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
66 dnl ========================================================
67 dnl Checks for compilers.
68 dnl ========================================================
70 if test "$COMPILE_ENVIRONMENT"; then
72 # Run some logic to figure out exe extensions (mostly for mingw's sake)
75 if test "$target" != "$host"; then
81 # Work around the conftest.exe access problem on Windows
85 AC_CHECK_PROGS(OTOOL, otool, :)
90 dnl ========================================================
91 dnl Special win32 checks
92 dnl ========================================================
98 if test "$GCC" != "yes"; then
99 # Check to see if we are really running in a msvc environemnt
102 # Make sure compilers are valid
103 CXXFLAGS="$CXXFLAGS -TP"
106 AC_TRY_COMPILE([#include <stdio.h>],
107 [ printf("Hello World\n"); ],,
108 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
111 AC_TRY_COMPILE([#include <new.h>],
112 [ unsigned *test = new unsigned(42); ],,
113 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
116 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
117 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
118 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
120 MSVC_C_RUNTIME_DLL=vcruntime140.dll
121 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
123 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
124 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
126 if test -n "$WIN_UCRT_REDIST_DIR"; then
127 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
128 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
130 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
133 AC_SUBST(MSVC_C_RUNTIME_DLL)
134 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
136 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
138 if test -n "$WIN32_REDIST_DIR"; then
139 if test ! -d "$WIN32_REDIST_DIR"; then
140 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
142 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
146 STL_FLAGS="-I${DIST}/stl_wrappers"
148 # Check w32api version
149 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
150 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
151 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
152 AC_TRY_COMPILE([#include <w32api.h>],
153 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
154 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
155 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
156 #error "test failed."
158 , [ res=yes ], [ res=no ])
159 AC_MSG_RESULT([$res])
160 if test "$res" != "yes"; then
161 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
163 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
164 # causing problems with local implementations with the same name.
165 AC_DEFINE(STRSAFE_NO_DEPRECATE)
168 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
169 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
171 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
172 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
173 # Require OS features provided by IE 8.0 (Win7)
174 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
179 if test -n "$_WIN32_MSVC"; then
181 SKIP_COMPILER_CHECKS=1
182 SKIP_LIBRARY_CHECKS=1
184 # Since we're skipping compiler and library checks, hard-code
187 AC_DEFINE(HAVE_ISATTY)
190 fi # COMPILE_ENVIRONMENT
195 AC_SUBST_LIST(STL_FLAGS)
196 AC_SUBST(WRAP_STL_INCLUDES)
198 dnl ========================================================
199 dnl set the defaults first
200 dnl ========================================================
201 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
203 dnl Configure platform-specific CPU architecture compiler options.
204 dnl ==============================================================
205 if test "$COMPILE_ENVIRONMENT"; then
207 fi # COMPILE_ENVIRONMENT
209 dnl ========================================================
210 dnl Android libstdc++
211 dnl ========================================================
213 if test "$COMPILE_ENVIRONMENT"; then
215 fi # COMPILE_ENVIRONMENT
217 dnl ========================================================
218 dnl Suppress Clang Argument Warnings
219 dnl ========================================================
220 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
221 if test -n "${CLANG_CC}${CLANG_CL}"; then
222 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
223 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
225 if test -n "${CLANG_CXX}${CLANG_CL}"; then
226 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
229 if test -n "$COMPILE_ENVIRONMENT"; then
233 dnl ========================================================
234 dnl GNU specific defaults
235 dnl ========================================================
236 if test "$GNU_CC"; then
237 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
238 DSO_PIC_CFLAGS='-fPIC'
239 ASFLAGS="$ASFLAGS -fPIC"
242 AC_MSG_CHECKING([for --noexecstack option to as])
244 CFLAGS="$CFLAGS -Wa,--noexecstack"
245 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
246 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
249 AC_MSG_CHECKING([for -z noexecstack option to ld])
250 _SAVE_LDFLAGS=$LDFLAGS
251 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
252 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
254 LDFLAGS=$_SAVE_LDFLAGS)
256 AC_MSG_CHECKING([for -z text option to ld])
257 _SAVE_LDFLAGS=$LDFLAGS
258 LDFLAGS="$LDFLAGS -Wl,-z,text"
259 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
261 LDFLAGS=$_SAVE_LDFLAGS)
263 AC_MSG_CHECKING([for -z relro option to ld])
264 _SAVE_LDFLAGS=$LDFLAGS
265 LDFLAGS="$LDFLAGS -Wl,-z,relro"
266 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
268 LDFLAGS=$_SAVE_LDFLAGS)
270 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
271 _SAVE_LDFLAGS=$LDFLAGS
272 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
273 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
275 LDFLAGS=$_SAVE_LDFLAGS)
277 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
278 _SAVE_LDFLAGS=$LDFLAGS
279 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
280 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
282 LDFLAGS=$_SAVE_LDFLAGS)
284 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
285 _SAVE_LDFLAGS=$LDFLAGS
286 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
287 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
289 LDFLAGS=$_SAVE_LDFLAGS)
291 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
292 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
293 _SAVE_LDFLAGS=$LDFLAGS
294 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
295 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
296 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
298 LDFLAGS=$_SAVE_LDFLAGS
301 if test "$GCC_USE_GNU_LD"; then
302 # Some tools like ASan use a runtime library that is only
303 # linked against executables, so we must allow undefined
304 # symbols for shared objects in some cases.
305 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
306 # Don't allow undefined symbols in libraries
307 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
309 # BSDs need `environ' exposed for posix_spawn (bug 753046)
311 DragonFly|FreeBSD|NetBSD|OpenBSD)
312 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
313 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
315 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
322 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
324 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
327 if test "$GNU_CXX"; then
328 CXXFLAGS="$CXXFLAGS -fno-exceptions"
330 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
333 dnl ========================================================
334 dnl System overrides of the defaults for host
335 dnl ========================================================
338 if test -n "$_WIN32_MSVC"; then
339 HOST_CFLAGS="$HOST_CFLAGS"
341 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
343 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
344 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
347 case "${host_cpu}" in
349 if test -n "$_WIN32_MSVC"; then
350 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
354 if test -n "$_WIN32_MSVC"; then
355 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
357 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
363 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
364 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
367 *-linux*|*-kfreebsd*-gnu|*-gnu*)
368 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
369 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
373 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
374 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
378 dnl ========================================================
379 dnl System overrides of the defaults for target
380 dnl ========================================================
384 MOZ_OPTIMIZE_FLAGS="-O3"
387 dnl DTrace and -dead_strip don't interact well. See bug 403132.
388 dnl ===================================================================
389 if test "x$enable_dtrace" = "xyes"; then
390 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
392 dnl check for the presence of the -dead_strip linker flag
393 AC_MSG_CHECKING([for -dead_strip option to ld])
394 _SAVE_LDFLAGS=$LDFLAGS
395 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
396 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
397 if test -n "$_HAVE_DEAD_STRIP" ; then
399 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
404 LDFLAGS=$_SAVE_LDFLAGS
410 *-android*|*-linuxandroid*)
411 if test -z "$CLANG_CC"; then
412 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
414 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
415 # -Oz is smaller than -Os on clang.
416 MOZ_OPTIMIZE_FLAGS="-Oz"
417 # Disable the outliner, which causes performance regressions, and is
418 # enabled on some platforms at -Oz.
419 if test -z "$MOZ_LTO"; then
420 DISABLE_OUTLINER="-mno-outline"
422 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
423 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
424 CFLAGS="$_SAVE_CFLAGS"
426 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
427 _SAVE_LDFLAGS=$LDFLAGS
428 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
429 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
430 LDFLAGS="$_SAVE_LDFLAGS"
436 if test "$GNU_CC" -o "$GNU_CXX"; then
437 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
438 if test -n "$MOZ_DEBUG"; then
439 MOZ_OPTIMIZE_FLAGS="-Os"
441 MOZ_OPTIMIZE_FLAGS="-O2"
443 if test -z "$CLANG_CC"; then
444 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
448 case "${target_cpu}" in
450 CFLAGS="$CFLAGS -mieee"
451 CXXFLAGS="$CXXFLAGS -mieee"
457 # certain versions of cygwin's makedepend barf on the
458 # #include <string> vs -I./dist/include/string issue so don't use it
459 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
460 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
461 if test -z "$CLANG_CC"; then
462 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
468 MOZ_OPTIMIZE_FLAGS="-O2"
470 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
471 WIN32_GUI_EXE_LDFLAGS=-mwindows
473 # Silence problematic clang warnings
474 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
475 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
477 TARGET_COMPILER_ABI=msvc
478 # aarch64 doesn't support subsystems below 6.02
479 if test "$CPU_ARCH" = "aarch64"; then
480 WIN32_SUBSYSTEM_VERSION=6.02
482 WIN32_SUBSYSTEM_VERSION=6.01
484 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
485 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
486 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
487 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
488 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
489 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
490 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
491 if test "$CPU_ARCH" = "x86"; then
492 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
493 dnl more recent, so set that explicitly here unless another
494 dnl target arch has already been set.
496 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
497 CFLAGS="$CFLAGS -arch:SSE2"
499 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
500 CXXFLAGS="$CXXFLAGS -arch:SSE2"
504 dnl VS2013+ supports -Gw for better linker optimizations.
505 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
506 dnl Disabled on ASan because it causes false-positive ODR violations.
507 if test -z "$MOZ_ASAN"; then
509 CXXFLAGS="$CXXFLAGS -Gw"
511 # String tail merging doesn't play nice with ASan's ODR checker.
512 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
514 # XXX We should combine some of these with our generic GCC-style
517 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
518 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
519 # We use offsetof on non-POD objects all the time.
520 # We also suppress this warning on other platforms.
521 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
522 # This warns for reasonable things like:
523 # enum { X = 0xffffffffU };
524 # which is annoying for IDL headers.
525 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
526 # This warns for cases that would be reached by the Microsoft
527 # #include rules, but also currently warns on cases that would
528 # *also* be reached by standard C++ include rules. That
529 # behavior doesn't seem useful, so we turn it off.
530 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
531 # We normally error out on unknown pragmas, but since clang-cl
532 # claims to be MSVC, it would be difficult to add
533 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
534 # use such pragmas, so just ignore them.
535 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
536 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
537 # We get errors about various #pragma intrinsic directives from
538 # clang-cl, and we don't need to hear about those.
539 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
540 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
541 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
542 # as __attribute((__deprecated__)). This is nice to know,
543 # but since we don't get the equivalent warning from MSVC,
544 # let's just ignore it.
545 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
546 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
547 # We use a function like:
548 # __declspec(noreturn) __inline void f() {}
549 # which -Winvalid-noreturn complains about. Again, MSVC seems
550 # OK with it, so let's silence the warning.
551 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
552 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
553 # Missing |override| on virtual function declarations isn't
554 # something that MSVC currently warns about.
555 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
556 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
557 # declaration on |operator delete(void*)|. However, clang-cl
558 # must internally declare |operator delete(void*)| differently,
559 # which causes this warning for virtually every file in the
560 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
561 # so there doesn't seem to be any way to convince clang-cl to
562 # declare |delete| differently. Therefore, suppress this
564 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
565 # Macros like STDMETHOD() and IFACEMETHOD() can declare
566 # __attribute__((nothrow)) on their respective method declarations,
567 # while the definitions are left without the matching attribute.
568 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
569 # At least one MSVC header and several headers in-tree have
570 # unused typedefs, so turn this on.
571 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
572 # jemalloc uses __declspec(allocator) as a profiler hint,
573 # which clang-cl doesn't understand.
574 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
575 # __attribute__((unused)) really means "might be unused" and
576 # we use it to avoid warnings about things that are unused
577 # in some compilation units, but used in many others. This
578 # warning insists on complaining about the latter case, which
579 # is annoying, and rather noisy.
580 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
581 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
582 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
583 MOZ_DEBUG_LDFLAGS='-DEBUG'
584 if test "$HOST_OS_ARCH" != "WINNT"; then
585 # %_PDB% is a special signal to emit only the PDB basename. This
586 # avoids problems in Windows tools that don't like forward-slashes.
587 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
589 MOZ_OPTIMIZE_FLAGS='-O2'
591 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
593 AC_DEFINE(WIN32_LEAN_AND_MEAN)
594 dnl See http://support.microsoft.com/kb/143208 to use STL
600 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.])
606 if test -n "$GNU_CC"; then
607 CFLAGS="$CFLAGS -mstackrealign"
608 CXXFLAGS="$CXXFLAGS -mstackrealign"
609 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
611 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
612 LDFLAGS="$LDFLAGS -SAFESEH"
618 if test -n "$_WIN32_MSVC"; then
619 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
624 if test -n "$_WIN32_MSVC"; then
625 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
630 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
636 CFLAGS="$CFLAGS -Dunix"
637 CXXFLAGS="$CXXFLAGS -Dunix"
638 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
639 DSO_PIC_CFLAGS='-fPIC -DPIC'
641 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
643 DSO_PIC_CFLAGS='-fPIC -DPIC'
646 # This will fail on a.out systems prior to 1.5.1_ALPHA.
647 if test "$LIBRUNPATH"; then
648 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
653 if test -z "$X11BASE"; then
656 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
657 DSO_PIC_CFLAGS='-fPIC'
658 DSO_LDOPTS='-shared -fPIC'
659 if test "$LIBRUNPATH"; then
660 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
665 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
670 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
671 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
673 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
674 MOZ_OPTIMIZE_FLAGS="-O"
678 if test -z "$COMPILE_ENVIRONMENT"; then
679 SKIP_COMPILER_CHECKS=1
680 SKIP_LIBRARY_CHECKS=1
684 fi # COMPILE_ENVIRONMENT
686 if test -z "$SKIP_COMPILER_CHECKS"; then
687 dnl Checks for typedefs, structures, and compiler characteristics.
688 dnl ========================================================
703 case "${OS_TARGET}" in
707 STL_FLAGS="-I${DIST}/stl_wrappers"
712 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
716 dnl Checks for header files.
717 dnl ========================================================
720 dnl Checks for libraries.
721 dnl ========================================================
722 AC_CHECK_LIB(c_r, gethostbyname_r)
724 dnl We don't want to link with libdl even if it's present on OS X, since
725 dnl it's not used and not part of the default installation. OS/2 has dlfcn
727 dnl We don't want to link against libm or libpthread on Darwin since
728 dnl they both are just symlinks to libSystem and explicitly linking
729 dnl against libSystem causes issues when debugging (see bug 299601).
734 AC_SEARCH_LIBS(dlopen, dl,
735 MOZ_CHECK_HEADER(dlfcn.h,
736 AC_DEFINE(HAVE_DLOPEN)))
740 _SAVE_CFLAGS="$CFLAGS"
741 CFLAGS="$CFLAGS -D_GNU_SOURCE"
742 AC_CHECK_FUNCS(dladdr)
743 CFLAGS="$_SAVE_CFLAGS"
745 if test ! "$GNU_CXX"; then
746 AC_CHECK_LIB(C, demangle)
749 AC_CHECK_LIB(socket, socket)
751 dnl ========================================================
752 dnl = pthread support
753 dnl = Start by checking whether the system support pthreads
754 dnl ========================================================
760 AC_CHECK_LIB(pthreads, pthread_create,
761 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
762 AC_CHECK_LIB(pthread, pthread_create,
763 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
764 AC_CHECK_LIB(c_r, pthread_create,
765 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
766 AC_CHECK_LIB(c, pthread_create,
775 dnl ========================================================
776 dnl Do the platform specific pthread hackery
777 dnl ========================================================
778 if test "$MOZ_USE_PTHREADS"x != x
781 dnl See if -pthread is supported.
784 ac_cv_have_dash_pthread=no
785 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
786 echo 'int main() { return 0; }' | cat > conftest.c
787 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
788 if test $? -eq 0; then
789 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
790 ac_cv_have_dash_pthread=yes
793 # Freebsd doesn't use -pthread for compiles, it uses them for linking
796 CFLAGS="$CFLAGS -pthread"
797 CXXFLAGS="$CXXFLAGS -pthread"
803 AC_MSG_RESULT($ac_cv_have_dash_pthread)
806 dnl See if -pthreads is supported.
808 ac_cv_have_dash_pthreads=no
809 if test "$ac_cv_have_dash_pthread" = "no"; then
810 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
811 echo 'int main() { return 0; }' | cat > conftest.c
812 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
813 if test $? -eq 0; then
814 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
815 ac_cv_have_dash_pthreads=yes
816 CFLAGS="$CFLAGS -pthreads"
817 CXXFLAGS="$CXXFLAGS -pthreads"
821 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
826 AC_DEFINE(_REENTRANT)
827 AC_DEFINE(_THREAD_SAFE)
828 dnl -pthread links in -lpthread, so don't specify it explicitly.
829 if test "$ac_cv_have_dash_pthread" = "yes"; then
830 _PTHREAD_LDFLAGS="-pthread"
834 *-*-openbsd*|*-*-bsdi*)
835 AC_DEFINE(_REENTRANT)
836 AC_DEFINE(_THREAD_SAFE)
837 dnl -pthread links in -lc_r, so don't specify it explicitly.
838 if test "$ac_cv_have_dash_pthread" = "yes"; then
839 _PTHREAD_LDFLAGS="-pthread"
843 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
844 AC_DEFINE(_REENTRANT)
848 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
849 AC_SUBST(MOZ_USE_PTHREADS)
850 MOZ_CHECK_HEADERS(pthread.h)
854 dnl Checks for library functions.
855 dnl ========================================================
857 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
858 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
859 ac_cv_clock_monotonic,
860 [for libs in "" -lrt; do
863 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
864 dnl we should or not be able to use it. To detect if we can, we need to make the
865 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
866 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
868 [ struct timespec ts;
869 clock_gettime(CLOCK_MONOTONIC, &ts); ],
870 ac_cv_clock_monotonic=$libs
873 ac_cv_clock_monotonic=no)
876 if test "$ac_cv_clock_monotonic" != "no"; then
877 HAVE_CLOCK_MONOTONIC=1
878 REALTIME_LIBS=$ac_cv_clock_monotonic
879 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
880 AC_SUBST(HAVE_CLOCK_MONOTONIC)
881 AC_SUBST_LIST(REALTIME_LIBS)
886 ac_cv_func_res_ninit,
887 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
888 dnl no need for res_ninit() on NetBSD and OpenBSD
889 ac_cv_func_res_ninit=no
893 #define _BSD_SOURCE 1
895 #include <sys/types.h>
896 #include <netinet/in.h>
897 #include <arpa/nameser.h>
900 [int foo = res_ninit(&_res);],
901 [ac_cv_func_res_ninit=yes],
902 [ac_cv_func_res_ninit=no])
906 if test "$ac_cv_func_res_ninit" = "yes"; then
907 AC_DEFINE(HAVE_RES_NINIT)
908 dnl must add the link line we do something as foolish as this... dougt
910 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
911 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
916 dnl ===================================================================
917 dnl ========================================================
918 dnl Put your C++ language/feature checks below
919 dnl ========================================================
923 if test "$GNU_CC"; then
924 if test "$CPU_ARCH" = "arm" ; then
925 AC_CACHE_CHECK(for ARM EABI,
929 #if defined(__ARM_EABI__)
935 ac_cv_gcc_arm_eabi="yes",
936 ac_cv_gcc_arm_eabi="no")])
937 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
945 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
948 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
949 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
950 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
952 _SAVE_LDFLAGS=$LDFLAGS
953 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
954 AC_CACHE_CHECK(for __thread keyword for TLS variables,
955 ac_cv_thread_keyword,
956 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
957 [return tlsIsMainThread;],
958 ac_cv_thread_keyword=yes,
959 ac_cv_thread_keyword=no)])
960 LDFLAGS=$_SAVE_LDFLAGS
961 # The custom dynamic linker doesn't support TLS variables
962 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
963 # mips builds fail with TLS variables because of a binutils bug.
965 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
970 *-android*|*-linuxandroid*)
977 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
982 if test -n "$MOZ_LINKER"; then
983 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
984 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
985 dnl Since the linker only understands the sysv ones, no need to build the
986 dnl gnu style tables anyways.
987 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
990 dnl End of C++ language/feature checks
993 fi # ! SKIP_COMPILER_CHECKS
995 if test -n "${COMPILE_ENVIRONMENT}"; then
1000 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1001 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1002 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1005 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1006 dnl features that Windows actually does support.
1008 if test -n "$SKIP_COMPILER_CHECKS"; then
1009 dnl Windows has malloc.h
1010 AC_DEFINE(MALLOC_H, [<malloc.h>])
1011 AC_DEFINE(HAVE_FORCEINLINE)
1012 fi # SKIP_COMPILER_CHECKS
1014 dnl Mozilla specific options
1015 dnl ========================================================
1016 dnl The macros used for command line options
1017 dnl are defined in build/autoconf/altoptions.m4.
1019 dnl ========================================================
1023 dnl ========================================================
1025 MOZ_BRANDING_DIRECTORY=
1026 MOZ_OFFICIAL_BRANDING=
1028 MOZ_BINARY_EXTENSIONS=
1031 dnl ========================================================
1032 dnl = Trademarked Branding
1033 dnl ========================================================
1034 MOZ_ARG_ENABLE_BOOL(official-branding,
1035 [ --enable-official-branding
1036 Enable Official mozilla.org Branding
1037 Do not distribute builds with
1038 --enable-official-branding unless you have
1039 permission to use trademarks per
1040 http://www.mozilla.org/foundation/trademarks/ .],
1041 MOZ_OFFICIAL_BRANDING=1,
1042 MOZ_OFFICIAL_BRANDING=)
1044 # Allow the application to influence configure with a confvars.sh script.
1045 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1046 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1047 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1048 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1053 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1054 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1055 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1056 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1058 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1059 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1063 MOZ_ARG_WITH_STRING(branding,
1064 [ --with-branding=dir Use branding from the specified directory.],
1065 MOZ_BRANDING_DIRECTORY=$withval)
1067 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1068 if test -z "$REAL_BRANDING_DIRECTORY"; then
1069 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1072 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1073 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1076 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1078 dnl ========================================================
1079 dnl = Distribution ID
1080 dnl ========================================================
1081 MOZ_ARG_WITH_STRING(distribution-id,
1082 [ --with-distribution-id=ID
1083 Set distribution-specific id (default=org.mozilla)],
1084 [ val=`echo $withval`
1085 MOZ_DISTRIBUTION_ID="$val"])
1087 if test -z "$MOZ_DISTRIBUTION_ID"; then
1088 MOZ_DISTRIBUTION_ID="org.mozilla"
1091 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1092 AC_SUBST(MOZ_DISTRIBUTION_ID)
1094 dnl ========================================================
1095 dnl = Enable code optimization. ON by default.
1096 dnl ========================================================
1098 # Use value from moz.configure if one is defined. Else use our computed
1100 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1101 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1104 if test "$COMPILE_ENVIRONMENT"; then
1105 if test -n "$MOZ_OPTIMIZE"; then
1106 AC_MSG_CHECKING([for valid C compiler optimization flags])
1107 _SAVE_CFLAGS=$CFLAGS
1108 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1109 AC_TRY_COMPILE([#include <stdio.h>],
1110 [printf("Hello World\n");],
1113 AC_MSG_RESULT([$_results])
1114 if test "$_results" = "no"; then
1115 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1117 CFLAGS=$_SAVE_CFLAGS
1118 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1119 # When using llvm-based LTO, non numeric optimization levels are
1120 # not supported by the linker, so force the linker to use -O2 (
1121 # which doesn't influence the level compilation units are actually
1123 case " $MOZ_OPTIMIZE_FLAGS " in
1124 *\ -Os\ *|*\ -Oz\ *)
1125 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1130 fi # COMPILE_ENVIRONMENT
1132 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1133 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1134 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1136 case "${OS_TARGET}" in
1137 Android|WINNT|Darwin)
1138 MOZ_GLUE_IN_PROGRAM=
1141 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1142 MOZ_GLUE_IN_PROGRAM=1
1143 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1147 dnl ========================================================
1148 dnl = Jemalloc build setup
1149 dnl ========================================================
1150 if test -z "$MOZ_MEMORY"; then
1153 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1154 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.])
1159 dnl The generic feature tests that determine how to compute ncpus are long and
1160 dnl complicated. Therefore, simply define special cpp variables for the
1161 dnl platforms we have special knowledge of.
1164 export MOZ_NO_DEBUG_RTL=1
1168 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1170 dnl ========================================================
1171 dnl = Enable using the clang plugin to build
1172 dnl ========================================================
1174 if test -n "$COMPILE_ENVIRONMENT"; then
1175 MOZ_CONFIG_CLANG_PLUGIN
1176 fi # COMPILE_ENVIRONMENT
1178 if test -z "$SKIP_COMPILER_CHECKS"; then
1179 dnl ========================================================
1180 dnl Check for gcc -pipe support
1181 dnl ========================================================
1182 AC_MSG_CHECKING([for -pipe support])
1183 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1184 dnl Any gcc that supports firefox supports -pipe.
1185 CFLAGS="$CFLAGS -pipe"
1186 CXXFLAGS="$CXXFLAGS -pipe"
1187 AC_MSG_RESULT([yes])
1192 fi # ! SKIP_COMPILER_CHECKS
1196 if test "$COMPILE_ENVIRONMENT"; then
1198 fi # COMPILE_ENVIRONMENT
1200 dnl ========================================================
1201 dnl Check if we need the 32-bit Linux SSE2 error dialog
1202 dnl ========================================================
1204 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1206 dnl ========================================================
1208 dnl ========================================================
1210 if test "$OS_ARCH" = "WINNT"; then
1211 # For now we assume that we will have a uint64_t available through
1212 # one of the above headers or mozstdint.h.
1213 AC_DEFINE(HAVE_UINT64_T)
1216 case "$MOZ_WIDGET_TOOLKIT" in
1218 if test "$COMPILE_ENVIRONMENT"; then
1219 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1223 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1225 dnl ========================================================
1227 dnl = Maintainer debug option (no --enable equivalent)
1229 dnl ========================================================
1231 AC_SUBST_LIST(ASFLAGS)
1232 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1233 AC_SUBST_LIST(WARNINGS_CFLAGS)
1235 AC_SUBST(MOZ_STUB_INSTALLER)
1237 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1239 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1241 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1242 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1245 dnl ========================================================
1246 dnl = Mac bundle name prefix
1247 dnl ========================================================
1248 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1249 [ --with-macbundlename-prefix=prefix
1250 Prefix for MOZ_MACBUNDLE_NAME],
1251 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1253 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1254 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1255 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1258 if test "$MOZ_DEBUG"; then
1259 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1261 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1263 AC_SUBST(MOZ_MACBUNDLE_NAME)
1265 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1266 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1267 # Otherwise, use MOZ_APP_DISPLAYNAME
1268 if test -z "$MOZ_MACBUNDLE_ID"; then
1269 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1271 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1272 if test "$MOZ_DEBUG"; then
1273 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1276 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1277 AC_SUBST(MOZ_MACBUNDLE_ID)
1279 dnl ========================================================
1280 dnl = Child Process Name for IPC
1281 dnl ========================================================
1282 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1283 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1285 # We want to let Android unpack the file at install time, but it only does
1286 # so if the file is named libsomething.so. The lib/ path is also required
1287 # because the unpacked file will be under the lib/ subdirectory and will
1288 # need to be executed from that path.
1289 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1291 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1292 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
1294 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1295 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1296 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1298 # The following variables are available to branding and application
1299 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1300 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1301 # impacts profile location and user-visible fields.
1302 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1303 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1304 # builds (e.g. Aurora for Firefox).
1305 # - MOZ_APP_PROFILE: When set, used for application.ini's
1306 # "Profile" field, which controls profile location.
1307 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1308 # crash reporter server url.
1309 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1311 # The following environment variables used to have an effect, but don't anymore:
1312 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1313 # the contents from the version.txt file in the application directory, or
1314 # browser/config/version.txt if there isn't one.
1315 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1316 # in the "About" window. This was replaced with the contents from the
1317 # version_display.txt or version.txt in the application directory, or
1318 # browser/config/version_display.txt.
1320 # For extensions and langpacks, we require a max version that is compatible
1321 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1322 # 24.0a1 and 24.0a2 aren't affected
1324 # 24.1.1 becomes 24.*
1325 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1326 if test -z "$IS_ALPHA"; then
1328 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1329 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1331 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1335 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1338 AC_SUBST(MOZ_APP_DISPLAYNAME)
1339 AC_SUBST(MOZ_APP_VENDOR)
1340 AC_SUBST(MOZ_APP_PROFILE)
1341 AC_SUBST(MOZ_APP_ID)
1342 AC_SUBST(MAR_CHANNEL_ID)
1343 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1344 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1345 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1346 AC_SUBST(MOZ_APP_UA_NAME)
1347 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1348 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1349 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1351 AC_SUBST(MOZ_APP_MAXVERSION)
1352 AC_SUBST(MOZ_PKG_SPECIAL)
1353 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1355 if test "$MOZILLA_OFFICIAL"; then
1356 # Build revisions should always be present in official builds
1357 MOZ_INCLUDE_SOURCE_INFO=1
1360 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1361 # explicitly set the repository and changeset information in.
1362 AC_SUBST(MOZ_SOURCE_REPO)
1363 AC_SUBST(MOZ_SOURCE_CHANGESET)
1364 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1366 dnl If we have any service that uploads data (and requires data submission
1367 dnl policy alert), set MOZ_DATA_REPORTING.
1368 dnl We need SUBST for build system and DEFINE for xul preprocessor.
1369 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
1370 MOZ_DATA_REPORTING=1
1371 AC_DEFINE(MOZ_DATA_REPORTING)
1372 AC_SUBST(MOZ_DATA_REPORTING)
1376 AC_SUBST(WIN32_REDIST_DIR)
1377 AC_SUBST(WIN_UCRT_REDIST_DIR)
1379 dnl Echo the CFLAGS to remove extra whitespace.
1381 $_COMPILATION_CFLAGS \
1385 $_WARNINGS_CXXFLAGS \
1386 $_COMPILATION_CXXFLAGS \
1389 COMPILE_CFLAGS=`echo \
1393 COMPILE_CXXFLAGS=`echo \
1394 $_DEFINES_CXXFLAGS \
1398 $_WARNINGS_HOST_CFLAGS \
1399 $_COMPILATION_HOST_CFLAGS \
1402 HOST_CXXFLAGS=`echo \
1403 $_WARNINGS_HOST_CXXFLAGS \
1404 $_COMPILATION_HOST_CXXFLAGS \
1407 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1408 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1409 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1410 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1411 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1412 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1413 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1415 AC_SUBST(HOST_CMFLAGS)
1416 AC_SUBST(HOST_CMMFLAGS)
1417 AC_SUBST(OS_COMPILE_CMFLAGS)
1418 AC_SUBST(OS_COMPILE_CMMFLAGS)
1421 OS_CXXFLAGS="$CXXFLAGS"
1422 OS_CPPFLAGS="$CPPFLAGS"
1423 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1424 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1425 OS_LDFLAGS="$LDFLAGS"
1427 AC_SUBST_LIST(OS_CFLAGS)
1428 AC_SUBST_LIST(OS_CXXFLAGS)
1429 AC_SUBST_LIST(OS_CPPFLAGS)
1430 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1431 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1432 AC_SUBST_LIST(OS_LDFLAGS)
1437 AC_SUBST_LIST(HOST_CFLAGS)
1438 AC_SUBST_LIST(HOST_CPPFLAGS)
1439 AC_SUBST_LIST(HOST_CXXFLAGS)
1440 AC_SUBST(HOST_LDFLAGS)
1441 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1442 AC_SUBST(HOST_BIN_SUFFIX)
1444 AC_SUBST(TARGET_XPCOM_ABI)
1446 AC_SUBST(DSO_LDOPTS)
1447 AC_SUBST(BIN_SUFFIX)
1449 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1450 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1452 AC_SUBST(MOZ_DEVTOOLS)
1454 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1458 dnl Host JavaScript runtime, if any, to use during cross compiles.
1461 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1463 dnl Set various defines and substitutions
1464 dnl ========================================================
1466 AC_SUBST(MOZ_DEV_EDITION)
1467 if test -n "$MOZ_DEV_EDITION"; then
1468 AC_DEFINE(MOZ_DEV_EDITION)
1471 dnl Windows AccessibilityHandler
1472 dnl ========================================================
1474 if test -z "$MOZ_HANDLER_CLSID"; then
1475 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
1476 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
1477 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
1478 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
1481 AC_SUBST(MOZ_HANDLER_CLSID)
1482 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
1483 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
1484 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
1486 dnl Spit out some output
1487 dnl ========================================================
1489 # Avoid using obsolete NSPR features
1490 AC_DEFINE(NO_NSPR_10_SUPPORT)
1492 MOZ_CREATE_CONFIG_STATUS()
1494 rm -fr confdefs* $ac_clean_files