Bug 1550804 - Add color scheme simulation to the inspector. r=pbro
[gecko.git] / old-configure.in
blob07e83a668bee921d8e6e7436732426eb7a2f0861
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.30.1
68 dnl Set various checks
69 dnl ========================================================
70 MISSING_X=
72 dnl Initialize the Pthread test variables early so they can be
73 dnl  overridden by each platform.
74 dnl ========================================================
75 MOZ_USE_PTHREADS=
76 _PTHREAD_LDFLAGS=""
78 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
80 if test "$COMPILE_ENVIRONMENT"; then
81     MOZ_ANDROID_NDK
82 fi # COMPILE_ENVIRONMENT
84 case "$target" in
85 *-android*|*-linuxandroid*)
86     ;;
87 *-linux*)
88     AC_PATH_PROG(OBJCOPY,objcopy)
89     ;;
90 esac
92 case "$target" in
93 *-apple-darwin*)
94     MOZ_IOS_SDK
95     ;;
96 esac
98 AC_SUBST(ANDROID_PACKAGE_NAME)
99 AC_SUBST(OBJCOPY)
101 dnl ========================================================
102 dnl Checks for compilers.
103 dnl ========================================================
105 if test "$COMPILE_ENVIRONMENT"; then
107 if test "$target" != "$host"; then
108     MOZ_CROSS_COMPILER
109 else
110     AC_PROG_CC
111     case "$target" in
112     *-mingw*)
113       # Work around the conftest.exe access problem on Windows
114       sleep 2
115     esac
116     AC_PROG_CXX
117     AC_PROG_RANLIB
118     MOZ_PATH_PROGS(AS, $AS as, $CC)
119     AC_CHECK_PROGS(STRIP, strip, :)
120     AC_CHECK_PROGS(OTOOL, otool, :)
123 if test -n "$MOZ_WINCONSOLE"; then
124     AC_DEFINE(MOZ_WINCONSOLE)
127 MOZ_TOOL_VARIABLES
129 dnl ========================================================
130 dnl Special win32 checks
131 dnl ========================================================
133 WINVER=601
135 case "$target" in
136 *-mingw*)
137     if test "$GCC" != "yes"; then
138         # Check to see if we are really running in a msvc environemnt
139         _WIN32_MSVC=1
141         # Make sure compilers are valid
142         CFLAGS="$CFLAGS -nologo"
143         CXXFLAGS="$CXXFLAGS -TP -nologo"
144         AC_LANG_SAVE
145         AC_LANG_C
146         AC_TRY_COMPILE([#include <stdio.h>],
147             [ printf("Hello World\n"); ],,
148             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
150         AC_LANG_CPLUSPLUS
151         AC_TRY_COMPILE([#include <new.h>],
152             [ unsigned *test = new unsigned(42); ],,
153             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
154         AC_LANG_RESTORE
156         changequote(,)
157         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
158         changequote([,])
160         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
161         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
162         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
164         _CC_SUITE=14
165         MSVC_C_RUNTIME_DLL=vcruntime140.dll
166         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
168         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
169         CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
171         if test -n "$WIN_UCRT_REDIST_DIR"; then
172           if test ! -d "$WIN_UCRT_REDIST_DIR"; then
173             AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
174           fi
175           WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
176         fi
178         AC_SUBST(MSVC_C_RUNTIME_DLL)
179         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
181         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
183         if test -n "$WIN32_REDIST_DIR"; then
184           if test ! -d "$WIN32_REDIST_DIR"; then
185             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
186           fi
187           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
188         fi
190         # Check linker version, except in lld builds
191         case "$LINKER" in
192         *lld*)
193             ;;
194         *)
195             _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
196             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
197             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
198                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
199             fi
200             ;;
201         esac
203         INCREMENTAL_LINKER=1
205         unset _MSVC_VER_FILTER
207         WRAP_STL_INCLUDES=1
208         STL_FLAGS="-I${DIST}/stl_wrappers"
209         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
210         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
211     else
212         # Check w32api version
213         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
214         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
215         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
216         AC_TRY_COMPILE([#include <w32api.h>],
217             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
218                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
219                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
220                 #error "test failed."
221             #endif
222             , [ res=yes ], [ res=no ])
223         AC_MSG_RESULT([$res])
224         if test "$res" != "yes"; then
225             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
226         fi
227         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
228         # causing problems with local implementations with the same name.
229         AC_DEFINE(STRSAFE_NO_DEPRECATE)
230     fi # !GNU_CC
232     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
233     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
234     # Require OS features provided by IE 8.0 (Win7)
235     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
237     ;;
238 esac
240 if test -n "$_WIN32_MSVC"; then
241     SKIP_PATH_CHECKS=1
242     SKIP_COMPILER_CHECKS=1
243     SKIP_LIBRARY_CHECKS=1
245     # Since we're skipping compiler and library checks, hard-code
246     # some facts here.
247     AC_DEFINE(HAVE_IO_H)
248     AC_DEFINE(HAVE_ISATTY)
251 fi # COMPILE_ENVIRONMENT
253 AC_SUBST(GNU_CC)
254 AC_SUBST(GNU_CXX)
256 AC_SUBST_LIST(STL_FLAGS)
257 AC_SUBST(WRAP_STL_INCLUDES)
259 dnl ========================================================
260 dnl Checks for programs.
261 dnl ========================================================
262 if test "$COMPILE_ENVIRONMENT"; then
264 AC_PATH_XTRA
266 XCFLAGS="$X_CFLAGS"
268 fi # COMPILE_ENVIRONMENT
270 dnl ========================================================
271 dnl set the defaults first
272 dnl ========================================================
273 MOZ_USER_DIR=".mozilla"
275 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
277 MOZ_FS_LAYOUT=unix
279 dnl Configure platform-specific CPU architecture compiler options.
280 dnl ==============================================================
281 if test "$COMPILE_ENVIRONMENT"; then
282     MOZ_ARCH_OPTS
283 fi # COMPILE_ENVIRONMENT
285 dnl ========================================================
286 dnl Android libstdc++
287 dnl ========================================================
289 MOZ_ANDROID_CPU_ARCH
290 if test "$COMPILE_ENVIRONMENT"; then
291     MOZ_ANDROID_STLPORT
292 fi # COMPILE_ENVIRONMENT
294 dnl ========================================================
295 dnl Suppress Clang Argument Warnings
296 dnl ========================================================
297 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
298 if test -n "${CLANG_CC}${CLANG_CL}"; then
299     WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
300     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
302 if test -n "${CLANG_CXX}${CLANG_CL}"; then
303     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
306 if test -n "$COMPILE_ENVIRONMENT"; then
307    MOZ_CONFIG_SANITIZE
310 dnl ========================================================
311 dnl 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         # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
649         if test -z "$CLANG_CC"; then
650             AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
651         fi
653         DSO_LDOPTS='-shared'
654         # Use temp file for windres (bug 213281)
655         RCFLAGS='-O coff --use-temp-file'
656         # mingw doesn't require kernel32, user32, and advapi32 explicitly
657         LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
658         MOZ_FIX_LINK_PATHS=
660         MOZ_OPTIMIZE_FLAGS="-O2"
662         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
663         WIN32_GUI_EXE_LDFLAGS=-mwindows
665         # Silence problematic clang warnings
666         CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
667     else
668         TARGET_COMPILER_ABI=msvc
669         RANLIB='echo not_ranlib'
670         STRIP='echo not_strip'
671         PKG_SKIP_STRIP=1
672         # aarch64 doesn't support subsystems below 6.02
673         if test "$CPU_ARCH" = "aarch64"; then
674             WIN32_SUBSYSTEM_VERSION=6.02
675         else
676             WIN32_SUBSYSTEM_VERSION=6.01
677         fi
678         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
679         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
680         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
681         _USE_CPP_INCLUDE_FLAG=1
682         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
683         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
684         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
685         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
686         if test -z "$CLANG_CL"; then
687             CPPFLAGS="$CPPFLAGS -utf-8"
688         fi
689         if test "$CPU_ARCH" = "x86"; then
690             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
691             dnl more recent, so set that explicitly here unless another
692             dnl target arch has already been set.
693             changequote(,)
694             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
695               CFLAGS="$CFLAGS -arch:SSE2"
696             fi
697             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
698               CXXFLAGS="$CXXFLAGS -arch:SSE2"
699             fi
700             changequote([,])
701             SSE_FLAGS="-arch:SSE"
702             SSE2_FLAGS="-arch:SSE2"
703             dnl MSVC allows the use of intrinsics without any flags
704             dnl and doesn't have a separate arch for SSSE3
705             SSSE3_FLAGS="-arch:SSE2"
706         fi
707         dnl clang-cl requires appropriate flags to enable SSSE3 support
708         dnl on all architectures.
709         if test -n "$CLANG_CL"; then
710             SSSE3_FLAGS="-mssse3"
711         fi
712         dnl VS2013+ supports -Gw for better linker optimizations.
713         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
714         dnl Disabled on ASan because it causes false-positive ODR violations.
715         if test -z "$MOZ_ASAN"; then
716             CFLAGS="$CFLAGS -Gw"
717             CXXFLAGS="$CXXFLAGS -Gw"
718         else
719             # String tail merging doesn't play nice with ASan's ODR checker.
720             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
721         fi
722         if test -n "$CLANG_CL"; then
723             # XXX We should combine some of these with our generic GCC-style
724             # warning checks.
725             #
726             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
727             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
728             # We use offsetof on non-POD objects all the time.
729             # We also suppress this warning on other platforms.
730             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
731             # This warns for reasonable things like:
732             #   enum { X = 0xffffffffU };
733             # which is annoying for IDL headers.
734             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
735             # This warns for cases that would be reached by the Microsoft
736             # #include rules, but also currently warns on cases that would
737             # *also* be reached by standard C++ include rules.  That
738             # behavior doesn't seem useful, so we turn it off.
739             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
740             # We normally error out on unknown pragmas, but since clang-cl
741             # claims to be MSVC, it would be difficult to add
742             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
743             # use such pragmas, so just ignore them.
744             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
745             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
746             # We get errors about various #pragma intrinsic directives from
747             # clang-cl, and we don't need to hear about those.
748             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
749             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
750             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
751             # as __attribute((__deprecated__)).  This is nice to know,
752             # but since we don't get the equivalent warning from MSVC,
753             # let's just ignore it.
754             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
755             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
756             # We use a function like:
757             #   __declspec(noreturn) __inline void f() {}
758             # which -Winvalid-noreturn complains about.  Again, MSVC seems
759             # OK with it, so let's silence the warning.
760             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
761             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
762             # Missing |override| on virtual function declarations isn't
763             # something that MSVC currently warns about.
764             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
765             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
766             # declaration on |operator delete(void*)|.  However, clang-cl
767             # must internally declare |operator delete(void*)| differently,
768             # which causes this warning for virtually every file in the
769             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
770             # so there doesn't seem to be any way to convince clang-cl to
771             # declare |delete| differently.  Therefore, suppress this
772             # warning.
773             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
774             # At least one MSVC header and several headers in-tree have
775             # unused typedefs, so turn this on.
776             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
777             # jemalloc uses __declspec(allocator) as a profiler hint,
778             # which clang-cl doesn't understand.
779             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
780             # __attribute__((unused)) really means "might be unused" and
781             # we use it to avoid warnings about things that are unused
782             # in some compilation units, but used in many others.  This
783             # warning insists on complaining about the latter case, which
784             # is annoying, and rather noisy.
785             CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
786         fi
787         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
788         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
789         LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
790         MOZ_DEBUG_LDFLAGS='-DEBUG'
791         # Use a higher optimization level for clang-cl, so we can come closer
792         # to MSVC's performance numbers (see bug 1443590).
793         if test -n "$CLANG_CL"; then
794             MOZ_OPTIMIZE_FLAGS='-O2'
795         else
796             MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
797         fi
798         MOZ_FIX_LINK_PATHS=
799         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
800         if test -z "$DEVELOPER_OPTIONS"; then
801             LDFLAGS="$LDFLAGS -RELEASE"
802         fi
803         RCFLAGS="-nologo"
804         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
805         dnl both SSSE3 and SSE4.1.
806         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
807         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
808         dnl allow AVX2 code from VS2015
809         HAVE_X86_AVX2=1
810     fi
811     AC_DEFINE(WIN32_LEAN_AND_MEAN)
812     dnl See http://support.microsoft.com/kb/143208 to use STL
813     AC_DEFINE(NOMINMAX)
814     BIN_SUFFIX='.exe'
815     MOZ_USER_DIR="Mozilla"
817     case "$host_os" in
818     cygwin*|msvc*|mks*)
819         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.])
820         ;;
821     esac
823     case "$target" in
824     i*86-*)
825         if test -n "$GNU_CC"; then
826             CFLAGS="$CFLAGS -mstackrealign"
827             CXXFLAGS="$CXXFLAGS -mstackrealign"
828             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
829         else
830             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
831             LDFLAGS="$LDFLAGS -SAFESEH"
832         fi
834         AC_DEFINE(_X86_)
835         ;;
836     x86_64-*)
837         if test -n "$_WIN32_MSVC"; then
838             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
839         fi
840         AC_DEFINE(_AMD64_)
841         ;;
842     aarch64-*)
843         if test -n "$_WIN32_MSVC"; then
844             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
845         fi
846         AC_DEFINE(_ARM64_)
847         ;;
848     *)
849         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
850         ;;
851     esac
852     ;;
854 *-netbsd*)
855     DSO_CFLAGS=''
856     CFLAGS="$CFLAGS -Dunix"
857     CXXFLAGS="$CXXFLAGS -Dunix"
858     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
859         DSO_PIC_CFLAGS='-fPIC -DPIC'
860         DSO_LDOPTS='-shared'
861         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
862     else
863         DSO_PIC_CFLAGS='-fPIC -DPIC'
864         DSO_LDOPTS='-shared'
865     fi
866     # This will fail on a.out systems prior to 1.5.1_ALPHA.
867     if test "$LIBRUNPATH"; then
868         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
869     fi
870     ;;
872 *-openbsd*)
873     if test -z "$X11BASE"; then
874         X11BASE=/usr/X11R6
875     fi
876     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
877     DSO_CFLAGS=''
878     DSO_PIC_CFLAGS='-fPIC'
879     DSO_LDOPTS='-shared -fPIC'
880     if test "$LIBRUNPATH"; then
881         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
882     fi
883     ;;
885 *-solaris*)
886     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
887     ;;
889 esac
891 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
892     MOZ_OPTIMIZE_FLAGS="-O"
895 AC_SUBST_LIST(MMX_FLAGS)
896 AC_SUBST_LIST(SSE_FLAGS)
897 AC_SUBST_LIST(SSE2_FLAGS)
898 AC_SUBST_LIST(SSSE3_FLAGS)
900 AC_SUBST(MOZ_LINKER)
901 if test -n "$MOZ_LINKER"; then
902   AC_DEFINE(MOZ_LINKER)
903   MOZ_LINKER_EXTRACT=1
904   AC_CHECK_PROGS(XZ, xz)
907 if test -z "$COMPILE_ENVIRONMENT"; then
908     SKIP_COMPILER_CHECKS=1
909     SKIP_LIBRARY_CHECKS=1
910     PKG_SKIP_STRIP=1
911     MOZ_DEBUGGING_OPTS
912 else
913     MOZ_COMPILER_OPTS
914 fi # COMPILE_ENVIRONMENT
916 if test -z "$SKIP_COMPILER_CHECKS"; then
917 dnl Checks for typedefs, structures, and compiler characteristics.
918 dnl ========================================================
919 AC_C_CONST
920 AC_TYPE_MODE_T
921 AC_TYPE_OFF_T
922 AC_TYPE_PID_T
923 AC_TYPE_SIZE_T
924 AC_LANG_CPLUSPLUS
925 AC_LANG_C
927 AC_LANG_CPLUSPLUS
929 MOZ_CXX11
931 AC_LANG_C
933 case "${OS_TARGET}" in
934 Darwin)
935   ;;
937   STL_FLAGS="-I${DIST}/stl_wrappers"
938   WRAP_STL_INCLUDES=1
939   ;;
940 esac
942 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
943     WRAP_STL_INCLUDES=
946 dnl Checks for header files.
947 dnl ========================================================
948 AC_HEADER_DIRENT
949 case "$target_os" in
950 bitrig*|dragonfly*|freebsd*|openbsd*)
951 # for stuff like -lXshm
952     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
953     ;;
954 esac
956 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
957 AC_CACHE_CHECK(for sockaddr_in.sin_len,
958                    ac_cv_sockaddr_in_sin_len,
959                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
960                                     #include <sys/types.h>
961                                     #endif
962                                     #include <netinet/in.h>
963                                     struct sockaddr_in x;
964                                     void *foo = (void*) &x.sin_len;],
965                                    [],
966                                    [ac_cv_sockaddr_in_sin_len=true],
967                                    [ac_cv_sockaddr_in_sin_len=false])])
968 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
969   AC_DEFINE(HAVE_SIN_LEN)
970 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
971   AC_DEFINE(HAVE_SCONN_LEN)
974 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
975                ac_cv_sockaddr_in6_sin6_len,
976                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
977                                 #include <sys/types.h>
978                                 #endif
979                                 #include <netinet/in.h>
980                                 struct sockaddr_in6 x;
981                                 void *foo = (void*) &x.sin6_len;],
982                                [],
983                                [ac_cv_sockaddr_in6_sin6_len=true],
984                                [ac_cv_sockaddr_in6_sin6_len=false])])
985 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
986   AC_DEFINE(HAVE_SIN6_LEN)
989 AC_CACHE_CHECK(for sockaddr.sa_len,
990                ac_cv_sockaddr_sa_len,
991                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
992                                 #include <sys/types.h>
993                                 #endif
994                                 #include <sys/socket.h>
995                                 struct sockaddr x;
996                                 void *foo = (void*) &x.sa_len;],
997                                [],
998                                [ac_cv_sockaddr_sa_len=true],
999                                [ac_cv_sockaddr_sa_len=false])])
1000 if test "$ac_cv_sockaddr_sa_len" = true ; then
1001   AC_DEFINE(HAVE_SA_LEN)
1004 MOZ_ARG_ENABLE_BOOL(dtrace,
1005               [  --enable-dtrace         build with dtrace support if available (default=no)],
1006               [enable_dtrace="yes"],)
1007 if test "x$enable_dtrace" = "xyes"; then
1008   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1009   if test -n "$HAVE_DTRACE"; then
1010       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1011   else
1012       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1013   fi
1015 AC_SUBST(HAVE_DTRACE)
1017 dnl Checks for libraries.
1018 dnl ========================================================
1019 AC_CHECK_LIB(c_r, gethostbyname_r)
1021 dnl We don't want to link with libdl even if it's present on OS X, since
1022 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1023 dnl in libc.
1024 dnl We don't want to link against libm or libpthread on Darwin since
1025 dnl they both are just symlinks to libSystem and explicitly linking
1026 dnl against libSystem causes issues when debugging (see bug 299601).
1027 case $target in
1028 *-darwin*)
1029     ;;
1031     AC_SEARCH_LIBS(dlopen, dl,
1032         MOZ_CHECK_HEADER(dlfcn.h,
1033         AC_DEFINE(HAVE_DLOPEN)))
1034     ;;
1035 esac
1037 _SAVE_CFLAGS="$CFLAGS"
1038 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1039 AC_CHECK_FUNCS(dladdr memmem)
1040 CFLAGS="$_SAVE_CFLAGS"
1042 if test ! "$GNU_CXX"; then
1043     AC_CHECK_LIB(C, demangle)
1046 AC_CHECK_LIB(socket, socket)
1048 XLDFLAGS="$X_LIBS"
1049 XLIBS="$X_EXTRA_LIBS"
1051 dnl ========================================================
1052 dnl Checks for X libraries.
1053 dnl Ordering is important.
1054 dnl Xt is dependent upon SM as of X11R6
1055 dnl ========================================================
1056 if test -n "$MOZ_X11"; then
1057     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1058     _SAVE_LDFLAGS="$LDFLAGS"
1059     _SAVE_LIBS="$LIBS"
1060     LDFLAGS="$XLDFLAGS $LDFLAGS"
1061     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1062         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1063     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1064         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1066     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1067         unset ac_cv_lib_Xt_XtFree
1068         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1069         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1070         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1071             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1072         ])
1074     dnl ========================================================
1075     dnl = Check for xcb
1076     dnl ========================================================
1077     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1078         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1079     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1080         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1081     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1082         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1084     LDFLAGS="$_SAVE_LDFLAGS"
1085     LIBS="$_SAVE_LIBS"
1086 fi # $MOZ_X11
1088 AC_SUBST_LIST(XCFLAGS)
1089 AC_SUBST_LIST(XLDFLAGS)
1090 AC_SUBST_LIST(XLIBS)
1091 AC_SUBST_LIST(XEXT_LIBS)
1092 AC_SUBST_LIST(XT_LIBS)
1094 dnl ========================================================
1095 dnl = pthread support
1096 dnl = Start by checking whether the system support pthreads
1097 dnl ========================================================
1098 case "$target_os" in
1099 darwin*)
1100     MOZ_USE_PTHREADS=1
1101     ;;
1103     AC_CHECK_LIB(pthreads, pthread_create,
1104         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1105         AC_CHECK_LIB(pthread, pthread_create,
1106             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1107             AC_CHECK_LIB(c_r, pthread_create,
1108                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1109                 AC_CHECK_LIB(c, pthread_create,
1110                     MOZ_USE_PTHREADS=1
1111                 )
1112             )
1113         )
1114     )
1115     ;;
1116 esac
1118 dnl ========================================================
1119 dnl Do the platform specific pthread hackery
1120 dnl ========================================================
1121 if test "$MOZ_USE_PTHREADS"x != x
1122 then
1123     dnl
1124     dnl See if -pthread is supported.
1125     dnl
1126     rm -f conftest*
1127     ac_cv_have_dash_pthread=no
1128     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1129     echo 'int main() { return 0; }' | cat > conftest.c
1130     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1131     if test $? -eq 0; then
1132         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1133             ac_cv_have_dash_pthread=yes
1134             case "$target_os" in
1135             freebsd*)
1136 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1137                 ;;
1138             *)
1139                 CFLAGS="$CFLAGS -pthread"
1140                 CXXFLAGS="$CXXFLAGS -pthread"
1141                 ;;
1142             esac
1143         fi
1144     fi
1145     rm -f conftest*
1146     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1148     dnl
1149     dnl See if -pthreads is supported.
1150     dnl
1151     ac_cv_have_dash_pthreads=no
1152     if test "$ac_cv_have_dash_pthread" = "no"; then
1153         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1154         echo 'int main() { return 0; }' | cat > conftest.c
1155         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1156         if test $? -eq 0; then
1157             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1158                 ac_cv_have_dash_pthreads=yes
1159                 CFLAGS="$CFLAGS -pthreads"
1160                 CXXFLAGS="$CXXFLAGS -pthreads"
1161             fi
1162         fi
1163         rm -f conftest*
1164         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1165     fi
1167     case "$target" in
1168         *-*-freebsd*)
1169             AC_DEFINE(_REENTRANT)
1170             AC_DEFINE(_THREAD_SAFE)
1171             dnl -pthread links in -lpthread, so don't specify it explicitly.
1172             if test "$ac_cv_have_dash_pthread" = "yes"; then
1173                 _PTHREAD_LDFLAGS="-pthread"
1174             fi
1175             ;;
1177         *-*-openbsd*|*-*-bsdi*)
1178             AC_DEFINE(_REENTRANT)
1179             AC_DEFINE(_THREAD_SAFE)
1180             dnl -pthread links in -lc_r, so don't specify it explicitly.
1181             if test "$ac_cv_have_dash_pthread" = "yes"; then
1182                 _PTHREAD_LDFLAGS="-pthread"
1183             fi
1184             ;;
1186         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1187             AC_DEFINE(_REENTRANT)
1188             ;;
1190     esac
1191     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1192     AC_SUBST(MOZ_USE_PTHREADS)
1193     MOZ_CHECK_HEADERS(pthread.h)
1197 dnl Checks for library functions.
1198 dnl ========================================================
1199 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1201 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1202 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1203                ac_cv_clock_monotonic,
1204                [for libs in "" -lrt; do
1205                     _SAVE_LIBS="$LIBS"
1206                     _SAVE_CFLAGS="$CFLAGS"
1207                     LIBS="$LIBS $libs"
1208                     CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1209 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1210 dnl we should or not be able to use it. To detect if we can, we need to make the
1211 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1212                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1213                                  #include <time.h>],
1214                                  [ struct timespec ts;
1215                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
1216                                  ac_cv_clock_monotonic=$libs
1217                                  LIBS="$_SAVE_LIBS"
1218                                  break,
1219                                  ac_cv_clock_monotonic=no)
1220                     LIBS="$_SAVE_LIBS"
1221                     CFLAGS="$_SAVE_CFLAGS"
1222                 done])
1223 if test "$ac_cv_clock_monotonic" != "no"; then
1224     HAVE_CLOCK_MONOTONIC=1
1225     REALTIME_LIBS=$ac_cv_clock_monotonic
1226     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1227     AC_SUBST(HAVE_CLOCK_MONOTONIC)
1228     AC_SUBST_LIST(REALTIME_LIBS)
1231 dnl Turn on warnings-as-errors to prevent implicit declaration of
1232 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1233 dnl inadvertently pass even if the function does not really exist.
1234 _SAVE_CFLAGS="$CFLAGS"
1235 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1236 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1237                ac_cv_pthread_cond_timedwait_monotonic_np,
1238                AC_TRY_LINK([#include <pthread.h>],
1239                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1240                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1241                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1242 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1243     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1245 CFLAGS=$_SAVE_CFLAGS
1247 AC_CACHE_CHECK(
1248     [for res_ninit()],
1249     ac_cv_func_res_ninit,
1250     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1251         dnl no need for res_ninit() on NetBSD and OpenBSD
1252         ac_cv_func_res_ninit=no
1253      else
1254         AC_TRY_LINK([
1255             #ifdef linux
1256             #define _BSD_SOURCE 1
1257             #endif
1258             #include <sys/types.h>
1259             #include <netinet/in.h>
1260             #include <arpa/nameser.h>
1261             #include <resolv.h>
1262             ],
1263             [int foo = res_ninit(&_res);],
1264             [ac_cv_func_res_ninit=yes],
1265             [ac_cv_func_res_ninit=no])
1266      fi
1267     ])
1269 if test "$ac_cv_func_res_ninit" = "yes"; then
1270     AC_DEFINE(HAVE_RES_NINIT)
1271 dnl must add the link line we do something as foolish as this... dougt
1272 dnl else
1273 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1274 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1277 AC_LANG_C
1279 dnl **********************
1280 dnl *** va_copy checks ***
1281 AC_CACHE_CHECK([for an implementation of va_copy()],
1282                ac_cv_va_copy,
1283     [AC_TRY_COMPILE([#include <stdarg.h>
1284                      #include <stdlib.h>
1285         void f (int i, ...) {
1286             va_list args1, args2;
1287             va_start (args1, i);
1288             va_copy (args2, args1);
1289             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1290                 exit (1);
1291             va_end (args1); va_end (args2);
1292         }],
1293         [f(0, 42); return 0],
1294         [ac_cv_va_copy=yes],
1295         [ac_cv_va_copy=no]
1296     )]
1298 AC_CACHE_CHECK([whether va_list can be copied by value],
1299                ac_cv_va_val_copy,
1300     [AC_TRY_COMPILE([#include <stdarg.h>
1301                      #include <stdlib.h>
1302         void f (int i, ...) {
1303             va_list args1, args2;
1304             va_start (args1, i);
1305             args2 = args1;
1306             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1307                 exit (1);
1308             va_end (args1); va_end (args2);
1309         }],
1310         [f(0, 42); return 0],
1311         [ac_cv_va_val_copy=yes],
1312         [ac_cv_va_val_copy=no],
1313     )]
1315 if test "x$ac_cv_va_copy" = "xyes"; then
1316     AC_DEFINE(VA_COPY, va_copy)
1317     AC_DEFINE(HAVE_VA_COPY)
1320 if test "x$ac_cv_va_val_copy" = "xno"; then
1321    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1324 dnl ===================================================================
1325 dnl ========================================================
1326 dnl Put your C++ language/feature checks below
1327 dnl ========================================================
1328 AC_LANG_CPLUSPLUS
1330 ARM_ABI_PREFIX=
1331 if test "$GNU_CC"; then
1332   if test "$CPU_ARCH" = "arm" ; then
1333     AC_CACHE_CHECK(for ARM EABI,
1334         ac_cv_gcc_arm_eabi,
1335         [AC_TRY_COMPILE([],
1336                         [
1337 #if defined(__ARM_EABI__)
1338   return 0;
1339 #else
1340 #error Not ARM EABI.
1341 #endif
1342                         ],
1343                         ac_cv_gcc_arm_eabi="yes",
1344                         ac_cv_gcc_arm_eabi="no")])
1345     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1346         HAVE_ARM_EABI=1
1347         ARM_ABI_PREFIX=eabi-
1348     else
1349         ARM_ABI_PREFIX=oabi-
1350     fi
1351   fi
1353   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1356 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1357 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1358 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1359 # linking XUL.
1360 _SAVE_LDFLAGS=$LDFLAGS
1361 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1362 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1363                ac_cv_thread_keyword,
1364                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1365                             [return tlsIsMainThread;],
1366                             ac_cv_thread_keyword=yes,
1367                             ac_cv_thread_keyword=no)])
1368 LDFLAGS=$_SAVE_LDFLAGS
1369 # The custom dynamic linker doesn't support TLS variables
1370 MOZ_TLS=
1371 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1372   # mips builds fail with TLS variables because of a binutils bug.
1373   # See bug 528687
1374   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1375   case "${target}" in
1376     mips*-*)
1377       :
1378       ;;
1379     *-android*|*-linuxandroid*)
1380       :
1381       ;;
1382     *-openbsd*)
1383       :
1384       ;;
1385     *)
1386       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1387       MOZ_TLS=1
1388       ;;
1389   esac
1392 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1393 if test -n "$MOZ_LINKER"; then
1394   if test "$CPU_ARCH" = arm; then
1395     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1396     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1397       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1398       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1399     fi
1400   fi
1402 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1403 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1404 dnl Since the linker only understands the sysv ones, no need to build the
1405 dnl gnu style tables anyways.
1406   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1409 dnl End of C++ language/feature checks
1410 AC_LANG_C
1412 dnl ========================================================
1413 dnl =  Internationalization checks
1414 dnl ========================================================
1416 dnl Internationalization and Locale support is different
1417 dnl on various UNIX platforms.  Checks for specific i18n
1418 dnl features go here.
1420 AC_HAVE_FUNCS(localeconv)
1422 fi # ! SKIP_COMPILER_CHECKS
1424 if test -n "${COMPILE_ENVIRONMENT}"; then
1425   MOZ_CHECK_ALLOCATOR
1428 TARGET_XPCOM_ABI=
1429 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1430     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1431     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1434 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1435 dnl features that Windows actually does support.
1437 if test -n "$SKIP_COMPILER_CHECKS"; then
1438    dnl Windows has malloc.h
1439    AC_DEFINE(MALLOC_H, [<malloc.h>])
1440    AC_DEFINE(HAVE_FORCEINLINE)
1441    AC_DEFINE(HAVE_LOCALECONV)
1442 fi # SKIP_COMPILER_CHECKS
1444 dnl Mozilla specific options
1445 dnl ========================================================
1446 dnl The macros used for command line options
1447 dnl are defined in build/autoconf/altoptions.m4.
1449 dnl ========================================================
1450 dnl =
1451 dnl = Check for external package dependencies
1452 dnl =
1453 dnl ========================================================
1454 MOZ_ARG_HEADER(External Packages)
1456 case "$OS_TARGET" in
1457 WINNT|Darwin|Android)
1458   MOZ_FOLD_LIBS=1
1459   ;;
1461   MOZ_FOLD_LIBS=
1462   ;;
1463 esac
1465 MOZ_CONFIG_NSPR()
1467 dnl ========================================================
1468 dnl system libevent Support
1469 dnl ========================================================
1470 MOZ_ARG_WITH_STRING(system-libevent,
1471 [  --with-system-libevent[=PFX]
1472                           Use system libevent [installed at prefix PFX]],
1473     LIBEVENT_DIR=$withval)
1475 _SAVE_CFLAGS=$CFLAGS
1476 _SAVE_LDFLAGS=$LDFLAGS
1477 _SAVE_LIBS=$LIBS
1478 if test "$LIBEVENT_DIR" = yes; then
1479     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1480         MOZ_SYSTEM_LIBEVENT=1,
1481         LIBEVENT_DIR=/usr)
1483 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1484     MOZ_SYSTEM_LIBEVENT=
1485 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1486     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1487     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1488     MOZ_CHECK_HEADER(event.h,
1489         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1490              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1491          fi],
1492         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1493     AC_CHECK_LIB(event, event_init,
1494                  [MOZ_SYSTEM_LIBEVENT=1
1495                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1496                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1497                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1499 CFLAGS=$_SAVE_CFLAGS
1500 LDFLAGS=$_SAVE_LDFLAGS
1501 LIBS=$_SAVE_LIBS
1503 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1505 dnl ========================================================
1506 dnl = If NSS was not detected in the system,
1507 dnl = use the one in the source tree (mozilla/security/nss)
1508 dnl ========================================================
1510 MOZ_ARG_WITH_BOOL(system-nss,
1511 [  --with-system-nss       Use system installed NSS],
1512     _USE_SYSTEM_NSS=1 )
1514 if test -n "$_USE_SYSTEM_NSS"; then
1515     AM_PATH_NSS(3.47, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1518 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1519 if test -z "$MOZ_SYSTEM_NSS"; then
1520    case "${OS_ARCH}" in
1521         # Only few platforms have been tested with GYP
1522         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1523             ;;
1524         *)
1525             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1526             ;;
1527    esac
1530 dnl system ZLIB support
1531 dnl ========================================================
1532 MOZ_ZLIB_CHECK([1.2.3])
1534 if test -z "$SKIP_LIBRARY_CHECKS"; then
1536 dnl ========================================================
1537 dnl system PNG Support
1538 dnl ========================================================
1539 MOZ_ARG_WITH_STRING(system-png,
1540 [  --with-system-png[=PFX]
1541                           Use system libpng [installed at prefix PFX]],
1542     PNG_DIR=$withval)
1544 _SAVE_CFLAGS=$CFLAGS
1545 _SAVE_LDFLAGS=$LDFLAGS
1546 _SAVE_LIBS=$LIBS
1547 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1548     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1549     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1551 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1552     MOZ_SYSTEM_PNG=
1553 else
1554     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1555                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1556     AC_CHECK_LIB(png, png_get_acTL, ,
1557                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1559 if test "$MOZ_SYSTEM_PNG" = 1; then
1560     AC_TRY_COMPILE([ #include <stdio.h>
1561                      #include <sys/types.h>
1562                      #include <png.h> ],
1563                    [ #if PNG_LIBPNG_VER < $MOZPNG
1564                      #error "Insufficient libpng version ($MOZPNG required)."
1565                      #endif
1566                      #ifndef PNG_UINT_31_MAX
1567                      #error "Insufficient libpng version."
1568                      #endif ],
1569                    MOZ_SYSTEM_PNG=1,
1570                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1572 CFLAGS=$_SAVE_CFLAGS
1573 LDFLAGS=$_SAVE_LDFLAGS
1574 LIBS=$_SAVE_LIBS
1576 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1577     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1578     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1581 fi # SKIP_LIBRARY_CHECKS
1583 dnl ========================================================
1584 dnl =
1585 dnl = Application
1586 dnl =
1587 dnl ========================================================
1589 MOZ_ARG_HEADER(Application)
1591 ENABLE_SYSTEM_EXTENSION_DIRS=1
1592 MOZ_BRANDING_DIRECTORY=
1593 MOZ_OFFICIAL_BRANDING=
1594 MOZ_AUTH_EXTENSION=1
1595 if test "$MOZ_IOS"; then
1596    MOZ_AUTH_EXTENSION=
1598 MOZ_PREF_EXTENSIONS=1
1599 MOZ_SPELLCHECK=1
1600 MOZ_UNIVERSALCHARDET=1
1601 MOZ_XUL=1
1602 MOZ_ZIPWRITER=1
1603 MOZ_NO_SMART_CARDS=
1604 NECKO_COOKIES=1
1605 MOZ_USE_NATIVE_POPUP_WINDOWS=
1606 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1607 MOZ_SANDBOX=1
1608 MOZ_BINARY_EXTENSIONS=
1609 MOZ_DEVTOOLS=server
1611 case "$target_os" in
1612     mingw*)
1613         NS_ENABLE_TSF=1
1614         AC_DEFINE(NS_ENABLE_TSF)
1615         ;;
1616 esac
1618 # Optional Firefox for Android partner distribution directory.
1619 MOZ_ARG_WITH_STRING(android-distribution-directory,
1620 [  --with-android-distribution-directory=dir
1621                           Optional Firefox for Android partner distribution directory.],
1622   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1624 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1625   # A distribution directory must have an assets/distribution directory.
1626   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1627   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1628     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1629                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1630   fi
1632 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1634 dnl ========================================================
1635 dnl = Trademarked Branding
1636 dnl ========================================================
1637 MOZ_ARG_ENABLE_BOOL(official-branding,
1638 [  --enable-official-branding
1639                           Enable Official mozilla.org Branding
1640                           Do not distribute builds with
1641                           --enable-official-branding unless you have
1642                           permission to use trademarks per
1643                           http://www.mozilla.org/foundation/trademarks/ .],
1644     MOZ_OFFICIAL_BRANDING=1,
1645     MOZ_OFFICIAL_BRANDING=)
1647 # Allow the application to influence configure with a confvars.sh script.
1648 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1649 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1650   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1651   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1652 else
1653   AC_MSG_RESULT([no])
1656 # Allow influencing configure with a defines.sh script.
1657 . "${srcdir}/build/defines.sh"
1659 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1660 # set in defines.sh
1661 if test "$BUILDING_RELEASE"; then
1662   # Override value in defines.sh, if any
1663   EARLY_BETA_OR_EARLIER=
1664 elif test "$EARLY_BETA_OR_EARLIER"; then
1665   AC_DEFINE(EARLY_BETA_OR_EARLIER)
1667 AC_SUBST(EARLY_BETA_OR_EARLIER)
1669 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1670 MOZ_ARG_WITH_STRING(app-name,
1671 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1672 WITH_APP_NAME=$withval,
1675 if test -n "$WITH_APP_NAME" ; then
1676     MOZ_APP_NAME="$WITH_APP_NAME"
1679 MOZ_ARG_WITH_STRING(app-basename,
1680 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1681 WITH_APP_BASENAME=$withval,
1684 if test -n "$WITH_APP_BASENAME" ; then
1685     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1688 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1689 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1690 # MOZ_BUILD_APP.
1691 case "$MOZ_BUILD_APP" in
1692 browser)
1693   AC_DEFINE(MOZ_PHOENIX)
1694   ;;
1695 esac
1697 # Graphene is a desktop runtime for running applications with a HTML UI.
1698 if test -n "$MOZ_GRAPHENE"; then
1699     AC_DEFINE(MOZ_GRAPHENE)
1702 AC_SUBST(MOZ_PHOENIX)
1704 dnl ========================================================
1705 dnl Ensure Android SDK and build-tools versions depending on
1706 dnl mobile target.
1707 dnl ========================================================
1709 case "$MOZ_BUILD_APP" in
1710 mobile/android)
1711     MOZ_ANDROID_SDK
1712     ;;
1713 esac
1715 dnl ========================================================
1716 dnl =
1717 dnl = Toolkit Options
1718 dnl =
1719 dnl ========================================================
1720 MOZ_ARG_HEADER(Toolkit Options)
1722 dnl ========================================================
1723 dnl = Enable the toolkit as needed                         =
1724 dnl ========================================================
1726 case "$MOZ_WIDGET_TOOLKIT" in
1728 cocoa)
1729     LDFLAGS="$LDFLAGS -framework Cocoa"
1730     # Use -Wl as a trick to avoid -framework and framework names from
1731     # being separated by AC_SUBST_LIST.
1732     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'
1733     TK_CFLAGS=""
1734     CFLAGS="$CFLAGS $TK_CFLAGS"
1735     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1736     MOZ_USER_DIR="Mozilla"
1737     MOZ_FS_LAYOUT=bundle
1738     ;;
1740 uikit)
1741     LDFLAGS="$LDFLAGS -framework UIKit"
1742     TK_CFLAGS=""
1743     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'
1744     CFLAGS="$CFLAGS $TK_CFLAGS"
1745     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1746     MOZ_USER_DIR="Mozilla"
1747     MOZ_FS_LAYOUT=bundle
1748     ;;
1750 esac
1752 if test "$OS_TARGET" = Darwin; then
1753     LDFLAGS="$LDFLAGS -lobjc"
1756 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1757 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1758 case "$MOZ_WIDGET_TOOLKIT" in
1759 gtk*)
1760     MOZ_ENABLE_GTK=1
1761     ;;
1762 esac
1764 if test "$COMPILE_ENVIRONMENT"; then
1765   if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1766     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)
1767     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1768     TK_CFLAGS=$MOZ_GTK3_CFLAGS
1769     TK_LIBS=$MOZ_GTK3_LIBS
1770     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1771     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1772     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1773     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1774   fi
1775   if test "$MOZ_ENABLE_GTK"; then
1776     if test "$MOZ_X11"; then
1777       GDK_PACKAGES=gdk-x11-2.0
1778     fi
1779     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1780     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1782     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)
1783     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1784   fi
1785 fi # COMPILE_ENVIRONMENT
1787 AC_SUBST(MOZ_FS_LAYOUT)
1789 dnl ========================================================
1790 dnl = startup-notification support module
1791 dnl ========================================================
1793 if test "$MOZ_ENABLE_GTK"
1794 then
1795     MOZ_ENABLE_STARTUP_NOTIFICATION=
1797     MOZ_ARG_ENABLE_BOOL(startup-notification,
1798     [  --enable-startup-notification
1799                           Enable startup-notification support (default: disabled) ],
1800         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1801         MOZ_ENABLE_STARTUP_NOTIFICATION=)
1802     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1803     then
1804         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1805                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1806         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1807             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1808             then
1809                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1810             fi
1811             MOZ_ENABLE_STARTUP_NOTIFICATION=
1812         ])
1813     fi
1815     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1816         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1817     fi
1819     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1821 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1823 AC_SUBST_LIST(TK_CFLAGS)
1824 AC_SUBST_LIST(TK_LIBS)
1826 dnl ========================================================
1827 dnl =
1828 dnl = Components & Features
1829 dnl =
1830 dnl ========================================================
1831 MOZ_ARG_HEADER(Components and Features)
1833 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1834 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1835   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1836     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1837   else
1838     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1839     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1840   fi
1843 MOZ_ARG_WITH_STRING(branding,
1844 [  --with-branding=dir     Use branding from the specified directory.],
1845     MOZ_BRANDING_DIRECTORY=$withval)
1847 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1848 if test -z "$REAL_BRANDING_DIRECTORY"; then
1849   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1852 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1853   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1854 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1855   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1858 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1860 dnl ========================================================
1861 dnl = Distribution ID
1862 dnl ========================================================
1863 MOZ_ARG_WITH_STRING(distribution-id,
1864 [  --with-distribution-id=ID
1865                           Set distribution-specific id (default=org.mozilla)],
1866 [ val=`echo $withval`
1867     MOZ_DISTRIBUTION_ID="$val"])
1869 if test -z "$MOZ_DISTRIBUTION_ID"; then
1870    MOZ_DISTRIBUTION_ID="org.mozilla"
1873 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1874 AC_SUBST(MOZ_DISTRIBUTION_ID)
1876 dnl ========================================================
1877 dnl = libproxy support
1878 dnl ========================================================
1880 if test "$MOZ_ENABLE_GTK"
1881 then
1882     MOZ_ENABLE_LIBPROXY=
1884     MOZ_ARG_ENABLE_BOOL(libproxy,
1885     [  --enable-libproxy         Enable libproxy support ],
1886     MOZ_ENABLE_LIBPROXY=1,
1887     MOZ_ENABLE_LIBPROXY=)
1889     if test "$MOZ_ENABLE_LIBPROXY"
1890     then
1891         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1892         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1893     fi
1895 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1897 dnl ========================================================
1898 dnl = dbus support
1899 dnl ========================================================
1901 if test "$MOZ_ENABLE_GTK"
1902 then
1903     MOZ_ENABLE_DBUS=1
1905     MOZ_ARG_DISABLE_BOOL(dbus,
1906     [  --disable-dbus          Disable dbus support ],
1907         MOZ_ENABLE_DBUS=,
1908         MOZ_ENABLE_DBUS=1)
1910     if test "$MOZ_ENABLE_DBUS"
1911     then
1912         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1913         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1914         AC_DEFINE(MOZ_ENABLE_DBUS)
1915     fi
1917 AC_SUBST(MOZ_ENABLE_DBUS)
1919 dnl =========================================================
1920 dnl = Whether to exclude hyphenations files in the build
1921 dnl =========================================================
1922 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1923     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1926 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1927                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1928                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1930 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1932 if test -n "$MOZ_WEBRTC"; then
1933     if test -n "$MOZ_X11"; then
1934       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1935     fi
1938 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1940 dnl ========================================================
1941 dnl = Apple platform decoder support
1942 dnl ========================================================
1943 if test "$COMPILE_ENVIRONMENT"; then
1944 if test -n "$MOZ_APPLEMEDIA"; then
1945   # hack in frameworks for fmp4 - see bug 1029974
1946   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1947   LDFLAGS="$LDFLAGS -framework AudioToolbox"
1948   dnl Verify CoreMedia is available.
1949   AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1950     [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1952 fi # COMPILE_ENVIRONMENT
1954 dnl ========================================================
1955 dnl = Handle dependent MEDIA defines
1956 dnl ========================================================
1958 MOZ_WEBM_ENCODER=1
1959 AC_DEFINE(MOZ_WEBM_ENCODER)
1960 AC_SUBST(MOZ_WEBM_ENCODER)
1962 dnl ========================================================
1963 dnl NegotiateAuth
1964 dnl ========================================================
1966 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1967 [  --disable-negotiateauth Disable GSS-API negotiation ],
1968     MOZ_AUTH_EXTENSION=,
1969     MOZ_AUTH_EXTENSION=1 )
1971 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1972    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1975 dnl ========================================================
1976 dnl Pref extensions (autoconfig)
1977 dnl ========================================================
1978 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1979 [  --disable-pref-extensions
1980                           Disable pref extensions such as autoconfig],
1981   MOZ_PREF_EXTENSIONS=,
1982   MOZ_PREF_EXTENSIONS=1 )
1984 dnl ========================================================
1985 dnl Searching of system directories for extensions.
1986 dnl Note: this switch is meant to be used for test builds
1987 dnl whose behavior should not depend on what happens to be
1988 dnl installed on the local machine.
1989 dnl ========================================================
1990 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1991 [  --disable-system-extension-dirs
1992                           Disable searching system- and account-global
1993                           directories for extensions of any kind; use
1994                           only profile-specific extension directories],
1995   ENABLE_SYSTEM_EXTENSION_DIRS=,
1996   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1997 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1998   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2001 dnl ========================================================
2002 dnl = Universalchardet
2003 dnl ========================================================
2004 MOZ_ARG_DISABLE_BOOL(universalchardet,
2005 [  --disable-universalchardet
2006                           Disable universal encoding detection],
2007   MOZ_UNIVERSALCHARDET=,
2008   MOZ_UNIVERSALCHARDET=1 )
2010 dnl ========================================================
2011 dnl Gamepad support
2012 dnl ========================================================
2014 if test "$COMPILE_ENVIRONMENT" ; then
2016 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2017 if test "$OS_TARGET" = "Linux"; then
2018     MOZ_CHECK_HEADER([linux/joystick.h])
2019     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2020       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2021     fi
2024 fi # COMPILE_ENVIRONMENT
2027 dnl ========================================================
2028 dnl = Breakpad crash reporting (on by default on supported platforms)
2029 dnl ========================================================
2031 case $target in
2032 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
2033   MOZ_CRASHREPORTER=1
2034   ;;
2035 i?86-apple-darwin*|x86_64-apple-darwin*)
2036   if test -z "$MOZ_IOS"; then
2037     MOZ_CRASHREPORTER=1
2038   fi
2039   ;;
2040 *-android*|*-linuxandroid*)
2041   dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2042   dnl be before Linux condition
2043   MOZ_CRASHREPORTER=1
2044   ;;
2045 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2046   if test "$MOZ_ENABLE_GTK"; then
2047     MOZ_CRASHREPORTER=1
2048   fi
2049   ;;
2050 esac
2052 MOZ_ARG_DISABLE_BOOL(crashreporter,
2053 [  --disable-crashreporter Disable breakpad crash reporting],
2054     [MOZ_CRASHREPORTER=],
2055     [MOZ_CRASHREPORTER=F # Force enable breakpad])
2057 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
2058   if test "$MOZ_CRASHREPORTER" = F; then
2059     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2060   fi
2061   MOZ_CRASHREPORTER=
2064 if test -n "$MOZ_CRASHREPORTER"; then
2065    AC_DEFINE(MOZ_CRASHREPORTER)
2067   if test "$OS_TARGET" = "Linux" && \
2068     test -z "$SKIP_LIBRARY_CHECKS"; then
2069     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2070   fi
2072   if test "$OS_ARCH" = "WINNT"; then
2073     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2074       MOZ_CRASHREPORTER_INJECTOR=1
2075       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2076     fi
2077   fi
2080 dnl ========================================================
2081 dnl = Enable compilation of specific extension modules
2082 dnl ========================================================
2084 MOZ_ARG_ENABLE_STRING(extensions,
2085 [  --enable-extensions     Enable extensions],
2086 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2087     if test "$option" = "yes" -o "$option" = "all"; then
2088         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2089     elif test "$option" = "no" -o "$option" = "none"; then
2090         MOZ_EXTENSIONS=""
2091     elif test "$option" = "default"; then
2092         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2093     elif test `echo "$option" | grep -c \^-` != 0; then
2094         option=`echo $option | sed 's/^-//'`
2095         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2096     else
2097         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2098     fi
2099 done],
2100     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2102 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2103 dnl when trying to build a nonexistent extension.
2104 for extension in $MOZ_EXTENSIONS; do
2105     if test ! -d "${srcdir}/extensions/${extension}"; then
2106         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2107     fi
2108 done
2110 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2111   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2114 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2115 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2116 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2117    MOZ_ENABLE_CAIRO_FT=1
2118    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2119    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2120    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2123 AC_CHECK_PROGS(WGET, wget, "")
2124 AC_SUBST(WGET)
2126 dnl ========================================================
2127 dnl Updater
2128 dnl ========================================================
2130 if test "$MOZ_IOS"; then
2131   MOZ_UPDATER=
2134 MOZ_ARG_DISABLE_BOOL(updater,
2135 [  --disable-updater       Disable building of updater],
2136     MOZ_UPDATER=,
2137     MOZ_UPDATER=1 )
2139 if test -n "$MOZ_UPDATER"; then
2140     AC_DEFINE(MOZ_UPDATER)
2143 dnl ========================================================
2144 dnl parental controls (for Windows Vista)
2145 dnl ========================================================
2146 MOZ_ARG_DISABLE_BOOL(parental-controls,
2147 [  --disable-parental-controls
2148                           Do not build parental controls],
2149    MOZ_DISABLE_PARENTAL_CONTROLS=1,
2150    MOZ_DISABLE_PARENTAL_CONTROLS=)
2151 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2152     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2155 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2157 dnl ========================================================
2158 dnl = Disable smartcard support
2159 dnl ========================================================
2160 if test -n "$MOZ_NO_SMART_CARDS"; then
2161     AC_DEFINE(MOZ_NO_SMART_CARDS)
2163 AC_SUBST(MOZ_NO_SMART_CARDS)
2165 dnl ========================================================
2166 dnl = Sandboxing support
2167 dnl ========================================================
2168 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2169     # Bug 1182565: TSan conflicts with sandboxing on Linux.
2170     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2171     case $OS_TARGET in
2172     Linux|Android)
2173         MOZ_SANDBOX=
2174         ;;
2175     esac
2178 MOZ_ARG_DISABLE_BOOL(sandbox,
2179 [  --disable-sandbox        Disable sandboxing support],
2180     MOZ_SANDBOX=,
2181     MOZ_SANDBOX=1)
2183 case "$OS_TARGET" in
2184 WINNT|Darwin|OpenBSD)
2186 Linux)
2187     case $CPU_ARCH in
2188         x86_64|x86)
2189         ;;
2190         # Linux sandbox is only available on x86 and x86_64.
2191         *)
2192             MOZ_SANDBOX=
2193         ;;
2194     esac
2195     ;;
2197     # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2198     MOZ_SANDBOX=
2200 esac
2202 if test -n "$MOZ_SANDBOX"; then
2203     AC_DEFINE(MOZ_SANDBOX)
2206 AC_SUBST(MOZ_SANDBOX)
2209 dnl ========================================================
2210 dnl =
2211 dnl = Module specific options
2212 dnl =
2213 dnl ========================================================
2214 MOZ_ARG_HEADER(Individual module options)
2216 dnl ========================================================
2217 dnl Check for sqlite
2218 dnl ========================================================
2220 MOZ_SYSTEM_SQLITE=
2221 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2222 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
2223 MOZ_SYSTEM_SQLITE=1,
2224 MOZ_SYSTEM_SQLITE= )
2226 if test -n "$MOZ_SYSTEM_SQLITE"
2227 then
2228     dnl ============================
2229     dnl === SQLite Version check ===
2230     dnl ============================
2231     dnl Check to see if the system SQLite package is new enough.
2232     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2233 else
2234     dnl ==============================
2235     dnl === SQLite fdatasync check ===
2236     dnl ==============================
2237     dnl Check to see if fdatasync is available
2238     AC_CHECK_FUNC(fdatasync)
2241 if test -n "$MOZ_SYSTEM_SQLITE"; then
2242     AC_DEFINE(MOZ_SYSTEM_SQLITE)
2244 AC_SUBST(MOZ_SYSTEM_SQLITE)
2246 dnl ========================================================
2247 dnl = Disable zipwriter
2248 dnl ========================================================
2249 MOZ_ARG_DISABLE_BOOL(zipwriter,
2250 [  --disable-zipwriter     Disable zipwriter component],
2251     MOZ_ZIPWRITER=,
2252     MOZ_ZIPWRITER=1 )
2253 AC_SUBST(MOZ_ZIPWRITER)
2255 dnl ========================================================
2256 dnl =
2257 dnl = Feature options that require extra sources to be pulled
2258 dnl =
2259 dnl ========================================================
2260 dnl MOZ_ARG_HEADER(Features that require extra sources)
2262 dnl ========================================================
2263 dnl =
2264 dnl = Runtime debugging and Optimization Options
2265 dnl =
2266 dnl ========================================================
2267 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2269 dnl ========================================================
2270 dnl enable mobile optimizations
2271 dnl ========================================================
2272 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2273 [  --enable-mobile-optimize
2274                           Enable mobile optimizations],
2275     MOZ_GFX_OPTIMIZE_MOBILE=1)
2277 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2279 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2280     # We ignore paint will resample on mobile for performance.
2281     # We may want to revisit this later.
2282     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2284     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2285     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2288 dnl ========================================================
2289 dnl = Enable code optimization. ON by default.
2290 dnl ========================================================
2292 # Use value from moz.configure if one is defined. Else use our computed
2293 # value.
2294 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2295     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2298 if test "$COMPILE_ENVIRONMENT"; then
2299 if test -n "$MOZ_OPTIMIZE"; then
2300     AC_MSG_CHECKING([for valid C compiler optimization flags])
2301     _SAVE_CFLAGS=$CFLAGS
2302     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2303     AC_TRY_COMPILE([#include <stdio.h>],
2304         [printf("Hello World\n");],
2305         _results=yes,
2306         _results=no)
2307     AC_MSG_RESULT([$_results])
2308     if test "$_results" = "no"; then
2309         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2310     fi
2311     CFLAGS=$_SAVE_CFLAGS
2312     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2313         # When using llvm-based LTO, non numeric optimization levels are
2314         # not supported by the linker, so force the linker to use -O2 (
2315         # which doesn't influence the level compilation units are actually
2316         # compiled at).
2317         case " $MOZ_OPTIMIZE_FLAGS " in
2318         *\ -Os\ *|*\ -Oz\ *)
2319             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2320             ;;
2321         esac
2322     fi
2324 fi # COMPILE_ENVIRONMENT
2326 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2327 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2328 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2330 dnl ========================================================
2331 dnl = Enable runtime logging
2332 dnl ========================================================
2333 AC_DEFINE(MOZ_LOGGING)
2334 AC_DEFINE(FORCE_PR_LOG)
2336 dnl ========================================================
2337 dnl = This will enable logging of addref, release, ctor, dtor.
2338 dnl ========================================================
2339 _ENABLE_LOGREFCNT=42
2340 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2341 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
2342     _ENABLE_LOGREFCNT=1,
2343     _ENABLE_LOGREFCNT= )
2344 if test "$_ENABLE_LOGREFCNT" = "1"; then
2345     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2346 elif test -z "$_ENABLE_LOGREFCNT"; then
2347     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2350 dnl ========================================================
2351 dnl moz_dump_painting
2352 dnl ========================================================
2353 MOZ_ARG_ENABLE_BOOL(dump-painting,
2354 [  --enable-dump-painting          Enable paint debugging.],
2355     MOZ_DUMP_PAINTING=1,
2356     MOZ_DUMP_PAINTING= )
2357 if test -n "$MOZ_DUMP_PAINTING"; then
2358     AC_DEFINE(MOZ_DUMP_PAINTING)
2359     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2361 if test -n "$MOZ_DEBUG"; then
2362     AC_DEFINE(MOZ_DUMP_PAINTING)
2365 case "${OS_TARGET}" in
2366 Android|WINNT|Darwin)
2367   MOZ_GLUE_IN_PROGRAM=
2368   ;;
2370   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2371   MOZ_GLUE_IN_PROGRAM=1
2372   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2373   ;;
2374 esac
2376 dnl ========================================================
2377 dnl = Jemalloc build setup
2378 dnl ========================================================
2379 if test -z "$MOZ_MEMORY"; then
2380   case "${target}" in
2381     *-mingw*)
2382       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2383         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.])
2384       fi
2385       ;;
2386   esac
2387 else
2388   dnl The generic feature tests that determine how to compute ncpus are long and
2389   dnl complicated.  Therefore, simply define special cpp variables for the
2390   dnl platforms we have special knowledge of.
2391   case "${target}" in
2392   *-mingw*)
2393     export MOZ_NO_DEBUG_RTL=1
2394     ;;
2395   esac
2396 fi # MOZ_MEMORY
2397 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2399 dnl ========================================================
2400 dnl = Enable using the clang plugin to build
2401 dnl ========================================================
2403 if test -n "$COMPILE_ENVIRONMENT"; then
2404 MOZ_CONFIG_CLANG_PLUGIN
2405 fi # COMPILE_ENVIRONMENT
2407 dnl ========================================================
2408 dnl = Enable stripping of libs & executables
2409 dnl ========================================================
2410 MOZ_ARG_ENABLE_BOOL(strip,
2411 [  --enable-strip          Enable stripping of libs & executables ],
2412     ENABLE_STRIP=1,
2413     ENABLE_STRIP= )
2415 dnl ========================================================
2416 dnl = Enable stripping of libs & executables when packaging
2417 dnl ========================================================
2418 MOZ_ARG_ENABLE_BOOL(install-strip,
2419 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
2420     PKG_SKIP_STRIP= ,
2421     PKG_SKIP_STRIP=1)
2423 dnl ========================================================
2424 dnl = frontend JS debug mode
2425 dnl ========================================================
2427 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2428 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
2429    DEBUG_JS_MODULES=1,
2430    DEBUG_JS_MODULES=)
2432 AC_SUBST(DEBUG_JS_MODULES)
2434 dnl ========================================================
2435 dnl =
2436 dnl = Profiling and Instrumenting
2437 dnl =
2438 dnl ========================================================
2439 MOZ_ARG_HEADER(Profiling and Instrumenting)
2441 dnl ========================================================
2442 dnl = Offer a way to disable the startup cache
2443 dnl ========================================================
2445 MOZ_ARG_DISABLE_BOOL(startupcache,
2446 [  --disable-startupcache          Disable startup cache ],
2447     MOZ_DISABLE_STARTUPCACHE=1,
2448     MOZ_DISABLE_STARTUPCACHE=)
2450 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2451   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2453 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2455 dnl ========================================================
2456 dnl = Support for demangling undefined symbols
2457 dnl ========================================================
2458 if test -z "$SKIP_LIBRARY_CHECKS"; then
2459     AC_LANG_SAVE
2460     AC_LANG_CPLUSPLUS
2461     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2462     AC_LANG_RESTORE
2465 # Demangle only for debug or DMD builds
2466 MOZ_DEMANGLE_SYMBOLS=
2467 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2468     MOZ_DEMANGLE_SYMBOLS=1
2469     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2471 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2473 dnl ========================================================
2474 dnl = Support for gcc stack unwinding (from gcc 3.3)
2475 dnl ========================================================
2476 if test -z "$SKIP_LIBRARY_CHECKS"; then
2477     AC_LANG_SAVE
2478     AC_LANG_CPLUSPLUS
2479     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2480     AC_LANG_RESTORE
2483 dnl ========================================================
2484 dnl JIT observers
2485 dnl ========================================================
2487 MOZ_ARG_WITH_STRING(jitreport-granularity,
2488 [  --jitreport-granularity=N
2489                            Default granularity at which to report JIT code
2490                            to external tools
2491                              0 - no info
2492                              1 - code ranges for whole functions only
2493                              2 - per-line information
2494                              3 - per-op information],
2495   JITREPORT_GRANULARITY=$withval,
2496   JITREPORT_GRANULARITY=3)
2498 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2500 dnl ========================================================
2501 dnl =
2502 dnl = Misc. Options
2503 dnl =
2504 dnl ========================================================
2505 MOZ_ARG_HEADER(Misc. Options)
2507 dnl ========================================================
2508 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2509 dnl ========================================================
2510 MOZ_ARG_WITH_STRING(user-appdir,
2511 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
2512 [ val=`echo $withval`
2513 if echo "$val" | grep "\/" >/dev/null; then
2514     AC_MSG_ERROR("Homedir must be single relative path.")
2515 else
2516     MOZ_USER_DIR="$val"
2517 fi])
2519 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2521 if test -z "$SKIP_COMPILER_CHECKS"; then
2522 dnl ========================================================
2523 dnl =
2524 dnl = Compiler Options
2525 dnl =
2526 dnl ========================================================
2527 MOZ_ARG_HEADER(Compiler Options)
2529 dnl ========================================================
2530 dnl Check for gcc -pipe support
2531 dnl ========================================================
2532 AC_MSG_CHECKING([for -pipe support])
2533 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2534     dnl Any gcc that supports firefox supports -pipe.
2535     CFLAGS="$CFLAGS -pipe"
2536     CXXFLAGS="$CXXFLAGS -pipe"
2537     AC_MSG_RESULT([yes])
2538 else
2539     AC_MSG_RESULT([no])
2542 fi # ! SKIP_COMPILER_CHECKS
2544 AC_LANG_C
2546 if test "$COMPILE_ENVIRONMENT"; then
2547 MOZ_EXPAND_LIBS
2548 fi # COMPILE_ENVIRONMENT
2550 dnl ========================================================
2551 dnl =
2552 dnl = Static Build Options
2553 dnl =
2554 dnl ========================================================
2555 MOZ_ARG_HEADER(Static build options)
2557 if test -z "$MOZ_SYSTEM_ZLIB"; then
2558 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
2559   ZLIB_IN_MOZGLUE=1
2560   AC_DEFINE(ZLIB_IN_MOZGLUE)
2564 AC_SUBST(ZLIB_IN_MOZGLUE)
2566 dnl ========================================================
2567 dnl =
2568 dnl = Standalone module options
2569 dnl =
2570 dnl ========================================================
2571 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2573 dnl Check for GLib.
2574 dnl ========================================================
2576 if test -z "$SKIP_PATH_CHECKS"; then
2577 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2578     if test "$MOZ_ENABLE_GTK" ; then
2579         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2580     fi
2584 if test -z "${GLIB_GMODULE_LIBS}" \
2585    -a -n "${GLIB_CONFIG}"\
2586     -a "${GLIB_CONFIG}" != no\
2587 ; then
2588     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2591 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2593 if test "$USE_FC_FREETYPE"; then
2594     if test "$COMPILE_ENVIRONMENT"; then
2595         dnl ========================================================
2596         dnl = Check for freetype2 functionality
2597         dnl ========================================================
2598         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2599             _SAVE_LIBS="$LIBS"
2600             _SAVE_CFLAGS="$CFLAGS"
2601             LIBS="$LIBS $FT2_LIBS"
2602             CFLAGS="$CFLAGS $FT2_CFLAGS"
2604             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2605                 ac_cv_member_FT_Bitmap_Size_y_ppem,
2606                 [AC_TRY_COMPILE([#include <ft2build.h>
2607                                  #include FT_FREETYPE_H],
2608                                 [FT_Bitmap_Size s;
2609                                  if (sizeof s.y_ppem) return 0;
2610                                  return 1],
2611                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2612                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2613             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2614                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2615             else
2616                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2617             fi
2618             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2619                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2620                                [FT_Bitmap_Size structure includes y_ppem field])
2622             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2624             LIBS="$_SAVE_LIBS"
2625             CFLAGS="$_SAVE_CFLAGS"
2626         fi
2628         _SAVE_CPPFLAGS="$CPPFLAGS"
2629         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2630         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2631             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2632         CPPFLAGS="$_SAVE_CPPFLAGS"
2633     fi
2636 dnl ========================================================
2637 dnl Check if we need the 32-bit Linux SSE2 error dialog
2638 dnl ========================================================
2640 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2642 dnl ========================================================
2643 dnl Check for pixman and cairo
2644 dnl ========================================================
2646 MOZ_TREE_CAIRO=1
2647 MOZ_ARG_ENABLE_BOOL(system-cairo,
2648 [ --enable-system-cairo  Obsolete: do not use this option],
2649 AC_MSG_ERROR(--enable-system-cairo is not supported),
2650 MOZ_TREE_CAIRO=1 )
2652 MOZ_TREE_PIXMAN=1
2653 MOZ_ARG_ENABLE_BOOL(system-pixman,
2654 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2655 MOZ_TREE_PIXMAN=,
2656 MOZ_TREE_PIXMAN=force,
2657 MOZ_TREE_PIXMAN=1 )
2659 if test "$MOZ_TREE_PIXMAN"; then
2660     AC_DEFINE(MOZ_TREE_PIXMAN)
2661 else
2662     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2665 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2666 AC_DEFINE(MOZ_TREE_CAIRO)
2668 if test "$OS_ARCH" = "WINNT"; then
2669     # For now we assume that we will have a uint64_t available through
2670     # one of the above headers or mozstdint.h.
2671     AC_DEFINE(HAVE_UINT64_T)
2674 # Define macros for cairo-features.h
2675 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2676 if test "$MOZ_X11"; then
2677     XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2678     XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2679     PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2681 if test "$_HAVE_FREETYPE2"; then
2682     FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2683     MOZ_ENABLE_CAIRO_FT=1
2684     CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2687 case "$MOZ_WIDGET_TOOLKIT" in
2688   cocoa | uikit)
2689     QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2690     QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2691     QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2692     ;;
2693   windows)
2694     WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2695     WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2696     WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2698     if test "$COMPILE_ENVIRONMENT"; then
2699       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2700     fi
2701     ;;
2702 esac
2703 if test "$USE_FC_FREETYPE"; then
2704     FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2706 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2707 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2709 AC_SUBST(PS_SURFACE_FEATURE)
2710 AC_SUBST(SVG_SURFACE_FEATURE)
2711 AC_SUBST(XLIB_SURFACE_FEATURE)
2712 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2713 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2714 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2715 AC_SUBST(WIN32_SURFACE_FEATURE)
2716 AC_SUBST(OS2_SURFACE_FEATURE)
2717 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2718 AC_SUBST(FT_FONT_FEATURE)
2719 AC_SUBST(FC_FONT_FEATURE)
2720 AC_SUBST(WIN32_FONT_FEATURE)
2721 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2722 AC_SUBST(QUARTZ_FONT_FEATURE)
2723 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2724 AC_SUBST(QT_SURFACE_FEATURE)
2725 AC_SUBST(TEE_SURFACE_FEATURE)
2727 if test "$MOZ_X11"; then
2728     MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2731 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2733 case "$MOZ_WIDGET_TOOLKIT" in
2734 android)
2735     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2736     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2737     ;;
2738 esac
2740 AC_SUBST(MOZ_TREE_CAIRO)
2741 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2742 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2743 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2744 AC_SUBST(MOZ_TREE_PIXMAN)
2746 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2747 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2748 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2749 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2751 dnl ========================================================
2752 dnl disable xul
2753 dnl ========================================================
2754 MOZ_ARG_DISABLE_BOOL(xul,
2755 [  --disable-xul           Disable XUL],
2756     MOZ_XUL= )
2757 if test "$MOZ_XUL"; then
2758   AC_DEFINE(MOZ_XUL)
2759 else
2760   dnl remove extensions that require XUL
2761   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2764 AC_SUBST(MOZ_XUL)
2766 dnl ========================================================
2767 dnl necko configuration options
2768 dnl ========================================================
2771 dnl option to disable necko's wifi scanner
2774 if test "$MOZ_WIDGET_TOOLKIT"; then
2776   case "$OS_TARGET" in
2777     Darwin)
2778       if test -z "$MOZ_IOS"; then
2779         NECKO_WIFI=1
2780       fi
2781       ;;
2782     DragonFly|FreeBSD|WINNT)
2783       NECKO_WIFI=1
2784       ;;
2785     Linux)
2786       NECKO_WIFI=1
2787       NECKO_WIFI_DBUS=1
2788       ;;
2789   esac
2793 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2794 [  --disable-necko-wifi    Disable necko wifi scanner],
2795     NECKO_WIFI=,
2796     NECKO_WIFI=1)
2798 if test "$NECKO_WIFI"; then
2799   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2800     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2801   fi
2802   AC_DEFINE(NECKO_WIFI)
2803   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2805 AC_SUBST(NECKO_WIFI)
2806 AC_SUBST(NECKO_WIFI_DBUS)
2809 dnl option to disable cookies
2811 MOZ_ARG_DISABLE_BOOL(cookies,
2812 [  --disable-cookies       Disable cookie support],
2813     NECKO_COOKIES=,
2814     NECKO_COOKIES=1)
2815 AC_SUBST(NECKO_COOKIES)
2816 if test "$NECKO_COOKIES"; then
2817     AC_DEFINE(NECKO_COOKIES)
2818     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2821 dnl ========================================================
2822 dnl =
2823 dnl = Maintainer debug option (no --enable equivalent)
2824 dnl =
2825 dnl ========================================================
2827 AC_SUBST(NM)
2828 AC_SUBST_LIST(ASFLAGS)
2829 AC_SUBST(RCFLAGS)
2830 AC_SUBST(IMPLIB)
2831 AC_SUBST(FILTER)
2832 AC_SUBST(MOZ_AUTH_EXTENSION)
2833 AC_SUBST(MOZ_PREF_EXTENSIONS)
2834 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2835 AC_SUBST_LIST(WARNINGS_CFLAGS)
2836 AC_SUBST_SET(MOZ_EXTENSIONS)
2838 AC_SUBST(MOZ_UNIVERSALCHARDET)
2839 AC_SUBST(MOZ_SPELLCHECK)
2840 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2841 AC_SUBST(MOZ_CRASHREPORTER)
2842 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2843 AC_SUBST(MOZ_STUB_INSTALLER)
2844 AC_SUBST(MOZ_UPDATER)
2846 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2847 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2848 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2849 AC_SUBST(ENABLE_STRIP)
2850 AC_SUBST(PKG_SKIP_STRIP)
2851 AC_SUBST(STRIP_FLAGS)
2852 AC_SUBST(INCREMENTAL_LINKER)
2854 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2856 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2857 AC_SUBST(MOZ_LINKER_EXTRACT)
2859 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2860   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2863 AC_SUBST(MOZ_REQUIRE_SIGNING)
2864 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2865   AC_DEFINE(MOZ_REQUIRE_SIGNING)
2868 dnl ========================================================
2869 dnl = Mac bundle name prefix
2870 dnl ========================================================
2871 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2872 [  --with-macbundlename-prefix=prefix
2873                           Prefix for MOZ_MACBUNDLE_NAME],
2874 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2876 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2877 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2878   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2881 if test "$MOZ_DEBUG"; then
2882   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2883 else
2884   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2886 AC_SUBST(MOZ_MACBUNDLE_NAME)
2888 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2889 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2890 # Otherwise, use MOZ_APP_DISPLAYNAME
2891 if test -z "$MOZ_MACBUNDLE_ID"; then
2892    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2894 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2895 if test "$MOZ_DEBUG"; then
2896   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2899 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2900 AC_SUBST(MOZ_MACBUNDLE_ID)
2902 dnl ========================================================
2903 dnl = Child Process Name for IPC
2904 dnl ========================================================
2905 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2906   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2907 else
2908   # We want to let Android unpack the file at install time, but it only does
2909   # so if the file is named libsomething.so. The lib/ path is also required
2910   # because the unpacked file will be under the lib/ subdirectory and will
2911   # need to be executed from that path.
2912   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2914 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2915 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2917 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2918 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2919 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2921 # The following variables are available to branding and application
2922 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2923 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2924 # impacts profile location and user-visible fields.
2925 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2926 # versions of a given application (e.g. Aurora and Firefox both use
2927 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2928 # for application.ini's "Name" field, which controls profile location in
2929 # the absence of a "Profile" field (see below), and various system
2930 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2931 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2932 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2933 # builds (e.g. Aurora for Firefox).
2934 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2935 # defaults to a lowercase form of MOZ_APP_BASENAME.
2936 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2937 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2938 # - MOZ_APP_PROFILE: When set, used for application.ini's
2939 # "Profile" field, which controls profile location.
2940 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2941 # crash reporter server url.
2942 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
2943 # the main application is set to the value of this variable.  If not
2944 # set, it falls back to a Mozilla-specific value derived from the
2945 # build ID.
2946 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
2947 # packages produced.
2948 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used.  GCM
2949 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
2950 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
2951 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2953 # The following environment variables used to have an effect, but don't anymore:
2954 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2955 # the contents from the version.txt file in the application directory, or
2956 # browser/config/version.txt if there isn't one.
2957 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2958 # in the "About" window. This was replaced with the contents from the
2959 # version_display.txt or version.txt in the application directory, or
2960 # browser/config/version_display.txt.
2962 if test -z "$MOZ_APP_NAME"; then
2963    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2966 if test -z "$MOZ_APP_REMOTINGNAME"; then
2967    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2970 if test -z "$ANDROID_PACKAGE_NAME" ; then
2971    # When we got rid of the Aurora channel we decided to replace the old
2972    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2973    # by all mozilla-central based branches we make this the new "default"
2974    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2975    # in their mozconfig, so they will never get this. If there are ever
2976    # non-Fennec builds for Android, they will fall into the else block
2977    # and use their own default name.
2978    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2979    # background on this.
2980    if test "$MOZ_APP_NAME" = "fennec"; then
2981       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2982    else
2983       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2984    fi
2987 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
2988 # the public with specific common shared IDs and we need to keep them
2989 # consistent forever.  The specific common values are set by per-channel
2990 # branding; all other channels use a generic sharedID, set below.
2991 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
2992    MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
2995 # For extensions and langpacks, we require a max version that is compatible
2996 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2997 # 24.0a1 and 24.0a2 aren't affected
2998 # 24.0 becomes 24.*
2999 # 24.1.1 becomes 24.*
3000 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3001 if test -z "$IS_ALPHA"; then
3002   changequote(,)
3003   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3004     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3005   else
3006     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3007   fi
3008   changequote([,])
3009 else
3010   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3013 AC_SUBST(MOZ_APP_NAME)
3014 AC_SUBST(MOZ_APP_REMOTINGNAME)
3015 AC_SUBST(MOZ_APP_DISPLAYNAME)
3016 AC_SUBST(MOZ_APP_BASENAME)
3017 AC_SUBST(MOZ_APP_VENDOR)
3018 AC_SUBST(MOZ_APP_PROFILE)
3019 AC_SUBST(MOZ_APP_ID)
3020 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3021 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3022 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3023 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3024 AC_SUBST(MAR_CHANNEL_ID)
3025 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3026 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3027 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3028 AC_SUBST(MOZ_APP_UA_NAME)
3029 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3030 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3031 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3033 AC_SUBST(MOZ_APP_MAXVERSION)
3034 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3035 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3036   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3039 AC_SUBST(MOZ_PKG_SPECIAL)
3040 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3042 if test "$MOZILLA_OFFICIAL"; then
3043     # Build revisions should always be present in official builds
3044     MOZ_INCLUDE_SOURCE_INFO=1
3047 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3048 # explicitly set the repository and changeset information in.
3049 AC_SUBST(MOZ_SOURCE_REPO)
3050 AC_SUBST(MOZ_SOURCE_CHANGESET)
3051 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3053 dnl If we have any service that uploads data (and requires data submission
3054 dnl policy alert), set MOZ_DATA_REPORTING.
3055 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3056 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"  || test -n "$MOZ_NORMANDY"; then
3057   MOZ_DATA_REPORTING=1
3058   AC_DEFINE(MOZ_DATA_REPORTING)
3059   AC_SUBST(MOZ_DATA_REPORTING)
3062 dnl win32 options
3063 AC_SUBST(WIN32_REDIST_DIR)
3064 AC_SUBST(WIN_UCRT_REDIST_DIR)
3066 dnl ========================================================
3067 dnl ICU Support
3068 dnl ========================================================
3070 _INTL_API=yes
3072 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3073     USE_ICU=1
3076 MOZ_CONFIG_ICU()
3078 dnl Echo the CFLAGS to remove extra whitespace.
3079 CFLAGS=`echo \
3080     $_COMPILATION_CFLAGS \
3081     $CFLAGS`
3083 CXXFLAGS=`echo \
3084     $_WARNINGS_CXXFLAGS \
3085     $_COMPILATION_CXXFLAGS \
3086     $CXXFLAGS`
3088 COMPILE_CFLAGS=`echo \
3089     $_DEFINES_CFLAGS \
3090     $COMPILE_CFLAGS`
3092 COMPILE_CXXFLAGS=`echo \
3093     $_DEFINES_CXXFLAGS \
3094     $COMPILE_CXXFLAGS`
3096 HOST_CFLAGS=`echo \
3097     $_WARNINGS_HOST_CFLAGS \
3098     $_COMPILATION_HOST_CFLAGS \
3099     $HOST_CFLAGS`
3101 HOST_CXXFLAGS=`echo \
3102     $_WARNINGS_HOST_CXXFLAGS \
3103     $_COMPILATION_HOST_CXXFLAGS \
3104     $HOST_CXXFLAGS`
3106 AC_SUBST(MOZ_SYSTEM_PNG)
3108 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3109 AC_SUBST_LIST(MOZ_PNG_LIBS)
3111 AC_SUBST(MOZ_SYSTEM_NSPR)
3113 AC_SUBST(MOZ_SYSTEM_NSS)
3115 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3116 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3117 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3118 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3119 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3120   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3121   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3123 AC_SUBST(HOST_CMFLAGS)
3124 AC_SUBST(HOST_CMMFLAGS)
3125 AC_SUBST(OS_COMPILE_CMFLAGS)
3126 AC_SUBST(OS_COMPILE_CMMFLAGS)
3128 OS_CFLAGS="$CFLAGS"
3129 OS_CXXFLAGS="$CXXFLAGS"
3130 OS_CPPFLAGS="$CPPFLAGS"
3131 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3132 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3133 OS_LDFLAGS="$LDFLAGS"
3134 OS_LIBS="$LIBS"
3135 AC_SUBST_LIST(OS_CFLAGS)
3136 AC_SUBST_LIST(OS_CXXFLAGS)
3137 AC_SUBST_LIST(OS_CPPFLAGS)
3138 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3139 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3140 AC_SUBST_LIST(OS_LDFLAGS)
3141 AC_SUBST(OS_LIBS)
3143 AC_SUBST(HOST_CC)
3144 AC_SUBST(HOST_CXX)
3145 AC_SUBST_LIST(HOST_CFLAGS)
3146 AC_SUBST_LIST(HOST_CPPFLAGS)
3147 AC_SUBST_LIST(HOST_CXXFLAGS)
3148 AC_SUBST(HOST_LDFLAGS)
3149 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3150 AC_SUBST(HOST_BIN_SUFFIX)
3152 AC_SUBST(TARGET_XPCOM_ABI)
3153 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3154 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3155 AC_SUBST(HAVE_X86_AVX2)
3156 AC_SUBST(HAVE_ALTIVEC)
3158 AC_SUBST_LIST(DSO_CFLAGS)
3159 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3160 AC_SUBST(DSO_LDOPTS)
3161 AC_SUBST(BIN_SUFFIX)
3162 AC_SUBST(USE_N32)
3163 AC_SUBST(NS_ENABLE_TSF)
3164 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3165 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3167 AC_SUBST(MOZ_DEVTOOLS)
3169 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3170 AC_SUBST(MOZ_FOLD_LIBS)
3171 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3173 AC_SUBST(DMG_TOOL)
3175 dnl Host JavaScript runtime, if any, to use during cross compiles.
3176 AC_SUBST(JS_BINARY)
3178 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3180 if test -n "$COMPILE_ENVIRONMENT"; then
3181 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3183 dnl Check for missing components
3184 if test "$MOZ_X11"; then
3185     dnl ====================================================
3186     dnl = Check if X headers exist
3187     dnl ====================================================
3188     _SAVE_CFLAGS=$CFLAGS
3189     CFLAGS="$CFLAGS $XCFLAGS"
3190     AC_TRY_COMPILE([
3191         #include <stdio.h>
3192         #include <stdlib.h>
3193         #include <X11/Xlib.h>
3194         #include <X11/Intrinsic.h>
3195         #include <X11/extensions/XShm.h>
3196     ],
3197     [
3198         Display *dpy = 0;
3199         if ((dpy = XOpenDisplay(NULL)) == NULL) {
3200             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3201             exit(1);
3202         }
3203     ], [],
3204     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3205     CFLAGS="$_SAVE_CFLAGS"
3207     if test -n "$MISSING_X"; then
3208         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3209     fi
3211 fi # MOZ_X11
3213 fi # COMPILE_ENVIRONMENT
3215 dnl Set various defines and substitutions
3216 dnl ========================================================
3218 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3219     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3220     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3221     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3222     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3223     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3224     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3225     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3226     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3229 AC_SUBST(MOZ_DEV_EDITION)
3230 if test -n "$MOZ_DEV_EDITION"; then
3231     AC_DEFINE(MOZ_DEV_EDITION)
3234 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3235     A11Y_LOG=1
3237 AC_SUBST(A11Y_LOG)
3238 if test -n "$A11Y_LOG"; then
3239     AC_DEFINE(A11Y_LOG)
3242 dnl Spit out some output
3243 dnl ========================================================
3245 dnl The following defines are used by xpcom
3246 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3247 HAVE_GETPAGESIZE
3248 HAVE_STATVFS64
3249 HAVE_STATVFS
3250 HAVE_STATFS64
3251 HAVE_STATFS
3252 HAVE_SYS_STATVFS_H
3253 HAVE_SYS_STATFS_H
3254 HAVE_SYS_VFS_H
3255 HAVE_SYS_MOUNT_H
3258 # Avoid using obsolete NSPR features
3259 AC_DEFINE(NO_NSPR_10_SUPPORT)
3261 MOZ_CREATE_CONFIG_STATUS()
3263 rm -fr confdefs* $ac_clean_files