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 two 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 ========================================================
54 dnl Set the minimum version of toolkit libs used by mozilla
55 dnl ========================================================
57 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
58 # The macro won't be used when compiling with earlier versions anyway.
59 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
63 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
64 WINDRES_VERSION=2.14.90
67 STARTUP_NOTIFICATION_VERSION=0.8
71 dnl Set various checks
72 dnl ========================================================
75 dnl Initialize the Pthread test variables early so they can be
76 dnl overridden by each platform.
77 dnl ========================================================
83 if test "$COMPILE_ENVIRONMENT"; then
85 fi # COMPILE_ENVIRONMENT
88 *-android*|*-linuxandroid*)
92 AC_PATH_PROG(OBJCOPY,objcopy)
102 AC_SUBST(ANDROID_SOURCE)
103 AC_SUBST(ANDROID_PACKAGE_NAME)
106 dnl ========================================================
107 dnl Checks for compilers.
108 dnl ========================================================
110 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
113 if test "$COMPILE_ENVIRONMENT"; then
115 if test "$target" != "$host"; then
121 # Work around the conftest.exe access problem on Windows
126 MOZ_PATH_PROGS(AS, $AS as, $CC)
127 AC_CHECK_PROGS(AR, ar, :)
128 AC_CHECK_PROGS(STRIP, strip, :)
129 AC_CHECK_PROGS(WINDRES, windres, :)
130 AC_CHECK_PROGS(OTOOL, otool, :)
131 if test -z "$HOST_RANLIB"; then
132 HOST_RANLIB="$RANLIB"
134 if test -z "$HOST_AR"; then
137 if test -z "$HOST_AR_FLAGS"; then
138 HOST_AR_FLAGS="$AR_FLAGS"
142 if test -n "$MOZ_WINCONSOLE"; then
143 AC_DEFINE(MOZ_WINCONSOLE)
148 dnl ========================================================
149 dnl Special win32 checks
150 dnl ========================================================
156 if test "$GCC" != "yes"; then
157 # Check to see if we are really running in a msvc environemnt
159 AC_CHECK_PROGS(MIDL, midl)
161 # Make sure compilers are valid
162 CFLAGS="$CFLAGS -TC -nologo"
163 CXXFLAGS="$CXXFLAGS -TP -nologo"
166 AC_TRY_COMPILE([#include <stdio.h>],
167 [ printf("Hello World\n"); ],,
168 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
171 AC_TRY_COMPILE([#include <new.h>],
172 [ unsigned *test = new unsigned(42); ],,
173 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
177 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
180 _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
182 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
183 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
184 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
187 MSVC_C_RUNTIME_DLL=vcruntime140.dll
188 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
190 MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
191 if test -n "$MSVC_HAS_DIA_SDK"; then
192 AC_DEFINE(MSVC_HAS_DIA_SDK)
195 if test "$_MSC_VER" -ge "1910"; then # VS2017+
196 # C5038: Enable initializer list order warnings
197 # The -w1#### flag treats warning C#### as if it was a warning level
198 # 1 warning, and thus enables it because we enable /W3 warnings. We
199 # don't use -we#### because it would enable warning C#### but treat
200 # it as an error, even in third-party code.
201 # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
202 CXXFLAGS="$CXXFLAGS -w15038"
205 # C5026: move constructor was implicitly defined as deleted
206 CXXFLAGS="$CXXFLAGS -wd5026"
208 # C5027: move assignment operator was implicitly defined as deleted
209 CXXFLAGS="$CXXFLAGS -wd5027"
211 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
212 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
214 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
215 # for dbghelp.h, imagehlp.h, and shobj.h
216 # C4091: 'typedef ': ignored on left of '' when no variable is declared
217 CFLAGS="$CFLAGS -wd4091"
218 CXXFLAGS="$CXXFLAGS -wd4091"
220 # This is intended as a temporary hack to support building with VS2015.
221 # 'noexcept' used with no exception handling mode specified;
222 # termination on exception is not guaranteed. Specify /EHsc
223 CXXFLAGS="$CXXFLAGS -wd4577"
225 if test -n "$WIN_UCRT_REDIST_DIR"; then
226 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
227 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
229 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
232 AC_SUBST(MSVC_HAS_DIA_SDK)
233 AC_SUBST(MSVC_C_RUNTIME_DLL)
234 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
236 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
238 if test -n "$WIN32_REDIST_DIR"; then
239 if test ! -d "$WIN32_REDIST_DIR"; then
240 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
242 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
245 # Check linker version, except in lld builds
250 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
251 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
252 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
253 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
260 # Set midl environment
263 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
266 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
270 unset _MSVC_VER_FILTER
272 AC_CACHE_CHECK(for overridable _RAISE,
277 _SAVE_CXXFLAGS="$CXXFLAGS"
278 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
279 AC_TRY_COMPILE([#include <xstddef>
281 #define _RAISE(x) externallyDefinedFunction((x).what())
284 [std::vector<int> v; return v.at(1);],
285 ac_cv_have__RAISE="no",
286 ac_cv_have__RAISE="yes")
287 CXXFLAGS="$_SAVE_CXXFLAGS"
290 if test "$ac_cv_have__RAISE" = "yes"; then
292 MOZ_MSVC_STL_WRAP_RAISE=1
293 AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
295 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
298 if test "$WRAP_STL_INCLUDES" = "1"; then
299 STL_FLAGS="-I${DIST}/stl_wrappers"
301 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
302 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
304 # Check w32api version
305 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
306 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
307 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
308 AC_TRY_COMPILE([#include <w32api.h>],
309 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
310 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
311 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
312 #error "test failed."
314 , [ res=yes ], [ res=no ])
315 AC_MSG_RESULT([$res])
316 if test "$res" != "yes"; then
317 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
319 # Check windres version
320 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
321 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
322 AC_MSG_RESULT([$_WINDRES_VERSION])
323 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
324 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
325 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
326 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
327 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
328 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
329 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
330 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
331 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
332 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
333 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
334 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
336 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
339 AC_CHECK_PROGS(MIDL, $target-widl widl)
340 if test -n "$MIDL"; then
343 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
346 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
351 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
352 # causing problems with local implementations with the same name.
353 AC_DEFINE(STRSAFE_NO_DEPRECATE)
356 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
357 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
358 # Require OS features provided by IE 8.0 (Win7)
359 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
364 if test -n "$_WIN32_MSVC"; then
366 SKIP_COMPILER_CHECKS=1
367 SKIP_LIBRARY_CHECKS=1
369 # Since we're skipping compiler and library checks, hard-code
372 AC_DEFINE(HAVE_ISATTY)
375 fi # COMPILE_ENVIRONMENT
384 AC_SUBST_LIST(STL_FLAGS)
385 AC_SUBST(WRAP_STL_INCLUDES)
386 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
388 dnl ========================================================
389 dnl Checks for programs.
390 dnl ========================================================
391 if test "$COMPILE_ENVIRONMENT"; then
393 dnl ========================================================
394 dnl = Mac OS X SDK support
395 dnl ========================================================
397 MOZ_ARG_WITH_STRING(macos-sdk,
398 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
399 MACOS_SDK_DIR=$withval)
401 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
402 MOZ_ARG_WITH_STRING(macos-private-frameworks,
403 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
404 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
405 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
406 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
408 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
409 if test -z "$CROSS_COMPILE"; then
410 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
412 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
413 AC_MSG_ERROR([PrivateFrameworks directory not found.])
417 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
418 AC_SUBST(MACOS_SDK_DIR)
419 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
421 if test "$MACOS_SDK_DIR"; then
422 dnl Sync this section with the ones in NSPR and NSS.
423 dnl Changes to the cross environment here need to be accounted for in
424 dnl the libIDL checks (below) and xpidl build.
426 if test ! -d "$MACOS_SDK_DIR"; then
427 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
428 specify a valid SDK. SDKs are installed when the optional cross-development
429 tools are selected during the Xcode/Developer Tools installation.])
432 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
433 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
435 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
436 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
437 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
440 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
442 AC_TRY_COMPILE([#include <new>],[],
446 AC_MSG_RESULT($result)
448 if test "$result" = "no" ; then
449 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
457 fi # COMPILE_ENVIRONMENT
459 dnl ========================================================
460 dnl set the defaults first
461 dnl ========================================================
466 MOZ_USER_DIR=".mozilla"
468 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
472 dnl Configure platform-specific CPU architecture compiler options.
473 dnl ==============================================================
474 if test "$COMPILE_ENVIRONMENT"; then
477 if test "$OS_TARGET" = Android; then
478 dnl Default Android builds to ARMv7.
481 fi # COMPILE_ENVIRONMENT
483 dnl ========================================================
484 dnl Android libstdc++, placed here so it can use MOZ_ARCH
486 dnl ========================================================
489 if test "$COMPILE_ENVIRONMENT"; then
491 fi # COMPILE_ENVIRONMENT
493 dnl ========================================================
494 dnl Suppress Clang Argument Warnings
495 dnl ========================================================
496 if test -n "${CLANG_CC}${CLANG_CL}"; then
497 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
498 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
500 if test -n "${CLANG_CXX}${CLANG_CL}"; then
501 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
504 if test -n "$COMPILE_ENVIRONMENT"; then
508 dnl ========================================================
509 dnl Add optional and non-optional hardening flags
510 dnl ========================================================
512 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
513 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
514 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
516 dnl ========================================================
517 dnl GNU specific defaults
518 dnl ========================================================
519 if test "$GNU_CC"; then
523 SSSE3_FLAGS="-mssse3"
524 # FIXME: Let us build with strict aliasing. bug 414641.
525 CFLAGS="$CFLAGS -fno-strict-aliasing"
526 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
527 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
528 WARNINGS_AS_ERRORS='-Werror'
530 DSO_PIC_CFLAGS='-fPIC'
531 ASFLAGS="$ASFLAGS -fPIC"
532 AC_MSG_CHECKING([for --noexecstack option to as])
534 CFLAGS="$CFLAGS -Wa,--noexecstack"
535 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
536 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
539 AC_MSG_CHECKING([for -z noexecstack option to ld])
540 _SAVE_LDFLAGS=$LDFLAGS
541 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
542 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
544 LDFLAGS=$_SAVE_LDFLAGS)
546 AC_MSG_CHECKING([for -z text option to ld])
547 _SAVE_LDFLAGS=$LDFLAGS
548 LDFLAGS="$LDFLAGS -Wl,-z,text"
549 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
551 LDFLAGS=$_SAVE_LDFLAGS)
553 AC_MSG_CHECKING([for -z relro option to ld])
554 _SAVE_LDFLAGS=$LDFLAGS
555 LDFLAGS="$LDFLAGS -Wl,-z,relro"
556 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
558 LDFLAGS=$_SAVE_LDFLAGS)
560 AC_MSG_CHECKING([for --build-id option to ld])
561 _SAVE_LDFLAGS=$LDFLAGS
562 LDFLAGS="$LDFLAGS -Wl,--build-id"
563 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
565 LDFLAGS=$_SAVE_LDFLAGS)
567 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
568 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
569 _SAVE_LDFLAGS=$LDFLAGS
570 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
571 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
572 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
574 LDFLAGS=$_SAVE_LDFLAGS
576 # Check for -mssse3 on $CC
577 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
578 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
580 CFLAGS="$CFLAGS -mssse3"
581 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
582 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
586 # Check for -msse4.1 on $CC
587 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
588 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
590 CFLAGS="$CFLAGS -msse4.1"
591 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
592 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
596 case "${CPU_ARCH}" in
598 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
600 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
601 result="yes", result="no")
602 AC_MSG_RESULT("$result")
603 if test "$result" = "yes"; then
609 AC_MSG_CHECKING([whether we can enable AltiVec support])
612 CFLAGS="$CFLAGS -maltivec"
613 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
621 if test "$GCC_USE_GNU_LD"; then
622 # Some tools like ASan use a runtime library that is only
623 # linked against executables, so we must allow undefined
624 # symbols for shared objects in some cases.
625 if test -z "$MOZ_NO_WLZDEFS"; then
626 # Don't allow undefined symbols in libraries
627 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
629 # BSDs need `environ' exposed for posix_spawn (bug 753046)
631 DragonFly|FreeBSD|NetBSD|OpenBSD)
632 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
633 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
635 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
642 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
643 _USE_CPP_INCLUDE_FLAG=1
645 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
648 if test "$GNU_CXX"; then
649 # FIXME: Let us build with strict aliasing. bug 414641.
650 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
652 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
653 _USE_CPP_INCLUDE_FLAG=1
656 dnl ========================================================
658 dnl ========================================================
659 MOZ_ARG_ENABLE_BOOL(valgrind,
660 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
663 if test -n "$MOZ_VALGRIND"; then
664 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
666 [--enable-valgrind specified but Valgrind is not installed]))
667 AC_DEFINE(MOZ_VALGRIND)
669 AC_SUBST(MOZ_VALGRIND)
671 # For profiling builds keep the symbol information
672 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
674 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
675 STRIP_FLAGS="--strip-debug"
680 dnl ========================================================
682 dnl ========================================================
684 if test "$MOZ_DMD"; then
685 if test "${CPU_ARCH}" = "arm"; then
686 CFLAGS="$CFLAGS -funwind-tables"
687 CXXFLAGS="$CXXFLAGS -funwind-tables"
691 dnl ========================================================
692 dnl System overrides of the defaults for host
693 dnl ========================================================
696 if test -n "$_WIN32_MSVC"; then
698 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
699 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
700 HOST_RANLIB='echo ranlib'
702 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
704 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
705 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
708 case "${host_cpu}" in
710 if test -n "$_WIN32_MSVC"; then
711 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
715 if test -n "$_WIN32_MSVC"; then
716 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
718 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
724 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
725 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
728 *-linux*|*-kfreebsd*-gnu|*-gnu*)
729 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
730 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
734 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
735 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
739 dnl Get version of various core apps from the version files.
740 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
741 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
743 if test -z "$FIREFOX_VERSION"; then
744 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
747 if test -z "$FIREFOX_VERSION_DISPLAY"; then
748 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
751 MOZ_DOING_LTO(lto_is_enabled)
753 dnl ========================================================
754 dnl System overrides of the defaults for target
755 dnl ========================================================
759 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
760 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
761 MOZ_OPTIMIZE_FLAGS="-O3"
762 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
764 STRIP_FLAGS="$STRIP_FLAGS -x -S"
765 # Ensure that if we're targeting iOS an SDK was provided.
766 AC_CACHE_CHECK(for iOS target,
768 [AC_TRY_COMPILE([#include <TargetConditionals.h>
769 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
773 ac_cv_ios_target="yes",
774 ac_cv_ios_target="no")])
775 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
776 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
778 if test -n "$MOZ_IOS"; then
781 # The ExceptionHandling framework is needed for Objective-C exception
782 # logging code in nsObjCExceptions.h. Currently we only use that in debug
784 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
787 if test "x$lto_is_enabled" = "xyes"; then
788 echo "Skipping -dead_strip because lto is enabled."
789 dnl DTrace and -dead_strip don't interact well. See bug 403132.
790 dnl ===================================================================
791 elif test "x$enable_dtrace" = "xyes"; then
792 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
794 dnl check for the presence of the -dead_strip linker flag
795 AC_MSG_CHECKING([for -dead_strip option to ld])
796 _SAVE_LDFLAGS=$LDFLAGS
797 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
798 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
799 if test -n "$_HAVE_DEAD_STRIP" ; then
801 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
806 LDFLAGS=$_SAVE_LDFLAGS
809 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
812 *-android*|*-linuxandroid*)
813 AC_DEFINE(NO_PW_GECOS)
815 if test "$COMPILE_ENVIRONMENT"; then
819 MOZ_GFX_OPTIMIZE_MOBILE=1
820 if test -z "$CLANG_CC"; then
821 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
823 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
824 # -Oz is smaller than -Os on clang.
825 MOZ_OPTIMIZE_FLAGS="-Oz"
830 if test "$GNU_CC" -o "$GNU_CXX"; then
831 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
832 if test -n "$MOZ_DEBUG"; then
833 MOZ_OPTIMIZE_FLAGS="-Os"
835 MOZ_OPTIMIZE_FLAGS="-O2"
837 if test -z "$CLANG_CC"; then
838 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
842 case "${target_cpu}" in
844 CFLAGS="$CFLAGS -mieee"
845 CXXFLAGS="$CXXFLAGS -mieee"
853 # certain versions of cygwin's makedepend barf on the
854 # #include <string> vs -I./dist/include/string issue so don't use it
855 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
859 CFLAGS="$CFLAGS -mms-bitfields"
860 CXXFLAGS="$CXXFLAGS -mms-bitfields"
862 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
863 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
865 # Use static libgcc and libstdc++
866 LDFLAGS="$LDFLAGS -static"
867 # Use temp file for windres (bug 213281)
868 RCFLAGS='-O coff --use-temp-file'
869 # mingw doesn't require kernel32, user32, and advapi32 explicitly
870 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
873 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
874 WIN32_GUI_EXE_LDFLAGS=-mwindows
876 # GCC/binutils can't link to a function if we try to include dllexport function
877 # in the same library as dllimport caller. To work around it, we build NSPR
878 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
879 # function thunks need to be generated for cross-DLL calls.
880 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
882 TARGET_COMPILER_ABI=msvc
883 if test "$AS_BIN"; then
884 AS="$(basename "$AS_BIN")"
887 AR_FLAGS='-NOLOGO -OUT:$@'
889 RANLIB='echo not_ranlib'
890 STRIP='echo not_strip'
892 MKSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
893 MKCSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
894 WIN32_SUBSYSTEM_VERSION=6.01
895 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
896 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
897 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
898 _USE_CPP_INCLUDE_FLAG=1
899 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
900 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
901 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
902 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
903 if test -z "$CLANG_CL"; then
904 CPPFLAGS="$CPPFLAGS -utf-8"
906 if test "$CPU_ARCH" = "x86"; then
907 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
908 dnl more recent, so set that explicitly here unless another
909 dnl target arch has already been set.
911 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
912 CFLAGS="$CFLAGS -arch:SSE2"
914 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
915 CXXFLAGS="$CXXFLAGS -arch:SSE2"
918 SSE_FLAGS="-arch:SSE"
919 SSE2_FLAGS="-arch:SSE2"
920 dnl MSVC allows the use of intrinsics without any flags
921 dnl and doesn't have a separate arch for SSSE3
922 SSSE3_FLAGS="-arch:SSE2"
924 dnl clang-cl requires appropriate flags to enable SSSE3 support
925 dnl on all architectures.
926 if test -n "$CLANG_CL"; then
927 SSSE3_FLAGS="-mssse3"
929 dnl VS2013+ supports -Gw for better linker optimizations.
930 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
931 dnl Disabled on ASan because it causes false-positive ODR violations.
932 if test -z "$MOZ_ASAN"; then
934 CXXFLAGS="$CXXFLAGS -Gw"
936 # khuey says we can safely ignore MSVC warning C4251
937 # MSVC warning C4244 (implicit type conversion may lose data) warns
938 # and requires workarounds for perfectly valid code. Also, GCC/clang
939 # don't warn about it by default. So for consistency/sanity, we turn
940 # it off on MSVC, too.
941 # MSVC warning C4267 warns for narrowing type conversions from size_t
942 # to 32-bit integer types on 64-bit platforms. Since this is virtually
943 # the same thing as C4244, we disable C4267, too.
944 # MSVC warning C4800 warns when a value is implicitly cast to bool,
945 # because this also forces narrowing to a single byte, which can be a
946 # perf hit. But this matters so little in practice (and often we want
947 # that behavior) that it's better to turn it off.
948 # MSVC warning C4595 warns non-member operator new or delete functions
949 # may not be declared inline, as of VS2015 Update 2.
950 CFLAGS="$CFLAGS -wd4244 -wd4267"
951 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
952 if test -n "$CLANG_CL"; then
953 # XXX We should combine some of these with our generic GCC-style
956 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
957 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
958 # We use offsetof on non-POD objects all the time.
959 # We also suppress this warning on other platforms.
960 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
961 # This warns for reasonable things like:
962 # enum { X = 0xffffffffU };
963 # which is annoying for IDL headers.
964 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
965 # This warns for cases that would be reached by the Microsoft
966 # #include rules, but also currently warns on cases that would
967 # *also* be reached by standard C++ include rules. That
968 # behavior doesn't seem useful, so we turn it off.
969 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
970 # We normally error out on unknown pragmas, but since clang-cl
971 # claims to be MSVC, it would be difficult to add
972 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
973 # use such pragmas, so just ignore them.
974 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
975 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
976 # We get errors about various #pragma intrinsic directives from
977 # clang-cl, and we don't need to hear about those.
978 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
979 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
980 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
981 # as __attribute((__deprecated__)). This is nice to know,
982 # but since we don't get the equivalent warning from MSVC,
983 # let's just ignore it.
984 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
985 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
986 # We use a function like:
987 # __declspec(noreturn) __inline void f() {}
988 # which -Winvalid-noreturn complains about. Again, MSVC seems
989 # OK with it, so let's silence the warning.
990 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
991 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
992 # Missing |override| on virtual function declarations isn't
993 # something that MSVC currently warns about.
994 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
995 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
996 # declaration on |operator delete(void*)|. However, clang-cl
997 # must internally declare |operator delete(void*)| differently,
998 # which causes this warning for virtually every file in the
999 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
1000 # so there doesn't seem to be any way to convince clang-cl to
1001 # declare |delete| differently. Therefore, suppress this
1003 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1004 # At least one MSVC header and several headers in-tree have
1005 # unused typedefs, so turn this on.
1006 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1007 # jemalloc uses __declspec(allocator) as a profiler hint,
1008 # which clang-cl doesn't understand.
1009 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1011 # make 'foo == bar;' error out
1012 CFLAGS="$CFLAGS -we4553"
1013 CXXFLAGS="$CXXFLAGS -we4553"
1014 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
1015 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
1016 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1017 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1018 WARNINGS_AS_ERRORS='-WX'
1019 # Use a higher optimization level for clang-cl, so we can come closer
1020 # to MSVC's performance numbers (see bug 1443590).
1021 if test -n "$CLANG_CL"; then
1022 MOZ_OPTIMIZE_FLAGS='-O2'
1024 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1027 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1028 if test -z "$DEVELOPER_OPTIONS"; then
1029 LDFLAGS="$LDFLAGS -RELEASE"
1031 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1033 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1034 dnl both SSSE3 and SSE4.1.
1035 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1036 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1037 dnl allow AVX2 code from VS2015
1040 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1041 dnl See http://support.microsoft.com/kb/143208 to use STL
1044 MOZ_USER_DIR="Mozilla"
1048 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.])
1054 if test -n "$GNU_CC"; then
1055 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1056 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1057 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1059 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1060 LDFLAGS="$LDFLAGS -SAFESEH"
1066 if test -n "$_WIN32_MSVC"; then
1067 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1072 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1079 CFLAGS="$CFLAGS -Dunix"
1080 CXXFLAGS="$CXXFLAGS -Dunix"
1081 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1082 DSO_PIC_CFLAGS='-fPIC -DPIC'
1083 DSO_LDOPTS='-shared'
1084 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
1086 DSO_PIC_CFLAGS='-fPIC -DPIC'
1087 DSO_LDOPTS='-shared'
1089 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1090 if test "$LIBRUNPATH"; then
1091 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1093 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1094 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1098 if test -z "$X11BASE"; then
1101 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1103 DSO_PIC_CFLAGS='-fPIC'
1104 DSO_LDOPTS='-shared -fPIC'
1105 if test "$LIBRUNPATH"; then
1106 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1111 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
1116 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
1117 MOZ_OPTIMIZE_FLAGS="-O"
1120 AC_SUBST_LIST(MMX_FLAGS)
1121 AC_SUBST_LIST(SSE_FLAGS)
1122 AC_SUBST_LIST(SSE2_FLAGS)
1123 AC_SUBST_LIST(SSSE3_FLAGS)
1125 AC_SUBST(MOZ_LINKER)
1126 if test -n "$MOZ_LINKER"; then
1127 AC_DEFINE(MOZ_LINKER)
1128 MOZ_LINKER_EXTRACT=1
1129 AC_CHECK_PROGS(XZ, xz)
1132 if test -z "$COMPILE_ENVIRONMENT"; then
1133 SKIP_COMPILER_CHECKS=1
1134 SKIP_LIBRARY_CHECKS=1
1139 fi # COMPILE_ENVIRONMENT
1141 if test -z "$SKIP_COMPILER_CHECKS"; then
1142 dnl Checks for typedefs, structures, and compiler characteristics.
1143 dnl ========================================================
1158 case "${OS_TARGET}" in
1162 STL_FLAGS="-I${DIST}/stl_wrappers"
1167 dnl Checks for header files.
1168 dnl ========================================================
1170 case "$target_os" in
1171 bitrig*|dragonfly*|freebsd*|openbsd*)
1172 # for stuff like -lXshm
1173 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1177 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1178 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1179 ac_cv_sockaddr_in_sin_len,
1180 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1181 #include <sys/types.h>
1183 #include <netinet/in.h>
1184 struct sockaddr_in x;
1185 void *foo = (void*) &x.sin_len;],
1187 [ac_cv_sockaddr_in_sin_len=true],
1188 [ac_cv_sockaddr_in_sin_len=false])])
1189 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1190 AC_DEFINE(HAVE_SIN_LEN)
1191 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1192 AC_DEFINE(HAVE_SCONN_LEN)
1195 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1196 ac_cv_sockaddr_in6_sin6_len,
1197 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1198 #include <sys/types.h>
1200 #include <netinet/in.h>
1201 struct sockaddr_in6 x;
1202 void *foo = (void*) &x.sin6_len;],
1204 [ac_cv_sockaddr_in6_sin6_len=true],
1205 [ac_cv_sockaddr_in6_sin6_len=false])])
1206 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1207 AC_DEFINE(HAVE_SIN6_LEN)
1210 AC_CACHE_CHECK(for sockaddr.sa_len,
1211 ac_cv_sockaddr_sa_len,
1212 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1213 #include <sys/types.h>
1215 #include <sys/socket.h>
1217 void *foo = (void*) &x.sa_len;],
1219 [ac_cv_sockaddr_sa_len=true],
1220 [ac_cv_sockaddr_sa_len=false])])
1221 if test "$ac_cv_sockaddr_sa_len" = true ; then
1222 AC_DEFINE(HAVE_SA_LEN)
1225 MOZ_ARG_ENABLE_BOOL(dtrace,
1226 [ --enable-dtrace build with dtrace support if available (default=no)],
1227 [enable_dtrace="yes"],)
1228 if test "x$enable_dtrace" = "xyes"; then
1229 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1230 if test -n "$HAVE_DTRACE"; then
1231 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1233 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1236 AC_SUBST(HAVE_DTRACE)
1238 dnl Checks for libraries.
1239 dnl ========================================================
1240 AC_CHECK_LIB(c_r, gethostbyname_r)
1242 dnl We don't want to link with libdl even if it's present on OS X, since
1243 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1245 dnl We don't want to link against libm or libpthread on Darwin since
1246 dnl they both are just symlinks to libSystem and explicitly linking
1247 dnl against libSystem causes issues when debugging (see bug 299601).
1252 AC_SEARCH_LIBS(dlopen, dl,
1253 MOZ_CHECK_HEADER(dlfcn.h,
1254 AC_DEFINE(HAVE_DLOPEN)))
1258 _SAVE_CFLAGS="$CFLAGS"
1259 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1260 AC_CHECK_FUNCS(dladdr memmem)
1261 CFLAGS="$_SAVE_CFLAGS"
1263 if test ! "$GNU_CXX"; then
1264 AC_CHECK_LIB(C, demangle)
1267 AC_CHECK_LIB(socket, socket)
1270 XLIBS="$X_EXTRA_LIBS"
1272 dnl ========================================================
1273 dnl Checks for X libraries.
1274 dnl Ordering is important.
1275 dnl Xt is dependent upon SM as of X11R6
1276 dnl ========================================================
1277 if test -n "$MOZ_X11"; then
1278 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1279 _SAVE_LDFLAGS="$LDFLAGS"
1281 LDFLAGS="$XLDFLAGS $LDFLAGS"
1282 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1283 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1284 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1285 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1287 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1288 unset ac_cv_lib_Xt_XtFree
1289 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1290 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1291 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1292 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1295 dnl ========================================================
1297 dnl ========================================================
1298 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1299 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1300 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1301 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1302 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1303 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1305 LDFLAGS="$_SAVE_LDFLAGS"
1309 AC_SUBST_LIST(XCFLAGS)
1310 AC_SUBST_LIST(XLDFLAGS)
1311 AC_SUBST_LIST(XLIBS)
1312 AC_SUBST_LIST(XEXT_LIBS)
1313 AC_SUBST_LIST(XT_LIBS)
1315 dnl ========================================================
1316 dnl = pthread support
1317 dnl = Start by checking whether the system support pthreads
1318 dnl ========================================================
1319 case "$target_os" in
1324 AC_CHECK_LIB(pthreads, pthread_create,
1325 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1326 AC_CHECK_LIB(pthread, pthread_create,
1327 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1328 AC_CHECK_LIB(c_r, pthread_create,
1329 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1330 AC_CHECK_LIB(c, pthread_create,
1339 dnl ========================================================
1340 dnl Check the command line for --with-pthreads
1341 dnl ========================================================
1342 MOZ_ARG_WITH_BOOL(pthreads,
1343 [ --with-pthreads Force use of system pthread library with NSPR ],
1344 [ if test "$MOZ_USE_PTHREADS"x = x; then
1345 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
1351 dnl ========================================================
1352 dnl Do the platform specific pthread hackery
1353 dnl ========================================================
1354 if test "$MOZ_USE_PTHREADS"x != x
1357 dnl See if -pthread is supported.
1360 ac_cv_have_dash_pthread=no
1361 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1362 echo 'int main() { return 0; }' | cat > conftest.c
1363 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1364 if test $? -eq 0; then
1365 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1366 ac_cv_have_dash_pthread=yes
1367 case "$target_os" in
1369 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1372 CFLAGS="$CFLAGS -pthread"
1373 CXXFLAGS="$CXXFLAGS -pthread"
1379 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1382 dnl See if -pthreads is supported.
1384 ac_cv_have_dash_pthreads=no
1385 if test "$ac_cv_have_dash_pthread" = "no"; then
1386 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1387 echo 'int main() { return 0; }' | cat > conftest.c
1388 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1389 if test $? -eq 0; then
1390 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1391 ac_cv_have_dash_pthreads=yes
1392 CFLAGS="$CFLAGS -pthreads"
1393 CXXFLAGS="$CXXFLAGS -pthreads"
1397 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1402 AC_DEFINE(_REENTRANT)
1403 AC_DEFINE(_THREAD_SAFE)
1404 dnl -pthread links in -lpthread, so don't specify it explicitly.
1405 if test "$ac_cv_have_dash_pthread" = "yes"; then
1406 _PTHREAD_LDFLAGS="-pthread"
1410 *-*-openbsd*|*-*-bsdi*)
1411 AC_DEFINE(_REENTRANT)
1412 AC_DEFINE(_THREAD_SAFE)
1413 dnl -pthread links in -lc_r, so don't specify it explicitly.
1414 if test "$ac_cv_have_dash_pthread" = "yes"; then
1415 _PTHREAD_LDFLAGS="-pthread"
1419 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1420 AC_DEFINE(_REENTRANT)
1424 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1425 AC_SUBST(MOZ_USE_PTHREADS)
1426 MOZ_CHECK_HEADERS(pthread.h)
1430 dnl Checks for library functions.
1431 dnl ========================================================
1432 AC_PROG_GCC_TRADITIONAL
1434 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1436 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1437 dnl avoid this on Darwin, since depending on your system config, we may think
1438 dnl it exists but it really doesn't
1439 case "$OS_TARGET" in
1443 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1444 ac_cv_clock_monotonic,
1445 [for libs in "" -lrt; do
1448 AC_TRY_LINK([#include <time.h>],
1449 [ struct timespec ts;
1450 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1451 ac_cv_clock_monotonic=$libs
1454 ac_cv_clock_monotonic=no)
1457 if test "$ac_cv_clock_monotonic" != "no"; then
1458 HAVE_CLOCK_MONOTONIC=1
1459 REALTIME_LIBS=$ac_cv_clock_monotonic
1460 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1461 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1462 AC_SUBST_LIST(REALTIME_LIBS)
1467 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1468 ac_cv_pthread_cond_timedwait_monotonic_np,
1469 AC_TRY_LINK([#include <pthread.h>],
1470 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1471 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1472 ac_cv_pthread_cond_timewait_monotonic_np=no))
1473 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1474 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1479 ac_cv_func_res_ninit,
1480 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1481 dnl no need for res_ninit() on NetBSD and OpenBSD
1482 ac_cv_func_res_ninit=no
1486 #define _BSD_SOURCE 1
1488 #include <sys/types.h>
1489 #include <netinet/in.h>
1490 #include <arpa/nameser.h>
1493 [int foo = res_ninit(&_res);],
1494 [ac_cv_func_res_ninit=yes],
1495 [ac_cv_func_res_ninit=no])
1499 if test "$ac_cv_func_res_ninit" = "yes"; then
1500 AC_DEFINE(HAVE_RES_NINIT)
1501 dnl must add the link line we do something as foolish as this... dougt
1503 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1504 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1509 dnl **********************
1510 dnl *** va_copy checks ***
1511 AC_CACHE_CHECK([for an implementation of va_copy()],
1513 [AC_TRY_COMPILE([#include <stdarg.h>
1515 void f (int i, ...) {
1516 va_list args1, args2;
1517 va_start (args1, i);
1518 va_copy (args2, args1);
1519 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1521 va_end (args1); va_end (args2);
1523 [f(0, 42); return 0],
1524 [ac_cv_va_copy=yes],
1528 AC_CACHE_CHECK([whether va_list can be copied by value],
1530 [AC_TRY_COMPILE([#include <stdarg.h>
1532 void f (int i, ...) {
1533 va_list args1, args2;
1534 va_start (args1, i);
1536 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1538 va_end (args1); va_end (args2);
1540 [f(0, 42); return 0],
1541 [ac_cv_va_val_copy=yes],
1542 [ac_cv_va_val_copy=no],
1545 if test "x$ac_cv_va_copy" = "xyes"; then
1546 AC_DEFINE(VA_COPY, va_copy)
1547 AC_DEFINE(HAVE_VA_COPY)
1550 if test "x$ac_cv_va_val_copy" = "xno"; then
1551 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1554 dnl ===================================================================
1555 dnl ========================================================
1556 dnl Put your C++ language/feature checks below
1557 dnl ========================================================
1561 if test "$GNU_CC"; then
1562 if test "$CPU_ARCH" = "arm" ; then
1563 AC_CACHE_CHECK(for ARM EABI,
1567 #if defined(__ARM_EABI__)
1570 #error Not ARM EABI.
1573 ac_cv_gcc_arm_eabi="yes",
1574 ac_cv_gcc_arm_eabi="no")])
1575 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1577 ARM_ABI_PREFIX=eabi-
1579 ARM_ABI_PREFIX=oabi-
1583 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1586 dnl See if a dynamic_cast to void* gives the most derived object.
1587 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1588 ac_cv_cpp_dynamic_cast_void_ptr,
1589 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1590 class Y { int j; public: virtual ~Y() { } };
1591 class Z : public X, public Y { int k; };
1597 return !((((void*)&mdo != (void*)subx) &&
1598 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1599 (((void*)&mdo != (void*)suby) &&
1600 ((void*)&mdo == dynamic_cast<void*>(suby))));
1602 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1603 ac_cv_cpp_dynamic_cast_void_ptr=no,
1604 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1605 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1606 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1610 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1611 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1612 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1614 _SAVE_LDFLAGS=$LDFLAGS
1615 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1616 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1617 ac_cv_thread_keyword,
1618 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1619 [return tlsIsMainThread;],
1620 ac_cv_thread_keyword=yes,
1621 ac_cv_thread_keyword=no)])
1622 LDFLAGS=$_SAVE_LDFLAGS
1623 # The custom dynamic linker doesn't support TLS variables
1625 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1626 # mips builds fail with TLS variables because of a binutils bug.
1628 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1633 *-android*|*-linuxandroid*)
1640 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1646 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1647 if test -n "$MOZ_LINKER"; then
1648 if test "$CPU_ARCH" = arm; then
1649 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1650 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1651 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1652 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1656 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1657 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1658 dnl Since the linker only understands the sysv ones, no need to build the
1659 dnl gnu style tables anyways.
1660 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1663 dnl End of C++ language/feature checks
1666 dnl ========================================================
1667 dnl = Internationalization checks
1668 dnl ========================================================
1670 dnl Internationalization and Locale support is different
1671 dnl on various UNIX platforms. Checks for specific i18n
1672 dnl features go here.
1674 AC_HAVE_FUNCS(localeconv)
1676 fi # ! SKIP_COMPILER_CHECKS
1678 if test -n "${COMPILE_ENVIRONMENT}"; then
1683 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1684 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1685 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1688 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1689 dnl features that Windows actually does support.
1691 if test -n "$SKIP_COMPILER_CHECKS"; then
1692 dnl Windows has malloc.h
1693 AC_DEFINE(MALLOC_H, [<malloc.h>])
1694 AC_DEFINE(HAVE_FORCEINLINE)
1695 AC_DEFINE(HAVE_LOCALECONV)
1696 fi # SKIP_COMPILER_CHECKS
1698 dnl Mozilla specific options
1699 dnl ========================================================
1700 dnl The macros used for command line options
1701 dnl are defined in build/autoconf/altoptions.m4.
1703 dnl ========================================================
1705 dnl = Check for external package dependencies
1707 dnl ========================================================
1708 MOZ_ARG_HEADER(External Packages)
1710 case "$OS_TARGET" in
1711 WINNT|Darwin|Android)
1721 dnl ========================================================
1722 dnl system libevent Support
1723 dnl ========================================================
1724 MOZ_ARG_WITH_STRING(system-libevent,
1725 [ --with-system-libevent[=PFX]
1726 Use system libevent [installed at prefix PFX]],
1727 LIBEVENT_DIR=$withval)
1729 _SAVE_CFLAGS=$CFLAGS
1730 _SAVE_LDFLAGS=$LDFLAGS
1732 if test "$LIBEVENT_DIR" = yes; then
1733 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1734 MOZ_SYSTEM_LIBEVENT=1,
1737 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1738 MOZ_SYSTEM_LIBEVENT=
1739 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1740 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1741 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1742 MOZ_CHECK_HEADER(event.h,
1743 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1744 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1746 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1747 AC_CHECK_LIB(event, event_init,
1748 [MOZ_SYSTEM_LIBEVENT=1
1749 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1750 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1751 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1753 CFLAGS=$_SAVE_CFLAGS
1754 LDFLAGS=$_SAVE_LDFLAGS
1757 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1759 dnl ========================================================
1760 dnl = If NSS was not detected in the system,
1761 dnl = use the one in the source tree (mozilla/security/nss)
1762 dnl ========================================================
1764 MOZ_ARG_WITH_BOOL(system-nss,
1765 [ --with-system-nss Use system installed NSS],
1768 if test -n "$_USE_SYSTEM_NSS"; then
1769 AM_PATH_NSS(3.36, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1772 if test -n "$MOZ_SYSTEM_NSS"; then
1773 NSS_LIBS="$NSS_LIBS -lcrmf"
1775 NSS_CFLAGS="-I${DIST}/include/nss"
1776 case "${OS_ARCH}" in
1777 # Only few platforms have been tested with GYP
1778 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1781 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1786 if test -z "$SKIP_LIBRARY_CHECKS"; then
1787 dnl system JPEG support
1788 dnl ========================================================
1789 MOZ_ARG_WITH_STRING(system-jpeg,
1790 [ --with-system-jpeg[=PFX]
1791 Use system libjpeg [installed at prefix PFX]],
1794 _SAVE_CFLAGS=$CFLAGS
1795 _SAVE_LDFLAGS=$LDFLAGS
1797 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1798 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1799 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1801 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1804 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1807 if test "$MOZ_SYSTEM_JPEG" = 1; then
1808 AC_TRY_COMPILE([ #include <stdio.h>
1809 #include <sys/types.h>
1810 #include <jpeglib.h> ],
1811 [ #if JPEG_LIB_VERSION < $MOZJPEG
1812 #error "Insufficient JPEG library version ($MOZJPEG required)."
1814 #ifndef JCS_EXTENSIONS
1815 #error "libjpeg-turbo JCS_EXTENSIONS required"
1819 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1821 CFLAGS=$_SAVE_CFLAGS
1822 LDFLAGS=$_SAVE_LDFLAGS
1825 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1826 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1827 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1829 fi # SKIP_LIBRARY_CHECKS
1831 dnl system ZLIB support
1832 dnl ========================================================
1833 MOZ_ZLIB_CHECK([1.2.3])
1835 if test -z "$SKIP_LIBRARY_CHECKS"; then
1836 dnl system BZIP2 Support
1837 dnl ========================================================
1838 MOZ_ARG_WITH_STRING(system-bz2,
1839 [ --with-system-bz2[=PFX]
1840 Use system libbz2 [installed at prefix PFX]],
1843 _SAVE_CFLAGS=$CFLAGS
1844 _SAVE_LDFLAGS=$LDFLAGS
1846 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
1847 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
1848 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
1850 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
1853 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
1854 [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
1856 CFLAGS=$_SAVE_CFLAGS
1857 LDFLAGS=$_SAVE_LDFLAGS
1860 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
1861 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
1862 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
1865 dnl ========================================================
1866 dnl system PNG Support
1867 dnl ========================================================
1868 MOZ_ARG_WITH_STRING(system-png,
1869 [ --with-system-png[=PFX]
1870 Use system libpng [installed at prefix PFX]],
1873 _SAVE_CFLAGS=$CFLAGS
1874 _SAVE_LDFLAGS=$LDFLAGS
1876 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1877 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1878 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1880 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1883 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1884 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1885 AC_CHECK_LIB(png, png_get_acTL, ,
1886 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1888 if test "$MOZ_SYSTEM_PNG" = 1; then
1889 AC_TRY_COMPILE([ #include <stdio.h>
1890 #include <sys/types.h>
1892 [ #if PNG_LIBPNG_VER < $MOZPNG
1893 #error "Insufficient libpng version ($MOZPNG required)."
1895 #ifndef PNG_UINT_31_MAX
1896 #error "Insufficient libpng version."
1899 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1901 CFLAGS=$_SAVE_CFLAGS
1902 LDFLAGS=$_SAVE_LDFLAGS
1905 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1906 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1907 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1910 fi # SKIP_LIBRARY_CHECKS
1912 dnl ========================================================
1916 dnl ========================================================
1918 MOZ_ARG_HEADER(Application)
1920 ENABLE_SYSTEM_EXTENSION_DIRS=1
1921 MOZ_BRANDING_DIRECTORY=
1922 MOZ_OFFICIAL_BRANDING=
1924 MOZ_AUTH_EXTENSION=1
1925 if test "$MOZ_IOS"; then
1931 MOZ_SAMPLE_TYPE_FLOAT32=
1932 MOZ_SAMPLE_TYPE_S16=
1934 MOZ_WEBRTC_HARDWARE_AEC_NS=
1942 LIBJPEG_TURBO_ASFLAGS=
1943 MOZ_PREF_EXTENSIONS=1
1946 MOZ_TOOLKIT_SEARCH=1
1947 MOZ_UNIVERSALCHARDET=1
1952 MOZ_USE_NATIVE_POPUP_WINDOWS=
1953 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1955 MOZ_CONTENT_SANDBOX=
1958 MOZ_BINARY_EXTENSIONS=
1961 case "$target_os" in
1964 AC_DEFINE(NS_ENABLE_TSF)
1969 *-android*|*-linuxandroid*)
1975 # Optional Firefox for Android partner distribution directory.
1976 MOZ_ARG_WITH_STRING(android-distribution-directory,
1977 [ --with-android-distribution-directory=dir
1978 Optional Firefox for Android partner distribution directory.],
1979 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1981 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1982 # A distribution directory must have an assets/distribution directory.
1983 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1984 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1985 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1986 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1989 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1991 dnl ========================================================
1992 dnl = Trademarked Branding
1993 dnl ========================================================
1994 MOZ_ARG_ENABLE_BOOL(official-branding,
1995 [ --enable-official-branding
1996 Enable Official mozilla.org Branding
1997 Do not distribute builds with
1998 --enable-official-branding unless you have
1999 permission to use trademarks per
2000 http://www.mozilla.org/foundation/trademarks/ .],
2001 MOZ_OFFICIAL_BRANDING=1,
2002 MOZ_OFFICIAL_BRANDING=)
2004 # Allow the application to influence configure with a confvars.sh script.
2005 AC_MSG_CHECKING([if app-specific confvars.sh exists])
2006 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
2007 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
2008 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2013 # Allow influencing configure with a defines.sh script.
2014 . "${srcdir}/build/defines.sh"
2016 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2018 if test "$BUILDING_RELEASE"; then
2019 # Override value in defines.sh, if any
2020 EARLY_BETA_OR_EARLIER=
2021 elif test "$EARLY_BETA_OR_EARLIER"; then
2022 AC_DEFINE(EARLY_BETA_OR_EARLIER)
2024 AC_SUBST(EARLY_BETA_OR_EARLIER)
2026 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2027 MOZ_ARG_WITH_STRING(app-name,
2028 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2029 WITH_APP_NAME=$withval,
2032 if test -n "$WITH_APP_NAME" ; then
2033 MOZ_APP_NAME="$WITH_APP_NAME"
2036 MOZ_ARG_WITH_STRING(app-basename,
2037 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2038 WITH_APP_BASENAME=$withval,
2041 if test -n "$WITH_APP_BASENAME" ; then
2042 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2045 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2046 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2048 case "$MOZ_BUILD_APP" in
2050 AC_DEFINE(MOZ_PHOENIX)
2054 AC_DEFINE(MOZ_XULRUNNER)
2058 # Graphene is a desktop runtime for running applications with a HTML UI.
2059 if test -n "$MOZ_GRAPHENE"; then
2060 AC_DEFINE(MOZ_GRAPHENE)
2063 if test -n "$MOZ_MULET"; then
2064 AC_DEFINE(MOZ_MULET)
2067 AC_SUBST(MOZ_PHOENIX)
2068 AC_SUBST(MOZ_XULRUNNER)
2071 dnl ========================================================
2072 dnl Ensure Android SDK and build-tools versions depending on
2074 dnl ========================================================
2076 case "$MOZ_BUILD_APP" in
2078 MOZ_ANDROID_SDK(23, 23, 26.0.2, 26.0.0 26.0.0-dev 25.3.2 25.3.1)
2082 dnl ========================================================
2084 dnl = Toolkit Options
2086 dnl ========================================================
2087 MOZ_ARG_HEADER(Toolkit Options)
2089 dnl ========================================================
2090 dnl = Enable the toolkit as needed =
2091 dnl ========================================================
2093 case "$MOZ_WIDGET_TOOLKIT" in
2096 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2097 # Use -Wl as a trick to avoid -framework and framework names from
2098 # being separated by AC_SUBST_LIST.
2099 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'
2101 CFLAGS="$CFLAGS $TK_CFLAGS"
2102 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2103 MOZ_USER_DIR="Mozilla"
2104 MOZ_FS_LAYOUT=bundle
2108 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2110 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'
2111 CFLAGS="$CFLAGS $TK_CFLAGS"
2112 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2113 MOZ_USER_DIR="Mozilla"
2114 MOZ_FS_LAYOUT=bundle
2119 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2120 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2121 case "$MOZ_WIDGET_TOOLKIT" in
2127 if test "$COMPILE_ENVIRONMENT"; then
2128 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2129 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
2130 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2131 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2132 TK_LIBS=$MOZ_GTK3_LIBS
2133 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2134 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2135 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2136 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2138 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2139 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2141 if test "$MOZ_ENABLE_GTK"; then
2142 if test "$MOZ_X11"; then
2143 GDK_PACKAGES=gdk-x11-2.0
2145 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2146 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2148 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
2149 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2151 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2152 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2153 TK_LIBS=$MOZ_GTK2_LIBS
2155 fi # COMPILE_ENVIRONMENT
2157 AC_SUBST(MOZ_FS_LAYOUT)
2159 dnl ========================================================
2160 dnl = startup-notification support module
2161 dnl ========================================================
2163 if test "$MOZ_ENABLE_GTK"
2165 MOZ_ENABLE_STARTUP_NOTIFICATION=
2167 MOZ_ARG_ENABLE_BOOL(startup-notification,
2168 [ --enable-startup-notification
2169 Enable startup-notification support (default: disabled) ],
2170 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2171 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2172 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2174 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2175 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2176 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2177 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2179 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2181 MOZ_ENABLE_STARTUP_NOTIFICATION=
2185 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2186 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2189 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2191 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2193 AC_SUBST_LIST(TK_CFLAGS)
2194 AC_SUBST_LIST(TK_LIBS)
2199 dnl ========================================================
2201 dnl = Components & Features
2203 dnl ========================================================
2204 MOZ_ARG_HEADER(Components and Features)
2206 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2207 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2208 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2209 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2211 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2212 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2216 MOZ_ARG_WITH_STRING(branding,
2217 [ --with-branding=dir Use branding from the specified directory.],
2218 MOZ_BRANDING_DIRECTORY=$withval)
2220 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2221 if test -z "$REAL_BRANDING_DIRECTORY"; then
2222 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2225 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2226 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2227 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2228 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2231 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2233 dnl ========================================================
2234 dnl = Distribution ID
2235 dnl ========================================================
2236 MOZ_ARG_WITH_STRING(distribution-id,
2237 [ --with-distribution-id=ID
2238 Set distribution-specific id (default=org.mozilla)],
2239 [ val=`echo $withval`
2240 MOZ_DISTRIBUTION_ID="$val"])
2242 if test -z "$MOZ_DISTRIBUTION_ID"; then
2243 MOZ_DISTRIBUTION_ID="org.mozilla"
2246 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2247 AC_SUBST(MOZ_DISTRIBUTION_ID)
2249 dnl ========================================================
2250 dnl = GConf support module
2251 dnl ========================================================
2255 if test "$MOZ_ENABLE_GTK"
2260 dnl ========================================================
2261 dnl = GConf support module
2262 dnl ========================================================
2263 MOZ_ARG_DISABLE_BOOL(gconf,
2264 [ --disable-gconf Disable Gconf support ],
2268 if test "$MOZ_ENABLE_GCONF"
2270 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2271 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2274 if test -n "$MOZ_ENABLE_GCONF";
2276 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2278 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2283 if test "$MOZ_ENABLE_GCONF"; then
2284 AC_DEFINE(MOZ_ENABLE_GCONF)
2287 AC_SUBST(MOZ_ENABLE_GCONF)
2290 dnl ========================================================
2291 dnl = libproxy support
2292 dnl ========================================================
2294 if test "$MOZ_ENABLE_GTK"
2296 MOZ_ENABLE_LIBPROXY=
2298 MOZ_ARG_ENABLE_BOOL(libproxy,
2299 [ --enable-libproxy Enable libproxy support ],
2300 MOZ_ENABLE_LIBPROXY=1,
2301 MOZ_ENABLE_LIBPROXY=)
2303 if test "$MOZ_ENABLE_LIBPROXY"
2305 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2306 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2309 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2311 dnl ========================================================
2313 dnl ========================================================
2315 if test "$MOZ_ENABLE_GTK"
2319 MOZ_ARG_DISABLE_BOOL(dbus,
2320 [ --disable-dbus Disable dbus support ],
2324 if test "$MOZ_ENABLE_DBUS"
2326 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2327 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2328 AC_DEFINE(MOZ_ENABLE_DBUS)
2331 AC_SUBST(MOZ_ENABLE_DBUS)
2333 dnl =========================================================
2334 dnl = Whether to exclude hyphenations files in the build
2335 dnl =========================================================
2336 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2337 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2340 dnl ========================================================
2341 dnl accessibility support on by default on all platforms
2342 dnl ========================================================
2343 MOZ_ARG_DISABLE_BOOL(accessibility,
2344 [ --disable-accessibility Disable accessibility support],
2347 if test "$ACCESSIBILITY"; then
2350 if test -z "$MIDL"; then
2351 if test "$GCC" != "yes"; then
2352 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2354 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
2358 AC_DEFINE(ACCESSIBILITY)
2361 dnl ========================================================
2362 dnl Accessibility is required for the linuxgl widget
2364 dnl ========================================================
2365 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2366 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2369 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2370 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2371 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2373 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2375 if test -n "$MOZ_WEBRTC"; then
2381 if test -n "$MOZ_X11"; then
2382 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2386 dnl ========================================================
2387 dnl = Force hardware AEC, disable webrtc.org AEC
2388 dnl ========================================================
2389 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2390 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2391 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2392 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2394 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2395 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2398 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2401 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2403 dnl Use integers over floats for audio on B2G and Android
2404 dnl (regarless of the CPU architecture, because audio
2405 dnl backends for those platforms don't support floats. We also
2406 dnl use integers on ARM with other OS, because it's more efficient.
2407 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
2408 MOZ_SAMPLE_TYPE_S16=1
2409 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
2410 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
2412 MOZ_SAMPLE_TYPE_FLOAT32=1
2413 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
2414 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
2417 dnl ========================================================
2418 dnl = Enable Raw Codecs
2419 dnl ========================================================
2420 MOZ_ARG_ENABLE_BOOL(raw,
2421 [ --enable-raw Enable support for RAW media],
2425 if test -n "$MOZ_RAW"; then
2431 dnl ========================================================
2432 dnl = Apple platform decoder support
2433 dnl ========================================================
2434 if test "$COMPILE_ENVIRONMENT"; then
2435 if test -n "$MOZ_APPLEMEDIA"; then
2436 # hack in frameworks for fmp4 - see bug 1029974
2437 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2438 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2439 dnl Verify CoreMedia is available.
2440 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2441 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
2443 fi # COMPILE_ENVIRONMENT
2445 dnl system libvpx Support
2446 dnl ========================================================
2447 MOZ_ARG_WITH_BOOL(system-libvpx,
2448 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2449 MOZ_SYSTEM_LIBVPX=1)
2454 _SAVE_CFLAGS=$CFLAGS
2456 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2457 dnl ============================
2458 dnl === libvpx Version check ===
2459 dnl ============================
2460 dnl Check to see if we have a system libvpx package.
2461 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2463 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2464 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2466 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2467 [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
2469 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2470 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2472 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2473 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2474 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2475 "$ac_cv_func_vpx_mem_set_functions" = no; then
2476 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2479 CFLAGS=$_SAVE_CFLAGS
2482 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2483 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2484 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2486 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
2492 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2494 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2495 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2496 dnl We currently require gcc on all arm platforms.
2498 dnl See if we have assembly on this platform.
2499 case "$OS_ARCH:$CPU_ARCH" in
2513 dnl Check for yasm 1.1 or greater.
2514 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2515 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
2516 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2517 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
2521 dnl The encoder needs obj_int_extract to get asm offsets.
2522 fi # COMPILE_ENVIRONMENT and others
2525 if test -n "$GNU_AS" ; then
2526 dnl These flags are a lie; they're just used to enable the requisite
2527 dnl opcodes; actual arch detection is done at runtime.
2528 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2529 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2531 dnl Building with -mfpu=neon requires either the "softfp" or the
2532 dnl "hardfp" ABI. Depending on the compiler's default target, and the
2533 dnl CFLAGS, the default ABI might be neither, in which case it is the
2534 dnl "softfloat" ABI.
2535 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2536 dnl we can safely mix code built with both ABIs. So, if we detect
2537 dnl that compiling uses the "softfloat" ABI, force the use of the
2538 dnl "softfp" ABI instead.
2539 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2540 dnl "softfloat" ABI, not the "softfp" ABI.
2541 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2544 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2546 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2551 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2557 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2564 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2565 AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
2566 fi # COMPILE_ENVIRONMENT and others
2568 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2572 if test -n "$VPX_X86_ASM"; then
2573 AC_DEFINE(VPX_X86_ASM)
2574 elif test -n "$VPX_ARM_ASM"; then
2575 AC_DEFINE(VPX_ARM_ASM)
2577 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2580 dnl native libvpx no longer has vpx_mem_set_functions
2581 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2584 dnl ========================================================
2585 dnl = Handle dependent MEDIA defines
2586 dnl ========================================================
2588 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
2589 AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive! The build system should not allow them both to be set, but they are. Please file a bug at https://bugzilla.mozilla.org/])
2592 if test -n "$MOZ_VORBIS"; then
2593 AC_DEFINE(MOZ_VORBIS)
2596 if test -n "$MOZ_TREMOR"; then
2597 AC_DEFINE(MOZ_TREMOR)
2601 AC_DEFINE(MOZ_WEBM_ENCODER)
2602 AC_SUBST(MOZ_WEBM_ENCODER)
2604 dnl ==================================
2605 dnl = Check alsa availability on Linux
2606 dnl ==================================
2608 MOZ_ARG_ENABLE_BOOL(alsa,
2609 [ --enable-alsa Enable Alsa support],
2613 if test -n "$MOZ_ALSA"; then
2614 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
2615 [echo "$MOZ_ALSA_PKG_ERRORS"
2616 AC_MSG_ERROR([Need alsa for audio output on Linux. (On Ubuntu, you might try installing the package libasound2-dev.)])])
2621 dnl ========================================================
2622 dnl = Disable PulseAudio
2623 dnl ========================================================
2625 dnl If using Desktop Linux, ensure that the PA library is available
2626 case "$OS_TARGET" in
2627 WINNT|Darwin|Android|OpenBSD)
2634 MOZ_ARG_DISABLE_BOOL(pulseaudio,
2635 [ --disable-pulseaudio Disable PulseAudio support],
2639 if test -n "$MOZ_PULSEAUDIO"; then
2640 AC_DEFINE(MOZ_PULSEAUDIO)
2641 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
2642 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
2643 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
2646 AC_SUBST(MOZ_PULSEAUDIO)
2648 dnl ========================================================
2650 dnl ========================================================
2652 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2653 [ --disable-negotiateauth Disable GSS-API negotiation ],
2654 MOZ_AUTH_EXTENSION=,
2655 MOZ_AUTH_EXTENSION=1 )
2657 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2658 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2661 dnl ========================================================
2662 dnl Pref extensions (autoconfig)
2663 dnl ========================================================
2664 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2665 [ --disable-pref-extensions
2666 Disable pref extensions such as autoconfig],
2667 MOZ_PREF_EXTENSIONS=,
2668 MOZ_PREF_EXTENSIONS=1 )
2670 dnl ========================================================
2671 dnl Searching of system directories for extensions.
2672 dnl Note: this switch is meant to be used for test builds
2673 dnl whose behavior should not depend on what happens to be
2674 dnl installed on the local machine.
2675 dnl ========================================================
2676 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2677 [ --disable-system-extension-dirs
2678 Disable searching system- and account-global
2679 directories for extensions of any kind; use
2680 only profile-specific extension directories],
2681 ENABLE_SYSTEM_EXTENSION_DIRS=,
2682 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2683 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2684 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2687 dnl ========================================================
2688 dnl = Universalchardet
2689 dnl ========================================================
2690 MOZ_ARG_DISABLE_BOOL(universalchardet,
2691 [ --disable-universalchardet
2692 Disable universal encoding detection],
2693 MOZ_UNIVERSALCHARDET=,
2694 MOZ_UNIVERSALCHARDET=1 )
2696 dnl ========================================================
2697 dnl = ANGLE OpenGL->D3D translator for WebGL
2698 dnl = * only applies to win32 (and then, not MINGW)
2699 dnl ========================================================
2703 MOZ_HAS_WINSDK_WITH_D3D=
2704 MOZ_D3DCOMPILER_VISTA_DLL=
2705 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2707 if test "$COMPILE_ENVIRONMENT" ; then
2708 case "$target_os" in
2710 MOZ_ANGLE_RENDERER=1
2714 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2715 case "${target_cpu}" in
2717 MOZ_D3D_CPU_SUFFIX=x86
2720 MOZ_D3D_CPU_SUFFIX=x64
2724 dnl ========================================================
2725 dnl D3D compiler DLL
2726 dnl ========================================================
2727 MOZ_FOUND_D3D_COMPILERS=
2729 if test -n "$MOZ_ANGLE_RENDERER"; then
2730 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2731 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2734 ######################################
2735 # Find _46+ for use by Vista+.
2737 # Find a D3D compiler DLL in a Windows SDK.
2738 MOZ_D3DCOMPILER_VISTA_DLL=
2739 case "$MOZ_WINSDK_MAXVER" in
2741 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2742 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2746 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2747 # We have a name, now track down the path.
2748 if test -n "$WINDOWSSDKDIR"; then
2749 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2750 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2751 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2752 MOZ_HAS_WINSDK_WITH_D3D=1
2754 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2755 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2756 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2759 AC_MSG_RESULT([Windows SDK not found.])
2762 if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2763 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2765 AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2769 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2770 MOZ_D3DCOMPILER_VISTA_DLL=
2773 # On mingw, check if headers are provided by toolchain.
2774 if test -n "$GNU_CC"; then
2775 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2778 ######################################
2779 # Check that we found what we needed.
2780 MOZ_FOUND_A_D3D_COMPILER=
2782 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2783 MOZ_FOUND_A_D3D_COMPILER=1
2784 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
2787 if test -z "$CROSS_COMPILE"; then
2788 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
2789 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
2792 fi # MOZ_ANGLE_RENDERER
2794 fi # COMPILE_ENVIRONMENT
2797 dnl ========================================================
2799 dnl ========================================================
2800 MOZ_GAMEPAD_BACKEND=stub
2802 case "$OS_TARGET" in
2804 if test -z "$MOZ_IOS"; then
2805 MOZ_GAMEPAD_BACKEND=cocoa
2809 MOZ_GAMEPAD_BACKEND=windows
2812 MOZ_CHECK_HEADER([linux/joystick.h])
2813 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2814 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2816 MOZ_GAMEPAD_BACKEND=linux
2819 MOZ_GAMEPAD_BACKEND=android
2825 AC_SUBST(MOZ_GAMEPAD_BACKEND)
2827 dnl ========================================================
2828 dnl = Breakpad crash reporting (on by default on supported platforms)
2829 dnl ========================================================
2832 i?86-*-mingw*|x86_64-*-mingw*)
2835 i?86-apple-darwin*|x86_64-apple-darwin*)
2836 if test -z "$MOZ_IOS"; then
2840 *-android*|*-linuxandroid*)
2841 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2842 dnl be before Linux condition
2845 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2846 if test "$MOZ_ENABLE_GTK"; then
2852 MOZ_ARG_DISABLE_BOOL(crashreporter,
2853 [ --disable-crashreporter Disable breakpad crash reporting],
2854 [MOZ_CRASHREPORTER=],
2855 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2857 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2858 if test "$MOZ_CRASHREPORTER" = F; then
2859 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2864 if test -n "$MOZ_CRASHREPORTER"; then
2865 AC_DEFINE(MOZ_CRASHREPORTER)
2867 if test "$OS_TARGET" = "Linux" && \
2868 test -z "$SKIP_LIBRARY_CHECKS"; then
2869 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2872 if test "$OS_ARCH" = "WINNT"; then
2873 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2874 MOZ_CRASHREPORTER_INJECTOR=1
2875 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2880 dnl ========================================================
2881 dnl = libjpeg-turbo configuration
2882 dnl ========================================================
2884 LIBJPEG_TURBO_USE_YASM=
2885 if test -z "$MOZ_SYSTEM_JPEG"; then
2889 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
2890 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
2892 MOZ_LIBJPEG_TURBO=1)
2894 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
2895 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
2898 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
2901 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
2903 dnl Do we support libjpeg-turbo on this platform?
2904 case "$OS_ARCH:$CPU_ARCH" in
2906 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
2909 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2914 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
2917 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2920 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
2923 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
2926 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
2929 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2930 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
2934 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2935 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2941 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
2943 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
2944 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
2945 dnl it doesn't exist or we have too old of a version.
2947 LIBJPEG_TURBO_USE_YASM=1
2949 if test -z "$YASM" ; then
2950 AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed. Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
2953 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2954 dnl on Linux and 1.1 or newer everywhere else.
2955 if test "$OS_ARCH" = "Linux" ; then
2956 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
2957 AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
2960 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2961 AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
2968 dnl ========================================================
2969 dnl = libav-fft configuration
2970 dnl ========================================================
2974 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
2975 dnl 32-bit linux/os x have text relocation issues.
2977 case "$OS_ARCH:$CPU_ARCH" in
2986 dnl Detect if we can use yasm to compile libav's assembly
2988 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
2989 AC_DEFINE(MOZ_LIBAV_FFT)
2990 dnl Do we support libav-fft on this platform?
2991 case "$OS_ARCH:$CPU_ARCH" in
2993 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2996 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
2999 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3002 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3003 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3007 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
3012 if test -n "$LIBAV_FFT_ASFLAGS"; then
3013 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
3014 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
3016 if test -z "$YASM" ; then
3017 AC_MSG_ERROR([Yasm is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
3019 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3020 dnl on Linux and 1.1 or newer everywhere else.
3021 if test "$OS_ARCH" = "Linux" ; then
3022 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
3023 AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
3026 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3027 AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
3030 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
3031 dnl Warn if we're not building either libav or opendl-max optimized routines.
3032 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
3035 dnl ========================================================
3036 dnl = FFmpeg's ffvpx configuration
3037 dnl ========================================================
3044 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
3045 if test -n "$LIBAV_FFT_ASFLAGS"; then
3046 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
3048 dnl On x86 system with assembly optimizations disabled, the ffvp9 and
3049 dnl ffvp8 decoders give worse performance than libvpx ones. So we only
3050 dnl enable the FFmpeg FLAC decoder on those machines.
3051 MOZ_FFVPX_FLACONLY=1
3056 MOZ_FFVPX_FLACONLY=1
3057 dnl Use same conditional as MOZ_LIBVPX to enable FFmpeg's ffvpx assembly decoder.
3058 dnl aarch 64 FLAC decoder for now will be C only.
3059 FFVPX_ASFLAGS=$VPX_ASFLAGS
3063 if test -n "$MOZ_FFVPX"; then
3064 AC_DEFINE(MOZ_FFVPX)
3066 if test -n "$MOZ_FFVPX_FLACONLY"; then
3067 AC_DEFINE(MOZ_FFVPX_FLACONLY)
3070 dnl ========================================================
3071 dnl = Enable compilation of specific extension modules
3072 dnl ========================================================
3074 MOZ_ARG_ENABLE_STRING(extensions,
3075 [ --enable-extensions Enable extensions],
3076 [ for option in `echo $enableval | sed 's/,/ /g'`; do
3077 if test "$option" = "yes" -o "$option" = "all"; then
3078 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
3079 elif test "$option" = "no" -o "$option" = "none"; then
3081 elif test "$option" = "default"; then
3082 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
3083 elif test `echo "$option" | grep -c \^-` != 0; then
3084 option=`echo $option | sed 's/^-//'`
3085 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
3087 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
3090 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
3092 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
3093 dnl when trying to build a nonexistent extension.
3094 for extension in $MOZ_EXTENSIONS; do
3095 if test ! -d "${srcdir}/extensions/${extension}"; then
3096 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
3100 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
3101 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
3104 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
3105 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
3106 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
3107 MOZ_ENABLE_CAIRO_FT=1
3108 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3109 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
3110 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3113 AC_CHECK_PROGS(WGET, wget, "")
3116 dnl ========================================================
3117 dnl Maintenance Service
3118 dnl ========================================================
3120 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3121 [ --enable-maintenance-service Enable building of maintenanceservice],
3122 MOZ_MAINTENANCE_SERVICE=1,
3123 MOZ_MAINTENANCE_SERVICE= )
3125 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3126 if test "$OS_ARCH" = "WINNT"; then
3127 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3129 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3133 dnl ========================================================
3134 dnl Bundled fonts on desktop platforms
3135 dnl ========================================================
3137 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3138 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3139 MOZ_BUNDLED_FONTS=1,
3142 if test -n "$MOZ_BUNDLED_FONTS"; then
3143 AC_DEFINE(MOZ_BUNDLED_FONTS)
3146 dnl ========================================================
3147 dnl Verify MAR signatures
3148 dnl ========================================================
3150 MOZ_ARG_ENABLE_BOOL(verify-mar,
3151 [ --enable-verify-mar Enable verifying MAR signatures],
3152 MOZ_VERIFY_MAR_SIGNATURE=1,
3153 MOZ_VERIFY_MAR_SIGNATURE= )
3155 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3156 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3159 dnl ========================================================
3160 dnl Enable building the signmar program.
3161 dnl This option is much different than the --enable-verify-mar option.
3162 dnl --enable-verify-mar is for enabling the verification check on MAR
3163 dnl files in the updater. The --enable-signmar option is for building
3164 dnl the signmar program.
3165 dnl ========================================================
3167 MOZ_ARG_ENABLE_BOOL(signmar,
3168 [ --enable-signmar Enable building the signmar program],
3169 MOZ_ENABLE_SIGNMAR=1,
3170 MOZ_ENABLE_SIGNMAR= )
3172 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3173 if test -z "$COMPILE_ENVIRONMENT" ; then
3174 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3177 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3181 dnl ========================================================
3183 dnl ========================================================
3185 if test "$MOZ_IOS"; then
3189 MOZ_ARG_DISABLE_BOOL(updater,
3190 [ --disable-updater Disable building of updater],
3194 if test -n "$MOZ_UPDATER"; then
3195 AC_DEFINE(MOZ_UPDATER)
3198 dnl ========================================================
3199 dnl parental controls (for Windows Vista)
3200 dnl ========================================================
3201 MOZ_ARG_DISABLE_BOOL(parental-controls,
3202 [ --disable-parental-controls
3203 Do not build parental controls],
3204 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3205 MOZ_DISABLE_PARENTAL_CONTROLS=)
3206 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3207 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3210 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3212 dnl ========================================================
3213 dnl = Disable smartcard support
3214 dnl ========================================================
3215 if test -n "$MOZ_NO_SMART_CARDS"; then
3216 AC_DEFINE(MOZ_NO_SMART_CARDS)
3218 AC_SUBST(MOZ_NO_SMART_CARDS)
3220 dnl ========================================================
3221 dnl = Sandboxing support
3222 dnl ========================================================
3223 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3224 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3225 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3233 MOZ_ARG_DISABLE_BOOL(sandbox,
3234 [ --disable-sandbox Disable sandboxing support],
3238 dnl ========================================================
3239 dnl = Content process sandboxing
3240 dnl ========================================================
3242 case "$OS_TARGET" in
3244 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3247 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3252 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3258 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3259 [ --enable-content-sandbox Enable sandboxing support for content-processes
3260 --disable-content-sandbox Disable sandboxing support for content-processes],
3261 MOZ_CONTENT_SANDBOX=1,
3262 MOZ_CONTENT_SANDBOX=)
3264 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3265 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3268 if test -n "$MOZ_CONTENT_SANDBOX"; then
3269 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3272 AC_SUBST(MOZ_CONTENT_SANDBOX)
3274 dnl ========================================================
3275 dnl = Gecko Media Plugin sandboxing
3276 dnl ========================================================
3279 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3284 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3289 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3293 if test -n "$MOZ_GMP_SANDBOX"; then
3294 AC_DEFINE(MOZ_GMP_SANDBOX)
3297 AC_SUBST(MOZ_GMP_SANDBOX)
3299 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3303 if test -n "$MOZ_SANDBOX"; then
3304 AC_DEFINE(MOZ_SANDBOX)
3307 AC_SUBST(MOZ_SANDBOX)
3310 dnl ========================================================
3312 dnl = Module specific options
3314 dnl ========================================================
3315 MOZ_ARG_HEADER(Individual module options)
3317 dnl ========================================================
3318 dnl = Disable feed handling components
3319 dnl ========================================================
3320 MOZ_ARG_DISABLE_BOOL(feeds,
3321 [ --disable-feeds Disable feed handling and processing components],
3324 if test -n "$MOZ_FEEDS"; then
3325 AC_DEFINE(MOZ_FEEDS)
3327 if test "$MOZ_BUILD_APP" = "browser"; then
3328 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3332 dnl ========================================================
3333 dnl Check for sqlite
3334 dnl ========================================================
3337 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3338 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3339 MOZ_SYSTEM_SQLITE=1,
3340 MOZ_SYSTEM_SQLITE= )
3342 if test -n "$MOZ_SYSTEM_SQLITE"
3344 dnl ============================
3345 dnl === SQLite Version check ===
3346 dnl ============================
3347 dnl Check to see if the system SQLite package is new enough.
3348 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3350 dnl ==================================
3351 dnl === SQLITE_SECURE_DELETE check ===
3352 dnl ==================================
3353 dnl Check to see if the system SQLite package is compiled with
3354 dnl SQLITE_SECURE_DELETE enabled.
3355 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3356 _SAVE_CFLAGS="$CFLAGS"
3357 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3359 LIBS="$LIBS $SQLITE_LIBS"
3360 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3362 #include "sqlite3.h"
3364 int main(int argc, char **argv){
3365 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3367 ac_cv_sqlite_secure_delete=yes,
3368 ac_cv_sqlite_secure_delete=no,
3369 ac_cv_sqlite_secure_delete=no
3372 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3373 CFLAGS="$_SAVE_CFLAGS"
3375 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3376 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3379 dnl ===============================
3380 dnl === SQLITE_THREADSAFE check ===
3381 dnl ===============================
3382 dnl Check to see if the system SQLite package is compiled with
3383 dnl SQLITE_THREADSAFE enabled.
3384 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3385 _SAVE_CFLAGS="$CFLAGS"
3386 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3388 LIBS="$LIBS $SQLITE_LIBS"
3389 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3391 #include "sqlite3.h"
3393 int main(int argc, char **argv){
3394 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3396 ac_cv_sqlite_threadsafe=yes,
3397 ac_cv_sqlite_threadsafe=no,
3398 ac_cv_sqlite_threadsafe=no
3401 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3402 CFLAGS="$_SAVE_CFLAGS"
3404 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3405 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3408 dnl ================================
3409 dnl === SQLITE_ENABLE_FTS3 check ===
3410 dnl ================================
3411 dnl check to see if the system SQLite package is compiled with
3412 dnl SQLITE_ENABLE_FTS3 enabled.
3413 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3414 _SAVE_CFLAGS="$CFLAGS"
3415 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3417 LIBS="$LIBS $SQLITE_LIBS"
3418 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3420 #include "sqlite3.h"
3422 int main(int argc, char **argv){
3423 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3425 ac_cv_sqlite_enable_fts3=yes,
3426 ac_cv_sqlite_enable_fts3=no,
3427 ac_cv_sqlite_enable_fts3=no
3430 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3431 CFLAGS="$_SAVE_CFLAGS"
3433 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3434 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3437 dnl =========================================
3438 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3439 dnl =========================================
3440 dnl check to see if the system SQLite package is compiled with
3441 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3442 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3443 _SAVE_CFLAGS="$CFLAGS"
3444 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3446 LIBS="$LIBS $SQLITE_LIBS"
3447 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3449 #include "sqlite3.h"
3451 int main(int argc, char **argv){
3452 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3454 ac_cv_sqlite_enable_unlock_notify=yes,
3455 ac_cv_sqlite_enable_unlock_notify=no,
3456 ac_cv_sqlite_enable_unlock_notify=no
3459 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3460 CFLAGS="$_SAVE_CFLAGS"
3462 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3463 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3466 dnl =========================================
3467 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3468 dnl =========================================
3469 dnl check to see if the system SQLite package is compiled with
3470 dnl SQLITE_ENABLE_DBSTAT_VTAB.
3471 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3472 _SAVE_CFLAGS="$CFLAGS"
3473 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3475 LIBS="$LIBS $SQLITE_LIBS"
3476 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3478 #include "sqlite3.h"
3480 int main(int argc, char **argv){
3481 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3483 ac_cv_sqlite_dbstat_vtab=yes,
3484 ac_cv_sqlite_dbstat_vtab=no,
3485 ac_cv_sqlite_dbstat_vtab=no
3488 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3489 CFLAGS="$_SAVE_CFLAGS"
3491 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3492 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3495 dnl ==============================
3496 dnl === SQLite fdatasync check ===
3497 dnl ==============================
3498 dnl Check to see if fdatasync is available
3499 AC_CHECK_FUNC(fdatasync)
3502 if test -n "$MOZ_SYSTEM_SQLITE"; then
3503 AC_DEFINE(MOZ_SYSTEM_SQLITE)
3505 AC_SUBST(MOZ_SYSTEM_SQLITE)
3507 dnl ========================================================
3508 dnl = Disable zipwriter
3509 dnl ========================================================
3510 MOZ_ARG_DISABLE_BOOL(zipwriter,
3511 [ --disable-zipwriter Disable zipwriter component],
3514 AC_SUBST(MOZ_ZIPWRITER)
3516 dnl ========================================================
3518 dnl = Feature options that require extra sources to be pulled
3520 dnl ========================================================
3521 dnl MOZ_ARG_HEADER(Features that require extra sources)
3523 dnl ========================================================
3525 dnl = Runtime debugging and Optimization Options
3527 dnl ========================================================
3528 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3530 dnl ========================================================
3531 dnl enable mobile optimizations
3532 dnl ========================================================
3533 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3534 [ --enable-mobile-optimize
3535 Enable mobile optimizations],
3536 MOZ_GFX_OPTIMIZE_MOBILE=1)
3538 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3540 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3541 # We ignore paint will resample on mobile for performance.
3542 # We may want to revisit this later.
3543 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3545 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3546 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3549 dnl ========================================================
3550 dnl = Enable code optimization. ON by default.
3551 dnl ========================================================
3553 # Use value from moz.configure if one is defined. Else use our computed
3555 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
3556 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
3559 MOZ_SET_FRAMEPTR_FLAGS
3561 if test "$COMPILE_ENVIRONMENT"; then
3562 if test -n "$MOZ_OPTIMIZE"; then
3563 AC_MSG_CHECKING([for valid C compiler optimization flags])
3564 _SAVE_CFLAGS=$CFLAGS
3565 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3566 AC_TRY_COMPILE([#include <stdio.h>],
3567 [printf("Hello World\n");],
3570 AC_MSG_RESULT([$_results])
3571 if test "$_results" = "no"; then
3572 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3574 CFLAGS=$_SAVE_CFLAGS
3576 fi # COMPILE_ENVIRONMENT
3578 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
3579 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
3580 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
3581 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
3583 dnl ========================================================
3584 dnl = Disable treating compiler warnings as errors
3585 dnl ========================================================
3586 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3587 WARNINGS_AS_ERRORS=''
3590 dnl ========================================================
3591 dnl = Enable runtime logging
3592 dnl ========================================================
3593 AC_DEFINE(MOZ_LOGGING)
3594 AC_DEFINE(FORCE_PR_LOG)
3596 dnl ========================================================
3597 dnl = This will enable logging of addref, release, ctor, dtor.
3598 dnl ========================================================
3599 _ENABLE_LOGREFCNT=42
3600 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3601 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
3602 _ENABLE_LOGREFCNT=1,
3603 _ENABLE_LOGREFCNT= )
3604 if test "$_ENABLE_LOGREFCNT" = "1"; then
3605 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3606 elif test -z "$_ENABLE_LOGREFCNT"; then
3607 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3610 dnl ========================================================
3611 dnl moz_dump_painting
3612 dnl ========================================================
3613 MOZ_ARG_ENABLE_BOOL(dump-painting,
3614 [ --enable-dump-painting Enable paint debugging.],
3615 MOZ_DUMP_PAINTING=1,
3616 MOZ_DUMP_PAINTING= )
3617 if test -n "$MOZ_DUMP_PAINTING"; then
3618 AC_DEFINE(MOZ_DUMP_PAINTING)
3619 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3621 if test -n "$MOZ_DEBUG"; then
3622 AC_DEFINE(MOZ_DUMP_PAINTING)
3625 case "${OS_TARGET}" in
3626 Android|WINNT|Darwin)
3627 MOZ_GLUE_IN_PROGRAM=
3630 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3631 MOZ_GLUE_IN_PROGRAM=1
3632 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3636 dnl ========================================================
3637 dnl = Jemalloc build setup
3638 dnl ========================================================
3639 if test -z "$MOZ_MEMORY"; then
3642 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3643 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.])
3648 dnl The generic feature tests that determine how to compute ncpus are long and
3649 dnl complicated. Therefore, simply define special cpp variables for the
3650 dnl platforms we have special knowledge of.
3653 export MOZ_NO_DEBUG_RTL=1
3657 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3659 # Allow the application to provide a subconfigure script.
3660 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3661 # ldap/c-sdk/configure refers to the enviroment value.
3662 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3663 do_output_subdirs() {
3664 if test -n "$_subconfigure_subdirs"; then
3665 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3667 _subconfigure_subdir="$1"
3668 _subconfigure_config_args="$ac_configure_args"
3670 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3671 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3672 "${srcdir}/build/autoconf/altoptions.m4" \
3673 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3678 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3679 export MOZ_GLUE_WRAP_LDFLAGS
3681 dnl ========================================================
3682 dnl = Enable using the clang plugin to build
3683 dnl ========================================================
3685 if test -n "$COMPILE_ENVIRONMENT"; then
3686 MOZ_CONFIG_CLANG_PLUGIN
3687 fi # COMPILE_ENVIRONMENT
3689 dnl ========================================================
3690 dnl = Enable stripping of libs & executables
3691 dnl ========================================================
3692 MOZ_ARG_ENABLE_BOOL(strip,
3693 [ --enable-strip Enable stripping of libs & executables ],
3697 dnl ========================================================
3698 dnl = Enable stripping of libs & executables when packaging
3699 dnl ========================================================
3700 MOZ_ARG_ENABLE_BOOL(install-strip,
3701 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3705 dnl ========================================================
3706 dnl = frontend JS debug mode
3707 dnl ========================================================
3709 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3710 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
3714 AC_SUBST(DEBUG_JS_MODULES)
3716 dnl ========================================================
3718 dnl = Profiling and Instrumenting
3720 dnl ========================================================
3721 MOZ_ARG_HEADER(Profiling and Instrumenting)
3723 dnl ========================================================
3724 dnl = Enable TaskTracer
3725 dnl ========================================================
3726 MOZ_ARG_ENABLE_BOOL(tasktracer,
3727 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
3730 if test -n "$MOZ_TASK_TRACER"; then
3731 AC_DEFINE(MOZ_TASK_TRACER)
3732 AC_SUBST(MOZ_TASK_TRACER)
3735 dnl ========================================================
3736 dnl Turn on reflow counting
3737 dnl ========================================================
3738 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3739 [ --enable-reflow-perf Enable reflow performance tracing],
3742 if test -n "$MOZ_REFLOW_PERF"; then
3743 AC_DEFINE(MOZ_REFLOW_PERF)
3746 dnl ========================================================
3747 dnl = Offer a way to disable the startup cache
3748 dnl ========================================================
3750 MOZ_ARG_DISABLE_BOOL(startupcache,
3751 [ --disable-startupcache Disable startup cache ],
3752 MOZ_DISABLE_STARTUPCACHE=1,
3753 MOZ_DISABLE_STARTUPCACHE=)
3755 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
3756 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
3758 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
3760 dnl ========================================================
3761 dnl = Support for demangling undefined symbols
3762 dnl ========================================================
3763 if test -z "$SKIP_LIBRARY_CHECKS"; then
3766 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3770 # Demangle only for debug or DMD builds
3771 MOZ_DEMANGLE_SYMBOLS=
3772 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
3773 MOZ_DEMANGLE_SYMBOLS=1
3774 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3776 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3778 dnl ========================================================
3779 dnl = Support for gcc stack unwinding (from gcc 3.3)
3780 dnl ========================================================
3781 if test -z "$SKIP_LIBRARY_CHECKS"; then
3784 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
3788 dnl ========================================================
3790 dnl ========================================================
3792 MOZ_ARG_WITH_STRING(jitreport-granularity,
3793 [ --jitreport-granularity=N
3794 Default granularity at which to report JIT code
3797 1 - code ranges for whole functions only
3798 2 - per-line information
3799 3 - per-op information],
3800 JITREPORT_GRANULARITY=$withval,
3801 JITREPORT_GRANULARITY=3)
3803 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3805 dnl ========================================================
3809 dnl ========================================================
3810 MOZ_ARG_HEADER(Misc. Options)
3812 dnl ========================================================
3813 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
3814 dnl ========================================================
3815 MOZ_ARG_WITH_STRING(user-appdir,
3816 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
3817 [ val=`echo $withval`
3818 if echo "$val" | grep "\/" >/dev/null; then
3819 AC_MSG_ERROR("Homedir must be single relative path.")
3824 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
3826 if test -z "$SKIP_COMPILER_CHECKS"; then
3827 dnl ========================================================
3829 dnl = Compiler Options
3831 dnl ========================================================
3832 MOZ_ARG_HEADER(Compiler Options)
3834 dnl ========================================================
3835 dnl Check for gcc -pipe support
3836 dnl ========================================================
3837 AC_MSG_CHECKING([for -pipe support])
3838 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3839 dnl Any gcc that supports firefox supports -pipe.
3840 CFLAGS="$CFLAGS -pipe"
3841 CXXFLAGS="$CXXFLAGS -pipe"
3842 AC_MSG_RESULT([yes])
3847 fi # ! SKIP_COMPILER_CHECKS
3849 AC_DEFINE(CPP_THROW_NEW, [throw()])
3852 if test "$COMPILE_ENVIRONMENT"; then
3854 fi # COMPILE_ENVIRONMENT
3856 dnl ========================================================
3858 dnl = Build depencency options
3860 dnl ========================================================
3861 MOZ_ARG_HEADER(Build dependencies)
3863 if test "$COMPILE_ENVIRONMENT"; then
3864 if test "$GNU_CC" -a "$GNU_CXX"; then
3865 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3867 # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
3868 # the underlying cc1 binary understands how to generate dependency files.
3869 # These options are based on analyzing what the normal clang driver sends to
3870 # cc1 when given the "correct" dependency options.
3871 if test -n "$CLANG_CL"; then
3872 _DEPEND_CFLAGS='-Xclang -MP -Xclang -MG -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
3874 dnl Don't override this for MSVC
3875 if test -z "$_WIN32_MSVC"; then
3876 _USE_CPP_INCLUDE_FLAG=
3877 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3878 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3880 echo '#include <stdio.h>' > dummy-hello.c
3882 dnl This output is localized, split at the first double space or colon and space.
3883 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
3884 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3885 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3887 if ! test -e "$_CL_STDIO_PATH"; then
3888 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3890 if test -z "$CL_INCLUDES_PREFIX"; then
3891 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3893 AC_SUBST(CL_INCLUDES_PREFIX)
3896 dnl Make sure that the build system can handle non-ASCII characters
3897 dnl in environment variables to prevent it from breaking silently on
3898 dnl non-English systems.
3899 NONASCII=$'\241\241'
3903 fi # COMPILE_ENVIRONMENT
3905 dnl ========================================================
3907 dnl = Static Build Options
3909 dnl ========================================================
3910 MOZ_ARG_HEADER(Static build options)
3912 if test -z "$MOZ_SYSTEM_ZLIB"; then
3913 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
3915 AC_DEFINE(ZLIB_IN_MOZGLUE)
3919 AC_SUBST(ZLIB_IN_MOZGLUE)
3921 dnl ========================================================
3923 dnl = Standalone module options
3925 dnl ========================================================
3926 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3929 dnl ========================================================
3931 if test -z "$SKIP_PATH_CHECKS"; then
3932 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
3933 if test "$MOZ_ENABLE_GTK" ; then
3934 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
3939 if test -z "${GLIB_GMODULE_LIBS}" \
3940 -a -n "${GLIB_CONFIG}"\
3941 -a "${GLIB_CONFIG}" != no\
3943 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
3946 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
3948 if test "$USE_FC_FREETYPE"; then
3949 if test "$COMPILE_ENVIRONMENT"; then
3950 dnl ========================================================
3951 dnl = Check for freetype2 functionality
3952 dnl ========================================================
3953 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
3955 _SAVE_CFLAGS="$CFLAGS"
3956 LIBS="$LIBS $FT2_LIBS"
3957 CFLAGS="$CFLAGS $FT2_CFLAGS"
3959 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3960 ac_cv_member_FT_Bitmap_Size_y_ppem,
3961 [AC_TRY_COMPILE([#include <ft2build.h>
3962 #include FT_FREETYPE_H],
3964 if (sizeof s.y_ppem) return 0;
3966 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3967 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3968 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3969 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3971 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3973 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3974 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3975 [FT_Bitmap_Size structure includes y_ppem field])
3977 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3980 CFLAGS="$_SAVE_CFLAGS"
3983 _SAVE_CPPFLAGS="$CPPFLAGS"
3984 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3985 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3986 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3987 CPPFLAGS="$_SAVE_CPPFLAGS"
3991 dnl ========================================================
3992 dnl Check if we need the 32-bit Linux SSE2 error dialog
3993 dnl ========================================================
3995 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3997 dnl ========================================================
3998 dnl Check for pixman and cairo
3999 dnl ========================================================
4002 MOZ_ARG_ENABLE_BOOL(system-cairo,
4003 [ --enable-system-cairo Obsolete: do not use this option],
4004 AC_MSG_ERROR(--enable-system-cairo is not supported),
4008 MOZ_ARG_ENABLE_BOOL(system-pixman,
4009 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
4011 MOZ_TREE_PIXMAN=force,
4014 if test "$MOZ_TREE_PIXMAN"; then
4015 AC_DEFINE(MOZ_TREE_PIXMAN)
4017 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
4020 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
4021 AC_DEFINE(MOZ_TREE_CAIRO)
4023 if test "$OS_ARCH" = "WINNT"; then
4024 # For now we assume that we will have a uint64_t available through
4025 # one of the above headers or mozstdint.h.
4026 AC_DEFINE(HAVE_UINT64_T)
4029 # Define macros for cairo-features.h
4030 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
4031 if test "$MOZ_X11"; then
4032 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
4033 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
4034 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
4036 if test "$_HAVE_FREETYPE2"; then
4037 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
4038 MOZ_ENABLE_CAIRO_FT=1
4039 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
4042 case "$MOZ_WIDGET_TOOLKIT" in
4044 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
4045 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
4046 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
4049 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
4050 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
4051 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
4052 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
4053 MOZ_ENABLE_D2D_SURFACE=1
4055 if test "$COMPILE_ENVIRONMENT"; then
4057 dnl D3D10 Layers depend on D2D Surfaces.
4058 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
4059 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
4064 if test "$USE_FC_FREETYPE"; then
4065 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
4067 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
4068 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
4069 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
4071 AC_SUBST(PS_SURFACE_FEATURE)
4072 AC_SUBST(SVG_SURFACE_FEATURE)
4073 AC_SUBST(XLIB_SURFACE_FEATURE)
4074 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
4075 AC_SUBST(QUARTZ_SURFACE_FEATURE)
4076 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
4077 AC_SUBST(WIN32_SURFACE_FEATURE)
4078 AC_SUBST(OS2_SURFACE_FEATURE)
4079 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
4080 AC_SUBST(FT_FONT_FEATURE)
4081 AC_SUBST(FC_FONT_FEATURE)
4082 AC_SUBST(WIN32_FONT_FEATURE)
4083 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
4084 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
4085 AC_SUBST(QUARTZ_FONT_FEATURE)
4086 AC_SUBST(PNG_FUNCTIONS_FEATURE)
4087 AC_SUBST(QT_SURFACE_FEATURE)
4088 AC_SUBST(TEE_SURFACE_FEATURE)
4090 if test "$MOZ_X11"; then
4091 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
4094 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
4096 case "$MOZ_WIDGET_TOOLKIT" in
4098 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
4099 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
4103 AC_SUBST(MOZ_TREE_CAIRO)
4104 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
4105 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
4106 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
4107 AC_SUBST(MOZ_TREE_PIXMAN)
4109 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
4110 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
4112 dnl ========================================================
4114 dnl ========================================================
4115 MOZ_ARG_DISABLE_BOOL(xul,
4116 [ --disable-xul Disable XUL],
4118 if test "$MOZ_XUL"; then
4121 dnl remove extensions that require XUL
4122 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4127 dnl ========================================================
4128 dnl necko configuration options
4129 dnl ========================================================
4132 dnl option to disable necko's wifi scanner
4135 if test "$MOZ_WIDGET_TOOLKIT"; then
4137 case "$OS_TARGET" in
4139 if test -z "$MOZ_IOS"; then
4143 DragonFly|FreeBSD|WINNT)
4154 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4155 [ --disable-necko-wifi Disable necko wifi scanner],
4159 if test "$NECKO_WIFI"; then
4160 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4161 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4163 AC_DEFINE(NECKO_WIFI)
4164 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4166 AC_SUBST(NECKO_WIFI)
4167 AC_SUBST(NECKO_WIFI_DBUS)
4170 dnl option to disable cookies
4172 MOZ_ARG_DISABLE_BOOL(cookies,
4173 [ --disable-cookies Disable cookie support],
4176 AC_SUBST(NECKO_COOKIES)
4177 if test "$NECKO_COOKIES"; then
4178 AC_DEFINE(NECKO_COOKIES)
4179 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4182 dnl ========================================================
4184 dnl = Maintainer debug option (no --enable equivalent)
4186 dnl ========================================================
4190 AC_SUBST(AR_EXTRACT)
4192 AC_SUBST_LIST(ASFLAGS)
4193 AC_SUBST(AS_DASH_C_FLAG)
4199 AC_SUBST(MOZ_AUTH_EXTENSION)
4200 AC_SUBST(MOZ_PREF_EXTENSIONS)
4201 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
4202 AC_SUBST(WARNINGS_AS_ERRORS)
4203 AC_SUBST_SET(MOZ_EXTENSIONS)
4204 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4207 AC_SUBST(MOZ_UNIVERSALCHARDET)
4208 AC_SUBST(ACCESSIBILITY)
4209 AC_SUBST(MOZ_SPELLCHECK)
4210 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4211 AC_SUBST(MOZ_CRASHREPORTER)
4212 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4213 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4214 AC_SUBST(MOZ_STUB_INSTALLER)
4215 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4216 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4217 AC_SUBST(MOZ_UPDATER)
4219 AC_SUBST(MOZ_ANGLE_RENDERER)
4220 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4221 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4222 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4223 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4225 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4226 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4227 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4228 AC_SUBST(ENABLE_STRIP)
4229 AC_SUBST(PKG_SKIP_STRIP)
4230 AC_SUBST(STRIP_FLAGS)
4231 AC_SUBST(INCREMENTAL_LINKER)
4233 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
4235 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4236 AC_SUBST(MOZ_LINKER_EXTRACT)
4238 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4239 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4242 AC_SUBST(MOZ_ADDON_SIGNING)
4243 if test "$MOZ_ADDON_SIGNING" = 1; then
4244 AC_DEFINE(MOZ_ADDON_SIGNING)
4246 AC_SUBST(MOZ_REQUIRE_SIGNING)
4247 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4248 AC_DEFINE(MOZ_REQUIRE_SIGNING)
4251 dnl ========================================================
4252 dnl = Mac bundle name prefix
4253 dnl ========================================================
4254 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4255 [ --with-macbundlename-prefix=prefix
4256 Prefix for MOZ_MACBUNDLE_NAME],
4257 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4259 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
4260 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4261 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4264 if test "$MOZ_DEBUG"; then
4265 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
4267 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4269 AC_SUBST(MOZ_MACBUNDLE_NAME)
4271 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4272 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
4273 # Otherwise, use MOZ_APP_DISPLAYNAME
4274 if test -z "$MOZ_MACBUNDLE_ID"; then
4275 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
4277 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4278 if test "$MOZ_DEBUG"; then
4279 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4282 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4283 AC_SUBST(MOZ_MACBUNDLE_ID)
4285 dnl ========================================================
4286 dnl = Child Process Name for IPC
4287 dnl ========================================================
4288 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4289 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4291 # We want to let Android unpack the file at install time, but it only does
4292 # so if the file is named libsomething.so. The lib/ path is also required
4293 # because the unpacked file will be under the lib/ subdirectory and will
4294 # need to be executed from that path.
4295 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4297 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4298 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4300 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4301 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4302 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4304 # The following variables are available to branding and application
4305 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4306 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4307 # impacts profile location and user-visible fields.
4308 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4309 # versions of a given application (e.g. Aurora and Firefox both use
4310 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4311 # for application.ini's "Name" field, which controls profile location in
4312 # the absence of a "Profile" field (see below), and various system
4313 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4314 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4315 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4316 # builds (e.g. Aurora for Firefox).
4317 # - MOZ_APP_VERSION: Defines the application version number.
4318 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4319 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4320 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4321 # defaults to a lowercase form of MOZ_APP_BASENAME.
4322 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4323 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4324 # - MOZ_APP_PROFILE: When set, used for application.ini's
4325 # "Profile" field, which controls profile location.
4326 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4327 # crash reporter server url.
4328 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4329 # the main application is set to the value of this variable. If not
4330 # set, it falls back to a Mozilla-specific value derived from the
4332 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4333 # packages produced.
4334 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
4335 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4336 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4337 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4339 if test -z "$MOZ_APP_NAME"; then
4340 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4343 if test -z "$MOZ_APP_REMOTINGNAME"; then
4344 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4347 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4348 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4351 if test -z "$ANDROID_PACKAGE_NAME" ; then
4352 # When we got rid of the Aurora channel we decided to replace the old
4353 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4354 # by all mozilla-central based branches we make this the new "default"
4355 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4356 # in their mozconfig, so they will never get this. If there are ever
4357 # non-Fennec builds for Android, they will fall into the else block
4358 # and use their own default name.
4359 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4360 # background on this.
4361 if test "$MOZ_APP_NAME" = "fennec"; then
4362 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4364 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4368 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4369 # the public with specific common shared IDs and we need to keep them
4370 # consistent forever. The specific common values are set by per-channel
4371 # branding; all other channels use a generic sharedID, set below.
4372 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4373 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4376 # For extensions and langpacks, we require a max version that is compatible
4377 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4378 # 24.0a1 and 24.0a2 aren't affected
4380 # 24.1.1 becomes 24.*
4381 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4382 if test -z "$IS_ALPHA"; then
4384 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4385 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4387 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4391 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4394 AC_SUBST(MOZ_APP_NAME)
4395 AC_SUBST(MOZ_APP_REMOTINGNAME)
4396 AC_SUBST(MOZ_APP_DISPLAYNAME)
4397 AC_SUBST(MOZ_APP_BASENAME)
4398 AC_SUBST(MOZ_APP_VENDOR)
4399 AC_SUBST(MOZ_APP_PROFILE)
4400 AC_SUBST(MOZ_APP_ID)
4401 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4402 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4403 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4404 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4405 AC_SUBST(MAR_CHANNEL_ID)
4406 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4407 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4408 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4409 AC_SUBST(MOZ_APP_UA_NAME)
4410 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4411 AC_SUBST(MOZ_APP_VERSION)
4412 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4413 AC_SUBST(MOZ_APP_MAXVERSION)
4414 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4415 AC_SUBST(FIREFOX_VERSION)
4416 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4417 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4418 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4421 AC_SUBST(MOZ_PKG_SPECIAL)
4422 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4424 if test "$MOZILLA_OFFICIAL"; then
4425 # Build revisions should always be present in official builds
4426 MOZ_INCLUDE_SOURCE_INFO=1
4429 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4430 # explicitly set the repository and changeset information in.
4431 AC_SUBST(MOZ_SOURCE_REPO)
4432 AC_SUBST(MOZ_SOURCE_CHANGESET)
4433 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4435 if test "$MOZ_TELEMETRY_REPORTING"; then
4436 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4438 # Enable Telemetry by default for nightly and aurora channels
4439 if test -z "$RELEASE_OR_BETA"; then
4440 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4444 dnl If we have any service that uploads data (and requires data submission
4445 dnl policy alert), set MOZ_DATA_REPORTING.
4446 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4447 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4448 MOZ_DATA_REPORTING=1
4449 AC_DEFINE(MOZ_DATA_REPORTING)
4450 AC_SUBST(MOZ_DATA_REPORTING)
4454 AC_SUBST(WIN32_REDIST_DIR)
4455 AC_SUBST(WIN_UCRT_REDIST_DIR)
4457 dnl ========================================================
4459 dnl ========================================================
4463 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4469 dnl Echo the CFLAGS to remove extra whitespace.
4472 $_COMPILATION_CFLAGS \
4476 $_WARNINGS_CXXFLAGS \
4477 $_COMPILATION_CXXFLAGS \
4480 COMPILE_CFLAGS=`echo \
4484 COMPILE_CXXFLAGS=`echo \
4485 $_DEFINES_CXXFLAGS \
4489 $_WARNINGS_HOST_CFLAGS \
4490 $_COMPILATION_HOST_CFLAGS \
4493 HOST_CXXFLAGS=`echo \
4494 $_WARNINGS_HOST_CXXFLAGS \
4495 $_COMPILATION_HOST_CXXFLAGS \
4498 AC_SUBST(_DEPEND_CFLAGS)
4499 AC_SUBST(MOZ_SYSTEM_JPEG)
4500 AC_SUBST(MOZ_SYSTEM_PNG)
4501 AC_SUBST(MOZ_SYSTEM_BZ2)
4503 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4504 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4505 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
4506 AC_SUBST_LIST(MOZ_BZ2_LIBS)
4507 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4508 AC_SUBST_LIST(MOZ_PNG_LIBS)
4510 AC_SUBST(MOZ_SYSTEM_NSPR)
4512 AC_SUBST(MOZ_SYSTEM_NSS)
4514 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
4515 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4516 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
4517 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4518 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4519 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4520 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4522 AC_SUBST(HOST_CMFLAGS)
4523 AC_SUBST(HOST_CMMFLAGS)
4524 AC_SUBST(OS_COMPILE_CMFLAGS)
4525 AC_SUBST(OS_COMPILE_CMMFLAGS)
4528 OS_CXXFLAGS="$CXXFLAGS"
4529 OS_CPPFLAGS="$CPPFLAGS"
4530 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4531 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4532 OS_LDFLAGS="$LDFLAGS"
4534 AC_SUBST_LIST(OS_CFLAGS)
4535 AC_SUBST_LIST(OS_CXXFLAGS)
4536 AC_SUBST_LIST(OS_CPPFLAGS)
4537 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
4538 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
4539 AC_SUBST_LIST(OS_LDFLAGS)
4544 AC_SUBST_LIST(HOST_CFLAGS)
4545 AC_SUBST_LIST(HOST_CPPFLAGS)
4546 AC_SUBST_LIST(HOST_CXXFLAGS)
4547 AC_SUBST(HOST_LDFLAGS)
4548 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
4550 AC_SUBST(HOST_AR_FLAGS)
4551 AC_SUBST(HOST_RANLIB)
4552 AC_SUBST(HOST_BIN_SUFFIX)
4554 AC_SUBST(TARGET_XPCOM_ABI)
4555 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4556 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4557 AC_SUBST(HAVE_X86_AVX2)
4558 AC_SUBST(HAVE_ALTIVEC)
4559 AC_SUBST(GCC_USE_GNU_LD)
4563 AC_SUBST_LIST(DSO_CFLAGS)
4564 AC_SUBST_LIST(DSO_PIC_CFLAGS)
4565 AC_SUBST(DSO_LDOPTS)
4566 AC_SUBST(BIN_SUFFIX)
4568 AC_SUBST(CC_VERSION)
4569 AC_SUBST(NS_ENABLE_TSF)
4570 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4571 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4573 AC_SUBST(MOZ_VORBIS)
4574 AC_SUBST(MOZ_TREMOR)
4576 AC_SUBST(MOZ_FFVPX_FLACONLY)
4577 AC_SUBST_LIST(FFVPX_ASFLAGS)
4578 AC_SUBST(VPX_USE_YASM)
4579 AC_SUBST_LIST(VPX_ASFLAGS)
4580 AC_SUBST(VPX_AS_CONVERSION)
4581 AC_SUBST(VPX_X86_ASM)
4582 AC_SUBST(VPX_ARM_ASM)
4583 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4584 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4585 AC_SUBST(MOZ_LIBAV_FFT)
4586 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4587 AC_SUBST(MOZ_DEVTOOLS)
4589 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4590 AC_SUBST(MOZ_FOLD_LIBS)
4591 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4595 dnl Host JavaScript runtime, if any, to use during cross compiles.
4598 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4600 if test -n "$COMPILE_ENVIRONMENT"; then
4601 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4603 dnl Check for missing components
4604 if test "$MOZ_X11"; then
4605 dnl ====================================================
4606 dnl = Check if X headers exist
4607 dnl ====================================================
4608 _SAVE_CFLAGS=$CFLAGS
4609 CFLAGS="$CFLAGS $XCFLAGS"
4613 #include <X11/Xlib.h>
4614 #include <X11/Intrinsic.h>
4615 #include <X11/extensions/XShm.h>
4619 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4620 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4624 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4625 CFLAGS="$_SAVE_CFLAGS"
4627 if test -n "$MISSING_X"; then
4628 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4633 fi # COMPILE_ENVIRONMENT
4635 dnl Set various defines and substitutions
4636 dnl ========================================================
4638 if test "$MOZ_DEBUG"; then
4639 AC_DEFINE(MOZ_REFLOW_PERF)
4640 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4643 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4644 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4645 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4646 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4647 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4648 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4649 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4650 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4651 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4654 AC_SUBST(MOZ_DEV_EDITION)
4655 if test -n "$MOZ_DEV_EDITION"; then
4656 AC_DEFINE(MOZ_DEV_EDITION)
4659 if test "$MOZ_DEBUG"; then
4662 case "$MOZ_UPDATE_CHANNEL" in
4663 aurora|beta|release|esr)
4670 if test -n "$A11Y_LOG"; then
4674 dnl Spit out some output
4675 dnl ========================================================
4677 dnl The following defines are used by xpcom
4678 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
4680 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
4692 # Avoid using obsolete NSPR features
4693 AC_DEFINE(NO_NSPR_10_SUPPORT)
4695 # Don't build NSS libpkix
4696 NSS_DISABLE_LIBPKIX=1
4697 AC_SUBST(NSS_DISABLE_LIBPKIX)
4699 MOZ_CREATE_CONFIG_STATUS()
4701 if test -z "$direct_nspr_config"; then
4702 dnl ========================================================
4703 dnl = Setup a nice relatively clean build environment for
4704 dnl = sub-configures.
4705 dnl ========================================================
4708 CFLAGS="$_SUBDIR_CFLAGS"
4709 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4710 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4711 LDFLAGS="$_SUBDIR_LDFLAGS"
4712 HOST_CC="$_SUBDIR_HOST_CC"
4713 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4714 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4715 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4722 # Run all configure scripts specified by a subconfigure
4723 if test -n "$_subconfigure_subdir"; then
4724 _save_srcdir="$srcdir"
4726 _save_ac_configure_args="$ac_configure_args"
4727 ac_configure_args="$_subconfigure_config_args"
4728 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
4729 ac_configure_args="$_save_ac_configure_args"
4730 srcdir="$_save_srcdir"
4733 if test "$COMPILE_ENVIRONMENT" -a "$MOZ_WIDGET_TOOLKIT"; then
4736 dnl ========================================================
4737 dnl = Setup a nice relatively clean build environment for
4738 dnl = sub-configures.
4739 dnl ========================================================
4742 CFLAGS="$_SUBDIR_CFLAGS"
4743 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4744 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4745 LDFLAGS="$_SUBDIR_LDFLAGS"
4746 HOST_CC="$_SUBDIR_HOST_CC"
4747 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4748 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4749 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4752 # Run the SpiderMonkey 'configure' script.
4753 dist=$MOZ_BUILD_ROOT/dist
4754 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4756 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
4758 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
4760 if test "$_INTL_API" = no; then
4761 ac_configure_args="$ac_configure_args --without-intl-api"
4764 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
4765 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
4766 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
4768 ac_configure_args="$ac_configure_args --prefix=$dist"
4769 if test -n "$ZLIB_IN_MOZGLUE"; then
4772 export MOZ_SYSTEM_ZLIB
4773 export MOZ_ZLIB_CFLAGS
4774 export MOZ_ZLIB_LIBS
4776 export MOZ_APP_REMOTINGNAME
4777 export MOZ_DEV_EDITION
4779 export MOZILLA_CENTRAL_PATH=$_topsrcdir
4780 export STLPORT_CPPFLAGS
4785 export ZLIB_IN_MOZGLUE
4799 export HOST_CPPFLAGS
4800 export HOST_CXXFLAGS
4803 if ! test -e js; then
4807 ac_configure_args="$ac_configure_args JS_STANDALONE="
4808 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
4809 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4811 fi # COMPILE_ENVIRONMENT
4813 dnl we need to run config.status after js/src subconfigure because we're
4814 dnl traversing its moz.build and we need its config.status for that.
4815 dnl However, writing our own config.status needs to happen before
4816 dnl subconfigures because the setup surrounding subconfigures alters
4817 dnl many AC_SUBSTed variables.
4818 MOZ_RUN_ALL_SUBCONFIGURES()
4820 rm -fr confdefs* $ac_clean_files