Bug 1521678 - Implement property value editor in the new rules view. r=rcaliman
[gecko.git] / old-configure.in
blob767c2ffc69af01ecd4240a4b57b5d39192546610
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.19
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 GCONF_VERSION=1.2.1
65 STARTUP_NOTIFICATION_VERSION=0.8
66 DBUS_VERSION=0.60
67 SQLITE_VERSION=3.26.0
69 dnl Set various checks
70 dnl ========================================================
71 MISSING_X=
73 dnl Initialize the Pthread test variables early so they can be
74 dnl  overridden by each platform.
75 dnl ========================================================
76 MOZ_USE_PTHREADS=
77 _PTHREAD_LDFLAGS=""
79 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
81 if test "$COMPILE_ENVIRONMENT"; then
82     MOZ_ANDROID_NDK
83 fi # COMPILE_ENVIRONMENT
85 case "$target" in
86 *-android*|*-linuxandroid*)
87     AC_DEFINE(ANDROID)
88     ;;
89 *-linux*)
90     AC_PATH_PROG(OBJCOPY,objcopy)
91     ;;
92 esac
94 case "$target" in
95 *-apple-darwin*)
96     MOZ_IOS_SDK
97     ;;
98 esac
100 AC_SUBST(ANDROID_SOURCE)
101 AC_SUBST(ANDROID_PACKAGE_NAME)
102 AC_SUBST(OBJCOPY)
104 dnl ========================================================
105 dnl Checks for compilers.
106 dnl ========================================================
108 if test "$COMPILE_ENVIRONMENT"; then
110 if test "$target" != "$host"; then
111     MOZ_CROSS_COMPILER
112 else
113     AC_PROG_CC
114     case "$target" in
115     *-mingw*)
116       # Work around the conftest.exe access problem on Windows
117       sleep 2
118     esac
119     AC_PROG_CXX
120     AC_PROG_RANLIB
121     MOZ_PATH_PROGS(AS, $AS as, $CC)
122     AC_CHECK_PROGS(STRIP, strip, :)
123     AC_CHECK_PROGS(OTOOL, otool, :)
126 if test -n "$MOZ_WINCONSOLE"; then
127     AC_DEFINE(MOZ_WINCONSOLE)
130 MOZ_TOOL_VARIABLES
132 dnl ========================================================
133 dnl Special win32 checks
134 dnl ========================================================
136 WINVER=601
138 case "$target" in
139 *-mingw*)
140     if test "$GCC" != "yes"; then
141         # Check to see if we are really running in a msvc environemnt
142         _WIN32_MSVC=1
144         # Make sure compilers are valid
145         CFLAGS="$CFLAGS -nologo"
146         CXXFLAGS="$CXXFLAGS -TP -nologo"
147         AC_LANG_SAVE
148         AC_LANG_C
149         AC_TRY_COMPILE([#include <stdio.h>],
150             [ printf("Hello World\n"); ],,
151             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
153         AC_LANG_CPLUSPLUS
154         AC_TRY_COMPILE([#include <new.h>],
155             [ unsigned *test = new unsigned(42); ],,
156             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
157         AC_LANG_RESTORE
159         changequote(,)
160         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
161         changequote([,])
163         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
164         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
165         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
167         _CC_SUITE=14
168         MSVC_C_RUNTIME_DLL=vcruntime140.dll
169         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
171         MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
172         if test -n "$MSVC_HAS_DIA_SDK"; then
173             AC_DEFINE(MSVC_HAS_DIA_SDK)
174         fi
176         # C5038: Enable initializer list order warnings
177         # The -w1#### flag treats warning C#### as if it was a warning level
178         # 1 warning, and thus enables it because we enable /W3 warnings. We
179         # don't use -we#### because it would enable warning C#### but treat
180         # it as an error, even in third-party code.
181         # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
182         CXXFLAGS="$CXXFLAGS -w15038"
184         # C5026: move constructor was implicitly defined as deleted
185         CXXFLAGS="$CXXFLAGS -wd5026"
187         # C5027: move assignment operator was implicitly defined as deleted
188         CXXFLAGS="$CXXFLAGS -wd5027"
190         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
191         CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
193         # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
194         # for dbghelp.h, imagehlp.h, and shobj.h
195         # C4091: 'typedef ': ignored on left of '' when no variable is declared
196         CFLAGS="$CFLAGS -wd4091"
197         CXXFLAGS="$CXXFLAGS -wd4091"
199         # This is intended as a temporary hack to support building with VS2015.
200         # 'noexcept' used with no exception handling mode specified;
201         # termination on exception is not guaranteed. Specify /EHsc
202         CXXFLAGS="$CXXFLAGS -wd4577"
204         if test -n "$WIN_UCRT_REDIST_DIR"; then
205           if test ! -d "$WIN_UCRT_REDIST_DIR"; then
206             AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
207           fi
208           WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
209         fi
211         if test -n "$WIN_DIA_SDK_BIN_DIR"; then
212           if test ! -d "$WIN_DIA_SDK_BIN_DIR"; then
213             AC_MSG_ERROR([Invalid Windows DIA SDK directory: ${WIN_DIA_SDK_BIN_DIR}])
214           fi
215           WIN_DIA_SDK_BIN_DIR=`cd "$WIN_DIA_SDK_BIN_DIR" && pwd -W`
216         fi
218         AC_SUBST(MSVC_HAS_DIA_SDK)
219         AC_SUBST(MSVC_C_RUNTIME_DLL)
220         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
222         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
224         if test -n "$WIN32_REDIST_DIR"; then
225           if test ! -d "$WIN32_REDIST_DIR"; then
226             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
227           fi
228           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
229         fi
231         # Check linker version, except in lld builds
232         case "$LINKER" in
233         *lld*)
234             ;;
235         *)
236             _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
237             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
238             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
239                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
240             fi
241             ;;
242         esac
244         INCREMENTAL_LINKER=1
246         unset _MSVC_VER_FILTER
248         WRAP_STL_INCLUDES=1
249         STL_FLAGS="-I${DIST}/stl_wrappers"
250         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
251         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
252     else
253         # Check w32api version
254         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
255         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
256         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
257         AC_TRY_COMPILE([#include <w32api.h>],
258             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
259                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
260                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
261                 #error "test failed."
262             #endif
263             , [ res=yes ], [ res=no ])
264         AC_MSG_RESULT([$res])
265         if test "$res" != "yes"; then
266             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
267         fi
268         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
269         # causing problems with local implementations with the same name.
270         AC_DEFINE(STRSAFE_NO_DEPRECATE)
271     fi # !GNU_CC
273     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
274     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
275     # Require OS features provided by IE 8.0 (Win7)
276     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
278     ;;
279 esac
281 if test -n "$_WIN32_MSVC"; then
282     SKIP_PATH_CHECKS=1
283     SKIP_COMPILER_CHECKS=1
284     SKIP_LIBRARY_CHECKS=1
286     # Since we're skipping compiler and library checks, hard-code
287     # some facts here.
288     AC_DEFINE(HAVE_IO_H)
289     AC_DEFINE(HAVE_ISATTY)
292 fi # COMPILE_ENVIRONMENT
294 AC_SUBST(GNU_CC)
295 AC_SUBST(GNU_CXX)
297 AC_SUBST_LIST(STL_FLAGS)
298 AC_SUBST(WRAP_STL_INCLUDES)
300 dnl ========================================================
301 dnl Checks for programs.
302 dnl ========================================================
303 if test "$COMPILE_ENVIRONMENT"; then
305 AC_PATH_XTRA
307 XCFLAGS="$X_CFLAGS"
309 fi # COMPILE_ENVIRONMENT
311 dnl ========================================================
312 dnl set the defaults first
313 dnl ========================================================
314 MOZ_USER_DIR=".mozilla"
316 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
318 MOZ_FS_LAYOUT=unix
320 dnl Configure platform-specific CPU architecture compiler options.
321 dnl ==============================================================
322 if test "$COMPILE_ENVIRONMENT"; then
323     MOZ_ARCH_OPTS
324 else
325     if test "$OS_TARGET" = Android; then
326         dnl Default Android builds to ARMv7.
327         MOZ_ARCH=armv7-a
328     fi
329 fi # COMPILE_ENVIRONMENT
331 dnl ========================================================
332 dnl Android libstdc++, placed here so it can use MOZ_ARCH
333 dnl computed above.
334 dnl ========================================================
336 MOZ_ANDROID_CPU_ARCH
337 if test "$COMPILE_ENVIRONMENT"; then
338     MOZ_ANDROID_STLPORT
339 fi # COMPILE_ENVIRONMENT
341 dnl ========================================================
342 dnl Suppress Clang Argument Warnings
343 dnl ========================================================
344 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
345 if test -n "${CLANG_CC}${CLANG_CL}"; then
346     WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
347     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
349 if test -n "${CLANG_CXX}${CLANG_CL}"; then
350     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
353 if test -n "$COMPILE_ENVIRONMENT"; then
354    MOZ_CONFIG_SANITIZE
357 dnl ========================================================
358 dnl Add optional and non-optional hardening flags
359 dnl ========================================================
361 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
362 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
363 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
364 LDFLAGS="$LDFLAGS $MOZ_HARDENING_LDFLAGS"
366 dnl ========================================================
367 dnl GNU specific defaults
368 dnl ========================================================
369 if test "$GNU_CC"; then
370     MMX_FLAGS="-mmmx"
371     SSE_FLAGS="-msse"
372     SSE2_FLAGS="-msse2"
373     SSSE3_FLAGS="-mssse3"
374     # FIXME: Let us build with strict aliasing. bug 414641.
375     CFLAGS="$CFLAGS -fno-strict-aliasing"
376     WARNINGS_AS_ERRORS='-Werror'
377     DSO_CFLAGS=''
379     if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
380         DSO_PIC_CFLAGS='-fPIC'
381         ASFLAGS="$ASFLAGS -fPIC"
382     fi
384     AC_MSG_CHECKING([for --noexecstack option to as])
385     _SAVE_CFLAGS=$CFLAGS
386     CFLAGS="$CFLAGS -Wa,--noexecstack"
387     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
388                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
389                      AC_MSG_RESULT([no]))
390     CFLAGS=$_SAVE_CFLAGS
391     AC_MSG_CHECKING([for -z noexecstack option to ld])
392     _SAVE_LDFLAGS=$LDFLAGS
393     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
394     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
395                   AC_MSG_RESULT([no])
396                   LDFLAGS=$_SAVE_LDFLAGS)
398     AC_MSG_CHECKING([for -z text option to ld])
399     _SAVE_LDFLAGS=$LDFLAGS
400     LDFLAGS="$LDFLAGS -Wl,-z,text"
401     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
402                   AC_MSG_RESULT([no])
403                   LDFLAGS=$_SAVE_LDFLAGS)
405     AC_MSG_CHECKING([for -z relro option to ld])
406     _SAVE_LDFLAGS=$LDFLAGS
407     LDFLAGS="$LDFLAGS -Wl,-z,relro"
408     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
409                   AC_MSG_RESULT([no])
410                   LDFLAGS=$_SAVE_LDFLAGS)
412     AC_MSG_CHECKING([for -z nocopyreloc option to ld])
413     _SAVE_LDFLAGS=$LDFLAGS
414     LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
415     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
416                   AC_MSG_RESULT([no])
417                   LDFLAGS=$_SAVE_LDFLAGS)
419     AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
420     _SAVE_LDFLAGS=$LDFLAGS
421     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
422     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
423                   AC_MSG_RESULT([no])
424                   LDFLAGS=$_SAVE_LDFLAGS)
426     AC_MSG_CHECKING([for --build-id=sha1 option to ld])
427     _SAVE_LDFLAGS=$LDFLAGS
428     LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
429     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
430                   AC_MSG_RESULT([no])
431                   LDFLAGS=$_SAVE_LDFLAGS)
433     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
434     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
435     _SAVE_LDFLAGS=$LDFLAGS
436     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
437     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
438                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
439                   AC_MSG_RESULT([no]))
440     LDFLAGS=$_SAVE_LDFLAGS
442     # Check for -mssse3 on $CC
443     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
444     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
445     _SAVE_CFLAGS=$CFLAGS
446     CFLAGS="$CFLAGS -mssse3"
447     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
448                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
449                      AC_MSG_RESULT([no]))
450     CFLAGS=$_SAVE_CFLAGS
452     # Check for -msse4.1 on $CC
453     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
454     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
455     _SAVE_CFLAGS=$CFLAGS
456     CFLAGS="$CFLAGS -msse4.1"
457     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
458                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
459                      AC_MSG_RESULT([no]))
460     CFLAGS=$_SAVE_CFLAGS
462     case "${CPU_ARCH}" in
463     x86 | x86_64)
464       AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
465       AC_TRY_COMPILE([],
466                      [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
467                      result="yes", result="no")
468       AC_MSG_RESULT("$result")
469       if test "$result" = "yes"; then
470           HAVE_X86_AVX2=1
471       fi
472       ;;
474     ppc*)
475       AC_MSG_CHECKING([whether we can enable AltiVec support])
476       HAVE_ALTIVEC=
477       _SAVE_CFLAGS=$CFLAGS
478       CFLAGS="$CFLAGS -maltivec"
479       AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
480                        [HAVE_ALTIVEC=1],
481                        AC_MSG_RESULT([no]))
482       CFLAGS=$_SAVE_CFLAGS
483       ;;
484     esac
486     DSO_LDOPTS='-shared'
487     if test "$GCC_USE_GNU_LD"; then
488         # Some tools like ASan use a runtime library that is only
489         # linked against executables, so we must allow undefined
490         # symbols for shared objects in some cases.
491         if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
492             # Don't allow undefined symbols in libraries
493             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
495             # BSDs need `environ' exposed for posix_spawn (bug 753046)
496             case "$OS_TARGET" in
497             DragonFly|FreeBSD|NetBSD|OpenBSD)
498                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
499                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
500                 else
501                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
502                 fi
503                 ;;
504             esac
505         fi
506     fi
508     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
509     _USE_CPP_INCLUDE_FLAG=1
511     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
514 if test "$GNU_CXX"; then
515     # FIXME: Let us build with strict aliasing. bug 414641.
516     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
518     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
519     _USE_CPP_INCLUDE_FLAG=1
522 # For profiling builds keep the symbol information
523 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
524     case "$OS_TARGET" in
525     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
526         STRIP_FLAGS="--strip-debug"
527         ;;
528     esac
531 dnl ========================================================
532 dnl = Enable DMD
533 dnl ========================================================
535 if test "$MOZ_DMD"; then
536     if test "${CPU_ARCH}" = "arm"; then
537         CFLAGS="$CFLAGS -funwind-tables"
538         CXXFLAGS="$CXXFLAGS -funwind-tables"
539     fi
542 dnl ========================================================
543 dnl System overrides of the defaults for host
544 dnl ========================================================
545 case "$host" in
546 *mingw*)
547     if test -n "$_WIN32_MSVC"; then
548         HOST_CFLAGS="$HOST_CFLAGS -nologo"
549     else
550         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
551     fi
552     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
553     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
554     HOST_BIN_SUFFIX=.exe
556     case "${host_cpu}" in
557     i*86)
558         if test -n "$_WIN32_MSVC"; then
559             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
560         fi
561         ;;
562     x86_64)
563         if test -n "$_WIN32_MSVC"; then
564             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
565         fi
566         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
567         ;;
568     esac
569     ;;
571 *-darwin*)
572     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
573     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
574     ;;
576 *-linux*|*-kfreebsd*-gnu|*-gnu*)
577     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
578     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
579     ;;
582     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
583     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
584     ;;
585 esac
587 dnl ========================================================
588 dnl System overrides of the defaults for target
589 dnl ========================================================
591 case "$target" in
592 *-darwin*)
593     MOZ_OPTIMIZE_FLAGS="-O3"
594     CXXFLAGS="$CXXFLAGS -stdlib=libc++"
595     DSO_LDOPTS=''
596     STRIP_FLAGS="$STRIP_FLAGS -x -S"
597     # Ensure that if we're targeting iOS an SDK was provided.
598     AC_CACHE_CHECK(for iOS target,
599                    ac_cv_ios_target,
600                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
601 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
602 #error not iOS
603 #endif],
604                                    [],
605                                    ac_cv_ios_target="yes",
606                                    ac_cv_ios_target="no")])
607     if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
608        AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
609     fi
610     if test -z "$MOZ_IOS"; then
611         # The ExceptionHandling framework is needed for Objective-C exception
612         # logging code in nsObjCExceptions.h. Currently we only use that in debug
613         # builds.
614         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
615     fi
617     dnl DTrace and -dead_strip don't interact well. See bug 403132.
618     dnl ===================================================================
619     if test "x$enable_dtrace" = "xyes"; then
620         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
621     else
622         dnl check for the presence of the -dead_strip linker flag
623         AC_MSG_CHECKING([for -dead_strip option to ld])
624         _SAVE_LDFLAGS=$LDFLAGS
625         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
626         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
627         if test -n "$_HAVE_DEAD_STRIP" ; then
628             AC_MSG_RESULT([yes])
629             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
630         else
631             AC_MSG_RESULT([no])
632         fi
634         LDFLAGS=$_SAVE_LDFLAGS
635     fi
637     MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
638     ;;
640 *-android*|*-linuxandroid*)
641     AC_DEFINE(NO_PW_GECOS)
643     if test "$COMPILE_ENVIRONMENT"; then
644         MOZ_LINKER=1
645     fi
647     MOZ_GFX_OPTIMIZE_MOBILE=1
648     if test -z "$CLANG_CC"; then
649         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
650     else
651         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
652         # -Oz is smaller than -Os on clang.
653         MOZ_OPTIMIZE_FLAGS="-Oz"
654         # Disable the outliner, which causes performance regressions, and is
655         # enabled on some platforms at -Oz.
656         if test -z "$MOZ_LTO"; then
657             DISABLE_OUTLINER="-mno-outline"
658             _SAVE_CFLAGS=$CFLAGS
659             CFLAGS="$CFLAGS $DISABLE_OUTLINER"
660             AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
661             CFLAGS="$_SAVE_CFLAGS"
662         else
663             DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
664             _SAVE_LDFLAGS=$LDFLAGS
665             LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
666             AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
667             LDFLAGS="$_SAVE_LDFLAGS"
668         fi
669     fi
670     ;;
672 *-*linux*)
673     if test "$GNU_CC" -o "$GNU_CXX"; then
674         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
675         if test -n "$MOZ_DEBUG"; then
676             MOZ_OPTIMIZE_FLAGS="-Os"
677         else
678             MOZ_OPTIMIZE_FLAGS="-O2"
679         fi
680         if test -z "$CLANG_CC"; then
681            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
682         fi
683     fi
685     case "${target_cpu}" in
686     alpha*)
687         CFLAGS="$CFLAGS -mieee"
688         CXXFLAGS="$CXXFLAGS -mieee"
689     ;;
690     esac
691     ;;
692 *-mingw*)
693     DSO_CFLAGS=
694     DSO_PIC_CFLAGS=
695     # certain versions of cygwin's makedepend barf on the
696     # #include <string> vs -I./dist/include/string issue so don't use it
697     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
698         CC="$CC -mwindows"
699         CXX="$CXX -mwindows"
700         CPP="$CPP -mwindows"
701         CFLAGS="$CFLAGS -mms-bitfields"
702         CXXFLAGS="$CXXFLAGS -mms-bitfields"
703         DSO_LDOPTS='-shared'
704         # Use temp file for windres (bug 213281)
705         RCFLAGS='-O coff --use-temp-file'
706         # mingw doesn't require kernel32, user32, and advapi32 explicitly
707         LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
708         MOZ_FIX_LINK_PATHS=
710         MOZ_OPTIMIZE_FLAGS="-O1"
712         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
713         WIN32_GUI_EXE_LDFLAGS=-mwindows
715         if test -z "$CLANG_CC"; then
716             # Use static libgcc and libstdc++
717             LDFLAGS="$LDFLAGS -static"
719             # GCC/binutils can't link to a function if we try to include dllexport function
720             # in the same library as dllimport caller. To work around it, we build NSPR
721             # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
722             # function thunks need to be generated for cross-DLL calls.
723             MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
724         else
725             # Silence problematic clang warnings
726             CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
727         fi
728     else
729         TARGET_COMPILER_ABI=msvc
730         RANLIB='echo not_ranlib'
731         STRIP='echo not_strip'
732         PKG_SKIP_STRIP=1
733         # aarch64 doesn't support subsystems below 6.02
734         if test "$CPU_ARCH" = "aarch64"; then
735             WIN32_SUBSYSTEM_VERSION=6.02
736         else
737             WIN32_SUBSYSTEM_VERSION=6.01
738         fi
739         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
740         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
741         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
742         _USE_CPP_INCLUDE_FLAG=1
743         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
744         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
745         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
746         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
747         if test -z "$CLANG_CL"; then
748             CPPFLAGS="$CPPFLAGS -utf-8"
749         fi
750         if test "$CPU_ARCH" = "x86"; then
751             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
752             dnl more recent, so set that explicitly here unless another
753             dnl target arch has already been set.
754             changequote(,)
755             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
756               CFLAGS="$CFLAGS -arch:SSE2"
757             fi
758             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
759               CXXFLAGS="$CXXFLAGS -arch:SSE2"
760             fi
761             changequote([,])
762             SSE_FLAGS="-arch:SSE"
763             SSE2_FLAGS="-arch:SSE2"
764             dnl MSVC allows the use of intrinsics without any flags
765             dnl and doesn't have a separate arch for SSSE3
766             SSSE3_FLAGS="-arch:SSE2"
767         fi
768         dnl clang-cl requires appropriate flags to enable SSSE3 support
769         dnl on all architectures.
770         if test -n "$CLANG_CL"; then
771             SSSE3_FLAGS="-mssse3"
772         fi
773         dnl VS2013+ supports -Gw for better linker optimizations.
774         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
775         dnl Disabled on ASan because it causes false-positive ODR violations.
776         if test -z "$MOZ_ASAN"; then
777             CFLAGS="$CFLAGS -Gw"
778             CXXFLAGS="$CXXFLAGS -Gw"
779         else
780             # String tail merging doesn't play nice with ASan's ODR checker.
781             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
782         fi
783         # khuey says we can safely ignore MSVC warning C4251
784         # MSVC warning C4244 (implicit type conversion may lose data) warns
785         # and requires workarounds for perfectly valid code.  Also, GCC/clang
786         # don't warn about it by default. So for consistency/sanity, we turn
787         # it off on MSVC, too.
788         # MSVC warning C4267 warns for narrowing type conversions from size_t
789         # to 32-bit integer types on 64-bit platforms.  Since this is virtually
790         # the same thing as C4244, we disable C4267, too.
791         # MSVC warning C4800 warns when a value is implicitly cast to bool,
792         # because this also forces narrowing to a single byte, which can be a
793         # perf hit.  But this matters so little in practice (and often we want
794         # that behavior) that it's better to turn it off.
795         # MSVC warning C4595 warns non-member operator new or delete functions
796         # may not be declared inline, as of VS2015 Update 2.
797         CFLAGS="$CFLAGS -wd4244 -wd4267"
798         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
799         # Silence "warning C4065: switch statement contains 'default' but no
800         # 'case' labels".  See bug 1461304.
801         CXXFLAGS="$CXXFLAGS -wd4065"
802         if test -n "$CLANG_CL"; then
803             # XXX We should combine some of these with our generic GCC-style
804             # warning checks.
805             #
806             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
807             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
808             # We use offsetof on non-POD objects all the time.
809             # We also suppress this warning on other platforms.
810             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
811             # This warns for reasonable things like:
812             #   enum { X = 0xffffffffU };
813             # which is annoying for IDL headers.
814             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
815             # This warns for cases that would be reached by the Microsoft
816             # #include rules, but also currently warns on cases that would
817             # *also* be reached by standard C++ include rules.  That
818             # behavior doesn't seem useful, so we turn it off.
819             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
820             # We normally error out on unknown pragmas, but since clang-cl
821             # claims to be MSVC, it would be difficult to add
822             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
823             # use such pragmas, so just ignore them.
824             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
825             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
826             # We get errors about various #pragma intrinsic directives from
827             # clang-cl, and we don't need to hear about those.
828             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
829             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
830             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
831             # as __attribute((__deprecated__)).  This is nice to know,
832             # but since we don't get the equivalent warning from MSVC,
833             # let's just ignore it.
834             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
835             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
836             # We use a function like:
837             #   __declspec(noreturn) __inline void f() {}
838             # which -Winvalid-noreturn complains about.  Again, MSVC seems
839             # OK with it, so let's silence the warning.
840             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
841             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
842             # Missing |override| on virtual function declarations isn't
843             # something that MSVC currently warns about.
844             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
845             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
846             # declaration on |operator delete(void*)|.  However, clang-cl
847             # must internally declare |operator delete(void*)| differently,
848             # which causes this warning for virtually every file in the
849             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
850             # so there doesn't seem to be any way to convince clang-cl to
851             # declare |delete| differently.  Therefore, suppress this
852             # warning.
853             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
854             # At least one MSVC header and several headers in-tree have
855             # unused typedefs, so turn this on.
856             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
857             # jemalloc uses __declspec(allocator) as a profiler hint,
858             # which clang-cl doesn't understand.
859             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
860             # __attribute__((unused)) really means "might be unused" and
861             # we use it to avoid warnings about things that are unused
862             # in some compilation units, but used in many others.  This
863             # warning insists on complaining about the latter case, which
864             # is annoying, and rather noisy.
865             CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
866         fi
867         # make 'foo == bar;' error out
868         CFLAGS="$CFLAGS -we4553"
869         CXXFLAGS="$CXXFLAGS -we4553"
870         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
871         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
872         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
873         MOZ_DEBUG_LDFLAGS='-DEBUG'
874         WARNINGS_AS_ERRORS='-WX'
875         # Use a higher optimization level for clang-cl, so we can come closer
876         # to MSVC's performance numbers (see bug 1443590).
877         if test -n "$CLANG_CL"; then
878             MOZ_OPTIMIZE_FLAGS='-O2'
879         else
880             MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
881         fi
882         MOZ_FIX_LINK_PATHS=
883         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
884         if test -z "$DEVELOPER_OPTIONS"; then
885             LDFLAGS="$LDFLAGS -RELEASE"
886         fi
887         RCFLAGS="-nologo"
888         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
889         dnl both SSSE3 and SSE4.1.
890         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
891         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
892         dnl allow AVX2 code from VS2015
893         HAVE_X86_AVX2=1
894     fi
895     AC_DEFINE(WIN32_LEAN_AND_MEAN)
896     dnl See http://support.microsoft.com/kb/143208 to use STL
897     AC_DEFINE(NOMINMAX)
898     BIN_SUFFIX='.exe'
899     MOZ_USER_DIR="Mozilla"
901     case "$host_os" in
902     cygwin*|msvc*|mks*)
903         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.])
904         ;;
905     esac
907     if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
908         CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
909         CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
910     fi
912     case "$target" in
913     i*86-*)
914         if test -n "$GNU_CC"; then
915             CFLAGS="$CFLAGS -mstackrealign"
916             CXXFLAGS="$CXXFLAGS -mstackrealign"
917             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
918             if test -z "$CLANG_CC"; then
919                 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
920             fi
921         else
922             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
923             LDFLAGS="$LDFLAGS -SAFESEH"
924         fi
926         AC_DEFINE(_X86_)
927         ;;
928     x86_64-*)
929         if test -n "$_WIN32_MSVC"; then
930             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
931         fi
932         AC_DEFINE(_AMD64_)
933         ;;
934     aarch64-*)
935         if test -n "$_WIN32_MSVC"; then
936             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
937         fi
938         AC_DEFINE(_ARM64_)
939         ;;
940     *)
941         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
942         ;;
943     esac
944     ;;
946 *-netbsd*)
947     DSO_CFLAGS=''
948     CFLAGS="$CFLAGS -Dunix"
949     CXXFLAGS="$CXXFLAGS -Dunix"
950     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
951         DSO_PIC_CFLAGS='-fPIC -DPIC'
952         DSO_LDOPTS='-shared'
953         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
954     else
955         DSO_PIC_CFLAGS='-fPIC -DPIC'
956         DSO_LDOPTS='-shared'
957     fi
958     # This will fail on a.out systems prior to 1.5.1_ALPHA.
959     if test "$LIBRUNPATH"; then
960         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
961     fi
962     ;;
964 *-openbsd*)
965     if test -z "$X11BASE"; then
966         X11BASE=/usr/X11R6
967     fi
968     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
969     DSO_CFLAGS=''
970     DSO_PIC_CFLAGS='-fPIC'
971     DSO_LDOPTS='-shared -fPIC'
972     if test "$LIBRUNPATH"; then
973         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
974     fi
975     ;;
977 *-solaris*)
978     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
979     ;;
981 esac
983 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
984     MOZ_OPTIMIZE_FLAGS="-O"
987 AC_SUBST_LIST(MMX_FLAGS)
988 AC_SUBST_LIST(SSE_FLAGS)
989 AC_SUBST_LIST(SSE2_FLAGS)
990 AC_SUBST_LIST(SSSE3_FLAGS)
992 AC_SUBST(MOZ_LINKER)
993 if test -n "$MOZ_LINKER"; then
994   AC_DEFINE(MOZ_LINKER)
995   MOZ_LINKER_EXTRACT=1
996   AC_CHECK_PROGS(XZ, xz)
999 if test -z "$COMPILE_ENVIRONMENT"; then
1000     SKIP_COMPILER_CHECKS=1
1001     SKIP_LIBRARY_CHECKS=1
1002     PKG_SKIP_STRIP=1
1003     MOZ_DEBUGGING_OPTS
1004 else
1005     MOZ_COMPILER_OPTS
1006 fi # COMPILE_ENVIRONMENT
1008 if test -z "$SKIP_COMPILER_CHECKS"; then
1009 dnl Checks for typedefs, structures, and compiler characteristics.
1010 dnl ========================================================
1011 AC_C_CONST
1012 AC_TYPE_MODE_T
1013 AC_TYPE_OFF_T
1014 AC_TYPE_PID_T
1015 AC_TYPE_SIZE_T
1016 AC_LANG_CPLUSPLUS
1017 AC_LANG_C
1019 AC_LANG_CPLUSPLUS
1021 MOZ_CXX11
1023 AC_LANG_C
1025 case "${OS_TARGET}" in
1026 Darwin)
1027   ;;
1029   STL_FLAGS="-I${DIST}/stl_wrappers"
1030   WRAP_STL_INCLUDES=1
1031   ;;
1032 esac
1034 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
1035     WRAP_STL_INCLUDES=
1038 dnl Checks for header files.
1039 dnl ========================================================
1040 AC_HEADER_DIRENT
1041 case "$target_os" in
1042 bitrig*|dragonfly*|freebsd*|openbsd*)
1043 # for stuff like -lXshm
1044     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1045     ;;
1046 esac
1048 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1049 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1050                    ac_cv_sockaddr_in_sin_len,
1051                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1052                                     #include <sys/types.h>
1053                                     #endif
1054                                     #include <netinet/in.h>
1055                                     struct sockaddr_in x;
1056                                     void *foo = (void*) &x.sin_len;],
1057                                    [],
1058                                    [ac_cv_sockaddr_in_sin_len=true],
1059                                    [ac_cv_sockaddr_in_sin_len=false])])
1060 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1061   AC_DEFINE(HAVE_SIN_LEN)
1062 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1063   AC_DEFINE(HAVE_SCONN_LEN)
1066 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1067                ac_cv_sockaddr_in6_sin6_len,
1068                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1069                                 #include <sys/types.h>
1070                                 #endif
1071                                 #include <netinet/in.h>
1072                                 struct sockaddr_in6 x;
1073                                 void *foo = (void*) &x.sin6_len;],
1074                                [],
1075                                [ac_cv_sockaddr_in6_sin6_len=true],
1076                                [ac_cv_sockaddr_in6_sin6_len=false])])
1077 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1078   AC_DEFINE(HAVE_SIN6_LEN)
1081 AC_CACHE_CHECK(for sockaddr.sa_len,
1082                ac_cv_sockaddr_sa_len,
1083                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1084                                 #include <sys/types.h>
1085                                 #endif
1086                                 #include <sys/socket.h>
1087                                 struct sockaddr x;
1088                                 void *foo = (void*) &x.sa_len;],
1089                                [],
1090                                [ac_cv_sockaddr_sa_len=true],
1091                                [ac_cv_sockaddr_sa_len=false])])
1092 if test "$ac_cv_sockaddr_sa_len" = true ; then
1093   AC_DEFINE(HAVE_SA_LEN)
1096 MOZ_ARG_ENABLE_BOOL(dtrace,
1097               [  --enable-dtrace         build with dtrace support if available (default=no)],
1098               [enable_dtrace="yes"],)
1099 if test "x$enable_dtrace" = "xyes"; then
1100   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1101   if test -n "$HAVE_DTRACE"; then
1102       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1103   else
1104       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1105   fi
1107 AC_SUBST(HAVE_DTRACE)
1109 dnl Checks for libraries.
1110 dnl ========================================================
1111 AC_CHECK_LIB(c_r, gethostbyname_r)
1113 dnl We don't want to link with libdl even if it's present on OS X, since
1114 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1115 dnl in libc.
1116 dnl We don't want to link against libm or libpthread on Darwin since
1117 dnl they both are just symlinks to libSystem and explicitly linking
1118 dnl against libSystem causes issues when debugging (see bug 299601).
1119 case $target in
1120 *-darwin*)
1121     ;;
1123     AC_SEARCH_LIBS(dlopen, dl,
1124         MOZ_CHECK_HEADER(dlfcn.h,
1125         AC_DEFINE(HAVE_DLOPEN)))
1126     ;;
1127 esac
1129 _SAVE_CFLAGS="$CFLAGS"
1130 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1131 AC_CHECK_FUNCS(dladdr memmem)
1132 CFLAGS="$_SAVE_CFLAGS"
1134 if test ! "$GNU_CXX"; then
1135     AC_CHECK_LIB(C, demangle)
1138 AC_CHECK_LIB(socket, socket)
1140 XLDFLAGS="$X_LIBS"
1141 XLIBS="$X_EXTRA_LIBS"
1143 dnl ========================================================
1144 dnl Checks for X libraries.
1145 dnl Ordering is important.
1146 dnl Xt is dependent upon SM as of X11R6
1147 dnl ========================================================
1148 if test -n "$MOZ_X11"; then
1149     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1150     _SAVE_LDFLAGS="$LDFLAGS"
1151     _SAVE_LIBS="$LIBS"
1152     LDFLAGS="$XLDFLAGS $LDFLAGS"
1153     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1154         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1155     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1156         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1158     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1159         unset ac_cv_lib_Xt_XtFree
1160         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1161         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1162         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1163             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1164         ])
1166     dnl ========================================================
1167     dnl = Check for xcb
1168     dnl ========================================================
1169     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1170         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1171     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1172         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1173     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1174         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1176     LDFLAGS="$_SAVE_LDFLAGS"
1177     LIBS="$_SAVE_LIBS"
1178 fi # $MOZ_X11
1180 AC_SUBST_LIST(XCFLAGS)
1181 AC_SUBST_LIST(XLDFLAGS)
1182 AC_SUBST_LIST(XLIBS)
1183 AC_SUBST_LIST(XEXT_LIBS)
1184 AC_SUBST_LIST(XT_LIBS)
1186 dnl ========================================================
1187 dnl = pthread support
1188 dnl = Start by checking whether the system support pthreads
1189 dnl ========================================================
1190 case "$target_os" in
1191 darwin*)
1192     MOZ_USE_PTHREADS=1
1193     ;;
1195     AC_CHECK_LIB(pthreads, pthread_create,
1196         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1197         AC_CHECK_LIB(pthread, pthread_create,
1198             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1199             AC_CHECK_LIB(c_r, pthread_create,
1200                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1201                 AC_CHECK_LIB(c, pthread_create,
1202                     MOZ_USE_PTHREADS=1
1203                 )
1204             )
1205         )
1206     )
1207     ;;
1208 esac
1210 dnl ========================================================
1211 dnl Do the platform specific pthread hackery
1212 dnl ========================================================
1213 if test "$MOZ_USE_PTHREADS"x != x
1214 then
1215     dnl
1216     dnl See if -pthread is supported.
1217     dnl
1218     rm -f conftest*
1219     ac_cv_have_dash_pthread=no
1220     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1221     echo 'int main() { return 0; }' | cat > conftest.c
1222     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1223     if test $? -eq 0; then
1224         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1225             ac_cv_have_dash_pthread=yes
1226             case "$target_os" in
1227             freebsd*)
1228 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1229                 ;;
1230             *)
1231                 CFLAGS="$CFLAGS -pthread"
1232                 CXXFLAGS="$CXXFLAGS -pthread"
1233                 ;;
1234             esac
1235         fi
1236     fi
1237     rm -f conftest*
1238     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1240     dnl
1241     dnl See if -pthreads is supported.
1242     dnl
1243     ac_cv_have_dash_pthreads=no
1244     if test "$ac_cv_have_dash_pthread" = "no"; then
1245         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1246         echo 'int main() { return 0; }' | cat > conftest.c
1247         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1248         if test $? -eq 0; then
1249             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1250                 ac_cv_have_dash_pthreads=yes
1251                 CFLAGS="$CFLAGS -pthreads"
1252                 CXXFLAGS="$CXXFLAGS -pthreads"
1253             fi
1254         fi
1255         rm -f conftest*
1256         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1257     fi
1259     case "$target" in
1260         *-*-freebsd*)
1261             AC_DEFINE(_REENTRANT)
1262             AC_DEFINE(_THREAD_SAFE)
1263             dnl -pthread links in -lpthread, so don't specify it explicitly.
1264             if test "$ac_cv_have_dash_pthread" = "yes"; then
1265                 _PTHREAD_LDFLAGS="-pthread"
1266             fi
1267             ;;
1269         *-*-openbsd*|*-*-bsdi*)
1270             AC_DEFINE(_REENTRANT)
1271             AC_DEFINE(_THREAD_SAFE)
1272             dnl -pthread links in -lc_r, so don't specify it explicitly.
1273             if test "$ac_cv_have_dash_pthread" = "yes"; then
1274                 _PTHREAD_LDFLAGS="-pthread"
1275             fi
1276             ;;
1278         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1279             AC_DEFINE(_REENTRANT)
1280             ;;
1282     esac
1283     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1284     AC_SUBST(MOZ_USE_PTHREADS)
1285     MOZ_CHECK_HEADERS(pthread.h)
1289 dnl Checks for library functions.
1290 dnl ========================================================
1291 AC_PROG_GCC_TRADITIONAL
1292 AC_FUNC_MEMCMP
1293 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1295 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1296 dnl avoid this on Darwin, since depending on your system config, we may think
1297 dnl it exists but it really doesn't
1298 case "$OS_TARGET" in
1299 Darwin)
1300   ;;
1302   AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1303                  ac_cv_clock_monotonic,
1304                  [for libs in "" -lrt; do
1305                       _SAVE_LIBS="$LIBS"
1306                       LIBS="$LIBS $libs"
1307                       AC_TRY_LINK([#include <time.h>],
1308                                    [ struct timespec ts;
1309                                      clock_gettime(CLOCK_MONOTONIC, &ts); ],
1310                                    ac_cv_clock_monotonic=$libs
1311                                    LIBS="$_SAVE_LIBS"
1312                                    break,
1313                                    ac_cv_clock_monotonic=no)
1314                       LIBS="$_SAVE_LIBS"
1315                   done])
1316   if test "$ac_cv_clock_monotonic" != "no"; then
1317       HAVE_CLOCK_MONOTONIC=1
1318       REALTIME_LIBS=$ac_cv_clock_monotonic
1319       AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1320       AC_SUBST(HAVE_CLOCK_MONOTONIC)
1321       AC_SUBST_LIST(REALTIME_LIBS)
1322   fi
1323   ;;
1324 esac
1326 dnl Turn on warnings-as-errors to prevent implicit declaration of
1327 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1328 dnl inadvertently pass even if the function does not really exist.
1329 _SAVE_CFLAGS="$CFLAGS"
1330 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1331 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1332                ac_cv_pthread_cond_timedwait_monotonic_np,
1333                AC_TRY_LINK([#include <pthread.h>],
1334                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1335                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1336                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1337 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1338     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1340 CFLAGS=$_SAVE_CFLAGS
1342 AC_CACHE_CHECK(
1343     [for res_ninit()],
1344     ac_cv_func_res_ninit,
1345     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1346         dnl no need for res_ninit() on NetBSD and OpenBSD
1347         ac_cv_func_res_ninit=no
1348      else
1349         AC_TRY_LINK([
1350             #ifdef linux
1351             #define _BSD_SOURCE 1
1352             #endif
1353             #include <sys/types.h>
1354             #include <netinet/in.h>
1355             #include <arpa/nameser.h>
1356             #include <resolv.h>
1357             ],
1358             [int foo = res_ninit(&_res);],
1359             [ac_cv_func_res_ninit=yes],
1360             [ac_cv_func_res_ninit=no])
1361      fi
1362     ])
1364 if test "$ac_cv_func_res_ninit" = "yes"; then
1365     AC_DEFINE(HAVE_RES_NINIT)
1366 dnl must add the link line we do something as foolish as this... dougt
1367 dnl else
1368 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1369 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1372 AC_LANG_C
1374 dnl **********************
1375 dnl *** va_copy checks ***
1376 AC_CACHE_CHECK([for an implementation of va_copy()],
1377                ac_cv_va_copy,
1378     [AC_TRY_COMPILE([#include <stdarg.h>
1379                      #include <stdlib.h>
1380         void f (int i, ...) {
1381             va_list args1, args2;
1382             va_start (args1, i);
1383             va_copy (args2, args1);
1384             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1385                 exit (1);
1386             va_end (args1); va_end (args2);
1387         }],
1388         [f(0, 42); return 0],
1389         [ac_cv_va_copy=yes],
1390         [ac_cv_va_copy=no]
1391     )]
1393 AC_CACHE_CHECK([whether va_list can be copied by value],
1394                ac_cv_va_val_copy,
1395     [AC_TRY_COMPILE([#include <stdarg.h>
1396                      #include <stdlib.h>
1397         void f (int i, ...) {
1398             va_list args1, args2;
1399             va_start (args1, i);
1400             args2 = args1;
1401             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1402                 exit (1);
1403             va_end (args1); va_end (args2);
1404         }],
1405         [f(0, 42); return 0],
1406         [ac_cv_va_val_copy=yes],
1407         [ac_cv_va_val_copy=no],
1408     )]
1410 if test "x$ac_cv_va_copy" = "xyes"; then
1411     AC_DEFINE(VA_COPY, va_copy)
1412     AC_DEFINE(HAVE_VA_COPY)
1415 if test "x$ac_cv_va_val_copy" = "xno"; then
1416    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1419 dnl ===================================================================
1420 dnl ========================================================
1421 dnl Put your C++ language/feature checks below
1422 dnl ========================================================
1423 AC_LANG_CPLUSPLUS
1425 ARM_ABI_PREFIX=
1426 if test "$GNU_CC"; then
1427   if test "$CPU_ARCH" = "arm" ; then
1428     AC_CACHE_CHECK(for ARM EABI,
1429         ac_cv_gcc_arm_eabi,
1430         [AC_TRY_COMPILE([],
1431                         [
1432 #if defined(__ARM_EABI__)
1433   return 0;
1434 #else
1435 #error Not ARM EABI.
1436 #endif
1437                         ],
1438                         ac_cv_gcc_arm_eabi="yes",
1439                         ac_cv_gcc_arm_eabi="no")])
1440     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1441         HAVE_ARM_EABI=1
1442         ARM_ABI_PREFIX=eabi-
1443     else
1444         ARM_ABI_PREFIX=oabi-
1445     fi
1446   fi
1448   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1451 dnl See if a dynamic_cast to void* gives the most derived object.
1452 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1453                ac_cv_cpp_dynamic_cast_void_ptr,
1454                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1455                             class Y { int j; public: virtual ~Y() { } };
1456                             class Z : public X, public Y { int k; };
1458                             int main() {
1459                                  Z mdo;
1460                                  X *subx = (X*)&mdo;
1461                                  Y *suby = (Y*)&mdo;
1462                                  return !((((void*)&mdo != (void*)subx) &&
1463                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1464                                           (((void*)&mdo != (void*)suby) &&
1465                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
1466                             }],
1467                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
1468                            ac_cv_cpp_dynamic_cast_void_ptr=no,
1469                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
1470 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1471    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1475 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1476 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1477 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1478 # linking XUL.
1479 _SAVE_LDFLAGS=$LDFLAGS
1480 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1481 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1482                ac_cv_thread_keyword,
1483                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1484                             [return tlsIsMainThread;],
1485                             ac_cv_thread_keyword=yes,
1486                             ac_cv_thread_keyword=no)])
1487 LDFLAGS=$_SAVE_LDFLAGS
1488 # The custom dynamic linker doesn't support TLS variables
1489 MOZ_TLS=
1490 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1491   # mips builds fail with TLS variables because of a binutils bug.
1492   # See bug 528687
1493   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1494   case "${target}" in
1495     mips*-*)
1496       :
1497       ;;
1498     *-android*|*-linuxandroid*)
1499       :
1500       ;;
1501     *-openbsd*)
1502       :
1503       ;;
1504     *)
1505       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1506       MOZ_TLS=1
1507       ;;
1508   esac
1511 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1512 if test -n "$MOZ_LINKER"; then
1513   if test "$CPU_ARCH" = arm; then
1514     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1515     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1516       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1517       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1518     fi
1519   fi
1521 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1522 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1523 dnl Since the linker only understands the sysv ones, no need to build the
1524 dnl gnu style tables anyways.
1525   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1528 dnl End of C++ language/feature checks
1529 AC_LANG_C
1531 dnl ========================================================
1532 dnl =  Internationalization checks
1533 dnl ========================================================
1535 dnl Internationalization and Locale support is different
1536 dnl on various UNIX platforms.  Checks for specific i18n
1537 dnl features go here.
1539 AC_HAVE_FUNCS(localeconv)
1541 fi # ! SKIP_COMPILER_CHECKS
1543 if test -n "${COMPILE_ENVIRONMENT}"; then
1544   MOZ_CHECK_ALLOCATOR
1547 TARGET_XPCOM_ABI=
1548 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1549     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1550     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1553 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1554 dnl features that Windows actually does support.
1556 if test -n "$SKIP_COMPILER_CHECKS"; then
1557    dnl Windows has malloc.h
1558    AC_DEFINE(MALLOC_H, [<malloc.h>])
1559    AC_DEFINE(HAVE_FORCEINLINE)
1560    AC_DEFINE(HAVE_LOCALECONV)
1561 fi # SKIP_COMPILER_CHECKS
1563 dnl Mozilla specific options
1564 dnl ========================================================
1565 dnl The macros used for command line options
1566 dnl are defined in build/autoconf/altoptions.m4.
1568 dnl ========================================================
1569 dnl =
1570 dnl = Check for external package dependencies
1571 dnl =
1572 dnl ========================================================
1573 MOZ_ARG_HEADER(External Packages)
1575 case "$OS_TARGET" in
1576 WINNT|Darwin|Android)
1577   MOZ_FOLD_LIBS=1
1578   ;;
1580   MOZ_FOLD_LIBS=
1581   ;;
1582 esac
1584 MOZ_CONFIG_NSPR()
1586 dnl ========================================================
1587 dnl system libevent Support
1588 dnl ========================================================
1589 MOZ_ARG_WITH_STRING(system-libevent,
1590 [  --with-system-libevent[=PFX]
1591                           Use system libevent [installed at prefix PFX]],
1592     LIBEVENT_DIR=$withval)
1594 _SAVE_CFLAGS=$CFLAGS
1595 _SAVE_LDFLAGS=$LDFLAGS
1596 _SAVE_LIBS=$LIBS
1597 if test "$LIBEVENT_DIR" = yes; then
1598     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1599         MOZ_SYSTEM_LIBEVENT=1,
1600         LIBEVENT_DIR=/usr)
1602 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1603     MOZ_SYSTEM_LIBEVENT=
1604 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1605     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1606     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1607     MOZ_CHECK_HEADER(event.h,
1608         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1609              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1610          fi],
1611         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1612     AC_CHECK_LIB(event, event_init,
1613                  [MOZ_SYSTEM_LIBEVENT=1
1614                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1615                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1616                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1618 CFLAGS=$_SAVE_CFLAGS
1619 LDFLAGS=$_SAVE_LDFLAGS
1620 LIBS=$_SAVE_LIBS
1622 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1624 dnl ========================================================
1625 dnl = If NSS was not detected in the system,
1626 dnl = use the one in the source tree (mozilla/security/nss)
1627 dnl ========================================================
1629 MOZ_ARG_WITH_BOOL(system-nss,
1630 [  --with-system-nss       Use system installed NSS],
1631     _USE_SYSTEM_NSS=1 )
1633 if test -n "$_USE_SYSTEM_NSS"; then
1634     AM_PATH_NSS(3.42, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1637 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1638 if test -z "$MOZ_SYSTEM_NSS"; then
1639    case "${OS_ARCH}" in
1640         # Only few platforms have been tested with GYP
1641         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1642             ;;
1643         *)
1644             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1645             ;;
1646    esac
1649 dnl system ZLIB support
1650 dnl ========================================================
1651 MOZ_ZLIB_CHECK([1.2.3])
1653 if test -z "$SKIP_LIBRARY_CHECKS"; then
1655 dnl ========================================================
1656 dnl system PNG Support
1657 dnl ========================================================
1658 MOZ_ARG_WITH_STRING(system-png,
1659 [  --with-system-png[=PFX]
1660                           Use system libpng [installed at prefix PFX]],
1661     PNG_DIR=$withval)
1663 _SAVE_CFLAGS=$CFLAGS
1664 _SAVE_LDFLAGS=$LDFLAGS
1665 _SAVE_LIBS=$LIBS
1666 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1667     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1668     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1670 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1671     MOZ_SYSTEM_PNG=
1672 else
1673     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1674                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1675     AC_CHECK_LIB(png, png_get_acTL, ,
1676                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1678 if test "$MOZ_SYSTEM_PNG" = 1; then
1679     AC_TRY_COMPILE([ #include <stdio.h>
1680                      #include <sys/types.h>
1681                      #include <png.h> ],
1682                    [ #if PNG_LIBPNG_VER < $MOZPNG
1683                      #error "Insufficient libpng version ($MOZPNG required)."
1684                      #endif
1685                      #ifndef PNG_UINT_31_MAX
1686                      #error "Insufficient libpng version."
1687                      #endif ],
1688                    MOZ_SYSTEM_PNG=1,
1689                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1691 CFLAGS=$_SAVE_CFLAGS
1692 LDFLAGS=$_SAVE_LDFLAGS
1693 LIBS=$_SAVE_LIBS
1695 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1696     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1697     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1700 fi # SKIP_LIBRARY_CHECKS
1702 dnl ========================================================
1703 dnl =
1704 dnl = Application
1705 dnl =
1706 dnl ========================================================
1708 MOZ_ARG_HEADER(Application)
1710 ENABLE_SYSTEM_EXTENSION_DIRS=1
1711 MOZ_BRANDING_DIRECTORY=
1712 MOZ_OFFICIAL_BRANDING=
1713 MOZ_AUTH_EXTENSION=1
1714 if test "$MOZ_IOS"; then
1715    MOZ_AUTH_EXTENSION=
1717 MOZ_PREF_EXTENSIONS=1
1718 MOZ_SPELLCHECK=1
1719 MOZ_TOOLKIT_SEARCH=1
1720 MOZ_UNIVERSALCHARDET=1
1721 MOZ_XUL=1
1722 MOZ_ZIPWRITER=1
1723 MOZ_NO_SMART_CARDS=
1724 NECKO_COOKIES=1
1725 MOZ_USE_NATIVE_POPUP_WINDOWS=
1726 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1727 MOZ_CONTENT_SANDBOX=
1728 MOZ_GMP_SANDBOX=
1729 MOZ_SANDBOX=1
1730 MOZ_BINARY_EXTENSIONS=
1731 MOZ_DEVTOOLS=server
1733 case "$target_os" in
1734     mingw*)
1735         NS_ENABLE_TSF=1
1736         AC_DEFINE(NS_ENABLE_TSF)
1737         ;;
1738 esac
1740 # Optional Firefox for Android partner distribution directory.
1741 MOZ_ARG_WITH_STRING(android-distribution-directory,
1742 [  --with-android-distribution-directory=dir
1743                           Optional Firefox for Android partner distribution directory.],
1744   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1746 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1747   # A distribution directory must have an assets/distribution directory.
1748   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1749   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1750     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1751                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1752   fi
1754 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1756 dnl ========================================================
1757 dnl = Trademarked Branding
1758 dnl ========================================================
1759 MOZ_ARG_ENABLE_BOOL(official-branding,
1760 [  --enable-official-branding
1761                           Enable Official mozilla.org Branding
1762                           Do not distribute builds with
1763                           --enable-official-branding unless you have
1764                           permission to use trademarks per
1765                           http://www.mozilla.org/foundation/trademarks/ .],
1766     MOZ_OFFICIAL_BRANDING=1,
1767     MOZ_OFFICIAL_BRANDING=)
1769 # Allow the application to influence configure with a confvars.sh script.
1770 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1771 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1772   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1773   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1774 else
1775   AC_MSG_RESULT([no])
1778 # Allow influencing configure with a defines.sh script.
1779 . "${srcdir}/build/defines.sh"
1781 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1782 # set in defines.sh
1783 if test "$BUILDING_RELEASE"; then
1784   # Override value in defines.sh, if any
1785   EARLY_BETA_OR_EARLIER=
1786 elif test "$EARLY_BETA_OR_EARLIER"; then
1787   AC_DEFINE(EARLY_BETA_OR_EARLIER)
1789 AC_SUBST(EARLY_BETA_OR_EARLIER)
1791 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1792 MOZ_ARG_WITH_STRING(app-name,
1793 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1794 WITH_APP_NAME=$withval,
1797 if test -n "$WITH_APP_NAME" ; then
1798     MOZ_APP_NAME="$WITH_APP_NAME"
1801 MOZ_ARG_WITH_STRING(app-basename,
1802 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1803 WITH_APP_BASENAME=$withval,
1806 if test -n "$WITH_APP_BASENAME" ; then
1807     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1810 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1811 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1812 # MOZ_BUILD_APP.
1813 case "$MOZ_BUILD_APP" in
1814 browser)
1815   AC_DEFINE(MOZ_PHOENIX)
1816   ;;
1818 xulrunner)
1819   AC_DEFINE(MOZ_XULRUNNER)
1820   ;;
1821 esac
1823 # Graphene is a desktop runtime for running applications with a HTML UI.
1824 if test -n "$MOZ_GRAPHENE"; then
1825     AC_DEFINE(MOZ_GRAPHENE)
1828 AC_SUBST(MOZ_PHOENIX)
1829 AC_SUBST(MOZ_XULRUNNER)
1831 dnl ========================================================
1832 dnl Ensure Android SDK and build-tools versions depending on
1833 dnl mobile target.
1834 dnl ========================================================
1836 case "$MOZ_BUILD_APP" in
1837 mobile/android)
1838     MOZ_ANDROID_SDK(26, 26, 27.0.3)
1839     ;;
1840 esac
1842 dnl ========================================================
1843 dnl =
1844 dnl = Toolkit Options
1845 dnl =
1846 dnl ========================================================
1847 MOZ_ARG_HEADER(Toolkit Options)
1849 dnl ========================================================
1850 dnl = Enable the toolkit as needed                         =
1851 dnl ========================================================
1853 case "$MOZ_WIDGET_TOOLKIT" in
1855 cocoa)
1856     LDFLAGS="$LDFLAGS -framework Cocoa"
1857     # Use -Wl as a trick to avoid -framework and framework names from
1858     # being separated by AC_SUBST_LIST.
1859     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'
1860     TK_CFLAGS=""
1861     CFLAGS="$CFLAGS $TK_CFLAGS"
1862     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1863     MOZ_USER_DIR="Mozilla"
1864     MOZ_FS_LAYOUT=bundle
1865     ;;
1867 uikit)
1868     LDFLAGS="$LDFLAGS -framework UIKit"
1869     TK_CFLAGS=""
1870     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'
1871     CFLAGS="$CFLAGS $TK_CFLAGS"
1872     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1873     MOZ_USER_DIR="Mozilla"
1874     MOZ_FS_LAYOUT=bundle
1875     ;;
1877 esac
1879 if test "$OS_TARGET" = Darwin; then
1880     LDFLAGS="$LDFLAGS -lobjc"
1883 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1884 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1885 case "$MOZ_WIDGET_TOOLKIT" in
1886 gtk*)
1887     MOZ_ENABLE_GTK=1
1888     ;;
1889 esac
1891 if test "$COMPILE_ENVIRONMENT"; then
1892   if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
1893     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)
1894     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1895     TK_CFLAGS=$MOZ_GTK3_CFLAGS
1896     TK_LIBS=$MOZ_GTK3_LIBS
1897     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1898     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1899     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1900     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1901   fi
1902   if test "$MOZ_ENABLE_GTK"; then
1903     if test "$MOZ_X11"; then
1904       GDK_PACKAGES=gdk-x11-2.0
1905     fi
1906     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1907     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1909     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)
1910     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1911   fi
1912 fi # COMPILE_ENVIRONMENT
1914 AC_SUBST(MOZ_FS_LAYOUT)
1916 dnl ========================================================
1917 dnl = startup-notification support module
1918 dnl ========================================================
1920 if test "$MOZ_ENABLE_GTK"
1921 then
1922     MOZ_ENABLE_STARTUP_NOTIFICATION=
1924     MOZ_ARG_ENABLE_BOOL(startup-notification,
1925     [  --enable-startup-notification
1926                           Enable startup-notification support (default: disabled) ],
1927         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1928         MOZ_ENABLE_STARTUP_NOTIFICATION=)
1929     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1930     then
1931         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1932                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1933         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1934             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1935             then
1936                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1937             fi
1938             MOZ_ENABLE_STARTUP_NOTIFICATION=
1939         ])
1940     fi
1942     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1943         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1944     fi
1946     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1948 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1950 AC_SUBST_LIST(TK_CFLAGS)
1951 AC_SUBST_LIST(TK_LIBS)
1953 AC_SUBST(MOC)
1954 AC_SUBST(RCC)
1956 dnl ========================================================
1957 dnl =
1958 dnl = Components & Features
1959 dnl =
1960 dnl ========================================================
1961 MOZ_ARG_HEADER(Components and Features)
1963 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1964 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1965   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1966     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1967   else
1968     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1969     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1970   fi
1973 MOZ_ARG_WITH_STRING(branding,
1974 [  --with-branding=dir     Use branding from the specified directory.],
1975     MOZ_BRANDING_DIRECTORY=$withval)
1977 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1978 if test -z "$REAL_BRANDING_DIRECTORY"; then
1979   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1982 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1983   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1984 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1985   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1988 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1990 dnl ========================================================
1991 dnl = Distribution ID
1992 dnl ========================================================
1993 MOZ_ARG_WITH_STRING(distribution-id,
1994 [  --with-distribution-id=ID
1995                           Set distribution-specific id (default=org.mozilla)],
1996 [ val=`echo $withval`
1997     MOZ_DISTRIBUTION_ID="$val"])
1999 if test -z "$MOZ_DISTRIBUTION_ID"; then
2000    MOZ_DISTRIBUTION_ID="org.mozilla"
2003 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2004 AC_SUBST(MOZ_DISTRIBUTION_ID)
2006 dnl ========================================================
2007 dnl = GConf support module
2008 dnl ========================================================
2010 if test "$MOZ_X11"
2011 then
2012     if test "$MOZ_ENABLE_GTK"
2013     then
2014         MOZ_ENABLE_GCONF=1
2015     fi
2017     dnl ========================================================
2018     dnl = GConf support module
2019     dnl ========================================================
2020     MOZ_ARG_DISABLE_BOOL(gconf,
2021     [  --disable-gconf      Disable Gconf support ],
2022         MOZ_ENABLE_GCONF=,
2023         MOZ_ENABLE_GCONF=1)
2025     if test "$MOZ_ENABLE_GCONF"
2026     then
2027         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2028             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2029             MOZ_ENABLE_GCONF=1
2030         ],[
2031             if test -n "$MOZ_ENABLE_GCONF";
2032             then
2033                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2034             else
2035                 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2036             fi
2037         ])
2038     fi
2040     if test "$MOZ_ENABLE_GCONF"; then
2041         AC_DEFINE(MOZ_ENABLE_GCONF)
2042     fi
2044     AC_SUBST(MOZ_ENABLE_GCONF)
2047 dnl ========================================================
2048 dnl = libproxy support
2049 dnl ========================================================
2051 if test "$MOZ_ENABLE_GTK"
2052 then
2053     MOZ_ENABLE_LIBPROXY=
2055     MOZ_ARG_ENABLE_BOOL(libproxy,
2056     [  --enable-libproxy         Enable libproxy support ],
2057     MOZ_ENABLE_LIBPROXY=1,
2058     MOZ_ENABLE_LIBPROXY=)
2060     if test "$MOZ_ENABLE_LIBPROXY"
2061     then
2062         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2063         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2064     fi
2066 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2068 dnl ========================================================
2069 dnl = dbus support
2070 dnl ========================================================
2072 if test "$MOZ_ENABLE_GTK"
2073 then
2074     MOZ_ENABLE_DBUS=1
2076     MOZ_ARG_DISABLE_BOOL(dbus,
2077     [  --disable-dbus          Disable dbus support ],
2078         MOZ_ENABLE_DBUS=,
2079         MOZ_ENABLE_DBUS=1)
2081     if test "$MOZ_ENABLE_DBUS"
2082     then
2083         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2084         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2085         AC_DEFINE(MOZ_ENABLE_DBUS)
2086     fi
2088 AC_SUBST(MOZ_ENABLE_DBUS)
2090 dnl =========================================================
2091 dnl = Whether to exclude hyphenations files in the build
2092 dnl =========================================================
2093 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2094     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2097 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2098                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2099                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2101 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2103 if test -n "$MOZ_WEBRTC"; then
2104     if test -n "$MOZ_X11"; then
2105       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2106     fi
2109 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2111 dnl ========================================================
2112 dnl = Apple platform decoder support
2113 dnl ========================================================
2114 if test "$COMPILE_ENVIRONMENT"; then
2115 if test -n "$MOZ_APPLEMEDIA"; then
2116   # hack in frameworks for fmp4 - see bug 1029974
2117   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2118   LDFLAGS="$LDFLAGS -framework AudioToolbox"
2119   dnl Verify CoreMedia is available.
2120   AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
2121     [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2123 fi # COMPILE_ENVIRONMENT
2125 dnl ========================================================
2126 dnl = Handle dependent MEDIA defines
2127 dnl ========================================================
2129 MOZ_WEBM_ENCODER=1
2130 AC_DEFINE(MOZ_WEBM_ENCODER)
2131 AC_SUBST(MOZ_WEBM_ENCODER)
2133 dnl ========================================================
2134 dnl NegotiateAuth
2135 dnl ========================================================
2137 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2138 [  --disable-negotiateauth Disable GSS-API negotiation ],
2139     MOZ_AUTH_EXTENSION=,
2140     MOZ_AUTH_EXTENSION=1 )
2142 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2143    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2146 dnl ========================================================
2147 dnl Pref extensions (autoconfig)
2148 dnl ========================================================
2149 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2150 [  --disable-pref-extensions
2151                           Disable pref extensions such as autoconfig],
2152   MOZ_PREF_EXTENSIONS=,
2153   MOZ_PREF_EXTENSIONS=1 )
2155 dnl ========================================================
2156 dnl Searching of system directories for extensions.
2157 dnl Note: this switch is meant to be used for test builds
2158 dnl whose behavior should not depend on what happens to be
2159 dnl installed on the local machine.
2160 dnl ========================================================
2161 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2162 [  --disable-system-extension-dirs
2163                           Disable searching system- and account-global
2164                           directories for extensions of any kind; use
2165                           only profile-specific extension directories],
2166   ENABLE_SYSTEM_EXTENSION_DIRS=,
2167   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2168 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2169   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2172 dnl ========================================================
2173 dnl = Universalchardet
2174 dnl ========================================================
2175 MOZ_ARG_DISABLE_BOOL(universalchardet,
2176 [  --disable-universalchardet
2177                           Disable universal encoding detection],
2178   MOZ_UNIVERSALCHARDET=,
2179   MOZ_UNIVERSALCHARDET=1 )
2181 dnl ========================================================
2182 dnl Gamepad support
2183 dnl ========================================================
2185 if test "$COMPILE_ENVIRONMENT" ; then
2187 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2188 if test "$OS_TARGET" = "Linux"; then
2189     MOZ_CHECK_HEADER([linux/joystick.h])
2190     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2191       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2192     fi
2195 fi # COMPILE_ENVIRONMENT
2198 dnl ========================================================
2199 dnl = Breakpad crash reporting (on by default on supported platforms)
2200 dnl ========================================================
2202 case $target in
2203 i?86-*-mingw*|x86_64-*-mingw*)
2204   MOZ_CRASHREPORTER=1
2205   ;;
2206 i?86-apple-darwin*|x86_64-apple-darwin*)
2207   if test -z "$MOZ_IOS"; then
2208     MOZ_CRASHREPORTER=1
2209   fi
2210   ;;
2211 *-android*|*-linuxandroid*)
2212   dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2213   dnl be before Linux condition
2214   MOZ_CRASHREPORTER=1
2215   ;;
2216 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2217   if test "$MOZ_ENABLE_GTK"; then
2218     MOZ_CRASHREPORTER=1
2219   fi
2220   ;;
2221 esac
2223 MOZ_ARG_DISABLE_BOOL(crashreporter,
2224 [  --disable-crashreporter Disable breakpad crash reporting],
2225     [MOZ_CRASHREPORTER=],
2226     [MOZ_CRASHREPORTER=F # Force enable breakpad])
2228 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2229   if test "$MOZ_CRASHREPORTER" = F; then
2230     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2231   fi
2232   MOZ_CRASHREPORTER=
2235 if test -n "$MOZ_CRASHREPORTER"; then
2236    AC_DEFINE(MOZ_CRASHREPORTER)
2238   if test "$OS_TARGET" = "Linux" && \
2239     test -z "$SKIP_LIBRARY_CHECKS"; then
2240     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2241   fi
2243   if test "$OS_ARCH" = "WINNT"; then
2244     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2245       MOZ_CRASHREPORTER_INJECTOR=1
2246       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2247     fi
2248   fi
2251 dnl ========================================================
2252 dnl = Enable compilation of specific extension modules
2253 dnl ========================================================
2255 MOZ_ARG_ENABLE_STRING(extensions,
2256 [  --enable-extensions     Enable extensions],
2257 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2258     if test "$option" = "yes" -o "$option" = "all"; then
2259         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2260     elif test "$option" = "no" -o "$option" = "none"; then
2261         MOZ_EXTENSIONS=""
2262     elif test "$option" = "default"; then
2263         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2264     elif test `echo "$option" | grep -c \^-` != 0; then
2265         option=`echo $option | sed 's/^-//'`
2266         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2267     else
2268         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2269     fi
2270 done],
2271     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2273 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2274 dnl when trying to build a nonexistent extension.
2275 for extension in $MOZ_EXTENSIONS; do
2276     if test ! -d "${srcdir}/extensions/${extension}"; then
2277         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2278     fi
2279 done
2281 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2282   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2285 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2286 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2287 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2288    MOZ_ENABLE_CAIRO_FT=1
2289    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2290    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2291    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2294 AC_CHECK_PROGS(WGET, wget, "")
2295 AC_SUBST(WGET)
2297 dnl ========================================================
2298 dnl Enable building the signmar program.
2299 dnl This option is much different than the --enable-verify-mar option.
2300 dnl --enable-verify-mar is for enabling the verification check on MAR
2301 dnl files in the updater.  The --enable-signmar option is for building
2302 dnl the signmar program.
2303 dnl ========================================================
2305 MOZ_ARG_ENABLE_BOOL(signmar,
2306 [  --enable-signmar     Enable building the signmar program],
2307     MOZ_ENABLE_SIGNMAR=1,
2308     MOZ_ENABLE_SIGNMAR= )
2310 if test -n "$MOZ_ENABLE_SIGNMAR"; then
2311   if test -z "$COMPILE_ENVIRONMENT" ; then
2312     AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
2313     MOZ_ENABLE_SIGNMAR=
2314   else
2315     AC_DEFINE(MOZ_ENABLE_SIGNMAR)
2316   fi
2319 dnl ========================================================
2320 dnl Updater
2321 dnl ========================================================
2323 if test "$MOZ_IOS"; then
2324   MOZ_UPDATER=
2327 MOZ_ARG_DISABLE_BOOL(updater,
2328 [  --disable-updater       Disable building of updater],
2329     MOZ_UPDATER=,
2330     MOZ_UPDATER=1 )
2332 if test -n "$MOZ_UPDATER"; then
2333     AC_DEFINE(MOZ_UPDATER)
2336 dnl ========================================================
2337 dnl parental controls (for Windows Vista)
2338 dnl ========================================================
2339 MOZ_ARG_DISABLE_BOOL(parental-controls,
2340 [  --disable-parental-controls
2341                           Do not build parental controls],
2342    MOZ_DISABLE_PARENTAL_CONTROLS=1,
2343    MOZ_DISABLE_PARENTAL_CONTROLS=)
2344 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2345     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2348 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2350 dnl ========================================================
2351 dnl = Disable smartcard support
2352 dnl ========================================================
2353 if test -n "$MOZ_NO_SMART_CARDS"; then
2354     AC_DEFINE(MOZ_NO_SMART_CARDS)
2356 AC_SUBST(MOZ_NO_SMART_CARDS)
2358 dnl ========================================================
2359 dnl = Sandboxing support
2360 dnl ========================================================
2361 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2362     # Bug 1182565: TSan conflicts with sandboxing on Linux.
2363     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2364     case $OS_TARGET in
2365     Linux|Android)
2366         MOZ_SANDBOX=
2367         ;;
2368     esac
2371 MOZ_ARG_DISABLE_BOOL(sandbox,
2372 [  --disable-sandbox        Disable sandboxing support],
2373     MOZ_SANDBOX=,
2374     MOZ_SANDBOX=1)
2376 dnl ========================================================
2377 dnl = Content process sandboxing
2378 dnl ========================================================
2380 case "$OS_TARGET" in
2381 WINNT)
2382     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2383     ;;
2384 Darwin)
2385     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2386     ;;
2387 Linux)
2388     case $CPU_ARCH in
2389         x86_64|x86)
2390             MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2391         ;;
2392     esac
2393     ;;
2394 esac
2396 MOZ_ARG_ENABLE_BOOL(content-sandbox,
2397 [  --enable-content-sandbox Enable sandboxing support for content-processes
2398   --disable-content-sandbox Disable sandboxing support for content-processes],
2399     MOZ_CONTENT_SANDBOX=1,
2400     MOZ_CONTENT_SANDBOX=)
2402 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
2403     AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
2406 if test -n "$MOZ_CONTENT_SANDBOX"; then
2407     AC_DEFINE(MOZ_CONTENT_SANDBOX)
2410 AC_SUBST(MOZ_CONTENT_SANDBOX)
2412 dnl ========================================================
2413 dnl = Gecko Media Plugin sandboxing
2414 dnl ========================================================
2415 case $OS_TARGET in
2416 WINNT)
2417     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2418     ;;
2419 Linux)
2420     case $CPU_ARCH in
2421     x86_64|x86)
2422         MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2423         ;;
2424     esac
2425     ;;
2426 Darwin)
2427     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2428     ;;
2429 esac
2431 if test -n "$MOZ_GMP_SANDBOX"; then
2432     AC_DEFINE(MOZ_GMP_SANDBOX)
2435 AC_SUBST(MOZ_GMP_SANDBOX)
2437 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
2438     MOZ_SANDBOX=
2441 if test -n "$MOZ_SANDBOX"; then
2442     AC_DEFINE(MOZ_SANDBOX)
2445 AC_SUBST(MOZ_SANDBOX)
2448 dnl ========================================================
2449 dnl =
2450 dnl = Module specific options
2451 dnl =
2452 dnl ========================================================
2453 MOZ_ARG_HEADER(Individual module options)
2455 dnl ========================================================
2456 dnl Check for sqlite
2457 dnl ========================================================
2459 MOZ_SYSTEM_SQLITE=
2460 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2461 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
2462 MOZ_SYSTEM_SQLITE=1,
2463 MOZ_SYSTEM_SQLITE= )
2465 if test -n "$MOZ_SYSTEM_SQLITE"
2466 then
2467     dnl ============================
2468     dnl === SQLite Version check ===
2469     dnl ============================
2470     dnl Check to see if the system SQLite package is new enough.
2471     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2473     dnl ==================================
2474     dnl === SQLITE_SECURE_DELETE check ===
2475     dnl ==================================
2476     dnl Check to see if the system SQLite package is compiled with
2477     dnl SQLITE_SECURE_DELETE enabled.
2478     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
2479     _SAVE_CFLAGS="$CFLAGS"
2480     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
2481     _SAVE_LIBS="$LIBS"
2482     LIBS="$LIBS $SQLITE_LIBS"
2483     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
2484         AC_TRY_RUN([
2485             #include "sqlite3.h"
2487             int main(int argc, char **argv){
2488               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
2489             }],
2490             ac_cv_sqlite_secure_delete=yes,
2491             ac_cv_sqlite_secure_delete=no,
2492             ac_cv_sqlite_secure_delete=no
2493         )
2494     ])
2495     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
2496     CFLAGS="$_SAVE_CFLAGS"
2497     LIBS="$_SAVE_LIBS"
2498     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
2499         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
2500     fi
2502     dnl ===============================
2503     dnl === SQLITE_THREADSAFE check ===
2504     dnl ===============================
2505     dnl Check to see if the system SQLite package is compiled with
2506     dnl SQLITE_THREADSAFE enabled.
2507     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
2508     _SAVE_CFLAGS="$CFLAGS"
2509     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
2510     _SAVE_LIBS="$LIBS"
2511     LIBS="$LIBS $SQLITE_LIBS"
2512     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
2513         AC_TRY_RUN([
2514             #include "sqlite3.h"
2516             int main(int argc, char **argv){
2517               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
2518             }],
2519             ac_cv_sqlite_threadsafe=yes,
2520             ac_cv_sqlite_threadsafe=no,
2521             ac_cv_sqlite_threadsafe=no
2522         )
2523     ])
2524     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
2525     CFLAGS="$_SAVE_CFLAGS"
2526     LIBS="$_SAVE_LIBS"
2527     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
2528         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
2529     fi
2531     dnl ================================
2532     dnl === SQLITE_ENABLE_FTS3 check ===
2533     dnl ================================
2534     dnl check to see if the system SQLite package is compiled with
2535     dnl SQLITE_ENABLE_FTS3 enabled.
2536     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
2537     _SAVE_CFLAGS="$CFLAGS"
2538     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
2539     _SAVE_LIBS="$LIBS"
2540     LIBS="$LIBS $SQLITE_LIBS"
2541     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
2542         AC_TRY_RUN([
2543             #include "sqlite3.h"
2545             int main(int argc, char **argv){
2546               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
2547             }],
2548             ac_cv_sqlite_enable_fts3=yes,
2549             ac_cv_sqlite_enable_fts3=no,
2550             ac_cv_sqlite_enable_fts3=no
2551         )
2552     ])
2553     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
2554     CFLAGS="$_SAVE_CFLAGS"
2555     LIBS="$_SAVE_LIBS"
2556     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
2557         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
2558     fi
2560     dnl =========================================
2561     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
2562     dnl =========================================
2563     dnl check to see if the system SQLite package is compiled with
2564     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
2565     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
2566     _SAVE_CFLAGS="$CFLAGS"
2567     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
2568     _SAVE_LIBS="$LIBS"
2569     LIBS="$LIBS $SQLITE_LIBS"
2570     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
2571         AC_TRY_RUN([
2572             #include "sqlite3.h"
2574             int main(int argc, char **argv){
2575               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
2576             }],
2577             ac_cv_sqlite_enable_unlock_notify=yes,
2578             ac_cv_sqlite_enable_unlock_notify=no,
2579             ac_cv_sqlite_enable_unlock_notify=no
2580         )
2581     ])
2582     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
2583     CFLAGS="$_SAVE_CFLAGS"
2584     LIBS="$_SAVE_LIBS"
2585     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
2586         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
2587     fi
2589     dnl =========================================
2590     dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
2591     dnl =========================================
2592     dnl check to see if the system SQLite package is compiled with
2593     dnl SQLITE_ENABLE_DBSTAT_VTAB.
2594     AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
2595     _SAVE_CFLAGS="$CFLAGS"
2596     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
2597     _SAVE_LIBS="$LIBS"
2598     LIBS="$LIBS $SQLITE_LIBS"
2599     AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
2600         AC_TRY_RUN([
2601             #include "sqlite3.h"
2603             int main(int argc, char **argv){
2604               return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
2605             }],
2606             ac_cv_sqlite_dbstat_vtab=yes,
2607             ac_cv_sqlite_dbstat_vtab=no,
2608             ac_cv_sqlite_dbstat_vtab=no
2609         )
2610     ])
2611     AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
2612     CFLAGS="$_SAVE_CFLAGS"
2613     LIBS="$_SAVE_LIBS"
2614     if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
2615         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
2616     fi
2617 else
2618     dnl ==============================
2619     dnl === SQLite fdatasync check ===
2620     dnl ==============================
2621     dnl Check to see if fdatasync is available
2622     AC_CHECK_FUNC(fdatasync)
2625 if test -n "$MOZ_SYSTEM_SQLITE"; then
2626     AC_DEFINE(MOZ_SYSTEM_SQLITE)
2628 AC_SUBST(MOZ_SYSTEM_SQLITE)
2630 dnl ========================================================
2631 dnl = Disable zipwriter
2632 dnl ========================================================
2633 MOZ_ARG_DISABLE_BOOL(zipwriter,
2634 [  --disable-zipwriter     Disable zipwriter component],
2635     MOZ_ZIPWRITER=,
2636     MOZ_ZIPWRITER=1 )
2637 AC_SUBST(MOZ_ZIPWRITER)
2639 dnl ========================================================
2640 dnl =
2641 dnl = Feature options that require extra sources to be pulled
2642 dnl =
2643 dnl ========================================================
2644 dnl MOZ_ARG_HEADER(Features that require extra sources)
2646 dnl ========================================================
2647 dnl =
2648 dnl = Runtime debugging and Optimization Options
2649 dnl =
2650 dnl ========================================================
2651 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2653 dnl ========================================================
2654 dnl enable mobile optimizations
2655 dnl ========================================================
2656 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2657 [  --enable-mobile-optimize
2658                           Enable mobile optimizations],
2659     MOZ_GFX_OPTIMIZE_MOBILE=1)
2661 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2663 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2664     # We ignore paint will resample on mobile for performance.
2665     # We may want to revisit this later.
2666     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2668     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2669     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2672 dnl ========================================================
2673 dnl = Enable code optimization. ON by default.
2674 dnl ========================================================
2676 # Use value from moz.configure if one is defined. Else use our computed
2677 # value.
2678 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2679     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2682 MOZ_SET_FRAMEPTR_FLAGS
2684 if test "$COMPILE_ENVIRONMENT"; then
2685 if test -n "$MOZ_OPTIMIZE"; then
2686     AC_MSG_CHECKING([for valid C compiler optimization flags])
2687     _SAVE_CFLAGS=$CFLAGS
2688     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2689     AC_TRY_COMPILE([#include <stdio.h>],
2690         [printf("Hello World\n");],
2691         _results=yes,
2692         _results=no)
2693     AC_MSG_RESULT([$_results])
2694     if test "$_results" = "no"; then
2695         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2696     fi
2697     CFLAGS=$_SAVE_CFLAGS
2698     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2699         # When using llvm-based LTO, non numeric optimization levels are
2700         # not supported by the linker, so force the linker to use -O2 (
2701         # which doesn't influence the level compilation units are actually
2702         # compiled at).
2703         case " $MOZ_OPTIMIZE_FLAGS " in
2704         *\ -Os\ *|*\ -Oz\ *)
2705             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2706             ;;
2707         esac
2708     fi
2710 fi # COMPILE_ENVIRONMENT
2712 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
2713 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2714 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2715 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2717 dnl ========================================================
2718 dnl = Disable treating compiler warnings as errors
2719 dnl ========================================================
2720 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
2721    WARNINGS_AS_ERRORS=''
2724 dnl ========================================================
2725 dnl = Enable runtime logging
2726 dnl ========================================================
2727 AC_DEFINE(MOZ_LOGGING)
2728 AC_DEFINE(FORCE_PR_LOG)
2730 dnl ========================================================
2731 dnl = This will enable logging of addref, release, ctor, dtor.
2732 dnl ========================================================
2733 _ENABLE_LOGREFCNT=42
2734 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2735 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
2736     _ENABLE_LOGREFCNT=1,
2737     _ENABLE_LOGREFCNT= )
2738 if test "$_ENABLE_LOGREFCNT" = "1"; then
2739     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2740 elif test -z "$_ENABLE_LOGREFCNT"; then
2741     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2744 dnl ========================================================
2745 dnl moz_dump_painting
2746 dnl ========================================================
2747 MOZ_ARG_ENABLE_BOOL(dump-painting,
2748 [  --enable-dump-painting          Enable paint debugging.],
2749     MOZ_DUMP_PAINTING=1,
2750     MOZ_DUMP_PAINTING= )
2751 if test -n "$MOZ_DUMP_PAINTING"; then
2752     AC_DEFINE(MOZ_DUMP_PAINTING)
2753     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2755 if test -n "$MOZ_DEBUG"; then
2756     AC_DEFINE(MOZ_DUMP_PAINTING)
2759 case "${OS_TARGET}" in
2760 Android|WINNT|Darwin)
2761   MOZ_GLUE_IN_PROGRAM=
2762   ;;
2764   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2765   MOZ_GLUE_IN_PROGRAM=1
2766   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2767   ;;
2768 esac
2770 dnl ========================================================
2771 dnl = Jemalloc build setup
2772 dnl ========================================================
2773 if test -z "$MOZ_MEMORY"; then
2774   case "${target}" in
2775     *-mingw*)
2776       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2777         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.])
2778       fi
2779       ;;
2780   esac
2781 else
2782   dnl The generic feature tests that determine how to compute ncpus are long and
2783   dnl complicated.  Therefore, simply define special cpp variables for the
2784   dnl platforms we have special knowledge of.
2785   case "${target}" in
2786   *-mingw*)
2787     export MOZ_NO_DEBUG_RTL=1
2788     ;;
2789   esac
2790 fi # MOZ_MEMORY
2791 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2793 dnl ========================================================
2794 dnl = Enable using the clang plugin to build
2795 dnl ========================================================
2797 if test -n "$COMPILE_ENVIRONMENT"; then
2798 MOZ_CONFIG_CLANG_PLUGIN
2799 fi # COMPILE_ENVIRONMENT
2801 dnl ========================================================
2802 dnl = Enable stripping of libs & executables
2803 dnl ========================================================
2804 MOZ_ARG_ENABLE_BOOL(strip,
2805 [  --enable-strip          Enable stripping of libs & executables ],
2806     ENABLE_STRIP=1,
2807     ENABLE_STRIP= )
2809 dnl ========================================================
2810 dnl = Enable stripping of libs & executables when packaging
2811 dnl ========================================================
2812 MOZ_ARG_ENABLE_BOOL(install-strip,
2813 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
2814     PKG_SKIP_STRIP= ,
2815     PKG_SKIP_STRIP=1)
2817 dnl ========================================================
2818 dnl = frontend JS debug mode
2819 dnl ========================================================
2821 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2822 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
2823    DEBUG_JS_MODULES=1,
2824    DEBUG_JS_MODULES=)
2826 AC_SUBST(DEBUG_JS_MODULES)
2828 dnl ========================================================
2829 dnl =
2830 dnl = Profiling and Instrumenting
2831 dnl =
2832 dnl ========================================================
2833 MOZ_ARG_HEADER(Profiling and Instrumenting)
2835 dnl ========================================================
2836 dnl = Offer a way to disable the startup cache
2837 dnl ========================================================
2839 MOZ_ARG_DISABLE_BOOL(startupcache,
2840 [  --disable-startupcache          Disable startup cache ],
2841     MOZ_DISABLE_STARTUPCACHE=1,
2842     MOZ_DISABLE_STARTUPCACHE=)
2844 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2845   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2847 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2849 dnl ========================================================
2850 dnl = Support for demangling undefined symbols
2851 dnl ========================================================
2852 if test -z "$SKIP_LIBRARY_CHECKS"; then
2853     AC_LANG_SAVE
2854     AC_LANG_CPLUSPLUS
2855     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2856     AC_LANG_RESTORE
2859 # Demangle only for debug or DMD builds
2860 MOZ_DEMANGLE_SYMBOLS=
2861 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2862     MOZ_DEMANGLE_SYMBOLS=1
2863     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2865 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2867 dnl ========================================================
2868 dnl = Support for gcc stack unwinding (from gcc 3.3)
2869 dnl ========================================================
2870 if test -z "$SKIP_LIBRARY_CHECKS"; then
2871     AC_LANG_SAVE
2872     AC_LANG_CPLUSPLUS
2873     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2874     AC_LANG_RESTORE
2877 dnl ========================================================
2878 dnl JIT observers
2879 dnl ========================================================
2881 MOZ_ARG_WITH_STRING(jitreport-granularity,
2882 [  --jitreport-granularity=N
2883                            Default granularity at which to report JIT code
2884                            to external tools
2885                              0 - no info
2886                              1 - code ranges for whole functions only
2887                              2 - per-line information
2888                              3 - per-op information],
2889   JITREPORT_GRANULARITY=$withval,
2890   JITREPORT_GRANULARITY=3)
2892 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2894 dnl ========================================================
2895 dnl =
2896 dnl = Misc. Options
2897 dnl =
2898 dnl ========================================================
2899 MOZ_ARG_HEADER(Misc. Options)
2901 dnl ========================================================
2902 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2903 dnl ========================================================
2904 MOZ_ARG_WITH_STRING(user-appdir,
2905 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
2906 [ val=`echo $withval`
2907 if echo "$val" | grep "\/" >/dev/null; then
2908     AC_MSG_ERROR("Homedir must be single relative path.")
2909 else
2910     MOZ_USER_DIR="$val"
2911 fi])
2913 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2915 if test -z "$SKIP_COMPILER_CHECKS"; then
2916 dnl ========================================================
2917 dnl =
2918 dnl = Compiler Options
2919 dnl =
2920 dnl ========================================================
2921 MOZ_ARG_HEADER(Compiler Options)
2923 dnl ========================================================
2924 dnl Check for gcc -pipe support
2925 dnl ========================================================
2926 AC_MSG_CHECKING([for -pipe support])
2927 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2928     dnl Any gcc that supports firefox supports -pipe.
2929     CFLAGS="$CFLAGS -pipe"
2930     CXXFLAGS="$CXXFLAGS -pipe"
2931     AC_MSG_RESULT([yes])
2932 else
2933     AC_MSG_RESULT([no])
2936 fi # ! SKIP_COMPILER_CHECKS
2938 AC_DEFINE(CPP_THROW_NEW, [throw()])
2939 AC_LANG_C
2941 if test "$COMPILE_ENVIRONMENT"; then
2942 MOZ_EXPAND_LIBS
2943 fi # COMPILE_ENVIRONMENT
2945 dnl ========================================================
2946 dnl =
2947 dnl = Static Build Options
2948 dnl =
2949 dnl ========================================================
2950 MOZ_ARG_HEADER(Static build options)
2952 if test -z "$MOZ_SYSTEM_ZLIB"; then
2953 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
2954   ZLIB_IN_MOZGLUE=1
2955   AC_DEFINE(ZLIB_IN_MOZGLUE)
2959 AC_SUBST(ZLIB_IN_MOZGLUE)
2961 dnl ========================================================
2962 dnl =
2963 dnl = Standalone module options
2964 dnl =
2965 dnl ========================================================
2966 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2968 dnl Check for GLib.
2969 dnl ========================================================
2971 if test -z "$SKIP_PATH_CHECKS"; then
2972 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2973     if test "$MOZ_ENABLE_GTK" ; then
2974         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2975     fi
2979 if test -z "${GLIB_GMODULE_LIBS}" \
2980    -a -n "${GLIB_CONFIG}"\
2981     -a "${GLIB_CONFIG}" != no\
2982 ; then
2983     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2986 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2988 if test "$USE_FC_FREETYPE"; then
2989     if test "$COMPILE_ENVIRONMENT"; then
2990         dnl ========================================================
2991         dnl = Check for freetype2 functionality
2992         dnl ========================================================
2993         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2994             _SAVE_LIBS="$LIBS"
2995             _SAVE_CFLAGS="$CFLAGS"
2996             LIBS="$LIBS $FT2_LIBS"
2997             CFLAGS="$CFLAGS $FT2_CFLAGS"
2999             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3000                 ac_cv_member_FT_Bitmap_Size_y_ppem,
3001                 [AC_TRY_COMPILE([#include <ft2build.h>
3002                                  #include FT_FREETYPE_H],
3003                                 [FT_Bitmap_Size s;
3004                                  if (sizeof s.y_ppem) return 0;
3005                                  return 1],
3006                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3007                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3008             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3009                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3010             else
3011                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3012             fi
3013             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3014                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3015                                [FT_Bitmap_Size structure includes y_ppem field])
3017             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3019             LIBS="$_SAVE_LIBS"
3020             CFLAGS="$_SAVE_CFLAGS"
3021         fi
3023         _SAVE_CPPFLAGS="$CPPFLAGS"
3024         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3025         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3026             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3027         CPPFLAGS="$_SAVE_CPPFLAGS"
3028     fi
3031 dnl ========================================================
3032 dnl Check if we need the 32-bit Linux SSE2 error dialog
3033 dnl ========================================================
3035 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3037 dnl ========================================================
3038 dnl Check for pixman and cairo
3039 dnl ========================================================
3041 MOZ_TREE_CAIRO=1
3042 MOZ_ARG_ENABLE_BOOL(system-cairo,
3043 [ --enable-system-cairo  Obsolete: do not use this option],
3044 AC_MSG_ERROR(--enable-system-cairo is not supported),
3045 MOZ_TREE_CAIRO=1 )
3047 MOZ_TREE_PIXMAN=1
3048 MOZ_ARG_ENABLE_BOOL(system-pixman,
3049 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
3050 MOZ_TREE_PIXMAN=,
3051 MOZ_TREE_PIXMAN=force,
3052 MOZ_TREE_PIXMAN=1 )
3054 if test "$MOZ_TREE_PIXMAN"; then
3055     AC_DEFINE(MOZ_TREE_PIXMAN)
3056 else
3057     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
3060 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
3061 AC_DEFINE(MOZ_TREE_CAIRO)
3063 if test "$OS_ARCH" = "WINNT"; then
3064     # For now we assume that we will have a uint64_t available through
3065     # one of the above headers or mozstdint.h.
3066     AC_DEFINE(HAVE_UINT64_T)
3069 # Define macros for cairo-features.h
3070 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
3071 if test "$MOZ_X11"; then
3072     XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
3073     XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
3074     PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
3076 if test "$_HAVE_FREETYPE2"; then
3077     FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3078     MOZ_ENABLE_CAIRO_FT=1
3079     CAIRO_FT_CFLAGS="$FT2_CFLAGS"
3082 case "$MOZ_WIDGET_TOOLKIT" in
3083   cocoa | uikit)
3084     QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
3085     QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
3086     QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
3087     ;;
3088   windows)
3089     WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
3090     WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
3091     WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
3093     if test "$COMPILE_ENVIRONMENT"; then
3094       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
3095     fi
3096     ;;
3097 esac
3098 if test "$USE_FC_FREETYPE"; then
3099     FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
3101 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
3102 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
3104 AC_SUBST(PS_SURFACE_FEATURE)
3105 AC_SUBST(SVG_SURFACE_FEATURE)
3106 AC_SUBST(XLIB_SURFACE_FEATURE)
3107 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
3108 AC_SUBST(QUARTZ_SURFACE_FEATURE)
3109 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
3110 AC_SUBST(WIN32_SURFACE_FEATURE)
3111 AC_SUBST(OS2_SURFACE_FEATURE)
3112 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
3113 AC_SUBST(FT_FONT_FEATURE)
3114 AC_SUBST(FC_FONT_FEATURE)
3115 AC_SUBST(WIN32_FONT_FEATURE)
3116 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
3117 AC_SUBST(QUARTZ_FONT_FEATURE)
3118 AC_SUBST(PNG_FUNCTIONS_FEATURE)
3119 AC_SUBST(QT_SURFACE_FEATURE)
3120 AC_SUBST(TEE_SURFACE_FEATURE)
3122 if test "$MOZ_X11"; then
3123     MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
3126 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
3128 case "$MOZ_WIDGET_TOOLKIT" in
3129 android)
3130     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
3131     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
3132     ;;
3133 esac
3135 AC_SUBST(MOZ_TREE_CAIRO)
3136 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
3137 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
3138 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
3139 AC_SUBST(MOZ_TREE_PIXMAN)
3141 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
3142 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
3143 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
3144 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
3146 dnl ========================================================
3147 dnl disable xul
3148 dnl ========================================================
3149 MOZ_ARG_DISABLE_BOOL(xul,
3150 [  --disable-xul           Disable XUL],
3151     MOZ_XUL= )
3152 if test "$MOZ_XUL"; then
3153   AC_DEFINE(MOZ_XUL)
3154 else
3155   dnl remove extensions that require XUL
3156   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
3159 AC_SUBST(MOZ_XUL)
3161 dnl ========================================================
3162 dnl necko configuration options
3163 dnl ========================================================
3166 dnl option to disable necko's wifi scanner
3169 if test "$MOZ_WIDGET_TOOLKIT"; then
3171   case "$OS_TARGET" in
3172     Darwin)
3173       if test -z "$MOZ_IOS"; then
3174         NECKO_WIFI=1
3175       fi
3176       ;;
3177     DragonFly|FreeBSD|WINNT)
3178       NECKO_WIFI=1
3179       ;;
3180     Linux)
3181       NECKO_WIFI=1
3182       NECKO_WIFI_DBUS=1
3183       ;;
3184   esac
3188 MOZ_ARG_DISABLE_BOOL(necko-wifi,
3189 [  --disable-necko-wifi    Disable necko wifi scanner],
3190     NECKO_WIFI=,
3191     NECKO_WIFI=1)
3193 if test "$NECKO_WIFI"; then
3194   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
3195     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
3196   fi
3197   AC_DEFINE(NECKO_WIFI)
3198   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
3200 AC_SUBST(NECKO_WIFI)
3201 AC_SUBST(NECKO_WIFI_DBUS)
3204 dnl option to disable cookies
3206 MOZ_ARG_DISABLE_BOOL(cookies,
3207 [  --disable-cookies       Disable cookie support],
3208     NECKO_COOKIES=,
3209     NECKO_COOKIES=1)
3210 AC_SUBST(NECKO_COOKIES)
3211 if test "$NECKO_COOKIES"; then
3212     AC_DEFINE(NECKO_COOKIES)
3213     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
3216 dnl ========================================================
3217 dnl =
3218 dnl = Maintainer debug option (no --enable equivalent)
3219 dnl =
3220 dnl ========================================================
3222 AC_SUBST(NM)
3223 AC_SUBST_LIST(ASFLAGS)
3224 AC_SUBST(RCFLAGS)
3225 AC_SUBST(IMPLIB)
3226 AC_SUBST(FILTER)
3227 AC_SUBST(MOZ_AUTH_EXTENSION)
3228 AC_SUBST(MOZ_PREF_EXTENSIONS)
3229 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
3230 AC_SUBST(WARNINGS_AS_ERRORS)
3231 AC_SUBST_LIST(WARNINGS_CFLAGS)
3232 AC_SUBST_SET(MOZ_EXTENSIONS)
3233 AC_SUBST(MOZ_TOOLKIT_SEARCH)
3235 AC_SUBST(MOZ_UNIVERSALCHARDET)
3236 AC_SUBST(MOZ_SPELLCHECK)
3237 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
3238 AC_SUBST(MOZ_CRASHREPORTER)
3239 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
3240 AC_SUBST(MOZ_STUB_INSTALLER)
3241 AC_SUBST(MOZ_ENABLE_SIGNMAR)
3242 AC_SUBST(MOZ_UPDATER)
3244 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
3245 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
3246 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
3247 AC_SUBST(ENABLE_STRIP)
3248 AC_SUBST(PKG_SKIP_STRIP)
3249 AC_SUBST(STRIP_FLAGS)
3250 AC_SUBST(INCREMENTAL_LINKER)
3252 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
3254 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
3255 AC_SUBST(MOZ_LINKER_EXTRACT)
3257 if test -n "$MOZ_BINARY_EXTENSIONS"; then
3258   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
3261 AC_SUBST(MOZ_REQUIRE_SIGNING)
3262 if test "$MOZ_REQUIRE_SIGNING" = 1; then
3263   AC_DEFINE(MOZ_REQUIRE_SIGNING)
3266 dnl ========================================================
3267 dnl = Mac bundle name prefix
3268 dnl ========================================================
3269 MOZ_ARG_WITH_STRING(macbundlename-prefix,
3270 [  --with-macbundlename-prefix=prefix
3271                           Prefix for MOZ_MACBUNDLE_NAME],
3272 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
3274 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
3275 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
3276   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
3279 if test "$MOZ_DEBUG"; then
3280   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
3281 else
3282   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
3284 AC_SUBST(MOZ_MACBUNDLE_NAME)
3286 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
3287 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
3288 # Otherwise, use MOZ_APP_DISPLAYNAME
3289 if test -z "$MOZ_MACBUNDLE_ID"; then
3290    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
3292 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
3293 if test "$MOZ_DEBUG"; then
3294   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
3297 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
3298 AC_SUBST(MOZ_MACBUNDLE_ID)
3300 dnl ========================================================
3301 dnl = Child Process Name for IPC
3302 dnl ========================================================
3303 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
3304   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
3305 else
3306   # We want to let Android unpack the file at install time, but it only does
3307   # so if the file is named libsomething.so. The lib/ path is also required
3308   # because the unpacked file will be under the lib/ subdirectory and will
3309   # need to be executed from that path.
3310   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
3312 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
3313 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
3315 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
3316 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
3317 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
3319 # The following variables are available to branding and application
3320 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
3321 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
3322 # impacts profile location and user-visible fields.
3323 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
3324 # versions of a given application (e.g. Aurora and Firefox both use
3325 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
3326 # for application.ini's "Name" field, which controls profile location in
3327 # the absence of a "Profile" field (see below), and various system
3328 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
3329 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
3330 # Mac Bundle name, Updater, Installer), it is typically used for nightly
3331 # builds (e.g. Aurora for Firefox).
3332 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
3333 # defaults to a lowercase form of MOZ_APP_BASENAME.
3334 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
3335 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
3336 # - MOZ_APP_PROFILE: When set, used for application.ini's
3337 # "Profile" field, which controls profile location.
3338 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
3339 # crash reporter server url.
3340 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
3341 # the main application is set to the value of this variable.  If not
3342 # set, it falls back to a Mozilla-specific value derived from the
3343 # build ID.
3344 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
3345 # packages produced.
3346 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used.  GCM
3347 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
3348 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
3349 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
3351 # The following environment variables used to have an effect, but don't anymore:
3352 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
3353 # the contents from the version.txt file in the application directory, or
3354 # browser/config/version.txt if there isn't one.
3355 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
3356 # in the "About" window. This was replaced with the contents from the
3357 # version_display.txt or version.txt in the application directory, or
3358 # browser/config/version_display.txt.
3360 if test -z "$MOZ_APP_NAME"; then
3361    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
3364 if test -z "$MOZ_APP_REMOTINGNAME"; then
3365    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
3368 if test -z "$ANDROID_PACKAGE_NAME" ; then
3369    # When we got rid of the Aurora channel we decided to replace the old
3370    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
3371    # by all mozilla-central based branches we make this the new "default"
3372    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
3373    # in their mozconfig, so they will never get this. If there are ever
3374    # non-Fennec builds for Android, they will fall into the else block
3375    # and use their own default name.
3376    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
3377    # background on this.
3378    if test "$MOZ_APP_NAME" = "fennec"; then
3379       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
3380    else
3381       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
3382    fi
3385 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
3386 # the public with specific common shared IDs and we need to keep them
3387 # consistent forever.  The specific common values are set by per-channel
3388 # branding; all other channels use a generic sharedID, set below.
3389 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
3390    MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
3393 # For extensions and langpacks, we require a max version that is compatible
3394 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
3395 # 24.0a1 and 24.0a2 aren't affected
3396 # 24.0 becomes 24.*
3397 # 24.1.1 becomes 24.*
3398 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3399 if test -z "$IS_ALPHA"; then
3400   changequote(,)
3401   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3402     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3403   else
3404     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3405   fi
3406   changequote([,])
3407 else
3408   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3411 AC_SUBST(MOZ_APP_NAME)
3412 AC_SUBST(MOZ_APP_REMOTINGNAME)
3413 AC_SUBST(MOZ_APP_DISPLAYNAME)
3414 AC_SUBST(MOZ_APP_BASENAME)
3415 AC_SUBST(MOZ_APP_VENDOR)
3416 AC_SUBST(MOZ_APP_PROFILE)
3417 AC_SUBST(MOZ_APP_ID)
3418 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3419 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3420 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3421 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3422 AC_SUBST(MAR_CHANNEL_ID)
3423 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3424 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3425 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3426 AC_SUBST(MOZ_APP_UA_NAME)
3427 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3428 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3429 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3431 AC_SUBST(MOZ_APP_MAXVERSION)
3432 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3433 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3434   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3437 AC_SUBST(MOZ_PKG_SPECIAL)
3438 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3440 if test "$MOZILLA_OFFICIAL"; then
3441     # Build revisions should always be present in official builds
3442     MOZ_INCLUDE_SOURCE_INFO=1
3445 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3446 # explicitly set the repository and changeset information in.
3447 AC_SUBST(MOZ_SOURCE_REPO)
3448 AC_SUBST(MOZ_SOURCE_CHANGESET)
3449 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3451 if test "$MOZ_TELEMETRY_REPORTING"; then
3452     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
3454     # Enable Telemetry by default for nightly and aurora channels
3455     if test -z "$RELEASE_OR_BETA"; then
3456       AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
3457     fi
3460 dnl If we have any service that uploads data (and requires data submission
3461 dnl policy alert), set MOZ_DATA_REPORTING.
3462 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3463 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
3464   MOZ_DATA_REPORTING=1
3465   AC_DEFINE(MOZ_DATA_REPORTING)
3466   AC_SUBST(MOZ_DATA_REPORTING)
3469 dnl win32 options
3470 AC_SUBST(WIN32_REDIST_DIR)
3471 AC_SUBST(WIN_UCRT_REDIST_DIR)
3472 AC_SUBST(WIN_DIA_SDK_BIN_DIR)
3474 dnl ========================================================
3475 dnl ICU Support
3476 dnl ========================================================
3478 _INTL_API=yes
3480 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3481     USE_ICU=1
3484 MOZ_CONFIG_ICU()
3486 dnl Echo the CFLAGS to remove extra whitespace.
3487 CFLAGS=`echo \
3488     $_COMPILATION_CFLAGS \
3489     $CFLAGS`
3491 CXXFLAGS=`echo \
3492     $_WARNINGS_CXXFLAGS \
3493     $_COMPILATION_CXXFLAGS \
3494     $CXXFLAGS`
3496 COMPILE_CFLAGS=`echo \
3497     $_DEFINES_CFLAGS \
3498     $COMPILE_CFLAGS`
3500 COMPILE_CXXFLAGS=`echo \
3501     $_DEFINES_CXXFLAGS \
3502     $COMPILE_CXXFLAGS`
3504 HOST_CFLAGS=`echo \
3505     $_WARNINGS_HOST_CFLAGS \
3506     $_COMPILATION_HOST_CFLAGS \
3507     $HOST_CFLAGS`
3509 HOST_CXXFLAGS=`echo \
3510     $_WARNINGS_HOST_CXXFLAGS \
3511     $_COMPILATION_HOST_CXXFLAGS \
3512     $HOST_CXXFLAGS`
3514 AC_SUBST(MOZ_SYSTEM_PNG)
3516 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3517 AC_SUBST_LIST(MOZ_PNG_LIBS)
3519 AC_SUBST(MOZ_SYSTEM_NSPR)
3521 AC_SUBST(MOZ_SYSTEM_NSS)
3523 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3524 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3525 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3526 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3527 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3528   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3529   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3531 AC_SUBST(HOST_CMFLAGS)
3532 AC_SUBST(HOST_CMMFLAGS)
3533 AC_SUBST(OS_COMPILE_CMFLAGS)
3534 AC_SUBST(OS_COMPILE_CMMFLAGS)
3536 OS_CFLAGS="$CFLAGS"
3537 OS_CXXFLAGS="$CXXFLAGS"
3538 OS_CPPFLAGS="$CPPFLAGS"
3539 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3540 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3541 OS_LDFLAGS="$LDFLAGS"
3542 OS_LIBS="$LIBS"
3543 AC_SUBST_LIST(OS_CFLAGS)
3544 AC_SUBST_LIST(OS_CXXFLAGS)
3545 AC_SUBST_LIST(OS_CPPFLAGS)
3546 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3547 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3548 AC_SUBST_LIST(OS_LDFLAGS)
3549 AC_SUBST(OS_LIBS)
3551 AC_SUBST(HOST_CC)
3552 AC_SUBST(HOST_CXX)
3553 AC_SUBST_LIST(HOST_CFLAGS)
3554 AC_SUBST_LIST(HOST_CPPFLAGS)
3555 AC_SUBST_LIST(HOST_CXXFLAGS)
3556 AC_SUBST(HOST_LDFLAGS)
3557 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3558 AC_SUBST(HOST_BIN_SUFFIX)
3560 AC_SUBST(TARGET_XPCOM_ABI)
3561 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3562 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3563 AC_SUBST(HAVE_X86_AVX2)
3564 AC_SUBST(HAVE_ALTIVEC)
3566 AC_SUBST_LIST(DSO_CFLAGS)
3567 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3568 AC_SUBST(DSO_LDOPTS)
3569 AC_SUBST(BIN_SUFFIX)
3570 AC_SUBST(USE_N32)
3571 AC_SUBST(NS_ENABLE_TSF)
3572 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3573 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3575 AC_SUBST(MOZ_DEVTOOLS)
3577 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3578 AC_SUBST(MOZ_FOLD_LIBS)
3579 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3581 AC_SUBST(DMG_TOOL)
3583 dnl Host JavaScript runtime, if any, to use during cross compiles.
3584 AC_SUBST(JS_BINARY)
3586 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3588 if test -n "$COMPILE_ENVIRONMENT"; then
3589 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3591 dnl Check for missing components
3592 if test "$MOZ_X11"; then
3593     dnl ====================================================
3594     dnl = Check if X headers exist
3595     dnl ====================================================
3596     _SAVE_CFLAGS=$CFLAGS
3597     CFLAGS="$CFLAGS $XCFLAGS"
3598     AC_TRY_COMPILE([
3599         #include <stdio.h>
3600         #include <stdlib.h>
3601         #include <X11/Xlib.h>
3602         #include <X11/Intrinsic.h>
3603         #include <X11/extensions/XShm.h>
3604     ],
3605     [
3606         Display *dpy = 0;
3607         if ((dpy = XOpenDisplay(NULL)) == NULL) {
3608             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3609             exit(1);
3610         }
3611     ], [],
3612     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3613     CFLAGS="$_SAVE_CFLAGS"
3615     if test -n "$MISSING_X"; then
3616         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3617     fi
3619 fi # MOZ_X11
3621 fi # COMPILE_ENVIRONMENT
3623 dnl Set various defines and substitutions
3624 dnl ========================================================
3626 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3627     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3628     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3629     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3630     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3631     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3632     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3633     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3634     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3637 AC_SUBST(MOZ_DEV_EDITION)
3638 if test -n "$MOZ_DEV_EDITION"; then
3639     AC_DEFINE(MOZ_DEV_EDITION)
3642 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3643     A11Y_LOG=1
3645 AC_SUBST(A11Y_LOG)
3646 if test -n "$A11Y_LOG"; then
3647     AC_DEFINE(A11Y_LOG)
3650 dnl Spit out some output
3651 dnl ========================================================
3653 dnl The following defines are used by xpcom
3654 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3655 CPP_THROW_NEW
3656 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
3657 HAVE_GETPAGESIZE
3658 HAVE_STATVFS64
3659 HAVE_STATVFS
3660 HAVE_STATFS64
3661 HAVE_STATFS
3662 HAVE_SYS_STATVFS_H
3663 HAVE_SYS_STATFS_H
3664 HAVE_SYS_VFS_H
3665 HAVE_SYS_MOUNT_H
3668 # Avoid using obsolete NSPR features
3669 AC_DEFINE(NO_NSPR_10_SUPPORT)
3671 MOZ_CREATE_CONFIG_STATUS()
3673 rm -fr confdefs* $ac_clean_files