Bug 1454293 [wpt PR 10484] - null is not the correct origin for createDocument()...
[gecko.git] / old-configure.in
blob96d7eea10402e47f6d862659c04ae8726e62a98e
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 two 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 MOZJPEG=62
49 MOZPNG=10634
50 NSPR_VERSION=4
51 NSPR_MINVER=4.19
52 NSS_VERSION=3
54 dnl Set the minimum version of toolkit libs used by mozilla
55 dnl ========================================================
56 GLIB_VERSION=2.22
57 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
58 # The macro won't be used when compiling with earlier versions anyway.
59 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
60 CAIRO_VERSION=1.10
61 GTK2_VERSION=2.18.0
62 GTK3_VERSION=3.4.0
63 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
64 WINDRES_VERSION=2.14.90
65 W32API_VERSION=3.14
66 GCONF_VERSION=1.2.1
67 STARTUP_NOTIFICATION_VERSION=0.8
68 DBUS_VERSION=0.60
69 SQLITE_VERSION=3.23.1
71 dnl Set various checks
72 dnl ========================================================
73 MISSING_X=
75 dnl Initialize the Pthread test variables early so they can be
76 dnl  overridden by each platform.
77 dnl ========================================================
78 MOZ_USE_PTHREADS=
79 _PTHREAD_LDFLAGS=""
81 MOZ_DEFAULT_COMPILER
83 if test "$COMPILE_ENVIRONMENT"; then
84     MOZ_ANDROID_NDK
85 fi # COMPILE_ENVIRONMENT
87 case "$target" in
88 *-android*|*-linuxandroid*)
89     AC_DEFINE(ANDROID)
90     ;;
91 *-linux*)
92     AC_PATH_PROG(OBJCOPY,objcopy)
93     ;;
94 esac
96 case "$target" in
97 *-apple-darwin*)
98     MOZ_IOS_SDK
99     ;;
100 esac
102 AC_SUBST(ANDROID_SOURCE)
103 AC_SUBST(ANDROID_PACKAGE_NAME)
104 AC_SUBST(OBJCOPY)
106 dnl ========================================================
107 dnl Checks for compilers.
108 dnl ========================================================
110 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
111 AR_FLAGS='crs $@'
113 if test "$COMPILE_ENVIRONMENT"; then
115 if test "$target" != "$host"; then
116     MOZ_CROSS_COMPILER
117 else
118     AC_PROG_CC
119     case "$target" in
120     *-mingw*)
121       # Work around the conftest.exe access problem on Windows
122       sleep 2
123     esac
124     AC_PROG_CXX
125     AC_PROG_RANLIB
126     MOZ_PATH_PROGS(AS, $AS as, $CC)
127     AC_CHECK_PROGS(AR, ar, :)
128     AC_CHECK_PROGS(STRIP, strip, :)
129     AC_CHECK_PROGS(WINDRES, windres, :)
130     AC_CHECK_PROGS(OTOOL, otool, :)
131     if test -z "$HOST_RANLIB"; then
132         HOST_RANLIB="$RANLIB"
133     fi
134     if test -z "$HOST_AR"; then
135         HOST_AR="$AR"
136     fi
137     if test -z "$HOST_AR_FLAGS"; then
138         HOST_AR_FLAGS="$AR_FLAGS"
139     fi
142 if test -n "$MOZ_WINCONSOLE"; then
143     AC_DEFINE(MOZ_WINCONSOLE)
146 MOZ_TOOL_VARIABLES
148 dnl ========================================================
149 dnl Special win32 checks
150 dnl ========================================================
152 WINVER=601
154 case "$target" in
155 *-mingw*)
156     if test "$GCC" != "yes"; then
157         # Check to see if we are really running in a msvc environemnt
158         _WIN32_MSVC=1
159         AC_CHECK_PROGS(MIDL, midl)
161         # Make sure compilers are valid
162         CFLAGS="$CFLAGS -TC -nologo"
163         CXXFLAGS="$CXXFLAGS -TP -nologo"
164         AC_LANG_SAVE
165         AC_LANG_C
166         AC_TRY_COMPILE([#include <stdio.h>],
167             [ printf("Hello World\n"); ],,
168             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
170         AC_LANG_CPLUSPLUS
171         AC_TRY_COMPILE([#include <new.h>],
172             [ unsigned *test = new unsigned(42); ],,
173             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
174         AC_LANG_RESTORE
176         changequote(,)
177         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
178         changequote([,])
180         _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
182         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
183         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
184         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
186         _CC_SUITE=14
187         MSVC_C_RUNTIME_DLL=vcruntime140.dll
188         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
190         MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
191         if test -n "$MSVC_HAS_DIA_SDK"; then
192             AC_DEFINE(MSVC_HAS_DIA_SDK)
193         fi
195         if test "$_MSC_VER" -ge "1910"; then # VS2017+
196             # C5038: Enable initializer list order warnings
197             # The -w1#### flag treats warning C#### as if it was a warning level
198             # 1 warning, and thus enables it because we enable /W3 warnings. We
199             # don't use -we#### because it would enable warning C#### but treat
200             # it as an error, even in third-party code.
201             # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
202             CXXFLAGS="$CXXFLAGS -w15038"
203         fi
205         # C5026: move constructor was implicitly defined as deleted
206         CXXFLAGS="$CXXFLAGS -wd5026"
208         # C5027: move assignment operator was implicitly defined as deleted
209         CXXFLAGS="$CXXFLAGS -wd5027"
211         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
212         CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
214         # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
215         # for dbghelp.h, imagehlp.h, and shobj.h
216         # C4091: 'typedef ': ignored on left of '' when no variable is declared
217         CFLAGS="$CFLAGS -wd4091"
218         CXXFLAGS="$CXXFLAGS -wd4091"
220         # This is intended as a temporary hack to support building with VS2015.
221         # 'noexcept' used with no exception handling mode specified;
222         # termination on exception is not guaranteed. Specify /EHsc
223         CXXFLAGS="$CXXFLAGS -wd4577"
225         if test -n "$WIN_UCRT_REDIST_DIR"; then
226           if test ! -d "$WIN_UCRT_REDIST_DIR"; then
227             AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
228           fi
229           WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
230         fi
232         AC_SUBST(MSVC_HAS_DIA_SDK)
233         AC_SUBST(MSVC_C_RUNTIME_DLL)
234         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
236         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
238         if test -n "$WIN32_REDIST_DIR"; then
239           if test ! -d "$WIN32_REDIST_DIR"; then
240             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
241           fi
242           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
243         fi
245         # Check linker version, except in lld builds
246         case "$LINKER" in
247         *lld*)
248             ;;
249         *)
250             _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
251             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
252             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
253                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
254             fi
255             ;;
256         esac
258         INCREMENTAL_LINKER=1
260         # Set midl environment
261         case "$target" in
262         i*86-*)
263             MIDL_FLAGS="${MIDL_FLAGS} -env win32"
264             ;;
265         x86_64-*)
266             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
267             ;;
268         esac
270         unset _MSVC_VER_FILTER
272         AC_CACHE_CHECK(for overridable _RAISE,
273                        ac_cv_have__RAISE,
274             [
275                 AC_LANG_SAVE
276                 AC_LANG_CPLUSPLUS
277                 _SAVE_CXXFLAGS="$CXXFLAGS"
278                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
279                 AC_TRY_COMPILE([#include <xstddef>
280                                 #undef _RAISE
281                                 #define _RAISE(x) externallyDefinedFunction((x).what())
282                                 #include <vector>
283                                ],
284                                [std::vector<int> v; return v.at(1);],
285                                ac_cv_have__RAISE="no",
286                                ac_cv_have__RAISE="yes")
287                 CXXFLAGS="$_SAVE_CXXFLAGS"
288                 AC_LANG_RESTORE
289             ])
290         if test "$ac_cv_have__RAISE" = "yes"; then
291             WRAP_STL_INCLUDES=1
292             MOZ_MSVC_STL_WRAP_RAISE=1
293             AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
294         else
295             AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
296         fi
298         if test "$WRAP_STL_INCLUDES" = "1"; then
299             STL_FLAGS="-I${DIST}/stl_wrappers"
300         fi
301         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
302         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
303     else
304         # Check w32api version
305         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
306         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
307         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
308         AC_TRY_COMPILE([#include <w32api.h>],
309             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
310                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
311                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
312                 #error "test failed."
313             #endif
314             , [ res=yes ], [ res=no ])
315         AC_MSG_RESULT([$res])
316         if test "$res" != "yes"; then
317             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
318         fi
319         # Check windres version
320         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
321         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
322         AC_MSG_RESULT([$_WINDRES_VERSION])
323         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
324         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
325         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
326         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
327         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
328         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
329         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
330                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
331                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
332                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
333                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
334                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
335         then
336             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
337         fi
339         AC_CHECK_PROGS(MIDL, $target-widl widl)
340         if test -n "$MIDL"; then
341             case "$target" in
342             i*86-*)
343                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
344                 ;;
345             x86_64-*)
346                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
347                 ;;
348             esac
349         fi
351         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
352         # causing problems with local implementations with the same name.
353         AC_DEFINE(STRSAFE_NO_DEPRECATE)
354     fi # !GNU_CC
356     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
357     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
358     # Require OS features provided by IE 8.0 (Win7)
359     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
361     ;;
362 esac
364 if test -n "$_WIN32_MSVC"; then
365     SKIP_PATH_CHECKS=1
366     SKIP_COMPILER_CHECKS=1
367     SKIP_LIBRARY_CHECKS=1
369     # Since we're skipping compiler and library checks, hard-code
370     # some facts here.
371     AC_DEFINE(HAVE_IO_H)
372     AC_DEFINE(HAVE_ISATTY)
375 fi # COMPILE_ENVIRONMENT
377 AC_SUBST(MIDL_FLAGS)
378 AC_SUBST(_MSC_VER)
380 AC_SUBST(GNU_AS)
381 AC_SUBST(GNU_CC)
382 AC_SUBST(GNU_CXX)
384 AC_SUBST_LIST(STL_FLAGS)
385 AC_SUBST(WRAP_STL_INCLUDES)
386 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
388 dnl ========================================================
389 dnl Checks for programs.
390 dnl ========================================================
391 if test "$COMPILE_ENVIRONMENT"; then
393 dnl ========================================================
394 dnl = Mac OS X SDK support
395 dnl ========================================================
396 MACOS_SDK_DIR=
397 MOZ_ARG_WITH_STRING(macos-sdk,
398 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
399     MACOS_SDK_DIR=$withval)
401 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
402 MOZ_ARG_WITH_STRING(macos-private-frameworks,
403 [  --with-macos-private-frameworks=dir    Location of private frameworks to use (Mac OS X only)],
404     MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
405     MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
406     MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
408 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
409   if test -z "$CROSS_COMPILE"; then
410     AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
411   fi
412   if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
413     AC_MSG_ERROR([PrivateFrameworks directory not found.])
414   fi
417 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
418 AC_SUBST(MACOS_SDK_DIR)
419 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
421 if test "$MACOS_SDK_DIR"; then
422   dnl Sync this section with the ones in NSPR and NSS.
423   dnl Changes to the cross environment here need to be accounted for in
424   dnl the libIDL checks (below) and xpidl build.
426   if test ! -d "$MACOS_SDK_DIR"; then
427     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
428 specify a valid SDK.  SDKs are installed when the optional cross-development
429 tools are selected during the Xcode/Developer Tools installation.])
430   fi
432   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
433   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
435   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
436   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
437   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
439   AC_LANG_SAVE
440   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
441   AC_LANG_CPLUSPLUS
442   AC_TRY_COMPILE([#include <new>],[],
443    result=yes,
444    result=no)
445   AC_LANG_RESTORE
446   AC_MSG_RESULT($result)
448   if test "$result" = "no" ; then
449     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
450   fi
453 AC_PATH_XTRA
455 XCFLAGS="$X_CFLAGS"
457 fi # COMPILE_ENVIRONMENT
459 dnl ========================================================
460 dnl set the defaults first
461 dnl ========================================================
462 AS_BIN=$AS
463 AR_EXTRACT='$(AR) x'
464 AS='$(CC)'
465 AS_DASH_C_FLAG='-c'
466 MOZ_USER_DIR=".mozilla"
468 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
470 MOZ_FS_LAYOUT=unix
472 dnl Configure platform-specific CPU architecture compiler options.
473 dnl ==============================================================
474 if test "$COMPILE_ENVIRONMENT"; then
475     MOZ_ARCH_OPTS
476 else
477     if test "$OS_TARGET" = Android; then
478         dnl Default Android builds to ARMv7.
479         MOZ_ARCH=armv7-a
480     fi
481 fi # COMPILE_ENVIRONMENT
483 dnl ========================================================
484 dnl Android libstdc++, placed here so it can use MOZ_ARCH
485 dnl computed above.
486 dnl ========================================================
488 MOZ_ANDROID_CPU_ARCH
489 if test "$COMPILE_ENVIRONMENT"; then
490     MOZ_ANDROID_STLPORT
491 fi # COMPILE_ENVIRONMENT
493 dnl ========================================================
494 dnl Suppress Clang Argument Warnings
495 dnl ========================================================
496 if test -n "${CLANG_CC}${CLANG_CL}"; then
497     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
498     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
500 if test -n "${CLANG_CXX}${CLANG_CL}"; then
501     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
504 if test -n "$COMPILE_ENVIRONMENT"; then
505    MOZ_CONFIG_SANITIZE
508 dnl ========================================================
509 dnl Add optional and non-optional hardening flags
510 dnl ========================================================
512 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
513 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
514 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
516 dnl ========================================================
517 dnl GNU specific defaults
518 dnl ========================================================
519 if test "$GNU_CC"; then
520     MMX_FLAGS="-mmmx"
521     SSE_FLAGS="-msse"
522     SSE2_FLAGS="-msse2"
523     SSSE3_FLAGS="-mssse3"
524     # FIXME: Let us build with strict aliasing. bug 414641.
525     CFLAGS="$CFLAGS -fno-strict-aliasing"
526     MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
527     MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
528     WARNINGS_AS_ERRORS='-Werror'
529     DSO_CFLAGS=''
530     DSO_PIC_CFLAGS='-fPIC'
531     ASFLAGS="$ASFLAGS -fPIC"
532     AC_MSG_CHECKING([for --noexecstack option to as])
533     _SAVE_CFLAGS=$CFLAGS
534     CFLAGS="$CFLAGS -Wa,--noexecstack"
535     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
536                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
537                      AC_MSG_RESULT([no]))
538     CFLAGS=$_SAVE_CFLAGS
539     AC_MSG_CHECKING([for -z noexecstack option to ld])
540     _SAVE_LDFLAGS=$LDFLAGS
541     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
542     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
543                   AC_MSG_RESULT([no])
544                   LDFLAGS=$_SAVE_LDFLAGS)
546     AC_MSG_CHECKING([for -z text option to ld])
547     _SAVE_LDFLAGS=$LDFLAGS
548     LDFLAGS="$LDFLAGS -Wl,-z,text"
549     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
550                   AC_MSG_RESULT([no])
551                   LDFLAGS=$_SAVE_LDFLAGS)
553     AC_MSG_CHECKING([for -z relro option to ld])
554     _SAVE_LDFLAGS=$LDFLAGS
555     LDFLAGS="$LDFLAGS -Wl,-z,relro"
556     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
557                   AC_MSG_RESULT([no])
558                   LDFLAGS=$_SAVE_LDFLAGS)
560     AC_MSG_CHECKING([for --build-id option to ld])
561     _SAVE_LDFLAGS=$LDFLAGS
562     LDFLAGS="$LDFLAGS -Wl,--build-id"
563     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
564                   AC_MSG_RESULT([no])
565                   LDFLAGS=$_SAVE_LDFLAGS)
567     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
568     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
569     _SAVE_LDFLAGS=$LDFLAGS
570     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
571     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
572                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
573                   AC_MSG_RESULT([no]))
574     LDFLAGS=$_SAVE_LDFLAGS
576     # Check for -mssse3 on $CC
577     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
578     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
579     _SAVE_CFLAGS=$CFLAGS
580     CFLAGS="$CFLAGS -mssse3"
581     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
582                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
583                      AC_MSG_RESULT([no]))
584     CFLAGS=$_SAVE_CFLAGS
586     # Check for -msse4.1 on $CC
587     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
588     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
589     _SAVE_CFLAGS=$CFLAGS
590     CFLAGS="$CFLAGS -msse4.1"
591     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
592                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
593                      AC_MSG_RESULT([no]))
594     CFLAGS=$_SAVE_CFLAGS
596     case "${CPU_ARCH}" in
597     x86 | x86_64)
598       AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
599       AC_TRY_COMPILE([],
600                      [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
601                      result="yes", result="no")
602       AC_MSG_RESULT("$result")
603       if test "$result" = "yes"; then
604           HAVE_X86_AVX2=1
605       fi
606       ;;
608     ppc*)
609       AC_MSG_CHECKING([whether we can enable AltiVec support])
610       HAVE_ALTIVEC=
611       _SAVE_CFLAGS=$CFLAGS
612       CFLAGS="$CFLAGS -maltivec"
613       AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
614                        [HAVE_ALTIVEC=1],
615                        AC_MSG_RESULT([no]))
616       CFLAGS=$_SAVE_CFLAGS
617       ;;
618     esac
620     DSO_LDOPTS='-shared'
621     if test "$GCC_USE_GNU_LD"; then
622         # Some tools like ASan use a runtime library that is only
623         # linked against executables, so we must allow undefined
624         # symbols for shared objects in some cases.
625         if test -z "$MOZ_NO_WLZDEFS"; then
626             # Don't allow undefined symbols in libraries
627             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
629             # BSDs need `environ' exposed for posix_spawn (bug 753046)
630             case "$OS_TARGET" in
631             DragonFly|FreeBSD|NetBSD|OpenBSD)
632                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
633                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
634                 else
635                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
636                 fi
637                 ;;
638             esac
639         fi
640     fi
642     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
643     _USE_CPP_INCLUDE_FLAG=1
645     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
648 if test "$GNU_CXX"; then
649     # FIXME: Let us build with strict aliasing. bug 414641.
650     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
652     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
653     _USE_CPP_INCLUDE_FLAG=1
656 dnl ========================================================
657 dnl = Use Valgrind
658 dnl ========================================================
659 MOZ_ARG_ENABLE_BOOL(valgrind,
660 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
661     MOZ_VALGRIND=1,
662     MOZ_VALGRIND= )
663 if test -n "$MOZ_VALGRIND"; then
664     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
665         AC_MSG_ERROR(
666             [--enable-valgrind specified but Valgrind is not installed]))
667     AC_DEFINE(MOZ_VALGRIND)
669 AC_SUBST(MOZ_VALGRIND)
671 # For profiling builds keep the symbol information
672 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
673     case "$OS_TARGET" in
674     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
675         STRIP_FLAGS="--strip-debug"
676         ;;
677     esac
680 dnl ========================================================
681 dnl = Enable DMD
682 dnl ========================================================
684 if test "$MOZ_DMD"; then
685     if test "${CPU_ARCH}" = "arm"; then
686         CFLAGS="$CFLAGS -funwind-tables"
687         CXXFLAGS="$CXXFLAGS -funwind-tables"
688     fi
691 dnl ========================================================
692 dnl System overrides of the defaults for host
693 dnl ========================================================
694 case "$host" in
695 *mingw*)
696     if test -n "$_WIN32_MSVC"; then
697         HOST_AR=lib
698         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
699         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
700         HOST_RANLIB='echo ranlib'
701     else
702         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
703     fi
704     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
705     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
706     HOST_BIN_SUFFIX=.exe
708     case "${host_cpu}" in
709     i*86)
710         if test -n "$_WIN32_MSVC"; then
711             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
712         fi
713         ;;
714     x86_64)
715         if test -n "$_WIN32_MSVC"; then
716             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
717         fi
718         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
719         ;;
720     esac
721     ;;
723 *-darwin*)
724     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
725     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
726     ;;
728 *-linux*|*-kfreebsd*-gnu|*-gnu*)
729     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
730     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
731     ;;
734     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
735     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
736     ;;
737 esac
739 dnl Get version of various core apps from the version files.
740 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
741 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
743 if test -z "$FIREFOX_VERSION"; then
744     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
747 if test -z "$FIREFOX_VERSION_DISPLAY"; then
748     AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
751 MOZ_DOING_LTO(lto_is_enabled)
753 dnl ========================================================
754 dnl System overrides of the defaults for target
755 dnl ========================================================
757 case "$target" in
758 *-darwin*)
759     MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
760     MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
761     MOZ_OPTIMIZE_FLAGS="-O3"
762     CXXFLAGS="$CXXFLAGS -stdlib=libc++"
763     DSO_LDOPTS=''
764     STRIP_FLAGS="$STRIP_FLAGS -x -S"
765     # Ensure that if we're targeting iOS an SDK was provided.
766     AC_CACHE_CHECK(for iOS target,
767                    ac_cv_ios_target,
768                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
769 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
770 #error not iOS
771 #endif],
772                                    [],
773                                    ac_cv_ios_target="yes",
774                                    ac_cv_ios_target="no")])
775     if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
776        AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
777     fi
778     if test -n "$MOZ_IOS"; then
779         direct_nspr_config=1
780     else
781         # The ExceptionHandling framework is needed for Objective-C exception
782         # logging code in nsObjCExceptions.h. Currently we only use that in debug
783         # builds.
784         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
785     fi
787     if test "x$lto_is_enabled" = "xyes"; then
788         echo "Skipping -dead_strip because lto is enabled."
789     dnl DTrace and -dead_strip don't interact well. See bug 403132.
790     dnl ===================================================================
791     elif test "x$enable_dtrace" = "xyes"; then
792         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
793     else
794         dnl check for the presence of the -dead_strip linker flag
795         AC_MSG_CHECKING([for -dead_strip option to ld])
796         _SAVE_LDFLAGS=$LDFLAGS
797         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
798         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
799         if test -n "$_HAVE_DEAD_STRIP" ; then
800             AC_MSG_RESULT([yes])
801             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
802         else
803             AC_MSG_RESULT([no])
804         fi
806         LDFLAGS=$_SAVE_LDFLAGS
807     fi
809     MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
810     ;;
812 *-android*|*-linuxandroid*)
813     AC_DEFINE(NO_PW_GECOS)
815     if test "$COMPILE_ENVIRONMENT"; then
816         MOZ_LINKER=1
817     fi
819     MOZ_GFX_OPTIMIZE_MOBILE=1
820     if test -z "$CLANG_CC"; then
821         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
822     else
823         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
824         # -Oz is smaller than -Os on clang.
825         MOZ_OPTIMIZE_FLAGS="-Oz"
826     fi
827     ;;
829 *-*linux*)
830     if test "$GNU_CC" -o "$GNU_CXX"; then
831         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
832         if test -n "$MOZ_DEBUG"; then
833             MOZ_OPTIMIZE_FLAGS="-Os"
834         else
835             MOZ_OPTIMIZE_FLAGS="-O2"
836         fi
837         if test -z "$CLANG_CC"; then
838            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
839         fi
840     fi
842     case "${target_cpu}" in
843     alpha*)
844         CFLAGS="$CFLAGS -mieee"
845         CXXFLAGS="$CXXFLAGS -mieee"
846     ;;
847     esac
848     ;;
849 *-mingw*)
850     DSO_CFLAGS=
851     DSO_PIC_CFLAGS=
852     RC=rc.exe
853     # certain versions of cygwin's makedepend barf on the
854     # #include <string> vs -I./dist/include/string issue so don't use it
855     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
856         CC="$CC -mwindows"
857         CXX="$CXX -mwindows"
858         CPP="$CPP -mwindows"
859         CFLAGS="$CFLAGS -mms-bitfields"
860         CXXFLAGS="$CXXFLAGS -mms-bitfields"
861         DSO_LDOPTS='-shared'
862         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
863         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
864         RC='$(WINDRES)'
865         # Use static libgcc and libstdc++
866         LDFLAGS="$LDFLAGS -static"
867         # Use temp file for windres (bug 213281)
868         RCFLAGS='-O coff --use-temp-file'
869         # mingw doesn't require kernel32, user32, and advapi32 explicitly
870         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
871         MOZ_FIX_LINK_PATHS=
873         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
874         WIN32_GUI_EXE_LDFLAGS=-mwindows
876         # GCC/binutils can't link to a function if we try to include dllexport function
877         # in the same library as dllimport caller. To work around it, we build NSPR
878         # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
879         # function thunks need to be generated for cross-DLL calls.
880         MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
881     else
882         TARGET_COMPILER_ABI=msvc
883         if test "$AS_BIN"; then
884             AS="$(basename "$AS_BIN")"
885         fi
886         AR='lib'
887         AR_FLAGS='-NOLOGO -OUT:$@'
888         AR_EXTRACT=
889         RANLIB='echo not_ranlib'
890         STRIP='echo not_strip'
891         PKG_SKIP_STRIP=1
892         MKSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
893         MKCSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
894         WIN32_SUBSYSTEM_VERSION=6.01
895         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
896         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
897         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
898         _USE_CPP_INCLUDE_FLAG=1
899         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
900         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
901         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
902         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
903         if test -z "$CLANG_CL"; then
904             CPPFLAGS="$CPPFLAGS -utf-8"
905         fi
906         if test "$CPU_ARCH" = "x86"; then
907             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
908             dnl more recent, so set that explicitly here unless another
909             dnl target arch has already been set.
910             changequote(,)
911             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
912               CFLAGS="$CFLAGS -arch:SSE2"
913             fi
914             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
915               CXXFLAGS="$CXXFLAGS -arch:SSE2"
916             fi
917             changequote([,])
918             SSE_FLAGS="-arch:SSE"
919             SSE2_FLAGS="-arch:SSE2"
920             dnl MSVC allows the use of intrinsics without any flags
921             dnl and doesn't have a separate arch for SSSE3
922             SSSE3_FLAGS="-arch:SSE2"
923         fi
924         dnl clang-cl requires appropriate flags to enable SSSE3 support
925         dnl on all architectures.
926         if test -n "$CLANG_CL"; then
927             SSSE3_FLAGS="-mssse3"
928         fi
929         dnl VS2013+ supports -Gw for better linker optimizations.
930         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
931         dnl Disabled on ASan because it causes false-positive ODR violations.
932         if test -z "$MOZ_ASAN"; then
933             CFLAGS="$CFLAGS -Gw"
934             CXXFLAGS="$CXXFLAGS -Gw"
935         fi
936         # khuey says we can safely ignore MSVC warning C4251
937         # MSVC warning C4244 (implicit type conversion may lose data) warns
938         # and requires workarounds for perfectly valid code.  Also, GCC/clang
939         # don't warn about it by default. So for consistency/sanity, we turn
940         # it off on MSVC, too.
941         # MSVC warning C4267 warns for narrowing type conversions from size_t
942         # to 32-bit integer types on 64-bit platforms.  Since this is virtually
943         # the same thing as C4244, we disable C4267, too.
944         # MSVC warning C4800 warns when a value is implicitly cast to bool,
945         # because this also forces narrowing to a single byte, which can be a
946         # perf hit.  But this matters so little in practice (and often we want
947         # that behavior) that it's better to turn it off.
948         # MSVC warning C4595 warns non-member operator new or delete functions
949         # may not be declared inline, as of VS2015 Update 2.
950         CFLAGS="$CFLAGS -wd4244 -wd4267"
951         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
952         if test -n "$CLANG_CL"; then
953             # XXX We should combine some of these with our generic GCC-style
954             # warning checks.
955             #
956             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
957             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
958             # We use offsetof on non-POD objects all the time.
959             # We also suppress this warning on other platforms.
960             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
961             # This warns for reasonable things like:
962             #   enum { X = 0xffffffffU };
963             # which is annoying for IDL headers.
964             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
965             # This warns for cases that would be reached by the Microsoft
966             # #include rules, but also currently warns on cases that would
967             # *also* be reached by standard C++ include rules.  That
968             # behavior doesn't seem useful, so we turn it off.
969             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
970             # We normally error out on unknown pragmas, but since clang-cl
971             # claims to be MSVC, it would be difficult to add
972             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
973             # use such pragmas, so just ignore them.
974             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
975             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
976             # We get errors about various #pragma intrinsic directives from
977             # clang-cl, and we don't need to hear about those.
978             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
979             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
980             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
981             # as __attribute((__deprecated__)).  This is nice to know,
982             # but since we don't get the equivalent warning from MSVC,
983             # let's just ignore it.
984             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
985             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
986             # We use a function like:
987             #   __declspec(noreturn) __inline void f() {}
988             # which -Winvalid-noreturn complains about.  Again, MSVC seems
989             # OK with it, so let's silence the warning.
990             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
991             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
992             # Missing |override| on virtual function declarations isn't
993             # something that MSVC currently warns about.
994             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
995             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
996             # declaration on |operator delete(void*)|.  However, clang-cl
997             # must internally declare |operator delete(void*)| differently,
998             # which causes this warning for virtually every file in the
999             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
1000             # so there doesn't seem to be any way to convince clang-cl to
1001             # declare |delete| differently.  Therefore, suppress this
1002             # warning.
1003             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1004             # At least one MSVC header and several headers in-tree have
1005             # unused typedefs, so turn this on.
1006             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1007             # jemalloc uses __declspec(allocator) as a profiler hint,
1008             # which clang-cl doesn't understand.
1009             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1010         fi
1011         # make 'foo == bar;' error out
1012         CFLAGS="$CFLAGS -we4553"
1013         CXXFLAGS="$CXXFLAGS -we4553"
1014         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
1015         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
1016         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1017         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1018         WARNINGS_AS_ERRORS='-WX'
1019         # Use a higher optimization level for clang-cl, so we can come closer
1020         # to MSVC's performance numbers (see bug 1443590).
1021         if test -n "$CLANG_CL"; then
1022             MOZ_OPTIMIZE_FLAGS='-O2'
1023         else
1024             MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1025         fi
1026         MOZ_FIX_LINK_PATHS=
1027         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1028         if test -z "$DEVELOPER_OPTIONS"; then
1029             LDFLAGS="$LDFLAGS -RELEASE"
1030         fi
1031         LDFLAGS="$LDFLAGS -DYNAMICBASE"
1032         RCFLAGS="-nologo"
1033         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1034         dnl both SSSE3 and SSE4.1.
1035         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1036         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1037         dnl allow AVX2 code from VS2015
1038         HAVE_X86_AVX2=1
1039     fi
1040     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1041     dnl See http://support.microsoft.com/kb/143208 to use STL
1042     AC_DEFINE(NOMINMAX)
1043     BIN_SUFFIX='.exe'
1044     MOZ_USER_DIR="Mozilla"
1046     case "$host_os" in
1047     cygwin*|msvc*|mks*)
1048         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.])
1049         ;;
1050     esac
1052     case "$target" in
1053     i*86-*)
1054         if test -n "$GNU_CC"; then
1055             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1056             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1057             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1058         else
1059             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1060             LDFLAGS="$LDFLAGS -SAFESEH"
1061         fi
1063         AC_DEFINE(_X86_)
1064         ;;
1065     x86_64-*)
1066         if test -n "$_WIN32_MSVC"; then
1067             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1068         fi
1069         AC_DEFINE(_AMD64_)
1070         ;;
1071     *)
1072         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1073         ;;
1074     esac
1075     ;;
1077 *-netbsd*)
1078     DSO_CFLAGS=''
1079     CFLAGS="$CFLAGS -Dunix"
1080     CXXFLAGS="$CXXFLAGS -Dunix"
1081     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1082         DSO_PIC_CFLAGS='-fPIC -DPIC'
1083         DSO_LDOPTS='-shared'
1084         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
1085     else
1086         DSO_PIC_CFLAGS='-fPIC -DPIC'
1087         DSO_LDOPTS='-shared'
1088     fi
1089     # This will fail on a.out systems prior to 1.5.1_ALPHA.
1090     if test "$LIBRUNPATH"; then
1091         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1092     fi
1093     MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1094     MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1095     ;;
1097 *-openbsd*)
1098     if test -z "$X11BASE"; then
1099         X11BASE=/usr/X11R6
1100     fi
1101     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1102     DSO_CFLAGS=''
1103     DSO_PIC_CFLAGS='-fPIC'
1104     DSO_LDOPTS='-shared -fPIC'
1105     if test "$LIBRUNPATH"; then
1106         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1107     fi
1108     ;;
1110 *-solaris*)
1111     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
1112     ;;
1114 esac
1116 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
1117     MOZ_OPTIMIZE_FLAGS="-O"
1120 AC_SUBST_LIST(MMX_FLAGS)
1121 AC_SUBST_LIST(SSE_FLAGS)
1122 AC_SUBST_LIST(SSE2_FLAGS)
1123 AC_SUBST_LIST(SSSE3_FLAGS)
1125 AC_SUBST(MOZ_LINKER)
1126 if test -n "$MOZ_LINKER"; then
1127   AC_DEFINE(MOZ_LINKER)
1128   MOZ_LINKER_EXTRACT=1
1129   AC_CHECK_PROGS(XZ, xz)
1132 if test -z "$COMPILE_ENVIRONMENT"; then
1133     SKIP_COMPILER_CHECKS=1
1134     SKIP_LIBRARY_CHECKS=1
1135     PKG_SKIP_STRIP=1
1136     MOZ_DEBUGGING_OPTS
1137 else
1138     MOZ_COMPILER_OPTS
1139 fi # COMPILE_ENVIRONMENT
1141 if test -z "$SKIP_COMPILER_CHECKS"; then
1142 dnl Checks for typedefs, structures, and compiler characteristics.
1143 dnl ========================================================
1144 AC_C_CONST
1145 AC_TYPE_MODE_T
1146 AC_TYPE_OFF_T
1147 AC_TYPE_PID_T
1148 AC_TYPE_SIZE_T
1149 AC_LANG_CPLUSPLUS
1150 AC_LANG_C
1152 AC_LANG_CPLUSPLUS
1154 MOZ_CXX11
1156 AC_LANG_C
1158 case "${OS_TARGET}" in
1159 Darwin)
1160   ;;
1162   STL_FLAGS="-I${DIST}/stl_wrappers"
1163   WRAP_STL_INCLUDES=1
1164   ;;
1165 esac
1167 dnl Checks for header files.
1168 dnl ========================================================
1169 AC_HEADER_DIRENT
1170 case "$target_os" in
1171 bitrig*|dragonfly*|freebsd*|openbsd*)
1172 # for stuff like -lXshm
1173     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1174     ;;
1175 esac
1177 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1178 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1179                    ac_cv_sockaddr_in_sin_len,
1180                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1181                                     #include <sys/types.h>
1182                                     #endif
1183                                     #include <netinet/in.h>
1184                                     struct sockaddr_in x;
1185                                     void *foo = (void*) &x.sin_len;],
1186                                    [],
1187                                    [ac_cv_sockaddr_in_sin_len=true],
1188                                    [ac_cv_sockaddr_in_sin_len=false])])
1189 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1190   AC_DEFINE(HAVE_SIN_LEN)
1191 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1192   AC_DEFINE(HAVE_SCONN_LEN)
1195 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1196                ac_cv_sockaddr_in6_sin6_len,
1197                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1198                                 #include <sys/types.h>
1199                                 #endif
1200                                 #include <netinet/in.h>
1201                                 struct sockaddr_in6 x;
1202                                 void *foo = (void*) &x.sin6_len;],
1203                                [],
1204                                [ac_cv_sockaddr_in6_sin6_len=true],
1205                                [ac_cv_sockaddr_in6_sin6_len=false])])
1206 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1207   AC_DEFINE(HAVE_SIN6_LEN)
1210 AC_CACHE_CHECK(for sockaddr.sa_len,
1211                ac_cv_sockaddr_sa_len,
1212                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1213                                 #include <sys/types.h>
1214                                 #endif
1215                                 #include <sys/socket.h>
1216                                 struct sockaddr x;
1217                                 void *foo = (void*) &x.sa_len;],
1218                                [],
1219                                [ac_cv_sockaddr_sa_len=true],
1220                                [ac_cv_sockaddr_sa_len=false])])
1221 if test "$ac_cv_sockaddr_sa_len" = true ; then
1222   AC_DEFINE(HAVE_SA_LEN)
1225 MOZ_ARG_ENABLE_BOOL(dtrace,
1226               [  --enable-dtrace         build with dtrace support if available (default=no)],
1227               [enable_dtrace="yes"],)
1228 if test "x$enable_dtrace" = "xyes"; then
1229   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1230   if test -n "$HAVE_DTRACE"; then
1231       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1232   else
1233       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1234   fi
1236 AC_SUBST(HAVE_DTRACE)
1238 dnl Checks for libraries.
1239 dnl ========================================================
1240 AC_CHECK_LIB(c_r, gethostbyname_r)
1242 dnl We don't want to link with libdl even if it's present on OS X, since
1243 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1244 dnl in libc.
1245 dnl We don't want to link against libm or libpthread on Darwin since
1246 dnl they both are just symlinks to libSystem and explicitly linking
1247 dnl against libSystem causes issues when debugging (see bug 299601).
1248 case $target in
1249 *-darwin*)
1250     ;;
1252     AC_SEARCH_LIBS(dlopen, dl,
1253         MOZ_CHECK_HEADER(dlfcn.h,
1254         AC_DEFINE(HAVE_DLOPEN)))
1255     ;;
1256 esac
1258 _SAVE_CFLAGS="$CFLAGS"
1259 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1260 AC_CHECK_FUNCS(dladdr memmem)
1261 CFLAGS="$_SAVE_CFLAGS"
1263 if test ! "$GNU_CXX"; then
1264     AC_CHECK_LIB(C, demangle)
1267 AC_CHECK_LIB(socket, socket)
1269 XLDFLAGS="$X_LIBS"
1270 XLIBS="$X_EXTRA_LIBS"
1272 dnl ========================================================
1273 dnl Checks for X libraries.
1274 dnl Ordering is important.
1275 dnl Xt is dependent upon SM as of X11R6
1276 dnl ========================================================
1277 if test -n "$MOZ_X11"; then
1278     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1279     _SAVE_LDFLAGS="$LDFLAGS"
1280     _SAVE_LIBS="$LIBS"
1281     LDFLAGS="$XLDFLAGS $LDFLAGS"
1282     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1283         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1284     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1285         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1287     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1288         unset ac_cv_lib_Xt_XtFree
1289         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1290         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1291         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1292             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1293         ])
1295     dnl ========================================================
1296     dnl = Check for xcb
1297     dnl ========================================================
1298     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1299         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1300     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1301         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1302     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1303         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1305     LDFLAGS="$_SAVE_LDFLAGS"
1306     LIBS="$_SAVE_LIBS"
1307 fi # $MOZ_X11
1309 AC_SUBST_LIST(XCFLAGS)
1310 AC_SUBST_LIST(XLDFLAGS)
1311 AC_SUBST_LIST(XLIBS)
1312 AC_SUBST_LIST(XEXT_LIBS)
1313 AC_SUBST_LIST(XT_LIBS)
1315 dnl ========================================================
1316 dnl = pthread support
1317 dnl = Start by checking whether the system support pthreads
1318 dnl ========================================================
1319 case "$target_os" in
1320 darwin*)
1321     MOZ_USE_PTHREADS=1
1322     ;;
1324     AC_CHECK_LIB(pthreads, pthread_create,
1325         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1326         AC_CHECK_LIB(pthread, pthread_create,
1327             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1328             AC_CHECK_LIB(c_r, pthread_create,
1329                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1330                 AC_CHECK_LIB(c, pthread_create,
1331                     MOZ_USE_PTHREADS=1
1332                 )
1333             )
1334         )
1335     )
1336     ;;
1337 esac
1339 dnl ========================================================
1340 dnl Check the command line for --with-pthreads
1341 dnl ========================================================
1342 MOZ_ARG_WITH_BOOL(pthreads,
1343 [  --with-pthreads         Force use of system pthread library with NSPR ],
1344 [ if test "$MOZ_USE_PTHREADS"x = x; then
1345     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
1346 fi],
1347     MOZ_USE_PTHREADS=
1348     _PTHREAD_LDFLAGS=
1351 dnl ========================================================
1352 dnl Do the platform specific pthread hackery
1353 dnl ========================================================
1354 if test "$MOZ_USE_PTHREADS"x != x
1355 then
1356     dnl
1357     dnl See if -pthread is supported.
1358     dnl
1359     rm -f conftest*
1360     ac_cv_have_dash_pthread=no
1361     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1362     echo 'int main() { return 0; }' | cat > conftest.c
1363     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1364     if test $? -eq 0; then
1365         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1366             ac_cv_have_dash_pthread=yes
1367             case "$target_os" in
1368             freebsd*)
1369 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1370                 ;;
1371             *)
1372                 CFLAGS="$CFLAGS -pthread"
1373                 CXXFLAGS="$CXXFLAGS -pthread"
1374                 ;;
1375             esac
1376         fi
1377     fi
1378     rm -f conftest*
1379     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1381     dnl
1382     dnl See if -pthreads is supported.
1383     dnl
1384     ac_cv_have_dash_pthreads=no
1385     if test "$ac_cv_have_dash_pthread" = "no"; then
1386         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1387         echo 'int main() { return 0; }' | cat > conftest.c
1388         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1389         if test $? -eq 0; then
1390             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1391                 ac_cv_have_dash_pthreads=yes
1392                 CFLAGS="$CFLAGS -pthreads"
1393                 CXXFLAGS="$CXXFLAGS -pthreads"
1394             fi
1395         fi
1396         rm -f conftest*
1397         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1398     fi
1400     case "$target" in
1401         *-*-freebsd*)
1402             AC_DEFINE(_REENTRANT)
1403             AC_DEFINE(_THREAD_SAFE)
1404             dnl -pthread links in -lpthread, so don't specify it explicitly.
1405             if test "$ac_cv_have_dash_pthread" = "yes"; then
1406                 _PTHREAD_LDFLAGS="-pthread"
1407             fi
1408             ;;
1410         *-*-openbsd*|*-*-bsdi*)
1411             AC_DEFINE(_REENTRANT)
1412             AC_DEFINE(_THREAD_SAFE)
1413             dnl -pthread links in -lc_r, so don't specify it explicitly.
1414             if test "$ac_cv_have_dash_pthread" = "yes"; then
1415                 _PTHREAD_LDFLAGS="-pthread"
1416             fi
1417             ;;
1419         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1420             AC_DEFINE(_REENTRANT)
1421             ;;
1423     esac
1424     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1425     AC_SUBST(MOZ_USE_PTHREADS)
1426     MOZ_CHECK_HEADERS(pthread.h)
1430 dnl Checks for library functions.
1431 dnl ========================================================
1432 AC_PROG_GCC_TRADITIONAL
1433 AC_FUNC_MEMCMP
1434 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1436 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1437 dnl avoid this on Darwin, since depending on your system config, we may think
1438 dnl it exists but it really doesn't
1439 case "$OS_TARGET" in
1440 Darwin)
1441   ;;
1443   AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1444                  ac_cv_clock_monotonic,
1445                  [for libs in "" -lrt; do
1446                       _SAVE_LIBS="$LIBS"
1447                       LIBS="$LIBS $libs"
1448                       AC_TRY_LINK([#include <time.h>],
1449                                    [ struct timespec ts;
1450                                      clock_gettime(CLOCK_MONOTONIC, &ts); ],
1451                                    ac_cv_clock_monotonic=$libs
1452                                    LIBS="$_SAVE_LIBS"
1453                                    break,
1454                                    ac_cv_clock_monotonic=no)
1455                       LIBS="$_SAVE_LIBS"
1456                   done])
1457   if test "$ac_cv_clock_monotonic" != "no"; then
1458       HAVE_CLOCK_MONOTONIC=1
1459       REALTIME_LIBS=$ac_cv_clock_monotonic
1460       AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1461       AC_SUBST(HAVE_CLOCK_MONOTONIC)
1462       AC_SUBST_LIST(REALTIME_LIBS)
1463   fi
1464   ;;
1465 esac
1467 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1468                ac_cv_pthread_cond_timedwait_monotonic_np,
1469                AC_TRY_LINK([#include <pthread.h>],
1470                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1471                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1472                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1473 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1474     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1477 AC_CACHE_CHECK(
1478     [for res_ninit()],
1479     ac_cv_func_res_ninit,
1480     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1481         dnl no need for res_ninit() on NetBSD and OpenBSD
1482         ac_cv_func_res_ninit=no
1483      else
1484         AC_TRY_LINK([
1485             #ifdef linux
1486             #define _BSD_SOURCE 1
1487             #endif
1488             #include <sys/types.h>
1489             #include <netinet/in.h>
1490             #include <arpa/nameser.h>
1491             #include <resolv.h>
1492             ],
1493             [int foo = res_ninit(&_res);],
1494             [ac_cv_func_res_ninit=yes],
1495             [ac_cv_func_res_ninit=no])
1496      fi
1497     ])
1499 if test "$ac_cv_func_res_ninit" = "yes"; then
1500     AC_DEFINE(HAVE_RES_NINIT)
1501 dnl must add the link line we do something as foolish as this... dougt
1502 dnl else
1503 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1504 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1507 AC_LANG_C
1509 dnl **********************
1510 dnl *** va_copy checks ***
1511 AC_CACHE_CHECK([for an implementation of va_copy()],
1512                ac_cv_va_copy,
1513     [AC_TRY_COMPILE([#include <stdarg.h>
1514                      #include <stdlib.h>
1515         void f (int i, ...) {
1516             va_list args1, args2;
1517             va_start (args1, i);
1518             va_copy (args2, args1);
1519             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1520                 exit (1);
1521             va_end (args1); va_end (args2);
1522         }],
1523         [f(0, 42); return 0],
1524         [ac_cv_va_copy=yes],
1525         [ac_cv_va_copy=no]
1526     )]
1528 AC_CACHE_CHECK([whether va_list can be copied by value],
1529                ac_cv_va_val_copy,
1530     [AC_TRY_COMPILE([#include <stdarg.h>
1531                      #include <stdlib.h>
1532         void f (int i, ...) {
1533             va_list args1, args2;
1534             va_start (args1, i);
1535             args2 = args1;
1536             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1537                 exit (1);
1538             va_end (args1); va_end (args2);
1539         }],
1540         [f(0, 42); return 0],
1541         [ac_cv_va_val_copy=yes],
1542         [ac_cv_va_val_copy=no],
1543     )]
1545 if test "x$ac_cv_va_copy" = "xyes"; then
1546     AC_DEFINE(VA_COPY, va_copy)
1547     AC_DEFINE(HAVE_VA_COPY)
1550 if test "x$ac_cv_va_val_copy" = "xno"; then
1551    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1554 dnl ===================================================================
1555 dnl ========================================================
1556 dnl Put your C++ language/feature checks below
1557 dnl ========================================================
1558 AC_LANG_CPLUSPLUS
1560 ARM_ABI_PREFIX=
1561 if test "$GNU_CC"; then
1562   if test "$CPU_ARCH" = "arm" ; then
1563     AC_CACHE_CHECK(for ARM EABI,
1564         ac_cv_gcc_arm_eabi,
1565         [AC_TRY_COMPILE([],
1566                         [
1567 #if defined(__ARM_EABI__)
1568   return 0;
1569 #else
1570 #error Not ARM EABI.
1571 #endif
1572                         ],
1573                         ac_cv_gcc_arm_eabi="yes",
1574                         ac_cv_gcc_arm_eabi="no")])
1575     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1576         HAVE_ARM_EABI=1
1577         ARM_ABI_PREFIX=eabi-
1578     else
1579         ARM_ABI_PREFIX=oabi-
1580     fi
1581   fi
1583   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1586 dnl See if a dynamic_cast to void* gives the most derived object.
1587 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1588                ac_cv_cpp_dynamic_cast_void_ptr,
1589                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1590                             class Y { int j; public: virtual ~Y() { } };
1591                             class Z : public X, public Y { int k; };
1593                             int main() {
1594                                  Z mdo;
1595                                  X *subx = (X*)&mdo;
1596                                  Y *suby = (Y*)&mdo;
1597                                  return !((((void*)&mdo != (void*)subx) &&
1598                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1599                                           (((void*)&mdo != (void*)suby) &&
1600                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
1601                             }],
1602                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
1603                            ac_cv_cpp_dynamic_cast_void_ptr=no,
1604                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
1605 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1606    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1610 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1611 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1612 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1613 # linking XUL.
1614 _SAVE_LDFLAGS=$LDFLAGS
1615 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1616 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1617                ac_cv_thread_keyword,
1618                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1619                             [return tlsIsMainThread;],
1620                             ac_cv_thread_keyword=yes,
1621                             ac_cv_thread_keyword=no)])
1622 LDFLAGS=$_SAVE_LDFLAGS
1623 # The custom dynamic linker doesn't support TLS variables
1624 MOZ_TLS=
1625 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1626   # mips builds fail with TLS variables because of a binutils bug.
1627   # See bug 528687
1628   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1629   case "${target}" in
1630     mips*-*)
1631       :
1632       ;;
1633     *-android*|*-linuxandroid*)
1634       :
1635       ;;
1636     *-openbsd*)
1637       :
1638       ;;
1639     *)
1640       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1641       MOZ_TLS=1
1642       ;;
1643   esac
1646 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1647 if test -n "$MOZ_LINKER"; then
1648   if test "$CPU_ARCH" = arm; then
1649     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1650     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1651       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1652       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1653     fi
1654   fi
1656 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1657 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1658 dnl Since the linker only understands the sysv ones, no need to build the
1659 dnl gnu style tables anyways.
1660   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1663 dnl End of C++ language/feature checks
1664 AC_LANG_C
1666 dnl ========================================================
1667 dnl =  Internationalization checks
1668 dnl ========================================================
1670 dnl Internationalization and Locale support is different
1671 dnl on various UNIX platforms.  Checks for specific i18n
1672 dnl features go here.
1674 AC_HAVE_FUNCS(localeconv)
1676 fi # ! SKIP_COMPILER_CHECKS
1678 if test -n "${COMPILE_ENVIRONMENT}"; then
1679   MOZ_CHECK_ALLOCATOR
1682 TARGET_XPCOM_ABI=
1683 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1684     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1685     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1688 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1689 dnl features that Windows actually does support.
1691 if test -n "$SKIP_COMPILER_CHECKS"; then
1692    dnl Windows has malloc.h
1693    AC_DEFINE(MALLOC_H, [<malloc.h>])
1694    AC_DEFINE(HAVE_FORCEINLINE)
1695    AC_DEFINE(HAVE_LOCALECONV)
1696 fi # SKIP_COMPILER_CHECKS
1698 dnl Mozilla specific options
1699 dnl ========================================================
1700 dnl The macros used for command line options
1701 dnl are defined in build/autoconf/altoptions.m4.
1703 dnl ========================================================
1704 dnl =
1705 dnl = Check for external package dependencies
1706 dnl =
1707 dnl ========================================================
1708 MOZ_ARG_HEADER(External Packages)
1710 case "$OS_TARGET" in
1711 WINNT|Darwin|Android)
1712   MOZ_FOLD_LIBS=1
1713   ;;
1715   MOZ_FOLD_LIBS=
1716   ;;
1717 esac
1719 MOZ_CONFIG_NSPR()
1721 dnl ========================================================
1722 dnl system libevent Support
1723 dnl ========================================================
1724 MOZ_ARG_WITH_STRING(system-libevent,
1725 [  --with-system-libevent[=PFX]
1726                           Use system libevent [installed at prefix PFX]],
1727     LIBEVENT_DIR=$withval)
1729 _SAVE_CFLAGS=$CFLAGS
1730 _SAVE_LDFLAGS=$LDFLAGS
1731 _SAVE_LIBS=$LIBS
1732 if test "$LIBEVENT_DIR" = yes; then
1733     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1734         MOZ_SYSTEM_LIBEVENT=1,
1735         LIBEVENT_DIR=/usr)
1737 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1738     MOZ_SYSTEM_LIBEVENT=
1739 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1740     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1741     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1742     MOZ_CHECK_HEADER(event.h,
1743         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1744              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1745          fi],
1746         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1747     AC_CHECK_LIB(event, event_init,
1748                  [MOZ_SYSTEM_LIBEVENT=1
1749                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1750                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1751                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1753 CFLAGS=$_SAVE_CFLAGS
1754 LDFLAGS=$_SAVE_LDFLAGS
1755 LIBS=$_SAVE_LIBS
1757 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1759 dnl ========================================================
1760 dnl = If NSS was not detected in the system,
1761 dnl = use the one in the source tree (mozilla/security/nss)
1762 dnl ========================================================
1764 MOZ_ARG_WITH_BOOL(system-nss,
1765 [  --with-system-nss       Use system installed NSS],
1766     _USE_SYSTEM_NSS=1 )
1768 if test -n "$_USE_SYSTEM_NSS"; then
1769     AM_PATH_NSS(3.36, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1772 if test -z "$MOZ_SYSTEM_NSS"; then
1773    NSS_CFLAGS="-I${DIST}/include/nss"
1774    case "${OS_ARCH}" in
1775         # Only few platforms have been tested with GYP
1776         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1777             ;;
1778         *)
1779             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1780             ;;
1781    esac
1784 if test -z "$SKIP_LIBRARY_CHECKS"; then
1785 dnl system JPEG support
1786 dnl ========================================================
1787 MOZ_ARG_WITH_STRING(system-jpeg,
1788 [  --with-system-jpeg[=PFX]
1789                           Use system libjpeg [installed at prefix PFX]],
1790     JPEG_DIR=$withval)
1792 _SAVE_CFLAGS=$CFLAGS
1793 _SAVE_LDFLAGS=$LDFLAGS
1794 _SAVE_LIBS=$LIBS
1795 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1796     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1797     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1799 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1800     MOZ_SYSTEM_JPEG=
1801 else
1802     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1805 if test "$MOZ_SYSTEM_JPEG" = 1; then
1806     AC_TRY_COMPILE([ #include <stdio.h>
1807                      #include <sys/types.h>
1808                      #include <jpeglib.h> ],
1809                    [ #if JPEG_LIB_VERSION < $MOZJPEG
1810                      #error "Insufficient JPEG library version ($MOZJPEG required)."
1811                      #endif
1812                      #ifndef JCS_EXTENSIONS
1813                      #error "libjpeg-turbo JCS_EXTENSIONS required"
1814                      #endif
1815                      ],
1816                    MOZ_SYSTEM_JPEG=1,
1817                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1819 CFLAGS=$_SAVE_CFLAGS
1820 LDFLAGS=$_SAVE_LDFLAGS
1821 LIBS=$_SAVE_LIBS
1823 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1824     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1825     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1827 fi # SKIP_LIBRARY_CHECKS
1829 dnl system ZLIB support
1830 dnl ========================================================
1831 MOZ_ZLIB_CHECK([1.2.3])
1833 if test -z "$SKIP_LIBRARY_CHECKS"; then
1834 dnl system BZIP2 Support
1835 dnl ========================================================
1836 MOZ_ARG_WITH_STRING(system-bz2,
1837 [  --with-system-bz2[=PFX]
1838                           Use system libbz2 [installed at prefix PFX]],
1839     BZ2_DIR=$withval)
1841 _SAVE_CFLAGS=$CFLAGS
1842 _SAVE_LDFLAGS=$LDFLAGS
1843 _SAVE_LIBS=$LIBS
1844 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
1845     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
1846     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
1848 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
1849     MOZ_SYSTEM_BZ2=
1850 else
1851     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
1852     [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
1854 CFLAGS=$_SAVE_CFLAGS
1855 LDFLAGS=$_SAVE_LDFLAGS
1856 LIBS=$_SAVE_LIBS
1858 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
1859     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
1860     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
1863 dnl ========================================================
1864 dnl system PNG Support
1865 dnl ========================================================
1866 MOZ_ARG_WITH_STRING(system-png,
1867 [  --with-system-png[=PFX]
1868                           Use system libpng [installed at prefix PFX]],
1869     PNG_DIR=$withval)
1871 _SAVE_CFLAGS=$CFLAGS
1872 _SAVE_LDFLAGS=$LDFLAGS
1873 _SAVE_LIBS=$LIBS
1874 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1875     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1876     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1878 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1879     MOZ_SYSTEM_PNG=
1880 else
1881     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1882                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1883     AC_CHECK_LIB(png, png_get_acTL, ,
1884                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1886 if test "$MOZ_SYSTEM_PNG" = 1; then
1887     AC_TRY_COMPILE([ #include <stdio.h>
1888                      #include <sys/types.h>
1889                      #include <png.h> ],
1890                    [ #if PNG_LIBPNG_VER < $MOZPNG
1891                      #error "Insufficient libpng version ($MOZPNG required)."
1892                      #endif
1893                      #ifndef PNG_UINT_31_MAX
1894                      #error "Insufficient libpng version."
1895                      #endif ],
1896                    MOZ_SYSTEM_PNG=1,
1897                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1899 CFLAGS=$_SAVE_CFLAGS
1900 LDFLAGS=$_SAVE_LDFLAGS
1901 LIBS=$_SAVE_LIBS
1903 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1904     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1905     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1908 fi # SKIP_LIBRARY_CHECKS
1910 dnl ========================================================
1911 dnl =
1912 dnl = Application
1913 dnl =
1914 dnl ========================================================
1916 MOZ_ARG_HEADER(Application)
1918 ENABLE_SYSTEM_EXTENSION_DIRS=1
1919 MOZ_BRANDING_DIRECTORY=
1920 MOZ_OFFICIAL_BRANDING=
1921 MOZ_FEEDS=1
1922 MOZ_AUTH_EXTENSION=1
1923 if test "$MOZ_IOS"; then
1924    MOZ_AUTH_EXTENSION=
1926 MOZ_RAW=
1927 MOZ_VORBIS=
1928 MOZ_TREMOR=
1929 MOZ_SAMPLE_TYPE_FLOAT32=
1930 MOZ_SAMPLE_TYPE_S16=
1931 MOZ_SRTP=
1932 MOZ_WEBRTC_HARDWARE_AEC_NS=
1933 MOZ_SCTP=
1934 VPX_USE_YASM=
1935 VPX_ASFLAGS=
1936 VPX_AS_CONVERSION=
1937 VPX_X86_ASM=
1938 VPX_ARM_ASM=
1939 LIBJPEG_TURBO_AS=
1940 LIBJPEG_TURBO_ASFLAGS=
1941 MOZ_PREF_EXTENSIONS=1
1942 MOZ_REFLOW_PERF=
1943 MOZ_SPELLCHECK=1
1944 MOZ_TOOLKIT_SEARCH=1
1945 MOZ_UNIVERSALCHARDET=1
1946 MOZ_XUL=1
1947 MOZ_ZIPWRITER=1
1948 MOZ_NO_SMART_CARDS=
1949 NECKO_COOKIES=1
1950 MOZ_USE_NATIVE_POPUP_WINDOWS=
1951 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1952 ACCESSIBILITY=1
1953 MOZ_CONTENT_SANDBOX=
1954 MOZ_GMP_SANDBOX=
1955 MOZ_SANDBOX=1
1956 MOZ_BINARY_EXTENSIONS=
1957 MOZ_DEVTOOLS=server
1959 case "$target_os" in
1960     mingw*)
1961         NS_ENABLE_TSF=1
1962         AC_DEFINE(NS_ENABLE_TSF)
1963         ;;
1964 esac
1966 case "${target}" in
1967     *-android*|*-linuxandroid*)
1968         MOZ_RAW=1
1969         ;;
1971 esac
1973 # Optional Firefox for Android partner distribution directory.
1974 MOZ_ARG_WITH_STRING(android-distribution-directory,
1975 [  --with-android-distribution-directory=dir
1976                           Optional Firefox for Android partner distribution directory.],
1977   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1979 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1980   # A distribution directory must have an assets/distribution directory.
1981   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1982   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1983     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1984                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1985   fi
1987 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1989 dnl ========================================================
1990 dnl = Trademarked Branding
1991 dnl ========================================================
1992 MOZ_ARG_ENABLE_BOOL(official-branding,
1993 [  --enable-official-branding
1994                           Enable Official mozilla.org Branding
1995                           Do not distribute builds with
1996                           --enable-official-branding unless you have
1997                           permission to use trademarks per
1998                           http://www.mozilla.org/foundation/trademarks/ .],
1999     MOZ_OFFICIAL_BRANDING=1,
2000     MOZ_OFFICIAL_BRANDING=)
2002 # Allow the application to influence configure with a confvars.sh script.
2003 AC_MSG_CHECKING([if app-specific confvars.sh exists])
2004 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
2005   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
2006   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2007 else
2008   AC_MSG_RESULT([no])
2011 # Allow influencing configure with a defines.sh script.
2012 . "${srcdir}/build/defines.sh"
2014 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2015 # set in defines.sh
2016 if test "$BUILDING_RELEASE"; then
2017   # Override value in defines.sh, if any
2018   EARLY_BETA_OR_EARLIER=
2019 elif test "$EARLY_BETA_OR_EARLIER"; then
2020   AC_DEFINE(EARLY_BETA_OR_EARLIER)
2022 AC_SUBST(EARLY_BETA_OR_EARLIER)
2024 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2025 MOZ_ARG_WITH_STRING(app-name,
2026 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2027 WITH_APP_NAME=$withval,
2030 if test -n "$WITH_APP_NAME" ; then
2031     MOZ_APP_NAME="$WITH_APP_NAME"
2034 MOZ_ARG_WITH_STRING(app-basename,
2035 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2036 WITH_APP_BASENAME=$withval,
2039 if test -n "$WITH_APP_BASENAME" ; then
2040     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2043 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2044 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2045 # MOZ_BUILD_APP.
2046 case "$MOZ_BUILD_APP" in
2047 browser)
2048   AC_DEFINE(MOZ_PHOENIX)
2049   ;;
2051 xulrunner)
2052   AC_DEFINE(MOZ_XULRUNNER)
2053   ;;
2054 esac
2056 # Graphene is a desktop runtime for running applications with a HTML UI.
2057 if test -n "$MOZ_GRAPHENE"; then
2058     AC_DEFINE(MOZ_GRAPHENE)
2061 if test -n "$MOZ_MULET"; then
2062     AC_DEFINE(MOZ_MULET)
2065 AC_SUBST(MOZ_PHOENIX)
2066 AC_SUBST(MOZ_XULRUNNER)
2067 AC_SUBST(MOZ_MULET)
2069 dnl ========================================================
2070 dnl Ensure Android SDK and build-tools versions depending on
2071 dnl mobile target.
2072 dnl ========================================================
2074 case "$MOZ_BUILD_APP" in
2075 mobile/android)
2076     MOZ_ANDROID_SDK(23, 23, 26.0.2, 26.0.0 26.0.0-dev 25.3.2 25.3.1)
2077     ;;
2078 esac
2080 dnl ========================================================
2081 dnl =
2082 dnl = Toolkit Options
2083 dnl =
2084 dnl ========================================================
2085 MOZ_ARG_HEADER(Toolkit Options)
2087 dnl ========================================================
2088 dnl = Enable the toolkit as needed                         =
2089 dnl ========================================================
2091 case "$MOZ_WIDGET_TOOLKIT" in
2093 cocoa)
2094     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2095     # Use -Wl as a trick to avoid -framework and framework names from
2096     # being separated by AC_SUBST_LIST.
2097     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'
2098     TK_CFLAGS=""
2099     CFLAGS="$CFLAGS $TK_CFLAGS"
2100     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2101     MOZ_USER_DIR="Mozilla"
2102     MOZ_FS_LAYOUT=bundle
2103     ;;
2105 uikit)
2106     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2107     TK_CFLAGS=""
2108     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'
2109     CFLAGS="$CFLAGS $TK_CFLAGS"
2110     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2111     MOZ_USER_DIR="Mozilla"
2112     MOZ_FS_LAYOUT=bundle
2113     ;;
2115 esac
2117 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2118 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2119 case "$MOZ_WIDGET_TOOLKIT" in
2120 gtk*)
2121     MOZ_ENABLE_GTK=1
2122     ;;
2123 esac
2125 if test "$COMPILE_ENVIRONMENT"; then
2126   if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2127     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
2128     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2129     TK_CFLAGS=$MOZ_GTK3_CFLAGS
2130     TK_LIBS=$MOZ_GTK3_LIBS
2131     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2132     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2133     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2134     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2135   fi
2136   if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2137     GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2138   fi
2139   if test "$MOZ_ENABLE_GTK"; then
2140     if test "$MOZ_X11"; then
2141       GDK_PACKAGES=gdk-x11-2.0
2142     fi
2143     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2144     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2146     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
2147     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2148   fi
2149   if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2150     TK_CFLAGS=$MOZ_GTK2_CFLAGS
2151     TK_LIBS=$MOZ_GTK2_LIBS
2152   fi
2153 fi # COMPILE_ENVIRONMENT
2155 AC_SUBST(MOZ_FS_LAYOUT)
2157 dnl ========================================================
2158 dnl = startup-notification support module
2159 dnl ========================================================
2161 if test "$MOZ_ENABLE_GTK"
2162 then
2163     MOZ_ENABLE_STARTUP_NOTIFICATION=
2165     MOZ_ARG_ENABLE_BOOL(startup-notification,
2166     [  --enable-startup-notification
2167                           Enable startup-notification support (default: disabled) ],
2168         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2169         MOZ_ENABLE_STARTUP_NOTIFICATION=)
2170     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2171     then
2172         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2173                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2174         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2175             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2176             then
2177                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2178             fi
2179             MOZ_ENABLE_STARTUP_NOTIFICATION=
2180         ])
2181     fi
2183     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2184         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2185     fi
2187     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2189 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2191 AC_SUBST_LIST(TK_CFLAGS)
2192 AC_SUBST_LIST(TK_LIBS)
2194 AC_SUBST(MOC)
2195 AC_SUBST(RCC)
2197 dnl ========================================================
2198 dnl =
2199 dnl = Components & Features
2200 dnl =
2201 dnl ========================================================
2202 MOZ_ARG_HEADER(Components and Features)
2204 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2205 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2206   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2207     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2208   else
2209     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2210     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2211   fi
2214 MOZ_ARG_WITH_STRING(branding,
2215 [  --with-branding=dir     Use branding from the specified directory.],
2216     MOZ_BRANDING_DIRECTORY=$withval)
2218 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2219 if test -z "$REAL_BRANDING_DIRECTORY"; then
2220   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2223 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2224   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2225 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2226   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2229 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2231 dnl ========================================================
2232 dnl = Distribution ID
2233 dnl ========================================================
2234 MOZ_ARG_WITH_STRING(distribution-id,
2235 [  --with-distribution-id=ID
2236                           Set distribution-specific id (default=org.mozilla)],
2237 [ val=`echo $withval`
2238     MOZ_DISTRIBUTION_ID="$val"])
2240 if test -z "$MOZ_DISTRIBUTION_ID"; then
2241    MOZ_DISTRIBUTION_ID="org.mozilla"
2244 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2245 AC_SUBST(MOZ_DISTRIBUTION_ID)
2247 dnl ========================================================
2248 dnl = GConf support module
2249 dnl ========================================================
2251 if test "$MOZ_X11"
2252 then
2253     if test "$MOZ_ENABLE_GTK"
2254     then
2255         MOZ_ENABLE_GCONF=1
2256     fi
2258     dnl ========================================================
2259     dnl = GConf support module
2260     dnl ========================================================
2261     MOZ_ARG_DISABLE_BOOL(gconf,
2262     [  --disable-gconf      Disable Gconf support ],
2263         MOZ_ENABLE_GCONF=,
2264         MOZ_ENABLE_GCONF=1)
2266     if test "$MOZ_ENABLE_GCONF"
2267     then
2268         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2269             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2270             MOZ_ENABLE_GCONF=1
2271         ],[
2272             if test -n "$MOZ_ENABLE_GCONF";
2273             then
2274                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2275             else
2276                 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2277             fi
2278         ])
2279     fi
2281     if test "$MOZ_ENABLE_GCONF"; then
2282         AC_DEFINE(MOZ_ENABLE_GCONF)
2283     fi
2285     AC_SUBST(MOZ_ENABLE_GCONF)
2288 dnl ========================================================
2289 dnl = libproxy support
2290 dnl ========================================================
2292 if test "$MOZ_ENABLE_GTK"
2293 then
2294     MOZ_ENABLE_LIBPROXY=
2296     MOZ_ARG_ENABLE_BOOL(libproxy,
2297     [  --enable-libproxy         Enable libproxy support ],
2298     MOZ_ENABLE_LIBPROXY=1,
2299     MOZ_ENABLE_LIBPROXY=)
2301     if test "$MOZ_ENABLE_LIBPROXY"
2302     then
2303         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2304         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2305     fi
2307 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2309 dnl ========================================================
2310 dnl = dbus support
2311 dnl ========================================================
2313 if test "$MOZ_ENABLE_GTK"
2314 then
2315     MOZ_ENABLE_DBUS=1
2317     MOZ_ARG_DISABLE_BOOL(dbus,
2318     [  --disable-dbus          Disable dbus support ],
2319         MOZ_ENABLE_DBUS=,
2320         MOZ_ENABLE_DBUS=1)
2322     if test "$MOZ_ENABLE_DBUS"
2323     then
2324         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2325         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2326         AC_DEFINE(MOZ_ENABLE_DBUS)
2327     fi
2329 AC_SUBST(MOZ_ENABLE_DBUS)
2331 dnl =========================================================
2332 dnl = Whether to exclude hyphenations files in the build
2333 dnl =========================================================
2334 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2335     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2338 dnl ========================================================
2339 dnl accessibility support on by default on all platforms
2340 dnl ========================================================
2341 MOZ_ARG_DISABLE_BOOL(accessibility,
2342 [  --disable-accessibility Disable accessibility support],
2343     ACCESSIBILITY=,
2344     ACCESSIBILITY=1 )
2345 if test "$ACCESSIBILITY"; then
2346     case "$target" in
2347     *-mingw*)
2348         if test -z "$MIDL"; then
2349             if test "$GCC" != "yes"; then
2350                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2351             else
2352                 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
2353             fi
2354         fi
2355     esac
2356     AC_DEFINE(ACCESSIBILITY)
2359 dnl ========================================================
2360 dnl Accessibility is required for the linuxgl widget
2361 dnl backend
2362 dnl ========================================================
2363 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2364     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2367 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2368                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2369                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2371 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2373 if test -n "$MOZ_WEBRTC"; then
2374     MOZ_RAW=1
2375     MOZ_SCTP=1
2376     MOZ_SRTP=1
2377     AC_DEFINE(MOZ_SCTP)
2378     AC_DEFINE(MOZ_SRTP)
2379     if test -n "$MOZ_X11"; then
2380       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2381     fi
2384 dnl ========================================================
2385 dnl = Force hardware AEC, disable webrtc.org AEC
2386 dnl ========================================================
2387 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2388 [  --enable-hardware-aec-ns   Enable support for hardware AEC and noise suppression],
2389     MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2390     MOZ_WEBRTC_HARDWARE_AEC_NS=)
2392 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2393     AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2396 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2397 AC_SUBST(MOZ_SCTP)
2398 AC_SUBST(MOZ_SRTP)
2399 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2401 dnl Use integers over floats for audio on B2G and Android
2402 dnl (regarless of the CPU architecture, because audio
2403 dnl backends for those platforms don't support floats. We also
2404 dnl use integers on ARM with other OS, because it's more efficient.
2405 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
2406     MOZ_SAMPLE_TYPE_S16=1
2407     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
2408     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
2409 else
2410     MOZ_SAMPLE_TYPE_FLOAT32=1
2411     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
2412     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
2415 dnl ========================================================
2416 dnl = Enable Raw Codecs
2417 dnl ========================================================
2418 MOZ_ARG_ENABLE_BOOL(raw,
2419 [  --enable-raw           Enable support for RAW media],
2420     MOZ_RAW=1,
2421     MOZ_RAW=)
2423 if test -n "$MOZ_RAW"; then
2424     AC_DEFINE(MOZ_RAW)
2427 AC_SUBST(MOZ_RAW)
2429 dnl ========================================================
2430 dnl = Apple platform decoder support
2431 dnl ========================================================
2432 if test "$COMPILE_ENVIRONMENT"; then
2433 if test -n "$MOZ_APPLEMEDIA"; then
2434   # hack in frameworks for fmp4 - see bug 1029974
2435   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2436   LDFLAGS="$LDFLAGS -framework AudioToolbox"
2437   dnl Verify CoreMedia is available.
2438   AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2439     [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
2441 fi # COMPILE_ENVIRONMENT
2443 dnl system libvpx Support
2444 dnl ========================================================
2445 MOZ_ARG_WITH_BOOL(system-libvpx,
2446 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
2447     MOZ_SYSTEM_LIBVPX=1)
2449 MOZ_LIBVPX_CFLAGS=
2450 MOZ_LIBVPX_LIBS=
2452 _SAVE_CFLAGS=$CFLAGS
2453 _SAVE_LIBS=$LIBS
2454 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2455     dnl ============================
2456     dnl === libvpx Version check ===
2457     dnl ============================
2458     dnl Check to see if we have a system libvpx package.
2459     PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2461     CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2462     LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2464     MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2465      [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
2467     AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2468      [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2470     MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2471      [AC_CHECK_FUNC(vpx_mem_set_functions)])
2472     if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2473             "$ac_cv_func_vpx_mem_set_functions" = no; then
2474         AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2475     fi
2477 CFLAGS=$_SAVE_CFLAGS
2478 LIBS=$_SAVE_LIBS
2480 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2481 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2482 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2484 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
2485     MOZ_VORBIS=1
2486 else
2487     MOZ_TREMOR=1
2490 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2492     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2493     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2494     dnl We currently require gcc on all arm platforms.
2496     dnl See if we have assembly on this platform.
2497     case "$OS_ARCH:$CPU_ARCH" in
2498     Darwin:x86)
2499       VPX_USE_YASM=1
2500       VPX_X86_ASM=1
2501     ;;
2502     Darwin:x86_64)
2503       VPX_USE_YASM=1
2504       VPX_X86_ASM=1
2505     ;;
2506     WINNT:x86_64)
2507       VPX_USE_YASM=1
2508       VPX_X86_ASM=1
2509     ;;
2510     WINNT:x86)
2511       dnl Check for yasm 1.1 or greater.
2512       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2513         AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed.  Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
2514       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2515         AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
2516       else
2517         VPX_USE_YASM=1
2518         VPX_X86_ASM=1
2519         dnl The encoder needs obj_int_extract to get asm offsets.
2520       fi # COMPILE_ENVIRONMENT and others
2521     ;;
2522     *:arm*)
2523       if test -n "$GNU_AS" ; then
2524         dnl These flags are a lie; they're just used to enable the requisite
2525         dnl opcodes; actual arch detection is done at runtime.
2526         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2527         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2528         VPX_ARM_ASM=1
2529         dnl Building with -mfpu=neon requires either the "softfp" or the
2530         dnl "hardfp" ABI. Depending on the compiler's default target, and the
2531         dnl CFLAGS, the default ABI might be neither, in which case it is the
2532         dnl "softfloat" ABI.
2533         dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2534         dnl we can safely mix code built with both ABIs. So, if we detect
2535         dnl that compiling uses the "softfloat" ABI, force the use of the
2536         dnl "softfp" ABI instead.
2537         dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2538         dnl "softfloat" ABI, not the "softfp" ABI.
2539         dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2540         AC_TRY_COMPILE([],
2541           [#ifndef __SOFTFP__
2542            #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2543            #endif],
2544            VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2545            )
2546       fi
2547     ;;
2548     *:x86)
2549       if $CC -E -dM -</dev/null | grep -q __ELF__; then
2550         VPX_USE_YASM=1
2551         VPX_X86_ASM=1
2552       fi
2553     ;;
2554     *:x86_64)
2555       if $CC -E -dM -</dev/null | grep -q __ELF__; then
2556         VPX_USE_YASM=1
2557         VPX_X86_ASM=1
2558       fi
2559     ;;
2560     esac
2562     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2563       AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
2564     fi # COMPILE_ENVIRONMENT and others
2566     if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2567       VPX_ASFLAGS="-DPIC"
2568     fi
2570     if test -n "$VPX_X86_ASM"; then
2571       AC_DEFINE(VPX_X86_ASM)
2572     elif test -n "$VPX_ARM_ASM"; then
2573       AC_DEFINE(VPX_ARM_ASM)
2574     else
2575       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2576     fi
2578     dnl native libvpx no longer has vpx_mem_set_functions
2579     AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2582 dnl ========================================================
2583 dnl = Handle dependent MEDIA defines
2584 dnl ========================================================
2586 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
2587     AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
2590 if test -n "$MOZ_VORBIS"; then
2591     AC_DEFINE(MOZ_VORBIS)
2594 if test -n "$MOZ_TREMOR"; then
2595     AC_DEFINE(MOZ_TREMOR)
2598 MOZ_WEBM_ENCODER=1
2599 AC_DEFINE(MOZ_WEBM_ENCODER)
2600 AC_SUBST(MOZ_WEBM_ENCODER)
2602 dnl ========================================================
2603 dnl NegotiateAuth
2604 dnl ========================================================
2606 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2607 [  --disable-negotiateauth Disable GSS-API negotiation ],
2608     MOZ_AUTH_EXTENSION=,
2609     MOZ_AUTH_EXTENSION=1 )
2611 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2612    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2615 dnl ========================================================
2616 dnl Pref extensions (autoconfig)
2617 dnl ========================================================
2618 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2619 [  --disable-pref-extensions
2620                           Disable pref extensions such as autoconfig],
2621   MOZ_PREF_EXTENSIONS=,
2622   MOZ_PREF_EXTENSIONS=1 )
2624 dnl ========================================================
2625 dnl Searching of system directories for extensions.
2626 dnl Note: this switch is meant to be used for test builds
2627 dnl whose behavior should not depend on what happens to be
2628 dnl installed on the local machine.
2629 dnl ========================================================
2630 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2631 [  --disable-system-extension-dirs
2632                           Disable searching system- and account-global
2633                           directories for extensions of any kind; use
2634                           only profile-specific extension directories],
2635   ENABLE_SYSTEM_EXTENSION_DIRS=,
2636   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2637 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2638   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2641 dnl ========================================================
2642 dnl = Universalchardet
2643 dnl ========================================================
2644 MOZ_ARG_DISABLE_BOOL(universalchardet,
2645 [  --disable-universalchardet
2646                           Disable universal encoding detection],
2647   MOZ_UNIVERSALCHARDET=,
2648   MOZ_UNIVERSALCHARDET=1 )
2650 dnl ========================================================
2651 dnl = ANGLE OpenGL->D3D translator for WebGL
2652 dnl = * only applies to win32 (and then, not MINGW)
2653 dnl ========================================================
2655 MOZ_ANGLE_RENDERER=
2656 MOZ_D3D_CPU_SUFFIX=
2657 MOZ_HAS_WINSDK_WITH_D3D=
2658 MOZ_D3DCOMPILER_VISTA_DLL=
2659 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2661 if test "$COMPILE_ENVIRONMENT" ; then
2662 case "$target_os" in
2663 *mingw*)
2664     MOZ_ANGLE_RENDERER=1
2665     ;;
2666 esac
2668 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2669 case "${target_cpu}" in
2670 i*86)
2671   MOZ_D3D_CPU_SUFFIX=x86
2672   ;;
2673 x86_64)
2674   MOZ_D3D_CPU_SUFFIX=x64
2675   ;;
2676 esac
2678 dnl ========================================================
2679 dnl D3D compiler DLL
2680 dnl ========================================================
2681 MOZ_FOUND_D3D_COMPILERS=
2683 if test -n "$MOZ_ANGLE_RENDERER"; then
2684   if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2685     AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2686   fi
2688   ######################################
2689   # Find _46+ for use by Vista+.
2691   # Find a D3D compiler DLL in a Windows SDK.
2692   MOZ_D3DCOMPILER_VISTA_DLL=
2693   case "$MOZ_WINSDK_MAXVER" in
2694   0x0603*|0x0A00*)
2695     MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2696     AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2697   ;;
2698   esac
2700   if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2701     # We have a name, now track down the path.
2702     if test -n "$WINDOWSSDKDIR"; then
2703       MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2704       if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2705         AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2706         MOZ_HAS_WINSDK_WITH_D3D=1
2707       else
2708         AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2709         AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2710         MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2711       fi
2712     else
2713       AC_MSG_RESULT([Windows SDK not found.])
2714     fi
2715   else
2716     if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2717       AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2718     else
2719       AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2720     fi
2721   fi
2723   if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2724     MOZ_D3DCOMPILER_VISTA_DLL=
2725   fi
2727   # On mingw, check if headers are provided by toolchain.
2728   if test -n "$GNU_CC"; then
2729     MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2730   fi
2732   ######################################
2733   # Check that we found what we needed.
2734   MOZ_FOUND_A_D3D_COMPILER=
2736   if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2737     MOZ_FOUND_A_D3D_COMPILER=1
2738     AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
2739   fi
2741   if test -z "$CROSS_COMPILE"; then
2742     if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
2743       AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
2744     fi
2745   fi
2746 fi # MOZ_ANGLE_RENDERER
2748 fi # COMPILE_ENVIRONMENT
2751 dnl ========================================================
2752 dnl Gamepad support
2753 dnl ========================================================
2754 MOZ_GAMEPAD_BACKEND=stub
2756 case "$OS_TARGET" in
2757 Darwin)
2758     if test -z "$MOZ_IOS"; then
2759         MOZ_GAMEPAD_BACKEND=cocoa
2760     fi
2761     ;;
2762 WINNT)
2763     MOZ_GAMEPAD_BACKEND=windows
2764     ;;
2765 Linux)
2766     MOZ_CHECK_HEADER([linux/joystick.h])
2767     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2768       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2769     fi
2770     MOZ_GAMEPAD_BACKEND=linux
2771     ;;
2772 Android)
2773     MOZ_GAMEPAD_BACKEND=android
2774     ;;
2776     ;;
2777 esac
2779 AC_SUBST(MOZ_GAMEPAD_BACKEND)
2781 dnl ========================================================
2782 dnl = Breakpad crash reporting (on by default on supported platforms)
2783 dnl ========================================================
2785 case $target in
2786 i?86-*-mingw*|x86_64-*-mingw*)
2787   MOZ_CRASHREPORTER=1
2788   ;;
2789 i?86-apple-darwin*|x86_64-apple-darwin*)
2790   if test -z "$MOZ_IOS"; then
2791     MOZ_CRASHREPORTER=1
2792   fi
2793   ;;
2794 *-android*|*-linuxandroid*)
2795   dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2796   dnl be before Linux condition
2797   MOZ_CRASHREPORTER=1
2798   ;;
2799 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2800   if test "$MOZ_ENABLE_GTK"; then
2801     MOZ_CRASHREPORTER=1
2802   fi
2803   ;;
2804 esac
2806 MOZ_ARG_DISABLE_BOOL(crashreporter,
2807 [  --disable-crashreporter Disable breakpad crash reporting],
2808     [MOZ_CRASHREPORTER=],
2809     [MOZ_CRASHREPORTER=F # Force enable breakpad])
2811 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2812   if test "$MOZ_CRASHREPORTER" = F; then
2813     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2814   fi
2815   MOZ_CRASHREPORTER=
2818 if test -n "$MOZ_CRASHREPORTER"; then
2819    AC_DEFINE(MOZ_CRASHREPORTER)
2821   if test "$OS_TARGET" = "Linux" && \
2822     test -z "$SKIP_LIBRARY_CHECKS"; then
2823     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2824   fi
2826   if test "$OS_ARCH" = "WINNT"; then
2827     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2828       MOZ_CRASHREPORTER_INJECTOR=1
2829       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2830     fi
2831   fi
2834 dnl ========================================================
2835 dnl = libjpeg-turbo configuration
2836 dnl ========================================================
2837 MOZ_LIBJPEG_TURBO=
2838 LIBJPEG_TURBO_USE_YASM=
2839 if test -z "$MOZ_SYSTEM_JPEG"; then
2840     MOZ_LIBJPEG_TURBO=1
2843 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
2844 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
2845     MOZ_LIBJPEG_TURBO=,
2846     MOZ_LIBJPEG_TURBO=1)
2848 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
2849     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
2852 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
2853 dnl files.
2855 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
2857   dnl Do we support libjpeg-turbo on this platform?
2858   case "$OS_ARCH:$CPU_ARCH" in
2859   Darwin:x86)
2860     LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
2861   ;;
2862   Darwin:x86_64)
2863     LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2864   ;;
2865   Darwin:arm*)
2866   ;;
2867   WINNT:x86)
2868     LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
2869   ;;
2870   WINNT:x86_64)
2871     LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2872   ;;
2873   *:arm)
2874     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
2875   ;;
2876   *:aarch64)
2877     LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
2878   ;;
2879   *:mips32)
2880     LIBJPEG_TURBO_ASFLAGS="-mdspr2"
2881   ;;
2882   *:x86)
2883     if $CC -E -dM -</dev/null | grep -q __ELF__; then
2884       LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
2885     fi
2886   ;;
2887   *:x86_64)
2888     if $CC -E -dM -</dev/null | grep -q __ELF__; then
2889       LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2890     fi
2891   ;;
2892   esac
2895 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
2896   case "$CPU_ARCH" in
2897 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
2898 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
2899 dnl it doesn't exist or we have too old of a version.
2900   x86_64|x86)
2901     LIBJPEG_TURBO_USE_YASM=1
2903     if test -z "$YASM" ; then
2904         AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed.  Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
2905     fi
2907     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
2908     dnl on Linux and 1.1 or newer everywhere else.
2909     if test "$OS_ARCH" = "Linux" ; then
2910         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
2911             AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
2912         fi
2913     else
2914         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2915             AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
2916         fi
2917     fi
2918   ;;
2919   esac
2922 dnl ========================================================
2923 dnl = libav-fft configuration
2924 dnl ========================================================
2926 MOZ_LIBAV_FFT=
2928 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
2929 dnl 32-bit linux/os x have text relocation issues.
2931 case "$OS_ARCH:$CPU_ARCH" in
2932   WINNT:x86)
2933       MOZ_LIBAV_FFT=1
2934   ;;
2935   *:x86_64)
2936       MOZ_LIBAV_FFT=1
2937   ;;
2938 esac
2940 dnl Detect if we can use yasm to compile libav's assembly
2942 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
2943   AC_DEFINE(MOZ_LIBAV_FFT)
2944   dnl Do we support libav-fft on this platform?
2945   case "$OS_ARCH:$CPU_ARCH" in
2946   Darwin:x86_64)
2947     LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2948   ;;
2949   WINNT:x86)
2950     LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
2951   ;;
2952   WINNT:x86_64)
2953     LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2954   ;;
2955   *:x86_64)
2956     if $CC -E -dM -</dev/null | grep -q __ELF__; then
2957       LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2958     fi
2959   ;;
2960   *)
2961     AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
2962   ;;
2963   esac
2966 if test -n "$LIBAV_FFT_ASFLAGS"; then
2967   dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
2968   dnl check for Yasm, and error out if it doesn't exist or we have too old of a
2969   dnl version.
2970   if test -z "$YASM" ; then
2971     AC_MSG_ERROR([Yasm is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
2972   fi
2973   dnl Check that we have the right yasm version.  We require 1.0.1 or newer
2974   dnl on Linux and 1.1 or newer everywhere else.
2975   if test "$OS_ARCH" = "Linux" ; then
2976     if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
2977       AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed.  See https://developer.mozilla.org/en/YASM for more details.])
2978     fi
2979   else
2980     if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2981       AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed.  See https://developer.mozilla.org/en/YASM for more details.])
2982     fi
2983   fi
2984 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
2985   dnl Warn if we're not building either libav or opendl-max optimized routines.
2986   AC_MSG_WARN([No assembler or assembly support for libav-fft.  Using unoptimized C routines.])
2989 dnl ========================================================
2990 dnl = FFmpeg's ffvpx configuration
2991 dnl ========================================================
2993 MOZ_FFVPX=
2994 MOZ_FFVPX_FLACONLY=
2995 case "$CPU_ARCH" in
2996   x86|x86_64)
2997       MOZ_FFVPX=1
2998       dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
2999       if test -n "$LIBAV_FFT_ASFLAGS"; then
3000           FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
3001       else
3002           dnl On x86 system with assembly optimizations disabled, the ffvp9 and
3003           dnl ffvp8 decoders give worse performance than libvpx ones. So we only
3004           dnl enable the FFmpeg FLAC decoder on those machines.
3005           MOZ_FFVPX_FLACONLY=1
3006       fi
3007   ;;
3008   arm*|aarch64)
3009       MOZ_FFVPX=1
3010       MOZ_FFVPX_FLACONLY=1
3011       dnl Use same conditional as MOZ_LIBVPX to enable FFmpeg's ffvpx assembly decoder.
3012       dnl aarch 64 FLAC decoder for now will be C only.
3013       FFVPX_ASFLAGS=$VPX_ASFLAGS
3014   ;;
3015 esac
3017 if test -n "$MOZ_FFVPX"; then
3018   AC_DEFINE(MOZ_FFVPX)
3020 if test -n "$MOZ_FFVPX_FLACONLY"; then
3021   AC_DEFINE(MOZ_FFVPX_FLACONLY)
3024 dnl ========================================================
3025 dnl = Enable compilation of specific extension modules
3026 dnl ========================================================
3028 MOZ_ARG_ENABLE_STRING(extensions,
3029 [  --enable-extensions     Enable extensions],
3030 [ for option in `echo $enableval | sed 's/,/ /g'`; do
3031     if test "$option" = "yes" -o "$option" = "all"; then
3032         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
3033     elif test "$option" = "no" -o "$option" = "none"; then
3034         MOZ_EXTENSIONS=""
3035     elif test "$option" = "default"; then
3036         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
3037     elif test `echo "$option" | grep -c \^-` != 0; then
3038         option=`echo $option | sed 's/^-//'`
3039         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
3040     else
3041         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
3042     fi
3043 done],
3044     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
3046 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
3047 dnl when trying to build a nonexistent extension.
3048 for extension in $MOZ_EXTENSIONS; do
3049     if test ! -d "${srcdir}/extensions/${extension}"; then
3050         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
3051     fi
3052 done
3054 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
3055   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
3058 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
3059 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
3060 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
3061    MOZ_ENABLE_CAIRO_FT=1
3062    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3063    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
3064    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3067 AC_CHECK_PROGS(WGET, wget, "")
3068 AC_SUBST(WGET)
3070 dnl ========================================================
3071 dnl Maintenance Service
3072 dnl ========================================================
3074 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3075 [  --enable-maintenance-service       Enable building of maintenanceservice],
3076     MOZ_MAINTENANCE_SERVICE=1,
3077     MOZ_MAINTENANCE_SERVICE= )
3079 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3080   if test "$OS_ARCH" = "WINNT"; then
3081     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3082   else
3083     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3084   fi
3087 dnl ========================================================
3088 dnl Bundled fonts on desktop platforms
3089 dnl ========================================================
3091 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3092 [  --enable-bundled-fonts  Enable support for bundled fonts on desktop platforms],
3093     MOZ_BUNDLED_FONTS=1,
3094     MOZ_BUNDLED_FONTS=)
3096 if test -n "$MOZ_BUNDLED_FONTS"; then
3097   AC_DEFINE(MOZ_BUNDLED_FONTS)
3100 dnl ========================================================
3101 dnl Verify MAR signatures
3102 dnl ========================================================
3104 MOZ_ARG_ENABLE_BOOL(verify-mar,
3105 [  --enable-verify-mar     Enable verifying MAR signatures],
3106     MOZ_VERIFY_MAR_SIGNATURE=1,
3107     MOZ_VERIFY_MAR_SIGNATURE= )
3109 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3110   AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3113 dnl ========================================================
3114 dnl Enable building the signmar program.
3115 dnl This option is much different than the --enable-verify-mar option.
3116 dnl --enable-verify-mar is for enabling the verification check on MAR
3117 dnl files in the updater.  The --enable-signmar option is for building
3118 dnl the signmar program.
3119 dnl ========================================================
3121 MOZ_ARG_ENABLE_BOOL(signmar,
3122 [  --enable-signmar     Enable building the signmar program],
3123     MOZ_ENABLE_SIGNMAR=1,
3124     MOZ_ENABLE_SIGNMAR= )
3126 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3127   if test -z "$COMPILE_ENVIRONMENT" ; then
3128     AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3129     MOZ_ENABLE_SIGNMAR=
3130   else
3131     AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3132   fi
3135 dnl ========================================================
3136 dnl Updater
3137 dnl ========================================================
3139 if test "$MOZ_IOS"; then
3140   MOZ_UPDATER=
3143 MOZ_ARG_DISABLE_BOOL(updater,
3144 [  --disable-updater       Disable building of updater],
3145     MOZ_UPDATER=,
3146     MOZ_UPDATER=1 )
3148 if test -n "$MOZ_UPDATER"; then
3149     AC_DEFINE(MOZ_UPDATER)
3152 dnl ========================================================
3153 dnl parental controls (for Windows Vista)
3154 dnl ========================================================
3155 MOZ_ARG_DISABLE_BOOL(parental-controls,
3156 [  --disable-parental-controls
3157                           Do not build parental controls],
3158    MOZ_DISABLE_PARENTAL_CONTROLS=1,
3159    MOZ_DISABLE_PARENTAL_CONTROLS=)
3160 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3161     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3164 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3166 dnl ========================================================
3167 dnl = Disable smartcard support
3168 dnl ========================================================
3169 if test -n "$MOZ_NO_SMART_CARDS"; then
3170     AC_DEFINE(MOZ_NO_SMART_CARDS)
3172 AC_SUBST(MOZ_NO_SMART_CARDS)
3174 dnl ========================================================
3175 dnl = Sandboxing support
3176 dnl ========================================================
3177 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3178     # Bug 1182565: TSan conflicts with sandboxing on Linux.
3179     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3180     case $OS_TARGET in
3181     Linux|Android)
3182         MOZ_SANDBOX=
3183         ;;
3184     esac
3187 MOZ_ARG_DISABLE_BOOL(sandbox,
3188 [  --disable-sandbox        Disable sandboxing support],
3189     MOZ_SANDBOX=,
3190     MOZ_SANDBOX=1)
3192 dnl ========================================================
3193 dnl = Content process sandboxing
3194 dnl ========================================================
3196 case "$OS_TARGET" in
3197 WINNT)
3198     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3199     ;;
3200 Darwin)
3201     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3202     ;;
3203 Linux)
3204     case $CPU_ARCH in
3205         x86_64|x86)
3206             MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3207         ;;
3208     esac
3209     ;;
3210 esac
3212 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3213 [  --enable-content-sandbox Enable sandboxing support for content-processes
3214   --disable-content-sandbox Disable sandboxing support for content-processes],
3215     MOZ_CONTENT_SANDBOX=1,
3216     MOZ_CONTENT_SANDBOX=)
3218 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3219     AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3222 if test -n "$MOZ_CONTENT_SANDBOX"; then
3223     AC_DEFINE(MOZ_CONTENT_SANDBOX)
3226 AC_SUBST(MOZ_CONTENT_SANDBOX)
3228 dnl ========================================================
3229 dnl = Gecko Media Plugin sandboxing
3230 dnl ========================================================
3231 case $OS_TARGET in
3232 WINNT)
3233     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3234     ;;
3235 Linux)
3236     case $CPU_ARCH in
3237     x86_64|x86)
3238         MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3239         ;;
3240     esac
3241     ;;
3242 Darwin)
3243     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3244     ;;
3245 esac
3247 if test -n "$MOZ_GMP_SANDBOX"; then
3248     AC_DEFINE(MOZ_GMP_SANDBOX)
3251 AC_SUBST(MOZ_GMP_SANDBOX)
3253 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3254     MOZ_SANDBOX=
3257 if test -n "$MOZ_SANDBOX"; then
3258     AC_DEFINE(MOZ_SANDBOX)
3261 AC_SUBST(MOZ_SANDBOX)
3264 dnl ========================================================
3265 dnl =
3266 dnl = Module specific options
3267 dnl =
3268 dnl ========================================================
3269 MOZ_ARG_HEADER(Individual module options)
3271 dnl ========================================================
3272 dnl = Disable feed handling components
3273 dnl ========================================================
3274 MOZ_ARG_DISABLE_BOOL(feeds,
3275 [  --disable-feeds         Disable feed handling and processing components],
3276     MOZ_FEEDS=,
3277     MOZ_FEEDS=1 )
3278 if test -n "$MOZ_FEEDS"; then
3279     AC_DEFINE(MOZ_FEEDS)
3280 else
3281     if test "$MOZ_BUILD_APP" = "browser"; then
3282         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3283     fi
3286 dnl ========================================================
3287 dnl Check for sqlite
3288 dnl ========================================================
3290 MOZ_SYSTEM_SQLITE=
3291 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3292 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
3293 MOZ_SYSTEM_SQLITE=1,
3294 MOZ_SYSTEM_SQLITE= )
3296 if test -n "$MOZ_SYSTEM_SQLITE"
3297 then
3298     dnl ============================
3299     dnl === SQLite Version check ===
3300     dnl ============================
3301     dnl Check to see if the system SQLite package is new enough.
3302     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3304     dnl ==================================
3305     dnl === SQLITE_SECURE_DELETE check ===
3306     dnl ==================================
3307     dnl Check to see if the system SQLite package is compiled with
3308     dnl SQLITE_SECURE_DELETE enabled.
3309     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3310     _SAVE_CFLAGS="$CFLAGS"
3311     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3312     _SAVE_LIBS="$LIBS"
3313     LIBS="$LIBS $SQLITE_LIBS"
3314     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3315         AC_TRY_RUN([
3316             #include "sqlite3.h"
3318             int main(int argc, char **argv){
3319               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3320             }],
3321             ac_cv_sqlite_secure_delete=yes,
3322             ac_cv_sqlite_secure_delete=no,
3323             ac_cv_sqlite_secure_delete=no
3324         )
3325     ])
3326     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3327     CFLAGS="$_SAVE_CFLAGS"
3328     LIBS="$_SAVE_LIBS"
3329     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3330         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3331     fi
3333     dnl ===============================
3334     dnl === SQLITE_THREADSAFE check ===
3335     dnl ===============================
3336     dnl Check to see if the system SQLite package is compiled with
3337     dnl SQLITE_THREADSAFE enabled.
3338     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3339     _SAVE_CFLAGS="$CFLAGS"
3340     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3341     _SAVE_LIBS="$LIBS"
3342     LIBS="$LIBS $SQLITE_LIBS"
3343     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3344         AC_TRY_RUN([
3345             #include "sqlite3.h"
3347             int main(int argc, char **argv){
3348               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3349             }],
3350             ac_cv_sqlite_threadsafe=yes,
3351             ac_cv_sqlite_threadsafe=no,
3352             ac_cv_sqlite_threadsafe=no
3353         )
3354     ])
3355     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3356     CFLAGS="$_SAVE_CFLAGS"
3357     LIBS="$_SAVE_LIBS"
3358     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3359         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3360     fi
3362     dnl ================================
3363     dnl === SQLITE_ENABLE_FTS3 check ===
3364     dnl ================================
3365     dnl check to see if the system SQLite package is compiled with
3366     dnl SQLITE_ENABLE_FTS3 enabled.
3367     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3368     _SAVE_CFLAGS="$CFLAGS"
3369     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3370     _SAVE_LIBS="$LIBS"
3371     LIBS="$LIBS $SQLITE_LIBS"
3372     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3373         AC_TRY_RUN([
3374             #include "sqlite3.h"
3376             int main(int argc, char **argv){
3377               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3378             }],
3379             ac_cv_sqlite_enable_fts3=yes,
3380             ac_cv_sqlite_enable_fts3=no,
3381             ac_cv_sqlite_enable_fts3=no
3382         )
3383     ])
3384     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3385     CFLAGS="$_SAVE_CFLAGS"
3386     LIBS="$_SAVE_LIBS"
3387     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3388         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3389     fi
3391     dnl =========================================
3392     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3393     dnl =========================================
3394     dnl check to see if the system SQLite package is compiled with
3395     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3396     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3397     _SAVE_CFLAGS="$CFLAGS"
3398     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3399     _SAVE_LIBS="$LIBS"
3400     LIBS="$LIBS $SQLITE_LIBS"
3401     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3402         AC_TRY_RUN([
3403             #include "sqlite3.h"
3405             int main(int argc, char **argv){
3406               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3407             }],
3408             ac_cv_sqlite_enable_unlock_notify=yes,
3409             ac_cv_sqlite_enable_unlock_notify=no,
3410             ac_cv_sqlite_enable_unlock_notify=no
3411         )
3412     ])
3413     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3414     CFLAGS="$_SAVE_CFLAGS"
3415     LIBS="$_SAVE_LIBS"
3416     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3417         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3418     fi
3420     dnl =========================================
3421     dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3422     dnl =========================================
3423     dnl check to see if the system SQLite package is compiled with
3424     dnl SQLITE_ENABLE_DBSTAT_VTAB.
3425     AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3426     _SAVE_CFLAGS="$CFLAGS"
3427     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3428     _SAVE_LIBS="$LIBS"
3429     LIBS="$LIBS $SQLITE_LIBS"
3430     AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3431         AC_TRY_RUN([
3432             #include "sqlite3.h"
3434             int main(int argc, char **argv){
3435               return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3436             }],
3437             ac_cv_sqlite_dbstat_vtab=yes,
3438             ac_cv_sqlite_dbstat_vtab=no,
3439             ac_cv_sqlite_dbstat_vtab=no
3440         )
3441     ])
3442     AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3443     CFLAGS="$_SAVE_CFLAGS"
3444     LIBS="$_SAVE_LIBS"
3445     if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3446         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3447     fi
3448 else
3449     dnl ==============================
3450     dnl === SQLite fdatasync check ===
3451     dnl ==============================
3452     dnl Check to see if fdatasync is available
3453     AC_CHECK_FUNC(fdatasync)
3456 if test -n "$MOZ_SYSTEM_SQLITE"; then
3457     AC_DEFINE(MOZ_SYSTEM_SQLITE)
3459 AC_SUBST(MOZ_SYSTEM_SQLITE)
3461 dnl ========================================================
3462 dnl = Disable zipwriter
3463 dnl ========================================================
3464 MOZ_ARG_DISABLE_BOOL(zipwriter,
3465 [  --disable-zipwriter     Disable zipwriter component],
3466     MOZ_ZIPWRITER=,
3467     MOZ_ZIPWRITER=1 )
3468 AC_SUBST(MOZ_ZIPWRITER)
3470 dnl ========================================================
3471 dnl =
3472 dnl = Feature options that require extra sources to be pulled
3473 dnl =
3474 dnl ========================================================
3475 dnl MOZ_ARG_HEADER(Features that require extra sources)
3477 dnl ========================================================
3478 dnl =
3479 dnl = Runtime debugging and Optimization Options
3480 dnl =
3481 dnl ========================================================
3482 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3484 dnl ========================================================
3485 dnl enable mobile optimizations
3486 dnl ========================================================
3487 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3488 [  --enable-mobile-optimize
3489                           Enable mobile optimizations],
3490     MOZ_GFX_OPTIMIZE_MOBILE=1)
3492 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3494 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3495     # We ignore paint will resample on mobile for performance.
3496     # We may want to revisit this later.
3497     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3499     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3500     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3503 dnl ========================================================
3504 dnl = Enable code optimization. ON by default.
3505 dnl ========================================================
3507 # Use value from moz.configure if one is defined. Else use our computed
3508 # value.
3509 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
3510     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
3513 MOZ_SET_FRAMEPTR_FLAGS
3515 if test "$COMPILE_ENVIRONMENT"; then
3516 if test -n "$MOZ_OPTIMIZE"; then
3517     AC_MSG_CHECKING([for valid C compiler optimization flags])
3518     _SAVE_CFLAGS=$CFLAGS
3519     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3520     AC_TRY_COMPILE([#include <stdio.h>],
3521         [printf("Hello World\n");],
3522         _results=yes,
3523         _results=no)
3524     AC_MSG_RESULT([$_results])
3525     if test "$_results" = "no"; then
3526         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3527     fi
3528     CFLAGS=$_SAVE_CFLAGS
3530 fi # COMPILE_ENVIRONMENT
3532 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
3533 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
3534 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
3535 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
3537 dnl ========================================================
3538 dnl = Disable treating compiler warnings as errors
3539 dnl ========================================================
3540 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3541    WARNINGS_AS_ERRORS=''
3544 dnl ========================================================
3545 dnl = Enable runtime logging
3546 dnl ========================================================
3547 AC_DEFINE(MOZ_LOGGING)
3548 AC_DEFINE(FORCE_PR_LOG)
3550 dnl ========================================================
3551 dnl = This will enable logging of addref, release, ctor, dtor.
3552 dnl ========================================================
3553 _ENABLE_LOGREFCNT=42
3554 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3555 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
3556     _ENABLE_LOGREFCNT=1,
3557     _ENABLE_LOGREFCNT= )
3558 if test "$_ENABLE_LOGREFCNT" = "1"; then
3559     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3560 elif test -z "$_ENABLE_LOGREFCNT"; then
3561     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3564 dnl ========================================================
3565 dnl moz_dump_painting
3566 dnl ========================================================
3567 MOZ_ARG_ENABLE_BOOL(dump-painting,
3568 [  --enable-dump-painting          Enable paint debugging.],
3569     MOZ_DUMP_PAINTING=1,
3570     MOZ_DUMP_PAINTING= )
3571 if test -n "$MOZ_DUMP_PAINTING"; then
3572     AC_DEFINE(MOZ_DUMP_PAINTING)
3573     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3575 if test -n "$MOZ_DEBUG"; then
3576     AC_DEFINE(MOZ_DUMP_PAINTING)
3579 case "${OS_TARGET}" in
3580 Android|WINNT|Darwin)
3581   MOZ_GLUE_IN_PROGRAM=
3582   ;;
3584   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3585   MOZ_GLUE_IN_PROGRAM=1
3586   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3587   ;;
3588 esac
3590 dnl ========================================================
3591 dnl = Jemalloc build setup
3592 dnl ========================================================
3593 if test -z "$MOZ_MEMORY"; then
3594   case "${target}" in
3595     *-mingw*)
3596       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3597         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.])
3598       fi
3599       ;;
3600   esac
3601 else
3602   dnl The generic feature tests that determine how to compute ncpus are long and
3603   dnl complicated.  Therefore, simply define special cpp variables for the
3604   dnl platforms we have special knowledge of.
3605   case "${target}" in
3606   *-mingw*)
3607     export MOZ_NO_DEBUG_RTL=1
3608     ;;
3609   esac
3610 fi # MOZ_MEMORY
3611 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3613 # Allow the application to provide a subconfigure script.
3614 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3615 # ldap/c-sdk/configure refers to the enviroment value.
3616 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3617   do_output_subdirs() {
3618     if test -n "$_subconfigure_subdirs"; then
3619       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3620      fi
3621     _subconfigure_subdir="$1"
3622     _subconfigure_config_args="$ac_configure_args"
3623   }
3624   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3625   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3626      "${srcdir}/build/autoconf/altoptions.m4" \
3627      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3628   . $tmpscript
3629   rm -f $tmpscript
3632 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3633 export MOZ_GLUE_WRAP_LDFLAGS
3635 dnl ========================================================
3636 dnl = Enable using the clang plugin to build
3637 dnl ========================================================
3639 if test -n "$COMPILE_ENVIRONMENT"; then
3640 MOZ_CONFIG_CLANG_PLUGIN
3641 fi # COMPILE_ENVIRONMENT
3643 dnl ========================================================
3644 dnl = Enable stripping of libs & executables
3645 dnl ========================================================
3646 MOZ_ARG_ENABLE_BOOL(strip,
3647 [  --enable-strip          Enable stripping of libs & executables ],
3648     ENABLE_STRIP=1,
3649     ENABLE_STRIP= )
3651 dnl ========================================================
3652 dnl = Enable stripping of libs & executables when packaging
3653 dnl ========================================================
3654 MOZ_ARG_ENABLE_BOOL(install-strip,
3655 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
3656     PKG_SKIP_STRIP= ,
3657     PKG_SKIP_STRIP=1)
3659 dnl ========================================================
3660 dnl = frontend JS debug mode
3661 dnl ========================================================
3663 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3664 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
3665    DEBUG_JS_MODULES=1,
3666    DEBUG_JS_MODULES=)
3668 AC_SUBST(DEBUG_JS_MODULES)
3670 dnl ========================================================
3671 dnl =
3672 dnl = Profiling and Instrumenting
3673 dnl =
3674 dnl ========================================================
3675 MOZ_ARG_HEADER(Profiling and Instrumenting)
3677 dnl ========================================================
3678 dnl = Enable TaskTracer
3679 dnl ========================================================
3680 MOZ_ARG_ENABLE_BOOL(tasktracer,
3681 [  --enable-tasktracer       Set compile flags necessary for using TaskTracer],
3682     MOZ_TASK_TRACER=1,
3683     MOZ_TASK_TRACER= )
3684 if test -n "$MOZ_TASK_TRACER"; then
3685     AC_DEFINE(MOZ_TASK_TRACER)
3686     AC_SUBST(MOZ_TASK_TRACER)
3689 dnl ========================================================
3690 dnl Turn on reflow counting
3691 dnl ========================================================
3692 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3693 [  --enable-reflow-perf    Enable reflow performance tracing],
3694     MOZ_REFLOW_PERF=1,
3695     MOZ_REFLOW_PERF= )
3696 if test -n "$MOZ_REFLOW_PERF"; then
3697     AC_DEFINE(MOZ_REFLOW_PERF)
3700 dnl ========================================================
3701 dnl = Offer a way to disable the startup cache
3702 dnl ========================================================
3704 MOZ_ARG_DISABLE_BOOL(startupcache,
3705 [  --disable-startupcache          Disable startup cache ],
3706     MOZ_DISABLE_STARTUPCACHE=1,
3707     MOZ_DISABLE_STARTUPCACHE=)
3709 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
3710   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
3712 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
3714 dnl ========================================================
3715 dnl = Support for demangling undefined symbols
3716 dnl ========================================================
3717 if test -z "$SKIP_LIBRARY_CHECKS"; then
3718     AC_LANG_SAVE
3719     AC_LANG_CPLUSPLUS
3720     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3721     AC_LANG_RESTORE
3724 # Demangle only for debug or DMD builds
3725 MOZ_DEMANGLE_SYMBOLS=
3726 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
3727     MOZ_DEMANGLE_SYMBOLS=1
3728     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3730 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3732 dnl ========================================================
3733 dnl = Support for gcc stack unwinding (from gcc 3.3)
3734 dnl ========================================================
3735 if test -z "$SKIP_LIBRARY_CHECKS"; then
3736     AC_LANG_SAVE
3737     AC_LANG_CPLUSPLUS
3738     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
3739     AC_LANG_RESTORE
3742 dnl ========================================================
3743 dnl JIT observers
3744 dnl ========================================================
3746 MOZ_ARG_WITH_STRING(jitreport-granularity,
3747 [  --jitreport-granularity=N
3748                            Default granularity at which to report JIT code
3749                            to external tools
3750                              0 - no info
3751                              1 - code ranges for whole functions only
3752                              2 - per-line information
3753                              3 - per-op information],
3754   JITREPORT_GRANULARITY=$withval,
3755   JITREPORT_GRANULARITY=3)
3757 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3759 dnl ========================================================
3760 dnl =
3761 dnl = Misc. Options
3762 dnl =
3763 dnl ========================================================
3764 MOZ_ARG_HEADER(Misc. Options)
3766 dnl ========================================================
3767 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
3768 dnl ========================================================
3769 MOZ_ARG_WITH_STRING(user-appdir,
3770 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
3771 [ val=`echo $withval`
3772 if echo "$val" | grep "\/" >/dev/null; then
3773     AC_MSG_ERROR("Homedir must be single relative path.")
3774 else
3775     MOZ_USER_DIR="$val"
3776 fi])
3778 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
3780 if test -z "$SKIP_COMPILER_CHECKS"; then
3781 dnl ========================================================
3782 dnl =
3783 dnl = Compiler Options
3784 dnl =
3785 dnl ========================================================
3786 MOZ_ARG_HEADER(Compiler Options)
3788 dnl ========================================================
3789 dnl Check for gcc -pipe support
3790 dnl ========================================================
3791 AC_MSG_CHECKING([for -pipe support])
3792 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3793     dnl Any gcc that supports firefox supports -pipe.
3794     CFLAGS="$CFLAGS -pipe"
3795     CXXFLAGS="$CXXFLAGS -pipe"
3796     AC_MSG_RESULT([yes])
3797 else
3798     AC_MSG_RESULT([no])
3801 fi # ! SKIP_COMPILER_CHECKS
3803 AC_DEFINE(CPP_THROW_NEW, [throw()])
3804 AC_LANG_C
3806 if test "$COMPILE_ENVIRONMENT"; then
3807 MOZ_EXPAND_LIBS
3808 fi # COMPILE_ENVIRONMENT
3810 dnl ========================================================
3811 dnl =
3812 dnl = Build depencency options
3813 dnl =
3814 dnl ========================================================
3815 MOZ_ARG_HEADER(Build dependencies)
3817 if test "$COMPILE_ENVIRONMENT"; then
3818 if test "$GNU_CC" -a "$GNU_CXX"; then
3819   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3820 else
3821   # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
3822   # the underlying cc1 binary understands how to generate dependency files.
3823   # These options are based on analyzing what the normal clang driver sends to
3824   # cc1 when given the "correct" dependency options.
3825   if test -n "$CLANG_CL"; then
3826    _DEPEND_CFLAGS='-Xclang -MP -Xclang -MG -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
3827   fi
3828   dnl Don't override this for MSVC
3829   if test -z "$_WIN32_MSVC"; then
3830     _USE_CPP_INCLUDE_FLAG=
3831     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3832     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3833   else
3834     echo '#include <stdio.h>' > dummy-hello.c
3835     changequote(,)
3836     dnl This output is localized, split at the first double space or colon and space.
3837     _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
3838     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3839     _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3840     changequote([,])
3841     if ! test -e "$_CL_STDIO_PATH"; then
3842         AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3843     fi
3844     if test -z "$CL_INCLUDES_PREFIX"; then
3845         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3846     fi
3847     AC_SUBST(CL_INCLUDES_PREFIX)
3848     rm -f dummy-hello.c
3850     dnl Make sure that the build system can handle non-ASCII characters
3851     dnl in environment variables to prevent it from breaking silently on
3852     dnl non-English systems.
3853     NONASCII=$'\241\241'
3854     AC_SUBST(NONASCII)
3855   fi
3857 fi # COMPILE_ENVIRONMENT
3859 dnl ========================================================
3860 dnl =
3861 dnl = Static Build Options
3862 dnl =
3863 dnl ========================================================
3864 MOZ_ARG_HEADER(Static build options)
3866 if test -z "$MOZ_SYSTEM_ZLIB"; then
3867 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
3868   ZLIB_IN_MOZGLUE=1
3869   AC_DEFINE(ZLIB_IN_MOZGLUE)
3873 AC_SUBST(ZLIB_IN_MOZGLUE)
3875 dnl ========================================================
3876 dnl =
3877 dnl = Standalone module options
3878 dnl =
3879 dnl ========================================================
3880 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3882 dnl Check for GLib.
3883 dnl ========================================================
3885 if test -z "$SKIP_PATH_CHECKS"; then
3886 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
3887     if test "$MOZ_ENABLE_GTK" ; then
3888         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
3889     fi
3893 if test -z "${GLIB_GMODULE_LIBS}" \
3894    -a -n "${GLIB_CONFIG}"\
3895     -a "${GLIB_CONFIG}" != no\
3896 ; then
3897     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
3900 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
3902 if test "$USE_FC_FREETYPE"; then
3903     if test "$COMPILE_ENVIRONMENT"; then
3904         dnl ========================================================
3905         dnl = Check for freetype2 functionality
3906         dnl ========================================================
3907         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
3908             _SAVE_LIBS="$LIBS"
3909             _SAVE_CFLAGS="$CFLAGS"
3910             LIBS="$LIBS $FT2_LIBS"
3911             CFLAGS="$CFLAGS $FT2_CFLAGS"
3913             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3914                 ac_cv_member_FT_Bitmap_Size_y_ppem,
3915                 [AC_TRY_COMPILE([#include <ft2build.h>
3916                                  #include FT_FREETYPE_H],
3917                                 [FT_Bitmap_Size s;
3918                                  if (sizeof s.y_ppem) return 0;
3919                                  return 1],
3920                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3921                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3922             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3923                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3924             else
3925                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3926             fi
3927             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3928                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3929                                [FT_Bitmap_Size structure includes y_ppem field])
3931             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3933             LIBS="$_SAVE_LIBS"
3934             CFLAGS="$_SAVE_CFLAGS"
3935         fi
3937         _SAVE_CPPFLAGS="$CPPFLAGS"
3938         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3939         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3940             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3941         CPPFLAGS="$_SAVE_CPPFLAGS"
3942     fi
3945 dnl ========================================================
3946 dnl Check if we need the 32-bit Linux SSE2 error dialog
3947 dnl ========================================================
3949 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3951 dnl ========================================================
3952 dnl Check for pixman and cairo
3953 dnl ========================================================
3955 MOZ_TREE_CAIRO=1
3956 MOZ_ARG_ENABLE_BOOL(system-cairo,
3957 [ --enable-system-cairo  Obsolete: do not use this option],
3958 AC_MSG_ERROR(--enable-system-cairo is not supported),
3959 MOZ_TREE_CAIRO=1 )
3961 MOZ_TREE_PIXMAN=1
3962 MOZ_ARG_ENABLE_BOOL(system-pixman,
3963 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
3964 MOZ_TREE_PIXMAN=,
3965 MOZ_TREE_PIXMAN=force,
3966 MOZ_TREE_PIXMAN=1 )
3968 if test "$MOZ_TREE_PIXMAN"; then
3969     AC_DEFINE(MOZ_TREE_PIXMAN)
3970 else
3971     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
3974 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
3975 AC_DEFINE(MOZ_TREE_CAIRO)
3977 if test "$OS_ARCH" = "WINNT"; then
3978     # For now we assume that we will have a uint64_t available through
3979     # one of the above headers or mozstdint.h.
3980     AC_DEFINE(HAVE_UINT64_T)
3983 # Define macros for cairo-features.h
3984 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
3985 if test "$MOZ_X11"; then
3986     XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
3987     XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
3988     PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
3990 if test "$_HAVE_FREETYPE2"; then
3991     FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3992     MOZ_ENABLE_CAIRO_FT=1
3993     CAIRO_FT_CFLAGS="$FT2_CFLAGS"
3996 case "$MOZ_WIDGET_TOOLKIT" in
3997   cocoa | uikit)
3998     QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
3999     QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
4000     QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
4001     ;;
4002   windows)
4003     WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
4004     WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
4005     WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
4006     WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
4007     MOZ_ENABLE_D2D_SURFACE=1
4009     if test "$COMPILE_ENVIRONMENT"; then
4011       dnl D3D10 Layers depend on D2D Surfaces.
4012       if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
4013         MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
4014       fi
4015     fi
4016     ;;
4017 esac
4018 if test "$USE_FC_FREETYPE"; then
4019     FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
4021 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
4022 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
4023 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
4025 AC_SUBST(PS_SURFACE_FEATURE)
4026 AC_SUBST(SVG_SURFACE_FEATURE)
4027 AC_SUBST(XLIB_SURFACE_FEATURE)
4028 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
4029 AC_SUBST(QUARTZ_SURFACE_FEATURE)
4030 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
4031 AC_SUBST(WIN32_SURFACE_FEATURE)
4032 AC_SUBST(OS2_SURFACE_FEATURE)
4033 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
4034 AC_SUBST(FT_FONT_FEATURE)
4035 AC_SUBST(FC_FONT_FEATURE)
4036 AC_SUBST(WIN32_FONT_FEATURE)
4037 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
4038 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
4039 AC_SUBST(QUARTZ_FONT_FEATURE)
4040 AC_SUBST(PNG_FUNCTIONS_FEATURE)
4041 AC_SUBST(QT_SURFACE_FEATURE)
4042 AC_SUBST(TEE_SURFACE_FEATURE)
4044 if test "$MOZ_X11"; then
4045     MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
4048 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
4050 case "$MOZ_WIDGET_TOOLKIT" in
4051 android)
4052     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
4053     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
4054     ;;
4055 esac
4057 AC_SUBST(MOZ_TREE_CAIRO)
4058 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
4059 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
4060 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
4061 AC_SUBST(MOZ_TREE_PIXMAN)
4063 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
4064 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
4066 dnl ========================================================
4067 dnl disable xul
4068 dnl ========================================================
4069 MOZ_ARG_DISABLE_BOOL(xul,
4070 [  --disable-xul           Disable XUL],
4071     MOZ_XUL= )
4072 if test "$MOZ_XUL"; then
4073   AC_DEFINE(MOZ_XUL)
4074 else
4075   dnl remove extensions that require XUL
4076   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4079 AC_SUBST(MOZ_XUL)
4081 dnl ========================================================
4082 dnl necko configuration options
4083 dnl ========================================================
4086 dnl option to disable necko's wifi scanner
4089 if test "$MOZ_WIDGET_TOOLKIT"; then
4091   case "$OS_TARGET" in
4092     Darwin)
4093       if test -z "$MOZ_IOS"; then
4094         NECKO_WIFI=1
4095       fi
4096       ;;
4097     DragonFly|FreeBSD|WINNT)
4098       NECKO_WIFI=1
4099       ;;
4100     Linux)
4101       NECKO_WIFI=1
4102       NECKO_WIFI_DBUS=1
4103       ;;
4104   esac
4108 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4109 [  --disable-necko-wifi    Disable necko wifi scanner],
4110     NECKO_WIFI=,
4111     NECKO_WIFI=1)
4113 if test "$NECKO_WIFI"; then
4114   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4115     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4116   fi
4117   AC_DEFINE(NECKO_WIFI)
4118   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4120 AC_SUBST(NECKO_WIFI)
4121 AC_SUBST(NECKO_WIFI_DBUS)
4124 dnl option to disable cookies
4126 MOZ_ARG_DISABLE_BOOL(cookies,
4127 [  --disable-cookies       Disable cookie support],
4128     NECKO_COOKIES=,
4129     NECKO_COOKIES=1)
4130 AC_SUBST(NECKO_COOKIES)
4131 if test "$NECKO_COOKIES"; then
4132     AC_DEFINE(NECKO_COOKIES)
4133     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4136 dnl ========================================================
4137 dnl =
4138 dnl = Maintainer debug option (no --enable equivalent)
4139 dnl =
4140 dnl ========================================================
4142 AC_SUBST(AR)
4143 AC_SUBST(AR_FLAGS)
4144 AC_SUBST(AR_EXTRACT)
4145 AC_SUBST(AS)
4146 AC_SUBST_LIST(ASFLAGS)
4147 AC_SUBST(AS_DASH_C_FLAG)
4148 AC_SUBST(RC)
4149 AC_SUBST(RCFLAGS)
4150 AC_SUBST(WINDRES)
4151 AC_SUBST(IMPLIB)
4152 AC_SUBST(FILTER)
4153 AC_SUBST(MOZ_AUTH_EXTENSION)
4154 AC_SUBST(MOZ_PREF_EXTENSIONS)
4155 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
4156 AC_SUBST(WARNINGS_AS_ERRORS)
4157 AC_SUBST_SET(MOZ_EXTENSIONS)
4158 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4159 AC_SUBST(MOZ_FEEDS)
4161 AC_SUBST(MOZ_UNIVERSALCHARDET)
4162 AC_SUBST(ACCESSIBILITY)
4163 AC_SUBST(MOZ_SPELLCHECK)
4164 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4165 AC_SUBST(MOZ_CRASHREPORTER)
4166 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4167 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4168 AC_SUBST(MOZ_STUB_INSTALLER)
4169 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4170 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4171 AC_SUBST(MOZ_UPDATER)
4173 AC_SUBST(MOZ_ANGLE_RENDERER)
4174 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4175 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4176 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4177 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4179 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4180 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4181 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4182 AC_SUBST(ENABLE_STRIP)
4183 AC_SUBST(PKG_SKIP_STRIP)
4184 AC_SUBST(STRIP_FLAGS)
4185 AC_SUBST(INCREMENTAL_LINKER)
4187 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
4189 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4190 AC_SUBST(MOZ_LINKER_EXTRACT)
4192 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4193   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4196 AC_SUBST(MOZ_ADDON_SIGNING)
4197 if test "$MOZ_ADDON_SIGNING" = 1; then
4198   AC_DEFINE(MOZ_ADDON_SIGNING)
4200 AC_SUBST(MOZ_REQUIRE_SIGNING)
4201 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4202   AC_DEFINE(MOZ_REQUIRE_SIGNING)
4205 dnl ========================================================
4206 dnl = Mac bundle name prefix
4207 dnl ========================================================
4208 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4209 [  --with-macbundlename-prefix=prefix
4210                           Prefix for MOZ_MACBUNDLE_NAME],
4211 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4213 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
4214 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4215   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4218 if test "$MOZ_DEBUG"; then
4219   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
4220 else
4221   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4223 AC_SUBST(MOZ_MACBUNDLE_NAME)
4225 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4226 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
4227 # Otherwise, use MOZ_APP_DISPLAYNAME
4228 if test -z "$MOZ_MACBUNDLE_ID"; then
4229    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
4231 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4232 if test "$MOZ_DEBUG"; then
4233   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4236 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4237 AC_SUBST(MOZ_MACBUNDLE_ID)
4239 dnl ========================================================
4240 dnl = Child Process Name for IPC
4241 dnl ========================================================
4242 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4243   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4244 else
4245   # We want to let Android unpack the file at install time, but it only does
4246   # so if the file is named libsomething.so. The lib/ path is also required
4247   # because the unpacked file will be under the lib/ subdirectory and will
4248   # need to be executed from that path.
4249   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4251 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4252 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4254 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4255 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4256 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4258 # The following variables are available to branding and application
4259 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4260 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4261 # impacts profile location and user-visible fields.
4262 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4263 # versions of a given application (e.g. Aurora and Firefox both use
4264 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4265 # for application.ini's "Name" field, which controls profile location in
4266 # the absence of a "Profile" field (see below), and various system
4267 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4268 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4269 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4270 # builds (e.g. Aurora for Firefox).
4271 # - MOZ_APP_VERSION: Defines the application version number.
4272 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4273 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4274 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4275 # defaults to a lowercase form of MOZ_APP_BASENAME.
4276 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4277 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4278 # - MOZ_APP_PROFILE: When set, used for application.ini's
4279 # "Profile" field, which controls profile location.
4280 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4281 # crash reporter server url.
4282 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4283 # the main application is set to the value of this variable.  If not
4284 # set, it falls back to a Mozilla-specific value derived from the
4285 # build ID.
4286 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4287 # packages produced.
4288 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used.  GCM
4289 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4290 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4291 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4293 if test -z "$MOZ_APP_NAME"; then
4294    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4297 if test -z "$MOZ_APP_REMOTINGNAME"; then
4298    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4301 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4302    MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4305 if test -z "$ANDROID_PACKAGE_NAME" ; then
4306    # When we got rid of the Aurora channel we decided to replace the old
4307    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4308    # by all mozilla-central based branches we make this the new "default"
4309    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4310    # in their mozconfig, so they will never get this. If there are ever
4311    # non-Fennec builds for Android, they will fall into the else block
4312    # and use their own default name.
4313    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4314    # background on this.
4315    if test "$MOZ_APP_NAME" = "fennec"; then
4316       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4317    else
4318       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4319    fi
4322 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4323 # the public with specific common shared IDs and we need to keep them
4324 # consistent forever.  The specific common values are set by per-channel
4325 # branding; all other channels use a generic sharedID, set below.
4326 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4327    MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4330 # For extensions and langpacks, we require a max version that is compatible
4331 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4332 # 24.0a1 and 24.0a2 aren't affected
4333 # 24.0 becomes 24.*
4334 # 24.1.1 becomes 24.*
4335 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4336 if test -z "$IS_ALPHA"; then
4337   changequote(,)
4338   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4339     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4340   else
4341     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4342   fi
4343   changequote([,])
4344 else
4345   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4348 AC_SUBST(MOZ_APP_NAME)
4349 AC_SUBST(MOZ_APP_REMOTINGNAME)
4350 AC_SUBST(MOZ_APP_DISPLAYNAME)
4351 AC_SUBST(MOZ_APP_BASENAME)
4352 AC_SUBST(MOZ_APP_VENDOR)
4353 AC_SUBST(MOZ_APP_PROFILE)
4354 AC_SUBST(MOZ_APP_ID)
4355 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4356 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4357 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4358 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4359 AC_SUBST(MAR_CHANNEL_ID)
4360 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4361 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4362 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4363 AC_SUBST(MOZ_APP_UA_NAME)
4364 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4365 AC_SUBST(MOZ_APP_VERSION)
4366 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4367 AC_SUBST(MOZ_APP_MAXVERSION)
4368 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4369 AC_SUBST(FIREFOX_VERSION)
4370 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4371 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4372   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4375 AC_SUBST(MOZ_PKG_SPECIAL)
4376 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4378 if test "$MOZILLA_OFFICIAL"; then
4379     # Build revisions should always be present in official builds
4380     MOZ_INCLUDE_SOURCE_INFO=1
4383 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4384 # explicitly set the repository and changeset information in.
4385 AC_SUBST(MOZ_SOURCE_REPO)
4386 AC_SUBST(MOZ_SOURCE_CHANGESET)
4387 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4389 if test "$MOZ_TELEMETRY_REPORTING"; then
4390     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4392     # Enable Telemetry by default for nightly and aurora channels
4393     if test -z "$RELEASE_OR_BETA"; then
4394       AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4395     fi
4398 dnl If we have any service that uploads data (and requires data submission
4399 dnl policy alert), set MOZ_DATA_REPORTING.
4400 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4401 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4402   MOZ_DATA_REPORTING=1
4403   AC_DEFINE(MOZ_DATA_REPORTING)
4404   AC_SUBST(MOZ_DATA_REPORTING)
4407 dnl win32 options
4408 AC_SUBST(WIN32_REDIST_DIR)
4409 AC_SUBST(WIN_UCRT_REDIST_DIR)
4411 dnl ========================================================
4412 dnl ICU Support
4413 dnl ========================================================
4415 _INTL_API=yes
4417 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4418     USE_ICU=1
4421 MOZ_CONFIG_ICU()
4423 dnl Echo the CFLAGS to remove extra whitespace.
4424 CFLAGS=`echo \
4425     $_WARNINGS_CFLAGS \
4426     $_COMPILATION_CFLAGS \
4427     $CFLAGS`
4429 CXXFLAGS=`echo \
4430     $_WARNINGS_CXXFLAGS \
4431     $_COMPILATION_CXXFLAGS \
4432     $CXXFLAGS`
4434 COMPILE_CFLAGS=`echo \
4435     $_DEFINES_CFLAGS \
4436     $COMPILE_CFLAGS`
4438 COMPILE_CXXFLAGS=`echo \
4439     $_DEFINES_CXXFLAGS \
4440     $COMPILE_CXXFLAGS`
4442 HOST_CFLAGS=`echo \
4443     $_WARNINGS_HOST_CFLAGS \
4444     $_COMPILATION_HOST_CFLAGS \
4445     $HOST_CFLAGS`
4447 HOST_CXXFLAGS=`echo \
4448     $_WARNINGS_HOST_CXXFLAGS \
4449     $_COMPILATION_HOST_CXXFLAGS \
4450     $HOST_CXXFLAGS`
4452 AC_SUBST(_DEPEND_CFLAGS)
4453 AC_SUBST(MOZ_SYSTEM_JPEG)
4454 AC_SUBST(MOZ_SYSTEM_PNG)
4455 AC_SUBST(MOZ_SYSTEM_BZ2)
4457 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4458 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4459 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
4460 AC_SUBST_LIST(MOZ_BZ2_LIBS)
4461 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4462 AC_SUBST_LIST(MOZ_PNG_LIBS)
4464 AC_SUBST(MOZ_SYSTEM_NSPR)
4466 AC_SUBST(MOZ_SYSTEM_NSS)
4468 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
4469 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4470 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
4471 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4472 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4473   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4474   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4476 AC_SUBST(HOST_CMFLAGS)
4477 AC_SUBST(HOST_CMMFLAGS)
4478 AC_SUBST(OS_COMPILE_CMFLAGS)
4479 AC_SUBST(OS_COMPILE_CMMFLAGS)
4481 OS_CFLAGS="$CFLAGS"
4482 OS_CXXFLAGS="$CXXFLAGS"
4483 OS_CPPFLAGS="$CPPFLAGS"
4484 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4485 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4486 OS_LDFLAGS="$LDFLAGS"
4487 OS_LIBS="$LIBS"
4488 AC_SUBST_LIST(OS_CFLAGS)
4489 AC_SUBST_LIST(OS_CXXFLAGS)
4490 AC_SUBST_LIST(OS_CPPFLAGS)
4491 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
4492 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
4493 AC_SUBST_LIST(OS_LDFLAGS)
4494 AC_SUBST(OS_LIBS)
4496 AC_SUBST(HOST_CC)
4497 AC_SUBST(HOST_CXX)
4498 AC_SUBST_LIST(HOST_CFLAGS)
4499 AC_SUBST_LIST(HOST_CPPFLAGS)
4500 AC_SUBST_LIST(HOST_CXXFLAGS)
4501 AC_SUBST(HOST_LDFLAGS)
4502 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
4503 AC_SUBST(HOST_AR)
4504 AC_SUBST(HOST_AR_FLAGS)
4505 AC_SUBST(HOST_RANLIB)
4506 AC_SUBST(HOST_BIN_SUFFIX)
4508 AC_SUBST(TARGET_XPCOM_ABI)
4509 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4510 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4511 AC_SUBST(HAVE_X86_AVX2)
4512 AC_SUBST(HAVE_ALTIVEC)
4513 AC_SUBST(GCC_USE_GNU_LD)
4515 AC_SUBST(MKSHLIB)
4516 AC_SUBST(MKCSHLIB)
4517 AC_SUBST_LIST(DSO_CFLAGS)
4518 AC_SUBST_LIST(DSO_PIC_CFLAGS)
4519 AC_SUBST(DSO_LDOPTS)
4520 AC_SUBST(BIN_SUFFIX)
4521 AC_SUBST(USE_N32)
4522 AC_SUBST(CC_VERSION)
4523 AC_SUBST(NS_ENABLE_TSF)
4524 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4525 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4527 AC_SUBST(MOZ_VORBIS)
4528 AC_SUBST(MOZ_TREMOR)
4529 AC_SUBST(MOZ_FFVPX)
4530 AC_SUBST(MOZ_FFVPX_FLACONLY)
4531 AC_SUBST_LIST(FFVPX_ASFLAGS)
4532 AC_SUBST(VPX_USE_YASM)
4533 AC_SUBST_LIST(VPX_ASFLAGS)
4534 AC_SUBST(VPX_AS_CONVERSION)
4535 AC_SUBST(VPX_X86_ASM)
4536 AC_SUBST(VPX_ARM_ASM)
4537 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4538 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4539 AC_SUBST(MOZ_LIBAV_FFT)
4540 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4541 AC_SUBST(MOZ_DEVTOOLS)
4543 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4544 AC_SUBST(MOZ_FOLD_LIBS)
4545 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4547 AC_SUBST(DMG_TOOL)
4549 dnl Host JavaScript runtime, if any, to use during cross compiles.
4550 AC_SUBST(JS_BINARY)
4552 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4554 if test -n "$COMPILE_ENVIRONMENT"; then
4555 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4557 dnl Check for missing components
4558 if test "$MOZ_X11"; then
4559     dnl ====================================================
4560     dnl = Check if X headers exist
4561     dnl ====================================================
4562     _SAVE_CFLAGS=$CFLAGS
4563     CFLAGS="$CFLAGS $XCFLAGS"
4564     AC_TRY_COMPILE([
4565         #include <stdio.h>
4566         #include <stdlib.h>
4567         #include <X11/Xlib.h>
4568         #include <X11/Intrinsic.h>
4569         #include <X11/extensions/XShm.h>
4570     ],
4571     [
4572         Display *dpy = 0;
4573         if ((dpy = XOpenDisplay(NULL)) == NULL) {
4574             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4575             exit(1);
4576         }
4577     ], [],
4578     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4579     CFLAGS="$_SAVE_CFLAGS"
4581     if test -n "$MISSING_X"; then
4582         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4583     fi
4585 fi # MOZ_X11
4587 fi # COMPILE_ENVIRONMENT
4589 dnl Set various defines and substitutions
4590 dnl ========================================================
4592 if test "$MOZ_DEBUG"; then
4593     AC_DEFINE(MOZ_REFLOW_PERF)
4594     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4597 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4598     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4599     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4600     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4601     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4602     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4603     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4604     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4605     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4608 AC_SUBST(MOZ_DEV_EDITION)
4609 if test -n "$MOZ_DEV_EDITION"; then
4610     AC_DEFINE(MOZ_DEV_EDITION)
4613 if test "$MOZ_DEBUG"; then
4614     A11Y_LOG=1
4616 case "$MOZ_UPDATE_CHANNEL" in
4617 aurora|beta|release|esr)
4618     ;;
4620     A11Y_LOG=1
4621     ;;
4622 esac
4623 AC_SUBST(A11Y_LOG)
4624 if test -n "$A11Y_LOG"; then
4625     AC_DEFINE(A11Y_LOG)
4628 dnl Spit out some output
4629 dnl ========================================================
4631 dnl The following defines are used by xpcom
4632 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
4633 CPP_THROW_NEW
4634 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
4635 HAVE_GETPAGESIZE
4636 HAVE_STATVFS64
4637 HAVE_STATVFS
4638 HAVE_STATFS64
4639 HAVE_STATFS
4640 HAVE_SYS_STATVFS_H
4641 HAVE_SYS_STATFS_H
4642 HAVE_SYS_VFS_H
4643 HAVE_SYS_MOUNT_H
4646 # Avoid using obsolete NSPR features
4647 AC_DEFINE(NO_NSPR_10_SUPPORT)
4649 # Don't build NSS libpkix
4650 NSS_DISABLE_LIBPKIX=1
4651 AC_SUBST(NSS_DISABLE_LIBPKIX)
4653 MOZ_CREATE_CONFIG_STATUS()
4655 if test -z "$direct_nspr_config"; then
4656     dnl ========================================================
4657     dnl = Setup a nice relatively clean build environment for
4658     dnl = sub-configures.
4659     dnl ========================================================
4660     CC="$_SUBDIR_CC"
4661     CXX="$_SUBDIR_CXX"
4662     CFLAGS="$_SUBDIR_CFLAGS"
4663     CPPFLAGS="$_SUBDIR_CPPFLAGS"
4664     CXXFLAGS="$_SUBDIR_CXXFLAGS"
4665     LDFLAGS="$_SUBDIR_LDFLAGS"
4666     HOST_CC="$_SUBDIR_HOST_CC"
4667     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4668     HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4669     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4670     RC=
4673 unset MAKEFILES
4674 unset CONFIG_FILES
4676 # Run all configure scripts specified by a subconfigure
4677 if test -n "$_subconfigure_subdir"; then
4678   _save_srcdir="$srcdir"
4679   srcdir="$srcdir/.."
4680   _save_ac_configure_args="$ac_configure_args"
4681   ac_configure_args="$_subconfigure_config_args"
4682   AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
4683   ac_configure_args="$_save_ac_configure_args"
4684   srcdir="$_save_srcdir"
4687 if test "$COMPILE_ENVIRONMENT" -a "$MOZ_WIDGET_TOOLKIT"; then
4690 dnl ========================================================
4691 dnl = Setup a nice relatively clean build environment for
4692 dnl = sub-configures.
4693 dnl ========================================================
4694 CC="$_SUBDIR_CC"
4695 CXX="$_SUBDIR_CXX"
4696 CFLAGS="$_SUBDIR_CFLAGS"
4697 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4698 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4699 LDFLAGS="$_SUBDIR_LDFLAGS"
4700 HOST_CC="$_SUBDIR_HOST_CC"
4701 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4702 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4703 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4706 # Run the SpiderMonkey 'configure' script.
4707 dist=$MOZ_BUILD_ROOT/dist
4708 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4710 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
4711 # and $NSPR_LIBS.
4712 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
4714 if test "$_INTL_API" = no; then
4715     ac_configure_args="$ac_configure_args --without-intl-api"
4718 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
4719     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
4720     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
4722 ac_configure_args="$ac_configure_args --prefix=$dist"
4723 if test -n "$ZLIB_IN_MOZGLUE"; then
4724    MOZ_ZLIB_LIBS=
4726 export MOZ_SYSTEM_ZLIB
4727 export MOZ_ZLIB_CFLAGS
4728 export MOZ_ZLIB_LIBS
4729 export MOZ_APP_NAME
4730 export MOZ_APP_REMOTINGNAME
4731 export MOZ_DEV_EDITION
4732 export RUSTC
4733 export MOZILLA_CENTRAL_PATH=$_topsrcdir
4734 export STLPORT_CPPFLAGS
4735 export STLPORT_LIBS
4736 unset MOZ_BUILD_APP
4737 export DIST
4738 export MOZ_LINKER
4739 export ZLIB_IN_MOZGLUE
4740 export AR
4741 export RANLIB
4742 export CPP
4743 export CC
4744 export CXX
4745 export ARFLAGS
4746 export CPPFLAGS
4747 export CFLAGS
4748 export CXXFLAGS
4749 export LDFLAGS
4750 export HOST_CC
4751 export HOST_CXX
4752 export HOST_CFLAGS
4753 export HOST_CPPFLAGS
4754 export HOST_CXXFLAGS
4755 export HOST_LDFLAGS
4757 if ! test -e js; then
4758     mkdir js
4761 ac_configure_args="$ac_configure_args JS_STANDALONE="
4762 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
4763 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4765 fi # COMPILE_ENVIRONMENT
4767 dnl we need to run config.status after js/src subconfigure because we're
4768 dnl traversing its moz.build and we need its config.status for that.
4769 dnl However, writing our own config.status needs to happen before
4770 dnl subconfigures because the setup surrounding subconfigures alters
4771 dnl many AC_SUBSTed variables.
4772 MOZ_RUN_ALL_SUBCONFIGURES()
4774 rm -fr confdefs* $ac_clean_files