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 version number of the libs included with mozilla
47 dnl ========================================================
53 dnl Set the minimum version of toolkit libs used by mozilla
54 dnl ========================================================
56 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
57 # The macro won't be used when compiling with earlier versions anyway.
58 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
62 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
66 dnl Set various checks
67 dnl ========================================================
70 dnl Initialize the Pthread test variables early so they can be
71 dnl overridden by each platform.
72 dnl ========================================================
76 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
78 if test "$COMPILE_ENVIRONMENT"; then
80 fi # COMPILE_ENVIRONMENT
83 *-android*|*-linuxandroid*)
86 AC_PATH_PROG(OBJCOPY,objcopy)
90 AC_SUBST(ANDROID_PACKAGE_NAME)
93 dnl ========================================================
94 dnl Checks for compilers.
95 dnl ========================================================
97 if test "$COMPILE_ENVIRONMENT"; then
99 if test "$target" != "$host"; then
105 # Work around the conftest.exe access problem on Windows
110 MOZ_PATH_PROGS(AS, $AS as, $CC)
111 AC_CHECK_PROGS(STRIP, strip, :)
112 AC_CHECK_PROGS(OTOOL, otool, :)
115 if test -n "$MOZ_WINCONSOLE"; then
116 AC_DEFINE(MOZ_WINCONSOLE)
121 dnl ========================================================
122 dnl Special win32 checks
123 dnl ========================================================
129 if test "$GCC" != "yes"; then
130 # Check to see if we are really running in a msvc environemnt
133 # Make sure compilers are valid
134 CXXFLAGS="$CXXFLAGS -TP"
137 AC_TRY_COMPILE([#include <stdio.h>],
138 [ printf("Hello World\n"); ],,
139 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
142 AC_TRY_COMPILE([#include <new.h>],
143 [ unsigned *test = new unsigned(42); ],,
144 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
148 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
151 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
152 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
153 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
156 MSVC_C_RUNTIME_DLL=vcruntime140.dll
157 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
159 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
160 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
162 if test -n "$WIN_UCRT_REDIST_DIR"; then
163 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
164 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
166 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
169 AC_SUBST(MSVC_C_RUNTIME_DLL)
170 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
172 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
174 if test -n "$WIN32_REDIST_DIR"; then
175 if test ! -d "$WIN32_REDIST_DIR"; then
176 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
178 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
181 # Check linker version, except in lld builds
186 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
187 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
188 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
189 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
196 unset _MSVC_VER_FILTER
199 STL_FLAGS="-I${DIST}/stl_wrappers"
201 # Check w32api version
202 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
203 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
204 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
205 AC_TRY_COMPILE([#include <w32api.h>],
206 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
207 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
208 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
209 #error "test failed."
211 , [ res=yes ], [ res=no ])
212 AC_MSG_RESULT([$res])
213 if test "$res" != "yes"; then
214 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
216 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
217 # causing problems with local implementations with the same name.
218 AC_DEFINE(STRSAFE_NO_DEPRECATE)
221 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
222 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
224 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
225 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
226 # Require OS features provided by IE 8.0 (Win7)
227 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
232 if test -n "$_WIN32_MSVC"; then
234 SKIP_COMPILER_CHECKS=1
235 SKIP_LIBRARY_CHECKS=1
237 # Since we're skipping compiler and library checks, hard-code
240 AC_DEFINE(HAVE_ISATTY)
243 fi # COMPILE_ENVIRONMENT
248 AC_SUBST_LIST(STL_FLAGS)
249 AC_SUBST(WRAP_STL_INCLUDES)
251 dnl ========================================================
252 dnl Checks for programs.
253 dnl ========================================================
254 if test "$COMPILE_ENVIRONMENT"; then
260 fi # COMPILE_ENVIRONMENT
262 dnl ========================================================
263 dnl set the defaults first
264 dnl ========================================================
265 MOZ_USER_DIR=".mozilla"
267 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
271 dnl Configure platform-specific CPU architecture compiler options.
272 dnl ==============================================================
273 if test "$COMPILE_ENVIRONMENT"; then
275 fi # COMPILE_ENVIRONMENT
277 dnl ========================================================
278 dnl Android libstdc++
279 dnl ========================================================
282 if test "$COMPILE_ENVIRONMENT"; then
284 fi # COMPILE_ENVIRONMENT
286 dnl ========================================================
287 dnl Suppress Clang Argument Warnings
288 dnl ========================================================
289 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
290 if test -n "${CLANG_CC}${CLANG_CL}"; then
291 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
292 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
294 if test -n "${CLANG_CXX}${CLANG_CL}"; then
295 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
298 if test -n "$COMPILE_ENVIRONMENT"; then
302 dnl ========================================================
303 dnl GNU specific defaults
304 dnl ========================================================
305 if test "$GNU_CC"; then
309 SSSE3_FLAGS="-mssse3"
310 CFLAGS="$CFLAGS -fno-strict-aliasing"
313 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
314 DSO_PIC_CFLAGS='-fPIC'
315 ASFLAGS="$ASFLAGS -fPIC"
318 AC_MSG_CHECKING([for --noexecstack option to as])
320 CFLAGS="$CFLAGS -Wa,--noexecstack"
321 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
322 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
325 AC_MSG_CHECKING([for -z noexecstack option to ld])
326 _SAVE_LDFLAGS=$LDFLAGS
327 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
328 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
330 LDFLAGS=$_SAVE_LDFLAGS)
332 AC_MSG_CHECKING([for -z text option to ld])
333 _SAVE_LDFLAGS=$LDFLAGS
334 LDFLAGS="$LDFLAGS -Wl,-z,text"
335 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
337 LDFLAGS=$_SAVE_LDFLAGS)
339 AC_MSG_CHECKING([for -z relro option to ld])
340 _SAVE_LDFLAGS=$LDFLAGS
341 LDFLAGS="$LDFLAGS -Wl,-z,relro"
342 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
344 LDFLAGS=$_SAVE_LDFLAGS)
346 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
347 _SAVE_LDFLAGS=$LDFLAGS
348 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
349 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
351 LDFLAGS=$_SAVE_LDFLAGS)
353 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
354 _SAVE_LDFLAGS=$LDFLAGS
355 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
356 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
358 LDFLAGS=$_SAVE_LDFLAGS)
360 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
361 _SAVE_LDFLAGS=$LDFLAGS
362 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
363 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
365 LDFLAGS=$_SAVE_LDFLAGS)
367 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
368 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
369 _SAVE_LDFLAGS=$LDFLAGS
370 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
371 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
372 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
374 LDFLAGS=$_SAVE_LDFLAGS
376 # Check for -mssse3 on $CC
377 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
378 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
380 CFLAGS="$CFLAGS -mssse3"
381 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
382 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
386 # Check for -msse4.1 on $CC
387 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
388 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
390 CFLAGS="$CFLAGS -msse4.1"
391 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
392 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
396 case "${CPU_ARCH}" in
398 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
400 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
401 result="yes", result="no")
402 AC_MSG_RESULT("$result")
403 if test "$result" = "yes"; then
409 AC_MSG_CHECKING([whether we can enable AltiVec support])
412 CFLAGS="$CFLAGS -maltivec"
413 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
421 if test "$GCC_USE_GNU_LD"; then
422 # Some tools like ASan use a runtime library that is only
423 # linked against executables, so we must allow undefined
424 # symbols for shared objects in some cases.
425 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
426 # Don't allow undefined symbols in libraries
427 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
429 # BSDs need `environ' exposed for posix_spawn (bug 753046)
431 DragonFly|FreeBSD|NetBSD|OpenBSD)
432 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
433 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
435 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
442 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
444 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
447 if test "$GNU_CXX"; then
448 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
450 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
453 # For profiling builds keep the symbol information
454 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
456 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
457 STRIP_FLAGS="--strip-debug"
462 dnl ========================================================
464 dnl ========================================================
466 if test "$MOZ_DMD"; then
467 if test "${CPU_ARCH}" = "arm"; then
468 CFLAGS="$CFLAGS -funwind-tables"
469 CXXFLAGS="$CXXFLAGS -funwind-tables"
473 dnl ========================================================
474 dnl System overrides of the defaults for host
475 dnl ========================================================
478 if test -n "$_WIN32_MSVC"; then
479 HOST_CFLAGS="$HOST_CFLAGS"
481 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
483 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
484 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
487 case "${host_cpu}" in
489 if test -n "$_WIN32_MSVC"; then
490 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
494 if test -n "$_WIN32_MSVC"; then
495 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
497 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
503 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
504 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
507 *-linux*|*-kfreebsd*-gnu|*-gnu*)
508 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
509 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
513 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
514 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
518 dnl ========================================================
519 dnl System overrides of the defaults for target
520 dnl ========================================================
524 MOZ_OPTIMIZE_FLAGS="-O3"
525 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
527 STRIP_FLAGS="$STRIP_FLAGS -x -S"
528 # The ExceptionHandling framework is needed for Objective-C exception
529 # logging code in nsObjCExceptions.h. Currently we only use that in debug
531 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
533 dnl DTrace and -dead_strip don't interact well. See bug 403132.
534 dnl ===================================================================
535 if test "x$enable_dtrace" = "xyes"; then
536 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
538 dnl check for the presence of the -dead_strip linker flag
539 AC_MSG_CHECKING([for -dead_strip option to ld])
540 _SAVE_LDFLAGS=$LDFLAGS
541 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
542 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
543 if test -n "$_HAVE_DEAD_STRIP" ; then
545 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
550 LDFLAGS=$_SAVE_LDFLAGS
553 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
556 *-android*|*-linuxandroid*)
557 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
561 MOZ_GFX_OPTIMIZE_MOBILE=1
562 if test -z "$CLANG_CC"; then
563 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
564 elif test -n "$RELEASE_OR_BETA"; then
565 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
566 # -Oz is smaller than -Os on clang.
567 MOZ_OPTIMIZE_FLAGS="-Oz"
568 # Disable the outliner, which causes performance regressions, and is
569 # enabled on some platforms at -Oz.
570 if test -z "$MOZ_LTO"; then
571 DISABLE_OUTLINER="-mno-outline"
573 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
574 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
575 CFLAGS="$_SAVE_CFLAGS"
577 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
578 _SAVE_LDFLAGS=$LDFLAGS
579 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
580 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
581 LDFLAGS="$_SAVE_LDFLAGS"
584 MOZ_OPTIMIZE_FLAGS="-O2"
589 if test "$GNU_CC" -o "$GNU_CXX"; then
590 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
591 if test -n "$MOZ_DEBUG"; then
592 MOZ_OPTIMIZE_FLAGS="-Os"
594 MOZ_OPTIMIZE_FLAGS="-O2"
596 if test -z "$CLANG_CC"; then
597 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
601 case "${target_cpu}" in
603 CFLAGS="$CFLAGS -mieee"
604 CXXFLAGS="$CXXFLAGS -mieee"
611 # certain versions of cygwin's makedepend barf on the
612 # #include <string> vs -I./dist/include/string issue so don't use it
613 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
614 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
615 if test -z "$CLANG_CC"; then
616 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
620 # Use temp file for windres (bug 213281)
621 RCFLAGS='-O coff --use-temp-file'
622 # mingw doesn't require kernel32, user32, and advapi32 explicitly
623 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
626 MOZ_OPTIMIZE_FLAGS="-O2"
628 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
629 WIN32_GUI_EXE_LDFLAGS=-mwindows
631 # Silence problematic clang warnings
632 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
633 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
635 TARGET_COMPILER_ABI=msvc
636 RANLIB='echo not_ranlib'
637 STRIP='echo not_strip'
639 # aarch64 doesn't support subsystems below 6.02
640 if test "$CPU_ARCH" = "aarch64"; then
641 WIN32_SUBSYSTEM_VERSION=6.02
643 WIN32_SUBSYSTEM_VERSION=6.01
645 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
646 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
647 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
648 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
649 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
650 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
651 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
652 if test -z "$CLANG_CL"; then
653 CPPFLAGS="$CPPFLAGS -utf-8"
655 if test "$CPU_ARCH" = "x86"; then
656 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
657 dnl more recent, so set that explicitly here unless another
658 dnl target arch has already been set.
660 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
661 CFLAGS="$CFLAGS -arch:SSE2"
663 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
664 CXXFLAGS="$CXXFLAGS -arch:SSE2"
667 SSE_FLAGS="-arch:SSE"
668 SSE2_FLAGS="-arch:SSE2"
669 dnl MSVC allows the use of intrinsics without any flags
670 dnl and doesn't have a separate arch for SSSE3
671 SSSE3_FLAGS="-arch:SSE2"
673 dnl clang-cl requires appropriate flags to enable SSSE3 support
674 dnl on all architectures.
675 if test -n "$CLANG_CL"; then
676 SSSE3_FLAGS="-mssse3"
678 dnl VS2013+ supports -Gw for better linker optimizations.
679 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
680 dnl Disabled on ASan because it causes false-positive ODR violations.
681 if test -z "$MOZ_ASAN"; then
683 CXXFLAGS="$CXXFLAGS -Gw"
685 # String tail merging doesn't play nice with ASan's ODR checker.
686 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
688 if test -n "$CLANG_CL"; then
689 # XXX We should combine some of these with our generic GCC-style
692 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
693 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
694 # We use offsetof on non-POD objects all the time.
695 # We also suppress this warning on other platforms.
696 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
697 # This warns for reasonable things like:
698 # enum { X = 0xffffffffU };
699 # which is annoying for IDL headers.
700 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
701 # This warns for cases that would be reached by the Microsoft
702 # #include rules, but also currently warns on cases that would
703 # *also* be reached by standard C++ include rules. That
704 # behavior doesn't seem useful, so we turn it off.
705 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
706 # We normally error out on unknown pragmas, but since clang-cl
707 # claims to be MSVC, it would be difficult to add
708 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
709 # use such pragmas, so just ignore them.
710 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
711 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
712 # We get errors about various #pragma intrinsic directives from
713 # clang-cl, and we don't need to hear about those.
714 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
715 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
716 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
717 # as __attribute((__deprecated__)). This is nice to know,
718 # but since we don't get the equivalent warning from MSVC,
719 # let's just ignore it.
720 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
721 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
722 # We use a function like:
723 # __declspec(noreturn) __inline void f() {}
724 # which -Winvalid-noreturn complains about. Again, MSVC seems
725 # OK with it, so let's silence the warning.
726 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
727 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
728 # Missing |override| on virtual function declarations isn't
729 # something that MSVC currently warns about.
730 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
731 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
732 # declaration on |operator delete(void*)|. However, clang-cl
733 # must internally declare |operator delete(void*)| differently,
734 # which causes this warning for virtually every file in the
735 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
736 # so there doesn't seem to be any way to convince clang-cl to
737 # declare |delete| differently. Therefore, suppress this
739 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
740 # Macros like STDMETHOD() and IFACEMETHOD() can declare
741 # __attribute__((nothrow)) on their respective method declarations,
742 # while the definitions are left without the matching attribute.
743 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
744 # At least one MSVC header and several headers in-tree have
745 # unused typedefs, so turn this on.
746 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
747 # jemalloc uses __declspec(allocator) as a profiler hint,
748 # which clang-cl doesn't understand.
749 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
750 # __attribute__((unused)) really means "might be unused" and
751 # we use it to avoid warnings about things that are unused
752 # in some compilation units, but used in many others. This
753 # warning insists on complaining about the latter case, which
754 # is annoying, and rather noisy.
755 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
757 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
758 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
759 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
760 MOZ_DEBUG_LDFLAGS='-DEBUG'
761 # Use a higher optimization level for clang-cl, so we can come closer
762 # to MSVC's performance numbers (see bug 1443590).
763 if test -n "$CLANG_CL"; then
764 MOZ_OPTIMIZE_FLAGS='-O2'
766 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
769 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
770 if test -z "$DEVELOPER_OPTIONS"; then
771 LDFLAGS="$LDFLAGS -RELEASE"
774 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
775 dnl both SSSE3 and SSE4.1.
776 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
777 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
778 dnl allow AVX2 code from VS2015
781 AC_DEFINE(WIN32_LEAN_AND_MEAN)
782 dnl See http://support.microsoft.com/kb/143208 to use STL
785 MOZ_USER_DIR="Mozilla"
789 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.])
795 if test -n "$GNU_CC"; then
796 CFLAGS="$CFLAGS -mstackrealign"
797 CXXFLAGS="$CXXFLAGS -mstackrealign"
798 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
800 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
801 LDFLAGS="$LDFLAGS -SAFESEH"
807 if test -n "$_WIN32_MSVC"; then
808 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
813 if test -n "$_WIN32_MSVC"; then
814 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
819 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
826 CFLAGS="$CFLAGS -Dunix"
827 CXXFLAGS="$CXXFLAGS -Dunix"
828 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
829 DSO_PIC_CFLAGS='-fPIC -DPIC'
831 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
833 DSO_PIC_CFLAGS='-fPIC -DPIC'
836 # This will fail on a.out systems prior to 1.5.1_ALPHA.
837 if test "$LIBRUNPATH"; then
838 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
843 if test -z "$X11BASE"; then
846 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
848 DSO_PIC_CFLAGS='-fPIC'
849 DSO_LDOPTS='-shared -fPIC'
850 if test "$LIBRUNPATH"; then
851 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
856 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
861 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
862 MOZ_OPTIMIZE_FLAGS="-O"
865 AC_SUBST_LIST(MMX_FLAGS)
866 AC_SUBST_LIST(SSE_FLAGS)
867 AC_SUBST_LIST(SSE2_FLAGS)
868 AC_SUBST_LIST(SSSE3_FLAGS)
871 if test -n "$MOZ_LINKER"; then
872 AC_DEFINE(MOZ_LINKER)
874 AC_CHECK_PROGS(XZ, xz)
877 if test -z "$COMPILE_ENVIRONMENT"; then
878 SKIP_COMPILER_CHECKS=1
879 SKIP_LIBRARY_CHECKS=1
884 fi # COMPILE_ENVIRONMENT
886 if test -z "$SKIP_COMPILER_CHECKS"; then
887 dnl Checks for typedefs, structures, and compiler characteristics.
888 dnl ========================================================
903 case "${OS_TARGET}" in
907 STL_FLAGS="-I${DIST}/stl_wrappers"
912 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
916 dnl Checks for header files.
917 dnl ========================================================
920 bitrig*|dragonfly*|freebsd*|openbsd*)
921 # for stuff like -lXshm
922 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
926 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
927 AC_CACHE_CHECK(for sockaddr_in.sin_len,
928 ac_cv_sockaddr_in_sin_len,
929 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
930 #include <sys/types.h>
932 #include <netinet/in.h>
933 struct sockaddr_in x;
934 void *foo = (void*) &x.sin_len;],
936 [ac_cv_sockaddr_in_sin_len=true],
937 [ac_cv_sockaddr_in_sin_len=false])])
938 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
939 AC_DEFINE(HAVE_SIN_LEN)
940 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
941 AC_DEFINE(HAVE_SCONN_LEN)
944 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
945 ac_cv_sockaddr_in6_sin6_len,
946 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
947 #include <sys/types.h>
949 #include <netinet/in.h>
950 struct sockaddr_in6 x;
951 void *foo = (void*) &x.sin6_len;],
953 [ac_cv_sockaddr_in6_sin6_len=true],
954 [ac_cv_sockaddr_in6_sin6_len=false])])
955 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
956 AC_DEFINE(HAVE_SIN6_LEN)
959 AC_CACHE_CHECK(for sockaddr.sa_len,
960 ac_cv_sockaddr_sa_len,
961 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
962 #include <sys/types.h>
964 #include <sys/socket.h>
966 void *foo = (void*) &x.sa_len;],
968 [ac_cv_sockaddr_sa_len=true],
969 [ac_cv_sockaddr_sa_len=false])])
970 if test "$ac_cv_sockaddr_sa_len" = true ; then
971 AC_DEFINE(HAVE_SA_LEN)
974 MOZ_ARG_ENABLE_BOOL(dtrace,
975 [ --enable-dtrace build with dtrace support if available (default=no)],
976 [enable_dtrace="yes"],)
977 if test "x$enable_dtrace" = "xyes"; then
978 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
979 if test -n "$HAVE_DTRACE"; then
980 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
982 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
985 AC_SUBST(HAVE_DTRACE)
987 dnl Checks for libraries.
988 dnl ========================================================
989 AC_CHECK_LIB(c_r, gethostbyname_r)
991 dnl We don't want to link with libdl even if it's present on OS X, since
992 dnl it's not used and not part of the default installation. OS/2 has dlfcn
994 dnl We don't want to link against libm or libpthread on Darwin since
995 dnl they both are just symlinks to libSystem and explicitly linking
996 dnl against libSystem causes issues when debugging (see bug 299601).
1001 AC_SEARCH_LIBS(dlopen, dl,
1002 MOZ_CHECK_HEADER(dlfcn.h,
1003 AC_DEFINE(HAVE_DLOPEN)))
1007 _SAVE_CFLAGS="$CFLAGS"
1008 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1009 AC_CHECK_FUNCS(dladdr memmem)
1010 CFLAGS="$_SAVE_CFLAGS"
1012 if test ! "$GNU_CXX"; then
1013 AC_CHECK_LIB(C, demangle)
1016 AC_CHECK_LIB(socket, socket)
1019 XLIBS="$X_EXTRA_LIBS"
1021 dnl ========================================================
1022 dnl Checks for X libraries.
1023 dnl Ordering is important.
1024 dnl Xt is dependent upon SM as of X11R6
1025 dnl ========================================================
1026 if test -n "$MOZ_X11"; then
1027 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1028 _SAVE_LDFLAGS="$LDFLAGS"
1030 LDFLAGS="$XLDFLAGS $LDFLAGS"
1031 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1032 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1033 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1034 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1036 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1037 unset ac_cv_lib_Xt_XtFree
1038 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1039 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1040 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1041 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1044 dnl ========================================================
1046 dnl ========================================================
1047 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1048 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1049 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1050 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1051 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1052 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1054 LDFLAGS="$_SAVE_LDFLAGS"
1058 AC_SUBST_LIST(XCFLAGS)
1059 AC_SUBST_LIST(XLDFLAGS)
1060 AC_SUBST_LIST(XLIBS)
1061 AC_SUBST_LIST(XEXT_LIBS)
1062 AC_SUBST_LIST(XT_LIBS)
1064 dnl ========================================================
1065 dnl = pthread support
1066 dnl = Start by checking whether the system support pthreads
1067 dnl ========================================================
1068 case "$target_os" in
1073 AC_CHECK_LIB(pthreads, pthread_create,
1074 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1075 AC_CHECK_LIB(pthread, pthread_create,
1076 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1077 AC_CHECK_LIB(c_r, pthread_create,
1078 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1079 AC_CHECK_LIB(c, pthread_create,
1088 dnl ========================================================
1089 dnl Do the platform specific pthread hackery
1090 dnl ========================================================
1091 if test "$MOZ_USE_PTHREADS"x != x
1094 dnl See if -pthread is supported.
1097 ac_cv_have_dash_pthread=no
1098 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1099 echo 'int main() { return 0; }' | cat > conftest.c
1100 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1101 if test $? -eq 0; then
1102 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1103 ac_cv_have_dash_pthread=yes
1104 case "$target_os" in
1106 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1109 CFLAGS="$CFLAGS -pthread"
1110 CXXFLAGS="$CXXFLAGS -pthread"
1116 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1119 dnl See if -pthreads is supported.
1121 ac_cv_have_dash_pthreads=no
1122 if test "$ac_cv_have_dash_pthread" = "no"; then
1123 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1124 echo 'int main() { return 0; }' | cat > conftest.c
1125 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1126 if test $? -eq 0; then
1127 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1128 ac_cv_have_dash_pthreads=yes
1129 CFLAGS="$CFLAGS -pthreads"
1130 CXXFLAGS="$CXXFLAGS -pthreads"
1134 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1139 AC_DEFINE(_REENTRANT)
1140 AC_DEFINE(_THREAD_SAFE)
1141 dnl -pthread links in -lpthread, so don't specify it explicitly.
1142 if test "$ac_cv_have_dash_pthread" = "yes"; then
1143 _PTHREAD_LDFLAGS="-pthread"
1147 *-*-openbsd*|*-*-bsdi*)
1148 AC_DEFINE(_REENTRANT)
1149 AC_DEFINE(_THREAD_SAFE)
1150 dnl -pthread links in -lc_r, so don't specify it explicitly.
1151 if test "$ac_cv_have_dash_pthread" = "yes"; then
1152 _PTHREAD_LDFLAGS="-pthread"
1156 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1157 AC_DEFINE(_REENTRANT)
1161 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1162 AC_SUBST(MOZ_USE_PTHREADS)
1163 MOZ_CHECK_HEADERS(pthread.h)
1167 dnl Checks for library functions.
1168 dnl ========================================================
1169 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1171 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1172 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1173 ac_cv_clock_monotonic,
1174 [for libs in "" -lrt; do
1176 _SAVE_CFLAGS="$CFLAGS"
1178 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1179 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1180 dnl we should or not be able to use it. To detect if we can, we need to make the
1181 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1182 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1184 [ struct timespec ts;
1185 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1186 ac_cv_clock_monotonic=$libs
1188 CFLAGS="$_SAVE_CFLAGS"
1190 ac_cv_clock_monotonic=no)
1192 CFLAGS="$_SAVE_CFLAGS"
1194 if test "$ac_cv_clock_monotonic" != "no"; then
1195 HAVE_CLOCK_MONOTONIC=1
1196 REALTIME_LIBS=$ac_cv_clock_monotonic
1197 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1198 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1199 AC_SUBST_LIST(REALTIME_LIBS)
1202 dnl Turn on warnings-as-errors to prevent implicit declaration of
1203 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1204 dnl inadvertently pass even if the function does not really exist.
1205 _SAVE_CFLAGS="$CFLAGS"
1206 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1207 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1208 ac_cv_pthread_cond_timedwait_monotonic_np,
1209 AC_TRY_LINK([#include <pthread.h>],
1210 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1211 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1212 ac_cv_pthread_cond_timewait_monotonic_np=no))
1213 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1214 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1216 CFLAGS=$_SAVE_CFLAGS
1220 ac_cv_func_res_ninit,
1221 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1222 dnl no need for res_ninit() on NetBSD and OpenBSD
1223 ac_cv_func_res_ninit=no
1227 #define _BSD_SOURCE 1
1229 #include <sys/types.h>
1230 #include <netinet/in.h>
1231 #include <arpa/nameser.h>
1234 [int foo = res_ninit(&_res);],
1235 [ac_cv_func_res_ninit=yes],
1236 [ac_cv_func_res_ninit=no])
1240 if test "$ac_cv_func_res_ninit" = "yes"; then
1241 AC_DEFINE(HAVE_RES_NINIT)
1242 dnl must add the link line we do something as foolish as this... dougt
1244 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1245 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1250 dnl **********************
1251 dnl *** va_copy checks ***
1252 AC_CACHE_CHECK([for an implementation of va_copy()],
1254 [AC_TRY_COMPILE([#include <stdarg.h>
1256 void f (int i, ...) {
1257 va_list args1, args2;
1258 va_start (args1, i);
1259 va_copy (args2, args1);
1260 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1262 va_end (args1); va_end (args2);
1264 [f(0, 42); return 0],
1265 [ac_cv_va_copy=yes],
1269 AC_CACHE_CHECK([whether va_list can be copied by value],
1271 [AC_TRY_COMPILE([#include <stdarg.h>
1273 void f (int i, ...) {
1274 va_list args1, args2;
1275 va_start (args1, i);
1277 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1279 va_end (args1); va_end (args2);
1281 [f(0, 42); return 0],
1282 [ac_cv_va_val_copy=yes],
1283 [ac_cv_va_val_copy=no],
1286 if test "x$ac_cv_va_copy" = "xyes"; then
1287 AC_DEFINE(VA_COPY, va_copy)
1288 AC_DEFINE(HAVE_VA_COPY)
1291 if test "x$ac_cv_va_val_copy" = "xno"; then
1292 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1295 dnl ===================================================================
1296 dnl ========================================================
1297 dnl Put your C++ language/feature checks below
1298 dnl ========================================================
1302 if test "$GNU_CC"; then
1303 if test "$CPU_ARCH" = "arm" ; then
1304 AC_CACHE_CHECK(for ARM EABI,
1308 #if defined(__ARM_EABI__)
1311 #error Not ARM EABI.
1314 ac_cv_gcc_arm_eabi="yes",
1315 ac_cv_gcc_arm_eabi="no")])
1316 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1318 ARM_ABI_PREFIX=eabi-
1320 ARM_ABI_PREFIX=oabi-
1324 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1327 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1328 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1329 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1331 _SAVE_LDFLAGS=$LDFLAGS
1332 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1333 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1334 ac_cv_thread_keyword,
1335 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1336 [return tlsIsMainThread;],
1337 ac_cv_thread_keyword=yes,
1338 ac_cv_thread_keyword=no)])
1339 LDFLAGS=$_SAVE_LDFLAGS
1340 # The custom dynamic linker doesn't support TLS variables
1342 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1343 # mips builds fail with TLS variables because of a binutils bug.
1345 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1350 *-android*|*-linuxandroid*)
1357 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1363 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1364 if test -n "$MOZ_LINKER"; then
1365 if test "$CPU_ARCH" = arm; then
1366 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1367 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1368 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1369 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1373 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1374 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1375 dnl Since the linker only understands the sysv ones, no need to build the
1376 dnl gnu style tables anyways.
1377 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1380 dnl End of C++ language/feature checks
1383 dnl ========================================================
1384 dnl = Internationalization checks
1385 dnl ========================================================
1387 dnl Internationalization and Locale support is different
1388 dnl on various UNIX platforms. Checks for specific i18n
1389 dnl features go here.
1391 AC_HAVE_FUNCS(localeconv)
1393 fi # ! SKIP_COMPILER_CHECKS
1395 if test -n "${COMPILE_ENVIRONMENT}"; then
1400 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1401 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1402 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1405 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1406 dnl features that Windows actually does support.
1408 if test -n "$SKIP_COMPILER_CHECKS"; then
1409 dnl Windows has malloc.h
1410 AC_DEFINE(MALLOC_H, [<malloc.h>])
1411 AC_DEFINE(HAVE_FORCEINLINE)
1412 AC_DEFINE(HAVE_LOCALECONV)
1413 fi # SKIP_COMPILER_CHECKS
1415 dnl Mozilla specific options
1416 dnl ========================================================
1417 dnl The macros used for command line options
1418 dnl are defined in build/autoconf/altoptions.m4.
1420 dnl ========================================================
1422 dnl = Check for external package dependencies
1424 dnl ========================================================
1425 MOZ_ARG_HEADER(External Packages)
1427 case "$OS_TARGET" in
1428 WINNT|Darwin|Android)
1438 dnl ========================================================
1439 dnl system libevent Support
1440 dnl ========================================================
1441 MOZ_ARG_WITH_STRING(system-libevent,
1442 [ --with-system-libevent[=PFX]
1443 Use system libevent [installed at prefix PFX]],
1444 LIBEVENT_DIR=$withval)
1446 _SAVE_CFLAGS=$CFLAGS
1447 _SAVE_LDFLAGS=$LDFLAGS
1449 if test "$LIBEVENT_DIR" = yes; then
1450 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1451 MOZ_SYSTEM_LIBEVENT=1,
1454 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1455 MOZ_SYSTEM_LIBEVENT=
1456 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1457 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1458 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1459 MOZ_CHECK_HEADER(event.h,
1460 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1461 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1463 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1464 AC_CHECK_LIB(event, event_init,
1465 [MOZ_SYSTEM_LIBEVENT=1
1466 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1467 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1468 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1470 CFLAGS=$_SAVE_CFLAGS
1471 LDFLAGS=$_SAVE_LDFLAGS
1474 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1476 dnl ========================================================
1477 dnl = If NSS was not detected in the system,
1478 dnl = use the one in the source tree (mozilla/security/nss)
1479 dnl ========================================================
1481 MOZ_ARG_WITH_BOOL(system-nss,
1482 [ --with-system-nss Use system installed NSS],
1485 if test -n "$_USE_SYSTEM_NSS"; then
1486 AM_PATH_NSS(3.53, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1489 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1490 if test -z "$MOZ_SYSTEM_NSS"; then
1491 case "${OS_ARCH}" in
1492 # Only few platforms have been tested with GYP
1493 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1496 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1501 dnl system ZLIB support
1502 dnl ========================================================
1503 MOZ_ZLIB_CHECK([1.2.3])
1505 if test -z "$SKIP_LIBRARY_CHECKS"; then
1507 dnl ========================================================
1508 dnl system PNG Support
1509 dnl ========================================================
1510 MOZ_ARG_WITH_STRING(system-png,
1511 [ --with-system-png[=PFX]
1512 Use system libpng [installed at prefix PFX]],
1515 _SAVE_CFLAGS=$CFLAGS
1516 _SAVE_LDFLAGS=$LDFLAGS
1518 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1519 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1520 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1522 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1525 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1526 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1527 AC_CHECK_LIB(png, png_get_acTL, ,
1528 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1530 if test "$MOZ_SYSTEM_PNG" = 1; then
1531 AC_TRY_COMPILE([ #include <stdio.h>
1532 #include <sys/types.h>
1534 [ #if PNG_LIBPNG_VER < $MOZPNG
1535 #error "Insufficient libpng version ($MOZPNG required)."
1537 #ifndef PNG_UINT_31_MAX
1538 #error "Insufficient libpng version."
1541 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1543 CFLAGS=$_SAVE_CFLAGS
1544 LDFLAGS=$_SAVE_LDFLAGS
1547 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1548 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1549 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1552 fi # SKIP_LIBRARY_CHECKS
1554 dnl ========================================================
1558 dnl ========================================================
1560 MOZ_ARG_HEADER(Application)
1562 ENABLE_SYSTEM_EXTENSION_DIRS=1
1563 MOZ_BRANDING_DIRECTORY=
1564 MOZ_OFFICIAL_BRANDING=
1565 MOZ_AUTH_EXTENSION=1
1566 MOZ_PREF_EXTENSIONS=1
1568 MOZ_UNIVERSALCHARDET=1
1572 MOZ_USE_NATIVE_POPUP_WINDOWS=
1573 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1575 MOZ_BINARY_EXTENSIONS=
1578 case "$target_os" in
1581 AC_DEFINE(NS_ENABLE_TSF)
1585 # Optional Firefox for Android partner distribution directory.
1586 MOZ_ARG_WITH_STRING(android-distribution-directory,
1587 [ --with-android-distribution-directory=dir
1588 Optional Firefox for Android partner distribution directory.],
1589 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1591 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1592 # A distribution directory must have an assets/distribution directory.
1593 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1594 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1595 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1596 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1599 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1601 dnl ========================================================
1602 dnl = Trademarked Branding
1603 dnl ========================================================
1604 MOZ_ARG_ENABLE_BOOL(official-branding,
1605 [ --enable-official-branding
1606 Enable Official mozilla.org Branding
1607 Do not distribute builds with
1608 --enable-official-branding unless you have
1609 permission to use trademarks per
1610 http://www.mozilla.org/foundation/trademarks/ .],
1611 MOZ_OFFICIAL_BRANDING=1,
1612 MOZ_OFFICIAL_BRANDING=)
1614 # Allow the application to influence configure with a confvars.sh script.
1615 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1616 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1617 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1618 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1623 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1624 MOZ_ARG_WITH_STRING(app-name,
1625 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1626 WITH_APP_NAME=$withval,
1629 if test -n "$WITH_APP_NAME" ; then
1630 MOZ_APP_NAME="$WITH_APP_NAME"
1633 MOZ_ARG_WITH_STRING(app-basename,
1634 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1635 WITH_APP_BASENAME=$withval,
1638 if test -n "$WITH_APP_BASENAME" ; then
1639 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1642 dnl ========================================================
1643 dnl Ensure Android SDK and build-tools versions depending on
1645 dnl ========================================================
1647 case "$MOZ_BUILD_APP" in
1653 dnl ========================================================
1655 dnl = Toolkit Options
1657 dnl ========================================================
1658 MOZ_ARG_HEADER(Toolkit Options)
1660 dnl ========================================================
1661 dnl = Enable the toolkit as needed =
1662 dnl ========================================================
1664 case "$MOZ_WIDGET_TOOLKIT" in
1667 LDFLAGS="$LDFLAGS -framework Cocoa"
1668 # Use -Wl as a trick to avoid -framework and framework names from
1669 # being separated by AC_SUBST_LIST.
1670 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,CoreVideo -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL -Wl,-framework,Security -Wl,-framework,ServiceManagement -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -Wl,-framework,AppKit'
1672 CFLAGS="$CFLAGS $TK_CFLAGS"
1673 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1674 MOZ_USER_DIR="Mozilla"
1675 MOZ_FS_LAYOUT=bundle
1679 LDFLAGS="$LDFLAGS -framework UIKit"
1681 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText -Wl,-framework,AVFoundation -Wl,-framework,AudioToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo -Wl,-framework,OpenGLES -Wl,-framework,QuartzCore'
1682 CFLAGS="$CFLAGS $TK_CFLAGS"
1683 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1684 MOZ_USER_DIR="Mozilla"
1685 MOZ_FS_LAYOUT=bundle
1690 if test "$OS_TARGET" = Darwin; then
1691 LDFLAGS="$LDFLAGS -lobjc"
1694 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1695 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1696 case "$MOZ_WIDGET_TOOLKIT" in
1702 if test "$COMPILE_ENVIRONMENT"; then
1703 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1704 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1705 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1706 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1707 TK_LIBS=$MOZ_GTK3_LIBS
1708 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1709 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1710 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1711 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1713 if test "$MOZ_ENABLE_GTK"; then
1714 if test "$MOZ_X11"; then
1715 GDK_PACKAGES=gdk-x11-2.0
1717 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1718 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1720 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1721 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1723 fi # COMPILE_ENVIRONMENT
1725 AC_SUBST(MOZ_FS_LAYOUT)
1727 AC_SUBST_LIST(TK_CFLAGS)
1728 AC_SUBST_LIST(TK_LIBS)
1730 dnl ========================================================
1732 dnl = Components & Features
1734 dnl ========================================================
1735 MOZ_ARG_HEADER(Components and Features)
1737 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1738 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1739 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1740 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1742 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1743 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1747 MOZ_ARG_WITH_STRING(branding,
1748 [ --with-branding=dir Use branding from the specified directory.],
1749 MOZ_BRANDING_DIRECTORY=$withval)
1751 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1752 if test -z "$REAL_BRANDING_DIRECTORY"; then
1753 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1756 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1757 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1758 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1759 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1762 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1764 dnl ========================================================
1765 dnl = Distribution ID
1766 dnl ========================================================
1767 MOZ_ARG_WITH_STRING(distribution-id,
1768 [ --with-distribution-id=ID
1769 Set distribution-specific id (default=org.mozilla)],
1770 [ val=`echo $withval`
1771 MOZ_DISTRIBUTION_ID="$val"])
1773 if test -z "$MOZ_DISTRIBUTION_ID"; then
1774 MOZ_DISTRIBUTION_ID="org.mozilla"
1777 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1778 AC_SUBST(MOZ_DISTRIBUTION_ID)
1780 dnl ========================================================
1781 dnl = libproxy support
1782 dnl ========================================================
1784 if test "$MOZ_ENABLE_GTK"
1786 MOZ_ENABLE_LIBPROXY=
1788 MOZ_ARG_ENABLE_BOOL(libproxy,
1789 [ --enable-libproxy Enable libproxy support ],
1790 MOZ_ENABLE_LIBPROXY=1,
1791 MOZ_ENABLE_LIBPROXY=)
1793 if test "$MOZ_ENABLE_LIBPROXY"
1795 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1796 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1799 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1801 dnl ========================================================
1803 dnl ========================================================
1805 if test "$MOZ_ENABLE_GTK"
1809 MOZ_ARG_DISABLE_BOOL(dbus,
1810 [ --disable-dbus Disable dbus support ],
1814 if test "$MOZ_ENABLE_DBUS"
1816 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1817 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1818 AC_DEFINE(MOZ_ENABLE_DBUS)
1821 AC_SUBST(MOZ_ENABLE_DBUS)
1823 dnl =========================================================
1824 dnl = Whether to exclude hyphenations files in the build
1825 dnl =========================================================
1826 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1827 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1830 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1831 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1832 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1834 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1836 if test -n "$MOZ_WEBRTC"; then
1837 if test -n "$MOZ_X11"; then
1838 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1842 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1844 dnl ========================================================
1845 dnl = Apple platform decoder support
1846 dnl ========================================================
1847 if test "$COMPILE_ENVIRONMENT"; then
1848 if test -n "$MOZ_APPLEMEDIA"; then
1849 # hack in frameworks for fmp4 - see bug 1029974
1850 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1851 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1852 dnl Verify CoreMedia is available.
1853 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1854 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1856 fi # COMPILE_ENVIRONMENT
1858 dnl ========================================================
1859 dnl = Handle dependent MEDIA defines
1860 dnl ========================================================
1863 AC_DEFINE(MOZ_WEBM_ENCODER)
1864 AC_SUBST(MOZ_WEBM_ENCODER)
1866 dnl ========================================================
1868 dnl ========================================================
1870 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1871 [ --disable-negotiateauth Disable GSS-API negotiation ],
1872 MOZ_AUTH_EXTENSION=,
1873 MOZ_AUTH_EXTENSION=1 )
1875 dnl ========================================================
1876 dnl Pref extensions (autoconfig)
1877 dnl ========================================================
1878 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1879 [ --disable-pref-extensions
1880 Disable pref extensions such as autoconfig],
1881 MOZ_PREF_EXTENSIONS=,
1882 MOZ_PREF_EXTENSIONS=1 )
1884 dnl ========================================================
1885 dnl Searching of system directories for extensions.
1886 dnl Note: this switch is meant to be used for test builds
1887 dnl whose behavior should not depend on what happens to be
1888 dnl installed on the local machine.
1889 dnl ========================================================
1890 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1891 [ --disable-system-extension-dirs
1892 Disable searching system- and account-global
1893 directories for extensions of any kind; use
1894 only profile-specific extension directories],
1895 ENABLE_SYSTEM_EXTENSION_DIRS=,
1896 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1897 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1898 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1901 dnl ========================================================
1902 dnl = Universalchardet
1903 dnl ========================================================
1904 MOZ_ARG_DISABLE_BOOL(universalchardet,
1905 [ --disable-universalchardet
1906 Disable universal encoding detection],
1907 MOZ_UNIVERSALCHARDET=,
1908 MOZ_UNIVERSALCHARDET=1 )
1910 dnl ========================================================
1912 dnl ========================================================
1914 if test "$COMPILE_ENVIRONMENT" ; then
1916 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1917 if test "$OS_TARGET" = "Linux"; then
1918 MOZ_CHECK_HEADER([linux/joystick.h])
1919 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1920 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1924 fi # COMPILE_ENVIRONMENT
1927 dnl ========================================================
1928 dnl = Breakpad crash reporting (on by default on supported platforms)
1929 dnl ========================================================
1932 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1935 i?86-apple-darwin*|x86_64-apple-darwin*)
1938 *-android*|*-linuxandroid*)
1939 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1940 dnl be before Linux condition
1943 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1944 if test "$MOZ_ENABLE_GTK"; then
1950 MOZ_ARG_DISABLE_BOOL(crashreporter,
1951 [ --disable-crashreporter Disable breakpad crash reporting],
1952 [MOZ_CRASHREPORTER=],
1953 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1955 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1956 if test "$MOZ_CRASHREPORTER" = F; then
1957 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1962 if test -n "$MOZ_CRASHREPORTER"; then
1963 AC_DEFINE(MOZ_CRASHREPORTER)
1965 if test "$OS_TARGET" = "Linux" && \
1966 test -z "$SKIP_LIBRARY_CHECKS"; then
1967 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1970 if test "$OS_ARCH" = "WINNT"; then
1971 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1972 MOZ_CRASHREPORTER_INJECTOR=1
1973 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1978 dnl ========================================================
1979 dnl = Enable compilation of specific extension modules
1980 dnl ========================================================
1982 MOZ_ARG_ENABLE_STRING(extensions,
1983 [ --enable-extensions Enable extensions],
1984 [ for option in `echo $enableval | sed 's/,/ /g'`; do
1985 if test "$option" = "yes" -o "$option" = "all"; then
1986 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
1987 elif test "$option" = "no" -o "$option" = "none"; then
1989 elif test "$option" = "default"; then
1990 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
1991 elif test `echo "$option" | grep -c \^-` != 0; then
1992 option=`echo $option | sed 's/^-//'`
1993 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
1995 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
1998 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2000 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2001 dnl when trying to build a nonexistent extension.
2002 for extension in $MOZ_EXTENSIONS; do
2003 if test ! -d "${srcdir}/extensions/${extension}"; then
2004 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2008 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2009 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2012 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2013 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2014 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2015 MOZ_ENABLE_CAIRO_FT=1
2016 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2017 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2018 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2021 AC_CHECK_PROGS(WGET, wget, "")
2024 dnl ========================================================
2026 dnl ========================================================
2028 MOZ_ARG_DISABLE_BOOL(updater,
2029 [ --disable-updater Disable building of updater],
2033 if test -n "$MOZ_UPDATER"; then
2034 AC_DEFINE(MOZ_UPDATER)
2037 dnl ========================================================
2038 dnl parental controls (for Windows Vista)
2039 dnl ========================================================
2040 MOZ_ARG_DISABLE_BOOL(parental-controls,
2041 [ --disable-parental-controls
2042 Do not build parental controls],
2043 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2044 MOZ_DISABLE_PARENTAL_CONTROLS=)
2045 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2046 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2049 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2051 dnl ========================================================
2052 dnl = Disable smartcard support
2053 dnl ========================================================
2054 if test -n "$MOZ_NO_SMART_CARDS"; then
2055 AC_DEFINE(MOZ_NO_SMART_CARDS)
2057 AC_SUBST(MOZ_NO_SMART_CARDS)
2059 dnl ========================================================
2060 dnl = Sandboxing support
2061 dnl ========================================================
2062 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2063 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2064 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2072 MOZ_ARG_DISABLE_BOOL(sandbox,
2073 [ --disable-sandbox Disable sandboxing support],
2077 case "$OS_TARGET" in
2078 WINNT|Darwin|OpenBSD)
2084 # Linux sandbox is only available on x86 and x86_64.
2091 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2096 if test -n "$MOZ_SANDBOX"; then
2097 AC_DEFINE(MOZ_SANDBOX)
2100 AC_SUBST(MOZ_SANDBOX)
2103 dnl ========================================================
2105 dnl = Module specific options
2107 dnl ========================================================
2108 MOZ_ARG_HEADER(Individual module options)
2110 dnl ==============================
2111 dnl === SQLite fdatasync check ===
2112 dnl ==============================
2113 dnl Check to see if fdatasync is available and make use of it
2114 AC_CHECK_FUNC(fdatasync)
2116 dnl ========================================================
2117 dnl = Disable zipwriter
2118 dnl ========================================================
2119 MOZ_ARG_DISABLE_BOOL(zipwriter,
2120 [ --disable-zipwriter Disable zipwriter component],
2123 AC_SUBST(MOZ_ZIPWRITER)
2125 dnl ========================================================
2127 dnl = Feature options that require extra sources to be pulled
2129 dnl ========================================================
2130 dnl MOZ_ARG_HEADER(Features that require extra sources)
2132 dnl ========================================================
2134 dnl = Runtime debugging and Optimization Options
2136 dnl ========================================================
2137 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2139 dnl ========================================================
2140 dnl enable mobile optimizations
2141 dnl ========================================================
2142 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2143 [ --enable-mobile-optimize
2144 Enable mobile optimizations],
2145 MOZ_GFX_OPTIMIZE_MOBILE=1)
2147 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2149 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2150 # We ignore paint will resample on mobile for performance.
2151 # We may want to revisit this later.
2152 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2154 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2155 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2158 dnl ========================================================
2159 dnl = Enable code optimization. ON by default.
2160 dnl ========================================================
2162 # Use value from moz.configure if one is defined. Else use our computed
2164 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2165 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2168 if test "$COMPILE_ENVIRONMENT"; then
2169 if test -n "$MOZ_OPTIMIZE"; then
2170 AC_MSG_CHECKING([for valid C compiler optimization flags])
2171 _SAVE_CFLAGS=$CFLAGS
2172 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2173 AC_TRY_COMPILE([#include <stdio.h>],
2174 [printf("Hello World\n");],
2177 AC_MSG_RESULT([$_results])
2178 if test "$_results" = "no"; then
2179 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2181 CFLAGS=$_SAVE_CFLAGS
2182 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2183 # When using llvm-based LTO, non numeric optimization levels are
2184 # not supported by the linker, so force the linker to use -O2 (
2185 # which doesn't influence the level compilation units are actually
2187 case " $MOZ_OPTIMIZE_FLAGS " in
2188 *\ -Os\ *|*\ -Oz\ *)
2189 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2194 fi # COMPILE_ENVIRONMENT
2196 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2197 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2198 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2200 dnl ========================================================
2201 dnl = Enable runtime logging
2202 dnl ========================================================
2203 AC_DEFINE(MOZ_LOGGING)
2204 AC_DEFINE(FORCE_PR_LOG)
2206 dnl ========================================================
2207 dnl = This will enable logging of addref, release, ctor, dtor.
2208 dnl ========================================================
2209 _ENABLE_LOGREFCNT=42
2210 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2211 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2212 _ENABLE_LOGREFCNT=1,
2213 _ENABLE_LOGREFCNT= )
2214 if test "$_ENABLE_LOGREFCNT" = "1"; then
2215 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2216 elif test -z "$_ENABLE_LOGREFCNT"; then
2217 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2220 dnl ========================================================
2221 dnl moz_dump_painting
2222 dnl ========================================================
2223 MOZ_ARG_ENABLE_BOOL(dump-painting,
2224 [ --enable-dump-painting Enable paint debugging.],
2225 MOZ_DUMP_PAINTING=1,
2226 MOZ_DUMP_PAINTING= )
2227 if test -n "$MOZ_DUMP_PAINTING"; then
2228 AC_DEFINE(MOZ_DUMP_PAINTING)
2229 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2231 if test -n "$MOZ_DEBUG"; then
2232 AC_DEFINE(MOZ_DUMP_PAINTING)
2235 case "${OS_TARGET}" in
2236 Android|WINNT|Darwin)
2237 MOZ_GLUE_IN_PROGRAM=
2240 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2241 MOZ_GLUE_IN_PROGRAM=1
2242 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2246 dnl ========================================================
2247 dnl = Jemalloc build setup
2248 dnl ========================================================
2249 if test -z "$MOZ_MEMORY"; then
2252 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2253 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.])
2258 dnl The generic feature tests that determine how to compute ncpus are long and
2259 dnl complicated. Therefore, simply define special cpp variables for the
2260 dnl platforms we have special knowledge of.
2263 export MOZ_NO_DEBUG_RTL=1
2267 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2269 dnl ========================================================
2270 dnl = Enable using the clang plugin to build
2271 dnl ========================================================
2273 if test -n "$COMPILE_ENVIRONMENT"; then
2274 MOZ_CONFIG_CLANG_PLUGIN
2275 fi # COMPILE_ENVIRONMENT
2277 dnl ========================================================
2278 dnl = Enable stripping of libs & executables
2279 dnl ========================================================
2280 MOZ_ARG_ENABLE_BOOL(strip,
2281 [ --enable-strip Enable stripping of libs & executables ],
2285 dnl ========================================================
2286 dnl = Enable stripping of libs & executables when packaging
2287 dnl ========================================================
2288 MOZ_ARG_ENABLE_BOOL(install-strip,
2289 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2293 dnl ========================================================
2294 dnl = frontend JS debug mode
2295 dnl ========================================================
2297 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2298 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2302 AC_SUBST(DEBUG_JS_MODULES)
2304 dnl ========================================================
2306 dnl = Profiling and Instrumenting
2308 dnl ========================================================
2309 MOZ_ARG_HEADER(Profiling and Instrumenting)
2311 dnl ========================================================
2312 dnl = Offer a way to disable the startup cache
2313 dnl ========================================================
2315 MOZ_ARG_DISABLE_BOOL(startupcache,
2316 [ --disable-startupcache Disable startup cache ],
2317 MOZ_DISABLE_STARTUPCACHE=1,
2318 MOZ_DISABLE_STARTUPCACHE=)
2320 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2321 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2323 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2325 dnl ========================================================
2326 dnl = Support for demangling undefined symbols
2327 dnl ========================================================
2328 if test -z "$SKIP_LIBRARY_CHECKS"; then
2331 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2335 # Demangle only for debug or DMD builds
2336 MOZ_DEMANGLE_SYMBOLS=
2337 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2338 MOZ_DEMANGLE_SYMBOLS=1
2339 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2341 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2343 dnl ========================================================
2344 dnl = Support for gcc stack unwinding (from gcc 3.3)
2345 dnl ========================================================
2346 if test -z "$SKIP_LIBRARY_CHECKS"; then
2349 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2353 dnl ========================================================
2355 dnl ========================================================
2357 MOZ_ARG_WITH_STRING(jitreport-granularity,
2358 [ --jitreport-granularity=N
2359 Default granularity at which to report JIT code
2362 1 - code ranges for whole functions only
2363 2 - per-line information
2364 3 - per-op information],
2365 JITREPORT_GRANULARITY=$withval,
2366 JITREPORT_GRANULARITY=3)
2368 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2370 dnl ========================================================
2374 dnl ========================================================
2375 MOZ_ARG_HEADER(Misc. Options)
2377 dnl ========================================================
2378 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2379 dnl ========================================================
2380 MOZ_ARG_WITH_STRING(user-appdir,
2381 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2382 [ val=`echo $withval`
2383 if echo "$val" | grep "\/" >/dev/null; then
2384 AC_MSG_ERROR("Homedir must be single relative path.")
2389 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2391 if test -z "$SKIP_COMPILER_CHECKS"; then
2392 dnl ========================================================
2394 dnl = Compiler Options
2396 dnl ========================================================
2397 MOZ_ARG_HEADER(Compiler Options)
2399 dnl ========================================================
2400 dnl Check for gcc -pipe support
2401 dnl ========================================================
2402 AC_MSG_CHECKING([for -pipe support])
2403 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2404 dnl Any gcc that supports firefox supports -pipe.
2405 CFLAGS="$CFLAGS -pipe"
2406 CXXFLAGS="$CXXFLAGS -pipe"
2407 AC_MSG_RESULT([yes])
2412 fi # ! SKIP_COMPILER_CHECKS
2416 if test "$COMPILE_ENVIRONMENT"; then
2418 fi # COMPILE_ENVIRONMENT
2420 dnl ========================================================
2422 dnl = Static Build Options
2424 dnl ========================================================
2425 MOZ_ARG_HEADER(Static build options)
2427 if test -z "$MOZ_SYSTEM_ZLIB"; then
2428 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2430 AC_DEFINE(ZLIB_IN_MOZGLUE)
2434 AC_SUBST(ZLIB_IN_MOZGLUE)
2436 dnl ========================================================
2438 dnl = Standalone module options
2440 dnl ========================================================
2441 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2444 dnl ========================================================
2446 if test -z "$SKIP_PATH_CHECKS"; then
2447 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2448 if test "$MOZ_ENABLE_GTK" ; then
2449 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2454 if test -z "${GLIB_GMODULE_LIBS}" \
2455 -a -n "${GLIB_CONFIG}"\
2456 -a "${GLIB_CONFIG}" != no\
2458 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2461 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2463 if test "$USE_FC_FREETYPE"; then
2464 if test "$COMPILE_ENVIRONMENT"; then
2465 dnl ========================================================
2466 dnl = Check for freetype2 functionality
2467 dnl ========================================================
2468 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2470 _SAVE_CFLAGS="$CFLAGS"
2471 LIBS="$LIBS $FT2_LIBS"
2472 CFLAGS="$CFLAGS $FT2_CFLAGS"
2474 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2475 ac_cv_member_FT_Bitmap_Size_y_ppem,
2476 [AC_TRY_COMPILE([#include <ft2build.h>
2477 #include FT_FREETYPE_H],
2479 if (sizeof s.y_ppem) return 0;
2481 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2482 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2483 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2484 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2486 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2488 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2489 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2490 [FT_Bitmap_Size structure includes y_ppem field])
2492 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2495 CFLAGS="$_SAVE_CFLAGS"
2498 _SAVE_CPPFLAGS="$CPPFLAGS"
2499 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2500 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2501 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2502 CPPFLAGS="$_SAVE_CPPFLAGS"
2506 dnl ========================================================
2507 dnl Check if we need the 32-bit Linux SSE2 error dialog
2508 dnl ========================================================
2510 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2512 dnl ========================================================
2513 dnl Check for pixman and cairo
2514 dnl ========================================================
2517 MOZ_ARG_ENABLE_BOOL(system-cairo,
2518 [ --enable-system-cairo Obsolete: do not use this option],
2519 AC_MSG_ERROR(--enable-system-cairo is not supported),
2523 MOZ_ARG_ENABLE_BOOL(system-pixman,
2524 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2526 MOZ_TREE_PIXMAN=force,
2529 if test "$MOZ_TREE_PIXMAN"; then
2530 AC_DEFINE(MOZ_TREE_PIXMAN)
2532 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2535 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2536 AC_DEFINE(MOZ_TREE_CAIRO)
2538 if test "$OS_ARCH" = "WINNT"; then
2539 # For now we assume that we will have a uint64_t available through
2540 # one of the above headers or mozstdint.h.
2541 AC_DEFINE(HAVE_UINT64_T)
2544 # Define macros for cairo-features.h
2545 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2546 if test "$MOZ_X11"; then
2547 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2548 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2549 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2551 if test "$_HAVE_FREETYPE2"; then
2552 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2553 MOZ_ENABLE_CAIRO_FT=1
2554 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2557 case "$MOZ_WIDGET_TOOLKIT" in
2559 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2560 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2561 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2564 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2565 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2566 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2568 if test "$COMPILE_ENVIRONMENT"; then
2569 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2573 if test "$USE_FC_FREETYPE"; then
2574 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2576 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2577 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2579 AC_SUBST(PS_SURFACE_FEATURE)
2580 AC_SUBST(SVG_SURFACE_FEATURE)
2581 AC_SUBST(XLIB_SURFACE_FEATURE)
2582 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2583 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2584 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2585 AC_SUBST(WIN32_SURFACE_FEATURE)
2586 AC_SUBST(OS2_SURFACE_FEATURE)
2587 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2588 AC_SUBST(FT_FONT_FEATURE)
2589 AC_SUBST(FC_FONT_FEATURE)
2590 AC_SUBST(WIN32_FONT_FEATURE)
2591 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2592 AC_SUBST(QUARTZ_FONT_FEATURE)
2593 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2594 AC_SUBST(QT_SURFACE_FEATURE)
2595 AC_SUBST(TEE_SURFACE_FEATURE)
2597 if test "$MOZ_X11"; then
2598 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2601 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2603 case "$MOZ_WIDGET_TOOLKIT" in
2605 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2606 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2610 AC_SUBST(MOZ_TREE_CAIRO)
2611 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2612 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2613 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2614 AC_SUBST(MOZ_TREE_PIXMAN)
2616 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2617 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2618 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2619 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2621 dnl ========================================================
2623 dnl ========================================================
2624 MOZ_ARG_DISABLE_BOOL(xul,
2625 [ --disable-xul Disable XUL],
2627 if test "$MOZ_XUL"; then
2630 dnl remove extensions that require XUL
2631 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2636 dnl ========================================================
2637 dnl necko configuration options
2638 dnl ========================================================
2641 dnl option to disable necko's wifi scanner
2644 if test "$MOZ_WIDGET_TOOLKIT"; then
2646 case "$OS_TARGET" in
2650 DragonFly|FreeBSD|WINNT)
2661 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2662 [ --disable-necko-wifi Disable necko wifi scanner],
2666 if test "$NECKO_WIFI"; then
2667 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2668 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2670 AC_DEFINE(NECKO_WIFI)
2671 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2673 AC_SUBST(NECKO_WIFI)
2674 AC_SUBST(NECKO_WIFI_DBUS)
2676 dnl ========================================================
2678 dnl = Maintainer debug option (no --enable equivalent)
2680 dnl ========================================================
2683 AC_SUBST_LIST(ASFLAGS)
2687 AC_SUBST(MOZ_AUTH_EXTENSION)
2688 AC_SUBST(MOZ_PREF_EXTENSIONS)
2689 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2690 AC_SUBST_LIST(WARNINGS_CFLAGS)
2691 AC_SUBST_SET(MOZ_EXTENSIONS)
2693 AC_SUBST(MOZ_UNIVERSALCHARDET)
2694 AC_SUBST(MOZ_SPELLCHECK)
2695 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2696 AC_SUBST(MOZ_CRASHREPORTER)
2697 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2698 AC_SUBST(MOZ_STUB_INSTALLER)
2699 AC_SUBST(MOZ_UPDATER)
2701 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2702 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2703 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2704 AC_SUBST(ENABLE_STRIP)
2705 AC_SUBST(PKG_SKIP_STRIP)
2706 AC_SUBST(STRIP_FLAGS)
2707 AC_SUBST(INCREMENTAL_LINKER)
2709 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2711 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2712 AC_SUBST(MOZ_LINKER_EXTRACT)
2714 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2715 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2718 AC_SUBST(MOZ_REQUIRE_SIGNING)
2719 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2720 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2723 dnl ========================================================
2724 dnl = Mac bundle name prefix
2725 dnl ========================================================
2726 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2727 [ --with-macbundlename-prefix=prefix
2728 Prefix for MOZ_MACBUNDLE_NAME],
2729 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2731 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2732 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2733 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2736 if test "$MOZ_DEBUG"; then
2737 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2739 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2741 AC_SUBST(MOZ_MACBUNDLE_NAME)
2743 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2744 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2745 # Otherwise, use MOZ_APP_DISPLAYNAME
2746 if test -z "$MOZ_MACBUNDLE_ID"; then
2747 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2749 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2750 if test "$MOZ_DEBUG"; then
2751 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2754 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2755 AC_SUBST(MOZ_MACBUNDLE_ID)
2757 dnl ========================================================
2758 dnl = Child Process Name for IPC
2759 dnl ========================================================
2760 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2761 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2763 # We want to let Android unpack the file at install time, but it only does
2764 # so if the file is named libsomething.so. The lib/ path is also required
2765 # because the unpacked file will be under the lib/ subdirectory and will
2766 # need to be executed from that path.
2767 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2769 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2770 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2772 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2773 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2774 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2776 # The following variables are available to branding and application
2777 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2778 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2779 # impacts profile location and user-visible fields.
2780 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2781 # versions of a given application (e.g. Aurora and Firefox both use
2782 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2783 # for application.ini's "Name" field, which controls profile location in
2784 # the absence of a "Profile" field (see below), and various system
2785 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2786 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2787 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2788 # builds (e.g. Aurora for Firefox).
2789 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2790 # defaults to a lowercase form of MOZ_APP_BASENAME.
2791 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2792 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2793 # - MOZ_APP_PROFILE: When set, used for application.ini's
2794 # "Profile" field, which controls profile location.
2795 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2796 # crash reporter server url.
2797 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2799 # The following environment variables used to have an effect, but don't anymore:
2800 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2801 # the contents from the version.txt file in the application directory, or
2802 # browser/config/version.txt if there isn't one.
2803 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2804 # in the "About" window. This was replaced with the contents from the
2805 # version_display.txt or version.txt in the application directory, or
2806 # browser/config/version_display.txt.
2808 if test -z "$MOZ_APP_NAME"; then
2809 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2812 if test -z "$MOZ_APP_REMOTINGNAME"; then
2813 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2816 if test -z "$ANDROID_PACKAGE_NAME" ; then
2817 # When we got rid of the Aurora channel we decided to replace the old
2818 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2819 # by all mozilla-central based branches we make this the new "default"
2820 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2821 # in their mozconfig, so they will never get this. If there are ever
2822 # non-Fennec builds for Android, they will fall into the else block
2823 # and use their own default name.
2824 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2825 # background on this.
2826 if test "$MOZ_APP_NAME" = "fennec"; then
2827 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2829 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2833 # For extensions and langpacks, we require a max version that is compatible
2834 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2835 # 24.0a1 and 24.0a2 aren't affected
2837 # 24.1.1 becomes 24.*
2838 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2839 if test -z "$IS_ALPHA"; then
2841 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2842 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2844 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2848 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2851 AC_SUBST(MOZ_APP_NAME)
2852 AC_SUBST(MOZ_APP_REMOTINGNAME)
2853 AC_SUBST(MOZ_APP_DISPLAYNAME)
2854 AC_SUBST(MOZ_APP_BASENAME)
2855 AC_SUBST(MOZ_APP_VENDOR)
2856 AC_SUBST(MOZ_APP_PROFILE)
2857 AC_SUBST(MOZ_APP_ID)
2858 AC_SUBST(MAR_CHANNEL_ID)
2859 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2860 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2861 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2862 AC_SUBST(MOZ_APP_UA_NAME)
2863 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2864 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2865 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2867 AC_SUBST(MOZ_APP_MAXVERSION)
2868 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2869 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2870 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2873 AC_SUBST(MOZ_PKG_SPECIAL)
2874 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2876 if test "$MOZILLA_OFFICIAL"; then
2877 # Build revisions should always be present in official builds
2878 MOZ_INCLUDE_SOURCE_INFO=1
2881 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2882 # explicitly set the repository and changeset information in.
2883 AC_SUBST(MOZ_SOURCE_REPO)
2884 AC_SUBST(MOZ_SOURCE_CHANGESET)
2885 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2887 dnl If we have any service that uploads data (and requires data submission
2888 dnl policy alert), set MOZ_DATA_REPORTING.
2889 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2890 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2891 MOZ_DATA_REPORTING=1
2892 AC_DEFINE(MOZ_DATA_REPORTING)
2893 AC_SUBST(MOZ_DATA_REPORTING)
2897 AC_SUBST(WIN32_REDIST_DIR)
2898 AC_SUBST(WIN_UCRT_REDIST_DIR)
2900 dnl ========================================================
2902 dnl ========================================================
2906 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
2912 dnl Echo the CFLAGS to remove extra whitespace.
2914 $_COMPILATION_CFLAGS \
2918 $_WARNINGS_CXXFLAGS \
2919 $_COMPILATION_CXXFLAGS \
2922 COMPILE_CFLAGS=`echo \
2926 COMPILE_CXXFLAGS=`echo \
2927 $_DEFINES_CXXFLAGS \
2931 $_WARNINGS_HOST_CFLAGS \
2932 $_COMPILATION_HOST_CFLAGS \
2935 HOST_CXXFLAGS=`echo \
2936 $_WARNINGS_HOST_CXXFLAGS \
2937 $_COMPILATION_HOST_CXXFLAGS \
2940 AC_SUBST(MOZ_SYSTEM_PNG)
2942 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2943 AC_SUBST_LIST(MOZ_PNG_LIBS)
2945 AC_SUBST(MOZ_SYSTEM_NSPR)
2947 AC_SUBST(MOZ_SYSTEM_NSS)
2949 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2950 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2951 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2952 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2953 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2954 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2955 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2957 AC_SUBST(HOST_CMFLAGS)
2958 AC_SUBST(HOST_CMMFLAGS)
2959 AC_SUBST(OS_COMPILE_CMFLAGS)
2960 AC_SUBST(OS_COMPILE_CMMFLAGS)
2963 OS_CXXFLAGS="$CXXFLAGS"
2964 OS_CPPFLAGS="$CPPFLAGS"
2965 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
2966 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
2967 OS_LDFLAGS="$LDFLAGS"
2969 AC_SUBST_LIST(OS_CFLAGS)
2970 AC_SUBST_LIST(OS_CXXFLAGS)
2971 AC_SUBST_LIST(OS_CPPFLAGS)
2972 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
2973 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
2974 AC_SUBST_LIST(OS_LDFLAGS)
2979 AC_SUBST_LIST(HOST_CFLAGS)
2980 AC_SUBST_LIST(HOST_CPPFLAGS)
2981 AC_SUBST_LIST(HOST_CXXFLAGS)
2982 AC_SUBST(HOST_LDFLAGS)
2983 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2984 AC_SUBST(HOST_BIN_SUFFIX)
2986 AC_SUBST(TARGET_XPCOM_ABI)
2987 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2988 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2989 AC_SUBST(HAVE_X86_AVX2)
2990 AC_SUBST(HAVE_ALTIVEC)
2992 AC_SUBST_LIST(DSO_CFLAGS)
2993 AC_SUBST_LIST(DSO_PIC_CFLAGS)
2994 AC_SUBST(DSO_LDOPTS)
2995 AC_SUBST(BIN_SUFFIX)
2997 AC_SUBST(NS_ENABLE_TSF)
2998 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2999 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3001 AC_SUBST(MOZ_DEVTOOLS)
3003 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3004 AC_SUBST(MOZ_FOLD_LIBS)
3005 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3009 dnl Host JavaScript runtime, if any, to use during cross compiles.
3012 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3014 if test -n "$COMPILE_ENVIRONMENT"; then
3015 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3017 dnl Check for missing components
3018 if test "$MOZ_X11"; then
3019 dnl ====================================================
3020 dnl = Check if X headers exist
3021 dnl ====================================================
3022 _SAVE_CFLAGS=$CFLAGS
3023 CFLAGS="$CFLAGS $XCFLAGS"
3027 #include <X11/Xlib.h>
3028 #include <X11/Intrinsic.h>
3029 #include <X11/extensions/XShm.h>
3033 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3034 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3038 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3039 CFLAGS="$_SAVE_CFLAGS"
3041 if test -n "$MISSING_X"; then
3042 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3047 fi # COMPILE_ENVIRONMENT
3049 dnl Set various defines and substitutions
3050 dnl ========================================================
3052 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3053 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3054 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3055 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3056 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3057 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3058 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3059 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3060 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3063 AC_SUBST(MOZ_DEV_EDITION)
3064 if test -n "$MOZ_DEV_EDITION"; then
3065 AC_DEFINE(MOZ_DEV_EDITION)
3068 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3072 if test -n "$A11Y_LOG"; then
3076 dnl Spit out some output
3077 dnl ========================================================
3079 dnl The following defines are used by xpcom
3080 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3092 # Avoid using obsolete NSPR features
3093 AC_DEFINE(NO_NSPR_10_SUPPORT)
3095 MOZ_CREATE_CONFIG_STATUS()
3097 rm -fr confdefs* $ac_clean_files