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"
61 HOST_LDFLAGS="$HOST_LDFLAGS $HOST_LINKER_LDFLAGS"
63 if test "$COMPILE_ENVIRONMENT"; then
65 fi # COMPILE_ENVIRONMENT
67 dnl ========================================================
68 dnl Checks for compilers.
69 dnl ========================================================
71 if test "$COMPILE_ENVIRONMENT"; then
73 # Run some logic to figure out exe extensions (mostly for mingw's sake)
76 if test "$target" != "$host"; then
82 # Work around the conftest.exe access problem on Windows
86 AC_CHECK_PROGS(OTOOL, otool, :)
91 dnl ========================================================
92 dnl Special win32 checks
93 dnl ========================================================
99 if test "$GCC" != "yes"; then
100 # Check to see if we are really running in a msvc environemnt
103 # Make sure compilers are valid
104 CXXFLAGS="$CXXFLAGS -TP"
107 AC_TRY_COMPILE([#include <stdio.h>],
108 [ printf("Hello World\n"); ],,
109 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
112 AC_TRY_COMPILE([#include <new.h>],
113 [ unsigned *test = new unsigned(42); ],,
114 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
117 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
118 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
119 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
121 MSVC_C_RUNTIME_DLL=vcruntime140.dll
122 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
124 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
125 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
127 if test -n "$WIN_UCRT_REDIST_DIR"; then
128 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
129 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
131 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
134 AC_SUBST(MSVC_C_RUNTIME_DLL)
135 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
137 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
139 if test -n "$WIN32_REDIST_DIR"; then
140 if test ! -d "$WIN32_REDIST_DIR"; then
141 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
143 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
147 STL_FLAGS="-I${DIST}/stl_wrappers"
149 # Check w32api version
150 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
151 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
152 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
153 AC_TRY_COMPILE([#include <w32api.h>],
154 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
155 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
156 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
157 #error "test failed."
159 , [ res=yes ], [ res=no ])
160 AC_MSG_RESULT([$res])
161 if test "$res" != "yes"; then
162 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
164 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
165 # causing problems with local implementations with the same name.
166 AC_DEFINE(STRSAFE_NO_DEPRECATE)
169 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
170 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
172 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
173 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
174 # Require OS features provided by IE 8.0 (Win7)
175 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
180 if test -n "$_WIN32_MSVC"; then
182 SKIP_COMPILER_CHECKS=1
183 SKIP_LIBRARY_CHECKS=1
185 # Since we're skipping compiler and library checks, hard-code
188 AC_DEFINE(HAVE_ISATTY)
191 fi # COMPILE_ENVIRONMENT
196 AC_SUBST_LIST(STL_FLAGS)
197 AC_SUBST(WRAP_STL_INCLUDES)
199 dnl ========================================================
200 dnl set the defaults first
201 dnl ========================================================
202 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
204 dnl Configure platform-specific CPU architecture compiler options.
205 dnl ==============================================================
206 if test "$COMPILE_ENVIRONMENT"; then
208 fi # COMPILE_ENVIRONMENT
210 dnl ========================================================
211 dnl Android libstdc++
212 dnl ========================================================
214 if test "$COMPILE_ENVIRONMENT"; then
216 fi # COMPILE_ENVIRONMENT
218 if test -n "$COMPILE_ENVIRONMENT"; then
222 dnl ========================================================
223 dnl GNU specific defaults
224 dnl ========================================================
225 if test "$GNU_CC"; then
226 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
227 DSO_PIC_CFLAGS='-fPIC'
228 ASFLAGS="$ASFLAGS -fPIC"
231 AC_MSG_CHECKING([for --noexecstack option to as])
233 CFLAGS="$CFLAGS -Wa,--noexecstack"
234 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
235 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
238 AC_MSG_CHECKING([for -z noexecstack option to ld])
239 _SAVE_LDFLAGS=$LDFLAGS
240 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
241 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
243 LDFLAGS=$_SAVE_LDFLAGS)
245 AC_MSG_CHECKING([for -z text option to ld])
246 _SAVE_LDFLAGS=$LDFLAGS
247 LDFLAGS="$LDFLAGS -Wl,-z,text"
248 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
250 LDFLAGS=$_SAVE_LDFLAGS)
252 AC_MSG_CHECKING([for -z relro option to ld])
253 _SAVE_LDFLAGS=$LDFLAGS
254 LDFLAGS="$LDFLAGS -Wl,-z,relro"
255 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
257 LDFLAGS=$_SAVE_LDFLAGS)
259 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
260 _SAVE_LDFLAGS=$LDFLAGS
261 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
262 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
264 LDFLAGS=$_SAVE_LDFLAGS)
266 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
267 _SAVE_LDFLAGS=$LDFLAGS
268 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
269 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
271 LDFLAGS=$_SAVE_LDFLAGS)
273 if test -z "$DEVELOPER_OPTIONS" -o "$OS_TARGET" = "Android"; then
274 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
275 _SAVE_LDFLAGS=$LDFLAGS
276 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
277 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
279 LDFLAGS=$_SAVE_LDFLAGS)
282 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
283 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
284 _SAVE_LDFLAGS=$LDFLAGS
285 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
286 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
287 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
289 LDFLAGS=$_SAVE_LDFLAGS
292 if test "$GCC_USE_GNU_LD"; then
293 # Some tools like ASan use a runtime library that is only
294 # linked against executables, so we must allow undefined
295 # symbols for shared objects in some cases.
296 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
297 # Don't allow undefined symbols in libraries
298 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
300 # BSDs need `environ' exposed for posix_spawn (bug 753046)
302 DragonFly|FreeBSD|NetBSD|OpenBSD)
303 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
304 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
306 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
313 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
315 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
318 if test "$GNU_CXX"; then
319 CXXFLAGS="$CXXFLAGS -fno-exceptions"
321 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
324 dnl ========================================================
325 dnl System overrides of the defaults for host
326 dnl ========================================================
329 if test -n "$_WIN32_MSVC"; then
330 HOST_CFLAGS="$HOST_CFLAGS"
332 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
334 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
335 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
338 case "${host_cpu}" in
340 if test -n "$_WIN32_MSVC"; then
341 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
345 if test -n "$_WIN32_MSVC"; then
346 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
348 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
354 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
355 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
358 *-linux*|*-kfreebsd*-gnu|*-gnu*)
359 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
360 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
364 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
365 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
369 dnl ========================================================
370 dnl System overrides of the defaults for target
371 dnl ========================================================
375 MOZ_OPTIMIZE_FLAGS="-O3"
378 dnl DTrace and -dead_strip don't interact well. See bug 403132.
379 dnl ===================================================================
380 if test "x$enable_dtrace" = "xyes"; then
381 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
383 dnl check for the presence of the -dead_strip linker flag
384 AC_MSG_CHECKING([for -dead_strip option to ld])
385 _SAVE_LDFLAGS=$LDFLAGS
386 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
387 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
388 if test -n "$_HAVE_DEAD_STRIP" ; then
390 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
395 LDFLAGS=$_SAVE_LDFLAGS
401 *-android*|*-linuxandroid*)
402 if test -z "$CLANG_CC"; then
403 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
405 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
406 # -Oz is smaller than -Os on clang.
407 MOZ_OPTIMIZE_FLAGS="-Oz"
408 # Disable the outliner, which causes performance regressions, and is
409 # enabled on some platforms at -Oz.
410 if test -z "$MOZ_LTO"; then
411 DISABLE_OUTLINER="-mno-outline"
413 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
414 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
415 CFLAGS="$_SAVE_CFLAGS"
417 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
418 _SAVE_LDFLAGS=$LDFLAGS
419 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
420 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
421 LDFLAGS="$_SAVE_LDFLAGS"
427 if test "$GNU_CC" -o "$GNU_CXX"; then
428 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
429 if test -n "$MOZ_DEBUG"; then
430 MOZ_OPTIMIZE_FLAGS="-Os"
432 MOZ_OPTIMIZE_FLAGS="-O2"
434 if test -z "$CLANG_CC"; then
435 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
439 case "${target_cpu}" in
441 CFLAGS="$CFLAGS -mieee"
442 CXXFLAGS="$CXXFLAGS -mieee"
448 # certain versions of cygwin's makedepend barf on the
449 # #include <string> vs -I./dist/include/string issue so don't use it
450 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
451 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
452 if test -z "$CLANG_CC"; then
453 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
459 MOZ_OPTIMIZE_FLAGS="-O2"
461 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
462 WIN32_GUI_EXE_LDFLAGS=-mwindows
464 # Silence problematic clang warnings
465 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
466 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
468 TARGET_COMPILER_ABI=msvc
469 # aarch64 doesn't support subsystems below 6.02
470 if test "$CPU_ARCH" = "aarch64"; then
471 WIN32_SUBSYSTEM_VERSION=6.02
473 WIN32_SUBSYSTEM_VERSION=6.01
475 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
476 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
477 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
478 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
479 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
480 CFLAGS="$CFLAGS -Gy -Zc:inline"
481 CXXFLAGS="$CXXFLAGS -Gy -Zc:inline"
482 if test "$CPU_ARCH" = "x86"; then
483 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
484 dnl more recent, so set that explicitly here unless another
485 dnl target arch has already been set.
487 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
488 CFLAGS="$CFLAGS -arch:SSE2"
490 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
491 CXXFLAGS="$CXXFLAGS -arch:SSE2"
495 dnl VS2013+ supports -Gw for better linker optimizations.
496 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
497 dnl Disabled on ASan because it causes false-positive ODR violations.
498 if test -z "$MOZ_ASAN"; then
500 CXXFLAGS="$CXXFLAGS -Gw"
502 # String tail merging doesn't play nice with ASan's ODR checker.
503 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
505 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
506 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
507 MOZ_DEBUG_LDFLAGS='-DEBUG'
508 if test "$HOST_OS_ARCH" != "WINNT"; then
509 # %_PDB% is a special signal to emit only the PDB basename. This
510 # avoids problems in Windows tools that don't like forward-slashes.
511 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
513 MOZ_OPTIMIZE_FLAGS='-O2'
515 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
517 AC_DEFINE(WIN32_LEAN_AND_MEAN)
518 dnl See http://support.microsoft.com/kb/143208 to use STL
524 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.])
530 if test -n "$GNU_CC"; then
531 CFLAGS="$CFLAGS -mstackrealign"
532 CXXFLAGS="$CXXFLAGS -mstackrealign"
533 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
535 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
536 LDFLAGS="$LDFLAGS -SAFESEH"
542 if test -n "$_WIN32_MSVC"; then
543 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
548 if test -n "$_WIN32_MSVC"; then
549 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
554 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
560 CFLAGS="$CFLAGS -Dunix"
561 CXXFLAGS="$CXXFLAGS -Dunix"
562 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
563 DSO_PIC_CFLAGS='-fPIC -DPIC'
565 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
567 DSO_PIC_CFLAGS='-fPIC -DPIC'
570 # This will fail on a.out systems prior to 1.5.1_ALPHA.
571 if test "$LIBRUNPATH"; then
572 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
577 if test -z "$X11BASE"; then
580 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
581 DSO_PIC_CFLAGS='-fPIC'
582 DSO_LDOPTS='-shared -fPIC'
583 if test "$LIBRUNPATH"; then
584 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
589 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
594 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
595 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
597 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
598 MOZ_OPTIMIZE_FLAGS="-O"
602 if test -z "$COMPILE_ENVIRONMENT"; then
603 SKIP_COMPILER_CHECKS=1
604 SKIP_LIBRARY_CHECKS=1
608 fi # COMPILE_ENVIRONMENT
610 if test -z "$SKIP_COMPILER_CHECKS"; then
611 dnl Checks for typedefs, structures, and compiler characteristics.
612 dnl ========================================================
627 case "${OS_TARGET}" in
631 STL_FLAGS="-I${DIST}/stl_wrappers"
636 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
640 dnl Checks for header files.
641 dnl ========================================================
644 dnl Checks for libraries.
645 dnl ========================================================
646 AC_CHECK_LIB(c_r, gethostbyname_r)
648 dnl We don't want to link with libdl even if it's present on OS X, since
649 dnl it's not used and not part of the default installation. OS/2 has dlfcn
651 dnl We don't want to link against libm or libpthread on Darwin since
652 dnl they both are just symlinks to libSystem and explicitly linking
653 dnl against libSystem causes issues when debugging (see bug 299601).
658 AC_SEARCH_LIBS(dlopen, dl,
659 MOZ_CHECK_HEADER(dlfcn.h,
660 AC_DEFINE(HAVE_DLOPEN)))
664 _SAVE_CFLAGS="$CFLAGS"
665 CFLAGS="$CFLAGS -D_GNU_SOURCE"
666 AC_CHECK_FUNCS(dladdr)
667 CFLAGS="$_SAVE_CFLAGS"
669 if test ! "$GNU_CXX"; then
670 AC_CHECK_LIB(C, demangle)
673 AC_CHECK_LIB(socket, socket)
675 dnl ========================================================
676 dnl = pthread support
677 dnl = Start by checking whether the system support pthreads
678 dnl ========================================================
684 AC_CHECK_LIB(pthreads, pthread_create,
685 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
686 AC_CHECK_LIB(pthread, pthread_create,
687 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
688 AC_CHECK_LIB(c_r, pthread_create,
689 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
690 AC_CHECK_LIB(c, pthread_create,
699 dnl ========================================================
700 dnl Do the platform specific pthread hackery
701 dnl ========================================================
702 if test "$MOZ_USE_PTHREADS"x != x
705 dnl See if -pthread is supported.
708 ac_cv_have_dash_pthread=no
709 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
710 echo 'int main() { return 0; }' | cat > conftest.c
711 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
712 if test $? -eq 0; then
713 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
714 ac_cv_have_dash_pthread=yes
717 # Freebsd doesn't use -pthread for compiles, it uses them for linking
720 CFLAGS="$CFLAGS -pthread"
721 CXXFLAGS="$CXXFLAGS -pthread"
727 AC_MSG_RESULT($ac_cv_have_dash_pthread)
730 dnl See if -pthreads is supported.
732 ac_cv_have_dash_pthreads=no
733 if test "$ac_cv_have_dash_pthread" = "no"; then
734 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
735 echo 'int main() { return 0; }' | cat > conftest.c
736 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
737 if test $? -eq 0; then
738 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
739 ac_cv_have_dash_pthreads=yes
740 CFLAGS="$CFLAGS -pthreads"
741 CXXFLAGS="$CXXFLAGS -pthreads"
745 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
750 AC_DEFINE(_REENTRANT)
751 AC_DEFINE(_THREAD_SAFE)
752 dnl -pthread links in -lpthread, so don't specify it explicitly.
753 if test "$ac_cv_have_dash_pthread" = "yes"; then
754 _PTHREAD_LDFLAGS="-pthread"
758 *-*-openbsd*|*-*-bsdi*)
759 AC_DEFINE(_REENTRANT)
760 AC_DEFINE(_THREAD_SAFE)
761 dnl -pthread links in -lc_r, so don't specify it explicitly.
762 if test "$ac_cv_have_dash_pthread" = "yes"; then
763 _PTHREAD_LDFLAGS="-pthread"
767 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
768 AC_DEFINE(_REENTRANT)
772 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
773 AC_SUBST(MOZ_USE_PTHREADS)
774 MOZ_CHECK_HEADERS(pthread.h)
778 dnl Checks for library functions.
779 dnl ========================================================
781 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
782 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
783 ac_cv_clock_monotonic,
784 [for libs in "" -lrt; do
787 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
788 dnl we should or not be able to use it. To detect if we can, we need to make the
789 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
790 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
792 [ struct timespec ts;
793 clock_gettime(CLOCK_MONOTONIC, &ts); ],
794 ac_cv_clock_monotonic=$libs
797 ac_cv_clock_monotonic=no)
800 if test "$ac_cv_clock_monotonic" != "no"; then
801 HAVE_CLOCK_MONOTONIC=1
802 REALTIME_LIBS=$ac_cv_clock_monotonic
803 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
804 AC_SUBST(HAVE_CLOCK_MONOTONIC)
805 AC_SUBST_LIST(REALTIME_LIBS)
810 ac_cv_func_res_ninit,
811 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
812 dnl no need for res_ninit() on NetBSD and OpenBSD
813 ac_cv_func_res_ninit=no
817 #define _BSD_SOURCE 1
819 #include <sys/types.h>
820 #include <netinet/in.h>
821 #include <arpa/nameser.h>
824 [int foo = res_ninit(&_res);],
825 [ac_cv_func_res_ninit=yes],
826 [ac_cv_func_res_ninit=no])
830 if test "$ac_cv_func_res_ninit" = "yes"; then
831 AC_DEFINE(HAVE_RES_NINIT)
832 dnl must add the link line we do something as foolish as this... dougt
834 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
835 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
840 dnl ===================================================================
841 dnl ========================================================
842 dnl Put your C++ language/feature checks below
843 dnl ========================================================
847 if test "$GNU_CC"; then
848 if test "$CPU_ARCH" = "arm" ; then
849 AC_CACHE_CHECK(for ARM EABI,
853 #if defined(__ARM_EABI__)
859 ac_cv_gcc_arm_eabi="yes",
860 ac_cv_gcc_arm_eabi="no")])
861 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
869 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
872 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
873 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
874 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
876 _SAVE_LDFLAGS=$LDFLAGS
877 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
878 AC_CACHE_CHECK(for __thread keyword for TLS variables,
879 ac_cv_thread_keyword,
880 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
881 [return tlsIsMainThread;],
882 ac_cv_thread_keyword=yes,
883 ac_cv_thread_keyword=no)])
884 LDFLAGS=$_SAVE_LDFLAGS
885 # The custom dynamic linker doesn't support TLS variables
886 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
887 # mips builds fail with TLS variables because of a binutils bug.
889 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
894 *-android*|*-linuxandroid*)
901 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
906 if test -n "$MOZ_LINKER"; then
907 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
908 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
909 dnl Since the linker only understands the sysv ones, no need to build the
910 dnl gnu style tables anyways.
911 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
914 dnl End of C++ language/feature checks
917 fi # ! SKIP_COMPILER_CHECKS
919 if test -n "${COMPILE_ENVIRONMENT}"; then
924 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
925 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
926 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
929 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
930 dnl features that Windows actually does support.
932 if test -n "$SKIP_COMPILER_CHECKS"; then
933 dnl Windows has malloc.h
934 AC_DEFINE(MALLOC_H, [<malloc.h>])
935 AC_DEFINE(HAVE_FORCEINLINE)
936 fi # SKIP_COMPILER_CHECKS
938 dnl Mozilla specific options
939 dnl ========================================================
940 dnl The macros used for command line options
941 dnl are defined in build/autoconf/altoptions.m4.
943 dnl ========================================================
947 dnl ========================================================
949 MOZ_BRANDING_DIRECTORY=
950 MOZ_OFFICIAL_BRANDING=
952 MOZ_BINARY_EXTENSIONS=
955 dnl ========================================================
956 dnl = Trademarked Branding
957 dnl ========================================================
958 MOZ_ARG_ENABLE_BOOL(official-branding,
959 [ --enable-official-branding
960 Enable Official mozilla.org Branding
961 Do not distribute builds with
962 --enable-official-branding unless you have
963 permission to use trademarks per
964 http://www.mozilla.org/foundation/trademarks/ .],
965 MOZ_OFFICIAL_BRANDING=1,
966 MOZ_OFFICIAL_BRANDING=)
968 # Allow the application to influence configure with a confvars.sh script.
969 AC_MSG_CHECKING([if app-specific confvars.sh exists])
970 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
971 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
972 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
977 AC_SUBST(MOZ_OFFICIAL_BRANDING)
978 if test -n "$MOZ_OFFICIAL_BRANDING"; then
979 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
980 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
982 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
983 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
987 MOZ_ARG_WITH_STRING(branding,
988 [ --with-branding=dir Use branding from the specified directory.],
989 MOZ_BRANDING_DIRECTORY=$withval)
991 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
992 if test -z "$REAL_BRANDING_DIRECTORY"; then
993 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
996 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
997 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1000 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1002 dnl ========================================================
1003 dnl = Distribution ID
1004 dnl ========================================================
1005 MOZ_ARG_WITH_STRING(distribution-id,
1006 [ --with-distribution-id=ID
1007 Set distribution-specific id (default=org.mozilla)],
1008 [ val=`echo $withval`
1009 MOZ_DISTRIBUTION_ID="$val"])
1011 if test -z "$MOZ_DISTRIBUTION_ID"; then
1012 MOZ_DISTRIBUTION_ID="org.mozilla"
1015 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1016 AC_SUBST(MOZ_DISTRIBUTION_ID)
1018 dnl ========================================================
1019 dnl = Enable code optimization. ON by default.
1020 dnl ========================================================
1022 # Use value from moz.configure if one is defined. Else use our computed
1024 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1025 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1028 if test "$COMPILE_ENVIRONMENT"; then
1029 if test -n "$MOZ_OPTIMIZE"; then
1030 AC_MSG_CHECKING([for valid C compiler optimization flags])
1031 _SAVE_CFLAGS=$CFLAGS
1032 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1033 AC_TRY_COMPILE([#include <stdio.h>],
1034 [printf("Hello World\n");],
1037 AC_MSG_RESULT([$_results])
1038 if test "$_results" = "no"; then
1039 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1041 CFLAGS=$_SAVE_CFLAGS
1042 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1043 # When using llvm-based LTO, non numeric optimization levels are
1044 # not supported by the linker, so force the linker to use -O2 (
1045 # which doesn't influence the level compilation units are actually
1047 case " $MOZ_OPTIMIZE_FLAGS " in
1048 *\ -Os\ *|*\ -Oz\ *)
1049 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1054 fi # COMPILE_ENVIRONMENT
1056 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1057 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1058 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1060 case "${OS_TARGET}" in
1061 Android|WINNT|Darwin)
1062 MOZ_GLUE_IN_PROGRAM=
1065 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1066 MOZ_GLUE_IN_PROGRAM=1
1067 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1071 dnl ========================================================
1072 dnl = Jemalloc build setup
1073 dnl ========================================================
1074 if test -z "$MOZ_MEMORY"; then
1077 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1078 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.])
1083 dnl The generic feature tests that determine how to compute ncpus are long and
1084 dnl complicated. Therefore, simply define special cpp variables for the
1085 dnl platforms we have special knowledge of.
1088 export MOZ_NO_DEBUG_RTL=1
1092 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1094 dnl ========================================================
1095 dnl = Enable using the clang plugin to build
1096 dnl ========================================================
1098 if test -n "$COMPILE_ENVIRONMENT"; then
1099 MOZ_CONFIG_CLANG_PLUGIN
1100 fi # COMPILE_ENVIRONMENT
1102 if test -z "$SKIP_COMPILER_CHECKS"; then
1103 dnl ========================================================
1104 dnl Check for gcc -pipe support
1105 dnl ========================================================
1106 AC_MSG_CHECKING([for -pipe support])
1107 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1108 dnl Any gcc that supports firefox supports -pipe.
1109 CFLAGS="$CFLAGS -pipe"
1110 CXXFLAGS="$CXXFLAGS -pipe"
1111 AC_MSG_RESULT([yes])
1116 fi # ! SKIP_COMPILER_CHECKS
1120 if test "$COMPILE_ENVIRONMENT"; then
1122 fi # COMPILE_ENVIRONMENT
1124 dnl ========================================================
1125 dnl Check if we need the 32-bit Linux SSE2 error dialog
1126 dnl ========================================================
1128 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1130 dnl ========================================================
1132 dnl ========================================================
1134 if test "$OS_ARCH" = "WINNT"; then
1135 # For now we assume that we will have a uint64_t available through
1136 # one of the above headers or mozstdint.h.
1137 AC_DEFINE(HAVE_UINT64_T)
1140 case "$MOZ_WIDGET_TOOLKIT" in
1142 if test "$COMPILE_ENVIRONMENT"; then
1143 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1147 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1149 dnl ========================================================
1151 dnl = Maintainer debug option (no --enable equivalent)
1153 dnl ========================================================
1155 AC_SUBST_LIST(ASFLAGS)
1156 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1158 AC_SUBST(MOZ_STUB_INSTALLER)
1160 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1162 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1164 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1165 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1168 dnl ========================================================
1169 dnl = Mac bundle name prefix
1170 dnl ========================================================
1171 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1172 [ --with-macbundlename-prefix=prefix
1173 Prefix for MOZ_MACBUNDLE_NAME],
1174 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1176 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1177 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1178 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1181 if test "$MOZ_DEBUG"; then
1182 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1184 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1186 AC_SUBST(MOZ_MACBUNDLE_NAME)
1188 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1189 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1190 # Otherwise, use MOZ_APP_DISPLAYNAME
1191 if test -z "$MOZ_MACBUNDLE_ID"; then
1192 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1194 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1195 if test "$MOZ_DEBUG"; then
1196 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1199 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1200 AC_SUBST(MOZ_MACBUNDLE_ID)
1202 dnl ========================================================
1203 dnl = Child Process Name for IPC
1204 dnl ========================================================
1205 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1206 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1208 # We want to let Android unpack the file at install time, but it only does
1209 # so if the file is named libsomething.so. The lib/ path is also required
1210 # because the unpacked file will be under the lib/ subdirectory and will
1211 # need to be executed from that path.
1212 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1214 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1215 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
1217 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1218 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1219 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1221 # The following variables are available to branding and application
1222 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1223 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1224 # impacts profile location and user-visible fields.
1225 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1226 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1227 # builds (e.g. Aurora for Firefox).
1228 # - MOZ_APP_PROFILE: When set, used for application.ini's
1229 # "Profile" field, which controls profile location.
1230 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1231 # crash reporter server url.
1232 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1234 # The following environment variables used to have an effect, but don't anymore:
1235 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1236 # the contents from the version.txt file in the application directory, or
1237 # browser/config/version.txt if there isn't one.
1238 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1239 # in the "About" window. This was replaced with the contents from the
1240 # version_display.txt or version.txt in the application directory, or
1241 # browser/config/version_display.txt.
1243 # For extensions and langpacks, we require a max version that is compatible
1244 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1245 # 24.0a1 and 24.0a2 aren't affected
1247 # 24.1.1 becomes 24.*
1248 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1249 if test -z "$IS_ALPHA"; then
1251 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1252 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1254 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1258 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1261 AC_SUBST(MOZ_APP_DISPLAYNAME)
1262 AC_SUBST(MOZ_APP_VENDOR)
1263 AC_SUBST(MOZ_APP_PROFILE)
1264 AC_SUBST(MOZ_APP_ID)
1265 AC_SUBST(MAR_CHANNEL_ID)
1266 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1267 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1268 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1269 AC_SUBST(MOZ_APP_UA_NAME)
1270 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1271 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1272 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1274 AC_SUBST(MOZ_APP_MAXVERSION)
1275 AC_SUBST(MOZ_PKG_SPECIAL)
1276 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1278 if test "$MOZILLA_OFFICIAL"; then
1279 # Build revisions should always be present in official builds
1280 MOZ_INCLUDE_SOURCE_INFO=1
1283 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1284 # explicitly set the repository and changeset information in.
1285 AC_SUBST(MOZ_SOURCE_REPO)
1286 AC_SUBST(MOZ_SOURCE_CHANGESET)
1287 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1289 dnl If we have any service that uploads data (and requires data submission
1290 dnl policy alert), set MOZ_DATA_REPORTING.
1291 dnl We need SUBST for build system and DEFINE for xul preprocessor.
1292 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
1293 MOZ_DATA_REPORTING=1
1294 AC_DEFINE(MOZ_DATA_REPORTING)
1295 AC_SUBST(MOZ_DATA_REPORTING)
1299 AC_SUBST(WIN32_REDIST_DIR)
1300 AC_SUBST(WIN_UCRT_REDIST_DIR)
1302 dnl Echo the CFLAGS to remove extra whitespace.
1304 $_COMPILATION_CFLAGS \
1308 $_COMPILATION_CXXFLAGS \
1311 COMPILE_CFLAGS=`echo \
1315 COMPILE_CXXFLAGS=`echo \
1316 $_DEFINES_CXXFLAGS \
1320 $_COMPILATION_HOST_CFLAGS \
1323 HOST_CXXFLAGS=`echo \
1324 $_COMPILATION_HOST_CXXFLAGS \
1327 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1328 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1329 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1330 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1331 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1332 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1333 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1335 AC_SUBST(HOST_CMFLAGS)
1336 AC_SUBST(HOST_CMMFLAGS)
1337 AC_SUBST(OS_COMPILE_CMFLAGS)
1338 AC_SUBST(OS_COMPILE_CMMFLAGS)
1341 OS_CXXFLAGS="$CXXFLAGS"
1342 OS_CPPFLAGS="$CPPFLAGS"
1343 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1344 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1345 OS_LDFLAGS="$LDFLAGS"
1347 AC_SUBST_LIST(OS_CFLAGS)
1348 AC_SUBST_LIST(OS_CXXFLAGS)
1349 AC_SUBST_LIST(OS_CPPFLAGS)
1350 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1351 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1352 AC_SUBST_LIST(OS_LDFLAGS)
1357 AC_SUBST_LIST(HOST_CFLAGS)
1358 AC_SUBST_LIST(HOST_CPPFLAGS)
1359 AC_SUBST_LIST(HOST_CXXFLAGS)
1360 AC_SUBST(HOST_LDFLAGS)
1361 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1362 AC_SUBST(HOST_BIN_SUFFIX)
1364 AC_SUBST(TARGET_XPCOM_ABI)
1366 AC_SUBST(DSO_LDOPTS)
1367 AC_SUBST(BIN_SUFFIX)
1369 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1370 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1372 AC_SUBST(MOZ_DEVTOOLS)
1374 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1378 dnl Host JavaScript runtime, if any, to use during cross compiles.
1381 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1383 dnl Set various defines and substitutions
1384 dnl ========================================================
1386 AC_SUBST(MOZ_DEV_EDITION)
1387 if test -n "$MOZ_DEV_EDITION"; then
1388 AC_DEFINE(MOZ_DEV_EDITION)
1391 dnl Windows AccessibilityHandler
1392 dnl ========================================================
1394 if test -z "$MOZ_HANDLER_CLSID"; then
1395 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
1396 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
1397 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
1398 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
1401 AC_SUBST(MOZ_HANDLER_CLSID)
1402 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
1403 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
1404 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
1406 dnl Spit out some output
1407 dnl ========================================================
1409 # Avoid using obsolete NSPR features
1410 AC_DEFINE(NO_NSPR_10_SUPPORT)
1412 MOZ_CREATE_CONFIG_STATUS()
1414 rm -fr confdefs* $ac_clean_files