Bug 1601761 - Enable the PiP audio toggle in nightly. r=mconley
[gecko.git] / old-configure.in
blobc93385db7bf405eb1abd2bcd5e0f1f5b4971ae1c
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.24
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 STARTUP_NOTIFICATION_VERSION=0.8
65 DBUS_VERSION=0.60
66 SQLITE_VERSION=3.30.1
68 dnl Set various checks
69 dnl ========================================================
70 MISSING_X=
72 dnl Initialize the Pthread test variables early so they can be
73 dnl  overridden by each platform.
74 dnl ========================================================
75 MOZ_USE_PTHREADS=
76 _PTHREAD_LDFLAGS=""
78 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
80 if test "$COMPILE_ENVIRONMENT"; then
81     MOZ_ANDROID_NDK
82 fi # COMPILE_ENVIRONMENT
84 case "$target" in
85 *-android*|*-linuxandroid*)
86     ;;
87 *-linux*)
88     AC_PATH_PROG(OBJCOPY,objcopy)
89     ;;
90 esac
92 case "$target" in
93 *-apple-darwin*)
94     MOZ_IOS_SDK
95     ;;
96 esac
98 AC_SUBST(ANDROID_PACKAGE_NAME)
99 AC_SUBST(OBJCOPY)
101 dnl ========================================================
102 dnl Checks for compilers.
103 dnl ========================================================
105 if test "$COMPILE_ENVIRONMENT"; then
107 if test "$target" != "$host"; then
108     MOZ_CROSS_COMPILER
109 else
110     AC_PROG_CC
111     case "$target" in
112     *-mingw*)
113       # Work around the conftest.exe access problem on Windows
114       sleep 2
115     esac
116     AC_PROG_CXX
117     AC_PROG_RANLIB
118     MOZ_PATH_PROGS(AS, $AS as, $CC)
119     AC_CHECK_PROGS(STRIP, strip, :)
120     AC_CHECK_PROGS(OTOOL, otool, :)
123 if test -n "$MOZ_WINCONSOLE"; then
124     AC_DEFINE(MOZ_WINCONSOLE)
127 MOZ_TOOL_VARIABLES
129 dnl ========================================================
130 dnl Special win32 checks
131 dnl ========================================================
133 WINVER=601
135 case "$target" in
136 *-mingw*)
137     if test "$GCC" != "yes"; then
138         # Check to see if we are really running in a msvc environemnt
139         _WIN32_MSVC=1
141         # Make sure compilers are valid
142         CFLAGS="$CFLAGS -nologo"
143         CXXFLAGS="$CXXFLAGS -TP -nologo"
144         AC_LANG_SAVE
145         AC_LANG_C
146         AC_TRY_COMPILE([#include <stdio.h>],
147             [ printf("Hello World\n"); ],,
148             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
150         AC_LANG_CPLUSPLUS
151         AC_TRY_COMPILE([#include <new.h>],
152             [ unsigned *test = new unsigned(42); ],,
153             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
154         AC_LANG_RESTORE
156         changequote(,)
157         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
158         changequote([,])
160         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
161         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
162         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
164         _CC_SUITE=14
165         MSVC_C_RUNTIME_DLL=vcruntime140.dll
166         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
168         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
169         CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
171         if test -n "$WIN_UCRT_REDIST_DIR"; then
172           if test ! -d "$WIN_UCRT_REDIST_DIR"; then
173             AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
174           fi
175           WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
176         fi
178         AC_SUBST(MSVC_C_RUNTIME_DLL)
179         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
181         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
183         if test -n "$WIN32_REDIST_DIR"; then
184           if test ! -d "$WIN32_REDIST_DIR"; then
185             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
186           fi
187           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
188         fi
190         # Check linker version, except in lld builds
191         case "$LINKER" in
192         *lld*)
193             ;;
194         *)
195             _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
196             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
197             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
198                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
199             fi
200             ;;
201         esac
203         INCREMENTAL_LINKER=1
205         unset _MSVC_VER_FILTER
207         WRAP_STL_INCLUDES=1
208         STL_FLAGS="-I${DIST}/stl_wrappers"
209         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
210         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
211     else
212         # Check w32api version
213         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
214         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
215         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
216         AC_TRY_COMPILE([#include <w32api.h>],
217             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
218                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
219                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
220                 #error "test failed."
221             #endif
222             , [ res=yes ], [ res=no ])
223         AC_MSG_RESULT([$res])
224         if test "$res" != "yes"; then
225             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
226         fi
227         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
228         # causing problems with local implementations with the same name.
229         AC_DEFINE(STRSAFE_NO_DEPRECATE)
230     fi # !GNU_CC
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     # FIXME: Let us build with strict aliasing. bug 414641.
319     CFLAGS="$CFLAGS -fno-strict-aliasing"
320     DSO_CFLAGS=''
322     if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
323         DSO_PIC_CFLAGS='-fPIC'
324         ASFLAGS="$ASFLAGS -fPIC"
325     fi
327     AC_MSG_CHECKING([for --noexecstack option to as])
328     _SAVE_CFLAGS=$CFLAGS
329     CFLAGS="$CFLAGS -Wa,--noexecstack"
330     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
331                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
332                      AC_MSG_RESULT([no]))
333     CFLAGS=$_SAVE_CFLAGS
334     AC_MSG_CHECKING([for -z noexecstack option to ld])
335     _SAVE_LDFLAGS=$LDFLAGS
336     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
337     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
338                   AC_MSG_RESULT([no])
339                   LDFLAGS=$_SAVE_LDFLAGS)
341     AC_MSG_CHECKING([for -z text option to ld])
342     _SAVE_LDFLAGS=$LDFLAGS
343     LDFLAGS="$LDFLAGS -Wl,-z,text"
344     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
345                   AC_MSG_RESULT([no])
346                   LDFLAGS=$_SAVE_LDFLAGS)
348     AC_MSG_CHECKING([for -z relro option to ld])
349     _SAVE_LDFLAGS=$LDFLAGS
350     LDFLAGS="$LDFLAGS -Wl,-z,relro"
351     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
352                   AC_MSG_RESULT([no])
353                   LDFLAGS=$_SAVE_LDFLAGS)
355     AC_MSG_CHECKING([for -z nocopyreloc option to ld])
356     _SAVE_LDFLAGS=$LDFLAGS
357     LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
358     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
359                   AC_MSG_RESULT([no])
360                   LDFLAGS=$_SAVE_LDFLAGS)
362     AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
363     _SAVE_LDFLAGS=$LDFLAGS
364     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
365     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
366                   AC_MSG_RESULT([no])
367                   LDFLAGS=$_SAVE_LDFLAGS)
369     AC_MSG_CHECKING([for --build-id=sha1 option to ld])
370     _SAVE_LDFLAGS=$LDFLAGS
371     LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
372     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
373                   AC_MSG_RESULT([no])
374                   LDFLAGS=$_SAVE_LDFLAGS)
376     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
377     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
378     _SAVE_LDFLAGS=$LDFLAGS
379     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
380     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
381                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
382                   AC_MSG_RESULT([no]))
383     LDFLAGS=$_SAVE_LDFLAGS
385     # Check for -mssse3 on $CC
386     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
387     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
388     _SAVE_CFLAGS=$CFLAGS
389     CFLAGS="$CFLAGS -mssse3"
390     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
391                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
392                      AC_MSG_RESULT([no]))
393     CFLAGS=$_SAVE_CFLAGS
395     # Check for -msse4.1 on $CC
396     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
397     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
398     _SAVE_CFLAGS=$CFLAGS
399     CFLAGS="$CFLAGS -msse4.1"
400     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
401                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
402                      AC_MSG_RESULT([no]))
403     CFLAGS=$_SAVE_CFLAGS
405     case "${CPU_ARCH}" in
406     x86 | x86_64)
407       AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
408       AC_TRY_COMPILE([],
409                      [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
410                      result="yes", result="no")
411       AC_MSG_RESULT("$result")
412       if test "$result" = "yes"; then
413           HAVE_X86_AVX2=1
414       fi
415       ;;
417     ppc*)
418       AC_MSG_CHECKING([whether we can enable AltiVec support])
419       HAVE_ALTIVEC=
420       _SAVE_CFLAGS=$CFLAGS
421       CFLAGS="$CFLAGS -maltivec"
422       AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
423                        [HAVE_ALTIVEC=1],
424                        AC_MSG_RESULT([no]))
425       CFLAGS=$_SAVE_CFLAGS
426       ;;
427     esac
429     DSO_LDOPTS='-shared'
430     if test "$GCC_USE_GNU_LD"; then
431         # Some tools like ASan use a runtime library that is only
432         # linked against executables, so we must allow undefined
433         # symbols for shared objects in some cases.
434         if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
435             # Don't allow undefined symbols in libraries
436             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
438             # BSDs need `environ' exposed for posix_spawn (bug 753046)
439             case "$OS_TARGET" in
440             DragonFly|FreeBSD|NetBSD|OpenBSD)
441                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
442                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
443                 else
444                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
445                 fi
446                 ;;
447             esac
448         fi
449     fi
451     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
452     _USE_CPP_INCLUDE_FLAG=1
454     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
457 if test "$GNU_CXX"; then
458     # FIXME: Let us build with strict aliasing. bug 414641.
459     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
461     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
462     _USE_CPP_INCLUDE_FLAG=1
465 # For profiling builds keep the symbol information
466 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
467     case "$OS_TARGET" in
468     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
469         STRIP_FLAGS="--strip-debug"
470         ;;
471     esac
474 dnl ========================================================
475 dnl = Enable DMD
476 dnl ========================================================
478 if test "$MOZ_DMD"; then
479     if test "${CPU_ARCH}" = "arm"; then
480         CFLAGS="$CFLAGS -funwind-tables"
481         CXXFLAGS="$CXXFLAGS -funwind-tables"
482     fi
485 dnl ========================================================
486 dnl System overrides of the defaults for host
487 dnl ========================================================
488 case "$host" in
489 *mingw*)
490     if test -n "$_WIN32_MSVC"; then
491         HOST_CFLAGS="$HOST_CFLAGS -nologo"
492     else
493         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
494     fi
495     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
496     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
497     HOST_BIN_SUFFIX=.exe
499     case "${host_cpu}" in
500     i*86)
501         if test -n "$_WIN32_MSVC"; then
502             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
503         fi
504         ;;
505     x86_64)
506         if test -n "$_WIN32_MSVC"; then
507             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
508         fi
509         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
510         ;;
511     esac
512     ;;
514 *-darwin*)
515     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
516     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
517     ;;
519 *-linux*|*-kfreebsd*-gnu|*-gnu*)
520     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
521     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
522     ;;
525     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
526     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
527     ;;
528 esac
530 dnl ========================================================
531 dnl System overrides of the defaults for target
532 dnl ========================================================
534 case "$target" in
535 *-darwin*)
536     MOZ_OPTIMIZE_FLAGS="-O3"
537     CXXFLAGS="$CXXFLAGS -stdlib=libc++"
538     DSO_LDOPTS=''
539     STRIP_FLAGS="$STRIP_FLAGS -x -S"
540     # Ensure that if we're targeting iOS an SDK was provided.
541     AC_CACHE_CHECK(for iOS target,
542                    ac_cv_ios_target,
543                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
544 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
545 #error not iOS
546 #endif],
547                                    [],
548                                    ac_cv_ios_target="yes",
549                                    ac_cv_ios_target="no")])
550     if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
551        AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
552     fi
553     if test -z "$MOZ_IOS"; then
554         # The ExceptionHandling framework is needed for Objective-C exception
555         # logging code in nsObjCExceptions.h. Currently we only use that in debug
556         # builds.
557         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
558     fi
560     dnl DTrace and -dead_strip don't interact well. See bug 403132.
561     dnl ===================================================================
562     if test "x$enable_dtrace" = "xyes"; then
563         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
564     else
565         dnl check for the presence of the -dead_strip linker flag
566         AC_MSG_CHECKING([for -dead_strip option to ld])
567         _SAVE_LDFLAGS=$LDFLAGS
568         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
569         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
570         if test -n "$_HAVE_DEAD_STRIP" ; then
571             AC_MSG_RESULT([yes])
572             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
573         else
574             AC_MSG_RESULT([no])
575         fi
577         LDFLAGS=$_SAVE_LDFLAGS
578     fi
580     MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
581     ;;
583 *-android*|*-linuxandroid*)
584     if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
585         MOZ_LINKER=1
586     fi
588     MOZ_GFX_OPTIMIZE_MOBILE=1
589     if test -z "$CLANG_CC"; then
590         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
591     else
592         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
593         # -Oz is smaller than -Os on clang.
594         MOZ_OPTIMIZE_FLAGS="-Oz"
595         # Disable the outliner, which causes performance regressions, and is
596         # enabled on some platforms at -Oz.
597         if test -z "$MOZ_LTO"; then
598             DISABLE_OUTLINER="-mno-outline"
599             _SAVE_CFLAGS=$CFLAGS
600             CFLAGS="$CFLAGS $DISABLE_OUTLINER"
601             AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
602             CFLAGS="$_SAVE_CFLAGS"
603         else
604             DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
605             _SAVE_LDFLAGS=$LDFLAGS
606             LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
607             AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
608             LDFLAGS="$_SAVE_LDFLAGS"
609         fi
610     fi
611     ;;
613 *-*linux*)
614     if test "$GNU_CC" -o "$GNU_CXX"; then
615         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
616         if test -n "$MOZ_DEBUG"; then
617             MOZ_OPTIMIZE_FLAGS="-Os"
618         else
619             MOZ_OPTIMIZE_FLAGS="-O2"
620         fi
621         if test -z "$CLANG_CC"; then
622            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
623         fi
624     fi
626     case "${target_cpu}" in
627     alpha*)
628         CFLAGS="$CFLAGS -mieee"
629         CXXFLAGS="$CXXFLAGS -mieee"
630     ;;
631     esac
632     ;;
633 *-mingw*)
634     DSO_CFLAGS=
635     DSO_PIC_CFLAGS=
636     # certain versions of cygwin's makedepend barf on the
637     # #include <string> vs -I./dist/include/string issue so don't use it
638     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
639         # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
640         if test -z "$CLANG_CC"; then
641             AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
642         fi
644         DSO_LDOPTS='-shared'
645         # Use temp file for windres (bug 213281)
646         RCFLAGS='-O coff --use-temp-file'
647         # mingw doesn't require kernel32, user32, and advapi32 explicitly
648         LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
649         MOZ_FIX_LINK_PATHS=
651         MOZ_OPTIMIZE_FLAGS="-O2"
653         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
654         WIN32_GUI_EXE_LDFLAGS=-mwindows
656         # Silence problematic clang warnings
657         CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
658     else
659         TARGET_COMPILER_ABI=msvc
660         RANLIB='echo not_ranlib'
661         STRIP='echo not_strip'
662         PKG_SKIP_STRIP=1
663         # aarch64 doesn't support subsystems below 6.02
664         if test "$CPU_ARCH" = "aarch64"; then
665             WIN32_SUBSYSTEM_VERSION=6.02
666         else
667             WIN32_SUBSYSTEM_VERSION=6.01
668         fi
669         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
670         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
671         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
672         _USE_CPP_INCLUDE_FLAG=1
673         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
674         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
675         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
676         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
677         if test -z "$CLANG_CL"; then
678             CPPFLAGS="$CPPFLAGS -utf-8"
679         fi
680         if test "$CPU_ARCH" = "x86"; then
681             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
682             dnl more recent, so set that explicitly here unless another
683             dnl target arch has already been set.
684             changequote(,)
685             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
686               CFLAGS="$CFLAGS -arch:SSE2"
687             fi
688             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
689               CXXFLAGS="$CXXFLAGS -arch:SSE2"
690             fi
691             changequote([,])
692             SSE_FLAGS="-arch:SSE"
693             SSE2_FLAGS="-arch:SSE2"
694             dnl MSVC allows the use of intrinsics without any flags
695             dnl and doesn't have a separate arch for SSSE3
696             SSSE3_FLAGS="-arch:SSE2"
697         fi
698         dnl clang-cl requires appropriate flags to enable SSSE3 support
699         dnl on all architectures.
700         if test -n "$CLANG_CL"; then
701             SSSE3_FLAGS="-mssse3"
702         fi
703         dnl VS2013+ supports -Gw for better linker optimizations.
704         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
705         dnl Disabled on ASan because it causes false-positive ODR violations.
706         if test -z "$MOZ_ASAN"; then
707             CFLAGS="$CFLAGS -Gw"
708             CXXFLAGS="$CXXFLAGS -Gw"
709         else
710             # String tail merging doesn't play nice with ASan's ODR checker.
711             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
712         fi
713         if test -n "$CLANG_CL"; then
714             # XXX We should combine some of these with our generic GCC-style
715             # warning checks.
716             #
717             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
718             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
719             # We use offsetof on non-POD objects all the time.
720             # We also suppress this warning on other platforms.
721             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
722             # This warns for reasonable things like:
723             #   enum { X = 0xffffffffU };
724             # which is annoying for IDL headers.
725             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
726             # This warns for cases that would be reached by the Microsoft
727             # #include rules, but also currently warns on cases that would
728             # *also* be reached by standard C++ include rules.  That
729             # behavior doesn't seem useful, so we turn it off.
730             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
731             # We normally error out on unknown pragmas, but since clang-cl
732             # claims to be MSVC, it would be difficult to add
733             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
734             # use such pragmas, so just ignore them.
735             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
736             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
737             # We get errors about various #pragma intrinsic directives from
738             # clang-cl, and we don't need to hear about those.
739             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
740             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
741             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
742             # as __attribute((__deprecated__)).  This is nice to know,
743             # but since we don't get the equivalent warning from MSVC,
744             # let's just ignore it.
745             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
746             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
747             # We use a function like:
748             #   __declspec(noreturn) __inline void f() {}
749             # which -Winvalid-noreturn complains about.  Again, MSVC seems
750             # OK with it, so let's silence the warning.
751             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
752             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
753             # Missing |override| on virtual function declarations isn't
754             # something that MSVC currently warns about.
755             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
756             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
757             # declaration on |operator delete(void*)|.  However, clang-cl
758             # must internally declare |operator delete(void*)| differently,
759             # which causes this warning for virtually every file in the
760             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
761             # so there doesn't seem to be any way to convince clang-cl to
762             # declare |delete| differently.  Therefore, suppress this
763             # warning.
764             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
765             # Macros like STDMETHOD() and IFACEMETHOD() can declare
766             # __attribute__((nothrow)) on their respective method declarations,
767             # while the definitions are left without the matching attribute.
768             CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
769             # At least one MSVC header and several headers in-tree have
770             # unused typedefs, so turn this on.
771             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
772             # jemalloc uses __declspec(allocator) as a profiler hint,
773             # which clang-cl doesn't understand.
774             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
775             # __attribute__((unused)) really means "might be unused" and
776             # we use it to avoid warnings about things that are unused
777             # in some compilation units, but used in many others.  This
778             # warning insists on complaining about the latter case, which
779             # is annoying, and rather noisy.
780             CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
781         fi
782         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
783         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
784         LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
785         MOZ_DEBUG_LDFLAGS='-DEBUG'
786         # Use a higher optimization level for clang-cl, so we can come closer
787         # to MSVC's performance numbers (see bug 1443590).
788         if test -n "$CLANG_CL"; then
789             MOZ_OPTIMIZE_FLAGS='-O2'
790         else
791             MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
792         fi
793         MOZ_FIX_LINK_PATHS=
794         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
795         if test -z "$DEVELOPER_OPTIONS"; then
796             LDFLAGS="$LDFLAGS -RELEASE"
797         fi
798         RCFLAGS="-nologo"
799         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
800         dnl both SSSE3 and SSE4.1.
801         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
802         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
803         dnl allow AVX2 code from VS2015
804         HAVE_X86_AVX2=1
805     fi
806     AC_DEFINE(WIN32_LEAN_AND_MEAN)
807     dnl See http://support.microsoft.com/kb/143208 to use STL
808     AC_DEFINE(NOMINMAX)
809     BIN_SUFFIX='.exe'
810     MOZ_USER_DIR="Mozilla"
812     case "$host_os" in
813     cygwin*|msvc*|mks*)
814         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.])
815         ;;
816     esac
818     case "$target" in
819     i*86-*)
820         if test -n "$GNU_CC"; then
821             CFLAGS="$CFLAGS -mstackrealign"
822             CXXFLAGS="$CXXFLAGS -mstackrealign"
823             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
824         else
825             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
826             LDFLAGS="$LDFLAGS -SAFESEH"
827         fi
829         AC_DEFINE(_X86_)
830         ;;
831     x86_64-*)
832         if test -n "$_WIN32_MSVC"; then
833             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
834         fi
835         AC_DEFINE(_AMD64_)
836         ;;
837     aarch64-*)
838         if test -n "$_WIN32_MSVC"; then
839             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
840         fi
841         AC_DEFINE(_ARM64_)
842         ;;
843     *)
844         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
845         ;;
846     esac
847     ;;
849 *-netbsd*)
850     DSO_CFLAGS=''
851     CFLAGS="$CFLAGS -Dunix"
852     CXXFLAGS="$CXXFLAGS -Dunix"
853     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
854         DSO_PIC_CFLAGS='-fPIC -DPIC'
855         DSO_LDOPTS='-shared'
856         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
857     else
858         DSO_PIC_CFLAGS='-fPIC -DPIC'
859         DSO_LDOPTS='-shared'
860     fi
861     # This will fail on a.out systems prior to 1.5.1_ALPHA.
862     if test "$LIBRUNPATH"; then
863         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
864     fi
865     ;;
867 *-openbsd*)
868     if test -z "$X11BASE"; then
869         X11BASE=/usr/X11R6
870     fi
871     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
872     DSO_CFLAGS=''
873     DSO_PIC_CFLAGS='-fPIC'
874     DSO_LDOPTS='-shared -fPIC'
875     if test "$LIBRUNPATH"; then
876         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
877     fi
878     ;;
880 *-solaris*)
881     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
882     ;;
884 esac
886 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
887     MOZ_OPTIMIZE_FLAGS="-O"
890 AC_SUBST_LIST(MMX_FLAGS)
891 AC_SUBST_LIST(SSE_FLAGS)
892 AC_SUBST_LIST(SSE2_FLAGS)
893 AC_SUBST_LIST(SSSE3_FLAGS)
895 AC_SUBST(MOZ_LINKER)
896 if test -n "$MOZ_LINKER"; then
897   AC_DEFINE(MOZ_LINKER)
898   MOZ_LINKER_EXTRACT=1
899   AC_CHECK_PROGS(XZ, xz)
902 if test -z "$COMPILE_ENVIRONMENT"; then
903     SKIP_COMPILER_CHECKS=1
904     SKIP_LIBRARY_CHECKS=1
905     PKG_SKIP_STRIP=1
906     MOZ_DEBUGGING_OPTS
907 else
908     MOZ_COMPILER_OPTS
909 fi # COMPILE_ENVIRONMENT
911 if test -z "$SKIP_COMPILER_CHECKS"; then
912 dnl Checks for typedefs, structures, and compiler characteristics.
913 dnl ========================================================
914 AC_C_CONST
915 AC_TYPE_MODE_T
916 AC_TYPE_OFF_T
917 AC_TYPE_PID_T
918 AC_TYPE_SIZE_T
919 AC_LANG_CPLUSPLUS
920 AC_LANG_C
922 AC_LANG_CPLUSPLUS
924 MOZ_CXX11
926 AC_LANG_C
928 case "${OS_TARGET}" in
929 Darwin)
930   ;;
932   STL_FLAGS="-I${DIST}/stl_wrappers"
933   WRAP_STL_INCLUDES=1
934   ;;
935 esac
937 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
938     WRAP_STL_INCLUDES=
941 dnl Checks for header files.
942 dnl ========================================================
943 AC_HEADER_DIRENT
944 case "$target_os" in
945 bitrig*|dragonfly*|freebsd*|openbsd*)
946 # for stuff like -lXshm
947     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
948     ;;
949 esac
951 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
952 AC_CACHE_CHECK(for sockaddr_in.sin_len,
953                    ac_cv_sockaddr_in_sin_len,
954                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
955                                     #include <sys/types.h>
956                                     #endif
957                                     #include <netinet/in.h>
958                                     struct sockaddr_in x;
959                                     void *foo = (void*) &x.sin_len;],
960                                    [],
961                                    [ac_cv_sockaddr_in_sin_len=true],
962                                    [ac_cv_sockaddr_in_sin_len=false])])
963 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
964   AC_DEFINE(HAVE_SIN_LEN)
965 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
966   AC_DEFINE(HAVE_SCONN_LEN)
969 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
970                ac_cv_sockaddr_in6_sin6_len,
971                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
972                                 #include <sys/types.h>
973                                 #endif
974                                 #include <netinet/in.h>
975                                 struct sockaddr_in6 x;
976                                 void *foo = (void*) &x.sin6_len;],
977                                [],
978                                [ac_cv_sockaddr_in6_sin6_len=true],
979                                [ac_cv_sockaddr_in6_sin6_len=false])])
980 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
981   AC_DEFINE(HAVE_SIN6_LEN)
984 AC_CACHE_CHECK(for sockaddr.sa_len,
985                ac_cv_sockaddr_sa_len,
986                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
987                                 #include <sys/types.h>
988                                 #endif
989                                 #include <sys/socket.h>
990                                 struct sockaddr x;
991                                 void *foo = (void*) &x.sa_len;],
992                                [],
993                                [ac_cv_sockaddr_sa_len=true],
994                                [ac_cv_sockaddr_sa_len=false])])
995 if test "$ac_cv_sockaddr_sa_len" = true ; then
996   AC_DEFINE(HAVE_SA_LEN)
999 MOZ_ARG_ENABLE_BOOL(dtrace,
1000               [  --enable-dtrace         build with dtrace support if available (default=no)],
1001               [enable_dtrace="yes"],)
1002 if test "x$enable_dtrace" = "xyes"; then
1003   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1004   if test -n "$HAVE_DTRACE"; then
1005       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1006   else
1007       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1008   fi
1010 AC_SUBST(HAVE_DTRACE)
1012 dnl Checks for libraries.
1013 dnl ========================================================
1014 AC_CHECK_LIB(c_r, gethostbyname_r)
1016 dnl We don't want to link with libdl even if it's present on OS X, since
1017 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1018 dnl in libc.
1019 dnl We don't want to link against libm or libpthread on Darwin since
1020 dnl they both are just symlinks to libSystem and explicitly linking
1021 dnl against libSystem causes issues when debugging (see bug 299601).
1022 case $target in
1023 *-darwin*)
1024     ;;
1026     AC_SEARCH_LIBS(dlopen, dl,
1027         MOZ_CHECK_HEADER(dlfcn.h,
1028         AC_DEFINE(HAVE_DLOPEN)))
1029     ;;
1030 esac
1032 _SAVE_CFLAGS="$CFLAGS"
1033 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1034 AC_CHECK_FUNCS(dladdr memmem)
1035 CFLAGS="$_SAVE_CFLAGS"
1037 if test ! "$GNU_CXX"; then
1038     AC_CHECK_LIB(C, demangle)
1041 AC_CHECK_LIB(socket, socket)
1043 XLDFLAGS="$X_LIBS"
1044 XLIBS="$X_EXTRA_LIBS"
1046 dnl ========================================================
1047 dnl Checks for X libraries.
1048 dnl Ordering is important.
1049 dnl Xt is dependent upon SM as of X11R6
1050 dnl ========================================================
1051 if test -n "$MOZ_X11"; then
1052     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1053     _SAVE_LDFLAGS="$LDFLAGS"
1054     _SAVE_LIBS="$LIBS"
1055     LDFLAGS="$XLDFLAGS $LDFLAGS"
1056     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1057         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1058     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1059         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1061     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1062         unset ac_cv_lib_Xt_XtFree
1063         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1064         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1065         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1066             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1067         ])
1069     dnl ========================================================
1070     dnl = Check for xcb
1071     dnl ========================================================
1072     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1073         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1074     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1075         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1076     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1077         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1079     LDFLAGS="$_SAVE_LDFLAGS"
1080     LIBS="$_SAVE_LIBS"
1081 fi # $MOZ_X11
1083 AC_SUBST_LIST(XCFLAGS)
1084 AC_SUBST_LIST(XLDFLAGS)
1085 AC_SUBST_LIST(XLIBS)
1086 AC_SUBST_LIST(XEXT_LIBS)
1087 AC_SUBST_LIST(XT_LIBS)
1089 dnl ========================================================
1090 dnl = pthread support
1091 dnl = Start by checking whether the system support pthreads
1092 dnl ========================================================
1093 case "$target_os" in
1094 darwin*)
1095     MOZ_USE_PTHREADS=1
1096     ;;
1098     AC_CHECK_LIB(pthreads, pthread_create,
1099         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1100         AC_CHECK_LIB(pthread, pthread_create,
1101             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1102             AC_CHECK_LIB(c_r, pthread_create,
1103                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1104                 AC_CHECK_LIB(c, pthread_create,
1105                     MOZ_USE_PTHREADS=1
1106                 )
1107             )
1108         )
1109     )
1110     ;;
1111 esac
1113 dnl ========================================================
1114 dnl Do the platform specific pthread hackery
1115 dnl ========================================================
1116 if test "$MOZ_USE_PTHREADS"x != x
1117 then
1118     dnl
1119     dnl See if -pthread is supported.
1120     dnl
1121     rm -f conftest*
1122     ac_cv_have_dash_pthread=no
1123     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1124     echo 'int main() { return 0; }' | cat > conftest.c
1125     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1126     if test $? -eq 0; then
1127         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1128             ac_cv_have_dash_pthread=yes
1129             case "$target_os" in
1130             freebsd*)
1131 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1132                 ;;
1133             *)
1134                 CFLAGS="$CFLAGS -pthread"
1135                 CXXFLAGS="$CXXFLAGS -pthread"
1136                 ;;
1137             esac
1138         fi
1139     fi
1140     rm -f conftest*
1141     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1143     dnl
1144     dnl See if -pthreads is supported.
1145     dnl
1146     ac_cv_have_dash_pthreads=no
1147     if test "$ac_cv_have_dash_pthread" = "no"; then
1148         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1149         echo 'int main() { return 0; }' | cat > conftest.c
1150         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1151         if test $? -eq 0; then
1152             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1153                 ac_cv_have_dash_pthreads=yes
1154                 CFLAGS="$CFLAGS -pthreads"
1155                 CXXFLAGS="$CXXFLAGS -pthreads"
1156             fi
1157         fi
1158         rm -f conftest*
1159         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1160     fi
1162     case "$target" in
1163         *-*-freebsd*)
1164             AC_DEFINE(_REENTRANT)
1165             AC_DEFINE(_THREAD_SAFE)
1166             dnl -pthread links in -lpthread, so don't specify it explicitly.
1167             if test "$ac_cv_have_dash_pthread" = "yes"; then
1168                 _PTHREAD_LDFLAGS="-pthread"
1169             fi
1170             ;;
1172         *-*-openbsd*|*-*-bsdi*)
1173             AC_DEFINE(_REENTRANT)
1174             AC_DEFINE(_THREAD_SAFE)
1175             dnl -pthread links in -lc_r, so don't specify it explicitly.
1176             if test "$ac_cv_have_dash_pthread" = "yes"; then
1177                 _PTHREAD_LDFLAGS="-pthread"
1178             fi
1179             ;;
1181         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1182             AC_DEFINE(_REENTRANT)
1183             ;;
1185     esac
1186     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1187     AC_SUBST(MOZ_USE_PTHREADS)
1188     MOZ_CHECK_HEADERS(pthread.h)
1192 dnl Checks for library functions.
1193 dnl ========================================================
1194 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1196 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1197 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1198                ac_cv_clock_monotonic,
1199                [for libs in "" -lrt; do
1200                     _SAVE_LIBS="$LIBS"
1201                     _SAVE_CFLAGS="$CFLAGS"
1202                     LIBS="$LIBS $libs"
1203                     CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1204 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1205 dnl we should or not be able to use it. To detect if we can, we need to make the
1206 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1207                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1208                                  #include <time.h>],
1209                                  [ struct timespec ts;
1210                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
1211                                  ac_cv_clock_monotonic=$libs
1212                                  LIBS="$_SAVE_LIBS"
1213                                  break,
1214                                  ac_cv_clock_monotonic=no)
1215                     LIBS="$_SAVE_LIBS"
1216                     CFLAGS="$_SAVE_CFLAGS"
1217                 done])
1218 if test "$ac_cv_clock_monotonic" != "no"; then
1219     HAVE_CLOCK_MONOTONIC=1
1220     REALTIME_LIBS=$ac_cv_clock_monotonic
1221     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1222     AC_SUBST(HAVE_CLOCK_MONOTONIC)
1223     AC_SUBST_LIST(REALTIME_LIBS)
1226 dnl Turn on warnings-as-errors to prevent implicit declaration of
1227 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1228 dnl inadvertently pass even if the function does not really exist.
1229 _SAVE_CFLAGS="$CFLAGS"
1230 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1231 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1232                ac_cv_pthread_cond_timedwait_monotonic_np,
1233                AC_TRY_LINK([#include <pthread.h>],
1234                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1235                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1236                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1237 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1238     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1240 CFLAGS=$_SAVE_CFLAGS
1242 AC_CACHE_CHECK(
1243     [for res_ninit()],
1244     ac_cv_func_res_ninit,
1245     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1246         dnl no need for res_ninit() on NetBSD and OpenBSD
1247         ac_cv_func_res_ninit=no
1248      else
1249         AC_TRY_LINK([
1250             #ifdef linux
1251             #define _BSD_SOURCE 1
1252             #endif
1253             #include <sys/types.h>
1254             #include <netinet/in.h>
1255             #include <arpa/nameser.h>
1256             #include <resolv.h>
1257             ],
1258             [int foo = res_ninit(&_res);],
1259             [ac_cv_func_res_ninit=yes],
1260             [ac_cv_func_res_ninit=no])
1261      fi
1262     ])
1264 if test "$ac_cv_func_res_ninit" = "yes"; then
1265     AC_DEFINE(HAVE_RES_NINIT)
1266 dnl must add the link line we do something as foolish as this... dougt
1267 dnl else
1268 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1269 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1272 AC_LANG_C
1274 dnl **********************
1275 dnl *** va_copy checks ***
1276 AC_CACHE_CHECK([for an implementation of va_copy()],
1277                ac_cv_va_copy,
1278     [AC_TRY_COMPILE([#include <stdarg.h>
1279                      #include <stdlib.h>
1280         void f (int i, ...) {
1281             va_list args1, args2;
1282             va_start (args1, i);
1283             va_copy (args2, args1);
1284             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1285                 exit (1);
1286             va_end (args1); va_end (args2);
1287         }],
1288         [f(0, 42); return 0],
1289         [ac_cv_va_copy=yes],
1290         [ac_cv_va_copy=no]
1291     )]
1293 AC_CACHE_CHECK([whether va_list can be copied by value],
1294                ac_cv_va_val_copy,
1295     [AC_TRY_COMPILE([#include <stdarg.h>
1296                      #include <stdlib.h>
1297         void f (int i, ...) {
1298             va_list args1, args2;
1299             va_start (args1, i);
1300             args2 = args1;
1301             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1302                 exit (1);
1303             va_end (args1); va_end (args2);
1304         }],
1305         [f(0, 42); return 0],
1306         [ac_cv_va_val_copy=yes],
1307         [ac_cv_va_val_copy=no],
1308     )]
1310 if test "x$ac_cv_va_copy" = "xyes"; then
1311     AC_DEFINE(VA_COPY, va_copy)
1312     AC_DEFINE(HAVE_VA_COPY)
1315 if test "x$ac_cv_va_val_copy" = "xno"; then
1316    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1319 dnl ===================================================================
1320 dnl ========================================================
1321 dnl Put your C++ language/feature checks below
1322 dnl ========================================================
1323 AC_LANG_CPLUSPLUS
1325 ARM_ABI_PREFIX=
1326 if test "$GNU_CC"; then
1327   if test "$CPU_ARCH" = "arm" ; then
1328     AC_CACHE_CHECK(for ARM EABI,
1329         ac_cv_gcc_arm_eabi,
1330         [AC_TRY_COMPILE([],
1331                         [
1332 #if defined(__ARM_EABI__)
1333   return 0;
1334 #else
1335 #error Not ARM EABI.
1336 #endif
1337                         ],
1338                         ac_cv_gcc_arm_eabi="yes",
1339                         ac_cv_gcc_arm_eabi="no")])
1340     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1341         HAVE_ARM_EABI=1
1342         ARM_ABI_PREFIX=eabi-
1343     else
1344         ARM_ABI_PREFIX=oabi-
1345     fi
1346   fi
1348   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1351 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1352 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1353 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1354 # linking XUL.
1355 _SAVE_LDFLAGS=$LDFLAGS
1356 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1357 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1358                ac_cv_thread_keyword,
1359                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1360                             [return tlsIsMainThread;],
1361                             ac_cv_thread_keyword=yes,
1362                             ac_cv_thread_keyword=no)])
1363 LDFLAGS=$_SAVE_LDFLAGS
1364 # The custom dynamic linker doesn't support TLS variables
1365 MOZ_TLS=
1366 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1367   # mips builds fail with TLS variables because of a binutils bug.
1368   # See bug 528687
1369   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1370   case "${target}" in
1371     mips*-*)
1372       :
1373       ;;
1374     *-android*|*-linuxandroid*)
1375       :
1376       ;;
1377     *-openbsd*)
1378       :
1379       ;;
1380     *)
1381       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1382       MOZ_TLS=1
1383       ;;
1384   esac
1387 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1388 if test -n "$MOZ_LINKER"; then
1389   if test "$CPU_ARCH" = arm; then
1390     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1391     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1392       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1393       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1394     fi
1395   fi
1397 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1398 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1399 dnl Since the linker only understands the sysv ones, no need to build the
1400 dnl gnu style tables anyways.
1401   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1404 dnl End of C++ language/feature checks
1405 AC_LANG_C
1407 dnl ========================================================
1408 dnl =  Internationalization checks
1409 dnl ========================================================
1411 dnl Internationalization and Locale support is different
1412 dnl on various UNIX platforms.  Checks for specific i18n
1413 dnl features go here.
1415 AC_HAVE_FUNCS(localeconv)
1417 fi # ! SKIP_COMPILER_CHECKS
1419 if test -n "${COMPILE_ENVIRONMENT}"; then
1420   MOZ_CHECK_ALLOCATOR
1423 TARGET_XPCOM_ABI=
1424 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1425     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1426     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1429 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1430 dnl features that Windows actually does support.
1432 if test -n "$SKIP_COMPILER_CHECKS"; then
1433    dnl Windows has malloc.h
1434    AC_DEFINE(MALLOC_H, [<malloc.h>])
1435    AC_DEFINE(HAVE_FORCEINLINE)
1436    AC_DEFINE(HAVE_LOCALECONV)
1437 fi # SKIP_COMPILER_CHECKS
1439 dnl Mozilla specific options
1440 dnl ========================================================
1441 dnl The macros used for command line options
1442 dnl are defined in build/autoconf/altoptions.m4.
1444 dnl ========================================================
1445 dnl =
1446 dnl = Check for external package dependencies
1447 dnl =
1448 dnl ========================================================
1449 MOZ_ARG_HEADER(External Packages)
1451 case "$OS_TARGET" in
1452 WINNT|Darwin|Android)
1453   MOZ_FOLD_LIBS=1
1454   ;;
1456   MOZ_FOLD_LIBS=
1457   ;;
1458 esac
1460 MOZ_CONFIG_NSPR()
1462 dnl ========================================================
1463 dnl system libevent Support
1464 dnl ========================================================
1465 MOZ_ARG_WITH_STRING(system-libevent,
1466 [  --with-system-libevent[=PFX]
1467                           Use system libevent [installed at prefix PFX]],
1468     LIBEVENT_DIR=$withval)
1470 _SAVE_CFLAGS=$CFLAGS
1471 _SAVE_LDFLAGS=$LDFLAGS
1472 _SAVE_LIBS=$LIBS
1473 if test "$LIBEVENT_DIR" = yes; then
1474     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1475         MOZ_SYSTEM_LIBEVENT=1,
1476         LIBEVENT_DIR=/usr)
1478 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1479     MOZ_SYSTEM_LIBEVENT=
1480 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1481     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1482     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1483     MOZ_CHECK_HEADER(event.h,
1484         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1485              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1486          fi],
1487         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1488     AC_CHECK_LIB(event, event_init,
1489                  [MOZ_SYSTEM_LIBEVENT=1
1490                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1491                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1492                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1494 CFLAGS=$_SAVE_CFLAGS
1495 LDFLAGS=$_SAVE_LDFLAGS
1496 LIBS=$_SAVE_LIBS
1498 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1500 dnl ========================================================
1501 dnl = If NSS was not detected in the system,
1502 dnl = use the one in the source tree (mozilla/security/nss)
1503 dnl ========================================================
1505 MOZ_ARG_WITH_BOOL(system-nss,
1506 [  --with-system-nss       Use system installed NSS],
1507     _USE_SYSTEM_NSS=1 )
1509 if test -n "$_USE_SYSTEM_NSS"; then
1510     AM_PATH_NSS(3.48, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1513 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1514 if test -z "$MOZ_SYSTEM_NSS"; then
1515    case "${OS_ARCH}" in
1516         # Only few platforms have been tested with GYP
1517         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1518             ;;
1519         *)
1520             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1521             ;;
1522    esac
1525 dnl system ZLIB support
1526 dnl ========================================================
1527 MOZ_ZLIB_CHECK([1.2.3])
1529 if test -z "$SKIP_LIBRARY_CHECKS"; then
1531 dnl ========================================================
1532 dnl system PNG Support
1533 dnl ========================================================
1534 MOZ_ARG_WITH_STRING(system-png,
1535 [  --with-system-png[=PFX]
1536                           Use system libpng [installed at prefix PFX]],
1537     PNG_DIR=$withval)
1539 _SAVE_CFLAGS=$CFLAGS
1540 _SAVE_LDFLAGS=$LDFLAGS
1541 _SAVE_LIBS=$LIBS
1542 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1543     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1544     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1546 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1547     MOZ_SYSTEM_PNG=
1548 else
1549     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1550                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1551     AC_CHECK_LIB(png, png_get_acTL, ,
1552                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1554 if test "$MOZ_SYSTEM_PNG" = 1; then
1555     AC_TRY_COMPILE([ #include <stdio.h>
1556                      #include <sys/types.h>
1557                      #include <png.h> ],
1558                    [ #if PNG_LIBPNG_VER < $MOZPNG
1559                      #error "Insufficient libpng version ($MOZPNG required)."
1560                      #endif
1561                      #ifndef PNG_UINT_31_MAX
1562                      #error "Insufficient libpng version."
1563                      #endif ],
1564                    MOZ_SYSTEM_PNG=1,
1565                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1567 CFLAGS=$_SAVE_CFLAGS
1568 LDFLAGS=$_SAVE_LDFLAGS
1569 LIBS=$_SAVE_LIBS
1571 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1572     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1573     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1576 fi # SKIP_LIBRARY_CHECKS
1578 dnl ========================================================
1579 dnl =
1580 dnl = Application
1581 dnl =
1582 dnl ========================================================
1584 MOZ_ARG_HEADER(Application)
1586 ENABLE_SYSTEM_EXTENSION_DIRS=1
1587 MOZ_BRANDING_DIRECTORY=
1588 MOZ_OFFICIAL_BRANDING=
1589 MOZ_AUTH_EXTENSION=1
1590 if test "$MOZ_IOS"; then
1591    MOZ_AUTH_EXTENSION=
1593 MOZ_PREF_EXTENSIONS=1
1594 MOZ_SPELLCHECK=1
1595 MOZ_UNIVERSALCHARDET=1
1596 MOZ_XUL=1
1597 MOZ_ZIPWRITER=1
1598 MOZ_NO_SMART_CARDS=
1599 NECKO_COOKIES=1
1600 MOZ_USE_NATIVE_POPUP_WINDOWS=
1601 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1602 MOZ_SANDBOX=1
1603 MOZ_BINARY_EXTENSIONS=
1604 MOZ_DEVTOOLS=server
1606 case "$target_os" in
1607     mingw*)
1608         NS_ENABLE_TSF=1
1609         AC_DEFINE(NS_ENABLE_TSF)
1610         ;;
1611 esac
1613 # Optional Firefox for Android partner distribution directory.
1614 MOZ_ARG_WITH_STRING(android-distribution-directory,
1615 [  --with-android-distribution-directory=dir
1616                           Optional Firefox for Android partner distribution directory.],
1617   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1619 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1620   # A distribution directory must have an assets/distribution directory.
1621   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1622   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1623     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1624                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1625   fi
1627 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1629 dnl ========================================================
1630 dnl = Trademarked Branding
1631 dnl ========================================================
1632 MOZ_ARG_ENABLE_BOOL(official-branding,
1633 [  --enable-official-branding
1634                           Enable Official mozilla.org Branding
1635                           Do not distribute builds with
1636                           --enable-official-branding unless you have
1637                           permission to use trademarks per
1638                           http://www.mozilla.org/foundation/trademarks/ .],
1639     MOZ_OFFICIAL_BRANDING=1,
1640     MOZ_OFFICIAL_BRANDING=)
1642 # Allow the application to influence configure with a confvars.sh script.
1643 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1644 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1645   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1646   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1647 else
1648   AC_MSG_RESULT([no])
1651 # Allow influencing configure with a defines.sh script.
1652 . "${srcdir}/build/defines.sh"
1654 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1655 # set in defines.sh
1656 if test "$BUILDING_RELEASE"; then
1657   # Override value in defines.sh, if any
1658   EARLY_BETA_OR_EARLIER=
1659 elif test "$EARLY_BETA_OR_EARLIER"; then
1660   AC_DEFINE(EARLY_BETA_OR_EARLIER)
1662 AC_SUBST(EARLY_BETA_OR_EARLIER)
1664 if test "$EARLY_BETA_OR_EARLIER"; then
1665     MOZ_NEW_CERT_STORAGE=1
1666     AC_DEFINE(MOZ_NEW_CERT_STORAGE)
1668 AC_SUBST(MOZ_NEW_CERT_STORAGE)
1670 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1671 MOZ_ARG_WITH_STRING(app-name,
1672 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1673 WITH_APP_NAME=$withval,
1676 if test -n "$WITH_APP_NAME" ; then
1677     MOZ_APP_NAME="$WITH_APP_NAME"
1680 MOZ_ARG_WITH_STRING(app-basename,
1681 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1682 WITH_APP_BASENAME=$withval,
1685 if test -n "$WITH_APP_BASENAME" ; then
1686     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1689 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1690 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1691 # MOZ_BUILD_APP.
1692 case "$MOZ_BUILD_APP" in
1693 browser)
1694   AC_DEFINE(MOZ_PHOENIX)
1695   ;;
1696 esac
1698 # Graphene is a desktop runtime for running applications with a HTML UI.
1699 if test -n "$MOZ_GRAPHENE"; then
1700     AC_DEFINE(MOZ_GRAPHENE)
1703 AC_SUBST(MOZ_PHOENIX)
1705 dnl ========================================================
1706 dnl Ensure Android SDK and build-tools versions depending on
1707 dnl mobile target.
1708 dnl ========================================================
1710 case "$MOZ_BUILD_APP" in
1711 mobile/android)
1712     MOZ_ANDROID_SDK
1713     ;;
1714 esac
1716 dnl ========================================================
1717 dnl =
1718 dnl = Toolkit Options
1719 dnl =
1720 dnl ========================================================
1721 MOZ_ARG_HEADER(Toolkit Options)
1723 dnl ========================================================
1724 dnl = Enable the toolkit as needed                         =
1725 dnl ========================================================
1727 case "$MOZ_WIDGET_TOOLKIT" in
1729 cocoa)
1730     LDFLAGS="$LDFLAGS -framework Cocoa"
1731     # Use -Wl as a trick to avoid -framework and framework names from
1732     # being separated by AC_SUBST_LIST.
1733     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'
1734     TK_CFLAGS=""
1735     CFLAGS="$CFLAGS $TK_CFLAGS"
1736     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1737     MOZ_USER_DIR="Mozilla"
1738     MOZ_FS_LAYOUT=bundle
1739     ;;
1741 uikit)
1742     LDFLAGS="$LDFLAGS -framework UIKit"
1743     TK_CFLAGS=""
1744     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'
1745     CFLAGS="$CFLAGS $TK_CFLAGS"
1746     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1747     MOZ_USER_DIR="Mozilla"
1748     MOZ_FS_LAYOUT=bundle
1749     ;;
1751 esac
1753 if test "$OS_TARGET" = Darwin; then
1754     LDFLAGS="$LDFLAGS -lobjc"
1757 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1758 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1759 case "$MOZ_WIDGET_TOOLKIT" in
1760 gtk*)
1761     MOZ_ENABLE_GTK=1
1762     ;;
1763 esac
1765 if test "$COMPILE_ENVIRONMENT"; then
1766   if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1767     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)
1768     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1769     TK_CFLAGS=$MOZ_GTK3_CFLAGS
1770     TK_LIBS=$MOZ_GTK3_LIBS
1771     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1772     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1773     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1774     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1775   fi
1776   if test "$MOZ_ENABLE_GTK"; then
1777     if test "$MOZ_X11"; then
1778       GDK_PACKAGES=gdk-x11-2.0
1779     fi
1780     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1781     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1783     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)
1784     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1785   fi
1786 fi # COMPILE_ENVIRONMENT
1788 AC_SUBST(MOZ_FS_LAYOUT)
1790 dnl ========================================================
1791 dnl = startup-notification support module
1792 dnl ========================================================
1794 if test "$MOZ_ENABLE_GTK"
1795 then
1796     MOZ_ENABLE_STARTUP_NOTIFICATION=
1798     MOZ_ARG_ENABLE_BOOL(startup-notification,
1799     [  --enable-startup-notification
1800                           Enable startup-notification support (default: disabled) ],
1801         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1802         MOZ_ENABLE_STARTUP_NOTIFICATION=)
1803     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1804     then
1805         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1806                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1807         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1808             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1809             then
1810                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1811             fi
1812             MOZ_ENABLE_STARTUP_NOTIFICATION=
1813         ])
1814     fi
1816     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1817         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1818     fi
1820     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1822 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1824 AC_SUBST_LIST(TK_CFLAGS)
1825 AC_SUBST_LIST(TK_LIBS)
1827 dnl ========================================================
1828 dnl =
1829 dnl = Components & Features
1830 dnl =
1831 dnl ========================================================
1832 MOZ_ARG_HEADER(Components and Features)
1834 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1835 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1836   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1837     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1838   else
1839     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1840     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1841   fi
1844 MOZ_ARG_WITH_STRING(branding,
1845 [  --with-branding=dir     Use branding from the specified directory.],
1846     MOZ_BRANDING_DIRECTORY=$withval)
1848 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1849 if test -z "$REAL_BRANDING_DIRECTORY"; then
1850   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1853 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1854   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1855 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1856   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1859 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1861 dnl ========================================================
1862 dnl = Distribution ID
1863 dnl ========================================================
1864 MOZ_ARG_WITH_STRING(distribution-id,
1865 [  --with-distribution-id=ID
1866                           Set distribution-specific id (default=org.mozilla)],
1867 [ val=`echo $withval`
1868     MOZ_DISTRIBUTION_ID="$val"])
1870 if test -z "$MOZ_DISTRIBUTION_ID"; then
1871    MOZ_DISTRIBUTION_ID="org.mozilla"
1874 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1875 AC_SUBST(MOZ_DISTRIBUTION_ID)
1877 dnl ========================================================
1878 dnl = libproxy support
1879 dnl ========================================================
1881 if test "$MOZ_ENABLE_GTK"
1882 then
1883     MOZ_ENABLE_LIBPROXY=
1885     MOZ_ARG_ENABLE_BOOL(libproxy,
1886     [  --enable-libproxy         Enable libproxy support ],
1887     MOZ_ENABLE_LIBPROXY=1,
1888     MOZ_ENABLE_LIBPROXY=)
1890     if test "$MOZ_ENABLE_LIBPROXY"
1891     then
1892         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1893         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1894     fi
1896 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1898 dnl ========================================================
1899 dnl = dbus support
1900 dnl ========================================================
1902 if test "$MOZ_ENABLE_GTK"
1903 then
1904     MOZ_ENABLE_DBUS=1
1906     MOZ_ARG_DISABLE_BOOL(dbus,
1907     [  --disable-dbus          Disable dbus support ],
1908         MOZ_ENABLE_DBUS=,
1909         MOZ_ENABLE_DBUS=1)
1911     if test "$MOZ_ENABLE_DBUS"
1912     then
1913         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1914         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1915         AC_DEFINE(MOZ_ENABLE_DBUS)
1916     fi
1918 AC_SUBST(MOZ_ENABLE_DBUS)
1920 dnl =========================================================
1921 dnl = Whether to exclude hyphenations files in the build
1922 dnl =========================================================
1923 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1924     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1927 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1928                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1929                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1931 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1933 if test -n "$MOZ_WEBRTC"; then
1934     if test -n "$MOZ_X11"; then
1935       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1936     fi
1939 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1941 dnl ========================================================
1942 dnl = Apple platform decoder support
1943 dnl ========================================================
1944 if test "$COMPILE_ENVIRONMENT"; then
1945 if test -n "$MOZ_APPLEMEDIA"; then
1946   # hack in frameworks for fmp4 - see bug 1029974
1947   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1948   LDFLAGS="$LDFLAGS -framework AudioToolbox"
1949   dnl Verify CoreMedia is available.
1950   AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1951     [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1953 fi # COMPILE_ENVIRONMENT
1955 dnl ========================================================
1956 dnl = Handle dependent MEDIA defines
1957 dnl ========================================================
1959 MOZ_WEBM_ENCODER=1
1960 AC_DEFINE(MOZ_WEBM_ENCODER)
1961 AC_SUBST(MOZ_WEBM_ENCODER)
1963 dnl ========================================================
1964 dnl NegotiateAuth
1965 dnl ========================================================
1967 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1968 [  --disable-negotiateauth Disable GSS-API negotiation ],
1969     MOZ_AUTH_EXTENSION=,
1970     MOZ_AUTH_EXTENSION=1 )
1972 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1973    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1976 dnl ========================================================
1977 dnl Pref extensions (autoconfig)
1978 dnl ========================================================
1979 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1980 [  --disable-pref-extensions
1981                           Disable pref extensions such as autoconfig],
1982   MOZ_PREF_EXTENSIONS=,
1983   MOZ_PREF_EXTENSIONS=1 )
1985 dnl ========================================================
1986 dnl Searching of system directories for extensions.
1987 dnl Note: this switch is meant to be used for test builds
1988 dnl whose behavior should not depend on what happens to be
1989 dnl installed on the local machine.
1990 dnl ========================================================
1991 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1992 [  --disable-system-extension-dirs
1993                           Disable searching system- and account-global
1994                           directories for extensions of any kind; use
1995                           only profile-specific extension directories],
1996   ENABLE_SYSTEM_EXTENSION_DIRS=,
1997   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1998 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1999   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2002 dnl ========================================================
2003 dnl = Universalchardet
2004 dnl ========================================================
2005 MOZ_ARG_DISABLE_BOOL(universalchardet,
2006 [  --disable-universalchardet
2007                           Disable universal encoding detection],
2008   MOZ_UNIVERSALCHARDET=,
2009   MOZ_UNIVERSALCHARDET=1 )
2011 dnl ========================================================
2012 dnl Gamepad support
2013 dnl ========================================================
2015 if test "$COMPILE_ENVIRONMENT" ; then
2017 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2018 if test "$OS_TARGET" = "Linux"; then
2019     MOZ_CHECK_HEADER([linux/joystick.h])
2020     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2021       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2022     fi
2025 fi # COMPILE_ENVIRONMENT
2028 dnl ========================================================
2029 dnl = Breakpad crash reporting (on by default on supported platforms)
2030 dnl ========================================================
2032 case $target in
2033 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
2034   MOZ_CRASHREPORTER=1
2035   ;;
2036 i?86-apple-darwin*|x86_64-apple-darwin*)
2037   if test -z "$MOZ_IOS"; then
2038     MOZ_CRASHREPORTER=1
2039   fi
2040   ;;
2041 *-android*|*-linuxandroid*)
2042   dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2043   dnl be before Linux condition
2044   MOZ_CRASHREPORTER=1
2045   ;;
2046 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2047   if test "$MOZ_ENABLE_GTK"; then
2048     MOZ_CRASHREPORTER=1
2049   fi
2050   ;;
2051 esac
2053 MOZ_ARG_DISABLE_BOOL(crashreporter,
2054 [  --disable-crashreporter Disable breakpad crash reporting],
2055     [MOZ_CRASHREPORTER=],
2056     [MOZ_CRASHREPORTER=F # Force enable breakpad])
2058 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
2059   if test "$MOZ_CRASHREPORTER" = F; then
2060     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2061   fi
2062   MOZ_CRASHREPORTER=
2065 if test -n "$MOZ_CRASHREPORTER"; then
2066    AC_DEFINE(MOZ_CRASHREPORTER)
2068   if test "$OS_TARGET" = "Linux" && \
2069     test -z "$SKIP_LIBRARY_CHECKS"; then
2070     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2071   fi
2073   if test "$OS_ARCH" = "WINNT"; then
2074     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2075       MOZ_CRASHREPORTER_INJECTOR=1
2076       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2077     fi
2078   fi
2081 dnl ========================================================
2082 dnl = Enable compilation of specific extension modules
2083 dnl ========================================================
2085 MOZ_ARG_ENABLE_STRING(extensions,
2086 [  --enable-extensions     Enable extensions],
2087 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2088     if test "$option" = "yes" -o "$option" = "all"; then
2089         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2090     elif test "$option" = "no" -o "$option" = "none"; then
2091         MOZ_EXTENSIONS=""
2092     elif test "$option" = "default"; then
2093         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2094     elif test `echo "$option" | grep -c \^-` != 0; then
2095         option=`echo $option | sed 's/^-//'`
2096         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2097     else
2098         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2099     fi
2100 done],
2101     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2103 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2104 dnl when trying to build a nonexistent extension.
2105 for extension in $MOZ_EXTENSIONS; do
2106     if test ! -d "${srcdir}/extensions/${extension}"; then
2107         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2108     fi
2109 done
2111 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2112   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2115 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2116 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2117 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2118    MOZ_ENABLE_CAIRO_FT=1
2119    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2120    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2121    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2124 AC_CHECK_PROGS(WGET, wget, "")
2125 AC_SUBST(WGET)
2127 dnl ========================================================
2128 dnl Updater
2129 dnl ========================================================
2131 if test "$MOZ_IOS"; then
2132   MOZ_UPDATER=
2135 MOZ_ARG_DISABLE_BOOL(updater,
2136 [  --disable-updater       Disable building of updater],
2137     MOZ_UPDATER=,
2138     MOZ_UPDATER=1 )
2140 if test -n "$MOZ_UPDATER"; then
2141     AC_DEFINE(MOZ_UPDATER)
2144 dnl ========================================================
2145 dnl parental controls (for Windows Vista)
2146 dnl ========================================================
2147 MOZ_ARG_DISABLE_BOOL(parental-controls,
2148 [  --disable-parental-controls
2149                           Do not build parental controls],
2150    MOZ_DISABLE_PARENTAL_CONTROLS=1,
2151    MOZ_DISABLE_PARENTAL_CONTROLS=)
2152 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2153     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2156 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2158 dnl ========================================================
2159 dnl = Disable smartcard support
2160 dnl ========================================================
2161 if test -n "$MOZ_NO_SMART_CARDS"; then
2162     AC_DEFINE(MOZ_NO_SMART_CARDS)
2164 AC_SUBST(MOZ_NO_SMART_CARDS)
2166 dnl ========================================================
2167 dnl = Sandboxing support
2168 dnl ========================================================
2169 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2170     # Bug 1182565: TSan conflicts with sandboxing on Linux.
2171     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2172     case $OS_TARGET in
2173     Linux|Android)
2174         MOZ_SANDBOX=
2175         ;;
2176     esac
2179 MOZ_ARG_DISABLE_BOOL(sandbox,
2180 [  --disable-sandbox        Disable sandboxing support],
2181     MOZ_SANDBOX=,
2182     MOZ_SANDBOX=1)
2184 case "$OS_TARGET" in
2185 WINNT|Darwin|OpenBSD)
2187 Linux)
2188     case $CPU_ARCH in
2189         x86_64|x86)
2190         ;;
2191         # Linux sandbox is only available on x86 and x86_64.
2192         *)
2193             MOZ_SANDBOX=
2194         ;;
2195     esac
2196     ;;
2198     # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2199     MOZ_SANDBOX=
2201 esac
2203 if test -n "$MOZ_SANDBOX"; then
2204     AC_DEFINE(MOZ_SANDBOX)
2207 AC_SUBST(MOZ_SANDBOX)
2210 dnl ========================================================
2211 dnl =
2212 dnl = Module specific options
2213 dnl =
2214 dnl ========================================================
2215 MOZ_ARG_HEADER(Individual module options)
2217 dnl ========================================================
2218 dnl Check for sqlite
2219 dnl ========================================================
2221 MOZ_SYSTEM_SQLITE=
2222 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2223 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
2224 MOZ_SYSTEM_SQLITE=1,
2225 MOZ_SYSTEM_SQLITE= )
2227 if test -n "$MOZ_SYSTEM_SQLITE"
2228 then
2229     dnl ============================
2230     dnl === SQLite Version check ===
2231     dnl ============================
2232     dnl Check to see if the system SQLite package is new enough.
2233     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2234 else
2235     dnl ==============================
2236     dnl === SQLite fdatasync check ===
2237     dnl ==============================
2238     dnl Check to see if fdatasync is available
2239     AC_CHECK_FUNC(fdatasync)
2242 if test -n "$MOZ_SYSTEM_SQLITE"; then
2243     AC_DEFINE(MOZ_SYSTEM_SQLITE)
2245 AC_SUBST(MOZ_SYSTEM_SQLITE)
2247 dnl ========================================================
2248 dnl = Disable zipwriter
2249 dnl ========================================================
2250 MOZ_ARG_DISABLE_BOOL(zipwriter,
2251 [  --disable-zipwriter     Disable zipwriter component],
2252     MOZ_ZIPWRITER=,
2253     MOZ_ZIPWRITER=1 )
2254 AC_SUBST(MOZ_ZIPWRITER)
2256 dnl ========================================================
2257 dnl =
2258 dnl = Feature options that require extra sources to be pulled
2259 dnl =
2260 dnl ========================================================
2261 dnl MOZ_ARG_HEADER(Features that require extra sources)
2263 dnl ========================================================
2264 dnl =
2265 dnl = Runtime debugging and Optimization Options
2266 dnl =
2267 dnl ========================================================
2268 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2270 dnl ========================================================
2271 dnl enable mobile optimizations
2272 dnl ========================================================
2273 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2274 [  --enable-mobile-optimize
2275                           Enable mobile optimizations],
2276     MOZ_GFX_OPTIMIZE_MOBILE=1)
2278 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2280 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2281     # We ignore paint will resample on mobile for performance.
2282     # We may want to revisit this later.
2283     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2285     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2286     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2289 dnl ========================================================
2290 dnl = Enable code optimization. ON by default.
2291 dnl ========================================================
2293 # Use value from moz.configure if one is defined. Else use our computed
2294 # value.
2295 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2296     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2299 if test "$COMPILE_ENVIRONMENT"; then
2300 if test -n "$MOZ_OPTIMIZE"; then
2301     AC_MSG_CHECKING([for valid C compiler optimization flags])
2302     _SAVE_CFLAGS=$CFLAGS
2303     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2304     AC_TRY_COMPILE([#include <stdio.h>],
2305         [printf("Hello World\n");],
2306         _results=yes,
2307         _results=no)
2308     AC_MSG_RESULT([$_results])
2309     if test "$_results" = "no"; then
2310         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2311     fi
2312     CFLAGS=$_SAVE_CFLAGS
2313     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2314         # When using llvm-based LTO, non numeric optimization levels are
2315         # not supported by the linker, so force the linker to use -O2 (
2316         # which doesn't influence the level compilation units are actually
2317         # compiled at).
2318         case " $MOZ_OPTIMIZE_FLAGS " in
2319         *\ -Os\ *|*\ -Oz\ *)
2320             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2321             ;;
2322         esac
2323     fi
2325 fi # COMPILE_ENVIRONMENT
2327 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2328 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2329 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2331 dnl ========================================================
2332 dnl = Enable runtime logging
2333 dnl ========================================================
2334 AC_DEFINE(MOZ_LOGGING)
2335 AC_DEFINE(FORCE_PR_LOG)
2337 dnl ========================================================
2338 dnl = This will enable logging of addref, release, ctor, dtor.
2339 dnl ========================================================
2340 _ENABLE_LOGREFCNT=42
2341 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2342 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
2343     _ENABLE_LOGREFCNT=1,
2344     _ENABLE_LOGREFCNT= )
2345 if test "$_ENABLE_LOGREFCNT" = "1"; then
2346     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2347 elif test -z "$_ENABLE_LOGREFCNT"; then
2348     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2351 dnl ========================================================
2352 dnl moz_dump_painting
2353 dnl ========================================================
2354 MOZ_ARG_ENABLE_BOOL(dump-painting,
2355 [  --enable-dump-painting          Enable paint debugging.],
2356     MOZ_DUMP_PAINTING=1,
2357     MOZ_DUMP_PAINTING= )
2358 if test -n "$MOZ_DUMP_PAINTING"; then
2359     AC_DEFINE(MOZ_DUMP_PAINTING)
2360     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2362 if test -n "$MOZ_DEBUG"; then
2363     AC_DEFINE(MOZ_DUMP_PAINTING)
2366 case "${OS_TARGET}" in
2367 Android|WINNT|Darwin)
2368   MOZ_GLUE_IN_PROGRAM=
2369   ;;
2371   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2372   MOZ_GLUE_IN_PROGRAM=1
2373   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2374   ;;
2375 esac
2377 dnl ========================================================
2378 dnl = Jemalloc build setup
2379 dnl ========================================================
2380 if test -z "$MOZ_MEMORY"; then
2381   case "${target}" in
2382     *-mingw*)
2383       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2384         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.])
2385       fi
2386       ;;
2387   esac
2388 else
2389   dnl The generic feature tests that determine how to compute ncpus are long and
2390   dnl complicated.  Therefore, simply define special cpp variables for the
2391   dnl platforms we have special knowledge of.
2392   case "${target}" in
2393   *-mingw*)
2394     export MOZ_NO_DEBUG_RTL=1
2395     ;;
2396   esac
2397 fi # MOZ_MEMORY
2398 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2400 dnl ========================================================
2401 dnl = Enable using the clang plugin to build
2402 dnl ========================================================
2404 if test -n "$COMPILE_ENVIRONMENT"; then
2405 MOZ_CONFIG_CLANG_PLUGIN
2406 fi # COMPILE_ENVIRONMENT
2408 dnl ========================================================
2409 dnl = Enable stripping of libs & executables
2410 dnl ========================================================
2411 MOZ_ARG_ENABLE_BOOL(strip,
2412 [  --enable-strip          Enable stripping of libs & executables ],
2413     ENABLE_STRIP=1,
2414     ENABLE_STRIP= )
2416 dnl ========================================================
2417 dnl = Enable stripping of libs & executables when packaging
2418 dnl ========================================================
2419 MOZ_ARG_ENABLE_BOOL(install-strip,
2420 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
2421     PKG_SKIP_STRIP= ,
2422     PKG_SKIP_STRIP=1)
2424 dnl ========================================================
2425 dnl = frontend JS debug mode
2426 dnl ========================================================
2428 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2429 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
2430    DEBUG_JS_MODULES=1,
2431    DEBUG_JS_MODULES=)
2433 AC_SUBST(DEBUG_JS_MODULES)
2435 dnl ========================================================
2436 dnl =
2437 dnl = Profiling and Instrumenting
2438 dnl =
2439 dnl ========================================================
2440 MOZ_ARG_HEADER(Profiling and Instrumenting)
2442 dnl ========================================================
2443 dnl = Offer a way to disable the startup cache
2444 dnl ========================================================
2446 MOZ_ARG_DISABLE_BOOL(startupcache,
2447 [  --disable-startupcache          Disable startup cache ],
2448     MOZ_DISABLE_STARTUPCACHE=1,
2449     MOZ_DISABLE_STARTUPCACHE=)
2451 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2452   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2454 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2456 dnl ========================================================
2457 dnl = Support for demangling undefined symbols
2458 dnl ========================================================
2459 if test -z "$SKIP_LIBRARY_CHECKS"; then
2460     AC_LANG_SAVE
2461     AC_LANG_CPLUSPLUS
2462     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2463     AC_LANG_RESTORE
2466 # Demangle only for debug or DMD builds
2467 MOZ_DEMANGLE_SYMBOLS=
2468 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2469     MOZ_DEMANGLE_SYMBOLS=1
2470     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2472 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2474 dnl ========================================================
2475 dnl = Support for gcc stack unwinding (from gcc 3.3)
2476 dnl ========================================================
2477 if test -z "$SKIP_LIBRARY_CHECKS"; then
2478     AC_LANG_SAVE
2479     AC_LANG_CPLUSPLUS
2480     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2481     AC_LANG_RESTORE
2484 dnl ========================================================
2485 dnl JIT observers
2486 dnl ========================================================
2488 MOZ_ARG_WITH_STRING(jitreport-granularity,
2489 [  --jitreport-granularity=N
2490                            Default granularity at which to report JIT code
2491                            to external tools
2492                              0 - no info
2493                              1 - code ranges for whole functions only
2494                              2 - per-line information
2495                              3 - per-op information],
2496   JITREPORT_GRANULARITY=$withval,
2497   JITREPORT_GRANULARITY=3)
2499 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2501 dnl ========================================================
2502 dnl =
2503 dnl = Misc. Options
2504 dnl =
2505 dnl ========================================================
2506 MOZ_ARG_HEADER(Misc. Options)
2508 dnl ========================================================
2509 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2510 dnl ========================================================
2511 MOZ_ARG_WITH_STRING(user-appdir,
2512 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
2513 [ val=`echo $withval`
2514 if echo "$val" | grep "\/" >/dev/null; then
2515     AC_MSG_ERROR("Homedir must be single relative path.")
2516 else
2517     MOZ_USER_DIR="$val"
2518 fi])
2520 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2522 if test -z "$SKIP_COMPILER_CHECKS"; then
2523 dnl ========================================================
2524 dnl =
2525 dnl = Compiler Options
2526 dnl =
2527 dnl ========================================================
2528 MOZ_ARG_HEADER(Compiler Options)
2530 dnl ========================================================
2531 dnl Check for gcc -pipe support
2532 dnl ========================================================
2533 AC_MSG_CHECKING([for -pipe support])
2534 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2535     dnl Any gcc that supports firefox supports -pipe.
2536     CFLAGS="$CFLAGS -pipe"
2537     CXXFLAGS="$CXXFLAGS -pipe"
2538     AC_MSG_RESULT([yes])
2539 else
2540     AC_MSG_RESULT([no])
2543 fi # ! SKIP_COMPILER_CHECKS
2545 AC_LANG_C
2547 if test "$COMPILE_ENVIRONMENT"; then
2548 MOZ_EXPAND_LIBS
2549 fi # COMPILE_ENVIRONMENT
2551 dnl ========================================================
2552 dnl =
2553 dnl = Static Build Options
2554 dnl =
2555 dnl ========================================================
2556 MOZ_ARG_HEADER(Static build options)
2558 if test -z "$MOZ_SYSTEM_ZLIB"; then
2559 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2560   ZLIB_IN_MOZGLUE=1
2561   AC_DEFINE(ZLIB_IN_MOZGLUE)
2565 AC_SUBST(ZLIB_IN_MOZGLUE)
2567 dnl ========================================================
2568 dnl =
2569 dnl = Standalone module options
2570 dnl =
2571 dnl ========================================================
2572 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2574 dnl Check for GLib.
2575 dnl ========================================================
2577 if test -z "$SKIP_PATH_CHECKS"; then
2578 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2579     if test "$MOZ_ENABLE_GTK" ; then
2580         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2581     fi
2585 if test -z "${GLIB_GMODULE_LIBS}" \
2586    -a -n "${GLIB_CONFIG}"\
2587     -a "${GLIB_CONFIG}" != no\
2588 ; then
2589     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2592 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2594 if test "$USE_FC_FREETYPE"; then
2595     if test "$COMPILE_ENVIRONMENT"; then
2596         dnl ========================================================
2597         dnl = Check for freetype2 functionality
2598         dnl ========================================================
2599         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2600             _SAVE_LIBS="$LIBS"
2601             _SAVE_CFLAGS="$CFLAGS"
2602             LIBS="$LIBS $FT2_LIBS"
2603             CFLAGS="$CFLAGS $FT2_CFLAGS"
2605             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2606                 ac_cv_member_FT_Bitmap_Size_y_ppem,
2607                 [AC_TRY_COMPILE([#include <ft2build.h>
2608                                  #include FT_FREETYPE_H],
2609                                 [FT_Bitmap_Size s;
2610                                  if (sizeof s.y_ppem) return 0;
2611                                  return 1],
2612                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2613                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2614             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2615                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2616             else
2617                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2618             fi
2619             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2620                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2621                                [FT_Bitmap_Size structure includes y_ppem field])
2623             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2625             LIBS="$_SAVE_LIBS"
2626             CFLAGS="$_SAVE_CFLAGS"
2627         fi
2629         _SAVE_CPPFLAGS="$CPPFLAGS"
2630         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2631         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2632             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2633         CPPFLAGS="$_SAVE_CPPFLAGS"
2634     fi
2637 dnl ========================================================
2638 dnl Check if we need the 32-bit Linux SSE2 error dialog
2639 dnl ========================================================
2641 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2643 dnl ========================================================
2644 dnl Check for pixman and cairo
2645 dnl ========================================================
2647 MOZ_TREE_CAIRO=1
2648 MOZ_ARG_ENABLE_BOOL(system-cairo,
2649 [ --enable-system-cairo  Obsolete: do not use this option],
2650 AC_MSG_ERROR(--enable-system-cairo is not supported),
2651 MOZ_TREE_CAIRO=1 )
2653 MOZ_TREE_PIXMAN=1
2654 MOZ_ARG_ENABLE_BOOL(system-pixman,
2655 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2656 MOZ_TREE_PIXMAN=,
2657 MOZ_TREE_PIXMAN=force,
2658 MOZ_TREE_PIXMAN=1 )
2660 if test "$MOZ_TREE_PIXMAN"; then
2661     AC_DEFINE(MOZ_TREE_PIXMAN)
2662 else
2663     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2666 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2667 AC_DEFINE(MOZ_TREE_CAIRO)
2669 if test "$OS_ARCH" = "WINNT"; then
2670     # For now we assume that we will have a uint64_t available through
2671     # one of the above headers or mozstdint.h.
2672     AC_DEFINE(HAVE_UINT64_T)
2675 # Define macros for cairo-features.h
2676 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2677 if test "$MOZ_X11"; then
2678     XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2679     XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2680     PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2682 if test "$_HAVE_FREETYPE2"; then
2683     FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2684     MOZ_ENABLE_CAIRO_FT=1
2685     CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2688 case "$MOZ_WIDGET_TOOLKIT" in
2689   cocoa | uikit)
2690     QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2691     QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2692     QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2693     ;;
2694   windows)
2695     WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2696     WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2697     WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2699     if test "$COMPILE_ENVIRONMENT"; then
2700       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2701     fi
2702     ;;
2703 esac
2704 if test "$USE_FC_FREETYPE"; then
2705     FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2707 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2708 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2710 AC_SUBST(PS_SURFACE_FEATURE)
2711 AC_SUBST(SVG_SURFACE_FEATURE)
2712 AC_SUBST(XLIB_SURFACE_FEATURE)
2713 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2714 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2715 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2716 AC_SUBST(WIN32_SURFACE_FEATURE)
2717 AC_SUBST(OS2_SURFACE_FEATURE)
2718 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2719 AC_SUBST(FT_FONT_FEATURE)
2720 AC_SUBST(FC_FONT_FEATURE)
2721 AC_SUBST(WIN32_FONT_FEATURE)
2722 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2723 AC_SUBST(QUARTZ_FONT_FEATURE)
2724 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2725 AC_SUBST(QT_SURFACE_FEATURE)
2726 AC_SUBST(TEE_SURFACE_FEATURE)
2728 if test "$MOZ_X11"; then
2729     MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2732 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2734 case "$MOZ_WIDGET_TOOLKIT" in
2735 android)
2736     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2737     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2738     ;;
2739 esac
2741 AC_SUBST(MOZ_TREE_CAIRO)
2742 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2743 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2744 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2745 AC_SUBST(MOZ_TREE_PIXMAN)
2747 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2748 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2749 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2750 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2752 dnl ========================================================
2753 dnl disable xul
2754 dnl ========================================================
2755 MOZ_ARG_DISABLE_BOOL(xul,
2756 [  --disable-xul           Disable XUL],
2757     MOZ_XUL= )
2758 if test "$MOZ_XUL"; then
2759   AC_DEFINE(MOZ_XUL)
2760 else
2761   dnl remove extensions that require XUL
2762   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2765 AC_SUBST(MOZ_XUL)
2767 dnl ========================================================
2768 dnl necko configuration options
2769 dnl ========================================================
2772 dnl option to disable necko's wifi scanner
2775 if test "$MOZ_WIDGET_TOOLKIT"; then
2777   case "$OS_TARGET" in
2778     Darwin)
2779       if test -z "$MOZ_IOS"; then
2780         NECKO_WIFI=1
2781       fi
2782       ;;
2783     DragonFly|FreeBSD|WINNT)
2784       NECKO_WIFI=1
2785       ;;
2786     Linux)
2787       NECKO_WIFI=1
2788       NECKO_WIFI_DBUS=1
2789       ;;
2790   esac
2794 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2795 [  --disable-necko-wifi    Disable necko wifi scanner],
2796     NECKO_WIFI=,
2797     NECKO_WIFI=1)
2799 if test "$NECKO_WIFI"; then
2800   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2801     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2802   fi
2803   AC_DEFINE(NECKO_WIFI)
2804   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2806 AC_SUBST(NECKO_WIFI)
2807 AC_SUBST(NECKO_WIFI_DBUS)
2810 dnl option to disable cookies
2812 MOZ_ARG_DISABLE_BOOL(cookies,
2813 [  --disable-cookies       Disable cookie support],
2814     NECKO_COOKIES=,
2815     NECKO_COOKIES=1)
2816 AC_SUBST(NECKO_COOKIES)
2817 if test "$NECKO_COOKIES"; then
2818     AC_DEFINE(NECKO_COOKIES)
2819     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2822 dnl ========================================================
2823 dnl =
2824 dnl = Maintainer debug option (no --enable equivalent)
2825 dnl =
2826 dnl ========================================================
2828 AC_SUBST(NM)
2829 AC_SUBST_LIST(ASFLAGS)
2830 AC_SUBST(RCFLAGS)
2831 AC_SUBST(IMPLIB)
2832 AC_SUBST(FILTER)
2833 AC_SUBST(MOZ_AUTH_EXTENSION)
2834 AC_SUBST(MOZ_PREF_EXTENSIONS)
2835 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2836 AC_SUBST_LIST(WARNINGS_CFLAGS)
2837 AC_SUBST_SET(MOZ_EXTENSIONS)
2839 AC_SUBST(MOZ_UNIVERSALCHARDET)
2840 AC_SUBST(MOZ_SPELLCHECK)
2841 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2842 AC_SUBST(MOZ_CRASHREPORTER)
2843 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2844 AC_SUBST(MOZ_STUB_INSTALLER)
2845 AC_SUBST(MOZ_UPDATER)
2847 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2848 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2849 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2850 AC_SUBST(ENABLE_STRIP)
2851 AC_SUBST(PKG_SKIP_STRIP)
2852 AC_SUBST(STRIP_FLAGS)
2853 AC_SUBST(INCREMENTAL_LINKER)
2855 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2857 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2858 AC_SUBST(MOZ_LINKER_EXTRACT)
2860 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2861   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2864 AC_SUBST(MOZ_REQUIRE_SIGNING)
2865 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2866   AC_DEFINE(MOZ_REQUIRE_SIGNING)
2869 dnl ========================================================
2870 dnl = Mac bundle name prefix
2871 dnl ========================================================
2872 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2873 [  --with-macbundlename-prefix=prefix
2874                           Prefix for MOZ_MACBUNDLE_NAME],
2875 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2877 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2878 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2879   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2882 if test "$MOZ_DEBUG"; then
2883   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2884 else
2885   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2887 AC_SUBST(MOZ_MACBUNDLE_NAME)
2889 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2890 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2891 # Otherwise, use MOZ_APP_DISPLAYNAME
2892 if test -z "$MOZ_MACBUNDLE_ID"; then
2893    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2895 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2896 if test "$MOZ_DEBUG"; then
2897   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2900 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2901 AC_SUBST(MOZ_MACBUNDLE_ID)
2903 dnl ========================================================
2904 dnl = Child Process Name for IPC
2905 dnl ========================================================
2906 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2907   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2908 else
2909   # We want to let Android unpack the file at install time, but it only does
2910   # so if the file is named libsomething.so. The lib/ path is also required
2911   # because the unpacked file will be under the lib/ subdirectory and will
2912   # need to be executed from that path.
2913   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2915 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2916 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2918 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2919 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2920 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2922 # The following variables are available to branding and application
2923 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2924 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2925 # impacts profile location and user-visible fields.
2926 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2927 # versions of a given application (e.g. Aurora and Firefox both use
2928 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2929 # for application.ini's "Name" field, which controls profile location in
2930 # the absence of a "Profile" field (see below), and various system
2931 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2932 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2933 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2934 # builds (e.g. Aurora for Firefox).
2935 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2936 # defaults to a lowercase form of MOZ_APP_BASENAME.
2937 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2938 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2939 # - MOZ_APP_PROFILE: When set, used for application.ini's
2940 # "Profile" field, which controls profile location.
2941 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2942 # crash reporter server url.
2943 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
2944 # the main application is set to the value of this variable.  If not
2945 # set, it falls back to a Mozilla-specific value derived from the
2946 # build ID.
2947 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
2948 # packages produced.
2949 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used.  GCM
2950 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
2951 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
2952 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2954 # The following environment variables used to have an effect, but don't anymore:
2955 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2956 # the contents from the version.txt file in the application directory, or
2957 # browser/config/version.txt if there isn't one.
2958 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2959 # in the "About" window. This was replaced with the contents from the
2960 # version_display.txt or version.txt in the application directory, or
2961 # browser/config/version_display.txt.
2963 if test -z "$MOZ_APP_NAME"; then
2964    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2967 if test -z "$MOZ_APP_REMOTINGNAME"; then
2968    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2971 if test -z "$ANDROID_PACKAGE_NAME" ; then
2972    # When we got rid of the Aurora channel we decided to replace the old
2973    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2974    # by all mozilla-central based branches we make this the new "default"
2975    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2976    # in their mozconfig, so they will never get this. If there are ever
2977    # non-Fennec builds for Android, they will fall into the else block
2978    # and use their own default name.
2979    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2980    # background on this.
2981    if test "$MOZ_APP_NAME" = "fennec"; then
2982       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2983    else
2984       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2985    fi
2988 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
2989 # the public with specific common shared IDs and we need to keep them
2990 # consistent forever.  The specific common values are set by per-channel
2991 # branding; all other channels use a generic sharedID, set below.
2992 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
2993    MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
2996 # For extensions and langpacks, we require a max version that is compatible
2997 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2998 # 24.0a1 and 24.0a2 aren't affected
2999 # 24.0 becomes 24.*
3000 # 24.1.1 becomes 24.*
3001 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3002 if test -z "$IS_ALPHA"; then
3003   changequote(,)
3004   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3005     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3006   else
3007     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3008   fi
3009   changequote([,])
3010 else
3011   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3014 AC_SUBST(MOZ_APP_NAME)
3015 AC_SUBST(MOZ_APP_REMOTINGNAME)
3016 AC_SUBST(MOZ_APP_DISPLAYNAME)
3017 AC_SUBST(MOZ_APP_BASENAME)
3018 AC_SUBST(MOZ_APP_VENDOR)
3019 AC_SUBST(MOZ_APP_PROFILE)
3020 AC_SUBST(MOZ_APP_ID)
3021 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3022 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3023 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3024 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3025 AC_SUBST(MAR_CHANNEL_ID)
3026 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3027 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3028 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3029 AC_SUBST(MOZ_APP_UA_NAME)
3030 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3031 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3032 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3034 AC_SUBST(MOZ_APP_MAXVERSION)
3035 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3036 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3037   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3040 AC_SUBST(MOZ_PKG_SPECIAL)
3041 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3043 if test "$MOZILLA_OFFICIAL"; then
3044     # Build revisions should always be present in official builds
3045     MOZ_INCLUDE_SOURCE_INFO=1
3048 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3049 # explicitly set the repository and changeset information in.
3050 AC_SUBST(MOZ_SOURCE_REPO)
3051 AC_SUBST(MOZ_SOURCE_CHANGESET)
3052 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3054 dnl If we have any service that uploads data (and requires data submission
3055 dnl policy alert), set MOZ_DATA_REPORTING.
3056 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3057 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"  || test -n "$MOZ_NORMANDY"; then
3058   MOZ_DATA_REPORTING=1
3059   AC_DEFINE(MOZ_DATA_REPORTING)
3060   AC_SUBST(MOZ_DATA_REPORTING)
3063 dnl win32 options
3064 AC_SUBST(WIN32_REDIST_DIR)
3065 AC_SUBST(WIN_UCRT_REDIST_DIR)
3067 dnl ========================================================
3068 dnl ICU Support
3069 dnl ========================================================
3071 _INTL_API=yes
3073 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3074     USE_ICU=1
3077 MOZ_CONFIG_ICU()
3079 dnl Echo the CFLAGS to remove extra whitespace.
3080 CFLAGS=`echo \
3081     $_COMPILATION_CFLAGS \
3082     $CFLAGS`
3084 CXXFLAGS=`echo \
3085     $_WARNINGS_CXXFLAGS \
3086     $_COMPILATION_CXXFLAGS \
3087     $CXXFLAGS`
3089 COMPILE_CFLAGS=`echo \
3090     $_DEFINES_CFLAGS \
3091     $COMPILE_CFLAGS`
3093 COMPILE_CXXFLAGS=`echo \
3094     $_DEFINES_CXXFLAGS \
3095     $COMPILE_CXXFLAGS`
3097 HOST_CFLAGS=`echo \
3098     $_WARNINGS_HOST_CFLAGS \
3099     $_COMPILATION_HOST_CFLAGS \
3100     $HOST_CFLAGS`
3102 HOST_CXXFLAGS=`echo \
3103     $_WARNINGS_HOST_CXXFLAGS \
3104     $_COMPILATION_HOST_CXXFLAGS \
3105     $HOST_CXXFLAGS`
3107 AC_SUBST(MOZ_SYSTEM_PNG)
3109 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3110 AC_SUBST_LIST(MOZ_PNG_LIBS)
3112 AC_SUBST(MOZ_SYSTEM_NSPR)
3114 AC_SUBST(MOZ_SYSTEM_NSS)
3116 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3117 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3118 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3119 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3120 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3121   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3122   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3124 AC_SUBST(HOST_CMFLAGS)
3125 AC_SUBST(HOST_CMMFLAGS)
3126 AC_SUBST(OS_COMPILE_CMFLAGS)
3127 AC_SUBST(OS_COMPILE_CMMFLAGS)
3129 OS_CFLAGS="$CFLAGS"
3130 OS_CXXFLAGS="$CXXFLAGS"
3131 OS_CPPFLAGS="$CPPFLAGS"
3132 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3133 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3134 OS_LDFLAGS="$LDFLAGS"
3135 OS_LIBS="$LIBS"
3136 AC_SUBST_LIST(OS_CFLAGS)
3137 AC_SUBST_LIST(OS_CXXFLAGS)
3138 AC_SUBST_LIST(OS_CPPFLAGS)
3139 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3140 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3141 AC_SUBST_LIST(OS_LDFLAGS)
3142 AC_SUBST(OS_LIBS)
3144 AC_SUBST(HOST_CC)
3145 AC_SUBST(HOST_CXX)
3146 AC_SUBST_LIST(HOST_CFLAGS)
3147 AC_SUBST_LIST(HOST_CPPFLAGS)
3148 AC_SUBST_LIST(HOST_CXXFLAGS)
3149 AC_SUBST(HOST_LDFLAGS)
3150 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3151 AC_SUBST(HOST_BIN_SUFFIX)
3153 AC_SUBST(TARGET_XPCOM_ABI)
3154 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3155 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3156 AC_SUBST(HAVE_X86_AVX2)
3157 AC_SUBST(HAVE_ALTIVEC)
3159 AC_SUBST_LIST(DSO_CFLAGS)
3160 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3161 AC_SUBST(DSO_LDOPTS)
3162 AC_SUBST(BIN_SUFFIX)
3163 AC_SUBST(USE_N32)
3164 AC_SUBST(NS_ENABLE_TSF)
3165 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3166 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3168 AC_SUBST(MOZ_DEVTOOLS)
3170 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3171 AC_SUBST(MOZ_FOLD_LIBS)
3172 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3174 AC_SUBST(DMG_TOOL)
3176 dnl Host JavaScript runtime, if any, to use during cross compiles.
3177 AC_SUBST(JS_BINARY)
3179 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3181 if test -n "$COMPILE_ENVIRONMENT"; then
3182 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3184 dnl Check for missing components
3185 if test "$MOZ_X11"; then
3186     dnl ====================================================
3187     dnl = Check if X headers exist
3188     dnl ====================================================
3189     _SAVE_CFLAGS=$CFLAGS
3190     CFLAGS="$CFLAGS $XCFLAGS"
3191     AC_TRY_COMPILE([
3192         #include <stdio.h>
3193         #include <stdlib.h>
3194         #include <X11/Xlib.h>
3195         #include <X11/Intrinsic.h>
3196         #include <X11/extensions/XShm.h>
3197     ],
3198     [
3199         Display *dpy = 0;
3200         if ((dpy = XOpenDisplay(NULL)) == NULL) {
3201             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3202             exit(1);
3203         }
3204     ], [],
3205     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3206     CFLAGS="$_SAVE_CFLAGS"
3208     if test -n "$MISSING_X"; then
3209         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3210     fi
3212 fi # MOZ_X11
3214 fi # COMPILE_ENVIRONMENT
3216 dnl Set various defines and substitutions
3217 dnl ========================================================
3219 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3220     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3221     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3222     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3223     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3224     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3225     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3226     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3227     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3230 AC_SUBST(MOZ_DEV_EDITION)
3231 if test -n "$MOZ_DEV_EDITION"; then
3232     AC_DEFINE(MOZ_DEV_EDITION)
3235 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3236     A11Y_LOG=1
3238 AC_SUBST(A11Y_LOG)
3239 if test -n "$A11Y_LOG"; then
3240     AC_DEFINE(A11Y_LOG)
3243 dnl Spit out some output
3244 dnl ========================================================
3246 dnl The following defines are used by xpcom
3247 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3248 HAVE_GETPAGESIZE
3249 HAVE_STATVFS64
3250 HAVE_STATVFS
3251 HAVE_STATFS64
3252 HAVE_STATFS
3253 HAVE_SYS_STATVFS_H
3254 HAVE_SYS_STATFS_H
3255 HAVE_SYS_VFS_H
3256 HAVE_SYS_MOUNT_H
3259 # Avoid using obsolete NSPR features
3260 AC_DEFINE(NO_NSPR_10_SUPPORT)
3262 MOZ_CREATE_CONFIG_STATUS()
3264 rm -fr confdefs* $ac_clean_files