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 -Gy -Zc:inline"
490 CXXFLAGS="$CXXFLAGS -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 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
515 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
516 MOZ_DEBUG_LDFLAGS='-DEBUG'
517 if test "$HOST_OS_ARCH" != "WINNT"; then
518 # %_PDB% is a special signal to emit only the PDB basename. This
519 # avoids problems in Windows tools that don't like forward-slashes.
520 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
522 MOZ_OPTIMIZE_FLAGS='-O2'
524 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
526 AC_DEFINE(WIN32_LEAN_AND_MEAN)
527 dnl See http://support.microsoft.com/kb/143208 to use STL
533 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.])
539 if test -n "$GNU_CC"; then
540 CFLAGS="$CFLAGS -mstackrealign"
541 CXXFLAGS="$CXXFLAGS -mstackrealign"
542 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
544 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
545 LDFLAGS="$LDFLAGS -SAFESEH"
551 if test -n "$_WIN32_MSVC"; then
552 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
557 if test -n "$_WIN32_MSVC"; then
558 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
563 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
569 CFLAGS="$CFLAGS -Dunix"
570 CXXFLAGS="$CXXFLAGS -Dunix"
571 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
572 DSO_PIC_CFLAGS='-fPIC -DPIC'
574 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
576 DSO_PIC_CFLAGS='-fPIC -DPIC'
579 # This will fail on a.out systems prior to 1.5.1_ALPHA.
580 if test "$LIBRUNPATH"; then
581 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
586 if test -z "$X11BASE"; then
589 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
590 DSO_PIC_CFLAGS='-fPIC'
591 DSO_LDOPTS='-shared -fPIC'
592 if test "$LIBRUNPATH"; then
593 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
598 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
603 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
604 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
606 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
607 MOZ_OPTIMIZE_FLAGS="-O"
611 if test -z "$COMPILE_ENVIRONMENT"; then
612 SKIP_COMPILER_CHECKS=1
613 SKIP_LIBRARY_CHECKS=1
617 fi # COMPILE_ENVIRONMENT
619 if test -z "$SKIP_COMPILER_CHECKS"; then
620 dnl Checks for typedefs, structures, and compiler characteristics.
621 dnl ========================================================
636 case "${OS_TARGET}" in
640 STL_FLAGS="-I${DIST}/stl_wrappers"
645 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
649 dnl Checks for header files.
650 dnl ========================================================
653 dnl Checks for libraries.
654 dnl ========================================================
655 AC_CHECK_LIB(c_r, gethostbyname_r)
657 dnl We don't want to link with libdl even if it's present on OS X, since
658 dnl it's not used and not part of the default installation. OS/2 has dlfcn
660 dnl We don't want to link against libm or libpthread on Darwin since
661 dnl they both are just symlinks to libSystem and explicitly linking
662 dnl against libSystem causes issues when debugging (see bug 299601).
667 AC_SEARCH_LIBS(dlopen, dl,
668 MOZ_CHECK_HEADER(dlfcn.h,
669 AC_DEFINE(HAVE_DLOPEN)))
673 _SAVE_CFLAGS="$CFLAGS"
674 CFLAGS="$CFLAGS -D_GNU_SOURCE"
675 AC_CHECK_FUNCS(dladdr)
676 CFLAGS="$_SAVE_CFLAGS"
678 if test ! "$GNU_CXX"; then
679 AC_CHECK_LIB(C, demangle)
682 AC_CHECK_LIB(socket, socket)
684 dnl ========================================================
685 dnl = pthread support
686 dnl = Start by checking whether the system support pthreads
687 dnl ========================================================
693 AC_CHECK_LIB(pthreads, pthread_create,
694 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
695 AC_CHECK_LIB(pthread, pthread_create,
696 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
697 AC_CHECK_LIB(c_r, pthread_create,
698 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
699 AC_CHECK_LIB(c, pthread_create,
708 dnl ========================================================
709 dnl Do the platform specific pthread hackery
710 dnl ========================================================
711 if test "$MOZ_USE_PTHREADS"x != x
714 dnl See if -pthread is supported.
717 ac_cv_have_dash_pthread=no
718 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
719 echo 'int main() { return 0; }' | cat > conftest.c
720 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
721 if test $? -eq 0; then
722 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
723 ac_cv_have_dash_pthread=yes
726 # Freebsd doesn't use -pthread for compiles, it uses them for linking
729 CFLAGS="$CFLAGS -pthread"
730 CXXFLAGS="$CXXFLAGS -pthread"
736 AC_MSG_RESULT($ac_cv_have_dash_pthread)
739 dnl See if -pthreads is supported.
741 ac_cv_have_dash_pthreads=no
742 if test "$ac_cv_have_dash_pthread" = "no"; then
743 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
744 echo 'int main() { return 0; }' | cat > conftest.c
745 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
746 if test $? -eq 0; then
747 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
748 ac_cv_have_dash_pthreads=yes
749 CFLAGS="$CFLAGS -pthreads"
750 CXXFLAGS="$CXXFLAGS -pthreads"
754 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
759 AC_DEFINE(_REENTRANT)
760 AC_DEFINE(_THREAD_SAFE)
761 dnl -pthread links in -lpthread, so don't specify it explicitly.
762 if test "$ac_cv_have_dash_pthread" = "yes"; then
763 _PTHREAD_LDFLAGS="-pthread"
767 *-*-openbsd*|*-*-bsdi*)
768 AC_DEFINE(_REENTRANT)
769 AC_DEFINE(_THREAD_SAFE)
770 dnl -pthread links in -lc_r, so don't specify it explicitly.
771 if test "$ac_cv_have_dash_pthread" = "yes"; then
772 _PTHREAD_LDFLAGS="-pthread"
776 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
777 AC_DEFINE(_REENTRANT)
781 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
782 AC_SUBST(MOZ_USE_PTHREADS)
783 MOZ_CHECK_HEADERS(pthread.h)
787 dnl Checks for library functions.
788 dnl ========================================================
790 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
791 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
792 ac_cv_clock_monotonic,
793 [for libs in "" -lrt; do
796 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
797 dnl we should or not be able to use it. To detect if we can, we need to make the
798 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
799 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
801 [ struct timespec ts;
802 clock_gettime(CLOCK_MONOTONIC, &ts); ],
803 ac_cv_clock_monotonic=$libs
806 ac_cv_clock_monotonic=no)
809 if test "$ac_cv_clock_monotonic" != "no"; then
810 HAVE_CLOCK_MONOTONIC=1
811 REALTIME_LIBS=$ac_cv_clock_monotonic
812 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
813 AC_SUBST(HAVE_CLOCK_MONOTONIC)
814 AC_SUBST_LIST(REALTIME_LIBS)
819 ac_cv_func_res_ninit,
820 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
821 dnl no need for res_ninit() on NetBSD and OpenBSD
822 ac_cv_func_res_ninit=no
826 #define _BSD_SOURCE 1
828 #include <sys/types.h>
829 #include <netinet/in.h>
830 #include <arpa/nameser.h>
833 [int foo = res_ninit(&_res);],
834 [ac_cv_func_res_ninit=yes],
835 [ac_cv_func_res_ninit=no])
839 if test "$ac_cv_func_res_ninit" = "yes"; then
840 AC_DEFINE(HAVE_RES_NINIT)
841 dnl must add the link line we do something as foolish as this... dougt
843 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
844 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
849 dnl ===================================================================
850 dnl ========================================================
851 dnl Put your C++ language/feature checks below
852 dnl ========================================================
856 if test "$GNU_CC"; then
857 if test "$CPU_ARCH" = "arm" ; then
858 AC_CACHE_CHECK(for ARM EABI,
862 #if defined(__ARM_EABI__)
868 ac_cv_gcc_arm_eabi="yes",
869 ac_cv_gcc_arm_eabi="no")])
870 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
878 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
881 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
882 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
883 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
885 _SAVE_LDFLAGS=$LDFLAGS
886 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
887 AC_CACHE_CHECK(for __thread keyword for TLS variables,
888 ac_cv_thread_keyword,
889 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
890 [return tlsIsMainThread;],
891 ac_cv_thread_keyword=yes,
892 ac_cv_thread_keyword=no)])
893 LDFLAGS=$_SAVE_LDFLAGS
894 # The custom dynamic linker doesn't support TLS variables
895 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
896 # mips builds fail with TLS variables because of a binutils bug.
898 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
903 *-android*|*-linuxandroid*)
910 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
915 if test -n "$MOZ_LINKER"; then
916 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
917 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
918 dnl Since the linker only understands the sysv ones, no need to build the
919 dnl gnu style tables anyways.
920 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
923 dnl End of C++ language/feature checks
926 fi # ! SKIP_COMPILER_CHECKS
928 if test -n "${COMPILE_ENVIRONMENT}"; then
933 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
934 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
935 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
938 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
939 dnl features that Windows actually does support.
941 if test -n "$SKIP_COMPILER_CHECKS"; then
942 dnl Windows has malloc.h
943 AC_DEFINE(MALLOC_H, [<malloc.h>])
944 AC_DEFINE(HAVE_FORCEINLINE)
945 fi # SKIP_COMPILER_CHECKS
947 dnl Mozilla specific options
948 dnl ========================================================
949 dnl The macros used for command line options
950 dnl are defined in build/autoconf/altoptions.m4.
952 dnl ========================================================
956 dnl ========================================================
958 MOZ_BRANDING_DIRECTORY=
959 MOZ_OFFICIAL_BRANDING=
961 MOZ_BINARY_EXTENSIONS=
964 dnl ========================================================
965 dnl = Trademarked Branding
966 dnl ========================================================
967 MOZ_ARG_ENABLE_BOOL(official-branding,
968 [ --enable-official-branding
969 Enable Official mozilla.org Branding
970 Do not distribute builds with
971 --enable-official-branding unless you have
972 permission to use trademarks per
973 http://www.mozilla.org/foundation/trademarks/ .],
974 MOZ_OFFICIAL_BRANDING=1,
975 MOZ_OFFICIAL_BRANDING=)
977 # Allow the application to influence configure with a confvars.sh script.
978 AC_MSG_CHECKING([if app-specific confvars.sh exists])
979 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
980 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
981 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
986 AC_SUBST(MOZ_OFFICIAL_BRANDING)
987 if test -n "$MOZ_OFFICIAL_BRANDING"; then
988 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
989 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
991 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
992 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
996 MOZ_ARG_WITH_STRING(branding,
997 [ --with-branding=dir Use branding from the specified directory.],
998 MOZ_BRANDING_DIRECTORY=$withval)
1000 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1001 if test -z "$REAL_BRANDING_DIRECTORY"; then
1002 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1005 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1006 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1009 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1011 dnl ========================================================
1012 dnl = Distribution ID
1013 dnl ========================================================
1014 MOZ_ARG_WITH_STRING(distribution-id,
1015 [ --with-distribution-id=ID
1016 Set distribution-specific id (default=org.mozilla)],
1017 [ val=`echo $withval`
1018 MOZ_DISTRIBUTION_ID="$val"])
1020 if test -z "$MOZ_DISTRIBUTION_ID"; then
1021 MOZ_DISTRIBUTION_ID="org.mozilla"
1024 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1025 AC_SUBST(MOZ_DISTRIBUTION_ID)
1027 dnl ========================================================
1028 dnl = Enable code optimization. ON by default.
1029 dnl ========================================================
1031 # Use value from moz.configure if one is defined. Else use our computed
1033 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1034 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1037 if test "$COMPILE_ENVIRONMENT"; then
1038 if test -n "$MOZ_OPTIMIZE"; then
1039 AC_MSG_CHECKING([for valid C compiler optimization flags])
1040 _SAVE_CFLAGS=$CFLAGS
1041 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1042 AC_TRY_COMPILE([#include <stdio.h>],
1043 [printf("Hello World\n");],
1046 AC_MSG_RESULT([$_results])
1047 if test "$_results" = "no"; then
1048 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1050 CFLAGS=$_SAVE_CFLAGS
1051 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1052 # When using llvm-based LTO, non numeric optimization levels are
1053 # not supported by the linker, so force the linker to use -O2 (
1054 # which doesn't influence the level compilation units are actually
1056 case " $MOZ_OPTIMIZE_FLAGS " in
1057 *\ -Os\ *|*\ -Oz\ *)
1058 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1063 fi # COMPILE_ENVIRONMENT
1065 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1066 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1067 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1069 case "${OS_TARGET}" in
1070 Android|WINNT|Darwin)
1071 MOZ_GLUE_IN_PROGRAM=
1074 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1075 MOZ_GLUE_IN_PROGRAM=1
1076 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1080 dnl ========================================================
1081 dnl = Jemalloc build setup
1082 dnl ========================================================
1083 if test -z "$MOZ_MEMORY"; then
1086 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1087 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.])
1092 dnl The generic feature tests that determine how to compute ncpus are long and
1093 dnl complicated. Therefore, simply define special cpp variables for the
1094 dnl platforms we have special knowledge of.
1097 export MOZ_NO_DEBUG_RTL=1
1101 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1103 dnl ========================================================
1104 dnl = Enable using the clang plugin to build
1105 dnl ========================================================
1107 if test -n "$COMPILE_ENVIRONMENT"; then
1108 MOZ_CONFIG_CLANG_PLUGIN
1109 fi # COMPILE_ENVIRONMENT
1111 if test -z "$SKIP_COMPILER_CHECKS"; then
1112 dnl ========================================================
1113 dnl Check for gcc -pipe support
1114 dnl ========================================================
1115 AC_MSG_CHECKING([for -pipe support])
1116 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1117 dnl Any gcc that supports firefox supports -pipe.
1118 CFLAGS="$CFLAGS -pipe"
1119 CXXFLAGS="$CXXFLAGS -pipe"
1120 AC_MSG_RESULT([yes])
1125 fi # ! SKIP_COMPILER_CHECKS
1129 if test "$COMPILE_ENVIRONMENT"; then
1131 fi # COMPILE_ENVIRONMENT
1133 dnl ========================================================
1134 dnl Check if we need the 32-bit Linux SSE2 error dialog
1135 dnl ========================================================
1137 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1139 dnl ========================================================
1141 dnl ========================================================
1143 if test "$OS_ARCH" = "WINNT"; then
1144 # For now we assume that we will have a uint64_t available through
1145 # one of the above headers or mozstdint.h.
1146 AC_DEFINE(HAVE_UINT64_T)
1149 case "$MOZ_WIDGET_TOOLKIT" in
1151 if test "$COMPILE_ENVIRONMENT"; then
1152 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1156 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1158 dnl ========================================================
1160 dnl = Maintainer debug option (no --enable equivalent)
1162 dnl ========================================================
1164 AC_SUBST_LIST(ASFLAGS)
1165 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1166 AC_SUBST_LIST(WARNINGS_CFLAGS)
1168 AC_SUBST(MOZ_STUB_INSTALLER)
1170 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1172 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1174 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1175 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1178 dnl ========================================================
1179 dnl = Mac bundle name prefix
1180 dnl ========================================================
1181 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1182 [ --with-macbundlename-prefix=prefix
1183 Prefix for MOZ_MACBUNDLE_NAME],
1184 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1186 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1187 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1188 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1191 if test "$MOZ_DEBUG"; then
1192 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1194 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1196 AC_SUBST(MOZ_MACBUNDLE_NAME)
1198 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1199 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1200 # Otherwise, use MOZ_APP_DISPLAYNAME
1201 if test -z "$MOZ_MACBUNDLE_ID"; then
1202 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1204 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1205 if test "$MOZ_DEBUG"; then
1206 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1209 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1210 AC_SUBST(MOZ_MACBUNDLE_ID)
1212 dnl ========================================================
1213 dnl = Child Process Name for IPC
1214 dnl ========================================================
1215 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1216 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1218 # We want to let Android unpack the file at install time, but it only does
1219 # so if the file is named libsomething.so. The lib/ path is also required
1220 # because the unpacked file will be under the lib/ subdirectory and will
1221 # need to be executed from that path.
1222 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1224 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1225 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
1227 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1228 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1229 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1231 # The following variables are available to branding and application
1232 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1233 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1234 # impacts profile location and user-visible fields.
1235 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1236 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1237 # builds (e.g. Aurora for Firefox).
1238 # - MOZ_APP_PROFILE: When set, used for application.ini's
1239 # "Profile" field, which controls profile location.
1240 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1241 # crash reporter server url.
1242 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1244 # The following environment variables used to have an effect, but don't anymore:
1245 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1246 # the contents from the version.txt file in the application directory, or
1247 # browser/config/version.txt if there isn't one.
1248 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1249 # in the "About" window. This was replaced with the contents from the
1250 # version_display.txt or version.txt in the application directory, or
1251 # browser/config/version_display.txt.
1253 # For extensions and langpacks, we require a max version that is compatible
1254 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1255 # 24.0a1 and 24.0a2 aren't affected
1257 # 24.1.1 becomes 24.*
1258 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1259 if test -z "$IS_ALPHA"; then
1261 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1262 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1264 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1268 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1271 AC_SUBST(MOZ_APP_DISPLAYNAME)
1272 AC_SUBST(MOZ_APP_VENDOR)
1273 AC_SUBST(MOZ_APP_PROFILE)
1274 AC_SUBST(MOZ_APP_ID)
1275 AC_SUBST(MAR_CHANNEL_ID)
1276 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1277 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1278 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1279 AC_SUBST(MOZ_APP_UA_NAME)
1280 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1281 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1282 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1284 AC_SUBST(MOZ_APP_MAXVERSION)
1285 AC_SUBST(MOZ_PKG_SPECIAL)
1286 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1288 if test "$MOZILLA_OFFICIAL"; then
1289 # Build revisions should always be present in official builds
1290 MOZ_INCLUDE_SOURCE_INFO=1
1293 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1294 # explicitly set the repository and changeset information in.
1295 AC_SUBST(MOZ_SOURCE_REPO)
1296 AC_SUBST(MOZ_SOURCE_CHANGESET)
1297 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1299 dnl If we have any service that uploads data (and requires data submission
1300 dnl policy alert), set MOZ_DATA_REPORTING.
1301 dnl We need SUBST for build system and DEFINE for xul preprocessor.
1302 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
1303 MOZ_DATA_REPORTING=1
1304 AC_DEFINE(MOZ_DATA_REPORTING)
1305 AC_SUBST(MOZ_DATA_REPORTING)
1309 AC_SUBST(WIN32_REDIST_DIR)
1310 AC_SUBST(WIN_UCRT_REDIST_DIR)
1312 dnl Echo the CFLAGS to remove extra whitespace.
1314 $_COMPILATION_CFLAGS \
1318 $_WARNINGS_CXXFLAGS \
1319 $_COMPILATION_CXXFLAGS \
1322 COMPILE_CFLAGS=`echo \
1326 COMPILE_CXXFLAGS=`echo \
1327 $_DEFINES_CXXFLAGS \
1331 $_WARNINGS_HOST_CFLAGS \
1332 $_COMPILATION_HOST_CFLAGS \
1335 HOST_CXXFLAGS=`echo \
1336 $_WARNINGS_HOST_CXXFLAGS \
1337 $_COMPILATION_HOST_CXXFLAGS \
1340 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1341 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1342 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1343 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1344 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1345 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1346 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1348 AC_SUBST(HOST_CMFLAGS)
1349 AC_SUBST(HOST_CMMFLAGS)
1350 AC_SUBST(OS_COMPILE_CMFLAGS)
1351 AC_SUBST(OS_COMPILE_CMMFLAGS)
1354 OS_CXXFLAGS="$CXXFLAGS"
1355 OS_CPPFLAGS="$CPPFLAGS"
1356 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1357 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1358 OS_LDFLAGS="$LDFLAGS"
1360 AC_SUBST_LIST(OS_CFLAGS)
1361 AC_SUBST_LIST(OS_CXXFLAGS)
1362 AC_SUBST_LIST(OS_CPPFLAGS)
1363 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1364 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1365 AC_SUBST_LIST(OS_LDFLAGS)
1370 AC_SUBST_LIST(HOST_CFLAGS)
1371 AC_SUBST_LIST(HOST_CPPFLAGS)
1372 AC_SUBST_LIST(HOST_CXXFLAGS)
1373 AC_SUBST(HOST_LDFLAGS)
1374 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1375 AC_SUBST(HOST_BIN_SUFFIX)
1377 AC_SUBST(TARGET_XPCOM_ABI)
1379 AC_SUBST(DSO_LDOPTS)
1380 AC_SUBST(BIN_SUFFIX)
1382 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1383 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1385 AC_SUBST(MOZ_DEVTOOLS)
1387 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1391 dnl Host JavaScript runtime, if any, to use during cross compiles.
1394 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1396 dnl Set various defines and substitutions
1397 dnl ========================================================
1399 AC_SUBST(MOZ_DEV_EDITION)
1400 if test -n "$MOZ_DEV_EDITION"; then
1401 AC_DEFINE(MOZ_DEV_EDITION)
1404 dnl Windows AccessibilityHandler
1405 dnl ========================================================
1407 if test -z "$MOZ_HANDLER_CLSID"; then
1408 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
1409 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
1410 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
1411 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
1414 AC_SUBST(MOZ_HANDLER_CLSID)
1415 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
1416 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
1417 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
1419 dnl Spit out some output
1420 dnl ========================================================
1422 # Avoid using obsolete NSPR features
1423 AC_DEFINE(NO_NSPR_10_SUPPORT)
1425 MOZ_CREATE_CONFIG_STATUS()
1427 rm -fr confdefs* $ac_clean_files