Bug 1613460 - Only enable keyboard control for PiP in Nightly. r=Gijs
[gecko.git] / old-configure.in
blobe29324a509e2776808f11bff8b1ef3529fcaf7c2
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 ========================================================
9 AC_PREREQ(2.13)
10 AC_INIT(config/config.mk)
11 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
12 AC_CANONICAL_SYSTEM
14 dnl ========================================================
15 dnl =
16 dnl = Don't change the following lines. Doing so breaks:
17 dnl =
18 dnl = CFLAGS="-foo" ./configure
19 dnl =
20 dnl ========================================================
21 CFLAGS="${CFLAGS=}"
22 CPPFLAGS="${CPPFLAGS=}"
23 CXXFLAGS="${CXXFLAGS=}"
24 LDFLAGS="${LDFLAGS=}"
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 ========================================================
34 _SUBDIR_CC="$CC"
35 _SUBDIR_CXX="$CXX"
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 ========================================================
48 MOZPNG=10635
49 NSPR_VERSION=4
50 NSPR_MINVER=4.25
51 NSS_VERSION=3
53 dnl Set the minimum version of toolkit libs used by mozilla
54 dnl ========================================================
55 GLIB_VERSION=2.22
56 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
57 # The macro won't be used when compiling with earlier versions anyway.
58 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
59 CAIRO_VERSION=1.10
60 GTK2_VERSION=2.18.0
61 GTK3_VERSION=3.4.0
62 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
63 W32API_VERSION=3.14
64 DBUS_VERSION=0.60
65 SQLITE_VERSION=3.31.1
67 dnl Set various checks
68 dnl ========================================================
69 MISSING_X=
71 dnl Initialize the Pthread test variables early so they can be
72 dnl  overridden by each platform.
73 dnl ========================================================
74 MOZ_USE_PTHREADS=
75 _PTHREAD_LDFLAGS=""
77 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
79 if test "$COMPILE_ENVIRONMENT"; then
80     MOZ_ANDROID_NDK
81 fi # COMPILE_ENVIRONMENT
83 case "$target" in
84 *-android*|*-linuxandroid*)
85     ;;
86 *-linux*)
87     AC_PATH_PROG(OBJCOPY,objcopy)
88     ;;
89 esac
91 case "$target" in
92 *-apple-darwin*)
93     MOZ_IOS_SDK
94     ;;
95 esac
97 AC_SUBST(ANDROID_PACKAGE_NAME)
98 AC_SUBST(OBJCOPY)
100 dnl ========================================================
101 dnl Checks for compilers.
102 dnl ========================================================
104 if test "$COMPILE_ENVIRONMENT"; then
106 if test "$target" != "$host"; then
107     MOZ_CROSS_COMPILER
108 else
109     AC_PROG_CC
110     case "$target" in
111     *-mingw*)
112       # Work around the conftest.exe access problem on Windows
113       sleep 2
114     esac
115     AC_PROG_CXX
116     AC_PROG_RANLIB
117     MOZ_PATH_PROGS(AS, $AS as, $CC)
118     AC_CHECK_PROGS(STRIP, strip, :)
119     AC_CHECK_PROGS(OTOOL, otool, :)
122 if test -n "$MOZ_WINCONSOLE"; then
123     AC_DEFINE(MOZ_WINCONSOLE)
126 MOZ_TOOL_VARIABLES
128 dnl ========================================================
129 dnl Special win32 checks
130 dnl ========================================================
132 WINVER=601
134 case "$target" in
135 *-mingw*)
136     if test "$GCC" != "yes"; then
137         # Check to see if we are really running in a msvc environemnt
138         _WIN32_MSVC=1
140         # Make sure compilers are valid
141         CFLAGS="$CFLAGS -nologo"
142         CXXFLAGS="$CXXFLAGS -TP -nologo"
143         AC_LANG_SAVE
144         AC_LANG_C
145         AC_TRY_COMPILE([#include <stdio.h>],
146             [ printf("Hello World\n"); ],,
147             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
149         AC_LANG_CPLUSPLUS
150         AC_TRY_COMPILE([#include <new.h>],
151             [ unsigned *test = new unsigned(42); ],,
152             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
153         AC_LANG_RESTORE
155         changequote(,)
156         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
157         changequote([,])
159         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
160         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
161         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
163         _CC_SUITE=14
164         MSVC_C_RUNTIME_DLL=vcruntime140.dll
165         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
167         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
168         CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
170         if test -n "$WIN_UCRT_REDIST_DIR"; then
171           if test ! -d "$WIN_UCRT_REDIST_DIR"; then
172             AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
173           fi
174           WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
175         fi
177         AC_SUBST(MSVC_C_RUNTIME_DLL)
178         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
180         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
182         if test -n "$WIN32_REDIST_DIR"; then
183           if test ! -d "$WIN32_REDIST_DIR"; then
184             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
185           fi
186           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
187         fi
189         # Check linker version, except in lld builds
190         case "$LINKER" in
191         *lld*)
192             ;;
193         *)
194             _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
195             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
196             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
197                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
198             fi
199             ;;
200         esac
202         INCREMENTAL_LINKER=1
204         unset _MSVC_VER_FILTER
206         WRAP_STL_INCLUDES=1
207         STL_FLAGS="-I${DIST}/stl_wrappers"
208     else
209         # Check w32api version
210         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
211         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
212         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
213         AC_TRY_COMPILE([#include <w32api.h>],
214             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
215                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
216                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
217                 #error "test failed."
218             #endif
219             , [ res=yes ], [ res=no ])
220         AC_MSG_RESULT([$res])
221         if test "$res" != "yes"; then
222             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
223         fi
224         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
225         # causing problems with local implementations with the same name.
226         AC_DEFINE(STRSAFE_NO_DEPRECATE)
227     fi # !GNU_CC
229     CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
230     CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
232     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
233     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
234     # Require OS features provided by IE 8.0 (Win7)
235     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
237     ;;
238 esac
240 if test -n "$_WIN32_MSVC"; then
241     SKIP_PATH_CHECKS=1
242     SKIP_COMPILER_CHECKS=1
243     SKIP_LIBRARY_CHECKS=1
245     # Since we're skipping compiler and library checks, hard-code
246     # some facts here.
247     AC_DEFINE(HAVE_IO_H)
248     AC_DEFINE(HAVE_ISATTY)
251 fi # COMPILE_ENVIRONMENT
253 AC_SUBST(GNU_CC)
254 AC_SUBST(GNU_CXX)
256 AC_SUBST_LIST(STL_FLAGS)
257 AC_SUBST(WRAP_STL_INCLUDES)
259 dnl ========================================================
260 dnl Checks for programs.
261 dnl ========================================================
262 if test "$COMPILE_ENVIRONMENT"; then
264 AC_PATH_XTRA
266 XCFLAGS="$X_CFLAGS"
268 fi # COMPILE_ENVIRONMENT
270 dnl ========================================================
271 dnl set the defaults first
272 dnl ========================================================
273 MOZ_USER_DIR=".mozilla"
275 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
277 MOZ_FS_LAYOUT=unix
279 dnl Configure platform-specific CPU architecture compiler options.
280 dnl ==============================================================
281 if test "$COMPILE_ENVIRONMENT"; then
282     MOZ_ARCH_OPTS
283 fi # COMPILE_ENVIRONMENT
285 dnl ========================================================
286 dnl Android libstdc++
287 dnl ========================================================
289 MOZ_ANDROID_CPU_ARCH
290 if test "$COMPILE_ENVIRONMENT"; then
291     MOZ_ANDROID_STLPORT
292 fi # COMPILE_ENVIRONMENT
294 dnl ========================================================
295 dnl Suppress Clang Argument Warnings
296 dnl ========================================================
297 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
298 if test -n "${CLANG_CC}${CLANG_CL}"; then
299     WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
300     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
302 if test -n "${CLANG_CXX}${CLANG_CL}"; then
303     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
306 if test -n "$COMPILE_ENVIRONMENT"; then
307    MOZ_CONFIG_SANITIZE
310 dnl ========================================================
311 dnl GNU specific defaults
312 dnl ========================================================
313 if test "$GNU_CC"; then
314     MMX_FLAGS="-mmmx"
315     SSE_FLAGS="-msse"
316     SSE2_FLAGS="-msse2"
317     SSSE3_FLAGS="-mssse3"
318     CFLAGS="$CFLAGS -fno-strict-aliasing"
319     DSO_CFLAGS=''
321     if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
322         DSO_PIC_CFLAGS='-fPIC'
323         ASFLAGS="$ASFLAGS -fPIC"
324     fi
326     AC_MSG_CHECKING([for --noexecstack option to as])
327     _SAVE_CFLAGS=$CFLAGS
328     CFLAGS="$CFLAGS -Wa,--noexecstack"
329     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
330                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
331                      AC_MSG_RESULT([no]))
332     CFLAGS=$_SAVE_CFLAGS
333     AC_MSG_CHECKING([for -z noexecstack option to ld])
334     _SAVE_LDFLAGS=$LDFLAGS
335     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
336     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
337                   AC_MSG_RESULT([no])
338                   LDFLAGS=$_SAVE_LDFLAGS)
340     AC_MSG_CHECKING([for -z text option to ld])
341     _SAVE_LDFLAGS=$LDFLAGS
342     LDFLAGS="$LDFLAGS -Wl,-z,text"
343     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
344                   AC_MSG_RESULT([no])
345                   LDFLAGS=$_SAVE_LDFLAGS)
347     AC_MSG_CHECKING([for -z relro option to ld])
348     _SAVE_LDFLAGS=$LDFLAGS
349     LDFLAGS="$LDFLAGS -Wl,-z,relro"
350     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
351                   AC_MSG_RESULT([no])
352                   LDFLAGS=$_SAVE_LDFLAGS)
354     AC_MSG_CHECKING([for -z nocopyreloc option to ld])
355     _SAVE_LDFLAGS=$LDFLAGS
356     LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
357     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
358                   AC_MSG_RESULT([no])
359                   LDFLAGS=$_SAVE_LDFLAGS)
361     AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
362     _SAVE_LDFLAGS=$LDFLAGS
363     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
364     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
365                   AC_MSG_RESULT([no])
366                   LDFLAGS=$_SAVE_LDFLAGS)
368     AC_MSG_CHECKING([for --build-id=sha1 option to ld])
369     _SAVE_LDFLAGS=$LDFLAGS
370     LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
371     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
372                   AC_MSG_RESULT([no])
373                   LDFLAGS=$_SAVE_LDFLAGS)
375     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
376     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
377     _SAVE_LDFLAGS=$LDFLAGS
378     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
379     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
380                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
381                   AC_MSG_RESULT([no]))
382     LDFLAGS=$_SAVE_LDFLAGS
384     # Check for -mssse3 on $CC
385     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
386     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
387     _SAVE_CFLAGS=$CFLAGS
388     CFLAGS="$CFLAGS -mssse3"
389     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
390                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
391                      AC_MSG_RESULT([no]))
392     CFLAGS=$_SAVE_CFLAGS
394     # Check for -msse4.1 on $CC
395     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
396     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
397     _SAVE_CFLAGS=$CFLAGS
398     CFLAGS="$CFLAGS -msse4.1"
399     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
400                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
401                      AC_MSG_RESULT([no]))
402     CFLAGS=$_SAVE_CFLAGS
404     case "${CPU_ARCH}" in
405     x86 | x86_64)
406       AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
407       AC_TRY_COMPILE([],
408                      [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
409                      result="yes", result="no")
410       AC_MSG_RESULT("$result")
411       if test "$result" = "yes"; then
412           HAVE_X86_AVX2=1
413       fi
414       ;;
416     ppc*)
417       AC_MSG_CHECKING([whether we can enable AltiVec support])
418       HAVE_ALTIVEC=
419       _SAVE_CFLAGS=$CFLAGS
420       CFLAGS="$CFLAGS -maltivec"
421       AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
422                        [HAVE_ALTIVEC=1],
423                        AC_MSG_RESULT([no]))
424       CFLAGS=$_SAVE_CFLAGS
425       ;;
426     esac
428     DSO_LDOPTS='-shared'
429     if test "$GCC_USE_GNU_LD"; then
430         # Some tools like ASan use a runtime library that is only
431         # linked against executables, so we must allow undefined
432         # symbols for shared objects in some cases.
433         if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
434             # Don't allow undefined symbols in libraries
435             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
437             # BSDs need `environ' exposed for posix_spawn (bug 753046)
438             case "$OS_TARGET" in
439             DragonFly|FreeBSD|NetBSD|OpenBSD)
440                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
441                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
442                 else
443                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
444                 fi
445                 ;;
446             esac
447         fi
448     fi
450     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
451     _USE_CPP_INCLUDE_FLAG=1
453     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
456 if test "$GNU_CXX"; then
457     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
459     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
460     _USE_CPP_INCLUDE_FLAG=1
463 # For profiling builds keep the symbol information
464 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
465     case "$OS_TARGET" in
466     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
467         STRIP_FLAGS="--strip-debug"
468         ;;
469     esac
472 dnl ========================================================
473 dnl = Enable DMD
474 dnl ========================================================
476 if test "$MOZ_DMD"; then
477     if test "${CPU_ARCH}" = "arm"; then
478         CFLAGS="$CFLAGS -funwind-tables"
479         CXXFLAGS="$CXXFLAGS -funwind-tables"
480     fi
483 dnl ========================================================
484 dnl System overrides of the defaults for host
485 dnl ========================================================
486 case "$host" in
487 *mingw*)
488     if test -n "$_WIN32_MSVC"; then
489         HOST_CFLAGS="$HOST_CFLAGS -nologo"
490     else
491         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
492     fi
493     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
494     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
495     HOST_BIN_SUFFIX=.exe
497     case "${host_cpu}" in
498     i*86)
499         if test -n "$_WIN32_MSVC"; then
500             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
501         fi
502         ;;
503     x86_64)
504         if test -n "$_WIN32_MSVC"; then
505             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
506         fi
507         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
508         ;;
509     esac
510     ;;
512 *-darwin*)
513     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
514     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
515     ;;
517 *-linux*|*-kfreebsd*-gnu|*-gnu*)
518     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
519     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
520     ;;
523     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
524     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
525     ;;
526 esac
528 dnl ========================================================
529 dnl System overrides of the defaults for target
530 dnl ========================================================
532 case "$target" in
533 *-darwin*)
534     MOZ_OPTIMIZE_FLAGS="-O3"
535     CXXFLAGS="$CXXFLAGS -stdlib=libc++"
536     DSO_LDOPTS=''
537     STRIP_FLAGS="$STRIP_FLAGS -x -S"
538     # Ensure that if we're targeting iOS an SDK was provided.
539     AC_CACHE_CHECK(for iOS target,
540                    ac_cv_ios_target,
541                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
542 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
543 #error not iOS
544 #endif],
545                                    [],
546                                    ac_cv_ios_target="yes",
547                                    ac_cv_ios_target="no")])
548     if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
549        AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
550     fi
551     if test -z "$MOZ_IOS"; then
552         # The ExceptionHandling framework is needed for Objective-C exception
553         # logging code in nsObjCExceptions.h. Currently we only use that in debug
554         # builds.
555         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
556     fi
558     dnl DTrace and -dead_strip don't interact well. See bug 403132.
559     dnl ===================================================================
560     if test "x$enable_dtrace" = "xyes"; then
561         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
562     else
563         dnl check for the presence of the -dead_strip linker flag
564         AC_MSG_CHECKING([for -dead_strip option to ld])
565         _SAVE_LDFLAGS=$LDFLAGS
566         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
567         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
568         if test -n "$_HAVE_DEAD_STRIP" ; then
569             AC_MSG_RESULT([yes])
570             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
571         else
572             AC_MSG_RESULT([no])
573         fi
575         LDFLAGS=$_SAVE_LDFLAGS
576     fi
578     MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
579     ;;
581 *-android*|*-linuxandroid*)
582     if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
583         MOZ_LINKER=1
584     fi
586     MOZ_GFX_OPTIMIZE_MOBILE=1
587     if test -z "$CLANG_CC"; then
588         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
589     else
590         MOZ_OPTIMIZE_FLAGS="-O2"
591     fi
592     ;;
594 *-*linux*)
595     if test "$GNU_CC" -o "$GNU_CXX"; then
596         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
597         if test -n "$MOZ_DEBUG"; then
598             MOZ_OPTIMIZE_FLAGS="-Os"
599         else
600             MOZ_OPTIMIZE_FLAGS="-O2"
601         fi
602         if test -z "$CLANG_CC"; then
603            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
604         fi
605     fi
607     case "${target_cpu}" in
608     alpha*)
609         CFLAGS="$CFLAGS -mieee"
610         CXXFLAGS="$CXXFLAGS -mieee"
611     ;;
612     esac
613     ;;
614 *-mingw*)
615     DSO_CFLAGS=
616     DSO_PIC_CFLAGS=
617     # certain versions of cygwin's makedepend barf on the
618     # #include <string> vs -I./dist/include/string issue so don't use it
619     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
620         # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
621         if test -z "$CLANG_CC"; then
622             AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
623         fi
625         DSO_LDOPTS='-shared'
626         # Use temp file for windres (bug 213281)
627         RCFLAGS='-O coff --use-temp-file'
628         # mingw doesn't require kernel32, user32, and advapi32 explicitly
629         LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
630         MOZ_FIX_LINK_PATHS=
632         MOZ_OPTIMIZE_FLAGS="-O2"
634         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
635         WIN32_GUI_EXE_LDFLAGS=-mwindows
637         # Silence problematic clang warnings
638         CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
639         LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
640     else
641         TARGET_COMPILER_ABI=msvc
642         RANLIB='echo not_ranlib'
643         STRIP='echo not_strip'
644         PKG_SKIP_STRIP=1
645         # aarch64 doesn't support subsystems below 6.02
646         if test "$CPU_ARCH" = "aarch64"; then
647             WIN32_SUBSYSTEM_VERSION=6.02
648         else
649             WIN32_SUBSYSTEM_VERSION=6.01
650         fi
651         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
652         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
653         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
654         _USE_CPP_INCLUDE_FLAG=1
655         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
656         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
657         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
658         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
659         if test -z "$CLANG_CL"; then
660             CPPFLAGS="$CPPFLAGS -utf-8"
661         fi
662         if test "$CPU_ARCH" = "x86"; then
663             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
664             dnl more recent, so set that explicitly here unless another
665             dnl target arch has already been set.
666             changequote(,)
667             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
668               CFLAGS="$CFLAGS -arch:SSE2"
669             fi
670             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
671               CXXFLAGS="$CXXFLAGS -arch:SSE2"
672             fi
673             changequote([,])
674             SSE_FLAGS="-arch:SSE"
675             SSE2_FLAGS="-arch:SSE2"
676             dnl MSVC allows the use of intrinsics without any flags
677             dnl and doesn't have a separate arch for SSSE3
678             SSSE3_FLAGS="-arch:SSE2"
679         fi
680         dnl clang-cl requires appropriate flags to enable SSSE3 support
681         dnl on all architectures.
682         if test -n "$CLANG_CL"; then
683             SSSE3_FLAGS="-mssse3"
684         fi
685         dnl VS2013+ supports -Gw for better linker optimizations.
686         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
687         dnl Disabled on ASan because it causes false-positive ODR violations.
688         if test -z "$MOZ_ASAN"; then
689             CFLAGS="$CFLAGS -Gw"
690             CXXFLAGS="$CXXFLAGS -Gw"
691         else
692             # String tail merging doesn't play nice with ASan's ODR checker.
693             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
694         fi
695         if test -n "$CLANG_CL"; then
696             # XXX We should combine some of these with our generic GCC-style
697             # warning checks.
698             #
699             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
700             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
701             # We use offsetof on non-POD objects all the time.
702             # We also suppress this warning on other platforms.
703             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
704             # This warns for reasonable things like:
705             #   enum { X = 0xffffffffU };
706             # which is annoying for IDL headers.
707             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
708             # This warns for cases that would be reached by the Microsoft
709             # #include rules, but also currently warns on cases that would
710             # *also* be reached by standard C++ include rules.  That
711             # behavior doesn't seem useful, so we turn it off.
712             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
713             # We normally error out on unknown pragmas, but since clang-cl
714             # claims to be MSVC, it would be difficult to add
715             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
716             # use such pragmas, so just ignore them.
717             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
718             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
719             # We get errors about various #pragma intrinsic directives from
720             # clang-cl, and we don't need to hear about those.
721             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
722             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
723             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
724             # as __attribute((__deprecated__)).  This is nice to know,
725             # but since we don't get the equivalent warning from MSVC,
726             # let's just ignore it.
727             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
728             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
729             # We use a function like:
730             #   __declspec(noreturn) __inline void f() {}
731             # which -Winvalid-noreturn complains about.  Again, MSVC seems
732             # OK with it, so let's silence the warning.
733             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
734             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
735             # Missing |override| on virtual function declarations isn't
736             # something that MSVC currently warns about.
737             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
738             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
739             # declaration on |operator delete(void*)|.  However, clang-cl
740             # must internally declare |operator delete(void*)| differently,
741             # which causes this warning for virtually every file in the
742             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
743             # so there doesn't seem to be any way to convince clang-cl to
744             # declare |delete| differently.  Therefore, suppress this
745             # warning.
746             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
747             # Macros like STDMETHOD() and IFACEMETHOD() can declare
748             # __attribute__((nothrow)) on their respective method declarations,
749             # while the definitions are left without the matching attribute.
750             CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
751             # At least one MSVC header and several headers in-tree have
752             # unused typedefs, so turn this on.
753             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
754             # jemalloc uses __declspec(allocator) as a profiler hint,
755             # which clang-cl doesn't understand.
756             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
757             # __attribute__((unused)) really means "might be unused" and
758             # we use it to avoid warnings about things that are unused
759             # in some compilation units, but used in many others.  This
760             # warning insists on complaining about the latter case, which
761             # is annoying, and rather noisy.
762             CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
763         fi
764         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
765         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
766         LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
767         MOZ_DEBUG_LDFLAGS='-DEBUG'
768         # Use a higher optimization level for clang-cl, so we can come closer
769         # to MSVC's performance numbers (see bug 1443590).
770         if test -n "$CLANG_CL"; then
771             MOZ_OPTIMIZE_FLAGS='-O2'
772         else
773             MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
774         fi
775         MOZ_FIX_LINK_PATHS=
776         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
777         if test -z "$DEVELOPER_OPTIONS"; then
778             LDFLAGS="$LDFLAGS -RELEASE"
779         fi
780         RCFLAGS="-nologo"
781         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
782         dnl both SSSE3 and SSE4.1.
783         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
784         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
785         dnl allow AVX2 code from VS2015
786         HAVE_X86_AVX2=1
787     fi
788     AC_DEFINE(WIN32_LEAN_AND_MEAN)
789     dnl See http://support.microsoft.com/kb/143208 to use STL
790     AC_DEFINE(NOMINMAX)
791     BIN_SUFFIX='.exe'
792     MOZ_USER_DIR="Mozilla"
794     case "$host_os" in
795     cygwin*|msvc*|mks*)
796         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.])
797         ;;
798     esac
800     case "$target" in
801     i*86-*)
802         if test -n "$GNU_CC"; then
803             CFLAGS="$CFLAGS -mstackrealign"
804             CXXFLAGS="$CXXFLAGS -mstackrealign"
805             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
806         else
807             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
808             LDFLAGS="$LDFLAGS -SAFESEH"
809         fi
811         AC_DEFINE(_X86_)
812         ;;
813     x86_64-*)
814         if test -n "$_WIN32_MSVC"; then
815             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
816         fi
817         AC_DEFINE(_AMD64_)
818         ;;
819     aarch64-*)
820         if test -n "$_WIN32_MSVC"; then
821             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
822         fi
823         AC_DEFINE(_ARM64_)
824         ;;
825     *)
826         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
827         ;;
828     esac
829     ;;
831 *-netbsd*)
832     DSO_CFLAGS=''
833     CFLAGS="$CFLAGS -Dunix"
834     CXXFLAGS="$CXXFLAGS -Dunix"
835     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
836         DSO_PIC_CFLAGS='-fPIC -DPIC'
837         DSO_LDOPTS='-shared'
838         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
839     else
840         DSO_PIC_CFLAGS='-fPIC -DPIC'
841         DSO_LDOPTS='-shared'
842     fi
843     # This will fail on a.out systems prior to 1.5.1_ALPHA.
844     if test "$LIBRUNPATH"; then
845         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
846     fi
847     ;;
849 *-openbsd*)
850     if test -z "$X11BASE"; then
851         X11BASE=/usr/X11R6
852     fi
853     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
854     DSO_CFLAGS=''
855     DSO_PIC_CFLAGS='-fPIC'
856     DSO_LDOPTS='-shared -fPIC'
857     if test "$LIBRUNPATH"; then
858         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
859     fi
860     ;;
862 *-solaris*)
863     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
864     ;;
866 esac
868 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
869     MOZ_OPTIMIZE_FLAGS="-O"
872 AC_SUBST_LIST(MMX_FLAGS)
873 AC_SUBST_LIST(SSE_FLAGS)
874 AC_SUBST_LIST(SSE2_FLAGS)
875 AC_SUBST_LIST(SSSE3_FLAGS)
877 AC_SUBST(MOZ_LINKER)
878 if test -n "$MOZ_LINKER"; then
879   AC_DEFINE(MOZ_LINKER)
880   MOZ_LINKER_EXTRACT=1
881   AC_CHECK_PROGS(XZ, xz)
884 if test -z "$COMPILE_ENVIRONMENT"; then
885     SKIP_COMPILER_CHECKS=1
886     SKIP_LIBRARY_CHECKS=1
887     PKG_SKIP_STRIP=1
888     MOZ_DEBUGGING_OPTS
889 else
890     MOZ_COMPILER_OPTS
891 fi # COMPILE_ENVIRONMENT
893 if test -z "$SKIP_COMPILER_CHECKS"; then
894 dnl Checks for typedefs, structures, and compiler characteristics.
895 dnl ========================================================
896 AC_C_CONST
897 AC_TYPE_MODE_T
898 AC_TYPE_OFF_T
899 AC_TYPE_PID_T
900 AC_TYPE_SIZE_T
901 AC_LANG_CPLUSPLUS
902 AC_LANG_C
904 AC_LANG_CPLUSPLUS
906 MOZ_CXX11
908 AC_LANG_C
910 case "${OS_TARGET}" in
911 Darwin)
912   ;;
914   STL_FLAGS="-I${DIST}/stl_wrappers"
915   WRAP_STL_INCLUDES=1
916   ;;
917 esac
919 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
920     WRAP_STL_INCLUDES=
923 dnl Checks for header files.
924 dnl ========================================================
925 AC_HEADER_DIRENT
926 case "$target_os" in
927 bitrig*|dragonfly*|freebsd*|openbsd*)
928 # for stuff like -lXshm
929     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
930     ;;
931 esac
933 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
934 AC_CACHE_CHECK(for sockaddr_in.sin_len,
935                    ac_cv_sockaddr_in_sin_len,
936                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
937                                     #include <sys/types.h>
938                                     #endif
939                                     #include <netinet/in.h>
940                                     struct sockaddr_in x;
941                                     void *foo = (void*) &x.sin_len;],
942                                    [],
943                                    [ac_cv_sockaddr_in_sin_len=true],
944                                    [ac_cv_sockaddr_in_sin_len=false])])
945 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
946   AC_DEFINE(HAVE_SIN_LEN)
947 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
948   AC_DEFINE(HAVE_SCONN_LEN)
951 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
952                ac_cv_sockaddr_in6_sin6_len,
953                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
954                                 #include <sys/types.h>
955                                 #endif
956                                 #include <netinet/in.h>
957                                 struct sockaddr_in6 x;
958                                 void *foo = (void*) &x.sin6_len;],
959                                [],
960                                [ac_cv_sockaddr_in6_sin6_len=true],
961                                [ac_cv_sockaddr_in6_sin6_len=false])])
962 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
963   AC_DEFINE(HAVE_SIN6_LEN)
966 AC_CACHE_CHECK(for sockaddr.sa_len,
967                ac_cv_sockaddr_sa_len,
968                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
969                                 #include <sys/types.h>
970                                 #endif
971                                 #include <sys/socket.h>
972                                 struct sockaddr x;
973                                 void *foo = (void*) &x.sa_len;],
974                                [],
975                                [ac_cv_sockaddr_sa_len=true],
976                                [ac_cv_sockaddr_sa_len=false])])
977 if test "$ac_cv_sockaddr_sa_len" = true ; then
978   AC_DEFINE(HAVE_SA_LEN)
981 MOZ_ARG_ENABLE_BOOL(dtrace,
982               [  --enable-dtrace         build with dtrace support if available (default=no)],
983               [enable_dtrace="yes"],)
984 if test "x$enable_dtrace" = "xyes"; then
985   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
986   if test -n "$HAVE_DTRACE"; then
987       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
988   else
989       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
990   fi
992 AC_SUBST(HAVE_DTRACE)
994 dnl Checks for libraries.
995 dnl ========================================================
996 AC_CHECK_LIB(c_r, gethostbyname_r)
998 dnl We don't want to link with libdl even if it's present on OS X, since
999 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1000 dnl in libc.
1001 dnl We don't want to link against libm or libpthread on Darwin since
1002 dnl they both are just symlinks to libSystem and explicitly linking
1003 dnl against libSystem causes issues when debugging (see bug 299601).
1004 case $target in
1005 *-darwin*)
1006     ;;
1008     AC_SEARCH_LIBS(dlopen, dl,
1009         MOZ_CHECK_HEADER(dlfcn.h,
1010         AC_DEFINE(HAVE_DLOPEN)))
1011     ;;
1012 esac
1014 _SAVE_CFLAGS="$CFLAGS"
1015 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1016 AC_CHECK_FUNCS(dladdr memmem)
1017 CFLAGS="$_SAVE_CFLAGS"
1019 if test ! "$GNU_CXX"; then
1020     AC_CHECK_LIB(C, demangle)
1023 AC_CHECK_LIB(socket, socket)
1025 XLDFLAGS="$X_LIBS"
1026 XLIBS="$X_EXTRA_LIBS"
1028 dnl ========================================================
1029 dnl Checks for X libraries.
1030 dnl Ordering is important.
1031 dnl Xt is dependent upon SM as of X11R6
1032 dnl ========================================================
1033 if test -n "$MOZ_X11"; then
1034     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1035     _SAVE_LDFLAGS="$LDFLAGS"
1036     _SAVE_LIBS="$LIBS"
1037     LDFLAGS="$XLDFLAGS $LDFLAGS"
1038     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1039         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1040     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1041         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1043     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1044         unset ac_cv_lib_Xt_XtFree
1045         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1046         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1047         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1048             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1049         ])
1051     dnl ========================================================
1052     dnl = Check for xcb
1053     dnl ========================================================
1054     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1055         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1056     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1057         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1058     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1059         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1061     LDFLAGS="$_SAVE_LDFLAGS"
1062     LIBS="$_SAVE_LIBS"
1063 fi # $MOZ_X11
1065 AC_SUBST_LIST(XCFLAGS)
1066 AC_SUBST_LIST(XLDFLAGS)
1067 AC_SUBST_LIST(XLIBS)
1068 AC_SUBST_LIST(XEXT_LIBS)
1069 AC_SUBST_LIST(XT_LIBS)
1071 dnl ========================================================
1072 dnl = pthread support
1073 dnl = Start by checking whether the system support pthreads
1074 dnl ========================================================
1075 case "$target_os" in
1076 darwin*)
1077     MOZ_USE_PTHREADS=1
1078     ;;
1080     AC_CHECK_LIB(pthreads, pthread_create,
1081         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1082         AC_CHECK_LIB(pthread, pthread_create,
1083             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1084             AC_CHECK_LIB(c_r, pthread_create,
1085                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1086                 AC_CHECK_LIB(c, pthread_create,
1087                     MOZ_USE_PTHREADS=1
1088                 )
1089             )
1090         )
1091     )
1092     ;;
1093 esac
1095 dnl ========================================================
1096 dnl Do the platform specific pthread hackery
1097 dnl ========================================================
1098 if test "$MOZ_USE_PTHREADS"x != x
1099 then
1100     dnl
1101     dnl See if -pthread is supported.
1102     dnl
1103     rm -f conftest*
1104     ac_cv_have_dash_pthread=no
1105     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1106     echo 'int main() { return 0; }' | cat > conftest.c
1107     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1108     if test $? -eq 0; then
1109         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1110             ac_cv_have_dash_pthread=yes
1111             case "$target_os" in
1112             freebsd*)
1113 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1114                 ;;
1115             *)
1116                 CFLAGS="$CFLAGS -pthread"
1117                 CXXFLAGS="$CXXFLAGS -pthread"
1118                 ;;
1119             esac
1120         fi
1121     fi
1122     rm -f conftest*
1123     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1125     dnl
1126     dnl See if -pthreads is supported.
1127     dnl
1128     ac_cv_have_dash_pthreads=no
1129     if test "$ac_cv_have_dash_pthread" = "no"; then
1130         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1131         echo 'int main() { return 0; }' | cat > conftest.c
1132         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1133         if test $? -eq 0; then
1134             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1135                 ac_cv_have_dash_pthreads=yes
1136                 CFLAGS="$CFLAGS -pthreads"
1137                 CXXFLAGS="$CXXFLAGS -pthreads"
1138             fi
1139         fi
1140         rm -f conftest*
1141         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1142     fi
1144     case "$target" in
1145         *-*-freebsd*)
1146             AC_DEFINE(_REENTRANT)
1147             AC_DEFINE(_THREAD_SAFE)
1148             dnl -pthread links in -lpthread, so don't specify it explicitly.
1149             if test "$ac_cv_have_dash_pthread" = "yes"; then
1150                 _PTHREAD_LDFLAGS="-pthread"
1151             fi
1152             ;;
1154         *-*-openbsd*|*-*-bsdi*)
1155             AC_DEFINE(_REENTRANT)
1156             AC_DEFINE(_THREAD_SAFE)
1157             dnl -pthread links in -lc_r, so don't specify it explicitly.
1158             if test "$ac_cv_have_dash_pthread" = "yes"; then
1159                 _PTHREAD_LDFLAGS="-pthread"
1160             fi
1161             ;;
1163         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1164             AC_DEFINE(_REENTRANT)
1165             ;;
1167     esac
1168     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1169     AC_SUBST(MOZ_USE_PTHREADS)
1170     MOZ_CHECK_HEADERS(pthread.h)
1174 dnl Checks for library functions.
1175 dnl ========================================================
1176 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1178 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1179 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1180                ac_cv_clock_monotonic,
1181                [for libs in "" -lrt; do
1182                     _SAVE_LIBS="$LIBS"
1183                     _SAVE_CFLAGS="$CFLAGS"
1184                     LIBS="$LIBS $libs"
1185                     CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1186 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1187 dnl we should or not be able to use it. To detect if we can, we need to make the
1188 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1189                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1190                                  #include <time.h>],
1191                                  [ struct timespec ts;
1192                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
1193                                  ac_cv_clock_monotonic=$libs
1194                                  LIBS="$_SAVE_LIBS"
1195                                  break,
1196                                  ac_cv_clock_monotonic=no)
1197                     LIBS="$_SAVE_LIBS"
1198                     CFLAGS="$_SAVE_CFLAGS"
1199                 done])
1200 if test "$ac_cv_clock_monotonic" != "no"; then
1201     HAVE_CLOCK_MONOTONIC=1
1202     REALTIME_LIBS=$ac_cv_clock_monotonic
1203     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1204     AC_SUBST(HAVE_CLOCK_MONOTONIC)
1205     AC_SUBST_LIST(REALTIME_LIBS)
1208 dnl Turn on warnings-as-errors to prevent implicit declaration of
1209 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1210 dnl inadvertently pass even if the function does not really exist.
1211 _SAVE_CFLAGS="$CFLAGS"
1212 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1213 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1214                ac_cv_pthread_cond_timedwait_monotonic_np,
1215                AC_TRY_LINK([#include <pthread.h>],
1216                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1217                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1218                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1219 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1220     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1222 CFLAGS=$_SAVE_CFLAGS
1224 AC_CACHE_CHECK(
1225     [for res_ninit()],
1226     ac_cv_func_res_ninit,
1227     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1228         dnl no need for res_ninit() on NetBSD and OpenBSD
1229         ac_cv_func_res_ninit=no
1230      else
1231         AC_TRY_LINK([
1232             #ifdef linux
1233             #define _BSD_SOURCE 1
1234             #endif
1235             #include <sys/types.h>
1236             #include <netinet/in.h>
1237             #include <arpa/nameser.h>
1238             #include <resolv.h>
1239             ],
1240             [int foo = res_ninit(&_res);],
1241             [ac_cv_func_res_ninit=yes],
1242             [ac_cv_func_res_ninit=no])
1243      fi
1244     ])
1246 if test "$ac_cv_func_res_ninit" = "yes"; then
1247     AC_DEFINE(HAVE_RES_NINIT)
1248 dnl must add the link line we do something as foolish as this... dougt
1249 dnl else
1250 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1251 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1254 AC_LANG_C
1256 dnl **********************
1257 dnl *** va_copy checks ***
1258 AC_CACHE_CHECK([for an implementation of va_copy()],
1259                ac_cv_va_copy,
1260     [AC_TRY_COMPILE([#include <stdarg.h>
1261                      #include <stdlib.h>
1262         void f (int i, ...) {
1263             va_list args1, args2;
1264             va_start (args1, i);
1265             va_copy (args2, args1);
1266             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1267                 exit (1);
1268             va_end (args1); va_end (args2);
1269         }],
1270         [f(0, 42); return 0],
1271         [ac_cv_va_copy=yes],
1272         [ac_cv_va_copy=no]
1273     )]
1275 AC_CACHE_CHECK([whether va_list can be copied by value],
1276                ac_cv_va_val_copy,
1277     [AC_TRY_COMPILE([#include <stdarg.h>
1278                      #include <stdlib.h>
1279         void f (int i, ...) {
1280             va_list args1, args2;
1281             va_start (args1, i);
1282             args2 = args1;
1283             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1284                 exit (1);
1285             va_end (args1); va_end (args2);
1286         }],
1287         [f(0, 42); return 0],
1288         [ac_cv_va_val_copy=yes],
1289         [ac_cv_va_val_copy=no],
1290     )]
1292 if test "x$ac_cv_va_copy" = "xyes"; then
1293     AC_DEFINE(VA_COPY, va_copy)
1294     AC_DEFINE(HAVE_VA_COPY)
1297 if test "x$ac_cv_va_val_copy" = "xno"; then
1298    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1301 dnl ===================================================================
1302 dnl ========================================================
1303 dnl Put your C++ language/feature checks below
1304 dnl ========================================================
1305 AC_LANG_CPLUSPLUS
1307 ARM_ABI_PREFIX=
1308 if test "$GNU_CC"; then
1309   if test "$CPU_ARCH" = "arm" ; then
1310     AC_CACHE_CHECK(for ARM EABI,
1311         ac_cv_gcc_arm_eabi,
1312         [AC_TRY_COMPILE([],
1313                         [
1314 #if defined(__ARM_EABI__)
1315   return 0;
1316 #else
1317 #error Not ARM EABI.
1318 #endif
1319                         ],
1320                         ac_cv_gcc_arm_eabi="yes",
1321                         ac_cv_gcc_arm_eabi="no")])
1322     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1323         HAVE_ARM_EABI=1
1324         ARM_ABI_PREFIX=eabi-
1325     else
1326         ARM_ABI_PREFIX=oabi-
1327     fi
1328   fi
1330   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1333 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1334 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1335 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1336 # linking XUL.
1337 _SAVE_LDFLAGS=$LDFLAGS
1338 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1339 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1340                ac_cv_thread_keyword,
1341                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1342                             [return tlsIsMainThread;],
1343                             ac_cv_thread_keyword=yes,
1344                             ac_cv_thread_keyword=no)])
1345 LDFLAGS=$_SAVE_LDFLAGS
1346 # The custom dynamic linker doesn't support TLS variables
1347 MOZ_TLS=
1348 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1349   # mips builds fail with TLS variables because of a binutils bug.
1350   # See bug 528687
1351   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1352   case "${target}" in
1353     mips*-*)
1354       :
1355       ;;
1356     *-android*|*-linuxandroid*)
1357       :
1358       ;;
1359     *-openbsd*)
1360       :
1361       ;;
1362     *)
1363       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1364       MOZ_TLS=1
1365       ;;
1366   esac
1369 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1370 if test -n "$MOZ_LINKER"; then
1371   if test "$CPU_ARCH" = arm; then
1372     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1373     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1374       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1375       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1376     fi
1377   fi
1379 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1380 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1381 dnl Since the linker only understands the sysv ones, no need to build the
1382 dnl gnu style tables anyways.
1383   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1386 dnl End of C++ language/feature checks
1387 AC_LANG_C
1389 dnl ========================================================
1390 dnl =  Internationalization checks
1391 dnl ========================================================
1393 dnl Internationalization and Locale support is different
1394 dnl on various UNIX platforms.  Checks for specific i18n
1395 dnl features go here.
1397 AC_HAVE_FUNCS(localeconv)
1399 fi # ! SKIP_COMPILER_CHECKS
1401 if test -n "${COMPILE_ENVIRONMENT}"; then
1402   MOZ_CHECK_ALLOCATOR
1405 TARGET_XPCOM_ABI=
1406 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1407     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1408     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1411 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1412 dnl features that Windows actually does support.
1414 if test -n "$SKIP_COMPILER_CHECKS"; then
1415    dnl Windows has malloc.h
1416    AC_DEFINE(MALLOC_H, [<malloc.h>])
1417    AC_DEFINE(HAVE_FORCEINLINE)
1418    AC_DEFINE(HAVE_LOCALECONV)
1419 fi # SKIP_COMPILER_CHECKS
1421 dnl Mozilla specific options
1422 dnl ========================================================
1423 dnl The macros used for command line options
1424 dnl are defined in build/autoconf/altoptions.m4.
1426 dnl ========================================================
1427 dnl =
1428 dnl = Check for external package dependencies
1429 dnl =
1430 dnl ========================================================
1431 MOZ_ARG_HEADER(External Packages)
1433 case "$OS_TARGET" in
1434 WINNT|Darwin|Android)
1435   MOZ_FOLD_LIBS=1
1436   ;;
1438   MOZ_FOLD_LIBS=
1439   ;;
1440 esac
1442 MOZ_CONFIG_NSPR()
1444 dnl ========================================================
1445 dnl system libevent Support
1446 dnl ========================================================
1447 MOZ_ARG_WITH_STRING(system-libevent,
1448 [  --with-system-libevent[=PFX]
1449                           Use system libevent [installed at prefix PFX]],
1450     LIBEVENT_DIR=$withval)
1452 _SAVE_CFLAGS=$CFLAGS
1453 _SAVE_LDFLAGS=$LDFLAGS
1454 _SAVE_LIBS=$LIBS
1455 if test "$LIBEVENT_DIR" = yes; then
1456     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1457         MOZ_SYSTEM_LIBEVENT=1,
1458         LIBEVENT_DIR=/usr)
1460 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1461     MOZ_SYSTEM_LIBEVENT=
1462 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1463     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1464     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1465     MOZ_CHECK_HEADER(event.h,
1466         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1467              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1468          fi],
1469         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1470     AC_CHECK_LIB(event, event_init,
1471                  [MOZ_SYSTEM_LIBEVENT=1
1472                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1473                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1474                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1476 CFLAGS=$_SAVE_CFLAGS
1477 LDFLAGS=$_SAVE_LDFLAGS
1478 LIBS=$_SAVE_LIBS
1480 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1482 dnl ========================================================
1483 dnl = If NSS was not detected in the system,
1484 dnl = use the one in the source tree (mozilla/security/nss)
1485 dnl ========================================================
1487 MOZ_ARG_WITH_BOOL(system-nss,
1488 [  --with-system-nss       Use system installed NSS],
1489     _USE_SYSTEM_NSS=1 )
1491 if test -n "$_USE_SYSTEM_NSS"; then
1492     AM_PATH_NSS(3.50, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1495 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1496 if test -z "$MOZ_SYSTEM_NSS"; then
1497    case "${OS_ARCH}" in
1498         # Only few platforms have been tested with GYP
1499         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1500             ;;
1501         *)
1502             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1503             ;;
1504    esac
1507 dnl system ZLIB support
1508 dnl ========================================================
1509 MOZ_ZLIB_CHECK([1.2.3])
1511 if test -z "$SKIP_LIBRARY_CHECKS"; then
1513 dnl ========================================================
1514 dnl system PNG Support
1515 dnl ========================================================
1516 MOZ_ARG_WITH_STRING(system-png,
1517 [  --with-system-png[=PFX]
1518                           Use system libpng [installed at prefix PFX]],
1519     PNG_DIR=$withval)
1521 _SAVE_CFLAGS=$CFLAGS
1522 _SAVE_LDFLAGS=$LDFLAGS
1523 _SAVE_LIBS=$LIBS
1524 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1525     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1526     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1528 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1529     MOZ_SYSTEM_PNG=
1530 else
1531     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1532                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1533     AC_CHECK_LIB(png, png_get_acTL, ,
1534                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1536 if test "$MOZ_SYSTEM_PNG" = 1; then
1537     AC_TRY_COMPILE([ #include <stdio.h>
1538                      #include <sys/types.h>
1539                      #include <png.h> ],
1540                    [ #if PNG_LIBPNG_VER < $MOZPNG
1541                      #error "Insufficient libpng version ($MOZPNG required)."
1542                      #endif
1543                      #ifndef PNG_UINT_31_MAX
1544                      #error "Insufficient libpng version."
1545                      #endif ],
1546                    MOZ_SYSTEM_PNG=1,
1547                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1549 CFLAGS=$_SAVE_CFLAGS
1550 LDFLAGS=$_SAVE_LDFLAGS
1551 LIBS=$_SAVE_LIBS
1553 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1554     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1555     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1558 fi # SKIP_LIBRARY_CHECKS
1560 dnl ========================================================
1561 dnl =
1562 dnl = Application
1563 dnl =
1564 dnl ========================================================
1566 MOZ_ARG_HEADER(Application)
1568 ENABLE_SYSTEM_EXTENSION_DIRS=1
1569 MOZ_BRANDING_DIRECTORY=
1570 MOZ_OFFICIAL_BRANDING=
1571 MOZ_AUTH_EXTENSION=1
1572 if test "$MOZ_IOS"; then
1573    MOZ_AUTH_EXTENSION=
1575 MOZ_PREF_EXTENSIONS=1
1576 MOZ_SPELLCHECK=1
1577 MOZ_UNIVERSALCHARDET=1
1578 MOZ_XUL=1
1579 MOZ_ZIPWRITER=1
1580 MOZ_NO_SMART_CARDS=
1581 NECKO_COOKIES=1
1582 MOZ_USE_NATIVE_POPUP_WINDOWS=
1583 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1584 MOZ_SANDBOX=1
1585 MOZ_BINARY_EXTENSIONS=
1586 MOZ_DEVTOOLS=server
1588 case "$target_os" in
1589     mingw*)
1590         NS_ENABLE_TSF=1
1591         AC_DEFINE(NS_ENABLE_TSF)
1592         ;;
1593 esac
1595 # Optional Firefox for Android partner distribution directory.
1596 MOZ_ARG_WITH_STRING(android-distribution-directory,
1597 [  --with-android-distribution-directory=dir
1598                           Optional Firefox for Android partner distribution directory.],
1599   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1601 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1602   # A distribution directory must have an assets/distribution directory.
1603   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1604   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1605     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1606                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1607   fi
1609 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1611 dnl ========================================================
1612 dnl = Trademarked Branding
1613 dnl ========================================================
1614 MOZ_ARG_ENABLE_BOOL(official-branding,
1615 [  --enable-official-branding
1616                           Enable Official mozilla.org Branding
1617                           Do not distribute builds with
1618                           --enable-official-branding unless you have
1619                           permission to use trademarks per
1620                           http://www.mozilla.org/foundation/trademarks/ .],
1621     MOZ_OFFICIAL_BRANDING=1,
1622     MOZ_OFFICIAL_BRANDING=)
1624 # Allow the application to influence configure with a confvars.sh script.
1625 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1626 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1627   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1628   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1629 else
1630   AC_MSG_RESULT([no])
1633 if test "$EARLY_BETA_OR_EARLIER"; then
1634     MOZ_NEW_CERT_STORAGE=1
1635     AC_DEFINE(MOZ_NEW_CERT_STORAGE)
1637 AC_SUBST(MOZ_NEW_CERT_STORAGE)
1639 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1640 MOZ_ARG_WITH_STRING(app-name,
1641 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1642 WITH_APP_NAME=$withval,
1645 if test -n "$WITH_APP_NAME" ; then
1646     MOZ_APP_NAME="$WITH_APP_NAME"
1649 MOZ_ARG_WITH_STRING(app-basename,
1650 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1651 WITH_APP_BASENAME=$withval,
1654 if test -n "$WITH_APP_BASENAME" ; then
1655     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1658 dnl ========================================================
1659 dnl Ensure Android SDK and build-tools versions depending on
1660 dnl mobile target.
1661 dnl ========================================================
1663 case "$MOZ_BUILD_APP" in
1664 mobile/android)
1665     MOZ_ANDROID_SDK
1666     ;;
1667 esac
1669 dnl ========================================================
1670 dnl =
1671 dnl = Toolkit Options
1672 dnl =
1673 dnl ========================================================
1674 MOZ_ARG_HEADER(Toolkit Options)
1676 dnl ========================================================
1677 dnl = Enable the toolkit as needed                         =
1678 dnl ========================================================
1680 case "$MOZ_WIDGET_TOOLKIT" in
1682 cocoa)
1683     LDFLAGS="$LDFLAGS -framework Cocoa"
1684     # Use -Wl as a trick to avoid -framework and framework names from
1685     # being separated by AC_SUBST_LIST.
1686     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'
1687     TK_CFLAGS=""
1688     CFLAGS="$CFLAGS $TK_CFLAGS"
1689     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1690     MOZ_USER_DIR="Mozilla"
1691     MOZ_FS_LAYOUT=bundle
1692     ;;
1694 uikit)
1695     LDFLAGS="$LDFLAGS -framework UIKit"
1696     TK_CFLAGS=""
1697     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'
1698     CFLAGS="$CFLAGS $TK_CFLAGS"
1699     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1700     MOZ_USER_DIR="Mozilla"
1701     MOZ_FS_LAYOUT=bundle
1702     ;;
1704 esac
1706 if test "$OS_TARGET" = Darwin; then
1707     LDFLAGS="$LDFLAGS -lobjc"
1710 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1711 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1712 case "$MOZ_WIDGET_TOOLKIT" in
1713 gtk*)
1714     MOZ_ENABLE_GTK=1
1715     ;;
1716 esac
1718 if test "$COMPILE_ENVIRONMENT"; then
1719   if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1720     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1721     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1722     TK_CFLAGS=$MOZ_GTK3_CFLAGS
1723     TK_LIBS=$MOZ_GTK3_LIBS
1724     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1725     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1726     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1727     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1728   fi
1729   if test "$MOZ_ENABLE_GTK"; then
1730     if test "$MOZ_X11"; then
1731       GDK_PACKAGES=gdk-x11-2.0
1732     fi
1733     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1734     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1736     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1737     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1738   fi
1739 fi # COMPILE_ENVIRONMENT
1741 AC_SUBST(MOZ_FS_LAYOUT)
1743 AC_SUBST_LIST(TK_CFLAGS)
1744 AC_SUBST_LIST(TK_LIBS)
1746 dnl ========================================================
1747 dnl =
1748 dnl = Components & Features
1749 dnl =
1750 dnl ========================================================
1751 MOZ_ARG_HEADER(Components and Features)
1753 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1754 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1755   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1756     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1757   else
1758     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1759     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1760   fi
1763 MOZ_ARG_WITH_STRING(branding,
1764 [  --with-branding=dir     Use branding from the specified directory.],
1765     MOZ_BRANDING_DIRECTORY=$withval)
1767 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1768 if test -z "$REAL_BRANDING_DIRECTORY"; then
1769   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1772 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1773   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1774 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1775   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1778 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1780 dnl ========================================================
1781 dnl = Distribution ID
1782 dnl ========================================================
1783 MOZ_ARG_WITH_STRING(distribution-id,
1784 [  --with-distribution-id=ID
1785                           Set distribution-specific id (default=org.mozilla)],
1786 [ val=`echo $withval`
1787     MOZ_DISTRIBUTION_ID="$val"])
1789 if test -z "$MOZ_DISTRIBUTION_ID"; then
1790    MOZ_DISTRIBUTION_ID="org.mozilla"
1793 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1794 AC_SUBST(MOZ_DISTRIBUTION_ID)
1796 dnl ========================================================
1797 dnl = libproxy support
1798 dnl ========================================================
1800 if test "$MOZ_ENABLE_GTK"
1801 then
1802     MOZ_ENABLE_LIBPROXY=
1804     MOZ_ARG_ENABLE_BOOL(libproxy,
1805     [  --enable-libproxy         Enable libproxy support ],
1806     MOZ_ENABLE_LIBPROXY=1,
1807     MOZ_ENABLE_LIBPROXY=)
1809     if test "$MOZ_ENABLE_LIBPROXY"
1810     then
1811         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1812         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1813     fi
1815 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1817 dnl ========================================================
1818 dnl = dbus support
1819 dnl ========================================================
1821 if test "$MOZ_ENABLE_GTK"
1822 then
1823     MOZ_ENABLE_DBUS=1
1825     MOZ_ARG_DISABLE_BOOL(dbus,
1826     [  --disable-dbus          Disable dbus support ],
1827         MOZ_ENABLE_DBUS=,
1828         MOZ_ENABLE_DBUS=1)
1830     if test "$MOZ_ENABLE_DBUS"
1831     then
1832         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1833         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1834         AC_DEFINE(MOZ_ENABLE_DBUS)
1835     fi
1837 AC_SUBST(MOZ_ENABLE_DBUS)
1839 dnl =========================================================
1840 dnl = Whether to exclude hyphenations files in the build
1841 dnl =========================================================
1842 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1843     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1846 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1847                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1848                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1850 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1852 if test -n "$MOZ_WEBRTC"; then
1853     if test -n "$MOZ_X11"; then
1854       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1855     fi
1858 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1860 dnl ========================================================
1861 dnl = Apple platform decoder support
1862 dnl ========================================================
1863 if test "$COMPILE_ENVIRONMENT"; then
1864 if test -n "$MOZ_APPLEMEDIA"; then
1865   # hack in frameworks for fmp4 - see bug 1029974
1866   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1867   LDFLAGS="$LDFLAGS -framework AudioToolbox"
1868   dnl Verify CoreMedia is available.
1869   AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1870     [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1872 fi # COMPILE_ENVIRONMENT
1874 dnl ========================================================
1875 dnl = Handle dependent MEDIA defines
1876 dnl ========================================================
1878 MOZ_WEBM_ENCODER=1
1879 AC_DEFINE(MOZ_WEBM_ENCODER)
1880 AC_SUBST(MOZ_WEBM_ENCODER)
1882 dnl ========================================================
1883 dnl NegotiateAuth
1884 dnl ========================================================
1886 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1887 [  --disable-negotiateauth Disable GSS-API negotiation ],
1888     MOZ_AUTH_EXTENSION=,
1889     MOZ_AUTH_EXTENSION=1 )
1891 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1892    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1895 dnl ========================================================
1896 dnl Pref extensions (autoconfig)
1897 dnl ========================================================
1898 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1899 [  --disable-pref-extensions
1900                           Disable pref extensions such as autoconfig],
1901   MOZ_PREF_EXTENSIONS=,
1902   MOZ_PREF_EXTENSIONS=1 )
1904 dnl ========================================================
1905 dnl Searching of system directories for extensions.
1906 dnl Note: this switch is meant to be used for test builds
1907 dnl whose behavior should not depend on what happens to be
1908 dnl installed on the local machine.
1909 dnl ========================================================
1910 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1911 [  --disable-system-extension-dirs
1912                           Disable searching system- and account-global
1913                           directories for extensions of any kind; use
1914                           only profile-specific extension directories],
1915   ENABLE_SYSTEM_EXTENSION_DIRS=,
1916   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1917 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1918   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1921 dnl ========================================================
1922 dnl = Universalchardet
1923 dnl ========================================================
1924 MOZ_ARG_DISABLE_BOOL(universalchardet,
1925 [  --disable-universalchardet
1926                           Disable universal encoding detection],
1927   MOZ_UNIVERSALCHARDET=,
1928   MOZ_UNIVERSALCHARDET=1 )
1930 dnl ========================================================
1931 dnl Gamepad support
1932 dnl ========================================================
1934 if test "$COMPILE_ENVIRONMENT" ; then
1936 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1937 if test "$OS_TARGET" = "Linux"; then
1938     MOZ_CHECK_HEADER([linux/joystick.h])
1939     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1940       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1941     fi
1944 fi # COMPILE_ENVIRONMENT
1947 dnl ========================================================
1948 dnl = Breakpad crash reporting (on by default on supported platforms)
1949 dnl ========================================================
1951 case $target in
1952 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1953   MOZ_CRASHREPORTER=1
1954   ;;
1955 i?86-apple-darwin*|x86_64-apple-darwin*)
1956   if test -z "$MOZ_IOS"; then
1957     MOZ_CRASHREPORTER=1
1958   fi
1959   ;;
1960 *-android*|*-linuxandroid*)
1961   dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1962   dnl be before Linux condition
1963   MOZ_CRASHREPORTER=1
1964   ;;
1965 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1966   if test "$MOZ_ENABLE_GTK"; then
1967     MOZ_CRASHREPORTER=1
1968   fi
1969   ;;
1970 esac
1972 MOZ_ARG_DISABLE_BOOL(crashreporter,
1973 [  --disable-crashreporter Disable breakpad crash reporting],
1974     [MOZ_CRASHREPORTER=],
1975     [MOZ_CRASHREPORTER=F # Force enable breakpad])
1977 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1978   if test "$MOZ_CRASHREPORTER" = F; then
1979     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1980   fi
1981   MOZ_CRASHREPORTER=
1984 if test -n "$MOZ_CRASHREPORTER"; then
1985    AC_DEFINE(MOZ_CRASHREPORTER)
1987   if test "$OS_TARGET" = "Linux" && \
1988     test -z "$SKIP_LIBRARY_CHECKS"; then
1989     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1990   fi
1992   if test "$OS_ARCH" = "WINNT"; then
1993     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1994       MOZ_CRASHREPORTER_INJECTOR=1
1995       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1996     fi
1997   fi
2000 dnl ========================================================
2001 dnl = Enable compilation of specific extension modules
2002 dnl ========================================================
2004 MOZ_ARG_ENABLE_STRING(extensions,
2005 [  --enable-extensions     Enable extensions],
2006 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2007     if test "$option" = "yes" -o "$option" = "all"; then
2008         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2009     elif test "$option" = "no" -o "$option" = "none"; then
2010         MOZ_EXTENSIONS=""
2011     elif test "$option" = "default"; then
2012         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2013     elif test `echo "$option" | grep -c \^-` != 0; then
2014         option=`echo $option | sed 's/^-//'`
2015         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2016     else
2017         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2018     fi
2019 done],
2020     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2022 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2023 dnl when trying to build a nonexistent extension.
2024 for extension in $MOZ_EXTENSIONS; do
2025     if test ! -d "${srcdir}/extensions/${extension}"; then
2026         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2027     fi
2028 done
2030 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2031   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2034 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2035 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2036 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2037    MOZ_ENABLE_CAIRO_FT=1
2038    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2039    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2040    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2043 AC_CHECK_PROGS(WGET, wget, "")
2044 AC_SUBST(WGET)
2046 dnl ========================================================
2047 dnl Updater
2048 dnl ========================================================
2050 if test "$MOZ_IOS"; then
2051   MOZ_UPDATER=
2054 MOZ_ARG_DISABLE_BOOL(updater,
2055 [  --disable-updater       Disable building of updater],
2056     MOZ_UPDATER=,
2057     MOZ_UPDATER=1 )
2059 if test -n "$MOZ_UPDATER"; then
2060     AC_DEFINE(MOZ_UPDATER)
2063 dnl ========================================================
2064 dnl parental controls (for Windows Vista)
2065 dnl ========================================================
2066 MOZ_ARG_DISABLE_BOOL(parental-controls,
2067 [  --disable-parental-controls
2068                           Do not build parental controls],
2069    MOZ_DISABLE_PARENTAL_CONTROLS=1,
2070    MOZ_DISABLE_PARENTAL_CONTROLS=)
2071 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2072     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2075 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2077 dnl ========================================================
2078 dnl = Disable smartcard support
2079 dnl ========================================================
2080 if test -n "$MOZ_NO_SMART_CARDS"; then
2081     AC_DEFINE(MOZ_NO_SMART_CARDS)
2083 AC_SUBST(MOZ_NO_SMART_CARDS)
2085 dnl ========================================================
2086 dnl = Sandboxing support
2087 dnl ========================================================
2088 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2089     # Bug 1182565: TSan conflicts with sandboxing on Linux.
2090     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2091     case $OS_TARGET in
2092     Linux|Android)
2093         MOZ_SANDBOX=
2094         ;;
2095     esac
2098 MOZ_ARG_DISABLE_BOOL(sandbox,
2099 [  --disable-sandbox        Disable sandboxing support],
2100     MOZ_SANDBOX=,
2101     MOZ_SANDBOX=1)
2103 case "$OS_TARGET" in
2104 WINNT|Darwin|OpenBSD)
2106 Linux)
2107     case $CPU_ARCH in
2108         x86_64|x86)
2109         ;;
2110         # Linux sandbox is only available on x86 and x86_64.
2111         *)
2112             MOZ_SANDBOX=
2113         ;;
2114     esac
2115     ;;
2117     # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2118     MOZ_SANDBOX=
2120 esac
2122 if test -n "$MOZ_SANDBOX"; then
2123     AC_DEFINE(MOZ_SANDBOX)
2126 AC_SUBST(MOZ_SANDBOX)
2129 dnl ========================================================
2130 dnl =
2131 dnl = Module specific options
2132 dnl =
2133 dnl ========================================================
2134 MOZ_ARG_HEADER(Individual module options)
2136 dnl ========================================================
2137 dnl Check for sqlite
2138 dnl ========================================================
2140 MOZ_SYSTEM_SQLITE=
2141 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2142 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
2143 MOZ_SYSTEM_SQLITE=1,
2144 MOZ_SYSTEM_SQLITE= )
2146 if test -n "$MOZ_SYSTEM_SQLITE"
2147 then
2148     dnl ============================
2149     dnl === SQLite Version check ===
2150     dnl ============================
2151     dnl Check to see if the system SQLite package is new enough.
2152     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2153 else
2154     dnl ==============================
2155     dnl === SQLite fdatasync check ===
2156     dnl ==============================
2157     dnl Check to see if fdatasync is available
2158     AC_CHECK_FUNC(fdatasync)
2161 if test -n "$MOZ_SYSTEM_SQLITE"; then
2162     AC_DEFINE(MOZ_SYSTEM_SQLITE)
2164 AC_SUBST(MOZ_SYSTEM_SQLITE)
2166 dnl ========================================================
2167 dnl = Disable zipwriter
2168 dnl ========================================================
2169 MOZ_ARG_DISABLE_BOOL(zipwriter,
2170 [  --disable-zipwriter     Disable zipwriter component],
2171     MOZ_ZIPWRITER=,
2172     MOZ_ZIPWRITER=1 )
2173 AC_SUBST(MOZ_ZIPWRITER)
2175 dnl ========================================================
2176 dnl =
2177 dnl = Feature options that require extra sources to be pulled
2178 dnl =
2179 dnl ========================================================
2180 dnl MOZ_ARG_HEADER(Features that require extra sources)
2182 dnl ========================================================
2183 dnl =
2184 dnl = Runtime debugging and Optimization Options
2185 dnl =
2186 dnl ========================================================
2187 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2189 dnl ========================================================
2190 dnl enable mobile optimizations
2191 dnl ========================================================
2192 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2193 [  --enable-mobile-optimize
2194                           Enable mobile optimizations],
2195     MOZ_GFX_OPTIMIZE_MOBILE=1)
2197 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2199 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2200     # We ignore paint will resample on mobile for performance.
2201     # We may want to revisit this later.
2202     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2204     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2205     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2208 dnl ========================================================
2209 dnl = Enable code optimization. ON by default.
2210 dnl ========================================================
2212 # Use value from moz.configure if one is defined. Else use our computed
2213 # value.
2214 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2215     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2218 if test "$COMPILE_ENVIRONMENT"; then
2219 if test -n "$MOZ_OPTIMIZE"; then
2220     AC_MSG_CHECKING([for valid C compiler optimization flags])
2221     _SAVE_CFLAGS=$CFLAGS
2222     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2223     AC_TRY_COMPILE([#include <stdio.h>],
2224         [printf("Hello World\n");],
2225         _results=yes,
2226         _results=no)
2227     AC_MSG_RESULT([$_results])
2228     if test "$_results" = "no"; then
2229         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2230     fi
2231     CFLAGS=$_SAVE_CFLAGS
2232     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2233         # When using llvm-based LTO, non numeric optimization levels are
2234         # not supported by the linker, so force the linker to use -O2 (
2235         # which doesn't influence the level compilation units are actually
2236         # compiled at).
2237         case " $MOZ_OPTIMIZE_FLAGS " in
2238         *\ -Os\ *|*\ -Oz\ *)
2239             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2240             ;;
2241         esac
2242     fi
2244 fi # COMPILE_ENVIRONMENT
2246 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2247 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2248 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2250 dnl ========================================================
2251 dnl = Enable runtime logging
2252 dnl ========================================================
2253 AC_DEFINE(MOZ_LOGGING)
2254 AC_DEFINE(FORCE_PR_LOG)
2256 dnl ========================================================
2257 dnl = This will enable logging of addref, release, ctor, dtor.
2258 dnl ========================================================
2259 _ENABLE_LOGREFCNT=42
2260 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2261 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
2262     _ENABLE_LOGREFCNT=1,
2263     _ENABLE_LOGREFCNT= )
2264 if test "$_ENABLE_LOGREFCNT" = "1"; then
2265     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2266 elif test -z "$_ENABLE_LOGREFCNT"; then
2267     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2270 dnl ========================================================
2271 dnl moz_dump_painting
2272 dnl ========================================================
2273 MOZ_ARG_ENABLE_BOOL(dump-painting,
2274 [  --enable-dump-painting          Enable paint debugging.],
2275     MOZ_DUMP_PAINTING=1,
2276     MOZ_DUMP_PAINTING= )
2277 if test -n "$MOZ_DUMP_PAINTING"; then
2278     AC_DEFINE(MOZ_DUMP_PAINTING)
2279     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2281 if test -n "$MOZ_DEBUG"; then
2282     AC_DEFINE(MOZ_DUMP_PAINTING)
2285 case "${OS_TARGET}" in
2286 Android|WINNT|Darwin)
2287   MOZ_GLUE_IN_PROGRAM=
2288   ;;
2290   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2291   MOZ_GLUE_IN_PROGRAM=1
2292   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2293   ;;
2294 esac
2296 dnl ========================================================
2297 dnl = Jemalloc build setup
2298 dnl ========================================================
2299 if test -z "$MOZ_MEMORY"; then
2300   case "${target}" in
2301     *-mingw*)
2302       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2303         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.])
2304       fi
2305       ;;
2306   esac
2307 else
2308   dnl The generic feature tests that determine how to compute ncpus are long and
2309   dnl complicated.  Therefore, simply define special cpp variables for the
2310   dnl platforms we have special knowledge of.
2311   case "${target}" in
2312   *-mingw*)
2313     export MOZ_NO_DEBUG_RTL=1
2314     ;;
2315   esac
2316 fi # MOZ_MEMORY
2317 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2319 dnl ========================================================
2320 dnl = Enable using the clang plugin to build
2321 dnl ========================================================
2323 if test -n "$COMPILE_ENVIRONMENT"; then
2324 MOZ_CONFIG_CLANG_PLUGIN
2325 fi # COMPILE_ENVIRONMENT
2327 dnl ========================================================
2328 dnl = Enable stripping of libs & executables
2329 dnl ========================================================
2330 MOZ_ARG_ENABLE_BOOL(strip,
2331 [  --enable-strip          Enable stripping of libs & executables ],
2332     ENABLE_STRIP=1,
2333     ENABLE_STRIP= )
2335 dnl ========================================================
2336 dnl = Enable stripping of libs & executables when packaging
2337 dnl ========================================================
2338 MOZ_ARG_ENABLE_BOOL(install-strip,
2339 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
2340     PKG_SKIP_STRIP= ,
2341     PKG_SKIP_STRIP=1)
2343 dnl ========================================================
2344 dnl = frontend JS debug mode
2345 dnl ========================================================
2347 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2348 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
2349    DEBUG_JS_MODULES=1,
2350    DEBUG_JS_MODULES=)
2352 AC_SUBST(DEBUG_JS_MODULES)
2354 dnl ========================================================
2355 dnl =
2356 dnl = Profiling and Instrumenting
2357 dnl =
2358 dnl ========================================================
2359 MOZ_ARG_HEADER(Profiling and Instrumenting)
2361 dnl ========================================================
2362 dnl = Offer a way to disable the startup cache
2363 dnl ========================================================
2365 MOZ_ARG_DISABLE_BOOL(startupcache,
2366 [  --disable-startupcache          Disable startup cache ],
2367     MOZ_DISABLE_STARTUPCACHE=1,
2368     MOZ_DISABLE_STARTUPCACHE=)
2370 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2371   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2373 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2375 dnl ========================================================
2376 dnl = Support for demangling undefined symbols
2377 dnl ========================================================
2378 if test -z "$SKIP_LIBRARY_CHECKS"; then
2379     AC_LANG_SAVE
2380     AC_LANG_CPLUSPLUS
2381     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2382     AC_LANG_RESTORE
2385 # Demangle only for debug or DMD builds
2386 MOZ_DEMANGLE_SYMBOLS=
2387 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2388     MOZ_DEMANGLE_SYMBOLS=1
2389     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2391 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2393 dnl ========================================================
2394 dnl = Support for gcc stack unwinding (from gcc 3.3)
2395 dnl ========================================================
2396 if test -z "$SKIP_LIBRARY_CHECKS"; then
2397     AC_LANG_SAVE
2398     AC_LANG_CPLUSPLUS
2399     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2400     AC_LANG_RESTORE
2403 dnl ========================================================
2404 dnl JIT observers
2405 dnl ========================================================
2407 MOZ_ARG_WITH_STRING(jitreport-granularity,
2408 [  --jitreport-granularity=N
2409                            Default granularity at which to report JIT code
2410                            to external tools
2411                              0 - no info
2412                              1 - code ranges for whole functions only
2413                              2 - per-line information
2414                              3 - per-op information],
2415   JITREPORT_GRANULARITY=$withval,
2416   JITREPORT_GRANULARITY=3)
2418 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2420 dnl ========================================================
2421 dnl =
2422 dnl = Misc. Options
2423 dnl =
2424 dnl ========================================================
2425 MOZ_ARG_HEADER(Misc. Options)
2427 dnl ========================================================
2428 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2429 dnl ========================================================
2430 MOZ_ARG_WITH_STRING(user-appdir,
2431 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
2432 [ val=`echo $withval`
2433 if echo "$val" | grep "\/" >/dev/null; then
2434     AC_MSG_ERROR("Homedir must be single relative path.")
2435 else
2436     MOZ_USER_DIR="$val"
2437 fi])
2439 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2441 if test -z "$SKIP_COMPILER_CHECKS"; then
2442 dnl ========================================================
2443 dnl =
2444 dnl = Compiler Options
2445 dnl =
2446 dnl ========================================================
2447 MOZ_ARG_HEADER(Compiler Options)
2449 dnl ========================================================
2450 dnl Check for gcc -pipe support
2451 dnl ========================================================
2452 AC_MSG_CHECKING([for -pipe support])
2453 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2454     dnl Any gcc that supports firefox supports -pipe.
2455     CFLAGS="$CFLAGS -pipe"
2456     CXXFLAGS="$CXXFLAGS -pipe"
2457     AC_MSG_RESULT([yes])
2458 else
2459     AC_MSG_RESULT([no])
2462 fi # ! SKIP_COMPILER_CHECKS
2464 AC_LANG_C
2466 if test "$COMPILE_ENVIRONMENT"; then
2467 MOZ_EXPAND_LIBS
2468 fi # COMPILE_ENVIRONMENT
2470 dnl ========================================================
2471 dnl =
2472 dnl = Static Build Options
2473 dnl =
2474 dnl ========================================================
2475 MOZ_ARG_HEADER(Static build options)
2477 if test -z "$MOZ_SYSTEM_ZLIB"; then
2478 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2479   ZLIB_IN_MOZGLUE=1
2480   AC_DEFINE(ZLIB_IN_MOZGLUE)
2484 AC_SUBST(ZLIB_IN_MOZGLUE)
2486 dnl ========================================================
2487 dnl =
2488 dnl = Standalone module options
2489 dnl =
2490 dnl ========================================================
2491 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2493 dnl Check for GLib.
2494 dnl ========================================================
2496 if test -z "$SKIP_PATH_CHECKS"; then
2497 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2498     if test "$MOZ_ENABLE_GTK" ; then
2499         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2500     fi
2504 if test -z "${GLIB_GMODULE_LIBS}" \
2505    -a -n "${GLIB_CONFIG}"\
2506     -a "${GLIB_CONFIG}" != no\
2507 ; then
2508     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2511 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2513 if test "$USE_FC_FREETYPE"; then
2514     if test "$COMPILE_ENVIRONMENT"; then
2515         dnl ========================================================
2516         dnl = Check for freetype2 functionality
2517         dnl ========================================================
2518         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2519             _SAVE_LIBS="$LIBS"
2520             _SAVE_CFLAGS="$CFLAGS"
2521             LIBS="$LIBS $FT2_LIBS"
2522             CFLAGS="$CFLAGS $FT2_CFLAGS"
2524             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2525                 ac_cv_member_FT_Bitmap_Size_y_ppem,
2526                 [AC_TRY_COMPILE([#include <ft2build.h>
2527                                  #include FT_FREETYPE_H],
2528                                 [FT_Bitmap_Size s;
2529                                  if (sizeof s.y_ppem) return 0;
2530                                  return 1],
2531                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2532                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2533             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2534                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2535             else
2536                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2537             fi
2538             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2539                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2540                                [FT_Bitmap_Size structure includes y_ppem field])
2542             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2544             LIBS="$_SAVE_LIBS"
2545             CFLAGS="$_SAVE_CFLAGS"
2546         fi
2548         _SAVE_CPPFLAGS="$CPPFLAGS"
2549         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2550         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2551             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2552         CPPFLAGS="$_SAVE_CPPFLAGS"
2553     fi
2556 dnl ========================================================
2557 dnl Check if we need the 32-bit Linux SSE2 error dialog
2558 dnl ========================================================
2560 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2562 dnl ========================================================
2563 dnl Check for pixman and cairo
2564 dnl ========================================================
2566 MOZ_TREE_CAIRO=1
2567 MOZ_ARG_ENABLE_BOOL(system-cairo,
2568 [ --enable-system-cairo  Obsolete: do not use this option],
2569 AC_MSG_ERROR(--enable-system-cairo is not supported),
2570 MOZ_TREE_CAIRO=1 )
2572 MOZ_TREE_PIXMAN=1
2573 MOZ_ARG_ENABLE_BOOL(system-pixman,
2574 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2575 MOZ_TREE_PIXMAN=,
2576 MOZ_TREE_PIXMAN=force,
2577 MOZ_TREE_PIXMAN=1 )
2579 if test "$MOZ_TREE_PIXMAN"; then
2580     AC_DEFINE(MOZ_TREE_PIXMAN)
2581 else
2582     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2585 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2586 AC_DEFINE(MOZ_TREE_CAIRO)
2588 if test "$OS_ARCH" = "WINNT"; then
2589     # For now we assume that we will have a uint64_t available through
2590     # one of the above headers or mozstdint.h.
2591     AC_DEFINE(HAVE_UINT64_T)
2594 # Define macros for cairo-features.h
2595 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2596 if test "$MOZ_X11"; then
2597     XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2598     XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2599     PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2601 if test "$_HAVE_FREETYPE2"; then
2602     FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2603     MOZ_ENABLE_CAIRO_FT=1
2604     CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2607 case "$MOZ_WIDGET_TOOLKIT" in
2608   cocoa | uikit)
2609     QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2610     QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2611     QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2612     ;;
2613   windows)
2614     WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2615     WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2616     WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2618     if test "$COMPILE_ENVIRONMENT"; then
2619       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2620     fi
2621     ;;
2622 esac
2623 if test "$USE_FC_FREETYPE"; then
2624     FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2626 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2627 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2629 AC_SUBST(PS_SURFACE_FEATURE)
2630 AC_SUBST(SVG_SURFACE_FEATURE)
2631 AC_SUBST(XLIB_SURFACE_FEATURE)
2632 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2633 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2634 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2635 AC_SUBST(WIN32_SURFACE_FEATURE)
2636 AC_SUBST(OS2_SURFACE_FEATURE)
2637 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2638 AC_SUBST(FT_FONT_FEATURE)
2639 AC_SUBST(FC_FONT_FEATURE)
2640 AC_SUBST(WIN32_FONT_FEATURE)
2641 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2642 AC_SUBST(QUARTZ_FONT_FEATURE)
2643 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2644 AC_SUBST(QT_SURFACE_FEATURE)
2645 AC_SUBST(TEE_SURFACE_FEATURE)
2647 if test "$MOZ_X11"; then
2648     MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2651 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2653 case "$MOZ_WIDGET_TOOLKIT" in
2654 android)
2655     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2656     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2657     ;;
2658 esac
2660 AC_SUBST(MOZ_TREE_CAIRO)
2661 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2662 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2663 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2664 AC_SUBST(MOZ_TREE_PIXMAN)
2666 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2667 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2668 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2669 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2671 dnl ========================================================
2672 dnl disable xul
2673 dnl ========================================================
2674 MOZ_ARG_DISABLE_BOOL(xul,
2675 [  --disable-xul           Disable XUL],
2676     MOZ_XUL= )
2677 if test "$MOZ_XUL"; then
2678   AC_DEFINE(MOZ_XUL)
2679 else
2680   dnl remove extensions that require XUL
2681   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2684 AC_SUBST(MOZ_XUL)
2686 dnl ========================================================
2687 dnl necko configuration options
2688 dnl ========================================================
2691 dnl option to disable necko's wifi scanner
2694 if test "$MOZ_WIDGET_TOOLKIT"; then
2696   case "$OS_TARGET" in
2697     Darwin)
2698       if test -z "$MOZ_IOS"; then
2699         NECKO_WIFI=1
2700       fi
2701       ;;
2702     DragonFly|FreeBSD|WINNT)
2703       NECKO_WIFI=1
2704       ;;
2705     Linux)
2706       NECKO_WIFI=1
2707       NECKO_WIFI_DBUS=1
2708       ;;
2709   esac
2713 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2714 [  --disable-necko-wifi    Disable necko wifi scanner],
2715     NECKO_WIFI=,
2716     NECKO_WIFI=1)
2718 if test "$NECKO_WIFI"; then
2719   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2720     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2721   fi
2722   AC_DEFINE(NECKO_WIFI)
2723   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2725 AC_SUBST(NECKO_WIFI)
2726 AC_SUBST(NECKO_WIFI_DBUS)
2729 dnl option to disable cookies
2731 MOZ_ARG_DISABLE_BOOL(cookies,
2732 [  --disable-cookies       Disable cookie support],
2733     NECKO_COOKIES=,
2734     NECKO_COOKIES=1)
2735 AC_SUBST(NECKO_COOKIES)
2736 if test "$NECKO_COOKIES"; then
2737     AC_DEFINE(NECKO_COOKIES)
2738     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2741 dnl ========================================================
2742 dnl =
2743 dnl = Maintainer debug option (no --enable equivalent)
2744 dnl =
2745 dnl ========================================================
2747 AC_SUBST(NM)
2748 AC_SUBST_LIST(ASFLAGS)
2749 AC_SUBST(RCFLAGS)
2750 AC_SUBST(IMPLIB)
2751 AC_SUBST(FILTER)
2752 AC_SUBST(MOZ_AUTH_EXTENSION)
2753 AC_SUBST(MOZ_PREF_EXTENSIONS)
2754 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2755 AC_SUBST_LIST(WARNINGS_CFLAGS)
2756 AC_SUBST_SET(MOZ_EXTENSIONS)
2758 AC_SUBST(MOZ_UNIVERSALCHARDET)
2759 AC_SUBST(MOZ_SPELLCHECK)
2760 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2761 AC_SUBST(MOZ_CRASHREPORTER)
2762 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2763 AC_SUBST(MOZ_STUB_INSTALLER)
2764 AC_SUBST(MOZ_UPDATER)
2766 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2767 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2768 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2769 AC_SUBST(ENABLE_STRIP)
2770 AC_SUBST(PKG_SKIP_STRIP)
2771 AC_SUBST(STRIP_FLAGS)
2772 AC_SUBST(INCREMENTAL_LINKER)
2774 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2776 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2777 AC_SUBST(MOZ_LINKER_EXTRACT)
2779 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2780   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2783 AC_SUBST(MOZ_REQUIRE_SIGNING)
2784 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2785   AC_DEFINE(MOZ_REQUIRE_SIGNING)
2788 dnl ========================================================
2789 dnl = Mac bundle name prefix
2790 dnl ========================================================
2791 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2792 [  --with-macbundlename-prefix=prefix
2793                           Prefix for MOZ_MACBUNDLE_NAME],
2794 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2796 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2797 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2798   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2801 if test "$MOZ_DEBUG"; then
2802   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2803 else
2804   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2806 AC_SUBST(MOZ_MACBUNDLE_NAME)
2808 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2809 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2810 # Otherwise, use MOZ_APP_DISPLAYNAME
2811 if test -z "$MOZ_MACBUNDLE_ID"; then
2812    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2814 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2815 if test "$MOZ_DEBUG"; then
2816   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2819 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2820 AC_SUBST(MOZ_MACBUNDLE_ID)
2822 dnl ========================================================
2823 dnl = Child Process Name for IPC
2824 dnl ========================================================
2825 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2826   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2827 else
2828   # We want to let Android unpack the file at install time, but it only does
2829   # so if the file is named libsomething.so. The lib/ path is also required
2830   # because the unpacked file will be under the lib/ subdirectory and will
2831   # need to be executed from that path.
2832   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2834 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2835 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2837 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2838 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2839 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2841 # The following variables are available to branding and application
2842 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2843 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2844 # impacts profile location and user-visible fields.
2845 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2846 # versions of a given application (e.g. Aurora and Firefox both use
2847 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2848 # for application.ini's "Name" field, which controls profile location in
2849 # the absence of a "Profile" field (see below), and various system
2850 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2851 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2852 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2853 # builds (e.g. Aurora for Firefox).
2854 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2855 # defaults to a lowercase form of MOZ_APP_BASENAME.
2856 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2857 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2858 # - MOZ_APP_PROFILE: When set, used for application.ini's
2859 # "Profile" field, which controls profile location.
2860 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2861 # crash reporter server url.
2862 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2864 # The following environment variables used to have an effect, but don't anymore:
2865 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2866 # the contents from the version.txt file in the application directory, or
2867 # browser/config/version.txt if there isn't one.
2868 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2869 # in the "About" window. This was replaced with the contents from the
2870 # version_display.txt or version.txt in the application directory, or
2871 # browser/config/version_display.txt.
2873 if test -z "$MOZ_APP_NAME"; then
2874    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2877 if test -z "$MOZ_APP_REMOTINGNAME"; then
2878    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2881 if test -z "$ANDROID_PACKAGE_NAME" ; then
2882    # When we got rid of the Aurora channel we decided to replace the old
2883    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2884    # by all mozilla-central based branches we make this the new "default"
2885    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2886    # in their mozconfig, so they will never get this. If there are ever
2887    # non-Fennec builds for Android, they will fall into the else block
2888    # and use their own default name.
2889    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2890    # background on this.
2891    if test "$MOZ_APP_NAME" = "fennec"; then
2892       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2893    else
2894       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2895    fi
2898 # For extensions and langpacks, we require a max version that is compatible
2899 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2900 # 24.0a1 and 24.0a2 aren't affected
2901 # 24.0 becomes 24.*
2902 # 24.1.1 becomes 24.*
2903 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2904 if test -z "$IS_ALPHA"; then
2905   changequote(,)
2906   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2907     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2908   else
2909     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2910   fi
2911   changequote([,])
2912 else
2913   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2916 AC_SUBST(MOZ_APP_NAME)
2917 AC_SUBST(MOZ_APP_REMOTINGNAME)
2918 AC_SUBST(MOZ_APP_DISPLAYNAME)
2919 AC_SUBST(MOZ_APP_BASENAME)
2920 AC_SUBST(MOZ_APP_VENDOR)
2921 AC_SUBST(MOZ_APP_PROFILE)
2922 AC_SUBST(MOZ_APP_ID)
2923 AC_SUBST(MAR_CHANNEL_ID)
2924 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2925 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2926 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2927 AC_SUBST(MOZ_APP_UA_NAME)
2928 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2929 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2930 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2932 AC_SUBST(MOZ_APP_MAXVERSION)
2933 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2934 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2935   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2938 AC_SUBST(MOZ_PKG_SPECIAL)
2939 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2941 if test "$MOZILLA_OFFICIAL"; then
2942     # Build revisions should always be present in official builds
2943     MOZ_INCLUDE_SOURCE_INFO=1
2946 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2947 # explicitly set the repository and changeset information in.
2948 AC_SUBST(MOZ_SOURCE_REPO)
2949 AC_SUBST(MOZ_SOURCE_CHANGESET)
2950 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2952 dnl If we have any service that uploads data (and requires data submission
2953 dnl policy alert), set MOZ_DATA_REPORTING.
2954 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2955 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"  || test -n "$MOZ_NORMANDY"; then
2956   MOZ_DATA_REPORTING=1
2957   AC_DEFINE(MOZ_DATA_REPORTING)
2958   AC_SUBST(MOZ_DATA_REPORTING)
2961 dnl win32 options
2962 AC_SUBST(WIN32_REDIST_DIR)
2963 AC_SUBST(WIN_UCRT_REDIST_DIR)
2965 dnl ========================================================
2966 dnl ICU Support
2967 dnl ========================================================
2969 _INTL_API=yes
2971 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
2972     USE_ICU=1
2975 MOZ_CONFIG_ICU()
2977 dnl Echo the CFLAGS to remove extra whitespace.
2978 CFLAGS=`echo \
2979     $_COMPILATION_CFLAGS \
2980     $CFLAGS`
2982 CXXFLAGS=`echo \
2983     $_WARNINGS_CXXFLAGS \
2984     $_COMPILATION_CXXFLAGS \
2985     $CXXFLAGS`
2987 COMPILE_CFLAGS=`echo \
2988     $_DEFINES_CFLAGS \
2989     $COMPILE_CFLAGS`
2991 COMPILE_CXXFLAGS=`echo \
2992     $_DEFINES_CXXFLAGS \
2993     $COMPILE_CXXFLAGS`
2995 HOST_CFLAGS=`echo \
2996     $_WARNINGS_HOST_CFLAGS \
2997     $_COMPILATION_HOST_CFLAGS \
2998     $HOST_CFLAGS`
3000 HOST_CXXFLAGS=`echo \
3001     $_WARNINGS_HOST_CXXFLAGS \
3002     $_COMPILATION_HOST_CXXFLAGS \
3003     $HOST_CXXFLAGS`
3005 AC_SUBST(MOZ_SYSTEM_PNG)
3007 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3008 AC_SUBST_LIST(MOZ_PNG_LIBS)
3010 AC_SUBST(MOZ_SYSTEM_NSPR)
3012 AC_SUBST(MOZ_SYSTEM_NSS)
3014 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3015 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3016 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3017 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3018 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3019   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3020   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3022 AC_SUBST(HOST_CMFLAGS)
3023 AC_SUBST(HOST_CMMFLAGS)
3024 AC_SUBST(OS_COMPILE_CMFLAGS)
3025 AC_SUBST(OS_COMPILE_CMMFLAGS)
3027 OS_CFLAGS="$CFLAGS"
3028 OS_CXXFLAGS="$CXXFLAGS"
3029 OS_CPPFLAGS="$CPPFLAGS"
3030 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3031 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3032 OS_LDFLAGS="$LDFLAGS"
3033 OS_LIBS="$LIBS"
3034 AC_SUBST_LIST(OS_CFLAGS)
3035 AC_SUBST_LIST(OS_CXXFLAGS)
3036 AC_SUBST_LIST(OS_CPPFLAGS)
3037 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3038 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3039 AC_SUBST_LIST(OS_LDFLAGS)
3040 AC_SUBST(OS_LIBS)
3042 AC_SUBST(HOST_CC)
3043 AC_SUBST(HOST_CXX)
3044 AC_SUBST_LIST(HOST_CFLAGS)
3045 AC_SUBST_LIST(HOST_CPPFLAGS)
3046 AC_SUBST_LIST(HOST_CXXFLAGS)
3047 AC_SUBST(HOST_LDFLAGS)
3048 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3049 AC_SUBST(HOST_BIN_SUFFIX)
3051 AC_SUBST(TARGET_XPCOM_ABI)
3052 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3053 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3054 AC_SUBST(HAVE_X86_AVX2)
3055 AC_SUBST(HAVE_ALTIVEC)
3057 AC_SUBST_LIST(DSO_CFLAGS)
3058 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3059 AC_SUBST(DSO_LDOPTS)
3060 AC_SUBST(BIN_SUFFIX)
3061 AC_SUBST(USE_N32)
3062 AC_SUBST(NS_ENABLE_TSF)
3063 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3064 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3066 AC_SUBST(MOZ_DEVTOOLS)
3068 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3069 AC_SUBST(MOZ_FOLD_LIBS)
3070 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3072 AC_SUBST(DMG_TOOL)
3074 dnl Host JavaScript runtime, if any, to use during cross compiles.
3075 AC_SUBST(JS_BINARY)
3077 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3079 if test -n "$COMPILE_ENVIRONMENT"; then
3080 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3082 dnl Check for missing components
3083 if test "$MOZ_X11"; then
3084     dnl ====================================================
3085     dnl = Check if X headers exist
3086     dnl ====================================================
3087     _SAVE_CFLAGS=$CFLAGS
3088     CFLAGS="$CFLAGS $XCFLAGS"
3089     AC_TRY_COMPILE([
3090         #include <stdio.h>
3091         #include <stdlib.h>
3092         #include <X11/Xlib.h>
3093         #include <X11/Intrinsic.h>
3094         #include <X11/extensions/XShm.h>
3095     ],
3096     [
3097         Display *dpy = 0;
3098         if ((dpy = XOpenDisplay(NULL)) == NULL) {
3099             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3100             exit(1);
3101         }
3102     ], [],
3103     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3104     CFLAGS="$_SAVE_CFLAGS"
3106     if test -n "$MISSING_X"; then
3107         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3108     fi
3110 fi # MOZ_X11
3112 fi # COMPILE_ENVIRONMENT
3114 dnl Set various defines and substitutions
3115 dnl ========================================================
3117 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3118     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3119     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3120     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3121     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3122     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3123     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3124     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3125     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3128 AC_SUBST(MOZ_DEV_EDITION)
3129 if test -n "$MOZ_DEV_EDITION"; then
3130     AC_DEFINE(MOZ_DEV_EDITION)
3133 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3134     A11Y_LOG=1
3136 AC_SUBST(A11Y_LOG)
3137 if test -n "$A11Y_LOG"; then
3138     AC_DEFINE(A11Y_LOG)
3141 dnl Spit out some output
3142 dnl ========================================================
3144 dnl The following defines are used by xpcom
3145 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3146 HAVE_GETPAGESIZE
3147 HAVE_STATVFS64
3148 HAVE_STATVFS
3149 HAVE_STATFS64
3150 HAVE_STATFS
3151 HAVE_SYS_STATVFS_H
3152 HAVE_SYS_STATFS_H
3153 HAVE_SYS_VFS_H
3154 HAVE_SYS_MOUNT_H
3157 # Avoid using obsolete NSPR features
3158 AC_DEFINE(NO_NSPR_10_SUPPORT)
3160 MOZ_CREATE_CONFIG_STATUS()
3162 rm -fr confdefs* $ac_clean_files