Bug 1584114 [wpt PR 19319] - Update wpt metadata, a=testonly
[gecko.git] / old-configure.in
blobeadac039b2324059d9e1126c1f534bae4553f940
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.21
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.29.0
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 Add optional and non-optional hardening flags
312 dnl ========================================================
314 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
315 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
316 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
317 LDFLAGS="$LDFLAGS $MOZ_HARDENING_LDFLAGS"
319 dnl ========================================================
320 dnl GNU specific defaults
321 dnl ========================================================
322 if test "$GNU_CC"; then
323     MMX_FLAGS="-mmmx"
324     SSE_FLAGS="-msse"
325     SSE2_FLAGS="-msse2"
326     SSSE3_FLAGS="-mssse3"
327     # FIXME: Let us build with strict aliasing. bug 414641.
328     CFLAGS="$CFLAGS -fno-strict-aliasing"
329     DSO_CFLAGS=''
331     if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
332         DSO_PIC_CFLAGS='-fPIC'
333         ASFLAGS="$ASFLAGS -fPIC"
334     fi
336     AC_MSG_CHECKING([for --noexecstack option to as])
337     _SAVE_CFLAGS=$CFLAGS
338     CFLAGS="$CFLAGS -Wa,--noexecstack"
339     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
340                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
341                      AC_MSG_RESULT([no]))
342     CFLAGS=$_SAVE_CFLAGS
343     AC_MSG_CHECKING([for -z noexecstack option to ld])
344     _SAVE_LDFLAGS=$LDFLAGS
345     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
346     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
347                   AC_MSG_RESULT([no])
348                   LDFLAGS=$_SAVE_LDFLAGS)
350     AC_MSG_CHECKING([for -z text option to ld])
351     _SAVE_LDFLAGS=$LDFLAGS
352     LDFLAGS="$LDFLAGS -Wl,-z,text"
353     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
354                   AC_MSG_RESULT([no])
355                   LDFLAGS=$_SAVE_LDFLAGS)
357     AC_MSG_CHECKING([for -z relro option to ld])
358     _SAVE_LDFLAGS=$LDFLAGS
359     LDFLAGS="$LDFLAGS -Wl,-z,relro"
360     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
361                   AC_MSG_RESULT([no])
362                   LDFLAGS=$_SAVE_LDFLAGS)
364     AC_MSG_CHECKING([for -z nocopyreloc option to ld])
365     _SAVE_LDFLAGS=$LDFLAGS
366     LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
367     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
368                   AC_MSG_RESULT([no])
369                   LDFLAGS=$_SAVE_LDFLAGS)
371     AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
372     _SAVE_LDFLAGS=$LDFLAGS
373     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
374     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
375                   AC_MSG_RESULT([no])
376                   LDFLAGS=$_SAVE_LDFLAGS)
378     AC_MSG_CHECKING([for --build-id=sha1 option to ld])
379     _SAVE_LDFLAGS=$LDFLAGS
380     LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
381     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
382                   AC_MSG_RESULT([no])
383                   LDFLAGS=$_SAVE_LDFLAGS)
385     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
386     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
387     _SAVE_LDFLAGS=$LDFLAGS
388     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
389     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
390                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
391                   AC_MSG_RESULT([no]))
392     LDFLAGS=$_SAVE_LDFLAGS
394     # Check for -mssse3 on $CC
395     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
396     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
397     _SAVE_CFLAGS=$CFLAGS
398     CFLAGS="$CFLAGS -mssse3"
399     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
400                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
401                      AC_MSG_RESULT([no]))
402     CFLAGS=$_SAVE_CFLAGS
404     # Check for -msse4.1 on $CC
405     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
406     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
407     _SAVE_CFLAGS=$CFLAGS
408     CFLAGS="$CFLAGS -msse4.1"
409     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
410                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
411                      AC_MSG_RESULT([no]))
412     CFLAGS=$_SAVE_CFLAGS
414     case "${CPU_ARCH}" in
415     x86 | x86_64)
416       AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
417       AC_TRY_COMPILE([],
418                      [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
419                      result="yes", result="no")
420       AC_MSG_RESULT("$result")
421       if test "$result" = "yes"; then
422           HAVE_X86_AVX2=1
423       fi
424       ;;
426     ppc*)
427       AC_MSG_CHECKING([whether we can enable AltiVec support])
428       HAVE_ALTIVEC=
429       _SAVE_CFLAGS=$CFLAGS
430       CFLAGS="$CFLAGS -maltivec"
431       AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
432                        [HAVE_ALTIVEC=1],
433                        AC_MSG_RESULT([no]))
434       CFLAGS=$_SAVE_CFLAGS
435       ;;
436     esac
438     DSO_LDOPTS='-shared'
439     if test "$GCC_USE_GNU_LD"; then
440         # Some tools like ASan use a runtime library that is only
441         # linked against executables, so we must allow undefined
442         # symbols for shared objects in some cases.
443         if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
444             # Don't allow undefined symbols in libraries
445             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
447             # BSDs need `environ' exposed for posix_spawn (bug 753046)
448             case "$OS_TARGET" in
449             DragonFly|FreeBSD|NetBSD|OpenBSD)
450                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
451                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
452                 else
453                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
454                 fi
455                 ;;
456             esac
457         fi
458     fi
460     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
461     _USE_CPP_INCLUDE_FLAG=1
463     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
466 if test "$GNU_CXX"; then
467     # FIXME: Let us build with strict aliasing. bug 414641.
468     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
470     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
471     _USE_CPP_INCLUDE_FLAG=1
474 # For profiling builds keep the symbol information
475 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
476     case "$OS_TARGET" in
477     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
478         STRIP_FLAGS="--strip-debug"
479         ;;
480     esac
483 dnl ========================================================
484 dnl = Enable DMD
485 dnl ========================================================
487 if test "$MOZ_DMD"; then
488     if test "${CPU_ARCH}" = "arm"; then
489         CFLAGS="$CFLAGS -funwind-tables"
490         CXXFLAGS="$CXXFLAGS -funwind-tables"
491     fi
494 dnl ========================================================
495 dnl System overrides of the defaults for host
496 dnl ========================================================
497 case "$host" in
498 *mingw*)
499     if test -n "$_WIN32_MSVC"; then
500         HOST_CFLAGS="$HOST_CFLAGS -nologo"
501     else
502         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
503     fi
504     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
505     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
506     HOST_BIN_SUFFIX=.exe
508     case "${host_cpu}" in
509     i*86)
510         if test -n "$_WIN32_MSVC"; then
511             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
512         fi
513         ;;
514     x86_64)
515         if test -n "$_WIN32_MSVC"; then
516             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
517         fi
518         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
519         ;;
520     esac
521     ;;
523 *-darwin*)
524     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
525     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
526     ;;
528 *-linux*|*-kfreebsd*-gnu|*-gnu*)
529     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
530     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
531     ;;
534     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
535     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
536     ;;
537 esac
539 dnl ========================================================
540 dnl System overrides of the defaults for target
541 dnl ========================================================
543 case "$target" in
544 *-darwin*)
545     MOZ_OPTIMIZE_FLAGS="-O3"
546     CXXFLAGS="$CXXFLAGS -stdlib=libc++"
547     DSO_LDOPTS=''
548     STRIP_FLAGS="$STRIP_FLAGS -x -S"
549     # Ensure that if we're targeting iOS an SDK was provided.
550     AC_CACHE_CHECK(for iOS target,
551                    ac_cv_ios_target,
552                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
553 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
554 #error not iOS
555 #endif],
556                                    [],
557                                    ac_cv_ios_target="yes",
558                                    ac_cv_ios_target="no")])
559     if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
560        AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
561     fi
562     if test -z "$MOZ_IOS"; then
563         # The ExceptionHandling framework is needed for Objective-C exception
564         # logging code in nsObjCExceptions.h. Currently we only use that in debug
565         # builds.
566         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
567     fi
569     dnl DTrace and -dead_strip don't interact well. See bug 403132.
570     dnl ===================================================================
571     if test "x$enable_dtrace" = "xyes"; then
572         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
573     else
574         dnl check for the presence of the -dead_strip linker flag
575         AC_MSG_CHECKING([for -dead_strip option to ld])
576         _SAVE_LDFLAGS=$LDFLAGS
577         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
578         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
579         if test -n "$_HAVE_DEAD_STRIP" ; then
580             AC_MSG_RESULT([yes])
581             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
582         else
583             AC_MSG_RESULT([no])
584         fi
586         LDFLAGS=$_SAVE_LDFLAGS
587     fi
589     MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
590     ;;
592 *-android*|*-linuxandroid*)
593     if test "$COMPILE_ENVIRONMENT"; then
594         MOZ_LINKER=1
595     fi
597     MOZ_GFX_OPTIMIZE_MOBILE=1
598     if test -z "$CLANG_CC"; then
599         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
600     else
601         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
602         # -Oz is smaller than -Os on clang.
603         MOZ_OPTIMIZE_FLAGS="-Oz"
604         # Disable the outliner, which causes performance regressions, and is
605         # enabled on some platforms at -Oz.
606         if test -z "$MOZ_LTO"; then
607             DISABLE_OUTLINER="-mno-outline"
608             _SAVE_CFLAGS=$CFLAGS
609             CFLAGS="$CFLAGS $DISABLE_OUTLINER"
610             AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
611             CFLAGS="$_SAVE_CFLAGS"
612         else
613             DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
614             _SAVE_LDFLAGS=$LDFLAGS
615             LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
616             AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
617             LDFLAGS="$_SAVE_LDFLAGS"
618         fi
619     fi
620     ;;
622 *-*linux*)
623     if test "$GNU_CC" -o "$GNU_CXX"; then
624         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
625         if test -n "$MOZ_DEBUG"; then
626             MOZ_OPTIMIZE_FLAGS="-Os"
627         else
628             MOZ_OPTIMIZE_FLAGS="-O2"
629         fi
630         if test -z "$CLANG_CC"; then
631            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
632         fi
633     fi
635     case "${target_cpu}" in
636     alpha*)
637         CFLAGS="$CFLAGS -mieee"
638         CXXFLAGS="$CXXFLAGS -mieee"
639     ;;
640     esac
641     ;;
642 *-mingw*)
643     DSO_CFLAGS=
644     DSO_PIC_CFLAGS=
645     # certain versions of cygwin's makedepend barf on the
646     # #include <string> vs -I./dist/include/string issue so don't use it
647     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
648         CC="$CC -mwindows"
649         CXX="$CXX -mwindows"
650         CPP="$CPP -mwindows"
651         DSO_LDOPTS='-shared'
652         # Use temp file for windres (bug 213281)
653         RCFLAGS='-O coff --use-temp-file'
654         # mingw doesn't require kernel32, user32, and advapi32 explicitly
655         LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
656         MOZ_FIX_LINK_PATHS=
658         MOZ_OPTIMIZE_FLAGS="-O2"
660         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
661         WIN32_GUI_EXE_LDFLAGS=-mwindows
663         if test -z "$CLANG_CC"; then
664             # Use static libgcc and libstdc++
665             LDFLAGS="$LDFLAGS -static"
667             # GCC/binutils can't link to a function if we try to include dllexport function
668             # in the same library as dllimport caller. To work around it, we build NSPR
669             # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
670             # function thunks need to be generated for cross-DLL calls.
671             MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
672         else
673             # Silence problematic clang warnings
674             CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
675         fi
676     else
677         TARGET_COMPILER_ABI=msvc
678         RANLIB='echo not_ranlib'
679         STRIP='echo not_strip'
680         PKG_SKIP_STRIP=1
681         # aarch64 doesn't support subsystems below 6.02
682         if test "$CPU_ARCH" = "aarch64"; then
683             WIN32_SUBSYSTEM_VERSION=6.02
684         else
685             WIN32_SUBSYSTEM_VERSION=6.01
686         fi
687         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
688         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
689         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
690         _USE_CPP_INCLUDE_FLAG=1
691         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
692         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
693         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
694         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
695         if test -z "$CLANG_CL"; then
696             CPPFLAGS="$CPPFLAGS -utf-8"
697         fi
698         if test "$CPU_ARCH" = "x86"; then
699             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
700             dnl more recent, so set that explicitly here unless another
701             dnl target arch has already been set.
702             changequote(,)
703             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
704               CFLAGS="$CFLAGS -arch:SSE2"
705             fi
706             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
707               CXXFLAGS="$CXXFLAGS -arch:SSE2"
708             fi
709             changequote([,])
710             SSE_FLAGS="-arch:SSE"
711             SSE2_FLAGS="-arch:SSE2"
712             dnl MSVC allows the use of intrinsics without any flags
713             dnl and doesn't have a separate arch for SSSE3
714             SSSE3_FLAGS="-arch:SSE2"
715         fi
716         dnl clang-cl requires appropriate flags to enable SSSE3 support
717         dnl on all architectures.
718         if test -n "$CLANG_CL"; then
719             SSSE3_FLAGS="-mssse3"
720         fi
721         dnl VS2013+ supports -Gw for better linker optimizations.
722         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
723         dnl Disabled on ASan because it causes false-positive ODR violations.
724         if test -z "$MOZ_ASAN"; then
725             CFLAGS="$CFLAGS -Gw"
726             CXXFLAGS="$CXXFLAGS -Gw"
727         else
728             # String tail merging doesn't play nice with ASan's ODR checker.
729             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
730         fi
731         if test -n "$CLANG_CL"; then
732             # XXX We should combine some of these with our generic GCC-style
733             # warning checks.
734             #
735             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
736             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
737             # We use offsetof on non-POD objects all the time.
738             # We also suppress this warning on other platforms.
739             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
740             # This warns for reasonable things like:
741             #   enum { X = 0xffffffffU };
742             # which is annoying for IDL headers.
743             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
744             # This warns for cases that would be reached by the Microsoft
745             # #include rules, but also currently warns on cases that would
746             # *also* be reached by standard C++ include rules.  That
747             # behavior doesn't seem useful, so we turn it off.
748             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
749             # We normally error out on unknown pragmas, but since clang-cl
750             # claims to be MSVC, it would be difficult to add
751             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
752             # use such pragmas, so just ignore them.
753             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
754             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
755             # We get errors about various #pragma intrinsic directives from
756             # clang-cl, and we don't need to hear about those.
757             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
758             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
759             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
760             # as __attribute((__deprecated__)).  This is nice to know,
761             # but since we don't get the equivalent warning from MSVC,
762             # let's just ignore it.
763             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
764             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
765             # We use a function like:
766             #   __declspec(noreturn) __inline void f() {}
767             # which -Winvalid-noreturn complains about.  Again, MSVC seems
768             # OK with it, so let's silence the warning.
769             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
770             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
771             # Missing |override| on virtual function declarations isn't
772             # something that MSVC currently warns about.
773             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
774             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
775             # declaration on |operator delete(void*)|.  However, clang-cl
776             # must internally declare |operator delete(void*)| differently,
777             # which causes this warning for virtually every file in the
778             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
779             # so there doesn't seem to be any way to convince clang-cl to
780             # declare |delete| differently.  Therefore, suppress this
781             # warning.
782             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
783             # At least one MSVC header and several headers in-tree have
784             # unused typedefs, so turn this on.
785             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
786             # jemalloc uses __declspec(allocator) as a profiler hint,
787             # which clang-cl doesn't understand.
788             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
789             # __attribute__((unused)) really means "might be unused" and
790             # we use it to avoid warnings about things that are unused
791             # in some compilation units, but used in many others.  This
792             # warning insists on complaining about the latter case, which
793             # is annoying, and rather noisy.
794             CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
795         fi
796         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
797         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
798         LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
799         MOZ_DEBUG_LDFLAGS='-DEBUG'
800         # Use a higher optimization level for clang-cl, so we can come closer
801         # to MSVC's performance numbers (see bug 1443590).
802         if test -n "$CLANG_CL"; then
803             MOZ_OPTIMIZE_FLAGS='-O2'
804         else
805             MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
806         fi
807         MOZ_FIX_LINK_PATHS=
808         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
809         if test -z "$DEVELOPER_OPTIONS"; then
810             LDFLAGS="$LDFLAGS -RELEASE"
811         fi
812         RCFLAGS="-nologo"
813         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
814         dnl both SSSE3 and SSE4.1.
815         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
816         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
817         dnl allow AVX2 code from VS2015
818         HAVE_X86_AVX2=1
819     fi
820     AC_DEFINE(WIN32_LEAN_AND_MEAN)
821     dnl See http://support.microsoft.com/kb/143208 to use STL
822     AC_DEFINE(NOMINMAX)
823     BIN_SUFFIX='.exe'
824     MOZ_USER_DIR="Mozilla"
826     case "$host_os" in
827     cygwin*|msvc*|mks*)
828         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.])
829         ;;
830     esac
832     if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
833         CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
834         CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
835     fi
837     case "$target" in
838     i*86-*)
839         if test -n "$GNU_CC"; then
840             CFLAGS="$CFLAGS -mstackrealign"
841             CXXFLAGS="$CXXFLAGS -mstackrealign"
842             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
843         else
844             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
845             LDFLAGS="$LDFLAGS -SAFESEH"
846         fi
848         AC_DEFINE(_X86_)
849         ;;
850     x86_64-*)
851         if test -n "$_WIN32_MSVC"; then
852             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
853         fi
854         AC_DEFINE(_AMD64_)
855         ;;
856     aarch64-*)
857         if test -n "$_WIN32_MSVC"; then
858             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
859         fi
860         AC_DEFINE(_ARM64_)
861         ;;
862     *)
863         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
864         ;;
865     esac
866     ;;
868 *-netbsd*)
869     DSO_CFLAGS=''
870     CFLAGS="$CFLAGS -Dunix"
871     CXXFLAGS="$CXXFLAGS -Dunix"
872     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
873         DSO_PIC_CFLAGS='-fPIC -DPIC'
874         DSO_LDOPTS='-shared'
875         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
876     else
877         DSO_PIC_CFLAGS='-fPIC -DPIC'
878         DSO_LDOPTS='-shared'
879     fi
880     # This will fail on a.out systems prior to 1.5.1_ALPHA.
881     if test "$LIBRUNPATH"; then
882         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
883     fi
884     ;;
886 *-openbsd*)
887     if test -z "$X11BASE"; then
888         X11BASE=/usr/X11R6
889     fi
890     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
891     DSO_CFLAGS=''
892     DSO_PIC_CFLAGS='-fPIC'
893     DSO_LDOPTS='-shared -fPIC'
894     if test "$LIBRUNPATH"; then
895         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
896     fi
897     ;;
899 *-solaris*)
900     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
901     ;;
903 esac
905 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
906     MOZ_OPTIMIZE_FLAGS="-O"
909 AC_SUBST_LIST(MMX_FLAGS)
910 AC_SUBST_LIST(SSE_FLAGS)
911 AC_SUBST_LIST(SSE2_FLAGS)
912 AC_SUBST_LIST(SSSE3_FLAGS)
914 AC_SUBST(MOZ_LINKER)
915 if test -n "$MOZ_LINKER"; then
916   AC_DEFINE(MOZ_LINKER)
917   MOZ_LINKER_EXTRACT=1
918   AC_CHECK_PROGS(XZ, xz)
921 if test -z "$COMPILE_ENVIRONMENT"; then
922     SKIP_COMPILER_CHECKS=1
923     SKIP_LIBRARY_CHECKS=1
924     PKG_SKIP_STRIP=1
925     MOZ_DEBUGGING_OPTS
926 else
927     MOZ_COMPILER_OPTS
928 fi # COMPILE_ENVIRONMENT
930 if test -z "$SKIP_COMPILER_CHECKS"; then
931 dnl Checks for typedefs, structures, and compiler characteristics.
932 dnl ========================================================
933 AC_C_CONST
934 AC_TYPE_MODE_T
935 AC_TYPE_OFF_T
936 AC_TYPE_PID_T
937 AC_TYPE_SIZE_T
938 AC_LANG_CPLUSPLUS
939 AC_LANG_C
941 AC_LANG_CPLUSPLUS
943 MOZ_CXX11
945 AC_LANG_C
947 case "${OS_TARGET}" in
948 Darwin)
949   ;;
951   STL_FLAGS="-I${DIST}/stl_wrappers"
952   WRAP_STL_INCLUDES=1
953   ;;
954 esac
956 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
957     WRAP_STL_INCLUDES=
960 dnl Checks for header files.
961 dnl ========================================================
962 AC_HEADER_DIRENT
963 case "$target_os" in
964 bitrig*|dragonfly*|freebsd*|openbsd*)
965 # for stuff like -lXshm
966     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
967     ;;
968 esac
970 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
971 AC_CACHE_CHECK(for sockaddr_in.sin_len,
972                    ac_cv_sockaddr_in_sin_len,
973                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
974                                     #include <sys/types.h>
975                                     #endif
976                                     #include <netinet/in.h>
977                                     struct sockaddr_in x;
978                                     void *foo = (void*) &x.sin_len;],
979                                    [],
980                                    [ac_cv_sockaddr_in_sin_len=true],
981                                    [ac_cv_sockaddr_in_sin_len=false])])
982 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
983   AC_DEFINE(HAVE_SIN_LEN)
984 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
985   AC_DEFINE(HAVE_SCONN_LEN)
988 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
989                ac_cv_sockaddr_in6_sin6_len,
990                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
991                                 #include <sys/types.h>
992                                 #endif
993                                 #include <netinet/in.h>
994                                 struct sockaddr_in6 x;
995                                 void *foo = (void*) &x.sin6_len;],
996                                [],
997                                [ac_cv_sockaddr_in6_sin6_len=true],
998                                [ac_cv_sockaddr_in6_sin6_len=false])])
999 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1000   AC_DEFINE(HAVE_SIN6_LEN)
1003 AC_CACHE_CHECK(for sockaddr.sa_len,
1004                ac_cv_sockaddr_sa_len,
1005                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1006                                 #include <sys/types.h>
1007                                 #endif
1008                                 #include <sys/socket.h>
1009                                 struct sockaddr x;
1010                                 void *foo = (void*) &x.sa_len;],
1011                                [],
1012                                [ac_cv_sockaddr_sa_len=true],
1013                                [ac_cv_sockaddr_sa_len=false])])
1014 if test "$ac_cv_sockaddr_sa_len" = true ; then
1015   AC_DEFINE(HAVE_SA_LEN)
1018 MOZ_ARG_ENABLE_BOOL(dtrace,
1019               [  --enable-dtrace         build with dtrace support if available (default=no)],
1020               [enable_dtrace="yes"],)
1021 if test "x$enable_dtrace" = "xyes"; then
1022   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1023   if test -n "$HAVE_DTRACE"; then
1024       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1025   else
1026       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1027   fi
1029 AC_SUBST(HAVE_DTRACE)
1031 dnl Checks for libraries.
1032 dnl ========================================================
1033 AC_CHECK_LIB(c_r, gethostbyname_r)
1035 dnl We don't want to link with libdl even if it's present on OS X, since
1036 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1037 dnl in libc.
1038 dnl We don't want to link against libm or libpthread on Darwin since
1039 dnl they both are just symlinks to libSystem and explicitly linking
1040 dnl against libSystem causes issues when debugging (see bug 299601).
1041 case $target in
1042 *-darwin*)
1043     ;;
1045     AC_SEARCH_LIBS(dlopen, dl,
1046         MOZ_CHECK_HEADER(dlfcn.h,
1047         AC_DEFINE(HAVE_DLOPEN)))
1048     ;;
1049 esac
1051 _SAVE_CFLAGS="$CFLAGS"
1052 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1053 AC_CHECK_FUNCS(dladdr memmem)
1054 CFLAGS="$_SAVE_CFLAGS"
1056 if test ! "$GNU_CXX"; then
1057     AC_CHECK_LIB(C, demangle)
1060 AC_CHECK_LIB(socket, socket)
1062 XLDFLAGS="$X_LIBS"
1063 XLIBS="$X_EXTRA_LIBS"
1065 dnl ========================================================
1066 dnl Checks for X libraries.
1067 dnl Ordering is important.
1068 dnl Xt is dependent upon SM as of X11R6
1069 dnl ========================================================
1070 if test -n "$MOZ_X11"; then
1071     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1072     _SAVE_LDFLAGS="$LDFLAGS"
1073     _SAVE_LIBS="$LIBS"
1074     LDFLAGS="$XLDFLAGS $LDFLAGS"
1075     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1076         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1077     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1078         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1080     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1081         unset ac_cv_lib_Xt_XtFree
1082         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1083         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1084         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1085             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1086         ])
1088     dnl ========================================================
1089     dnl = Check for xcb
1090     dnl ========================================================
1091     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1092         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1093     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1094         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1095     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1096         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1098     LDFLAGS="$_SAVE_LDFLAGS"
1099     LIBS="$_SAVE_LIBS"
1100 fi # $MOZ_X11
1102 AC_SUBST_LIST(XCFLAGS)
1103 AC_SUBST_LIST(XLDFLAGS)
1104 AC_SUBST_LIST(XLIBS)
1105 AC_SUBST_LIST(XEXT_LIBS)
1106 AC_SUBST_LIST(XT_LIBS)
1108 dnl ========================================================
1109 dnl = pthread support
1110 dnl = Start by checking whether the system support pthreads
1111 dnl ========================================================
1112 case "$target_os" in
1113 darwin*)
1114     MOZ_USE_PTHREADS=1
1115     ;;
1117     AC_CHECK_LIB(pthreads, pthread_create,
1118         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1119         AC_CHECK_LIB(pthread, pthread_create,
1120             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1121             AC_CHECK_LIB(c_r, pthread_create,
1122                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1123                 AC_CHECK_LIB(c, pthread_create,
1124                     MOZ_USE_PTHREADS=1
1125                 )
1126             )
1127         )
1128     )
1129     ;;
1130 esac
1132 dnl ========================================================
1133 dnl Do the platform specific pthread hackery
1134 dnl ========================================================
1135 if test "$MOZ_USE_PTHREADS"x != x
1136 then
1137     dnl
1138     dnl See if -pthread is supported.
1139     dnl
1140     rm -f conftest*
1141     ac_cv_have_dash_pthread=no
1142     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1143     echo 'int main() { return 0; }' | cat > conftest.c
1144     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1145     if test $? -eq 0; then
1146         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1147             ac_cv_have_dash_pthread=yes
1148             case "$target_os" in
1149             freebsd*)
1150 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1151                 ;;
1152             *)
1153                 CFLAGS="$CFLAGS -pthread"
1154                 CXXFLAGS="$CXXFLAGS -pthread"
1155                 ;;
1156             esac
1157         fi
1158     fi
1159     rm -f conftest*
1160     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1162     dnl
1163     dnl See if -pthreads is supported.
1164     dnl
1165     ac_cv_have_dash_pthreads=no
1166     if test "$ac_cv_have_dash_pthread" = "no"; then
1167         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1168         echo 'int main() { return 0; }' | cat > conftest.c
1169         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1170         if test $? -eq 0; then
1171             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1172                 ac_cv_have_dash_pthreads=yes
1173                 CFLAGS="$CFLAGS -pthreads"
1174                 CXXFLAGS="$CXXFLAGS -pthreads"
1175             fi
1176         fi
1177         rm -f conftest*
1178         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1179     fi
1181     case "$target" in
1182         *-*-freebsd*)
1183             AC_DEFINE(_REENTRANT)
1184             AC_DEFINE(_THREAD_SAFE)
1185             dnl -pthread links in -lpthread, so don't specify it explicitly.
1186             if test "$ac_cv_have_dash_pthread" = "yes"; then
1187                 _PTHREAD_LDFLAGS="-pthread"
1188             fi
1189             ;;
1191         *-*-openbsd*|*-*-bsdi*)
1192             AC_DEFINE(_REENTRANT)
1193             AC_DEFINE(_THREAD_SAFE)
1194             dnl -pthread links in -lc_r, so don't specify it explicitly.
1195             if test "$ac_cv_have_dash_pthread" = "yes"; then
1196                 _PTHREAD_LDFLAGS="-pthread"
1197             fi
1198             ;;
1200         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1201             AC_DEFINE(_REENTRANT)
1202             ;;
1204     esac
1205     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1206     AC_SUBST(MOZ_USE_PTHREADS)
1207     MOZ_CHECK_HEADERS(pthread.h)
1211 dnl Checks for library functions.
1212 dnl ========================================================
1213 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1215 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1216 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1217                ac_cv_clock_monotonic,
1218                [for libs in "" -lrt; do
1219                     _SAVE_LIBS="$LIBS"
1220                     _SAVE_CFLAGS="$CFLAGS"
1221                     LIBS="$LIBS $libs"
1222                     CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1223 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1224 dnl we should or not be able to use it. To detect if we can, we need to make the
1225 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1226                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1227                                  #include <time.h>],
1228                                  [ struct timespec ts;
1229                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
1230                                  ac_cv_clock_monotonic=$libs
1231                                  LIBS="$_SAVE_LIBS"
1232                                  break,
1233                                  ac_cv_clock_monotonic=no)
1234                     LIBS="$_SAVE_LIBS"
1235                     CFLAGS="$_SAVE_CFLAGS"
1236                 done])
1237 if test "$ac_cv_clock_monotonic" != "no"; then
1238     HAVE_CLOCK_MONOTONIC=1
1239     REALTIME_LIBS=$ac_cv_clock_monotonic
1240     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1241     AC_SUBST(HAVE_CLOCK_MONOTONIC)
1242     AC_SUBST_LIST(REALTIME_LIBS)
1245 dnl Turn on warnings-as-errors to prevent implicit declaration of
1246 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1247 dnl inadvertently pass even if the function does not really exist.
1248 _SAVE_CFLAGS="$CFLAGS"
1249 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1250 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1251                ac_cv_pthread_cond_timedwait_monotonic_np,
1252                AC_TRY_LINK([#include <pthread.h>],
1253                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1254                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1255                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1256 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1257     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1259 CFLAGS=$_SAVE_CFLAGS
1261 AC_CACHE_CHECK(
1262     [for res_ninit()],
1263     ac_cv_func_res_ninit,
1264     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1265         dnl no need for res_ninit() on NetBSD and OpenBSD
1266         ac_cv_func_res_ninit=no
1267      else
1268         AC_TRY_LINK([
1269             #ifdef linux
1270             #define _BSD_SOURCE 1
1271             #endif
1272             #include <sys/types.h>
1273             #include <netinet/in.h>
1274             #include <arpa/nameser.h>
1275             #include <resolv.h>
1276             ],
1277             [int foo = res_ninit(&_res);],
1278             [ac_cv_func_res_ninit=yes],
1279             [ac_cv_func_res_ninit=no])
1280      fi
1281     ])
1283 if test "$ac_cv_func_res_ninit" = "yes"; then
1284     AC_DEFINE(HAVE_RES_NINIT)
1285 dnl must add the link line we do something as foolish as this... dougt
1286 dnl else
1287 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1288 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1291 AC_LANG_C
1293 dnl **********************
1294 dnl *** va_copy checks ***
1295 AC_CACHE_CHECK([for an implementation of va_copy()],
1296                ac_cv_va_copy,
1297     [AC_TRY_COMPILE([#include <stdarg.h>
1298                      #include <stdlib.h>
1299         void f (int i, ...) {
1300             va_list args1, args2;
1301             va_start (args1, i);
1302             va_copy (args2, args1);
1303             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1304                 exit (1);
1305             va_end (args1); va_end (args2);
1306         }],
1307         [f(0, 42); return 0],
1308         [ac_cv_va_copy=yes],
1309         [ac_cv_va_copy=no]
1310     )]
1312 AC_CACHE_CHECK([whether va_list can be copied by value],
1313                ac_cv_va_val_copy,
1314     [AC_TRY_COMPILE([#include <stdarg.h>
1315                      #include <stdlib.h>
1316         void f (int i, ...) {
1317             va_list args1, args2;
1318             va_start (args1, i);
1319             args2 = args1;
1320             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1321                 exit (1);
1322             va_end (args1); va_end (args2);
1323         }],
1324         [f(0, 42); return 0],
1325         [ac_cv_va_val_copy=yes],
1326         [ac_cv_va_val_copy=no],
1327     )]
1329 if test "x$ac_cv_va_copy" = "xyes"; then
1330     AC_DEFINE(VA_COPY, va_copy)
1331     AC_DEFINE(HAVE_VA_COPY)
1334 if test "x$ac_cv_va_val_copy" = "xno"; then
1335    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1338 dnl ===================================================================
1339 dnl ========================================================
1340 dnl Put your C++ language/feature checks below
1341 dnl ========================================================
1342 AC_LANG_CPLUSPLUS
1344 ARM_ABI_PREFIX=
1345 if test "$GNU_CC"; then
1346   if test "$CPU_ARCH" = "arm" ; then
1347     AC_CACHE_CHECK(for ARM EABI,
1348         ac_cv_gcc_arm_eabi,
1349         [AC_TRY_COMPILE([],
1350                         [
1351 #if defined(__ARM_EABI__)
1352   return 0;
1353 #else
1354 #error Not ARM EABI.
1355 #endif
1356                         ],
1357                         ac_cv_gcc_arm_eabi="yes",
1358                         ac_cv_gcc_arm_eabi="no")])
1359     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1360         HAVE_ARM_EABI=1
1361         ARM_ABI_PREFIX=eabi-
1362     else
1363         ARM_ABI_PREFIX=oabi-
1364     fi
1365   fi
1367   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1370 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1371 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1372 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1373 # linking XUL.
1374 _SAVE_LDFLAGS=$LDFLAGS
1375 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1376 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1377                ac_cv_thread_keyword,
1378                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1379                             [return tlsIsMainThread;],
1380                             ac_cv_thread_keyword=yes,
1381                             ac_cv_thread_keyword=no)])
1382 LDFLAGS=$_SAVE_LDFLAGS
1383 # The custom dynamic linker doesn't support TLS variables
1384 MOZ_TLS=
1385 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1386   # mips builds fail with TLS variables because of a binutils bug.
1387   # See bug 528687
1388   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1389   case "${target}" in
1390     mips*-*)
1391       :
1392       ;;
1393     *-android*|*-linuxandroid*)
1394       :
1395       ;;
1396     *-openbsd*)
1397       :
1398       ;;
1399     *)
1400       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1401       MOZ_TLS=1
1402       ;;
1403   esac
1406 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1407 if test -n "$MOZ_LINKER"; then
1408   if test "$CPU_ARCH" = arm; then
1409     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1410     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1411       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1412       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1413     fi
1414   fi
1416 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1417 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1418 dnl Since the linker only understands the sysv ones, no need to build the
1419 dnl gnu style tables anyways.
1420   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1423 dnl End of C++ language/feature checks
1424 AC_LANG_C
1426 dnl ========================================================
1427 dnl =  Internationalization checks
1428 dnl ========================================================
1430 dnl Internationalization and Locale support is different
1431 dnl on various UNIX platforms.  Checks for specific i18n
1432 dnl features go here.
1434 AC_HAVE_FUNCS(localeconv)
1436 fi # ! SKIP_COMPILER_CHECKS
1438 if test -n "${COMPILE_ENVIRONMENT}"; then
1439   MOZ_CHECK_ALLOCATOR
1442 TARGET_XPCOM_ABI=
1443 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1444     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1445     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1448 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1449 dnl features that Windows actually does support.
1451 if test -n "$SKIP_COMPILER_CHECKS"; then
1452    dnl Windows has malloc.h
1453    AC_DEFINE(MALLOC_H, [<malloc.h>])
1454    AC_DEFINE(HAVE_FORCEINLINE)
1455    AC_DEFINE(HAVE_LOCALECONV)
1456 fi # SKIP_COMPILER_CHECKS
1458 dnl Mozilla specific options
1459 dnl ========================================================
1460 dnl The macros used for command line options
1461 dnl are defined in build/autoconf/altoptions.m4.
1463 dnl ========================================================
1464 dnl =
1465 dnl = Check for external package dependencies
1466 dnl =
1467 dnl ========================================================
1468 MOZ_ARG_HEADER(External Packages)
1470 case "$OS_TARGET" in
1471 WINNT|Darwin|Android)
1472   MOZ_FOLD_LIBS=1
1473   ;;
1475   MOZ_FOLD_LIBS=
1476   ;;
1477 esac
1479 MOZ_CONFIG_NSPR()
1481 dnl ========================================================
1482 dnl system libevent Support
1483 dnl ========================================================
1484 MOZ_ARG_WITH_STRING(system-libevent,
1485 [  --with-system-libevent[=PFX]
1486                           Use system libevent [installed at prefix PFX]],
1487     LIBEVENT_DIR=$withval)
1489 _SAVE_CFLAGS=$CFLAGS
1490 _SAVE_LDFLAGS=$LDFLAGS
1491 _SAVE_LIBS=$LIBS
1492 if test "$LIBEVENT_DIR" = yes; then
1493     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1494         MOZ_SYSTEM_LIBEVENT=1,
1495         LIBEVENT_DIR=/usr)
1497 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1498     MOZ_SYSTEM_LIBEVENT=
1499 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1500     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1501     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1502     MOZ_CHECK_HEADER(event.h,
1503         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1504              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1505          fi],
1506         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1507     AC_CHECK_LIB(event, event_init,
1508                  [MOZ_SYSTEM_LIBEVENT=1
1509                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1510                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1511                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1513 CFLAGS=$_SAVE_CFLAGS
1514 LDFLAGS=$_SAVE_LDFLAGS
1515 LIBS=$_SAVE_LIBS
1517 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1519 dnl ========================================================
1520 dnl = If NSS was not detected in the system,
1521 dnl = use the one in the source tree (mozilla/security/nss)
1522 dnl ========================================================
1524 MOZ_ARG_WITH_BOOL(system-nss,
1525 [  --with-system-nss       Use system installed NSS],
1526     _USE_SYSTEM_NSS=1 )
1528 if test -n "$_USE_SYSTEM_NSS"; then
1529     AM_PATH_NSS(3.47, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1532 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1533 if test -z "$MOZ_SYSTEM_NSS"; then
1534    case "${OS_ARCH}" in
1535         # Only few platforms have been tested with GYP
1536         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1537             ;;
1538         *)
1539             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1540             ;;
1541    esac
1544 dnl system ZLIB support
1545 dnl ========================================================
1546 MOZ_ZLIB_CHECK([1.2.3])
1548 if test -z "$SKIP_LIBRARY_CHECKS"; then
1550 dnl ========================================================
1551 dnl system PNG Support
1552 dnl ========================================================
1553 MOZ_ARG_WITH_STRING(system-png,
1554 [  --with-system-png[=PFX]
1555                           Use system libpng [installed at prefix PFX]],
1556     PNG_DIR=$withval)
1558 _SAVE_CFLAGS=$CFLAGS
1559 _SAVE_LDFLAGS=$LDFLAGS
1560 _SAVE_LIBS=$LIBS
1561 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1562     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1563     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1565 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1566     MOZ_SYSTEM_PNG=
1567 else
1568     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1569                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1570     AC_CHECK_LIB(png, png_get_acTL, ,
1571                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1573 if test "$MOZ_SYSTEM_PNG" = 1; then
1574     AC_TRY_COMPILE([ #include <stdio.h>
1575                      #include <sys/types.h>
1576                      #include <png.h> ],
1577                    [ #if PNG_LIBPNG_VER < $MOZPNG
1578                      #error "Insufficient libpng version ($MOZPNG required)."
1579                      #endif
1580                      #ifndef PNG_UINT_31_MAX
1581                      #error "Insufficient libpng version."
1582                      #endif ],
1583                    MOZ_SYSTEM_PNG=1,
1584                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1586 CFLAGS=$_SAVE_CFLAGS
1587 LDFLAGS=$_SAVE_LDFLAGS
1588 LIBS=$_SAVE_LIBS
1590 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1591     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1592     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1595 fi # SKIP_LIBRARY_CHECKS
1597 dnl ========================================================
1598 dnl =
1599 dnl = Application
1600 dnl =
1601 dnl ========================================================
1603 MOZ_ARG_HEADER(Application)
1605 ENABLE_SYSTEM_EXTENSION_DIRS=1
1606 MOZ_BRANDING_DIRECTORY=
1607 MOZ_OFFICIAL_BRANDING=
1608 MOZ_AUTH_EXTENSION=1
1609 if test "$MOZ_IOS"; then
1610    MOZ_AUTH_EXTENSION=
1612 MOZ_PREF_EXTENSIONS=1
1613 MOZ_SPELLCHECK=1
1614 MOZ_UNIVERSALCHARDET=1
1615 MOZ_XUL=1
1616 MOZ_ZIPWRITER=1
1617 MOZ_NO_SMART_CARDS=
1618 NECKO_COOKIES=1
1619 MOZ_USE_NATIVE_POPUP_WINDOWS=
1620 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1621 MOZ_SANDBOX=1
1622 MOZ_BINARY_EXTENSIONS=
1623 MOZ_DEVTOOLS=server
1625 case "$target_os" in
1626     mingw*)
1627         NS_ENABLE_TSF=1
1628         AC_DEFINE(NS_ENABLE_TSF)
1629         ;;
1630 esac
1632 # Optional Firefox for Android partner distribution directory.
1633 MOZ_ARG_WITH_STRING(android-distribution-directory,
1634 [  --with-android-distribution-directory=dir
1635                           Optional Firefox for Android partner distribution directory.],
1636   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1638 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1639   # A distribution directory must have an assets/distribution directory.
1640   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1641   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1642     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1643                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1644   fi
1646 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1648 dnl ========================================================
1649 dnl = Trademarked Branding
1650 dnl ========================================================
1651 MOZ_ARG_ENABLE_BOOL(official-branding,
1652 [  --enable-official-branding
1653                           Enable Official mozilla.org Branding
1654                           Do not distribute builds with
1655                           --enable-official-branding unless you have
1656                           permission to use trademarks per
1657                           http://www.mozilla.org/foundation/trademarks/ .],
1658     MOZ_OFFICIAL_BRANDING=1,
1659     MOZ_OFFICIAL_BRANDING=)
1661 # Allow the application to influence configure with a confvars.sh script.
1662 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1663 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1664   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1665   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1666 else
1667   AC_MSG_RESULT([no])
1670 # Allow influencing configure with a defines.sh script.
1671 . "${srcdir}/build/defines.sh"
1673 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1674 # set in defines.sh
1675 if test "$BUILDING_RELEASE"; then
1676   # Override value in defines.sh, if any
1677   EARLY_BETA_OR_EARLIER=
1678 elif test "$EARLY_BETA_OR_EARLIER"; then
1679   AC_DEFINE(EARLY_BETA_OR_EARLIER)
1681 AC_SUBST(EARLY_BETA_OR_EARLIER)
1683 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1684 MOZ_ARG_WITH_STRING(app-name,
1685 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1686 WITH_APP_NAME=$withval,
1689 if test -n "$WITH_APP_NAME" ; then
1690     MOZ_APP_NAME="$WITH_APP_NAME"
1693 MOZ_ARG_WITH_STRING(app-basename,
1694 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1695 WITH_APP_BASENAME=$withval,
1698 if test -n "$WITH_APP_BASENAME" ; then
1699     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1702 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1703 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1704 # MOZ_BUILD_APP.
1705 case "$MOZ_BUILD_APP" in
1706 browser)
1707   AC_DEFINE(MOZ_PHOENIX)
1708   ;;
1709 esac
1711 # Graphene is a desktop runtime for running applications with a HTML UI.
1712 if test -n "$MOZ_GRAPHENE"; then
1713     AC_DEFINE(MOZ_GRAPHENE)
1716 AC_SUBST(MOZ_PHOENIX)
1718 dnl ========================================================
1719 dnl Ensure Android SDK and build-tools versions depending on
1720 dnl mobile target.
1721 dnl ========================================================
1723 case "$MOZ_BUILD_APP" in
1724 mobile/android)
1725     MOZ_ANDROID_SDK
1726     ;;
1727 esac
1729 dnl ========================================================
1730 dnl =
1731 dnl = Toolkit Options
1732 dnl =
1733 dnl ========================================================
1734 MOZ_ARG_HEADER(Toolkit Options)
1736 dnl ========================================================
1737 dnl = Enable the toolkit as needed                         =
1738 dnl ========================================================
1740 case "$MOZ_WIDGET_TOOLKIT" in
1742 cocoa)
1743     LDFLAGS="$LDFLAGS -framework Cocoa"
1744     # Use -Wl as a trick to avoid -framework and framework names from
1745     # being separated by AC_SUBST_LIST.
1746     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'
1747     TK_CFLAGS=""
1748     CFLAGS="$CFLAGS $TK_CFLAGS"
1749     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1750     MOZ_USER_DIR="Mozilla"
1751     MOZ_FS_LAYOUT=bundle
1752     ;;
1754 uikit)
1755     LDFLAGS="$LDFLAGS -framework UIKit"
1756     TK_CFLAGS=""
1757     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'
1758     CFLAGS="$CFLAGS $TK_CFLAGS"
1759     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1760     MOZ_USER_DIR="Mozilla"
1761     MOZ_FS_LAYOUT=bundle
1762     ;;
1764 esac
1766 if test "$OS_TARGET" = Darwin; then
1767     LDFLAGS="$LDFLAGS -lobjc"
1770 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1771 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1772 case "$MOZ_WIDGET_TOOLKIT" in
1773 gtk*)
1774     MOZ_ENABLE_GTK=1
1775     ;;
1776 esac
1778 if test "$COMPILE_ENVIRONMENT"; then
1779   if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1780     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)
1781     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1782     TK_CFLAGS=$MOZ_GTK3_CFLAGS
1783     TK_LIBS=$MOZ_GTK3_LIBS
1784     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1785     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1786     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1787     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1788   fi
1789   if test "$MOZ_ENABLE_GTK"; then
1790     if test "$MOZ_X11"; then
1791       GDK_PACKAGES=gdk-x11-2.0
1792     fi
1793     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1794     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1796     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)
1797     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1798   fi
1799 fi # COMPILE_ENVIRONMENT
1801 AC_SUBST(MOZ_FS_LAYOUT)
1803 dnl ========================================================
1804 dnl = startup-notification support module
1805 dnl ========================================================
1807 if test "$MOZ_ENABLE_GTK"
1808 then
1809     MOZ_ENABLE_STARTUP_NOTIFICATION=
1811     MOZ_ARG_ENABLE_BOOL(startup-notification,
1812     [  --enable-startup-notification
1813                           Enable startup-notification support (default: disabled) ],
1814         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1815         MOZ_ENABLE_STARTUP_NOTIFICATION=)
1816     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1817     then
1818         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1819                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1820         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1821             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1822             then
1823                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1824             fi
1825             MOZ_ENABLE_STARTUP_NOTIFICATION=
1826         ])
1827     fi
1829     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1830         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1831     fi
1833     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1835 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1837 AC_SUBST_LIST(TK_CFLAGS)
1838 AC_SUBST_LIST(TK_LIBS)
1840 dnl ========================================================
1841 dnl =
1842 dnl = Components & Features
1843 dnl =
1844 dnl ========================================================
1845 MOZ_ARG_HEADER(Components and Features)
1847 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1848 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1849   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1850     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1851   else
1852     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1853     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1854   fi
1857 MOZ_ARG_WITH_STRING(branding,
1858 [  --with-branding=dir     Use branding from the specified directory.],
1859     MOZ_BRANDING_DIRECTORY=$withval)
1861 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1862 if test -z "$REAL_BRANDING_DIRECTORY"; then
1863   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1866 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1867   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1868 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1869   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1872 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1874 dnl ========================================================
1875 dnl = Distribution ID
1876 dnl ========================================================
1877 MOZ_ARG_WITH_STRING(distribution-id,
1878 [  --with-distribution-id=ID
1879                           Set distribution-specific id (default=org.mozilla)],
1880 [ val=`echo $withval`
1881     MOZ_DISTRIBUTION_ID="$val"])
1883 if test -z "$MOZ_DISTRIBUTION_ID"; then
1884    MOZ_DISTRIBUTION_ID="org.mozilla"
1887 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1888 AC_SUBST(MOZ_DISTRIBUTION_ID)
1890 dnl ========================================================
1891 dnl = libproxy support
1892 dnl ========================================================
1894 if test "$MOZ_ENABLE_GTK"
1895 then
1896     MOZ_ENABLE_LIBPROXY=
1898     MOZ_ARG_ENABLE_BOOL(libproxy,
1899     [  --enable-libproxy         Enable libproxy support ],
1900     MOZ_ENABLE_LIBPROXY=1,
1901     MOZ_ENABLE_LIBPROXY=)
1903     if test "$MOZ_ENABLE_LIBPROXY"
1904     then
1905         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1906         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1907     fi
1909 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1911 dnl ========================================================
1912 dnl = dbus support
1913 dnl ========================================================
1915 if test "$MOZ_ENABLE_GTK"
1916 then
1917     MOZ_ENABLE_DBUS=1
1919     MOZ_ARG_DISABLE_BOOL(dbus,
1920     [  --disable-dbus          Disable dbus support ],
1921         MOZ_ENABLE_DBUS=,
1922         MOZ_ENABLE_DBUS=1)
1924     if test "$MOZ_ENABLE_DBUS"
1925     then
1926         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1927         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1928         AC_DEFINE(MOZ_ENABLE_DBUS)
1929     fi
1931 AC_SUBST(MOZ_ENABLE_DBUS)
1933 dnl =========================================================
1934 dnl = Whether to exclude hyphenations files in the build
1935 dnl =========================================================
1936 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1937     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1940 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1941                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1942                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1944 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1946 if test -n "$MOZ_WEBRTC"; then
1947     if test -n "$MOZ_X11"; then
1948       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1949     fi
1952 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1954 dnl ========================================================
1955 dnl = Apple platform decoder support
1956 dnl ========================================================
1957 if test "$COMPILE_ENVIRONMENT"; then
1958 if test -n "$MOZ_APPLEMEDIA"; then
1959   # hack in frameworks for fmp4 - see bug 1029974
1960   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1961   LDFLAGS="$LDFLAGS -framework AudioToolbox"
1962   dnl Verify CoreMedia is available.
1963   AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1964     [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1966 fi # COMPILE_ENVIRONMENT
1968 dnl ========================================================
1969 dnl = Handle dependent MEDIA defines
1970 dnl ========================================================
1972 MOZ_WEBM_ENCODER=1
1973 AC_DEFINE(MOZ_WEBM_ENCODER)
1974 AC_SUBST(MOZ_WEBM_ENCODER)
1976 dnl ========================================================
1977 dnl NegotiateAuth
1978 dnl ========================================================
1980 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1981 [  --disable-negotiateauth Disable GSS-API negotiation ],
1982     MOZ_AUTH_EXTENSION=,
1983     MOZ_AUTH_EXTENSION=1 )
1985 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1986    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1989 dnl ========================================================
1990 dnl Pref extensions (autoconfig)
1991 dnl ========================================================
1992 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1993 [  --disable-pref-extensions
1994                           Disable pref extensions such as autoconfig],
1995   MOZ_PREF_EXTENSIONS=,
1996   MOZ_PREF_EXTENSIONS=1 )
1998 dnl ========================================================
1999 dnl Searching of system directories for extensions.
2000 dnl Note: this switch is meant to be used for test builds
2001 dnl whose behavior should not depend on what happens to be
2002 dnl installed on the local machine.
2003 dnl ========================================================
2004 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2005 [  --disable-system-extension-dirs
2006                           Disable searching system- and account-global
2007                           directories for extensions of any kind; use
2008                           only profile-specific extension directories],
2009   ENABLE_SYSTEM_EXTENSION_DIRS=,
2010   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2011 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2012   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2015 dnl ========================================================
2016 dnl = Universalchardet
2017 dnl ========================================================
2018 MOZ_ARG_DISABLE_BOOL(universalchardet,
2019 [  --disable-universalchardet
2020                           Disable universal encoding detection],
2021   MOZ_UNIVERSALCHARDET=,
2022   MOZ_UNIVERSALCHARDET=1 )
2024 dnl ========================================================
2025 dnl Gamepad support
2026 dnl ========================================================
2028 if test "$COMPILE_ENVIRONMENT" ; then
2030 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2031 if test "$OS_TARGET" = "Linux"; then
2032     MOZ_CHECK_HEADER([linux/joystick.h])
2033     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2034       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2035     fi
2038 fi # COMPILE_ENVIRONMENT
2041 dnl ========================================================
2042 dnl = Breakpad crash reporting (on by default on supported platforms)
2043 dnl ========================================================
2045 case $target in
2046 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
2047   MOZ_CRASHREPORTER=1
2048   ;;
2049 i?86-apple-darwin*|x86_64-apple-darwin*)
2050   if test -z "$MOZ_IOS"; then
2051     MOZ_CRASHREPORTER=1
2052   fi
2053   ;;
2054 *-android*|*-linuxandroid*)
2055   dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2056   dnl be before Linux condition
2057   MOZ_CRASHREPORTER=1
2058   ;;
2059 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2060   if test "$MOZ_ENABLE_GTK"; then
2061     MOZ_CRASHREPORTER=1
2062   fi
2063   ;;
2064 esac
2066 MOZ_ARG_DISABLE_BOOL(crashreporter,
2067 [  --disable-crashreporter Disable breakpad crash reporting],
2068     [MOZ_CRASHREPORTER=],
2069     [MOZ_CRASHREPORTER=F # Force enable breakpad])
2071 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
2072   if test "$MOZ_CRASHREPORTER" = F; then
2073     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2074   fi
2075   MOZ_CRASHREPORTER=
2078 if test -n "$MOZ_CRASHREPORTER"; then
2079    AC_DEFINE(MOZ_CRASHREPORTER)
2081   if test "$OS_TARGET" = "Linux" && \
2082     test -z "$SKIP_LIBRARY_CHECKS"; then
2083     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2084   fi
2086   if test "$OS_ARCH" = "WINNT"; then
2087     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2088       MOZ_CRASHREPORTER_INJECTOR=1
2089       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2090     fi
2091   fi
2094 dnl ========================================================
2095 dnl = Enable compilation of specific extension modules
2096 dnl ========================================================
2098 MOZ_ARG_ENABLE_STRING(extensions,
2099 [  --enable-extensions     Enable extensions],
2100 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2101     if test "$option" = "yes" -o "$option" = "all"; then
2102         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2103     elif test "$option" = "no" -o "$option" = "none"; then
2104         MOZ_EXTENSIONS=""
2105     elif test "$option" = "default"; then
2106         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2107     elif test `echo "$option" | grep -c \^-` != 0; then
2108         option=`echo $option | sed 's/^-//'`
2109         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2110     else
2111         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2112     fi
2113 done],
2114     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2116 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2117 dnl when trying to build a nonexistent extension.
2118 for extension in $MOZ_EXTENSIONS; do
2119     if test ! -d "${srcdir}/extensions/${extension}"; then
2120         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2121     fi
2122 done
2124 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2125   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2128 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2129 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2130 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2131    MOZ_ENABLE_CAIRO_FT=1
2132    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2133    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2134    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2137 AC_CHECK_PROGS(WGET, wget, "")
2138 AC_SUBST(WGET)
2140 dnl ========================================================
2141 dnl Updater
2142 dnl ========================================================
2144 if test "$MOZ_IOS"; then
2145   MOZ_UPDATER=
2148 MOZ_ARG_DISABLE_BOOL(updater,
2149 [  --disable-updater       Disable building of updater],
2150     MOZ_UPDATER=,
2151     MOZ_UPDATER=1 )
2153 if test -n "$MOZ_UPDATER"; then
2154     AC_DEFINE(MOZ_UPDATER)
2157 dnl ========================================================
2158 dnl parental controls (for Windows Vista)
2159 dnl ========================================================
2160 MOZ_ARG_DISABLE_BOOL(parental-controls,
2161 [  --disable-parental-controls
2162                           Do not build parental controls],
2163    MOZ_DISABLE_PARENTAL_CONTROLS=1,
2164    MOZ_DISABLE_PARENTAL_CONTROLS=)
2165 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2166     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2169 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2171 dnl ========================================================
2172 dnl = Disable smartcard support
2173 dnl ========================================================
2174 if test -n "$MOZ_NO_SMART_CARDS"; then
2175     AC_DEFINE(MOZ_NO_SMART_CARDS)
2177 AC_SUBST(MOZ_NO_SMART_CARDS)
2179 dnl ========================================================
2180 dnl = Sandboxing support
2181 dnl ========================================================
2182 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2183     # Bug 1182565: TSan conflicts with sandboxing on Linux.
2184     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2185     case $OS_TARGET in
2186     Linux|Android)
2187         MOZ_SANDBOX=
2188         ;;
2189     esac
2192 MOZ_ARG_DISABLE_BOOL(sandbox,
2193 [  --disable-sandbox        Disable sandboxing support],
2194     MOZ_SANDBOX=,
2195     MOZ_SANDBOX=1)
2197 case "$OS_TARGET" in
2198 WINNT|Darwin|OpenBSD)
2200 Linux)
2201     case $CPU_ARCH in
2202         x86_64|x86)
2203         ;;
2204         # Linux sandbox is only available on x86 and x86_64.
2205         *)
2206             MOZ_SANDBOX=
2207         ;;
2208     esac
2209     ;;
2211     # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2212     MOZ_SANDBOX=
2214 esac
2216 if test -n "$MOZ_SANDBOX"; then
2217     AC_DEFINE(MOZ_SANDBOX)
2220 AC_SUBST(MOZ_SANDBOX)
2223 dnl ========================================================
2224 dnl =
2225 dnl = Module specific options
2226 dnl =
2227 dnl ========================================================
2228 MOZ_ARG_HEADER(Individual module options)
2230 dnl ========================================================
2231 dnl Check for sqlite
2232 dnl ========================================================
2234 MOZ_SYSTEM_SQLITE=
2235 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2236 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
2237 MOZ_SYSTEM_SQLITE=1,
2238 MOZ_SYSTEM_SQLITE= )
2240 if test -n "$MOZ_SYSTEM_SQLITE"
2241 then
2242     dnl ============================
2243     dnl === SQLite Version check ===
2244     dnl ============================
2245     dnl Check to see if the system SQLite package is new enough.
2246     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2247 else
2248     dnl ==============================
2249     dnl === SQLite fdatasync check ===
2250     dnl ==============================
2251     dnl Check to see if fdatasync is available
2252     AC_CHECK_FUNC(fdatasync)
2255 if test -n "$MOZ_SYSTEM_SQLITE"; then
2256     AC_DEFINE(MOZ_SYSTEM_SQLITE)
2258 AC_SUBST(MOZ_SYSTEM_SQLITE)
2260 dnl ========================================================
2261 dnl = Disable zipwriter
2262 dnl ========================================================
2263 MOZ_ARG_DISABLE_BOOL(zipwriter,
2264 [  --disable-zipwriter     Disable zipwriter component],
2265     MOZ_ZIPWRITER=,
2266     MOZ_ZIPWRITER=1 )
2267 AC_SUBST(MOZ_ZIPWRITER)
2269 dnl ========================================================
2270 dnl =
2271 dnl = Feature options that require extra sources to be pulled
2272 dnl =
2273 dnl ========================================================
2274 dnl MOZ_ARG_HEADER(Features that require extra sources)
2276 dnl ========================================================
2277 dnl =
2278 dnl = Runtime debugging and Optimization Options
2279 dnl =
2280 dnl ========================================================
2281 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2283 dnl ========================================================
2284 dnl enable mobile optimizations
2285 dnl ========================================================
2286 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2287 [  --enable-mobile-optimize
2288                           Enable mobile optimizations],
2289     MOZ_GFX_OPTIMIZE_MOBILE=1)
2291 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2293 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2294     # We ignore paint will resample on mobile for performance.
2295     # We may want to revisit this later.
2296     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2298     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2299     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2302 dnl ========================================================
2303 dnl = Enable code optimization. ON by default.
2304 dnl ========================================================
2306 # Use value from moz.configure if one is defined. Else use our computed
2307 # value.
2308 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2309     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2312 if test "$COMPILE_ENVIRONMENT"; then
2313 if test -n "$MOZ_OPTIMIZE"; then
2314     AC_MSG_CHECKING([for valid C compiler optimization flags])
2315     _SAVE_CFLAGS=$CFLAGS
2316     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2317     AC_TRY_COMPILE([#include <stdio.h>],
2318         [printf("Hello World\n");],
2319         _results=yes,
2320         _results=no)
2321     AC_MSG_RESULT([$_results])
2322     if test "$_results" = "no"; then
2323         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2324     fi
2325     CFLAGS=$_SAVE_CFLAGS
2326     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2327         # When using llvm-based LTO, non numeric optimization levels are
2328         # not supported by the linker, so force the linker to use -O2 (
2329         # which doesn't influence the level compilation units are actually
2330         # compiled at).
2331         case " $MOZ_OPTIMIZE_FLAGS " in
2332         *\ -Os\ *|*\ -Oz\ *)
2333             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2334             ;;
2335         esac
2336     fi
2338 fi # COMPILE_ENVIRONMENT
2340 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2341 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2342 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2344 dnl ========================================================
2345 dnl = Enable runtime logging
2346 dnl ========================================================
2347 AC_DEFINE(MOZ_LOGGING)
2348 AC_DEFINE(FORCE_PR_LOG)
2350 dnl ========================================================
2351 dnl = This will enable logging of addref, release, ctor, dtor.
2352 dnl ========================================================
2353 _ENABLE_LOGREFCNT=42
2354 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2355 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
2356     _ENABLE_LOGREFCNT=1,
2357     _ENABLE_LOGREFCNT= )
2358 if test "$_ENABLE_LOGREFCNT" = "1"; then
2359     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2360 elif test -z "$_ENABLE_LOGREFCNT"; then
2361     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2364 dnl ========================================================
2365 dnl moz_dump_painting
2366 dnl ========================================================
2367 MOZ_ARG_ENABLE_BOOL(dump-painting,
2368 [  --enable-dump-painting          Enable paint debugging.],
2369     MOZ_DUMP_PAINTING=1,
2370     MOZ_DUMP_PAINTING= )
2371 if test -n "$MOZ_DUMP_PAINTING"; then
2372     AC_DEFINE(MOZ_DUMP_PAINTING)
2373     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2375 if test -n "$MOZ_DEBUG"; then
2376     AC_DEFINE(MOZ_DUMP_PAINTING)
2379 case "${OS_TARGET}" in
2380 Android|WINNT|Darwin)
2381   MOZ_GLUE_IN_PROGRAM=
2382   ;;
2384   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2385   MOZ_GLUE_IN_PROGRAM=1
2386   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2387   ;;
2388 esac
2390 dnl ========================================================
2391 dnl = Jemalloc build setup
2392 dnl ========================================================
2393 if test -z "$MOZ_MEMORY"; then
2394   case "${target}" in
2395     *-mingw*)
2396       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2397         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.])
2398       fi
2399       ;;
2400   esac
2401 else
2402   dnl The generic feature tests that determine how to compute ncpus are long and
2403   dnl complicated.  Therefore, simply define special cpp variables for the
2404   dnl platforms we have special knowledge of.
2405   case "${target}" in
2406   *-mingw*)
2407     export MOZ_NO_DEBUG_RTL=1
2408     ;;
2409   esac
2410 fi # MOZ_MEMORY
2411 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2413 dnl ========================================================
2414 dnl = Enable using the clang plugin to build
2415 dnl ========================================================
2417 if test -n "$COMPILE_ENVIRONMENT"; then
2418 MOZ_CONFIG_CLANG_PLUGIN
2419 fi # COMPILE_ENVIRONMENT
2421 dnl ========================================================
2422 dnl = Enable stripping of libs & executables
2423 dnl ========================================================
2424 MOZ_ARG_ENABLE_BOOL(strip,
2425 [  --enable-strip          Enable stripping of libs & executables ],
2426     ENABLE_STRIP=1,
2427     ENABLE_STRIP= )
2429 dnl ========================================================
2430 dnl = Enable stripping of libs & executables when packaging
2431 dnl ========================================================
2432 MOZ_ARG_ENABLE_BOOL(install-strip,
2433 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
2434     PKG_SKIP_STRIP= ,
2435     PKG_SKIP_STRIP=1)
2437 dnl ========================================================
2438 dnl = frontend JS debug mode
2439 dnl ========================================================
2441 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2442 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
2443    DEBUG_JS_MODULES=1,
2444    DEBUG_JS_MODULES=)
2446 AC_SUBST(DEBUG_JS_MODULES)
2448 dnl ========================================================
2449 dnl =
2450 dnl = Profiling and Instrumenting
2451 dnl =
2452 dnl ========================================================
2453 MOZ_ARG_HEADER(Profiling and Instrumenting)
2455 dnl ========================================================
2456 dnl = Offer a way to disable the startup cache
2457 dnl ========================================================
2459 MOZ_ARG_DISABLE_BOOL(startupcache,
2460 [  --disable-startupcache          Disable startup cache ],
2461     MOZ_DISABLE_STARTUPCACHE=1,
2462     MOZ_DISABLE_STARTUPCACHE=)
2464 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2465   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2467 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2469 dnl ========================================================
2470 dnl = Support for demangling undefined symbols
2471 dnl ========================================================
2472 if test -z "$SKIP_LIBRARY_CHECKS"; then
2473     AC_LANG_SAVE
2474     AC_LANG_CPLUSPLUS
2475     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2476     AC_LANG_RESTORE
2479 # Demangle only for debug or DMD builds
2480 MOZ_DEMANGLE_SYMBOLS=
2481 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2482     MOZ_DEMANGLE_SYMBOLS=1
2483     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2485 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2487 dnl ========================================================
2488 dnl = Support for gcc stack unwinding (from gcc 3.3)
2489 dnl ========================================================
2490 if test -z "$SKIP_LIBRARY_CHECKS"; then
2491     AC_LANG_SAVE
2492     AC_LANG_CPLUSPLUS
2493     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2494     AC_LANG_RESTORE
2497 dnl ========================================================
2498 dnl JIT observers
2499 dnl ========================================================
2501 MOZ_ARG_WITH_STRING(jitreport-granularity,
2502 [  --jitreport-granularity=N
2503                            Default granularity at which to report JIT code
2504                            to external tools
2505                              0 - no info
2506                              1 - code ranges for whole functions only
2507                              2 - per-line information
2508                              3 - per-op information],
2509   JITREPORT_GRANULARITY=$withval,
2510   JITREPORT_GRANULARITY=3)
2512 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2514 dnl ========================================================
2515 dnl =
2516 dnl = Misc. Options
2517 dnl =
2518 dnl ========================================================
2519 MOZ_ARG_HEADER(Misc. Options)
2521 dnl ========================================================
2522 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2523 dnl ========================================================
2524 MOZ_ARG_WITH_STRING(user-appdir,
2525 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
2526 [ val=`echo $withval`
2527 if echo "$val" | grep "\/" >/dev/null; then
2528     AC_MSG_ERROR("Homedir must be single relative path.")
2529 else
2530     MOZ_USER_DIR="$val"
2531 fi])
2533 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2535 if test -z "$SKIP_COMPILER_CHECKS"; then
2536 dnl ========================================================
2537 dnl =
2538 dnl = Compiler Options
2539 dnl =
2540 dnl ========================================================
2541 MOZ_ARG_HEADER(Compiler Options)
2543 dnl ========================================================
2544 dnl Check for gcc -pipe support
2545 dnl ========================================================
2546 AC_MSG_CHECKING([for -pipe support])
2547 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2548     dnl Any gcc that supports firefox supports -pipe.
2549     CFLAGS="$CFLAGS -pipe"
2550     CXXFLAGS="$CXXFLAGS -pipe"
2551     AC_MSG_RESULT([yes])
2552 else
2553     AC_MSG_RESULT([no])
2556 fi # ! SKIP_COMPILER_CHECKS
2558 AC_LANG_C
2560 if test "$COMPILE_ENVIRONMENT"; then
2561 MOZ_EXPAND_LIBS
2562 fi # COMPILE_ENVIRONMENT
2564 dnl ========================================================
2565 dnl =
2566 dnl = Static Build Options
2567 dnl =
2568 dnl ========================================================
2569 MOZ_ARG_HEADER(Static build options)
2571 if test -z "$MOZ_SYSTEM_ZLIB"; then
2572 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
2573   ZLIB_IN_MOZGLUE=1
2574   AC_DEFINE(ZLIB_IN_MOZGLUE)
2578 AC_SUBST(ZLIB_IN_MOZGLUE)
2580 dnl ========================================================
2581 dnl =
2582 dnl = Standalone module options
2583 dnl =
2584 dnl ========================================================
2585 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2587 dnl Check for GLib.
2588 dnl ========================================================
2590 if test -z "$SKIP_PATH_CHECKS"; then
2591 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2592     if test "$MOZ_ENABLE_GTK" ; then
2593         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2594     fi
2598 if test -z "${GLIB_GMODULE_LIBS}" \
2599    -a -n "${GLIB_CONFIG}"\
2600     -a "${GLIB_CONFIG}" != no\
2601 ; then
2602     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2605 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2607 if test "$USE_FC_FREETYPE"; then
2608     if test "$COMPILE_ENVIRONMENT"; then
2609         dnl ========================================================
2610         dnl = Check for freetype2 functionality
2611         dnl ========================================================
2612         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2613             _SAVE_LIBS="$LIBS"
2614             _SAVE_CFLAGS="$CFLAGS"
2615             LIBS="$LIBS $FT2_LIBS"
2616             CFLAGS="$CFLAGS $FT2_CFLAGS"
2618             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2619                 ac_cv_member_FT_Bitmap_Size_y_ppem,
2620                 [AC_TRY_COMPILE([#include <ft2build.h>
2621                                  #include FT_FREETYPE_H],
2622                                 [FT_Bitmap_Size s;
2623                                  if (sizeof s.y_ppem) return 0;
2624                                  return 1],
2625                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2626                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2627             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2628                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2629             else
2630                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2631             fi
2632             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2633                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2634                                [FT_Bitmap_Size structure includes y_ppem field])
2636             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2638             LIBS="$_SAVE_LIBS"
2639             CFLAGS="$_SAVE_CFLAGS"
2640         fi
2642         _SAVE_CPPFLAGS="$CPPFLAGS"
2643         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2644         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2645             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2646         CPPFLAGS="$_SAVE_CPPFLAGS"
2647     fi
2650 dnl ========================================================
2651 dnl Check if we need the 32-bit Linux SSE2 error dialog
2652 dnl ========================================================
2654 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2656 dnl ========================================================
2657 dnl Check for pixman and cairo
2658 dnl ========================================================
2660 MOZ_TREE_CAIRO=1
2661 MOZ_ARG_ENABLE_BOOL(system-cairo,
2662 [ --enable-system-cairo  Obsolete: do not use this option],
2663 AC_MSG_ERROR(--enable-system-cairo is not supported),
2664 MOZ_TREE_CAIRO=1 )
2666 MOZ_TREE_PIXMAN=1
2667 MOZ_ARG_ENABLE_BOOL(system-pixman,
2668 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2669 MOZ_TREE_PIXMAN=,
2670 MOZ_TREE_PIXMAN=force,
2671 MOZ_TREE_PIXMAN=1 )
2673 if test "$MOZ_TREE_PIXMAN"; then
2674     AC_DEFINE(MOZ_TREE_PIXMAN)
2675 else
2676     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2679 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2680 AC_DEFINE(MOZ_TREE_CAIRO)
2682 if test "$OS_ARCH" = "WINNT"; then
2683     # For now we assume that we will have a uint64_t available through
2684     # one of the above headers or mozstdint.h.
2685     AC_DEFINE(HAVE_UINT64_T)
2688 # Define macros for cairo-features.h
2689 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2690 if test "$MOZ_X11"; then
2691     XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2692     XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2693     PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2695 if test "$_HAVE_FREETYPE2"; then
2696     FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2697     MOZ_ENABLE_CAIRO_FT=1
2698     CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2701 case "$MOZ_WIDGET_TOOLKIT" in
2702   cocoa | uikit)
2703     QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2704     QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2705     QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2706     ;;
2707   windows)
2708     WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2709     WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2710     WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2712     if test "$COMPILE_ENVIRONMENT"; then
2713       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2714     fi
2715     ;;
2716 esac
2717 if test "$USE_FC_FREETYPE"; then
2718     FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2720 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2721 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2723 AC_SUBST(PS_SURFACE_FEATURE)
2724 AC_SUBST(SVG_SURFACE_FEATURE)
2725 AC_SUBST(XLIB_SURFACE_FEATURE)
2726 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2727 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2728 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2729 AC_SUBST(WIN32_SURFACE_FEATURE)
2730 AC_SUBST(OS2_SURFACE_FEATURE)
2731 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2732 AC_SUBST(FT_FONT_FEATURE)
2733 AC_SUBST(FC_FONT_FEATURE)
2734 AC_SUBST(WIN32_FONT_FEATURE)
2735 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2736 AC_SUBST(QUARTZ_FONT_FEATURE)
2737 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2738 AC_SUBST(QT_SURFACE_FEATURE)
2739 AC_SUBST(TEE_SURFACE_FEATURE)
2741 if test "$MOZ_X11"; then
2742     MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2745 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2747 case "$MOZ_WIDGET_TOOLKIT" in
2748 android)
2749     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2750     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2751     ;;
2752 esac
2754 AC_SUBST(MOZ_TREE_CAIRO)
2755 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2756 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2757 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2758 AC_SUBST(MOZ_TREE_PIXMAN)
2760 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2761 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2762 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2763 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2765 dnl ========================================================
2766 dnl disable xul
2767 dnl ========================================================
2768 MOZ_ARG_DISABLE_BOOL(xul,
2769 [  --disable-xul           Disable XUL],
2770     MOZ_XUL= )
2771 if test "$MOZ_XUL"; then
2772   AC_DEFINE(MOZ_XUL)
2773 else
2774   dnl remove extensions that require XUL
2775   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2778 AC_SUBST(MOZ_XUL)
2780 dnl ========================================================
2781 dnl necko configuration options
2782 dnl ========================================================
2785 dnl option to disable necko's wifi scanner
2788 if test "$MOZ_WIDGET_TOOLKIT"; then
2790   case "$OS_TARGET" in
2791     Darwin)
2792       if test -z "$MOZ_IOS"; then
2793         NECKO_WIFI=1
2794       fi
2795       ;;
2796     DragonFly|FreeBSD|WINNT)
2797       NECKO_WIFI=1
2798       ;;
2799     Linux)
2800       NECKO_WIFI=1
2801       NECKO_WIFI_DBUS=1
2802       ;;
2803   esac
2807 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2808 [  --disable-necko-wifi    Disable necko wifi scanner],
2809     NECKO_WIFI=,
2810     NECKO_WIFI=1)
2812 if test "$NECKO_WIFI"; then
2813   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2814     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2815   fi
2816   AC_DEFINE(NECKO_WIFI)
2817   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2819 AC_SUBST(NECKO_WIFI)
2820 AC_SUBST(NECKO_WIFI_DBUS)
2823 dnl option to disable cookies
2825 MOZ_ARG_DISABLE_BOOL(cookies,
2826 [  --disable-cookies       Disable cookie support],
2827     NECKO_COOKIES=,
2828     NECKO_COOKIES=1)
2829 AC_SUBST(NECKO_COOKIES)
2830 if test "$NECKO_COOKIES"; then
2831     AC_DEFINE(NECKO_COOKIES)
2832     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2835 dnl ========================================================
2836 dnl =
2837 dnl = Maintainer debug option (no --enable equivalent)
2838 dnl =
2839 dnl ========================================================
2841 AC_SUBST(NM)
2842 AC_SUBST_LIST(ASFLAGS)
2843 AC_SUBST(RCFLAGS)
2844 AC_SUBST(IMPLIB)
2845 AC_SUBST(FILTER)
2846 AC_SUBST(MOZ_AUTH_EXTENSION)
2847 AC_SUBST(MOZ_PREF_EXTENSIONS)
2848 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2849 AC_SUBST_LIST(WARNINGS_CFLAGS)
2850 AC_SUBST_SET(MOZ_EXTENSIONS)
2852 AC_SUBST(MOZ_UNIVERSALCHARDET)
2853 AC_SUBST(MOZ_SPELLCHECK)
2854 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2855 AC_SUBST(MOZ_CRASHREPORTER)
2856 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2857 AC_SUBST(MOZ_STUB_INSTALLER)
2858 AC_SUBST(MOZ_UPDATER)
2860 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2861 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2862 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2863 AC_SUBST(ENABLE_STRIP)
2864 AC_SUBST(PKG_SKIP_STRIP)
2865 AC_SUBST(STRIP_FLAGS)
2866 AC_SUBST(INCREMENTAL_LINKER)
2868 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2870 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2871 AC_SUBST(MOZ_LINKER_EXTRACT)
2873 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2874   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2877 AC_SUBST(MOZ_REQUIRE_SIGNING)
2878 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2879   AC_DEFINE(MOZ_REQUIRE_SIGNING)
2882 dnl ========================================================
2883 dnl = Mac bundle name prefix
2884 dnl ========================================================
2885 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2886 [  --with-macbundlename-prefix=prefix
2887                           Prefix for MOZ_MACBUNDLE_NAME],
2888 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2890 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2891 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2892   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2895 if test "$MOZ_DEBUG"; then
2896   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2897 else
2898   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2900 AC_SUBST(MOZ_MACBUNDLE_NAME)
2902 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2903 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2904 # Otherwise, use MOZ_APP_DISPLAYNAME
2905 if test -z "$MOZ_MACBUNDLE_ID"; then
2906    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2908 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2909 if test "$MOZ_DEBUG"; then
2910   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2913 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2914 AC_SUBST(MOZ_MACBUNDLE_ID)
2916 dnl ========================================================
2917 dnl = Child Process Name for IPC
2918 dnl ========================================================
2919 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2920   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2921 else
2922   # We want to let Android unpack the file at install time, but it only does
2923   # so if the file is named libsomething.so. The lib/ path is also required
2924   # because the unpacked file will be under the lib/ subdirectory and will
2925   # need to be executed from that path.
2926   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2928 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2929 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2931 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2932 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2933 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2935 # The following variables are available to branding and application
2936 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2937 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2938 # impacts profile location and user-visible fields.
2939 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2940 # versions of a given application (e.g. Aurora and Firefox both use
2941 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2942 # for application.ini's "Name" field, which controls profile location in
2943 # the absence of a "Profile" field (see below), and various system
2944 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2945 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2946 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2947 # builds (e.g. Aurora for Firefox).
2948 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2949 # defaults to a lowercase form of MOZ_APP_BASENAME.
2950 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2951 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2952 # - MOZ_APP_PROFILE: When set, used for application.ini's
2953 # "Profile" field, which controls profile location.
2954 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2955 # crash reporter server url.
2956 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
2957 # the main application is set to the value of this variable.  If not
2958 # set, it falls back to a Mozilla-specific value derived from the
2959 # build ID.
2960 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
2961 # packages produced.
2962 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used.  GCM
2963 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
2964 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
2965 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2967 # The following environment variables used to have an effect, but don't anymore:
2968 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2969 # the contents from the version.txt file in the application directory, or
2970 # browser/config/version.txt if there isn't one.
2971 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2972 # in the "About" window. This was replaced with the contents from the
2973 # version_display.txt or version.txt in the application directory, or
2974 # browser/config/version_display.txt.
2976 if test -z "$MOZ_APP_NAME"; then
2977    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2980 if test -z "$MOZ_APP_REMOTINGNAME"; then
2981    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2984 if test -z "$ANDROID_PACKAGE_NAME" ; then
2985    # When we got rid of the Aurora channel we decided to replace the old
2986    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2987    # by all mozilla-central based branches we make this the new "default"
2988    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2989    # in their mozconfig, so they will never get this. If there are ever
2990    # non-Fennec builds for Android, they will fall into the else block
2991    # and use their own default name.
2992    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2993    # background on this.
2994    if test "$MOZ_APP_NAME" = "fennec"; then
2995       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2996    else
2997       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2998    fi
3001 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
3002 # the public with specific common shared IDs and we need to keep them
3003 # consistent forever.  The specific common values are set by per-channel
3004 # branding; all other channels use a generic sharedID, set below.
3005 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
3006    MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
3009 # For extensions and langpacks, we require a max version that is compatible
3010 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
3011 # 24.0a1 and 24.0a2 aren't affected
3012 # 24.0 becomes 24.*
3013 # 24.1.1 becomes 24.*
3014 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3015 if test -z "$IS_ALPHA"; then
3016   changequote(,)
3017   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3018     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3019   else
3020     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3021   fi
3022   changequote([,])
3023 else
3024   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3027 AC_SUBST(MOZ_APP_NAME)
3028 AC_SUBST(MOZ_APP_REMOTINGNAME)
3029 AC_SUBST(MOZ_APP_DISPLAYNAME)
3030 AC_SUBST(MOZ_APP_BASENAME)
3031 AC_SUBST(MOZ_APP_VENDOR)
3032 AC_SUBST(MOZ_APP_PROFILE)
3033 AC_SUBST(MOZ_APP_ID)
3034 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3035 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3036 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3037 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3038 AC_SUBST(MAR_CHANNEL_ID)
3039 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3040 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3041 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3042 AC_SUBST(MOZ_APP_UA_NAME)
3043 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3044 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3045 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3047 AC_SUBST(MOZ_APP_MAXVERSION)
3048 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3049 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3050   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3053 AC_SUBST(MOZ_PKG_SPECIAL)
3054 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3056 if test "$MOZILLA_OFFICIAL"; then
3057     # Build revisions should always be present in official builds
3058     MOZ_INCLUDE_SOURCE_INFO=1
3061 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3062 # explicitly set the repository and changeset information in.
3063 AC_SUBST(MOZ_SOURCE_REPO)
3064 AC_SUBST(MOZ_SOURCE_CHANGESET)
3065 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3067 dnl If we have any service that uploads data (and requires data submission
3068 dnl policy alert), set MOZ_DATA_REPORTING.
3069 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3070 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"  || test -n "$MOZ_NORMANDY"; then
3071   MOZ_DATA_REPORTING=1
3072   AC_DEFINE(MOZ_DATA_REPORTING)
3073   AC_SUBST(MOZ_DATA_REPORTING)
3076 dnl win32 options
3077 AC_SUBST(WIN32_REDIST_DIR)
3078 AC_SUBST(WIN_UCRT_REDIST_DIR)
3080 dnl ========================================================
3081 dnl ICU Support
3082 dnl ========================================================
3084 _INTL_API=yes
3086 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3087     USE_ICU=1
3090 MOZ_CONFIG_ICU()
3092 dnl Echo the CFLAGS to remove extra whitespace.
3093 CFLAGS=`echo \
3094     $_COMPILATION_CFLAGS \
3095     $CFLAGS`
3097 CXXFLAGS=`echo \
3098     $_WARNINGS_CXXFLAGS \
3099     $_COMPILATION_CXXFLAGS \
3100     $CXXFLAGS`
3102 COMPILE_CFLAGS=`echo \
3103     $_DEFINES_CFLAGS \
3104     $COMPILE_CFLAGS`
3106 COMPILE_CXXFLAGS=`echo \
3107     $_DEFINES_CXXFLAGS \
3108     $COMPILE_CXXFLAGS`
3110 HOST_CFLAGS=`echo \
3111     $_WARNINGS_HOST_CFLAGS \
3112     $_COMPILATION_HOST_CFLAGS \
3113     $HOST_CFLAGS`
3115 HOST_CXXFLAGS=`echo \
3116     $_WARNINGS_HOST_CXXFLAGS \
3117     $_COMPILATION_HOST_CXXFLAGS \
3118     $HOST_CXXFLAGS`
3120 AC_SUBST(MOZ_SYSTEM_PNG)
3122 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3123 AC_SUBST_LIST(MOZ_PNG_LIBS)
3125 AC_SUBST(MOZ_SYSTEM_NSPR)
3127 AC_SUBST(MOZ_SYSTEM_NSS)
3129 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3130 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3131 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3132 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3133 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3134   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3135   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3137 AC_SUBST(HOST_CMFLAGS)
3138 AC_SUBST(HOST_CMMFLAGS)
3139 AC_SUBST(OS_COMPILE_CMFLAGS)
3140 AC_SUBST(OS_COMPILE_CMMFLAGS)
3142 OS_CFLAGS="$CFLAGS"
3143 OS_CXXFLAGS="$CXXFLAGS"
3144 OS_CPPFLAGS="$CPPFLAGS"
3145 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3146 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3147 OS_LDFLAGS="$LDFLAGS"
3148 OS_LIBS="$LIBS"
3149 AC_SUBST_LIST(OS_CFLAGS)
3150 AC_SUBST_LIST(OS_CXXFLAGS)
3151 AC_SUBST_LIST(OS_CPPFLAGS)
3152 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3153 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3154 AC_SUBST_LIST(OS_LDFLAGS)
3155 AC_SUBST(OS_LIBS)
3157 AC_SUBST(HOST_CC)
3158 AC_SUBST(HOST_CXX)
3159 AC_SUBST_LIST(HOST_CFLAGS)
3160 AC_SUBST_LIST(HOST_CPPFLAGS)
3161 AC_SUBST_LIST(HOST_CXXFLAGS)
3162 AC_SUBST(HOST_LDFLAGS)
3163 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3164 AC_SUBST(HOST_BIN_SUFFIX)
3166 AC_SUBST(TARGET_XPCOM_ABI)
3167 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3168 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3169 AC_SUBST(HAVE_X86_AVX2)
3170 AC_SUBST(HAVE_ALTIVEC)
3172 AC_SUBST_LIST(DSO_CFLAGS)
3173 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3174 AC_SUBST(DSO_LDOPTS)
3175 AC_SUBST(BIN_SUFFIX)
3176 AC_SUBST(USE_N32)
3177 AC_SUBST(NS_ENABLE_TSF)
3178 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3179 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3181 AC_SUBST(MOZ_DEVTOOLS)
3183 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3184 AC_SUBST(MOZ_FOLD_LIBS)
3185 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3187 AC_SUBST(DMG_TOOL)
3189 dnl Host JavaScript runtime, if any, to use during cross compiles.
3190 AC_SUBST(JS_BINARY)
3192 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3194 if test -n "$COMPILE_ENVIRONMENT"; then
3195 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3197 dnl Check for missing components
3198 if test "$MOZ_X11"; then
3199     dnl ====================================================
3200     dnl = Check if X headers exist
3201     dnl ====================================================
3202     _SAVE_CFLAGS=$CFLAGS
3203     CFLAGS="$CFLAGS $XCFLAGS"
3204     AC_TRY_COMPILE([
3205         #include <stdio.h>
3206         #include <stdlib.h>
3207         #include <X11/Xlib.h>
3208         #include <X11/Intrinsic.h>
3209         #include <X11/extensions/XShm.h>
3210     ],
3211     [
3212         Display *dpy = 0;
3213         if ((dpy = XOpenDisplay(NULL)) == NULL) {
3214             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3215             exit(1);
3216         }
3217     ], [],
3218     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3219     CFLAGS="$_SAVE_CFLAGS"
3221     if test -n "$MISSING_X"; then
3222         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3223     fi
3225 fi # MOZ_X11
3227 fi # COMPILE_ENVIRONMENT
3229 dnl Set various defines and substitutions
3230 dnl ========================================================
3232 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3233     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3234     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3235     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3236     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3237     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3238     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3239     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3240     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3243 AC_SUBST(MOZ_DEV_EDITION)
3244 if test -n "$MOZ_DEV_EDITION"; then
3245     AC_DEFINE(MOZ_DEV_EDITION)
3248 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3249     A11Y_LOG=1
3251 AC_SUBST(A11Y_LOG)
3252 if test -n "$A11Y_LOG"; then
3253     AC_DEFINE(A11Y_LOG)
3256 dnl Spit out some output
3257 dnl ========================================================
3259 dnl The following defines are used by xpcom
3260 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3261 HAVE_GETPAGESIZE
3262 HAVE_STATVFS64
3263 HAVE_STATVFS
3264 HAVE_STATFS64
3265 HAVE_STATFS
3266 HAVE_SYS_STATVFS_H
3267 HAVE_SYS_STATFS_H
3268 HAVE_SYS_VFS_H
3269 HAVE_SYS_MOUNT_H
3272 # Avoid using obsolete NSPR features
3273 AC_DEFINE(NO_NSPR_10_SUPPORT)
3275 MOZ_CREATE_CONFIG_STATUS()
3277 rm -fr confdefs* $ac_clean_files