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 if test -n "$COMPILE_ENVIRONMENT"; then
221 dnl ========================================================
222 dnl GNU specific defaults
223 dnl ========================================================
224 if test "$GNU_CC"; then
225 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
226 DSO_PIC_CFLAGS='-fPIC'
227 ASFLAGS="$ASFLAGS -fPIC"
230 AC_MSG_CHECKING([for --noexecstack option to as])
232 CFLAGS="$CFLAGS -Wa,--noexecstack"
233 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
234 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
237 AC_MSG_CHECKING([for -z noexecstack option to ld])
238 _SAVE_LDFLAGS=$LDFLAGS
239 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
240 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
242 LDFLAGS=$_SAVE_LDFLAGS)
244 AC_MSG_CHECKING([for -z text option to ld])
245 _SAVE_LDFLAGS=$LDFLAGS
246 LDFLAGS="$LDFLAGS -Wl,-z,text"
247 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
249 LDFLAGS=$_SAVE_LDFLAGS)
251 AC_MSG_CHECKING([for -z relro option to ld])
252 _SAVE_LDFLAGS=$LDFLAGS
253 LDFLAGS="$LDFLAGS -Wl,-z,relro"
254 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
256 LDFLAGS=$_SAVE_LDFLAGS)
258 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
259 _SAVE_LDFLAGS=$LDFLAGS
260 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
261 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
263 LDFLAGS=$_SAVE_LDFLAGS)
265 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
266 _SAVE_LDFLAGS=$LDFLAGS
267 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
268 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
270 LDFLAGS=$_SAVE_LDFLAGS)
272 if test -z "$DEVELOPER_OPTIONS" -o "$OS_TARGET" = "Android"; then
273 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
274 _SAVE_LDFLAGS=$LDFLAGS
275 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
276 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
278 LDFLAGS=$_SAVE_LDFLAGS)
281 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
282 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
283 _SAVE_LDFLAGS=$LDFLAGS
284 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
285 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
286 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
288 LDFLAGS=$_SAVE_LDFLAGS
291 if test "$GCC_USE_GNU_LD"; then
292 # Some tools like ASan use a runtime library that is only
293 # linked against executables, so we must allow undefined
294 # symbols for shared objects in some cases.
295 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
296 # Don't allow undefined symbols in libraries
297 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
299 # BSDs need `environ' exposed for posix_spawn (bug 753046)
301 DragonFly|FreeBSD|NetBSD|OpenBSD)
302 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
303 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
305 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
312 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
314 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
317 if test "$GNU_CXX"; then
318 CXXFLAGS="$CXXFLAGS -fno-exceptions"
320 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
323 dnl ========================================================
324 dnl System overrides of the defaults for host
325 dnl ========================================================
328 if test -n "$_WIN32_MSVC"; then
329 HOST_CFLAGS="$HOST_CFLAGS"
331 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
333 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
334 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
337 case "${host_cpu}" in
339 if test -n "$_WIN32_MSVC"; then
340 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
344 if test -n "$_WIN32_MSVC"; then
345 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
347 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
353 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
354 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
357 *-linux*|*-kfreebsd*-gnu|*-gnu*)
358 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
359 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
363 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
364 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
368 dnl ========================================================
369 dnl System overrides of the defaults for target
370 dnl ========================================================
374 MOZ_OPTIMIZE_FLAGS="-O3"
377 dnl DTrace and -dead_strip don't interact well. See bug 403132.
378 dnl ===================================================================
379 if test "x$enable_dtrace" = "xyes"; then
380 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
382 dnl check for the presence of the -dead_strip linker flag
383 AC_MSG_CHECKING([for -dead_strip option to ld])
384 _SAVE_LDFLAGS=$LDFLAGS
385 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
386 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
387 if test -n "$_HAVE_DEAD_STRIP" ; then
389 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
394 LDFLAGS=$_SAVE_LDFLAGS
400 *-android*|*-linuxandroid*)
401 if test -z "$CLANG_CC"; then
402 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
404 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
405 # -Oz is smaller than -Os on clang.
406 MOZ_OPTIMIZE_FLAGS="-Oz"
407 # Disable the outliner, which causes performance regressions, and is
408 # enabled on some platforms at -Oz.
409 if test -z "$MOZ_LTO"; then
410 DISABLE_OUTLINER="-mno-outline"
412 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
413 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
414 CFLAGS="$_SAVE_CFLAGS"
416 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
417 _SAVE_LDFLAGS=$LDFLAGS
418 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
419 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
420 LDFLAGS="$_SAVE_LDFLAGS"
426 if test "$GNU_CC" -o "$GNU_CXX"; then
427 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
428 if test -n "$MOZ_DEBUG"; then
429 MOZ_OPTIMIZE_FLAGS="-Os"
431 MOZ_OPTIMIZE_FLAGS="-O2"
433 if test -z "$CLANG_CC"; then
434 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
438 case "${target_cpu}" in
440 CFLAGS="$CFLAGS -mieee"
441 CXXFLAGS="$CXXFLAGS -mieee"
447 # certain versions of cygwin's makedepend barf on the
448 # #include <string> vs -I./dist/include/string issue so don't use it
449 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
450 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
451 if test -z "$CLANG_CC"; then
452 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
458 MOZ_OPTIMIZE_FLAGS="-O2"
460 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
461 WIN32_GUI_EXE_LDFLAGS=-mwindows
463 # Silence problematic clang warnings
464 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
465 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
467 TARGET_COMPILER_ABI=msvc
468 # aarch64 doesn't support subsystems below 6.02
469 if test "$CPU_ARCH" = "aarch64"; then
470 WIN32_SUBSYSTEM_VERSION=6.02
472 WIN32_SUBSYSTEM_VERSION=6.01
474 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
475 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
476 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
477 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
478 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
479 CFLAGS="$CFLAGS -Gy -Zc:inline"
480 CXXFLAGS="$CXXFLAGS -Gy -Zc:inline"
481 if test "$CPU_ARCH" = "x86"; then
482 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
483 dnl more recent, so set that explicitly here unless another
484 dnl target arch has already been set.
486 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
487 CFLAGS="$CFLAGS -arch:SSE2"
489 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
490 CXXFLAGS="$CXXFLAGS -arch:SSE2"
494 dnl VS2013+ supports -Gw for better linker optimizations.
495 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
496 dnl Disabled on ASan because it causes false-positive ODR violations.
497 if test -z "$MOZ_ASAN"; then
499 CXXFLAGS="$CXXFLAGS -Gw"
501 # String tail merging doesn't play nice with ASan's ODR checker.
502 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
504 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
505 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
506 MOZ_DEBUG_LDFLAGS='-DEBUG'
507 if test "$HOST_OS_ARCH" != "WINNT"; then
508 # %_PDB% is a special signal to emit only the PDB basename. This
509 # avoids problems in Windows tools that don't like forward-slashes.
510 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
512 MOZ_OPTIMIZE_FLAGS='-O2'
514 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
516 AC_DEFINE(WIN32_LEAN_AND_MEAN)
517 dnl See http://support.microsoft.com/kb/143208 to use STL
523 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.])
529 if test -n "$GNU_CC"; then
530 CFLAGS="$CFLAGS -mstackrealign"
531 CXXFLAGS="$CXXFLAGS -mstackrealign"
532 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
534 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
535 LDFLAGS="$LDFLAGS -SAFESEH"
541 if test -n "$_WIN32_MSVC"; then
542 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
547 if test -n "$_WIN32_MSVC"; then
548 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
553 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
559 CFLAGS="$CFLAGS -Dunix"
560 CXXFLAGS="$CXXFLAGS -Dunix"
561 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
562 DSO_PIC_CFLAGS='-fPIC -DPIC'
564 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
566 DSO_PIC_CFLAGS='-fPIC -DPIC'
569 # This will fail on a.out systems prior to 1.5.1_ALPHA.
570 if test "$LIBRUNPATH"; then
571 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
576 if test -z "$X11BASE"; then
579 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
580 DSO_PIC_CFLAGS='-fPIC'
581 DSO_LDOPTS='-shared -fPIC'
582 if test "$LIBRUNPATH"; then
583 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
588 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
593 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
594 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
596 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
597 MOZ_OPTIMIZE_FLAGS="-O"
601 if test -z "$COMPILE_ENVIRONMENT"; then
602 SKIP_COMPILER_CHECKS=1
603 SKIP_LIBRARY_CHECKS=1
607 fi # COMPILE_ENVIRONMENT
609 if test -z "$SKIP_COMPILER_CHECKS"; then
610 dnl Checks for typedefs, structures, and compiler characteristics.
611 dnl ========================================================
626 case "${OS_TARGET}" in
630 STL_FLAGS="-I${DIST}/stl_wrappers"
635 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
639 dnl Checks for header files.
640 dnl ========================================================
643 dnl Checks for libraries.
644 dnl ========================================================
645 AC_CHECK_LIB(c_r, gethostbyname_r)
647 dnl We don't want to link with libdl even if it's present on OS X, since
648 dnl it's not used and not part of the default installation. OS/2 has dlfcn
650 dnl We don't want to link against libm or libpthread on Darwin since
651 dnl they both are just symlinks to libSystem and explicitly linking
652 dnl against libSystem causes issues when debugging (see bug 299601).
657 AC_SEARCH_LIBS(dlopen, dl,
658 MOZ_CHECK_HEADER(dlfcn.h,
659 AC_DEFINE(HAVE_DLOPEN)))
663 _SAVE_CFLAGS="$CFLAGS"
664 CFLAGS="$CFLAGS -D_GNU_SOURCE"
665 AC_CHECK_FUNCS(dladdr)
666 CFLAGS="$_SAVE_CFLAGS"
668 if test ! "$GNU_CXX"; then
669 AC_CHECK_LIB(C, demangle)
672 AC_CHECK_LIB(socket, socket)
674 dnl ========================================================
675 dnl = pthread support
676 dnl = Start by checking whether the system support pthreads
677 dnl ========================================================
683 AC_CHECK_LIB(pthreads, pthread_create,
684 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
685 AC_CHECK_LIB(pthread, pthread_create,
686 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
687 AC_CHECK_LIB(c_r, pthread_create,
688 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
689 AC_CHECK_LIB(c, pthread_create,
698 dnl ========================================================
699 dnl Do the platform specific pthread hackery
700 dnl ========================================================
701 if test "$MOZ_USE_PTHREADS"x != x
704 dnl See if -pthread is supported.
707 ac_cv_have_dash_pthread=no
708 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
709 echo 'int main() { return 0; }' | cat > conftest.c
710 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
711 if test $? -eq 0; then
712 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
713 ac_cv_have_dash_pthread=yes
716 # Freebsd doesn't use -pthread for compiles, it uses them for linking
719 CFLAGS="$CFLAGS -pthread"
720 CXXFLAGS="$CXXFLAGS -pthread"
726 AC_MSG_RESULT($ac_cv_have_dash_pthread)
729 dnl See if -pthreads is supported.
731 ac_cv_have_dash_pthreads=no
732 if test "$ac_cv_have_dash_pthread" = "no"; then
733 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
734 echo 'int main() { return 0; }' | cat > conftest.c
735 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
736 if test $? -eq 0; then
737 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
738 ac_cv_have_dash_pthreads=yes
739 CFLAGS="$CFLAGS -pthreads"
740 CXXFLAGS="$CXXFLAGS -pthreads"
744 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
749 AC_DEFINE(_REENTRANT)
750 AC_DEFINE(_THREAD_SAFE)
751 dnl -pthread links in -lpthread, so don't specify it explicitly.
752 if test "$ac_cv_have_dash_pthread" = "yes"; then
753 _PTHREAD_LDFLAGS="-pthread"
757 *-*-openbsd*|*-*-bsdi*)
758 AC_DEFINE(_REENTRANT)
759 AC_DEFINE(_THREAD_SAFE)
760 dnl -pthread links in -lc_r, so don't specify it explicitly.
761 if test "$ac_cv_have_dash_pthread" = "yes"; then
762 _PTHREAD_LDFLAGS="-pthread"
766 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
767 AC_DEFINE(_REENTRANT)
771 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
772 AC_SUBST(MOZ_USE_PTHREADS)
773 MOZ_CHECK_HEADERS(pthread.h)
777 dnl Checks for library functions.
778 dnl ========================================================
780 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
781 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
782 ac_cv_clock_monotonic,
783 [for libs in "" -lrt; do
786 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
787 dnl we should or not be able to use it. To detect if we can, we need to make the
788 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
789 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
791 [ struct timespec ts;
792 clock_gettime(CLOCK_MONOTONIC, &ts); ],
793 ac_cv_clock_monotonic=$libs
796 ac_cv_clock_monotonic=no)
799 if test "$ac_cv_clock_monotonic" != "no"; then
800 HAVE_CLOCK_MONOTONIC=1
801 REALTIME_LIBS=$ac_cv_clock_monotonic
802 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
803 AC_SUBST(HAVE_CLOCK_MONOTONIC)
804 AC_SUBST_LIST(REALTIME_LIBS)
809 ac_cv_func_res_ninit,
810 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
811 dnl no need for res_ninit() on NetBSD and OpenBSD
812 ac_cv_func_res_ninit=no
816 #define _BSD_SOURCE 1
818 #include <sys/types.h>
819 #include <netinet/in.h>
820 #include <arpa/nameser.h>
823 [int foo = res_ninit(&_res);],
824 [ac_cv_func_res_ninit=yes],
825 [ac_cv_func_res_ninit=no])
829 if test "$ac_cv_func_res_ninit" = "yes"; then
830 AC_DEFINE(HAVE_RES_NINIT)
831 dnl must add the link line we do something as foolish as this... dougt
833 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
834 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
839 dnl ===================================================================
840 dnl ========================================================
841 dnl Put your C++ language/feature checks below
842 dnl ========================================================
846 if test "$GNU_CC"; then
847 if test "$CPU_ARCH" = "arm" ; then
848 AC_CACHE_CHECK(for ARM EABI,
852 #if defined(__ARM_EABI__)
858 ac_cv_gcc_arm_eabi="yes",
859 ac_cv_gcc_arm_eabi="no")])
860 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
868 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
871 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
872 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
873 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
875 _SAVE_LDFLAGS=$LDFLAGS
876 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
877 AC_CACHE_CHECK(for __thread keyword for TLS variables,
878 ac_cv_thread_keyword,
879 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
880 [return tlsIsMainThread;],
881 ac_cv_thread_keyword=yes,
882 ac_cv_thread_keyword=no)])
883 LDFLAGS=$_SAVE_LDFLAGS
884 # The custom dynamic linker doesn't support TLS variables
885 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
886 # mips builds fail with TLS variables because of a binutils bug.
888 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
893 *-android*|*-linuxandroid*)
900 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
905 if test -n "$MOZ_LINKER"; then
906 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
907 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
908 dnl Since the linker only understands the sysv ones, no need to build the
909 dnl gnu style tables anyways.
910 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
913 dnl End of C++ language/feature checks
916 fi # ! SKIP_COMPILER_CHECKS
918 if test -n "${COMPILE_ENVIRONMENT}"; then
923 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
924 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
925 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
928 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
929 dnl features that Windows actually does support.
931 if test -n "$SKIP_COMPILER_CHECKS"; then
932 dnl Windows has malloc.h
933 AC_DEFINE(MALLOC_H, [<malloc.h>])
934 AC_DEFINE(HAVE_FORCEINLINE)
935 fi # SKIP_COMPILER_CHECKS
937 dnl Mozilla specific options
938 dnl ========================================================
939 dnl The macros used for command line options
940 dnl are defined in build/autoconf/altoptions.m4.
942 dnl ========================================================
946 dnl ========================================================
948 MOZ_BRANDING_DIRECTORY=
949 MOZ_OFFICIAL_BRANDING=
951 MOZ_BINARY_EXTENSIONS=
954 dnl ========================================================
955 dnl = Trademarked Branding
956 dnl ========================================================
957 MOZ_ARG_ENABLE_BOOL(official-branding,
958 [ --enable-official-branding
959 Enable Official mozilla.org Branding
960 Do not distribute builds with
961 --enable-official-branding unless you have
962 permission to use trademarks per
963 http://www.mozilla.org/foundation/trademarks/ .],
964 MOZ_OFFICIAL_BRANDING=1,
965 MOZ_OFFICIAL_BRANDING=)
967 # Allow the application to influence configure with a confvars.sh script.
968 AC_MSG_CHECKING([if app-specific confvars.sh exists])
969 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
970 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
971 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
976 AC_SUBST(MOZ_OFFICIAL_BRANDING)
977 if test -n "$MOZ_OFFICIAL_BRANDING"; then
978 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
979 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
981 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
982 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
986 MOZ_ARG_WITH_STRING(branding,
987 [ --with-branding=dir Use branding from the specified directory.],
988 MOZ_BRANDING_DIRECTORY=$withval)
990 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
991 if test -z "$REAL_BRANDING_DIRECTORY"; then
992 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
995 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
996 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
999 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1001 dnl ========================================================
1002 dnl = Distribution ID
1003 dnl ========================================================
1004 MOZ_ARG_WITH_STRING(distribution-id,
1005 [ --with-distribution-id=ID
1006 Set distribution-specific id (default=org.mozilla)],
1007 [ val=`echo $withval`
1008 MOZ_DISTRIBUTION_ID="$val"])
1010 if test -z "$MOZ_DISTRIBUTION_ID"; then
1011 MOZ_DISTRIBUTION_ID="org.mozilla"
1014 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1015 AC_SUBST(MOZ_DISTRIBUTION_ID)
1017 dnl ========================================================
1018 dnl = Enable code optimization. ON by default.
1019 dnl ========================================================
1021 # Use value from moz.configure if one is defined. Else use our computed
1023 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1024 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1027 if test "$COMPILE_ENVIRONMENT"; then
1028 if test -n "$MOZ_OPTIMIZE"; then
1029 AC_MSG_CHECKING([for valid C compiler optimization flags])
1030 _SAVE_CFLAGS=$CFLAGS
1031 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1032 AC_TRY_COMPILE([#include <stdio.h>],
1033 [printf("Hello World\n");],
1036 AC_MSG_RESULT([$_results])
1037 if test "$_results" = "no"; then
1038 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1040 CFLAGS=$_SAVE_CFLAGS
1041 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1042 # When using llvm-based LTO, non numeric optimization levels are
1043 # not supported by the linker, so force the linker to use -O2 (
1044 # which doesn't influence the level compilation units are actually
1046 case " $MOZ_OPTIMIZE_FLAGS " in
1047 *\ -Os\ *|*\ -Oz\ *)
1048 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1053 fi # COMPILE_ENVIRONMENT
1055 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1056 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1057 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1059 case "${OS_TARGET}" in
1060 Android|WINNT|Darwin)
1061 MOZ_GLUE_IN_PROGRAM=
1064 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1065 MOZ_GLUE_IN_PROGRAM=1
1066 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1070 dnl ========================================================
1071 dnl = Jemalloc build setup
1072 dnl ========================================================
1073 if test -z "$MOZ_MEMORY"; then
1076 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1077 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.])
1082 dnl The generic feature tests that determine how to compute ncpus are long and
1083 dnl complicated. Therefore, simply define special cpp variables for the
1084 dnl platforms we have special knowledge of.
1087 export MOZ_NO_DEBUG_RTL=1
1091 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1093 dnl ========================================================
1094 dnl = Enable using the clang plugin to build
1095 dnl ========================================================
1097 if test -n "$COMPILE_ENVIRONMENT"; then
1098 MOZ_CONFIG_CLANG_PLUGIN
1099 fi # COMPILE_ENVIRONMENT
1101 if test -z "$SKIP_COMPILER_CHECKS"; then
1102 dnl ========================================================
1103 dnl Check for gcc -pipe support
1104 dnl ========================================================
1105 AC_MSG_CHECKING([for -pipe support])
1106 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1107 dnl Any gcc that supports firefox supports -pipe.
1108 CFLAGS="$CFLAGS -pipe"
1109 CXXFLAGS="$CXXFLAGS -pipe"
1110 AC_MSG_RESULT([yes])
1115 fi # ! SKIP_COMPILER_CHECKS
1119 if test "$COMPILE_ENVIRONMENT"; then
1121 fi # COMPILE_ENVIRONMENT
1123 dnl ========================================================
1124 dnl Check if we need the 32-bit Linux SSE2 error dialog
1125 dnl ========================================================
1127 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1129 dnl ========================================================
1131 dnl ========================================================
1133 if test "$OS_ARCH" = "WINNT"; then
1134 # For now we assume that we will have a uint64_t available through
1135 # one of the above headers or mozstdint.h.
1136 AC_DEFINE(HAVE_UINT64_T)
1139 case "$MOZ_WIDGET_TOOLKIT" in
1141 if test "$COMPILE_ENVIRONMENT"; then
1142 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1146 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1148 dnl ========================================================
1150 dnl = Maintainer debug option (no --enable equivalent)
1152 dnl ========================================================
1154 AC_SUBST_LIST(ASFLAGS)
1155 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1157 AC_SUBST(MOZ_STUB_INSTALLER)
1159 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1161 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1163 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1164 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1167 dnl ========================================================
1168 dnl = Mac bundle name prefix
1169 dnl ========================================================
1170 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1171 [ --with-macbundlename-prefix=prefix
1172 Prefix for MOZ_MACBUNDLE_NAME],
1173 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1175 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1176 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1177 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1180 if test "$MOZ_DEBUG"; then
1181 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1183 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1185 AC_SUBST(MOZ_MACBUNDLE_NAME)
1187 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1188 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1189 # Otherwise, use MOZ_APP_DISPLAYNAME
1190 if test -z "$MOZ_MACBUNDLE_ID"; then
1191 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1193 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1194 if test "$MOZ_DEBUG"; then
1195 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1198 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1199 AC_SUBST(MOZ_MACBUNDLE_ID)
1201 dnl ========================================================
1202 dnl = Child Process Name for IPC
1203 dnl ========================================================
1204 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1205 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1207 # We want to let Android unpack the file at install time, but it only does
1208 # so if the file is named libsomething.so. The lib/ path is also required
1209 # because the unpacked file will be under the lib/ subdirectory and will
1210 # need to be executed from that path.
1211 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1213 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1214 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
1216 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1217 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1218 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1220 # The following variables are available to branding and application
1221 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1222 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1223 # impacts profile location and user-visible fields.
1224 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1225 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1226 # builds (e.g. Aurora for Firefox).
1227 # - MOZ_APP_PROFILE: When set, used for application.ini's
1228 # "Profile" field, which controls profile location.
1229 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1230 # crash reporter server url.
1231 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1233 # The following environment variables used to have an effect, but don't anymore:
1234 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1235 # the contents from the version.txt file in the application directory, or
1236 # browser/config/version.txt if there isn't one.
1237 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1238 # in the "About" window. This was replaced with the contents from the
1239 # version_display.txt or version.txt in the application directory, or
1240 # browser/config/version_display.txt.
1242 # For extensions and langpacks, we require a max version that is compatible
1243 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1244 # 24.0a1 and 24.0a2 aren't affected
1246 # 24.1.1 becomes 24.*
1247 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1248 if test -z "$IS_ALPHA"; then
1250 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1251 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1253 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1257 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1260 AC_SUBST(MOZ_APP_DISPLAYNAME)
1261 AC_SUBST(MOZ_APP_VENDOR)
1262 AC_SUBST(MOZ_APP_PROFILE)
1263 AC_SUBST(MOZ_APP_ID)
1264 AC_SUBST(MAR_CHANNEL_ID)
1265 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1266 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1267 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1268 AC_SUBST(MOZ_APP_UA_NAME)
1269 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1270 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1271 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1273 AC_SUBST(MOZ_APP_MAXVERSION)
1274 AC_SUBST(MOZ_PKG_SPECIAL)
1275 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1277 if test "$MOZILLA_OFFICIAL"; then
1278 # Build revisions should always be present in official builds
1279 MOZ_INCLUDE_SOURCE_INFO=1
1282 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1283 # explicitly set the repository and changeset information in.
1284 AC_SUBST(MOZ_SOURCE_REPO)
1285 AC_SUBST(MOZ_SOURCE_CHANGESET)
1286 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1288 dnl If we have any service that uploads data (and requires data submission
1289 dnl policy alert), set MOZ_DATA_REPORTING.
1290 dnl We need SUBST for build system and DEFINE for xul preprocessor.
1291 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
1292 MOZ_DATA_REPORTING=1
1293 AC_DEFINE(MOZ_DATA_REPORTING)
1294 AC_SUBST(MOZ_DATA_REPORTING)
1298 AC_SUBST(WIN32_REDIST_DIR)
1299 AC_SUBST(WIN_UCRT_REDIST_DIR)
1301 dnl Echo the CFLAGS to remove extra whitespace.
1303 $_COMPILATION_CFLAGS \
1307 $_COMPILATION_CXXFLAGS \
1310 COMPILE_CFLAGS=`echo \
1314 COMPILE_CXXFLAGS=`echo \
1315 $_DEFINES_CXXFLAGS \
1319 $_COMPILATION_HOST_CFLAGS \
1322 HOST_CXXFLAGS=`echo \
1323 $_COMPILATION_HOST_CXXFLAGS \
1326 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1327 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1328 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1329 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1330 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1331 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1332 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1334 AC_SUBST(HOST_CMFLAGS)
1335 AC_SUBST(HOST_CMMFLAGS)
1336 AC_SUBST(OS_COMPILE_CMFLAGS)
1337 AC_SUBST(OS_COMPILE_CMMFLAGS)
1340 OS_CXXFLAGS="$CXXFLAGS"
1341 OS_CPPFLAGS="$CPPFLAGS"
1342 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1343 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1344 OS_LDFLAGS="$LDFLAGS"
1346 AC_SUBST_LIST(OS_CFLAGS)
1347 AC_SUBST_LIST(OS_CXXFLAGS)
1348 AC_SUBST_LIST(OS_CPPFLAGS)
1349 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1350 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1351 AC_SUBST_LIST(OS_LDFLAGS)
1356 AC_SUBST_LIST(HOST_CFLAGS)
1357 AC_SUBST_LIST(HOST_CPPFLAGS)
1358 AC_SUBST_LIST(HOST_CXXFLAGS)
1359 AC_SUBST(HOST_LDFLAGS)
1360 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1361 AC_SUBST(HOST_BIN_SUFFIX)
1363 AC_SUBST(TARGET_XPCOM_ABI)
1365 AC_SUBST(DSO_LDOPTS)
1366 AC_SUBST(BIN_SUFFIX)
1368 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1369 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1371 AC_SUBST(MOZ_DEVTOOLS)
1373 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1377 dnl Host JavaScript runtime, if any, to use during cross compiles.
1380 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1382 dnl Set various defines and substitutions
1383 dnl ========================================================
1385 AC_SUBST(MOZ_DEV_EDITION)
1386 if test -n "$MOZ_DEV_EDITION"; then
1387 AC_DEFINE(MOZ_DEV_EDITION)
1390 dnl Windows AccessibilityHandler
1391 dnl ========================================================
1393 if test -z "$MOZ_HANDLER_CLSID"; then
1394 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
1395 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
1396 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
1397 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
1400 AC_SUBST(MOZ_HANDLER_CLSID)
1401 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
1402 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
1403 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
1405 dnl Spit out some output
1406 dnl ========================================================
1408 # Avoid using obsolete NSPR features
1409 AC_DEFINE(NO_NSPR_10_SUPPORT)
1411 MOZ_CREATE_CONFIG_STATUS()
1413 rm -fr confdefs* $ac_clean_files