Bug 1608587 [wpt PR 21137] - [FlexNG] Fix min-width: auto for flex item tables, a...
[gecko.git] / old-configure.in
blob1e600382e1c261333cc1004483b020f312f7c2db
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.30.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         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
591         # -Oz is smaller than -Os on clang.
592         MOZ_OPTIMIZE_FLAGS="-Oz"
593         # Disable the outliner, which causes performance regressions, and is
594         # enabled on some platforms at -Oz.
595         if test -z "$MOZ_LTO"; then
596             DISABLE_OUTLINER="-mno-outline"
597             _SAVE_CFLAGS=$CFLAGS
598             CFLAGS="$CFLAGS $DISABLE_OUTLINER"
599             AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
600             CFLAGS="$_SAVE_CFLAGS"
601         else
602             DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
603             _SAVE_LDFLAGS=$LDFLAGS
604             LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
605             AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
606             LDFLAGS="$_SAVE_LDFLAGS"
607         fi
608     fi
609     ;;
611 *-*linux*)
612     if test "$GNU_CC" -o "$GNU_CXX"; then
613         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
614         if test -n "$MOZ_DEBUG"; then
615             MOZ_OPTIMIZE_FLAGS="-Os"
616         else
617             MOZ_OPTIMIZE_FLAGS="-O2"
618         fi
619         if test -z "$CLANG_CC"; then
620            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
621         fi
622     fi
624     case "${target_cpu}" in
625     alpha*)
626         CFLAGS="$CFLAGS -mieee"
627         CXXFLAGS="$CXXFLAGS -mieee"
628     ;;
629     esac
630     ;;
631 *-mingw*)
632     DSO_CFLAGS=
633     DSO_PIC_CFLAGS=
634     # certain versions of cygwin's makedepend barf on the
635     # #include <string> vs -I./dist/include/string issue so don't use it
636     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
637         # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
638         if test -z "$CLANG_CC"; then
639             AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
640         fi
642         DSO_LDOPTS='-shared'
643         # Use temp file for windres (bug 213281)
644         RCFLAGS='-O coff --use-temp-file'
645         # mingw doesn't require kernel32, user32, and advapi32 explicitly
646         LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
647         MOZ_FIX_LINK_PATHS=
649         MOZ_OPTIMIZE_FLAGS="-O2"
651         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
652         WIN32_GUI_EXE_LDFLAGS=-mwindows
654         # Silence problematic clang warnings
655         CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
656     else
657         TARGET_COMPILER_ABI=msvc
658         RANLIB='echo not_ranlib'
659         STRIP='echo not_strip'
660         PKG_SKIP_STRIP=1
661         # aarch64 doesn't support subsystems below 6.02
662         if test "$CPU_ARCH" = "aarch64"; then
663             WIN32_SUBSYSTEM_VERSION=6.02
664         else
665             WIN32_SUBSYSTEM_VERSION=6.01
666         fi
667         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
668         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
669         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
670         _USE_CPP_INCLUDE_FLAG=1
671         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
672         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
673         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
674         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
675         if test -z "$CLANG_CL"; then
676             CPPFLAGS="$CPPFLAGS -utf-8"
677         fi
678         if test "$CPU_ARCH" = "x86"; then
679             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
680             dnl more recent, so set that explicitly here unless another
681             dnl target arch has already been set.
682             changequote(,)
683             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
684               CFLAGS="$CFLAGS -arch:SSE2"
685             fi
686             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
687               CXXFLAGS="$CXXFLAGS -arch:SSE2"
688             fi
689             changequote([,])
690             SSE_FLAGS="-arch:SSE"
691             SSE2_FLAGS="-arch:SSE2"
692             dnl MSVC allows the use of intrinsics without any flags
693             dnl and doesn't have a separate arch for SSSE3
694             SSSE3_FLAGS="-arch:SSE2"
695         fi
696         dnl clang-cl requires appropriate flags to enable SSSE3 support
697         dnl on all architectures.
698         if test -n "$CLANG_CL"; then
699             SSSE3_FLAGS="-mssse3"
700         fi
701         dnl VS2013+ supports -Gw for better linker optimizations.
702         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
703         dnl Disabled on ASan because it causes false-positive ODR violations.
704         if test -z "$MOZ_ASAN"; then
705             CFLAGS="$CFLAGS -Gw"
706             CXXFLAGS="$CXXFLAGS -Gw"
707         else
708             # String tail merging doesn't play nice with ASan's ODR checker.
709             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
710         fi
711         if test -n "$CLANG_CL"; then
712             # XXX We should combine some of these with our generic GCC-style
713             # warning checks.
714             #
715             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
716             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
717             # We use offsetof on non-POD objects all the time.
718             # We also suppress this warning on other platforms.
719             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
720             # This warns for reasonable things like:
721             #   enum { X = 0xffffffffU };
722             # which is annoying for IDL headers.
723             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
724             # This warns for cases that would be reached by the Microsoft
725             # #include rules, but also currently warns on cases that would
726             # *also* be reached by standard C++ include rules.  That
727             # behavior doesn't seem useful, so we turn it off.
728             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
729             # We normally error out on unknown pragmas, but since clang-cl
730             # claims to be MSVC, it would be difficult to add
731             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
732             # use such pragmas, so just ignore them.
733             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
734             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
735             # We get errors about various #pragma intrinsic directives from
736             # clang-cl, and we don't need to hear about those.
737             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
738             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
739             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
740             # as __attribute((__deprecated__)).  This is nice to know,
741             # but since we don't get the equivalent warning from MSVC,
742             # let's just ignore it.
743             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
744             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
745             # We use a function like:
746             #   __declspec(noreturn) __inline void f() {}
747             # which -Winvalid-noreturn complains about.  Again, MSVC seems
748             # OK with it, so let's silence the warning.
749             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
750             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
751             # Missing |override| on virtual function declarations isn't
752             # something that MSVC currently warns about.
753             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
754             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
755             # declaration on |operator delete(void*)|.  However, clang-cl
756             # must internally declare |operator delete(void*)| differently,
757             # which causes this warning for virtually every file in the
758             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
759             # so there doesn't seem to be any way to convince clang-cl to
760             # declare |delete| differently.  Therefore, suppress this
761             # warning.
762             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
763             # Macros like STDMETHOD() and IFACEMETHOD() can declare
764             # __attribute__((nothrow)) on their respective method declarations,
765             # while the definitions are left without the matching attribute.
766             CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
767             # At least one MSVC header and several headers in-tree have
768             # unused typedefs, so turn this on.
769             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
770             # jemalloc uses __declspec(allocator) as a profiler hint,
771             # which clang-cl doesn't understand.
772             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
773             # __attribute__((unused)) really means "might be unused" and
774             # we use it to avoid warnings about things that are unused
775             # in some compilation units, but used in many others.  This
776             # warning insists on complaining about the latter case, which
777             # is annoying, and rather noisy.
778             CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
779         fi
780         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
781         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
782         LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
783         MOZ_DEBUG_LDFLAGS='-DEBUG'
784         # Use a higher optimization level for clang-cl, so we can come closer
785         # to MSVC's performance numbers (see bug 1443590).
786         if test -n "$CLANG_CL"; then
787             MOZ_OPTIMIZE_FLAGS='-O2'
788         else
789             MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
790         fi
791         MOZ_FIX_LINK_PATHS=
792         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
793         if test -z "$DEVELOPER_OPTIONS"; then
794             LDFLAGS="$LDFLAGS -RELEASE"
795         fi
796         RCFLAGS="-nologo"
797         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
798         dnl both SSSE3 and SSE4.1.
799         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
800         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
801         dnl allow AVX2 code from VS2015
802         HAVE_X86_AVX2=1
803     fi
804     AC_DEFINE(WIN32_LEAN_AND_MEAN)
805     dnl See http://support.microsoft.com/kb/143208 to use STL
806     AC_DEFINE(NOMINMAX)
807     BIN_SUFFIX='.exe'
808     MOZ_USER_DIR="Mozilla"
810     case "$host_os" in
811     cygwin*|msvc*|mks*)
812         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.])
813         ;;
814     esac
816     case "$target" in
817     i*86-*)
818         if test -n "$GNU_CC"; then
819             CFLAGS="$CFLAGS -mstackrealign"
820             CXXFLAGS="$CXXFLAGS -mstackrealign"
821             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
822         else
823             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
824             LDFLAGS="$LDFLAGS -SAFESEH"
825         fi
827         AC_DEFINE(_X86_)
828         ;;
829     x86_64-*)
830         if test -n "$_WIN32_MSVC"; then
831             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
832         fi
833         AC_DEFINE(_AMD64_)
834         ;;
835     aarch64-*)
836         if test -n "$_WIN32_MSVC"; then
837             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
838         fi
839         AC_DEFINE(_ARM64_)
840         ;;
841     *)
842         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
843         ;;
844     esac
845     ;;
847 *-netbsd*)
848     DSO_CFLAGS=''
849     CFLAGS="$CFLAGS -Dunix"
850     CXXFLAGS="$CXXFLAGS -Dunix"
851     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
852         DSO_PIC_CFLAGS='-fPIC -DPIC'
853         DSO_LDOPTS='-shared'
854         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
855     else
856         DSO_PIC_CFLAGS='-fPIC -DPIC'
857         DSO_LDOPTS='-shared'
858     fi
859     # This will fail on a.out systems prior to 1.5.1_ALPHA.
860     if test "$LIBRUNPATH"; then
861         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
862     fi
863     ;;
865 *-openbsd*)
866     if test -z "$X11BASE"; then
867         X11BASE=/usr/X11R6
868     fi
869     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
870     DSO_CFLAGS=''
871     DSO_PIC_CFLAGS='-fPIC'
872     DSO_LDOPTS='-shared -fPIC'
873     if test "$LIBRUNPATH"; then
874         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
875     fi
876     ;;
878 *-solaris*)
879     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
880     ;;
882 esac
884 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
885     MOZ_OPTIMIZE_FLAGS="-O"
888 AC_SUBST_LIST(MMX_FLAGS)
889 AC_SUBST_LIST(SSE_FLAGS)
890 AC_SUBST_LIST(SSE2_FLAGS)
891 AC_SUBST_LIST(SSSE3_FLAGS)
893 AC_SUBST(MOZ_LINKER)
894 if test -n "$MOZ_LINKER"; then
895   AC_DEFINE(MOZ_LINKER)
896   MOZ_LINKER_EXTRACT=1
897   AC_CHECK_PROGS(XZ, xz)
900 if test -z "$COMPILE_ENVIRONMENT"; then
901     SKIP_COMPILER_CHECKS=1
902     SKIP_LIBRARY_CHECKS=1
903     PKG_SKIP_STRIP=1
904     MOZ_DEBUGGING_OPTS
905 else
906     MOZ_COMPILER_OPTS
907 fi # COMPILE_ENVIRONMENT
909 if test -z "$SKIP_COMPILER_CHECKS"; then
910 dnl Checks for typedefs, structures, and compiler characteristics.
911 dnl ========================================================
912 AC_C_CONST
913 AC_TYPE_MODE_T
914 AC_TYPE_OFF_T
915 AC_TYPE_PID_T
916 AC_TYPE_SIZE_T
917 AC_LANG_CPLUSPLUS
918 AC_LANG_C
920 AC_LANG_CPLUSPLUS
922 MOZ_CXX11
924 AC_LANG_C
926 case "${OS_TARGET}" in
927 Darwin)
928   ;;
930   STL_FLAGS="-I${DIST}/stl_wrappers"
931   WRAP_STL_INCLUDES=1
932   ;;
933 esac
935 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
936     WRAP_STL_INCLUDES=
939 dnl Checks for header files.
940 dnl ========================================================
941 AC_HEADER_DIRENT
942 case "$target_os" in
943 bitrig*|dragonfly*|freebsd*|openbsd*)
944 # for stuff like -lXshm
945     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
946     ;;
947 esac
949 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
950 AC_CACHE_CHECK(for sockaddr_in.sin_len,
951                    ac_cv_sockaddr_in_sin_len,
952                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
953                                     #include <sys/types.h>
954                                     #endif
955                                     #include <netinet/in.h>
956                                     struct sockaddr_in x;
957                                     void *foo = (void*) &x.sin_len;],
958                                    [],
959                                    [ac_cv_sockaddr_in_sin_len=true],
960                                    [ac_cv_sockaddr_in_sin_len=false])])
961 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
962   AC_DEFINE(HAVE_SIN_LEN)
963 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
964   AC_DEFINE(HAVE_SCONN_LEN)
967 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
968                ac_cv_sockaddr_in6_sin6_len,
969                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
970                                 #include <sys/types.h>
971                                 #endif
972                                 #include <netinet/in.h>
973                                 struct sockaddr_in6 x;
974                                 void *foo = (void*) &x.sin6_len;],
975                                [],
976                                [ac_cv_sockaddr_in6_sin6_len=true],
977                                [ac_cv_sockaddr_in6_sin6_len=false])])
978 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
979   AC_DEFINE(HAVE_SIN6_LEN)
982 AC_CACHE_CHECK(for sockaddr.sa_len,
983                ac_cv_sockaddr_sa_len,
984                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
985                                 #include <sys/types.h>
986                                 #endif
987                                 #include <sys/socket.h>
988                                 struct sockaddr x;
989                                 void *foo = (void*) &x.sa_len;],
990                                [],
991                                [ac_cv_sockaddr_sa_len=true],
992                                [ac_cv_sockaddr_sa_len=false])])
993 if test "$ac_cv_sockaddr_sa_len" = true ; then
994   AC_DEFINE(HAVE_SA_LEN)
997 MOZ_ARG_ENABLE_BOOL(dtrace,
998               [  --enable-dtrace         build with dtrace support if available (default=no)],
999               [enable_dtrace="yes"],)
1000 if test "x$enable_dtrace" = "xyes"; then
1001   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1002   if test -n "$HAVE_DTRACE"; then
1003       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1004   else
1005       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1006   fi
1008 AC_SUBST(HAVE_DTRACE)
1010 dnl Checks for libraries.
1011 dnl ========================================================
1012 AC_CHECK_LIB(c_r, gethostbyname_r)
1014 dnl We don't want to link with libdl even if it's present on OS X, since
1015 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1016 dnl in libc.
1017 dnl We don't want to link against libm or libpthread on Darwin since
1018 dnl they both are just symlinks to libSystem and explicitly linking
1019 dnl against libSystem causes issues when debugging (see bug 299601).
1020 case $target in
1021 *-darwin*)
1022     ;;
1024     AC_SEARCH_LIBS(dlopen, dl,
1025         MOZ_CHECK_HEADER(dlfcn.h,
1026         AC_DEFINE(HAVE_DLOPEN)))
1027     ;;
1028 esac
1030 _SAVE_CFLAGS="$CFLAGS"
1031 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1032 AC_CHECK_FUNCS(dladdr memmem)
1033 CFLAGS="$_SAVE_CFLAGS"
1035 if test ! "$GNU_CXX"; then
1036     AC_CHECK_LIB(C, demangle)
1039 AC_CHECK_LIB(socket, socket)
1041 XLDFLAGS="$X_LIBS"
1042 XLIBS="$X_EXTRA_LIBS"
1044 dnl ========================================================
1045 dnl Checks for X libraries.
1046 dnl Ordering is important.
1047 dnl Xt is dependent upon SM as of X11R6
1048 dnl ========================================================
1049 if test -n "$MOZ_X11"; then
1050     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1051     _SAVE_LDFLAGS="$LDFLAGS"
1052     _SAVE_LIBS="$LIBS"
1053     LDFLAGS="$XLDFLAGS $LDFLAGS"
1054     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1055         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1056     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1057         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1059     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1060         unset ac_cv_lib_Xt_XtFree
1061         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1062         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1063         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1064             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1065         ])
1067     dnl ========================================================
1068     dnl = Check for xcb
1069     dnl ========================================================
1070     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1071         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1072     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1073         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1074     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1075         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1077     LDFLAGS="$_SAVE_LDFLAGS"
1078     LIBS="$_SAVE_LIBS"
1079 fi # $MOZ_X11
1081 AC_SUBST_LIST(XCFLAGS)
1082 AC_SUBST_LIST(XLDFLAGS)
1083 AC_SUBST_LIST(XLIBS)
1084 AC_SUBST_LIST(XEXT_LIBS)
1085 AC_SUBST_LIST(XT_LIBS)
1087 dnl ========================================================
1088 dnl = pthread support
1089 dnl = Start by checking whether the system support pthreads
1090 dnl ========================================================
1091 case "$target_os" in
1092 darwin*)
1093     MOZ_USE_PTHREADS=1
1094     ;;
1096     AC_CHECK_LIB(pthreads, pthread_create,
1097         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1098         AC_CHECK_LIB(pthread, pthread_create,
1099             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1100             AC_CHECK_LIB(c_r, pthread_create,
1101                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1102                 AC_CHECK_LIB(c, pthread_create,
1103                     MOZ_USE_PTHREADS=1
1104                 )
1105             )
1106         )
1107     )
1108     ;;
1109 esac
1111 dnl ========================================================
1112 dnl Do the platform specific pthread hackery
1113 dnl ========================================================
1114 if test "$MOZ_USE_PTHREADS"x != x
1115 then
1116     dnl
1117     dnl See if -pthread is supported.
1118     dnl
1119     rm -f conftest*
1120     ac_cv_have_dash_pthread=no
1121     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1122     echo 'int main() { return 0; }' | cat > conftest.c
1123     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1124     if test $? -eq 0; then
1125         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1126             ac_cv_have_dash_pthread=yes
1127             case "$target_os" in
1128             freebsd*)
1129 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1130                 ;;
1131             *)
1132                 CFLAGS="$CFLAGS -pthread"
1133                 CXXFLAGS="$CXXFLAGS -pthread"
1134                 ;;
1135             esac
1136         fi
1137     fi
1138     rm -f conftest*
1139     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1141     dnl
1142     dnl See if -pthreads is supported.
1143     dnl
1144     ac_cv_have_dash_pthreads=no
1145     if test "$ac_cv_have_dash_pthread" = "no"; then
1146         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1147         echo 'int main() { return 0; }' | cat > conftest.c
1148         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1149         if test $? -eq 0; then
1150             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1151                 ac_cv_have_dash_pthreads=yes
1152                 CFLAGS="$CFLAGS -pthreads"
1153                 CXXFLAGS="$CXXFLAGS -pthreads"
1154             fi
1155         fi
1156         rm -f conftest*
1157         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1158     fi
1160     case "$target" in
1161         *-*-freebsd*)
1162             AC_DEFINE(_REENTRANT)
1163             AC_DEFINE(_THREAD_SAFE)
1164             dnl -pthread links in -lpthread, so don't specify it explicitly.
1165             if test "$ac_cv_have_dash_pthread" = "yes"; then
1166                 _PTHREAD_LDFLAGS="-pthread"
1167             fi
1168             ;;
1170         *-*-openbsd*|*-*-bsdi*)
1171             AC_DEFINE(_REENTRANT)
1172             AC_DEFINE(_THREAD_SAFE)
1173             dnl -pthread links in -lc_r, so don't specify it explicitly.
1174             if test "$ac_cv_have_dash_pthread" = "yes"; then
1175                 _PTHREAD_LDFLAGS="-pthread"
1176             fi
1177             ;;
1179         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1180             AC_DEFINE(_REENTRANT)
1181             ;;
1183     esac
1184     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1185     AC_SUBST(MOZ_USE_PTHREADS)
1186     MOZ_CHECK_HEADERS(pthread.h)
1190 dnl Checks for library functions.
1191 dnl ========================================================
1192 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1194 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1195 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1196                ac_cv_clock_monotonic,
1197                [for libs in "" -lrt; do
1198                     _SAVE_LIBS="$LIBS"
1199                     _SAVE_CFLAGS="$CFLAGS"
1200                     LIBS="$LIBS $libs"
1201                     CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1202 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1203 dnl we should or not be able to use it. To detect if we can, we need to make the
1204 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1205                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1206                                  #include <time.h>],
1207                                  [ struct timespec ts;
1208                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
1209                                  ac_cv_clock_monotonic=$libs
1210                                  LIBS="$_SAVE_LIBS"
1211                                  break,
1212                                  ac_cv_clock_monotonic=no)
1213                     LIBS="$_SAVE_LIBS"
1214                     CFLAGS="$_SAVE_CFLAGS"
1215                 done])
1216 if test "$ac_cv_clock_monotonic" != "no"; then
1217     HAVE_CLOCK_MONOTONIC=1
1218     REALTIME_LIBS=$ac_cv_clock_monotonic
1219     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1220     AC_SUBST(HAVE_CLOCK_MONOTONIC)
1221     AC_SUBST_LIST(REALTIME_LIBS)
1224 dnl Turn on warnings-as-errors to prevent implicit declaration of
1225 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1226 dnl inadvertently pass even if the function does not really exist.
1227 _SAVE_CFLAGS="$CFLAGS"
1228 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1229 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1230                ac_cv_pthread_cond_timedwait_monotonic_np,
1231                AC_TRY_LINK([#include <pthread.h>],
1232                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1233                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1234                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1235 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1236     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1238 CFLAGS=$_SAVE_CFLAGS
1240 AC_CACHE_CHECK(
1241     [for res_ninit()],
1242     ac_cv_func_res_ninit,
1243     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1244         dnl no need for res_ninit() on NetBSD and OpenBSD
1245         ac_cv_func_res_ninit=no
1246      else
1247         AC_TRY_LINK([
1248             #ifdef linux
1249             #define _BSD_SOURCE 1
1250             #endif
1251             #include <sys/types.h>
1252             #include <netinet/in.h>
1253             #include <arpa/nameser.h>
1254             #include <resolv.h>
1255             ],
1256             [int foo = res_ninit(&_res);],
1257             [ac_cv_func_res_ninit=yes],
1258             [ac_cv_func_res_ninit=no])
1259      fi
1260     ])
1262 if test "$ac_cv_func_res_ninit" = "yes"; then
1263     AC_DEFINE(HAVE_RES_NINIT)
1264 dnl must add the link line we do something as foolish as this... dougt
1265 dnl else
1266 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1267 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1270 AC_LANG_C
1272 dnl **********************
1273 dnl *** va_copy checks ***
1274 AC_CACHE_CHECK([for an implementation of va_copy()],
1275                ac_cv_va_copy,
1276     [AC_TRY_COMPILE([#include <stdarg.h>
1277                      #include <stdlib.h>
1278         void f (int i, ...) {
1279             va_list args1, args2;
1280             va_start (args1, i);
1281             va_copy (args2, args1);
1282             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1283                 exit (1);
1284             va_end (args1); va_end (args2);
1285         }],
1286         [f(0, 42); return 0],
1287         [ac_cv_va_copy=yes],
1288         [ac_cv_va_copy=no]
1289     )]
1291 AC_CACHE_CHECK([whether va_list can be copied by value],
1292                ac_cv_va_val_copy,
1293     [AC_TRY_COMPILE([#include <stdarg.h>
1294                      #include <stdlib.h>
1295         void f (int i, ...) {
1296             va_list args1, args2;
1297             va_start (args1, i);
1298             args2 = args1;
1299             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1300                 exit (1);
1301             va_end (args1); va_end (args2);
1302         }],
1303         [f(0, 42); return 0],
1304         [ac_cv_va_val_copy=yes],
1305         [ac_cv_va_val_copy=no],
1306     )]
1308 if test "x$ac_cv_va_copy" = "xyes"; then
1309     AC_DEFINE(VA_COPY, va_copy)
1310     AC_DEFINE(HAVE_VA_COPY)
1313 if test "x$ac_cv_va_val_copy" = "xno"; then
1314    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1317 dnl ===================================================================
1318 dnl ========================================================
1319 dnl Put your C++ language/feature checks below
1320 dnl ========================================================
1321 AC_LANG_CPLUSPLUS
1323 ARM_ABI_PREFIX=
1324 if test "$GNU_CC"; then
1325   if test "$CPU_ARCH" = "arm" ; then
1326     AC_CACHE_CHECK(for ARM EABI,
1327         ac_cv_gcc_arm_eabi,
1328         [AC_TRY_COMPILE([],
1329                         [
1330 #if defined(__ARM_EABI__)
1331   return 0;
1332 #else
1333 #error Not ARM EABI.
1334 #endif
1335                         ],
1336                         ac_cv_gcc_arm_eabi="yes",
1337                         ac_cv_gcc_arm_eabi="no")])
1338     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1339         HAVE_ARM_EABI=1
1340         ARM_ABI_PREFIX=eabi-
1341     else
1342         ARM_ABI_PREFIX=oabi-
1343     fi
1344   fi
1346   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1349 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1350 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1351 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1352 # linking XUL.
1353 _SAVE_LDFLAGS=$LDFLAGS
1354 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1355 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1356                ac_cv_thread_keyword,
1357                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1358                             [return tlsIsMainThread;],
1359                             ac_cv_thread_keyword=yes,
1360                             ac_cv_thread_keyword=no)])
1361 LDFLAGS=$_SAVE_LDFLAGS
1362 # The custom dynamic linker doesn't support TLS variables
1363 MOZ_TLS=
1364 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1365   # mips builds fail with TLS variables because of a binutils bug.
1366   # See bug 528687
1367   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1368   case "${target}" in
1369     mips*-*)
1370       :
1371       ;;
1372     *-android*|*-linuxandroid*)
1373       :
1374       ;;
1375     *-openbsd*)
1376       :
1377       ;;
1378     *)
1379       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1380       MOZ_TLS=1
1381       ;;
1382   esac
1385 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1386 if test -n "$MOZ_LINKER"; then
1387   if test "$CPU_ARCH" = arm; then
1388     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1389     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1390       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1391       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1392     fi
1393   fi
1395 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1396 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1397 dnl Since the linker only understands the sysv ones, no need to build the
1398 dnl gnu style tables anyways.
1399   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1402 dnl End of C++ language/feature checks
1403 AC_LANG_C
1405 dnl ========================================================
1406 dnl =  Internationalization checks
1407 dnl ========================================================
1409 dnl Internationalization and Locale support is different
1410 dnl on various UNIX platforms.  Checks for specific i18n
1411 dnl features go here.
1413 AC_HAVE_FUNCS(localeconv)
1415 fi # ! SKIP_COMPILER_CHECKS
1417 if test -n "${COMPILE_ENVIRONMENT}"; then
1418   MOZ_CHECK_ALLOCATOR
1421 TARGET_XPCOM_ABI=
1422 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1423     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1424     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1427 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1428 dnl features that Windows actually does support.
1430 if test -n "$SKIP_COMPILER_CHECKS"; then
1431    dnl Windows has malloc.h
1432    AC_DEFINE(MALLOC_H, [<malloc.h>])
1433    AC_DEFINE(HAVE_FORCEINLINE)
1434    AC_DEFINE(HAVE_LOCALECONV)
1435 fi # SKIP_COMPILER_CHECKS
1437 dnl Mozilla specific options
1438 dnl ========================================================
1439 dnl The macros used for command line options
1440 dnl are defined in build/autoconf/altoptions.m4.
1442 dnl ========================================================
1443 dnl =
1444 dnl = Check for external package dependencies
1445 dnl =
1446 dnl ========================================================
1447 MOZ_ARG_HEADER(External Packages)
1449 case "$OS_TARGET" in
1450 WINNT|Darwin|Android)
1451   MOZ_FOLD_LIBS=1
1452   ;;
1454   MOZ_FOLD_LIBS=
1455   ;;
1456 esac
1458 MOZ_CONFIG_NSPR()
1460 dnl ========================================================
1461 dnl system libevent Support
1462 dnl ========================================================
1463 MOZ_ARG_WITH_STRING(system-libevent,
1464 [  --with-system-libevent[=PFX]
1465                           Use system libevent [installed at prefix PFX]],
1466     LIBEVENT_DIR=$withval)
1468 _SAVE_CFLAGS=$CFLAGS
1469 _SAVE_LDFLAGS=$LDFLAGS
1470 _SAVE_LIBS=$LIBS
1471 if test "$LIBEVENT_DIR" = yes; then
1472     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1473         MOZ_SYSTEM_LIBEVENT=1,
1474         LIBEVENT_DIR=/usr)
1476 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1477     MOZ_SYSTEM_LIBEVENT=
1478 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1479     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1480     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1481     MOZ_CHECK_HEADER(event.h,
1482         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1483              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1484          fi],
1485         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1486     AC_CHECK_LIB(event, event_init,
1487                  [MOZ_SYSTEM_LIBEVENT=1
1488                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1489                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1490                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1492 CFLAGS=$_SAVE_CFLAGS
1493 LDFLAGS=$_SAVE_LDFLAGS
1494 LIBS=$_SAVE_LIBS
1496 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1498 dnl ========================================================
1499 dnl = If NSS was not detected in the system,
1500 dnl = use the one in the source tree (mozilla/security/nss)
1501 dnl ========================================================
1503 MOZ_ARG_WITH_BOOL(system-nss,
1504 [  --with-system-nss       Use system installed NSS],
1505     _USE_SYSTEM_NSS=1 )
1507 if test -n "$_USE_SYSTEM_NSS"; then
1508     AM_PATH_NSS(3.50, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1511 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1512 if test -z "$MOZ_SYSTEM_NSS"; then
1513    case "${OS_ARCH}" in
1514         # Only few platforms have been tested with GYP
1515         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1516             ;;
1517         *)
1518             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1519             ;;
1520    esac
1523 dnl system ZLIB support
1524 dnl ========================================================
1525 MOZ_ZLIB_CHECK([1.2.3])
1527 if test -z "$SKIP_LIBRARY_CHECKS"; then
1529 dnl ========================================================
1530 dnl system PNG Support
1531 dnl ========================================================
1532 MOZ_ARG_WITH_STRING(system-png,
1533 [  --with-system-png[=PFX]
1534                           Use system libpng [installed at prefix PFX]],
1535     PNG_DIR=$withval)
1537 _SAVE_CFLAGS=$CFLAGS
1538 _SAVE_LDFLAGS=$LDFLAGS
1539 _SAVE_LIBS=$LIBS
1540 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1541     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1542     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1544 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1545     MOZ_SYSTEM_PNG=
1546 else
1547     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1548                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1549     AC_CHECK_LIB(png, png_get_acTL, ,
1550                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1552 if test "$MOZ_SYSTEM_PNG" = 1; then
1553     AC_TRY_COMPILE([ #include <stdio.h>
1554                      #include <sys/types.h>
1555                      #include <png.h> ],
1556                    [ #if PNG_LIBPNG_VER < $MOZPNG
1557                      #error "Insufficient libpng version ($MOZPNG required)."
1558                      #endif
1559                      #ifndef PNG_UINT_31_MAX
1560                      #error "Insufficient libpng version."
1561                      #endif ],
1562                    MOZ_SYSTEM_PNG=1,
1563                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1565 CFLAGS=$_SAVE_CFLAGS
1566 LDFLAGS=$_SAVE_LDFLAGS
1567 LIBS=$_SAVE_LIBS
1569 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1570     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1571     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1574 fi # SKIP_LIBRARY_CHECKS
1576 dnl ========================================================
1577 dnl =
1578 dnl = Application
1579 dnl =
1580 dnl ========================================================
1582 MOZ_ARG_HEADER(Application)
1584 ENABLE_SYSTEM_EXTENSION_DIRS=1
1585 MOZ_BRANDING_DIRECTORY=
1586 MOZ_OFFICIAL_BRANDING=
1587 MOZ_AUTH_EXTENSION=1
1588 if test "$MOZ_IOS"; then
1589    MOZ_AUTH_EXTENSION=
1591 MOZ_PREF_EXTENSIONS=1
1592 MOZ_SPELLCHECK=1
1593 MOZ_UNIVERSALCHARDET=1
1594 MOZ_XUL=1
1595 MOZ_ZIPWRITER=1
1596 MOZ_NO_SMART_CARDS=
1597 NECKO_COOKIES=1
1598 MOZ_USE_NATIVE_POPUP_WINDOWS=
1599 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1600 MOZ_SANDBOX=1
1601 MOZ_BINARY_EXTENSIONS=
1602 MOZ_DEVTOOLS=server
1604 case "$target_os" in
1605     mingw*)
1606         NS_ENABLE_TSF=1
1607         AC_DEFINE(NS_ENABLE_TSF)
1608         ;;
1609 esac
1611 # Optional Firefox for Android partner distribution directory.
1612 MOZ_ARG_WITH_STRING(android-distribution-directory,
1613 [  --with-android-distribution-directory=dir
1614                           Optional Firefox for Android partner distribution directory.],
1615   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1617 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1618   # A distribution directory must have an assets/distribution directory.
1619   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1620   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1621     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1622                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1623   fi
1625 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1627 dnl ========================================================
1628 dnl = Trademarked Branding
1629 dnl ========================================================
1630 MOZ_ARG_ENABLE_BOOL(official-branding,
1631 [  --enable-official-branding
1632                           Enable Official mozilla.org Branding
1633                           Do not distribute builds with
1634                           --enable-official-branding unless you have
1635                           permission to use trademarks per
1636                           http://www.mozilla.org/foundation/trademarks/ .],
1637     MOZ_OFFICIAL_BRANDING=1,
1638     MOZ_OFFICIAL_BRANDING=)
1640 # Allow the application to influence configure with a confvars.sh script.
1641 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1642 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1643   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1644   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1645 else
1646   AC_MSG_RESULT([no])
1649 if test "$EARLY_BETA_OR_EARLIER"; then
1650     MOZ_NEW_CERT_STORAGE=1
1651     AC_DEFINE(MOZ_NEW_CERT_STORAGE)
1653 AC_SUBST(MOZ_NEW_CERT_STORAGE)
1655 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1656 MOZ_ARG_WITH_STRING(app-name,
1657 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1658 WITH_APP_NAME=$withval,
1661 if test -n "$WITH_APP_NAME" ; then
1662     MOZ_APP_NAME="$WITH_APP_NAME"
1665 MOZ_ARG_WITH_STRING(app-basename,
1666 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1667 WITH_APP_BASENAME=$withval,
1670 if test -n "$WITH_APP_BASENAME" ; then
1671     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1674 dnl ========================================================
1675 dnl Ensure Android SDK and build-tools versions depending on
1676 dnl mobile target.
1677 dnl ========================================================
1679 case "$MOZ_BUILD_APP" in
1680 mobile/android)
1681     MOZ_ANDROID_SDK
1682     ;;
1683 esac
1685 dnl ========================================================
1686 dnl =
1687 dnl = Toolkit Options
1688 dnl =
1689 dnl ========================================================
1690 MOZ_ARG_HEADER(Toolkit Options)
1692 dnl ========================================================
1693 dnl = Enable the toolkit as needed                         =
1694 dnl ========================================================
1696 case "$MOZ_WIDGET_TOOLKIT" in
1698 cocoa)
1699     LDFLAGS="$LDFLAGS -framework Cocoa"
1700     # Use -Wl as a trick to avoid -framework and framework names from
1701     # being separated by AC_SUBST_LIST.
1702     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'
1703     TK_CFLAGS=""
1704     CFLAGS="$CFLAGS $TK_CFLAGS"
1705     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1706     MOZ_USER_DIR="Mozilla"
1707     MOZ_FS_LAYOUT=bundle
1708     ;;
1710 uikit)
1711     LDFLAGS="$LDFLAGS -framework UIKit"
1712     TK_CFLAGS=""
1713     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'
1714     CFLAGS="$CFLAGS $TK_CFLAGS"
1715     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1716     MOZ_USER_DIR="Mozilla"
1717     MOZ_FS_LAYOUT=bundle
1718     ;;
1720 esac
1722 if test "$OS_TARGET" = Darwin; then
1723     LDFLAGS="$LDFLAGS -lobjc"
1726 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1727 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1728 case "$MOZ_WIDGET_TOOLKIT" in
1729 gtk*)
1730     MOZ_ENABLE_GTK=1
1731     ;;
1732 esac
1734 if test "$COMPILE_ENVIRONMENT"; then
1735   if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1736     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)
1737     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1738     TK_CFLAGS=$MOZ_GTK3_CFLAGS
1739     TK_LIBS=$MOZ_GTK3_LIBS
1740     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1741     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1742     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1743     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1744   fi
1745   if test "$MOZ_ENABLE_GTK"; then
1746     if test "$MOZ_X11"; then
1747       GDK_PACKAGES=gdk-x11-2.0
1748     fi
1749     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1750     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1752     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)
1753     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1754   fi
1755 fi # COMPILE_ENVIRONMENT
1757 AC_SUBST(MOZ_FS_LAYOUT)
1759 AC_SUBST_LIST(TK_CFLAGS)
1760 AC_SUBST_LIST(TK_LIBS)
1762 dnl ========================================================
1763 dnl =
1764 dnl = Components & Features
1765 dnl =
1766 dnl ========================================================
1767 MOZ_ARG_HEADER(Components and Features)
1769 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1770 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1771   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1772     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1773   else
1774     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1775     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1776   fi
1779 MOZ_ARG_WITH_STRING(branding,
1780 [  --with-branding=dir     Use branding from the specified directory.],
1781     MOZ_BRANDING_DIRECTORY=$withval)
1783 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1784 if test -z "$REAL_BRANDING_DIRECTORY"; then
1785   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1788 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1789   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1790 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1791   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1794 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1796 dnl ========================================================
1797 dnl = Distribution ID
1798 dnl ========================================================
1799 MOZ_ARG_WITH_STRING(distribution-id,
1800 [  --with-distribution-id=ID
1801                           Set distribution-specific id (default=org.mozilla)],
1802 [ val=`echo $withval`
1803     MOZ_DISTRIBUTION_ID="$val"])
1805 if test -z "$MOZ_DISTRIBUTION_ID"; then
1806    MOZ_DISTRIBUTION_ID="org.mozilla"
1809 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1810 AC_SUBST(MOZ_DISTRIBUTION_ID)
1812 dnl ========================================================
1813 dnl = libproxy support
1814 dnl ========================================================
1816 if test "$MOZ_ENABLE_GTK"
1817 then
1818     MOZ_ENABLE_LIBPROXY=
1820     MOZ_ARG_ENABLE_BOOL(libproxy,
1821     [  --enable-libproxy         Enable libproxy support ],
1822     MOZ_ENABLE_LIBPROXY=1,
1823     MOZ_ENABLE_LIBPROXY=)
1825     if test "$MOZ_ENABLE_LIBPROXY"
1826     then
1827         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1828         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1829     fi
1831 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1833 dnl ========================================================
1834 dnl = dbus support
1835 dnl ========================================================
1837 if test "$MOZ_ENABLE_GTK"
1838 then
1839     MOZ_ENABLE_DBUS=1
1841     MOZ_ARG_DISABLE_BOOL(dbus,
1842     [  --disable-dbus          Disable dbus support ],
1843         MOZ_ENABLE_DBUS=,
1844         MOZ_ENABLE_DBUS=1)
1846     if test "$MOZ_ENABLE_DBUS"
1847     then
1848         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1849         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1850         AC_DEFINE(MOZ_ENABLE_DBUS)
1851     fi
1853 AC_SUBST(MOZ_ENABLE_DBUS)
1855 dnl =========================================================
1856 dnl = Whether to exclude hyphenations files in the build
1857 dnl =========================================================
1858 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1859     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1862 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1863                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1864                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1866 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1868 if test -n "$MOZ_WEBRTC"; then
1869     if test -n "$MOZ_X11"; then
1870       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1871     fi
1874 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1876 dnl ========================================================
1877 dnl = Apple platform decoder support
1878 dnl ========================================================
1879 if test "$COMPILE_ENVIRONMENT"; then
1880 if test -n "$MOZ_APPLEMEDIA"; then
1881   # hack in frameworks for fmp4 - see bug 1029974
1882   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1883   LDFLAGS="$LDFLAGS -framework AudioToolbox"
1884   dnl Verify CoreMedia is available.
1885   AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1886     [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1888 fi # COMPILE_ENVIRONMENT
1890 dnl ========================================================
1891 dnl = Handle dependent MEDIA defines
1892 dnl ========================================================
1894 MOZ_WEBM_ENCODER=1
1895 AC_DEFINE(MOZ_WEBM_ENCODER)
1896 AC_SUBST(MOZ_WEBM_ENCODER)
1898 dnl ========================================================
1899 dnl NegotiateAuth
1900 dnl ========================================================
1902 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1903 [  --disable-negotiateauth Disable GSS-API negotiation ],
1904     MOZ_AUTH_EXTENSION=,
1905     MOZ_AUTH_EXTENSION=1 )
1907 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1908    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1911 dnl ========================================================
1912 dnl Pref extensions (autoconfig)
1913 dnl ========================================================
1914 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1915 [  --disable-pref-extensions
1916                           Disable pref extensions such as autoconfig],
1917   MOZ_PREF_EXTENSIONS=,
1918   MOZ_PREF_EXTENSIONS=1 )
1920 dnl ========================================================
1921 dnl Searching of system directories for extensions.
1922 dnl Note: this switch is meant to be used for test builds
1923 dnl whose behavior should not depend on what happens to be
1924 dnl installed on the local machine.
1925 dnl ========================================================
1926 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1927 [  --disable-system-extension-dirs
1928                           Disable searching system- and account-global
1929                           directories for extensions of any kind; use
1930                           only profile-specific extension directories],
1931   ENABLE_SYSTEM_EXTENSION_DIRS=,
1932   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1933 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1934   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1937 dnl ========================================================
1938 dnl = Universalchardet
1939 dnl ========================================================
1940 MOZ_ARG_DISABLE_BOOL(universalchardet,
1941 [  --disable-universalchardet
1942                           Disable universal encoding detection],
1943   MOZ_UNIVERSALCHARDET=,
1944   MOZ_UNIVERSALCHARDET=1 )
1946 dnl ========================================================
1947 dnl Gamepad support
1948 dnl ========================================================
1950 if test "$COMPILE_ENVIRONMENT" ; then
1952 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1953 if test "$OS_TARGET" = "Linux"; then
1954     MOZ_CHECK_HEADER([linux/joystick.h])
1955     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1956       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1957     fi
1960 fi # COMPILE_ENVIRONMENT
1963 dnl ========================================================
1964 dnl = Breakpad crash reporting (on by default on supported platforms)
1965 dnl ========================================================
1967 case $target in
1968 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1969   MOZ_CRASHREPORTER=1
1970   ;;
1971 i?86-apple-darwin*|x86_64-apple-darwin*)
1972   if test -z "$MOZ_IOS"; then
1973     MOZ_CRASHREPORTER=1
1974   fi
1975   ;;
1976 *-android*|*-linuxandroid*)
1977   dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1978   dnl be before Linux condition
1979   MOZ_CRASHREPORTER=1
1980   ;;
1981 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1982   if test "$MOZ_ENABLE_GTK"; then
1983     MOZ_CRASHREPORTER=1
1984   fi
1985   ;;
1986 esac
1988 MOZ_ARG_DISABLE_BOOL(crashreporter,
1989 [  --disable-crashreporter Disable breakpad crash reporting],
1990     [MOZ_CRASHREPORTER=],
1991     [MOZ_CRASHREPORTER=F # Force enable breakpad])
1993 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1994   if test "$MOZ_CRASHREPORTER" = F; then
1995     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1996   fi
1997   MOZ_CRASHREPORTER=
2000 if test -n "$MOZ_CRASHREPORTER"; then
2001    AC_DEFINE(MOZ_CRASHREPORTER)
2003   if test "$OS_TARGET" = "Linux" && \
2004     test -z "$SKIP_LIBRARY_CHECKS"; then
2005     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2006   fi
2008   if test "$OS_ARCH" = "WINNT"; then
2009     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2010       MOZ_CRASHREPORTER_INJECTOR=1
2011       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2012     fi
2013   fi
2016 dnl ========================================================
2017 dnl = Enable compilation of specific extension modules
2018 dnl ========================================================
2020 MOZ_ARG_ENABLE_STRING(extensions,
2021 [  --enable-extensions     Enable extensions],
2022 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2023     if test "$option" = "yes" -o "$option" = "all"; then
2024         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2025     elif test "$option" = "no" -o "$option" = "none"; then
2026         MOZ_EXTENSIONS=""
2027     elif test "$option" = "default"; then
2028         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2029     elif test `echo "$option" | grep -c \^-` != 0; then
2030         option=`echo $option | sed 's/^-//'`
2031         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2032     else
2033         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2034     fi
2035 done],
2036     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2038 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2039 dnl when trying to build a nonexistent extension.
2040 for extension in $MOZ_EXTENSIONS; do
2041     if test ! -d "${srcdir}/extensions/${extension}"; then
2042         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2043     fi
2044 done
2046 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2047   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2050 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2051 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2052 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2053    MOZ_ENABLE_CAIRO_FT=1
2054    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2055    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2056    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2059 AC_CHECK_PROGS(WGET, wget, "")
2060 AC_SUBST(WGET)
2062 dnl ========================================================
2063 dnl Updater
2064 dnl ========================================================
2066 if test "$MOZ_IOS"; then
2067   MOZ_UPDATER=
2070 MOZ_ARG_DISABLE_BOOL(updater,
2071 [  --disable-updater       Disable building of updater],
2072     MOZ_UPDATER=,
2073     MOZ_UPDATER=1 )
2075 if test -n "$MOZ_UPDATER"; then
2076     AC_DEFINE(MOZ_UPDATER)
2079 dnl ========================================================
2080 dnl parental controls (for Windows Vista)
2081 dnl ========================================================
2082 MOZ_ARG_DISABLE_BOOL(parental-controls,
2083 [  --disable-parental-controls
2084                           Do not build parental controls],
2085    MOZ_DISABLE_PARENTAL_CONTROLS=1,
2086    MOZ_DISABLE_PARENTAL_CONTROLS=)
2087 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2088     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2091 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2093 dnl ========================================================
2094 dnl = Disable smartcard support
2095 dnl ========================================================
2096 if test -n "$MOZ_NO_SMART_CARDS"; then
2097     AC_DEFINE(MOZ_NO_SMART_CARDS)
2099 AC_SUBST(MOZ_NO_SMART_CARDS)
2101 dnl ========================================================
2102 dnl = Sandboxing support
2103 dnl ========================================================
2104 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2105     # Bug 1182565: TSan conflicts with sandboxing on Linux.
2106     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2107     case $OS_TARGET in
2108     Linux|Android)
2109         MOZ_SANDBOX=
2110         ;;
2111     esac
2114 MOZ_ARG_DISABLE_BOOL(sandbox,
2115 [  --disable-sandbox        Disable sandboxing support],
2116     MOZ_SANDBOX=,
2117     MOZ_SANDBOX=1)
2119 case "$OS_TARGET" in
2120 WINNT|Darwin|OpenBSD)
2122 Linux)
2123     case $CPU_ARCH in
2124         x86_64|x86)
2125         ;;
2126         # Linux sandbox is only available on x86 and x86_64.
2127         *)
2128             MOZ_SANDBOX=
2129         ;;
2130     esac
2131     ;;
2133     # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2134     MOZ_SANDBOX=
2136 esac
2138 if test -n "$MOZ_SANDBOX"; then
2139     AC_DEFINE(MOZ_SANDBOX)
2142 AC_SUBST(MOZ_SANDBOX)
2145 dnl ========================================================
2146 dnl =
2147 dnl = Module specific options
2148 dnl =
2149 dnl ========================================================
2150 MOZ_ARG_HEADER(Individual module options)
2152 dnl ========================================================
2153 dnl Check for sqlite
2154 dnl ========================================================
2156 MOZ_SYSTEM_SQLITE=
2157 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2158 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
2159 MOZ_SYSTEM_SQLITE=1,
2160 MOZ_SYSTEM_SQLITE= )
2162 if test -n "$MOZ_SYSTEM_SQLITE"
2163 then
2164     dnl ============================
2165     dnl === SQLite Version check ===
2166     dnl ============================
2167     dnl Check to see if the system SQLite package is new enough.
2168     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2169 else
2170     dnl ==============================
2171     dnl === SQLite fdatasync check ===
2172     dnl ==============================
2173     dnl Check to see if fdatasync is available
2174     AC_CHECK_FUNC(fdatasync)
2177 if test -n "$MOZ_SYSTEM_SQLITE"; then
2178     AC_DEFINE(MOZ_SYSTEM_SQLITE)
2180 AC_SUBST(MOZ_SYSTEM_SQLITE)
2182 dnl ========================================================
2183 dnl = Disable zipwriter
2184 dnl ========================================================
2185 MOZ_ARG_DISABLE_BOOL(zipwriter,
2186 [  --disable-zipwriter     Disable zipwriter component],
2187     MOZ_ZIPWRITER=,
2188     MOZ_ZIPWRITER=1 )
2189 AC_SUBST(MOZ_ZIPWRITER)
2191 dnl ========================================================
2192 dnl =
2193 dnl = Feature options that require extra sources to be pulled
2194 dnl =
2195 dnl ========================================================
2196 dnl MOZ_ARG_HEADER(Features that require extra sources)
2198 dnl ========================================================
2199 dnl =
2200 dnl = Runtime debugging and Optimization Options
2201 dnl =
2202 dnl ========================================================
2203 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2205 dnl ========================================================
2206 dnl enable mobile optimizations
2207 dnl ========================================================
2208 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2209 [  --enable-mobile-optimize
2210                           Enable mobile optimizations],
2211     MOZ_GFX_OPTIMIZE_MOBILE=1)
2213 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2215 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2216     # We ignore paint will resample on mobile for performance.
2217     # We may want to revisit this later.
2218     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2220     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2221     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2224 dnl ========================================================
2225 dnl = Enable code optimization. ON by default.
2226 dnl ========================================================
2228 # Use value from moz.configure if one is defined. Else use our computed
2229 # value.
2230 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2231     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2234 if test "$COMPILE_ENVIRONMENT"; then
2235 if test -n "$MOZ_OPTIMIZE"; then
2236     AC_MSG_CHECKING([for valid C compiler optimization flags])
2237     _SAVE_CFLAGS=$CFLAGS
2238     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2239     AC_TRY_COMPILE([#include <stdio.h>],
2240         [printf("Hello World\n");],
2241         _results=yes,
2242         _results=no)
2243     AC_MSG_RESULT([$_results])
2244     if test "$_results" = "no"; then
2245         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2246     fi
2247     CFLAGS=$_SAVE_CFLAGS
2248     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2249         # When using llvm-based LTO, non numeric optimization levels are
2250         # not supported by the linker, so force the linker to use -O2 (
2251         # which doesn't influence the level compilation units are actually
2252         # compiled at).
2253         case " $MOZ_OPTIMIZE_FLAGS " in
2254         *\ -Os\ *|*\ -Oz\ *)
2255             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2256             ;;
2257         esac
2258     fi
2260 fi # COMPILE_ENVIRONMENT
2262 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2263 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2264 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2266 dnl ========================================================
2267 dnl = Enable runtime logging
2268 dnl ========================================================
2269 AC_DEFINE(MOZ_LOGGING)
2270 AC_DEFINE(FORCE_PR_LOG)
2272 dnl ========================================================
2273 dnl = This will enable logging of addref, release, ctor, dtor.
2274 dnl ========================================================
2275 _ENABLE_LOGREFCNT=42
2276 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2277 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
2278     _ENABLE_LOGREFCNT=1,
2279     _ENABLE_LOGREFCNT= )
2280 if test "$_ENABLE_LOGREFCNT" = "1"; then
2281     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2282 elif test -z "$_ENABLE_LOGREFCNT"; then
2283     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2286 dnl ========================================================
2287 dnl moz_dump_painting
2288 dnl ========================================================
2289 MOZ_ARG_ENABLE_BOOL(dump-painting,
2290 [  --enable-dump-painting          Enable paint debugging.],
2291     MOZ_DUMP_PAINTING=1,
2292     MOZ_DUMP_PAINTING= )
2293 if test -n "$MOZ_DUMP_PAINTING"; then
2294     AC_DEFINE(MOZ_DUMP_PAINTING)
2295     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2297 if test -n "$MOZ_DEBUG"; then
2298     AC_DEFINE(MOZ_DUMP_PAINTING)
2301 case "${OS_TARGET}" in
2302 Android|WINNT|Darwin)
2303   MOZ_GLUE_IN_PROGRAM=
2304   ;;
2306   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2307   MOZ_GLUE_IN_PROGRAM=1
2308   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2309   ;;
2310 esac
2312 dnl ========================================================
2313 dnl = Jemalloc build setup
2314 dnl ========================================================
2315 if test -z "$MOZ_MEMORY"; then
2316   case "${target}" in
2317     *-mingw*)
2318       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2319         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.])
2320       fi
2321       ;;
2322   esac
2323 else
2324   dnl The generic feature tests that determine how to compute ncpus are long and
2325   dnl complicated.  Therefore, simply define special cpp variables for the
2326   dnl platforms we have special knowledge of.
2327   case "${target}" in
2328   *-mingw*)
2329     export MOZ_NO_DEBUG_RTL=1
2330     ;;
2331   esac
2332 fi # MOZ_MEMORY
2333 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2335 dnl ========================================================
2336 dnl = Enable using the clang plugin to build
2337 dnl ========================================================
2339 if test -n "$COMPILE_ENVIRONMENT"; then
2340 MOZ_CONFIG_CLANG_PLUGIN
2341 fi # COMPILE_ENVIRONMENT
2343 dnl ========================================================
2344 dnl = Enable stripping of libs & executables
2345 dnl ========================================================
2346 MOZ_ARG_ENABLE_BOOL(strip,
2347 [  --enable-strip          Enable stripping of libs & executables ],
2348     ENABLE_STRIP=1,
2349     ENABLE_STRIP= )
2351 dnl ========================================================
2352 dnl = Enable stripping of libs & executables when packaging
2353 dnl ========================================================
2354 MOZ_ARG_ENABLE_BOOL(install-strip,
2355 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
2356     PKG_SKIP_STRIP= ,
2357     PKG_SKIP_STRIP=1)
2359 dnl ========================================================
2360 dnl = frontend JS debug mode
2361 dnl ========================================================
2363 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2364 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
2365    DEBUG_JS_MODULES=1,
2366    DEBUG_JS_MODULES=)
2368 AC_SUBST(DEBUG_JS_MODULES)
2370 dnl ========================================================
2371 dnl =
2372 dnl = Profiling and Instrumenting
2373 dnl =
2374 dnl ========================================================
2375 MOZ_ARG_HEADER(Profiling and Instrumenting)
2377 dnl ========================================================
2378 dnl = Offer a way to disable the startup cache
2379 dnl ========================================================
2381 MOZ_ARG_DISABLE_BOOL(startupcache,
2382 [  --disable-startupcache          Disable startup cache ],
2383     MOZ_DISABLE_STARTUPCACHE=1,
2384     MOZ_DISABLE_STARTUPCACHE=)
2386 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2387   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2389 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2391 dnl ========================================================
2392 dnl = Support for demangling undefined symbols
2393 dnl ========================================================
2394 if test -z "$SKIP_LIBRARY_CHECKS"; then
2395     AC_LANG_SAVE
2396     AC_LANG_CPLUSPLUS
2397     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2398     AC_LANG_RESTORE
2401 # Demangle only for debug or DMD builds
2402 MOZ_DEMANGLE_SYMBOLS=
2403 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2404     MOZ_DEMANGLE_SYMBOLS=1
2405     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2407 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2409 dnl ========================================================
2410 dnl = Support for gcc stack unwinding (from gcc 3.3)
2411 dnl ========================================================
2412 if test -z "$SKIP_LIBRARY_CHECKS"; then
2413     AC_LANG_SAVE
2414     AC_LANG_CPLUSPLUS
2415     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2416     AC_LANG_RESTORE
2419 dnl ========================================================
2420 dnl JIT observers
2421 dnl ========================================================
2423 MOZ_ARG_WITH_STRING(jitreport-granularity,
2424 [  --jitreport-granularity=N
2425                            Default granularity at which to report JIT code
2426                            to external tools
2427                              0 - no info
2428                              1 - code ranges for whole functions only
2429                              2 - per-line information
2430                              3 - per-op information],
2431   JITREPORT_GRANULARITY=$withval,
2432   JITREPORT_GRANULARITY=3)
2434 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2436 dnl ========================================================
2437 dnl =
2438 dnl = Misc. Options
2439 dnl =
2440 dnl ========================================================
2441 MOZ_ARG_HEADER(Misc. Options)
2443 dnl ========================================================
2444 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2445 dnl ========================================================
2446 MOZ_ARG_WITH_STRING(user-appdir,
2447 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
2448 [ val=`echo $withval`
2449 if echo "$val" | grep "\/" >/dev/null; then
2450     AC_MSG_ERROR("Homedir must be single relative path.")
2451 else
2452     MOZ_USER_DIR="$val"
2453 fi])
2455 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2457 if test -z "$SKIP_COMPILER_CHECKS"; then
2458 dnl ========================================================
2459 dnl =
2460 dnl = Compiler Options
2461 dnl =
2462 dnl ========================================================
2463 MOZ_ARG_HEADER(Compiler Options)
2465 dnl ========================================================
2466 dnl Check for gcc -pipe support
2467 dnl ========================================================
2468 AC_MSG_CHECKING([for -pipe support])
2469 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2470     dnl Any gcc that supports firefox supports -pipe.
2471     CFLAGS="$CFLAGS -pipe"
2472     CXXFLAGS="$CXXFLAGS -pipe"
2473     AC_MSG_RESULT([yes])
2474 else
2475     AC_MSG_RESULT([no])
2478 fi # ! SKIP_COMPILER_CHECKS
2480 AC_LANG_C
2482 if test "$COMPILE_ENVIRONMENT"; then
2483 MOZ_EXPAND_LIBS
2484 fi # COMPILE_ENVIRONMENT
2486 dnl ========================================================
2487 dnl =
2488 dnl = Static Build Options
2489 dnl =
2490 dnl ========================================================
2491 MOZ_ARG_HEADER(Static build options)
2493 if test -z "$MOZ_SYSTEM_ZLIB"; then
2494 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2495   ZLIB_IN_MOZGLUE=1
2496   AC_DEFINE(ZLIB_IN_MOZGLUE)
2500 AC_SUBST(ZLIB_IN_MOZGLUE)
2502 dnl ========================================================
2503 dnl =
2504 dnl = Standalone module options
2505 dnl =
2506 dnl ========================================================
2507 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2509 dnl Check for GLib.
2510 dnl ========================================================
2512 if test -z "$SKIP_PATH_CHECKS"; then
2513 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2514     if test "$MOZ_ENABLE_GTK" ; then
2515         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2516     fi
2520 if test -z "${GLIB_GMODULE_LIBS}" \
2521    -a -n "${GLIB_CONFIG}"\
2522     -a "${GLIB_CONFIG}" != no\
2523 ; then
2524     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2527 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2529 if test "$USE_FC_FREETYPE"; then
2530     if test "$COMPILE_ENVIRONMENT"; then
2531         dnl ========================================================
2532         dnl = Check for freetype2 functionality
2533         dnl ========================================================
2534         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2535             _SAVE_LIBS="$LIBS"
2536             _SAVE_CFLAGS="$CFLAGS"
2537             LIBS="$LIBS $FT2_LIBS"
2538             CFLAGS="$CFLAGS $FT2_CFLAGS"
2540             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2541                 ac_cv_member_FT_Bitmap_Size_y_ppem,
2542                 [AC_TRY_COMPILE([#include <ft2build.h>
2543                                  #include FT_FREETYPE_H],
2544                                 [FT_Bitmap_Size s;
2545                                  if (sizeof s.y_ppem) return 0;
2546                                  return 1],
2547                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2548                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2549             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2550                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2551             else
2552                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2553             fi
2554             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2555                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2556                                [FT_Bitmap_Size structure includes y_ppem field])
2558             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2560             LIBS="$_SAVE_LIBS"
2561             CFLAGS="$_SAVE_CFLAGS"
2562         fi
2564         _SAVE_CPPFLAGS="$CPPFLAGS"
2565         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2566         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2567             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2568         CPPFLAGS="$_SAVE_CPPFLAGS"
2569     fi
2572 dnl ========================================================
2573 dnl Check if we need the 32-bit Linux SSE2 error dialog
2574 dnl ========================================================
2576 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2578 dnl ========================================================
2579 dnl Check for pixman and cairo
2580 dnl ========================================================
2582 MOZ_TREE_CAIRO=1
2583 MOZ_ARG_ENABLE_BOOL(system-cairo,
2584 [ --enable-system-cairo  Obsolete: do not use this option],
2585 AC_MSG_ERROR(--enable-system-cairo is not supported),
2586 MOZ_TREE_CAIRO=1 )
2588 MOZ_TREE_PIXMAN=1
2589 MOZ_ARG_ENABLE_BOOL(system-pixman,
2590 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2591 MOZ_TREE_PIXMAN=,
2592 MOZ_TREE_PIXMAN=force,
2593 MOZ_TREE_PIXMAN=1 )
2595 if test "$MOZ_TREE_PIXMAN"; then
2596     AC_DEFINE(MOZ_TREE_PIXMAN)
2597 else
2598     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2601 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2602 AC_DEFINE(MOZ_TREE_CAIRO)
2604 if test "$OS_ARCH" = "WINNT"; then
2605     # For now we assume that we will have a uint64_t available through
2606     # one of the above headers or mozstdint.h.
2607     AC_DEFINE(HAVE_UINT64_T)
2610 # Define macros for cairo-features.h
2611 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2612 if test "$MOZ_X11"; then
2613     XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2614     XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2615     PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2617 if test "$_HAVE_FREETYPE2"; then
2618     FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2619     MOZ_ENABLE_CAIRO_FT=1
2620     CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2623 case "$MOZ_WIDGET_TOOLKIT" in
2624   cocoa | uikit)
2625     QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2626     QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2627     QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2628     ;;
2629   windows)
2630     WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2631     WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2632     WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2634     if test "$COMPILE_ENVIRONMENT"; then
2635       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2636     fi
2637     ;;
2638 esac
2639 if test "$USE_FC_FREETYPE"; then
2640     FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2642 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2643 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2645 AC_SUBST(PS_SURFACE_FEATURE)
2646 AC_SUBST(SVG_SURFACE_FEATURE)
2647 AC_SUBST(XLIB_SURFACE_FEATURE)
2648 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2649 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2650 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2651 AC_SUBST(WIN32_SURFACE_FEATURE)
2652 AC_SUBST(OS2_SURFACE_FEATURE)
2653 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2654 AC_SUBST(FT_FONT_FEATURE)
2655 AC_SUBST(FC_FONT_FEATURE)
2656 AC_SUBST(WIN32_FONT_FEATURE)
2657 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2658 AC_SUBST(QUARTZ_FONT_FEATURE)
2659 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2660 AC_SUBST(QT_SURFACE_FEATURE)
2661 AC_SUBST(TEE_SURFACE_FEATURE)
2663 if test "$MOZ_X11"; then
2664     MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2667 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2669 case "$MOZ_WIDGET_TOOLKIT" in
2670 android)
2671     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2672     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2673     ;;
2674 esac
2676 AC_SUBST(MOZ_TREE_CAIRO)
2677 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2678 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2679 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2680 AC_SUBST(MOZ_TREE_PIXMAN)
2682 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2683 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2684 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2685 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2687 dnl ========================================================
2688 dnl disable xul
2689 dnl ========================================================
2690 MOZ_ARG_DISABLE_BOOL(xul,
2691 [  --disable-xul           Disable XUL],
2692     MOZ_XUL= )
2693 if test "$MOZ_XUL"; then
2694   AC_DEFINE(MOZ_XUL)
2695 else
2696   dnl remove extensions that require XUL
2697   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2700 AC_SUBST(MOZ_XUL)
2702 dnl ========================================================
2703 dnl necko configuration options
2704 dnl ========================================================
2707 dnl option to disable necko's wifi scanner
2710 if test "$MOZ_WIDGET_TOOLKIT"; then
2712   case "$OS_TARGET" in
2713     Darwin)
2714       if test -z "$MOZ_IOS"; then
2715         NECKO_WIFI=1
2716       fi
2717       ;;
2718     DragonFly|FreeBSD|WINNT)
2719       NECKO_WIFI=1
2720       ;;
2721     Linux)
2722       NECKO_WIFI=1
2723       NECKO_WIFI_DBUS=1
2724       ;;
2725   esac
2729 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2730 [  --disable-necko-wifi    Disable necko wifi scanner],
2731     NECKO_WIFI=,
2732     NECKO_WIFI=1)
2734 if test "$NECKO_WIFI"; then
2735   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2736     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2737   fi
2738   AC_DEFINE(NECKO_WIFI)
2739   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2741 AC_SUBST(NECKO_WIFI)
2742 AC_SUBST(NECKO_WIFI_DBUS)
2745 dnl option to disable cookies
2747 MOZ_ARG_DISABLE_BOOL(cookies,
2748 [  --disable-cookies       Disable cookie support],
2749     NECKO_COOKIES=,
2750     NECKO_COOKIES=1)
2751 AC_SUBST(NECKO_COOKIES)
2752 if test "$NECKO_COOKIES"; then
2753     AC_DEFINE(NECKO_COOKIES)
2754     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2757 dnl ========================================================
2758 dnl =
2759 dnl = Maintainer debug option (no --enable equivalent)
2760 dnl =
2761 dnl ========================================================
2763 AC_SUBST(NM)
2764 AC_SUBST_LIST(ASFLAGS)
2765 AC_SUBST(RCFLAGS)
2766 AC_SUBST(IMPLIB)
2767 AC_SUBST(FILTER)
2768 AC_SUBST(MOZ_AUTH_EXTENSION)
2769 AC_SUBST(MOZ_PREF_EXTENSIONS)
2770 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2771 AC_SUBST_LIST(WARNINGS_CFLAGS)
2772 AC_SUBST_SET(MOZ_EXTENSIONS)
2774 AC_SUBST(MOZ_UNIVERSALCHARDET)
2775 AC_SUBST(MOZ_SPELLCHECK)
2776 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2777 AC_SUBST(MOZ_CRASHREPORTER)
2778 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2779 AC_SUBST(MOZ_STUB_INSTALLER)
2780 AC_SUBST(MOZ_UPDATER)
2782 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2783 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2784 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2785 AC_SUBST(ENABLE_STRIP)
2786 AC_SUBST(PKG_SKIP_STRIP)
2787 AC_SUBST(STRIP_FLAGS)
2788 AC_SUBST(INCREMENTAL_LINKER)
2790 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2792 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2793 AC_SUBST(MOZ_LINKER_EXTRACT)
2795 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2796   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2799 AC_SUBST(MOZ_REQUIRE_SIGNING)
2800 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2801   AC_DEFINE(MOZ_REQUIRE_SIGNING)
2804 dnl ========================================================
2805 dnl = Mac bundle name prefix
2806 dnl ========================================================
2807 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2808 [  --with-macbundlename-prefix=prefix
2809                           Prefix for MOZ_MACBUNDLE_NAME],
2810 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2812 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2813 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2814   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2817 if test "$MOZ_DEBUG"; then
2818   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2819 else
2820   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2822 AC_SUBST(MOZ_MACBUNDLE_NAME)
2824 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2825 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2826 # Otherwise, use MOZ_APP_DISPLAYNAME
2827 if test -z "$MOZ_MACBUNDLE_ID"; then
2828    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2830 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2831 if test "$MOZ_DEBUG"; then
2832   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2835 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2836 AC_SUBST(MOZ_MACBUNDLE_ID)
2838 dnl ========================================================
2839 dnl = Child Process Name for IPC
2840 dnl ========================================================
2841 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2842   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2843 else
2844   # We want to let Android unpack the file at install time, but it only does
2845   # so if the file is named libsomething.so. The lib/ path is also required
2846   # because the unpacked file will be under the lib/ subdirectory and will
2847   # need to be executed from that path.
2848   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2850 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2851 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2853 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2854 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2855 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2857 # The following variables are available to branding and application
2858 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2859 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2860 # impacts profile location and user-visible fields.
2861 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2862 # versions of a given application (e.g. Aurora and Firefox both use
2863 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2864 # for application.ini's "Name" field, which controls profile location in
2865 # the absence of a "Profile" field (see below), and various system
2866 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2867 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2868 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2869 # builds (e.g. Aurora for Firefox).
2870 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2871 # defaults to a lowercase form of MOZ_APP_BASENAME.
2872 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2873 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2874 # - MOZ_APP_PROFILE: When set, used for application.ini's
2875 # "Profile" field, which controls profile location.
2876 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2877 # crash reporter server url.
2878 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2880 # The following environment variables used to have an effect, but don't anymore:
2881 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2882 # the contents from the version.txt file in the application directory, or
2883 # browser/config/version.txt if there isn't one.
2884 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2885 # in the "About" window. This was replaced with the contents from the
2886 # version_display.txt or version.txt in the application directory, or
2887 # browser/config/version_display.txt.
2889 if test -z "$MOZ_APP_NAME"; then
2890    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2893 if test -z "$MOZ_APP_REMOTINGNAME"; then
2894    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2897 if test -z "$ANDROID_PACKAGE_NAME" ; then
2898    # When we got rid of the Aurora channel we decided to replace the old
2899    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2900    # by all mozilla-central based branches we make this the new "default"
2901    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2902    # in their mozconfig, so they will never get this. If there are ever
2903    # non-Fennec builds for Android, they will fall into the else block
2904    # and use their own default name.
2905    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2906    # background on this.
2907    if test "$MOZ_APP_NAME" = "fennec"; then
2908       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2909    else
2910       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2911    fi
2914 # For extensions and langpacks, we require a max version that is compatible
2915 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2916 # 24.0a1 and 24.0a2 aren't affected
2917 # 24.0 becomes 24.*
2918 # 24.1.1 becomes 24.*
2919 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2920 if test -z "$IS_ALPHA"; then
2921   changequote(,)
2922   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2923     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2924   else
2925     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2926   fi
2927   changequote([,])
2928 else
2929   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2932 AC_SUBST(MOZ_APP_NAME)
2933 AC_SUBST(MOZ_APP_REMOTINGNAME)
2934 AC_SUBST(MOZ_APP_DISPLAYNAME)
2935 AC_SUBST(MOZ_APP_BASENAME)
2936 AC_SUBST(MOZ_APP_VENDOR)
2937 AC_SUBST(MOZ_APP_PROFILE)
2938 AC_SUBST(MOZ_APP_ID)
2939 AC_SUBST(MAR_CHANNEL_ID)
2940 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2941 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2942 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2943 AC_SUBST(MOZ_APP_UA_NAME)
2944 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2945 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2946 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2948 AC_SUBST(MOZ_APP_MAXVERSION)
2949 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2950 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2951   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2954 AC_SUBST(MOZ_PKG_SPECIAL)
2955 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2957 if test "$MOZILLA_OFFICIAL"; then
2958     # Build revisions should always be present in official builds
2959     MOZ_INCLUDE_SOURCE_INFO=1
2962 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2963 # explicitly set the repository and changeset information in.
2964 AC_SUBST(MOZ_SOURCE_REPO)
2965 AC_SUBST(MOZ_SOURCE_CHANGESET)
2966 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2968 dnl If we have any service that uploads data (and requires data submission
2969 dnl policy alert), set MOZ_DATA_REPORTING.
2970 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2971 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"  || test -n "$MOZ_NORMANDY"; then
2972   MOZ_DATA_REPORTING=1
2973   AC_DEFINE(MOZ_DATA_REPORTING)
2974   AC_SUBST(MOZ_DATA_REPORTING)
2977 dnl win32 options
2978 AC_SUBST(WIN32_REDIST_DIR)
2979 AC_SUBST(WIN_UCRT_REDIST_DIR)
2981 dnl ========================================================
2982 dnl ICU Support
2983 dnl ========================================================
2985 _INTL_API=yes
2987 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
2988     USE_ICU=1
2991 MOZ_CONFIG_ICU()
2993 dnl Echo the CFLAGS to remove extra whitespace.
2994 CFLAGS=`echo \
2995     $_COMPILATION_CFLAGS \
2996     $CFLAGS`
2998 CXXFLAGS=`echo \
2999     $_WARNINGS_CXXFLAGS \
3000     $_COMPILATION_CXXFLAGS \
3001     $CXXFLAGS`
3003 COMPILE_CFLAGS=`echo \
3004     $_DEFINES_CFLAGS \
3005     $COMPILE_CFLAGS`
3007 COMPILE_CXXFLAGS=`echo \
3008     $_DEFINES_CXXFLAGS \
3009     $COMPILE_CXXFLAGS`
3011 HOST_CFLAGS=`echo \
3012     $_WARNINGS_HOST_CFLAGS \
3013     $_COMPILATION_HOST_CFLAGS \
3014     $HOST_CFLAGS`
3016 HOST_CXXFLAGS=`echo \
3017     $_WARNINGS_HOST_CXXFLAGS \
3018     $_COMPILATION_HOST_CXXFLAGS \
3019     $HOST_CXXFLAGS`
3021 AC_SUBST(MOZ_SYSTEM_PNG)
3023 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3024 AC_SUBST_LIST(MOZ_PNG_LIBS)
3026 AC_SUBST(MOZ_SYSTEM_NSPR)
3028 AC_SUBST(MOZ_SYSTEM_NSS)
3030 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3031 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3032 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3033 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3034 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3035   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3036   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3038 AC_SUBST(HOST_CMFLAGS)
3039 AC_SUBST(HOST_CMMFLAGS)
3040 AC_SUBST(OS_COMPILE_CMFLAGS)
3041 AC_SUBST(OS_COMPILE_CMMFLAGS)
3043 OS_CFLAGS="$CFLAGS"
3044 OS_CXXFLAGS="$CXXFLAGS"
3045 OS_CPPFLAGS="$CPPFLAGS"
3046 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3047 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3048 OS_LDFLAGS="$LDFLAGS"
3049 OS_LIBS="$LIBS"
3050 AC_SUBST_LIST(OS_CFLAGS)
3051 AC_SUBST_LIST(OS_CXXFLAGS)
3052 AC_SUBST_LIST(OS_CPPFLAGS)
3053 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3054 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3055 AC_SUBST_LIST(OS_LDFLAGS)
3056 AC_SUBST(OS_LIBS)
3058 AC_SUBST(HOST_CC)
3059 AC_SUBST(HOST_CXX)
3060 AC_SUBST_LIST(HOST_CFLAGS)
3061 AC_SUBST_LIST(HOST_CPPFLAGS)
3062 AC_SUBST_LIST(HOST_CXXFLAGS)
3063 AC_SUBST(HOST_LDFLAGS)
3064 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3065 AC_SUBST(HOST_BIN_SUFFIX)
3067 AC_SUBST(TARGET_XPCOM_ABI)
3068 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3069 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3070 AC_SUBST(HAVE_X86_AVX2)
3071 AC_SUBST(HAVE_ALTIVEC)
3073 AC_SUBST_LIST(DSO_CFLAGS)
3074 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3075 AC_SUBST(DSO_LDOPTS)
3076 AC_SUBST(BIN_SUFFIX)
3077 AC_SUBST(USE_N32)
3078 AC_SUBST(NS_ENABLE_TSF)
3079 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3080 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3082 AC_SUBST(MOZ_DEVTOOLS)
3084 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3085 AC_SUBST(MOZ_FOLD_LIBS)
3086 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3088 AC_SUBST(DMG_TOOL)
3090 dnl Host JavaScript runtime, if any, to use during cross compiles.
3091 AC_SUBST(JS_BINARY)
3093 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3095 if test -n "$COMPILE_ENVIRONMENT"; then
3096 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3098 dnl Check for missing components
3099 if test "$MOZ_X11"; then
3100     dnl ====================================================
3101     dnl = Check if X headers exist
3102     dnl ====================================================
3103     _SAVE_CFLAGS=$CFLAGS
3104     CFLAGS="$CFLAGS $XCFLAGS"
3105     AC_TRY_COMPILE([
3106         #include <stdio.h>
3107         #include <stdlib.h>
3108         #include <X11/Xlib.h>
3109         #include <X11/Intrinsic.h>
3110         #include <X11/extensions/XShm.h>
3111     ],
3112     [
3113         Display *dpy = 0;
3114         if ((dpy = XOpenDisplay(NULL)) == NULL) {
3115             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3116             exit(1);
3117         }
3118     ], [],
3119     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3120     CFLAGS="$_SAVE_CFLAGS"
3122     if test -n "$MISSING_X"; then
3123         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3124     fi
3126 fi # MOZ_X11
3128 fi # COMPILE_ENVIRONMENT
3130 dnl Set various defines and substitutions
3131 dnl ========================================================
3133 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3134     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3135     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3136     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3137     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3138     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3139     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3140     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3141     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3144 AC_SUBST(MOZ_DEV_EDITION)
3145 if test -n "$MOZ_DEV_EDITION"; then
3146     AC_DEFINE(MOZ_DEV_EDITION)
3149 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3150     A11Y_LOG=1
3152 AC_SUBST(A11Y_LOG)
3153 if test -n "$A11Y_LOG"; then
3154     AC_DEFINE(A11Y_LOG)
3157 dnl Spit out some output
3158 dnl ========================================================
3160 dnl The following defines are used by xpcom
3161 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3162 HAVE_GETPAGESIZE
3163 HAVE_STATVFS64
3164 HAVE_STATVFS
3165 HAVE_STATFS64
3166 HAVE_STATFS
3167 HAVE_SYS_STATVFS_H
3168 HAVE_SYS_STATFS_H
3169 HAVE_SYS_VFS_H
3170 HAVE_SYS_MOUNT_H
3173 # Avoid using obsolete NSPR features
3174 AC_DEFINE(NO_NSPR_10_SUPPORT)
3176 MOZ_CREATE_CONFIG_STATUS()
3178 rm -fr confdefs* $ac_clean_files