Bug 1464197 [wpt PR 11147] - [css-contain] Disable paint containment in non-atomic...
[gecko.git] / old-configure.in
blobf391272819406cbb5ccbf5c5120844f323d9f366
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.24.0
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 -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         if test -n "$WIN_DIA_SDK_BIN_DIR"; then
233           if test ! -d "$WIN_DIA_SDK_BIN_DIR"; then
234             AC_MSG_ERROR([Invalid Windows DIA SDK directory: ${WIN_DIA_SDK_BIN_DIR}])
235           fi
236           WIN_DIA_SDK_BIN_DIR=`cd "$WIN_DIA_SDK_BIN_DIR" && pwd -W`
237         fi
239         AC_SUBST(MSVC_HAS_DIA_SDK)
240         AC_SUBST(MSVC_C_RUNTIME_DLL)
241         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
243         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
245         if test -n "$WIN32_REDIST_DIR"; then
246           if test ! -d "$WIN32_REDIST_DIR"; then
247             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
248           fi
249           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
250         fi
252         # Check linker version, except in lld builds
253         case "$LINKER" in
254         *lld*)
255             ;;
256         *)
257             _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
258             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
259             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
260                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
261             fi
262             ;;
263         esac
265         INCREMENTAL_LINKER=1
267         # Set midl environment
268         case "$target" in
269         i*86-*)
270             MIDL_FLAGS="${MIDL_FLAGS} -env win32"
271             ;;
272         x86_64-*)
273             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
274             ;;
275         esac
277         unset _MSVC_VER_FILTER
279         AC_CACHE_CHECK(for overridable _RAISE,
280                        ac_cv_have__RAISE,
281             [
282                 AC_LANG_SAVE
283                 AC_LANG_CPLUSPLUS
284                 _SAVE_CXXFLAGS="$CXXFLAGS"
285                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
286                 AC_TRY_COMPILE([#include <xstddef>
287                                 #undef _RAISE
288                                 #define _RAISE(x) externallyDefinedFunction((x).what())
289                                 #include <vector>
290                                ],
291                                [std::vector<int> v; return v.at(1);],
292                                ac_cv_have__RAISE="no",
293                                ac_cv_have__RAISE="yes")
294                 CXXFLAGS="$_SAVE_CXXFLAGS"
295                 AC_LANG_RESTORE
296             ])
297         if test "$ac_cv_have__RAISE" = "yes"; then
298             WRAP_STL_INCLUDES=1
299             MOZ_MSVC_STL_WRAP_RAISE=1
300             AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
301         else
302             AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
303         fi
305         if test "$WRAP_STL_INCLUDES" = "1"; then
306             STL_FLAGS="-I${DIST}/stl_wrappers"
307         fi
308         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
309         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
310     else
311         # Check w32api version
312         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
313         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
314         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
315         AC_TRY_COMPILE([#include <w32api.h>],
316             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
317                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
318                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
319                 #error "test failed."
320             #endif
321             , [ res=yes ], [ res=no ])
322         AC_MSG_RESULT([$res])
323         if test "$res" != "yes"; then
324             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
325         fi
326         # Check windres version
327         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
328         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
329         AC_MSG_RESULT([$_WINDRES_VERSION])
330         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
331         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
332         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
333         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
334         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
335         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
336         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
337                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
338                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
339                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
340                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
341                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
342         then
343             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
344         fi
346         AC_CHECK_PROGS(MIDL, $target-widl widl)
347         if test -n "$MIDL"; then
348             case "$target" in
349             i*86-*)
350                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
351                 ;;
352             x86_64-*)
353                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
354                 ;;
355             esac
356         fi
358         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
359         # causing problems with local implementations with the same name.
360         AC_DEFINE(STRSAFE_NO_DEPRECATE)
361     fi # !GNU_CC
363     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
364     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
365     # Require OS features provided by IE 8.0 (Win7)
366     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
368     ;;
369 esac
371 if test -n "$_WIN32_MSVC"; then
372     SKIP_PATH_CHECKS=1
373     SKIP_COMPILER_CHECKS=1
374     SKIP_LIBRARY_CHECKS=1
376     # Since we're skipping compiler and library checks, hard-code
377     # some facts here.
378     AC_DEFINE(HAVE_IO_H)
379     AC_DEFINE(HAVE_ISATTY)
382 fi # COMPILE_ENVIRONMENT
384 AC_SUBST(MIDL_FLAGS)
385 AC_SUBST(_MSC_VER)
387 AC_SUBST(GNU_AS)
388 AC_SUBST(GNU_CC)
389 AC_SUBST(GNU_CXX)
391 AC_SUBST_LIST(STL_FLAGS)
392 AC_SUBST(WRAP_STL_INCLUDES)
393 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
395 dnl ========================================================
396 dnl Checks for programs.
397 dnl ========================================================
398 if test "$COMPILE_ENVIRONMENT"; then
400 dnl ========================================================
401 dnl = Mac OS X SDK support
402 dnl ========================================================
403 MACOS_SDK_DIR=
404 MOZ_ARG_WITH_STRING(macos-sdk,
405 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
406     MACOS_SDK_DIR=$withval)
408 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
409 MOZ_ARG_WITH_STRING(macos-private-frameworks,
410 [  --with-macos-private-frameworks=dir    Location of private frameworks to use (Mac OS X only)],
411     MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
412     MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
413     MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
415 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
416   if test -z "$CROSS_COMPILE"; then
417     AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
418   fi
419   if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
420     AC_MSG_ERROR([PrivateFrameworks directory not found.])
421   fi
424 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
425 AC_SUBST(MACOS_SDK_DIR)
426 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
428 if test "$MACOS_SDK_DIR"; then
429   dnl Sync this section with the ones in NSPR and NSS.
430   dnl Changes to the cross environment here need to be accounted for in
431   dnl the libIDL checks (below) and xpidl build.
433   if test ! -d "$MACOS_SDK_DIR"; then
434     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
435 specify a valid SDK.  SDKs are installed when the optional cross-development
436 tools are selected during the Xcode/Developer Tools installation.])
437   fi
439   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
440   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
442   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
443   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
444   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
446   AC_LANG_SAVE
447   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
448   AC_LANG_CPLUSPLUS
449   AC_TRY_COMPILE([#include <new>],[],
450    result=yes,
451    result=no)
452   AC_LANG_RESTORE
453   AC_MSG_RESULT($result)
455   if test "$result" = "no" ; then
456     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
457   fi
460 AC_PATH_XTRA
462 XCFLAGS="$X_CFLAGS"
464 fi # COMPILE_ENVIRONMENT
466 dnl ========================================================
467 dnl set the defaults first
468 dnl ========================================================
469 AS_BIN=$AS
470 AR_EXTRACT='$(AR) x'
471 AS='$(CC)'
472 AS_DASH_C_FLAG='-c'
473 MOZ_USER_DIR=".mozilla"
475 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
477 MOZ_FS_LAYOUT=unix
479 dnl Configure platform-specific CPU architecture compiler options.
480 dnl ==============================================================
481 if test "$COMPILE_ENVIRONMENT"; then
482     MOZ_ARCH_OPTS
483 else
484     if test "$OS_TARGET" = Android; then
485         dnl Default Android builds to ARMv7.
486         MOZ_ARCH=armv7-a
487     fi
488 fi # COMPILE_ENVIRONMENT
490 dnl ========================================================
491 dnl Android libstdc++, placed here so it can use MOZ_ARCH
492 dnl computed above.
493 dnl ========================================================
495 MOZ_ANDROID_CPU_ARCH
496 if test "$COMPILE_ENVIRONMENT"; then
497     MOZ_ANDROID_STLPORT
498 fi # COMPILE_ENVIRONMENT
500 dnl ========================================================
501 dnl Suppress Clang Argument Warnings
502 dnl ========================================================
503 if test -n "${CLANG_CC}${CLANG_CL}"; then
504     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
505     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
507 if test -n "${CLANG_CXX}${CLANG_CL}"; then
508     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
511 if test -n "$COMPILE_ENVIRONMENT"; then
512    MOZ_CONFIG_SANITIZE
515 dnl ========================================================
516 dnl Add optional and non-optional hardening flags
517 dnl ========================================================
519 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
520 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
521 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
523 dnl ========================================================
524 dnl GNU specific defaults
525 dnl ========================================================
526 if test "$GNU_CC"; then
527     MMX_FLAGS="-mmmx"
528     SSE_FLAGS="-msse"
529     SSE2_FLAGS="-msse2"
530     SSSE3_FLAGS="-mssse3"
531     # FIXME: Let us build with strict aliasing. bug 414641.
532     CFLAGS="$CFLAGS -fno-strict-aliasing"
533     MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
534     MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
535     WARNINGS_AS_ERRORS='-Werror'
536     DSO_CFLAGS=''
537     DSO_PIC_CFLAGS='-fPIC'
538     ASFLAGS="$ASFLAGS -fPIC"
539     AC_MSG_CHECKING([for --noexecstack option to as])
540     _SAVE_CFLAGS=$CFLAGS
541     CFLAGS="$CFLAGS -Wa,--noexecstack"
542     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
543                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
544                      AC_MSG_RESULT([no]))
545     CFLAGS=$_SAVE_CFLAGS
546     AC_MSG_CHECKING([for -z noexecstack option to ld])
547     _SAVE_LDFLAGS=$LDFLAGS
548     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
549     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
550                   AC_MSG_RESULT([no])
551                   LDFLAGS=$_SAVE_LDFLAGS)
553     AC_MSG_CHECKING([for -z text option to ld])
554     _SAVE_LDFLAGS=$LDFLAGS
555     LDFLAGS="$LDFLAGS -Wl,-z,text"
556     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
557                   AC_MSG_RESULT([no])
558                   LDFLAGS=$_SAVE_LDFLAGS)
560     AC_MSG_CHECKING([for -z relro option to ld])
561     _SAVE_LDFLAGS=$LDFLAGS
562     LDFLAGS="$LDFLAGS -Wl,-z,relro"
563     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
564                   AC_MSG_RESULT([no])
565                   LDFLAGS=$_SAVE_LDFLAGS)
567     AC_MSG_CHECKING([for --build-id option to ld])
568     _SAVE_LDFLAGS=$LDFLAGS
569     LDFLAGS="$LDFLAGS -Wl,--build-id"
570     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
571                   AC_MSG_RESULT([no])
572                   LDFLAGS=$_SAVE_LDFLAGS)
574     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
575     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
576     _SAVE_LDFLAGS=$LDFLAGS
577     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
578     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
579                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
580                   AC_MSG_RESULT([no]))
581     LDFLAGS=$_SAVE_LDFLAGS
583     # Check for -mssse3 on $CC
584     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
585     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
586     _SAVE_CFLAGS=$CFLAGS
587     CFLAGS="$CFLAGS -mssse3"
588     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
589                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
590                      AC_MSG_RESULT([no]))
591     CFLAGS=$_SAVE_CFLAGS
593     # Check for -msse4.1 on $CC
594     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
595     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
596     _SAVE_CFLAGS=$CFLAGS
597     CFLAGS="$CFLAGS -msse4.1"
598     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
599                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
600                      AC_MSG_RESULT([no]))
601     CFLAGS=$_SAVE_CFLAGS
603     case "${CPU_ARCH}" in
604     x86 | x86_64)
605       AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
606       AC_TRY_COMPILE([],
607                      [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
608                      result="yes", result="no")
609       AC_MSG_RESULT("$result")
610       if test "$result" = "yes"; then
611           HAVE_X86_AVX2=1
612       fi
613       ;;
615     ppc*)
616       AC_MSG_CHECKING([whether we can enable AltiVec support])
617       HAVE_ALTIVEC=
618       _SAVE_CFLAGS=$CFLAGS
619       CFLAGS="$CFLAGS -maltivec"
620       AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
621                        [HAVE_ALTIVEC=1],
622                        AC_MSG_RESULT([no]))
623       CFLAGS=$_SAVE_CFLAGS
624       ;;
625     esac
627     DSO_LDOPTS='-shared'
628     if test "$GCC_USE_GNU_LD"; then
629         # Some tools like ASan use a runtime library that is only
630         # linked against executables, so we must allow undefined
631         # symbols for shared objects in some cases.
632         if test -z "$MOZ_NO_WLZDEFS"; then
633             # Don't allow undefined symbols in libraries
634             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
636             # BSDs need `environ' exposed for posix_spawn (bug 753046)
637             case "$OS_TARGET" in
638             DragonFly|FreeBSD|NetBSD|OpenBSD)
639                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
640                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
641                 else
642                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
643                 fi
644                 ;;
645             esac
646         fi
647     fi
649     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
650     _USE_CPP_INCLUDE_FLAG=1
652     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
655 if test "$GNU_CXX"; then
656     # FIXME: Let us build with strict aliasing. bug 414641.
657     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
659     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
660     _USE_CPP_INCLUDE_FLAG=1
663 # For profiling builds keep the symbol information
664 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
665     case "$OS_TARGET" in
666     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
667         STRIP_FLAGS="--strip-debug"
668         ;;
669     esac
672 dnl ========================================================
673 dnl = Enable DMD
674 dnl ========================================================
676 if test "$MOZ_DMD"; then
677     if test "${CPU_ARCH}" = "arm"; then
678         CFLAGS="$CFLAGS -funwind-tables"
679         CXXFLAGS="$CXXFLAGS -funwind-tables"
680     fi
683 dnl ========================================================
684 dnl System overrides of the defaults for host
685 dnl ========================================================
686 case "$host" in
687 *mingw*)
688     if test -n "$_WIN32_MSVC"; then
689         HOST_AR=lib
690         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
691         HOST_CFLAGS="$HOST_CFLAGS -nologo"
692         HOST_RANLIB='echo ranlib'
693     else
694         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
695     fi
696     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
697     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
698     HOST_BIN_SUFFIX=.exe
700     case "${host_cpu}" in
701     i*86)
702         if test -n "$_WIN32_MSVC"; then
703             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
704         fi
705         ;;
706     x86_64)
707         if test -n "$_WIN32_MSVC"; then
708             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
709         fi
710         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
711         ;;
712     esac
713     ;;
715 *-darwin*)
716     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
717     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
718     ;;
720 *-linux*|*-kfreebsd*-gnu|*-gnu*)
721     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
722     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
723     ;;
726     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
727     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
728     ;;
729 esac
731 dnl Get version of various core apps from the version files.
732 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
733 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
735 if test -z "$FIREFOX_VERSION"; then
736     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
739 if test -z "$FIREFOX_VERSION_DISPLAY"; then
740     AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
743 MOZ_DOING_LTO(lto_is_enabled)
745 dnl ========================================================
746 dnl System overrides of the defaults for target
747 dnl ========================================================
749 case "$target" in
750 *-darwin*)
751     MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
752     MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
753     MOZ_OPTIMIZE_FLAGS="-O3"
754     CXXFLAGS="$CXXFLAGS -stdlib=libc++"
755     DSO_LDOPTS=''
756     STRIP_FLAGS="$STRIP_FLAGS -x -S"
757     # Ensure that if we're targeting iOS an SDK was provided.
758     AC_CACHE_CHECK(for iOS target,
759                    ac_cv_ios_target,
760                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
761 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
762 #error not iOS
763 #endif],
764                                    [],
765                                    ac_cv_ios_target="yes",
766                                    ac_cv_ios_target="no")])
767     if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
768        AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
769     fi
770     if test -n "$MOZ_IOS"; then
771         direct_nspr_config=1
772     else
773         # The ExceptionHandling framework is needed for Objective-C exception
774         # logging code in nsObjCExceptions.h. Currently we only use that in debug
775         # builds.
776         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
777     fi
779     if test "x$lto_is_enabled" = "xyes"; then
780         echo "Skipping -dead_strip because lto is enabled."
781     dnl DTrace and -dead_strip don't interact well. See bug 403132.
782     dnl ===================================================================
783     elif test "x$enable_dtrace" = "xyes"; then
784         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
785     else
786         dnl check for the presence of the -dead_strip linker flag
787         AC_MSG_CHECKING([for -dead_strip option to ld])
788         _SAVE_LDFLAGS=$LDFLAGS
789         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
790         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
791         if test -n "$_HAVE_DEAD_STRIP" ; then
792             AC_MSG_RESULT([yes])
793             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
794         else
795             AC_MSG_RESULT([no])
796         fi
798         LDFLAGS=$_SAVE_LDFLAGS
799     fi
801     MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
802     ;;
804 *-android*|*-linuxandroid*)
805     AC_DEFINE(NO_PW_GECOS)
807     if test "$COMPILE_ENVIRONMENT"; then
808         MOZ_LINKER=1
809     fi
811     MOZ_GFX_OPTIMIZE_MOBILE=1
812     if test -z "$CLANG_CC"; then
813         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
814     else
815         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
816         # -Oz is smaller than -Os on clang.
817         MOZ_OPTIMIZE_FLAGS="-Oz"
818     fi
819     ;;
821 *-*linux*)
822     if test "$GNU_CC" -o "$GNU_CXX"; then
823         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
824         if test -n "$MOZ_DEBUG"; then
825             MOZ_OPTIMIZE_FLAGS="-Os"
826         else
827             MOZ_OPTIMIZE_FLAGS="-O2"
828         fi
829         if test -z "$CLANG_CC"; then
830            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
831         fi
832     fi
834     case "${target_cpu}" in
835     alpha*)
836         CFLAGS="$CFLAGS -mieee"
837         CXXFLAGS="$CXXFLAGS -mieee"
838     ;;
839     esac
840     ;;
841 *-mingw*)
842     DSO_CFLAGS=
843     DSO_PIC_CFLAGS=
844     RC=rc.exe
845     # certain versions of cygwin's makedepend barf on the
846     # #include <string> vs -I./dist/include/string issue so don't use it
847     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
848         CC="$CC -mwindows"
849         CXX="$CXX -mwindows"
850         CPP="$CPP -mwindows"
851         CFLAGS="$CFLAGS -mms-bitfields"
852         CXXFLAGS="$CXXFLAGS -mms-bitfields"
853         DSO_LDOPTS='-shared'
854         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
855         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
856         RC='$(WINDRES)'
857         # Use static libgcc and libstdc++
858         LDFLAGS="$LDFLAGS -static"
859         # Use temp file for windres (bug 213281)
860         RCFLAGS='-O coff --use-temp-file'
861         # mingw doesn't require kernel32, user32, and advapi32 explicitly
862         LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
863         MOZ_FIX_LINK_PATHS=
865         MOZ_OPTIMIZE_FLAGS="-O1"
867         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
868         WIN32_GUI_EXE_LDFLAGS=-mwindows
870         # GCC/binutils can't link to a function if we try to include dllexport function
871         # in the same library as dllimport caller. To work around it, we build NSPR
872         # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
873         # function thunks need to be generated for cross-DLL calls.
874         MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
875     else
876         TARGET_COMPILER_ABI=msvc
877         if test "$AS_BIN"; then
878             AS="$(basename "$AS_BIN")"
879         fi
880         AR='lib'
881         AR_FLAGS='-NOLOGO -OUT:$@'
882         AR_EXTRACT=
883         RANLIB='echo not_ranlib'
884         STRIP='echo not_strip'
885         PKG_SKIP_STRIP=1
886         MKSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
887         MKCSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
888         WIN32_SUBSYSTEM_VERSION=6.01
889         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
890         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
891         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
892         _USE_CPP_INCLUDE_FLAG=1
893         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
894         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
895         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
896         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
897         if test -z "$CLANG_CL"; then
898             CPPFLAGS="$CPPFLAGS -utf-8"
899         fi
900         if test "$CPU_ARCH" = "x86"; then
901             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
902             dnl more recent, so set that explicitly here unless another
903             dnl target arch has already been set.
904             changequote(,)
905             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
906               CFLAGS="$CFLAGS -arch:SSE2"
907             fi
908             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
909               CXXFLAGS="$CXXFLAGS -arch:SSE2"
910             fi
911             changequote([,])
912             SSE_FLAGS="-arch:SSE"
913             SSE2_FLAGS="-arch:SSE2"
914             dnl MSVC allows the use of intrinsics without any flags
915             dnl and doesn't have a separate arch for SSSE3
916             SSSE3_FLAGS="-arch:SSE2"
917         fi
918         dnl clang-cl requires appropriate flags to enable SSSE3 support
919         dnl on all architectures.
920         if test -n "$CLANG_CL"; then
921             SSSE3_FLAGS="-mssse3"
922         fi
923         dnl VS2013+ supports -Gw for better linker optimizations.
924         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
925         dnl Disabled on ASan because it causes false-positive ODR violations.
926         if test -z "$MOZ_ASAN"; then
927             CFLAGS="$CFLAGS -Gw"
928             CXXFLAGS="$CXXFLAGS -Gw"
929         fi
930         # khuey says we can safely ignore MSVC warning C4251
931         # MSVC warning C4244 (implicit type conversion may lose data) warns
932         # and requires workarounds for perfectly valid code.  Also, GCC/clang
933         # don't warn about it by default. So for consistency/sanity, we turn
934         # it off on MSVC, too.
935         # MSVC warning C4267 warns for narrowing type conversions from size_t
936         # to 32-bit integer types on 64-bit platforms.  Since this is virtually
937         # the same thing as C4244, we disable C4267, too.
938         # MSVC warning C4800 warns when a value is implicitly cast to bool,
939         # because this also forces narrowing to a single byte, which can be a
940         # perf hit.  But this matters so little in practice (and often we want
941         # that behavior) that it's better to turn it off.
942         # MSVC warning C4595 warns non-member operator new or delete functions
943         # may not be declared inline, as of VS2015 Update 2.
944         CFLAGS="$CFLAGS -wd4244 -wd4267"
945         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
946         # Silence "warning C4065: switch statement contains 'default' but no
947         # 'case' labels".  See bug 1461304.
948         CXXFLAGS="$CXXFLAGS -wd4065"
949         if test -n "$CLANG_CL"; then
950             # XXX We should combine some of these with our generic GCC-style
951             # warning checks.
952             #
953             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
954             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
955             # We use offsetof on non-POD objects all the time.
956             # We also suppress this warning on other platforms.
957             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
958             # This warns for reasonable things like:
959             #   enum { X = 0xffffffffU };
960             # which is annoying for IDL headers.
961             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
962             # This warns for cases that would be reached by the Microsoft
963             # #include rules, but also currently warns on cases that would
964             # *also* be reached by standard C++ include rules.  That
965             # behavior doesn't seem useful, so we turn it off.
966             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
967             # We normally error out on unknown pragmas, but since clang-cl
968             # claims to be MSVC, it would be difficult to add
969             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
970             # use such pragmas, so just ignore them.
971             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
972             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
973             # We get errors about various #pragma intrinsic directives from
974             # clang-cl, and we don't need to hear about those.
975             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
976             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
977             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
978             # as __attribute((__deprecated__)).  This is nice to know,
979             # but since we don't get the equivalent warning from MSVC,
980             # let's just ignore it.
981             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
982             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
983             # We use a function like:
984             #   __declspec(noreturn) __inline void f() {}
985             # which -Winvalid-noreturn complains about.  Again, MSVC seems
986             # OK with it, so let's silence the warning.
987             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
988             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
989             # Missing |override| on virtual function declarations isn't
990             # something that MSVC currently warns about.
991             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
992             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
993             # declaration on |operator delete(void*)|.  However, clang-cl
994             # must internally declare |operator delete(void*)| differently,
995             # which causes this warning for virtually every file in the
996             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
997             # so there doesn't seem to be any way to convince clang-cl to
998             # declare |delete| differently.  Therefore, suppress this
999             # warning.
1000             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1001             # At least one MSVC header and several headers in-tree have
1002             # unused typedefs, so turn this on.
1003             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1004             # jemalloc uses __declspec(allocator) as a profiler hint,
1005             # which clang-cl doesn't understand.
1006             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1007         fi
1008         # make 'foo == bar;' error out
1009         CFLAGS="$CFLAGS -we4553"
1010         CXXFLAGS="$CXXFLAGS -we4553"
1011         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
1012         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
1013         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1014         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1015         WARNINGS_AS_ERRORS='-WX'
1016         # Use a higher optimization level for clang-cl, so we can come closer
1017         # to MSVC's performance numbers (see bug 1443590).
1018         if test -n "$CLANG_CL"; then
1019             MOZ_OPTIMIZE_FLAGS='-O2'
1020         else
1021             MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1022         fi
1023         MOZ_FIX_LINK_PATHS=
1024         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1025         if test -z "$DEVELOPER_OPTIONS"; then
1026             LDFLAGS="$LDFLAGS -RELEASE"
1027         fi
1028         LDFLAGS="$LDFLAGS -DYNAMICBASE"
1029         RCFLAGS="-nologo"
1030         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1031         dnl both SSSE3 and SSE4.1.
1032         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1033         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1034         dnl allow AVX2 code from VS2015
1035         HAVE_X86_AVX2=1
1036     fi
1037     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1038     dnl See http://support.microsoft.com/kb/143208 to use STL
1039     AC_DEFINE(NOMINMAX)
1040     BIN_SUFFIX='.exe'
1041     MOZ_USER_DIR="Mozilla"
1043     case "$host_os" in
1044     cygwin*|msvc*|mks*)
1045         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.])
1046         ;;
1047     esac
1049     if test -n "$GNU_CC"; then
1050         CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
1051         CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
1052     fi
1054     case "$target" in
1055     i*86-*)
1056         if test -n "$GNU_CC"; then
1057             CFLAGS="$CFLAGS -mstackrealign"
1058             CXXFLAGS="$CXXFLAGS -mstackrealign"
1059             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1060         else
1061             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1062             LDFLAGS="$LDFLAGS -SAFESEH"
1063         fi
1065         AC_DEFINE(_X86_)
1066         ;;
1067     x86_64-*)
1068         if test -n "$_WIN32_MSVC"; then
1069             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1070         fi
1071         AC_DEFINE(_AMD64_)
1072         ;;
1073     *)
1074         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1075         ;;
1076     esac
1077     ;;
1079 *-netbsd*)
1080     DSO_CFLAGS=''
1081     CFLAGS="$CFLAGS -Dunix"
1082     CXXFLAGS="$CXXFLAGS -Dunix"
1083     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1084         DSO_PIC_CFLAGS='-fPIC -DPIC'
1085         DSO_LDOPTS='-shared'
1086         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
1087     else
1088         DSO_PIC_CFLAGS='-fPIC -DPIC'
1089         DSO_LDOPTS='-shared'
1090     fi
1091     # This will fail on a.out systems prior to 1.5.1_ALPHA.
1092     if test "$LIBRUNPATH"; then
1093         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1094     fi
1095     MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1096     MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1097     ;;
1099 *-openbsd*)
1100     if test -z "$X11BASE"; then
1101         X11BASE=/usr/X11R6
1102     fi
1103     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1104     DSO_CFLAGS=''
1105     DSO_PIC_CFLAGS='-fPIC'
1106     DSO_LDOPTS='-shared -fPIC'
1107     if test "$LIBRUNPATH"; then
1108         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1109     fi
1110     ;;
1112 *-solaris*)
1113     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
1114     ;;
1116 esac
1118 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
1119     MOZ_OPTIMIZE_FLAGS="-O"
1122 AC_SUBST_LIST(MMX_FLAGS)
1123 AC_SUBST_LIST(SSE_FLAGS)
1124 AC_SUBST_LIST(SSE2_FLAGS)
1125 AC_SUBST_LIST(SSSE3_FLAGS)
1127 AC_SUBST(MOZ_LINKER)
1128 if test -n "$MOZ_LINKER"; then
1129   AC_DEFINE(MOZ_LINKER)
1130   MOZ_LINKER_EXTRACT=1
1131   AC_CHECK_PROGS(XZ, xz)
1134 if test -z "$COMPILE_ENVIRONMENT"; then
1135     SKIP_COMPILER_CHECKS=1
1136     SKIP_LIBRARY_CHECKS=1
1137     PKG_SKIP_STRIP=1
1138     MOZ_DEBUGGING_OPTS
1139 else
1140     MOZ_COMPILER_OPTS
1141 fi # COMPILE_ENVIRONMENT
1143 if test -z "$SKIP_COMPILER_CHECKS"; then
1144 dnl Checks for typedefs, structures, and compiler characteristics.
1145 dnl ========================================================
1146 AC_C_CONST
1147 AC_TYPE_MODE_T
1148 AC_TYPE_OFF_T
1149 AC_TYPE_PID_T
1150 AC_TYPE_SIZE_T
1151 AC_LANG_CPLUSPLUS
1152 AC_LANG_C
1154 AC_LANG_CPLUSPLUS
1156 MOZ_CXX11
1158 AC_LANG_C
1160 case "${OS_TARGET}" in
1161 Darwin)
1162   ;;
1164   STL_FLAGS="-I${DIST}/stl_wrappers"
1165   WRAP_STL_INCLUDES=1
1166   ;;
1167 esac
1169 dnl Checks for header files.
1170 dnl ========================================================
1171 AC_HEADER_DIRENT
1172 case "$target_os" in
1173 bitrig*|dragonfly*|freebsd*|openbsd*)
1174 # for stuff like -lXshm
1175     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1176     ;;
1177 esac
1179 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1180 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1181                    ac_cv_sockaddr_in_sin_len,
1182                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1183                                     #include <sys/types.h>
1184                                     #endif
1185                                     #include <netinet/in.h>
1186                                     struct sockaddr_in x;
1187                                     void *foo = (void*) &x.sin_len;],
1188                                    [],
1189                                    [ac_cv_sockaddr_in_sin_len=true],
1190                                    [ac_cv_sockaddr_in_sin_len=false])])
1191 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1192   AC_DEFINE(HAVE_SIN_LEN)
1193 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1194   AC_DEFINE(HAVE_SCONN_LEN)
1197 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1198                ac_cv_sockaddr_in6_sin6_len,
1199                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1200                                 #include <sys/types.h>
1201                                 #endif
1202                                 #include <netinet/in.h>
1203                                 struct sockaddr_in6 x;
1204                                 void *foo = (void*) &x.sin6_len;],
1205                                [],
1206                                [ac_cv_sockaddr_in6_sin6_len=true],
1207                                [ac_cv_sockaddr_in6_sin6_len=false])])
1208 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1209   AC_DEFINE(HAVE_SIN6_LEN)
1212 AC_CACHE_CHECK(for sockaddr.sa_len,
1213                ac_cv_sockaddr_sa_len,
1214                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1215                                 #include <sys/types.h>
1216                                 #endif
1217                                 #include <sys/socket.h>
1218                                 struct sockaddr x;
1219                                 void *foo = (void*) &x.sa_len;],
1220                                [],
1221                                [ac_cv_sockaddr_sa_len=true],
1222                                [ac_cv_sockaddr_sa_len=false])])
1223 if test "$ac_cv_sockaddr_sa_len" = true ; then
1224   AC_DEFINE(HAVE_SA_LEN)
1227 MOZ_ARG_ENABLE_BOOL(dtrace,
1228               [  --enable-dtrace         build with dtrace support if available (default=no)],
1229               [enable_dtrace="yes"],)
1230 if test "x$enable_dtrace" = "xyes"; then
1231   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1232   if test -n "$HAVE_DTRACE"; then
1233       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1234   else
1235       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1236   fi
1238 AC_SUBST(HAVE_DTRACE)
1240 dnl Checks for libraries.
1241 dnl ========================================================
1242 AC_CHECK_LIB(c_r, gethostbyname_r)
1244 dnl We don't want to link with libdl even if it's present on OS X, since
1245 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1246 dnl in libc.
1247 dnl We don't want to link against libm or libpthread on Darwin since
1248 dnl they both are just symlinks to libSystem and explicitly linking
1249 dnl against libSystem causes issues when debugging (see bug 299601).
1250 case $target in
1251 *-darwin*)
1252     ;;
1254     AC_SEARCH_LIBS(dlopen, dl,
1255         MOZ_CHECK_HEADER(dlfcn.h,
1256         AC_DEFINE(HAVE_DLOPEN)))
1257     ;;
1258 esac
1260 _SAVE_CFLAGS="$CFLAGS"
1261 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1262 AC_CHECK_FUNCS(dladdr memmem)
1263 CFLAGS="$_SAVE_CFLAGS"
1265 if test ! "$GNU_CXX"; then
1266     AC_CHECK_LIB(C, demangle)
1269 AC_CHECK_LIB(socket, socket)
1271 XLDFLAGS="$X_LIBS"
1272 XLIBS="$X_EXTRA_LIBS"
1274 dnl ========================================================
1275 dnl Checks for X libraries.
1276 dnl Ordering is important.
1277 dnl Xt is dependent upon SM as of X11R6
1278 dnl ========================================================
1279 if test -n "$MOZ_X11"; then
1280     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1281     _SAVE_LDFLAGS="$LDFLAGS"
1282     _SAVE_LIBS="$LIBS"
1283     LDFLAGS="$XLDFLAGS $LDFLAGS"
1284     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1285         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1286     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1287         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1289     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1290         unset ac_cv_lib_Xt_XtFree
1291         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1292         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1293         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1294             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1295         ])
1297     dnl ========================================================
1298     dnl = Check for xcb
1299     dnl ========================================================
1300     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1301         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1302     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1303         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1304     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1305         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1307     LDFLAGS="$_SAVE_LDFLAGS"
1308     LIBS="$_SAVE_LIBS"
1309 fi # $MOZ_X11
1311 AC_SUBST_LIST(XCFLAGS)
1312 AC_SUBST_LIST(XLDFLAGS)
1313 AC_SUBST_LIST(XLIBS)
1314 AC_SUBST_LIST(XEXT_LIBS)
1315 AC_SUBST_LIST(XT_LIBS)
1317 dnl ========================================================
1318 dnl = pthread support
1319 dnl = Start by checking whether the system support pthreads
1320 dnl ========================================================
1321 case "$target_os" in
1322 darwin*)
1323     MOZ_USE_PTHREADS=1
1324     ;;
1326     AC_CHECK_LIB(pthreads, pthread_create,
1327         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1328         AC_CHECK_LIB(pthread, pthread_create,
1329             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1330             AC_CHECK_LIB(c_r, pthread_create,
1331                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1332                 AC_CHECK_LIB(c, pthread_create,
1333                     MOZ_USE_PTHREADS=1
1334                 )
1335             )
1336         )
1337     )
1338     ;;
1339 esac
1341 dnl ========================================================
1342 dnl Do the platform specific pthread hackery
1343 dnl ========================================================
1344 if test "$MOZ_USE_PTHREADS"x != x
1345 then
1346     dnl
1347     dnl See if -pthread is supported.
1348     dnl
1349     rm -f conftest*
1350     ac_cv_have_dash_pthread=no
1351     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1352     echo 'int main() { return 0; }' | cat > conftest.c
1353     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1354     if test $? -eq 0; then
1355         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1356             ac_cv_have_dash_pthread=yes
1357             case "$target_os" in
1358             freebsd*)
1359 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1360                 ;;
1361             *)
1362                 CFLAGS="$CFLAGS -pthread"
1363                 CXXFLAGS="$CXXFLAGS -pthread"
1364                 ;;
1365             esac
1366         fi
1367     fi
1368     rm -f conftest*
1369     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1371     dnl
1372     dnl See if -pthreads is supported.
1373     dnl
1374     ac_cv_have_dash_pthreads=no
1375     if test "$ac_cv_have_dash_pthread" = "no"; then
1376         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1377         echo 'int main() { return 0; }' | cat > conftest.c
1378         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1379         if test $? -eq 0; then
1380             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1381                 ac_cv_have_dash_pthreads=yes
1382                 CFLAGS="$CFLAGS -pthreads"
1383                 CXXFLAGS="$CXXFLAGS -pthreads"
1384             fi
1385         fi
1386         rm -f conftest*
1387         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1388     fi
1390     case "$target" in
1391         *-*-freebsd*)
1392             AC_DEFINE(_REENTRANT)
1393             AC_DEFINE(_THREAD_SAFE)
1394             dnl -pthread links in -lpthread, so don't specify it explicitly.
1395             if test "$ac_cv_have_dash_pthread" = "yes"; then
1396                 _PTHREAD_LDFLAGS="-pthread"
1397             fi
1398             ;;
1400         *-*-openbsd*|*-*-bsdi*)
1401             AC_DEFINE(_REENTRANT)
1402             AC_DEFINE(_THREAD_SAFE)
1403             dnl -pthread links in -lc_r, so don't specify it explicitly.
1404             if test "$ac_cv_have_dash_pthread" = "yes"; then
1405                 _PTHREAD_LDFLAGS="-pthread"
1406             fi
1407             ;;
1409         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1410             AC_DEFINE(_REENTRANT)
1411             ;;
1413     esac
1414     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1415     AC_SUBST(MOZ_USE_PTHREADS)
1416     MOZ_CHECK_HEADERS(pthread.h)
1420 dnl Checks for library functions.
1421 dnl ========================================================
1422 AC_PROG_GCC_TRADITIONAL
1423 AC_FUNC_MEMCMP
1424 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1426 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1427 dnl avoid this on Darwin, since depending on your system config, we may think
1428 dnl it exists but it really doesn't
1429 case "$OS_TARGET" in
1430 Darwin)
1431   ;;
1433   AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1434                  ac_cv_clock_monotonic,
1435                  [for libs in "" -lrt; do
1436                       _SAVE_LIBS="$LIBS"
1437                       LIBS="$LIBS $libs"
1438                       AC_TRY_LINK([#include <time.h>],
1439                                    [ struct timespec ts;
1440                                      clock_gettime(CLOCK_MONOTONIC, &ts); ],
1441                                    ac_cv_clock_monotonic=$libs
1442                                    LIBS="$_SAVE_LIBS"
1443                                    break,
1444                                    ac_cv_clock_monotonic=no)
1445                       LIBS="$_SAVE_LIBS"
1446                   done])
1447   if test "$ac_cv_clock_monotonic" != "no"; then
1448       HAVE_CLOCK_MONOTONIC=1
1449       REALTIME_LIBS=$ac_cv_clock_monotonic
1450       AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1451       AC_SUBST(HAVE_CLOCK_MONOTONIC)
1452       AC_SUBST_LIST(REALTIME_LIBS)
1453   fi
1454   ;;
1455 esac
1457 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1458                ac_cv_pthread_cond_timedwait_monotonic_np,
1459                AC_TRY_LINK([#include <pthread.h>],
1460                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1461                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1462                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1463 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1464     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1467 AC_CACHE_CHECK(
1468     [for res_ninit()],
1469     ac_cv_func_res_ninit,
1470     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1471         dnl no need for res_ninit() on NetBSD and OpenBSD
1472         ac_cv_func_res_ninit=no
1473      else
1474         AC_TRY_LINK([
1475             #ifdef linux
1476             #define _BSD_SOURCE 1
1477             #endif
1478             #include <sys/types.h>
1479             #include <netinet/in.h>
1480             #include <arpa/nameser.h>
1481             #include <resolv.h>
1482             ],
1483             [int foo = res_ninit(&_res);],
1484             [ac_cv_func_res_ninit=yes],
1485             [ac_cv_func_res_ninit=no])
1486      fi
1487     ])
1489 if test "$ac_cv_func_res_ninit" = "yes"; then
1490     AC_DEFINE(HAVE_RES_NINIT)
1491 dnl must add the link line we do something as foolish as this... dougt
1492 dnl else
1493 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1494 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1497 AC_LANG_C
1499 dnl **********************
1500 dnl *** va_copy checks ***
1501 AC_CACHE_CHECK([for an implementation of va_copy()],
1502                ac_cv_va_copy,
1503     [AC_TRY_COMPILE([#include <stdarg.h>
1504                      #include <stdlib.h>
1505         void f (int i, ...) {
1506             va_list args1, args2;
1507             va_start (args1, i);
1508             va_copy (args2, args1);
1509             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1510                 exit (1);
1511             va_end (args1); va_end (args2);
1512         }],
1513         [f(0, 42); return 0],
1514         [ac_cv_va_copy=yes],
1515         [ac_cv_va_copy=no]
1516     )]
1518 AC_CACHE_CHECK([whether va_list can be copied by value],
1519                ac_cv_va_val_copy,
1520     [AC_TRY_COMPILE([#include <stdarg.h>
1521                      #include <stdlib.h>
1522         void f (int i, ...) {
1523             va_list args1, args2;
1524             va_start (args1, i);
1525             args2 = args1;
1526             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1527                 exit (1);
1528             va_end (args1); va_end (args2);
1529         }],
1530         [f(0, 42); return 0],
1531         [ac_cv_va_val_copy=yes],
1532         [ac_cv_va_val_copy=no],
1533     )]
1535 if test "x$ac_cv_va_copy" = "xyes"; then
1536     AC_DEFINE(VA_COPY, va_copy)
1537     AC_DEFINE(HAVE_VA_COPY)
1540 if test "x$ac_cv_va_val_copy" = "xno"; then
1541    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1544 dnl ===================================================================
1545 dnl ========================================================
1546 dnl Put your C++ language/feature checks below
1547 dnl ========================================================
1548 AC_LANG_CPLUSPLUS
1550 ARM_ABI_PREFIX=
1551 if test "$GNU_CC"; then
1552   if test "$CPU_ARCH" = "arm" ; then
1553     AC_CACHE_CHECK(for ARM EABI,
1554         ac_cv_gcc_arm_eabi,
1555         [AC_TRY_COMPILE([],
1556                         [
1557 #if defined(__ARM_EABI__)
1558   return 0;
1559 #else
1560 #error Not ARM EABI.
1561 #endif
1562                         ],
1563                         ac_cv_gcc_arm_eabi="yes",
1564                         ac_cv_gcc_arm_eabi="no")])
1565     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1566         HAVE_ARM_EABI=1
1567         ARM_ABI_PREFIX=eabi-
1568     else
1569         ARM_ABI_PREFIX=oabi-
1570     fi
1571   fi
1573   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1576 dnl See if a dynamic_cast to void* gives the most derived object.
1577 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1578                ac_cv_cpp_dynamic_cast_void_ptr,
1579                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1580                             class Y { int j; public: virtual ~Y() { } };
1581                             class Z : public X, public Y { int k; };
1583                             int main() {
1584                                  Z mdo;
1585                                  X *subx = (X*)&mdo;
1586                                  Y *suby = (Y*)&mdo;
1587                                  return !((((void*)&mdo != (void*)subx) &&
1588                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1589                                           (((void*)&mdo != (void*)suby) &&
1590                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
1591                             }],
1592                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
1593                            ac_cv_cpp_dynamic_cast_void_ptr=no,
1594                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
1595 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1596    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1600 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1601 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1602 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1603 # linking XUL.
1604 _SAVE_LDFLAGS=$LDFLAGS
1605 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1606 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1607                ac_cv_thread_keyword,
1608                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1609                             [return tlsIsMainThread;],
1610                             ac_cv_thread_keyword=yes,
1611                             ac_cv_thread_keyword=no)])
1612 LDFLAGS=$_SAVE_LDFLAGS
1613 # The custom dynamic linker doesn't support TLS variables
1614 MOZ_TLS=
1615 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1616   # mips builds fail with TLS variables because of a binutils bug.
1617   # See bug 528687
1618   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1619   case "${target}" in
1620     mips*-*)
1621       :
1622       ;;
1623     *-android*|*-linuxandroid*)
1624       :
1625       ;;
1626     *-openbsd*)
1627       :
1628       ;;
1629     *)
1630       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1631       MOZ_TLS=1
1632       ;;
1633   esac
1636 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1637 if test -n "$MOZ_LINKER"; then
1638   if test "$CPU_ARCH" = arm; then
1639     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1640     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1641       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1642       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1643     fi
1644   fi
1646 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1647 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1648 dnl Since the linker only understands the sysv ones, no need to build the
1649 dnl gnu style tables anyways.
1650   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1653 dnl End of C++ language/feature checks
1654 AC_LANG_C
1656 dnl ========================================================
1657 dnl =  Internationalization checks
1658 dnl ========================================================
1660 dnl Internationalization and Locale support is different
1661 dnl on various UNIX platforms.  Checks for specific i18n
1662 dnl features go here.
1664 AC_HAVE_FUNCS(localeconv)
1666 fi # ! SKIP_COMPILER_CHECKS
1668 if test -n "${COMPILE_ENVIRONMENT}"; then
1669   MOZ_CHECK_ALLOCATOR
1672 TARGET_XPCOM_ABI=
1673 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1674     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1675     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1678 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1679 dnl features that Windows actually does support.
1681 if test -n "$SKIP_COMPILER_CHECKS"; then
1682    dnl Windows has malloc.h
1683    AC_DEFINE(MALLOC_H, [<malloc.h>])
1684    AC_DEFINE(HAVE_FORCEINLINE)
1685    AC_DEFINE(HAVE_LOCALECONV)
1686 fi # SKIP_COMPILER_CHECKS
1688 dnl Mozilla specific options
1689 dnl ========================================================
1690 dnl The macros used for command line options
1691 dnl are defined in build/autoconf/altoptions.m4.
1693 dnl ========================================================
1694 dnl =
1695 dnl = Check for external package dependencies
1696 dnl =
1697 dnl ========================================================
1698 MOZ_ARG_HEADER(External Packages)
1700 case "$OS_TARGET" in
1701 WINNT|Darwin|Android)
1702   MOZ_FOLD_LIBS=1
1703   ;;
1705   MOZ_FOLD_LIBS=
1706   ;;
1707 esac
1709 MOZ_CONFIG_NSPR()
1711 dnl ========================================================
1712 dnl system libevent Support
1713 dnl ========================================================
1714 MOZ_ARG_WITH_STRING(system-libevent,
1715 [  --with-system-libevent[=PFX]
1716                           Use system libevent [installed at prefix PFX]],
1717     LIBEVENT_DIR=$withval)
1719 _SAVE_CFLAGS=$CFLAGS
1720 _SAVE_LDFLAGS=$LDFLAGS
1721 _SAVE_LIBS=$LIBS
1722 if test "$LIBEVENT_DIR" = yes; then
1723     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1724         MOZ_SYSTEM_LIBEVENT=1,
1725         LIBEVENT_DIR=/usr)
1727 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1728     MOZ_SYSTEM_LIBEVENT=
1729 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1730     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1731     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1732     MOZ_CHECK_HEADER(event.h,
1733         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1734              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1735          fi],
1736         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1737     AC_CHECK_LIB(event, event_init,
1738                  [MOZ_SYSTEM_LIBEVENT=1
1739                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1740                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1741                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1743 CFLAGS=$_SAVE_CFLAGS
1744 LDFLAGS=$_SAVE_LDFLAGS
1745 LIBS=$_SAVE_LIBS
1747 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1749 dnl ========================================================
1750 dnl = If NSS was not detected in the system,
1751 dnl = use the one in the source tree (mozilla/security/nss)
1752 dnl ========================================================
1754 MOZ_ARG_WITH_BOOL(system-nss,
1755 [  --with-system-nss       Use system installed NSS],
1756     _USE_SYSTEM_NSS=1 )
1758 if test -n "$_USE_SYSTEM_NSS"; then
1759     AM_PATH_NSS(3.38, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1762 if test -z "$MOZ_SYSTEM_NSS"; then
1763    NSS_CFLAGS="-I${DIST}/include/nss"
1764    case "${OS_ARCH}" in
1765         # Only few platforms have been tested with GYP
1766         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1767             ;;
1768         *)
1769             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1770             ;;
1771    esac
1774 if test -z "$SKIP_LIBRARY_CHECKS"; then
1775 dnl system JPEG support
1776 dnl ========================================================
1777 MOZ_ARG_WITH_STRING(system-jpeg,
1778 [  --with-system-jpeg[=PFX]
1779                           Use system libjpeg [installed at prefix PFX]],
1780     JPEG_DIR=$withval)
1782 _SAVE_CFLAGS=$CFLAGS
1783 _SAVE_LDFLAGS=$LDFLAGS
1784 _SAVE_LIBS=$LIBS
1785 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1786     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1787     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1789 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1790     MOZ_SYSTEM_JPEG=
1791 else
1792     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1795 if test "$MOZ_SYSTEM_JPEG" = 1; then
1796     AC_TRY_COMPILE([ #include <stdio.h>
1797                      #include <sys/types.h>
1798                      #include <jpeglib.h> ],
1799                    [ #if JPEG_LIB_VERSION < $MOZJPEG
1800                      #error "Insufficient JPEG library version ($MOZJPEG required)."
1801                      #endif
1802                      #ifndef JCS_EXTENSIONS
1803                      #error "libjpeg-turbo JCS_EXTENSIONS required"
1804                      #endif
1805                      ],
1806                    MOZ_SYSTEM_JPEG=1,
1807                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1809 CFLAGS=$_SAVE_CFLAGS
1810 LDFLAGS=$_SAVE_LDFLAGS
1811 LIBS=$_SAVE_LIBS
1813 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1814     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1815     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1817 fi # SKIP_LIBRARY_CHECKS
1819 dnl system ZLIB support
1820 dnl ========================================================
1821 MOZ_ZLIB_CHECK([1.2.3])
1823 if test -z "$SKIP_LIBRARY_CHECKS"; then
1825 dnl ========================================================
1826 dnl system PNG Support
1827 dnl ========================================================
1828 MOZ_ARG_WITH_STRING(system-png,
1829 [  --with-system-png[=PFX]
1830                           Use system libpng [installed at prefix PFX]],
1831     PNG_DIR=$withval)
1833 _SAVE_CFLAGS=$CFLAGS
1834 _SAVE_LDFLAGS=$LDFLAGS
1835 _SAVE_LIBS=$LIBS
1836 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1837     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1838     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1840 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1841     MOZ_SYSTEM_PNG=
1842 else
1843     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1844                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1845     AC_CHECK_LIB(png, png_get_acTL, ,
1846                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1848 if test "$MOZ_SYSTEM_PNG" = 1; then
1849     AC_TRY_COMPILE([ #include <stdio.h>
1850                      #include <sys/types.h>
1851                      #include <png.h> ],
1852                    [ #if PNG_LIBPNG_VER < $MOZPNG
1853                      #error "Insufficient libpng version ($MOZPNG required)."
1854                      #endif
1855                      #ifndef PNG_UINT_31_MAX
1856                      #error "Insufficient libpng version."
1857                      #endif ],
1858                    MOZ_SYSTEM_PNG=1,
1859                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1861 CFLAGS=$_SAVE_CFLAGS
1862 LDFLAGS=$_SAVE_LDFLAGS
1863 LIBS=$_SAVE_LIBS
1865 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1866     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1867     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1870 fi # SKIP_LIBRARY_CHECKS
1872 dnl ========================================================
1873 dnl =
1874 dnl = Application
1875 dnl =
1876 dnl ========================================================
1878 MOZ_ARG_HEADER(Application)
1880 ENABLE_SYSTEM_EXTENSION_DIRS=1
1881 MOZ_BRANDING_DIRECTORY=
1882 MOZ_OFFICIAL_BRANDING=
1883 MOZ_FEEDS=1
1884 MOZ_AUTH_EXTENSION=1
1885 if test "$MOZ_IOS"; then
1886    MOZ_AUTH_EXTENSION=
1888 MOZ_RAW=
1889 MOZ_SRTP=
1890 MOZ_WEBRTC_HARDWARE_AEC_NS=
1891 MOZ_SCTP=
1892 VPX_USE_YASM=
1893 VPX_ASFLAGS=
1894 VPX_AS_CONVERSION=
1895 VPX_X86_ASM=
1896 VPX_ARM_ASM=
1897 LIBJPEG_TURBO_AS=
1898 LIBJPEG_TURBO_ASFLAGS=
1899 MOZ_PREF_EXTENSIONS=1
1900 MOZ_REFLOW_PERF=
1901 MOZ_SPELLCHECK=1
1902 MOZ_TOOLKIT_SEARCH=1
1903 MOZ_UNIVERSALCHARDET=1
1904 MOZ_XUL=1
1905 MOZ_ZIPWRITER=1
1906 MOZ_NO_SMART_CARDS=
1907 NECKO_COOKIES=1
1908 MOZ_USE_NATIVE_POPUP_WINDOWS=
1909 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1910 ACCESSIBILITY=1
1911 MOZ_CONTENT_SANDBOX=
1912 MOZ_GMP_SANDBOX=
1913 MOZ_SANDBOX=1
1914 MOZ_BINARY_EXTENSIONS=
1915 MOZ_DEVTOOLS=server
1917 case "$target_os" in
1918     mingw*)
1919         NS_ENABLE_TSF=1
1920         AC_DEFINE(NS_ENABLE_TSF)
1921         ;;
1922 esac
1924 case "${target}" in
1925     *-android*|*-linuxandroid*)
1926         MOZ_RAW=1
1927         ;;
1929 esac
1931 # Optional Firefox for Android partner distribution directory.
1932 MOZ_ARG_WITH_STRING(android-distribution-directory,
1933 [  --with-android-distribution-directory=dir
1934                           Optional Firefox for Android partner distribution directory.],
1935   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1937 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1938   # A distribution directory must have an assets/distribution directory.
1939   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1940   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1941     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1942                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1943   fi
1945 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1947 dnl ========================================================
1948 dnl = Trademarked Branding
1949 dnl ========================================================
1950 MOZ_ARG_ENABLE_BOOL(official-branding,
1951 [  --enable-official-branding
1952                           Enable Official mozilla.org Branding
1953                           Do not distribute builds with
1954                           --enable-official-branding unless you have
1955                           permission to use trademarks per
1956                           http://www.mozilla.org/foundation/trademarks/ .],
1957     MOZ_OFFICIAL_BRANDING=1,
1958     MOZ_OFFICIAL_BRANDING=)
1960 # Allow the application to influence configure with a confvars.sh script.
1961 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1962 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1963   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1964   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1965 else
1966   AC_MSG_RESULT([no])
1969 # Allow influencing configure with a defines.sh script.
1970 . "${srcdir}/build/defines.sh"
1972 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1973 # set in defines.sh
1974 if test "$BUILDING_RELEASE"; then
1975   # Override value in defines.sh, if any
1976   EARLY_BETA_OR_EARLIER=
1977 elif test "$EARLY_BETA_OR_EARLIER"; then
1978   AC_DEFINE(EARLY_BETA_OR_EARLIER)
1980 AC_SUBST(EARLY_BETA_OR_EARLIER)
1982 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1983 MOZ_ARG_WITH_STRING(app-name,
1984 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1985 WITH_APP_NAME=$withval,
1988 if test -n "$WITH_APP_NAME" ; then
1989     MOZ_APP_NAME="$WITH_APP_NAME"
1992 MOZ_ARG_WITH_STRING(app-basename,
1993 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1994 WITH_APP_BASENAME=$withval,
1997 if test -n "$WITH_APP_BASENAME" ; then
1998     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2001 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2002 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2003 # MOZ_BUILD_APP.
2004 case "$MOZ_BUILD_APP" in
2005 browser)
2006   AC_DEFINE(MOZ_PHOENIX)
2007   ;;
2009 xulrunner)
2010   AC_DEFINE(MOZ_XULRUNNER)
2011   ;;
2012 esac
2014 # Graphene is a desktop runtime for running applications with a HTML UI.
2015 if test -n "$MOZ_GRAPHENE"; then
2016     AC_DEFINE(MOZ_GRAPHENE)
2019 if test -n "$MOZ_MULET"; then
2020     AC_DEFINE(MOZ_MULET)
2023 AC_SUBST(MOZ_PHOENIX)
2024 AC_SUBST(MOZ_XULRUNNER)
2025 AC_SUBST(MOZ_MULET)
2027 dnl ========================================================
2028 dnl Ensure Android SDK and build-tools versions depending on
2029 dnl mobile target.
2030 dnl ========================================================
2032 case "$MOZ_BUILD_APP" in
2033 mobile/android)
2034     MOZ_ANDROID_SDK(26, 23, 26.0.2)
2035     ;;
2036 esac
2038 dnl ========================================================
2039 dnl =
2040 dnl = Toolkit Options
2041 dnl =
2042 dnl ========================================================
2043 MOZ_ARG_HEADER(Toolkit Options)
2045 dnl ========================================================
2046 dnl = Enable the toolkit as needed                         =
2047 dnl ========================================================
2049 case "$MOZ_WIDGET_TOOLKIT" in
2051 cocoa)
2052     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2053     # Use -Wl as a trick to avoid -framework and framework names from
2054     # being separated by AC_SUBST_LIST.
2055     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'
2056     TK_CFLAGS=""
2057     CFLAGS="$CFLAGS $TK_CFLAGS"
2058     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2059     MOZ_USER_DIR="Mozilla"
2060     MOZ_FS_LAYOUT=bundle
2061     ;;
2063 uikit)
2064     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2065     TK_CFLAGS=""
2066     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'
2067     CFLAGS="$CFLAGS $TK_CFLAGS"
2068     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2069     MOZ_USER_DIR="Mozilla"
2070     MOZ_FS_LAYOUT=bundle
2071     ;;
2073 esac
2075 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2076 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2077 case "$MOZ_WIDGET_TOOLKIT" in
2078 gtk*)
2079     MOZ_ENABLE_GTK=1
2080     ;;
2081 esac
2083 if test "$COMPILE_ENVIRONMENT"; then
2084   if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2085     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
2086     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2087     TK_CFLAGS=$MOZ_GTK3_CFLAGS
2088     TK_LIBS=$MOZ_GTK3_LIBS
2089     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2090     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2091     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2092     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2093   fi
2094   if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2095     GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2096   fi
2097   if test "$MOZ_ENABLE_GTK"; then
2098     if test "$MOZ_X11"; then
2099       GDK_PACKAGES=gdk-x11-2.0
2100     fi
2101     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2102     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2104     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
2105     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2106   fi
2107   if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2108     TK_CFLAGS=$MOZ_GTK2_CFLAGS
2109     TK_LIBS=$MOZ_GTK2_LIBS
2110   fi
2111 fi # COMPILE_ENVIRONMENT
2113 AC_SUBST(MOZ_FS_LAYOUT)
2115 dnl ========================================================
2116 dnl = startup-notification support module
2117 dnl ========================================================
2119 if test "$MOZ_ENABLE_GTK"
2120 then
2121     MOZ_ENABLE_STARTUP_NOTIFICATION=
2123     MOZ_ARG_ENABLE_BOOL(startup-notification,
2124     [  --enable-startup-notification
2125                           Enable startup-notification support (default: disabled) ],
2126         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2127         MOZ_ENABLE_STARTUP_NOTIFICATION=)
2128     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2129     then
2130         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2131                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2132         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2133             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2134             then
2135                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2136             fi
2137             MOZ_ENABLE_STARTUP_NOTIFICATION=
2138         ])
2139     fi
2141     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2142         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2143     fi
2145     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2147 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2149 AC_SUBST_LIST(TK_CFLAGS)
2150 AC_SUBST_LIST(TK_LIBS)
2152 AC_SUBST(MOC)
2153 AC_SUBST(RCC)
2155 dnl ========================================================
2156 dnl =
2157 dnl = Components & Features
2158 dnl =
2159 dnl ========================================================
2160 MOZ_ARG_HEADER(Components and Features)
2162 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2163 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2164   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2165     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2166   else
2167     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2168     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2169   fi
2172 MOZ_ARG_WITH_STRING(branding,
2173 [  --with-branding=dir     Use branding from the specified directory.],
2174     MOZ_BRANDING_DIRECTORY=$withval)
2176 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2177 if test -z "$REAL_BRANDING_DIRECTORY"; then
2178   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2181 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2182   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2183 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2184   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2187 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2189 dnl ========================================================
2190 dnl = Distribution ID
2191 dnl ========================================================
2192 MOZ_ARG_WITH_STRING(distribution-id,
2193 [  --with-distribution-id=ID
2194                           Set distribution-specific id (default=org.mozilla)],
2195 [ val=`echo $withval`
2196     MOZ_DISTRIBUTION_ID="$val"])
2198 if test -z "$MOZ_DISTRIBUTION_ID"; then
2199    MOZ_DISTRIBUTION_ID="org.mozilla"
2202 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2203 AC_SUBST(MOZ_DISTRIBUTION_ID)
2205 dnl ========================================================
2206 dnl = GConf support module
2207 dnl ========================================================
2209 if test "$MOZ_X11"
2210 then
2211     if test "$MOZ_ENABLE_GTK"
2212     then
2213         MOZ_ENABLE_GCONF=1
2214     fi
2216     dnl ========================================================
2217     dnl = GConf support module
2218     dnl ========================================================
2219     MOZ_ARG_DISABLE_BOOL(gconf,
2220     [  --disable-gconf      Disable Gconf support ],
2221         MOZ_ENABLE_GCONF=,
2222         MOZ_ENABLE_GCONF=1)
2224     if test "$MOZ_ENABLE_GCONF"
2225     then
2226         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2227             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2228             MOZ_ENABLE_GCONF=1
2229         ],[
2230             if test -n "$MOZ_ENABLE_GCONF";
2231             then
2232                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2233             else
2234                 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2235             fi
2236         ])
2237     fi
2239     if test "$MOZ_ENABLE_GCONF"; then
2240         AC_DEFINE(MOZ_ENABLE_GCONF)
2241     fi
2243     AC_SUBST(MOZ_ENABLE_GCONF)
2246 dnl ========================================================
2247 dnl = libproxy support
2248 dnl ========================================================
2250 if test "$MOZ_ENABLE_GTK"
2251 then
2252     MOZ_ENABLE_LIBPROXY=
2254     MOZ_ARG_ENABLE_BOOL(libproxy,
2255     [  --enable-libproxy         Enable libproxy support ],
2256     MOZ_ENABLE_LIBPROXY=1,
2257     MOZ_ENABLE_LIBPROXY=)
2259     if test "$MOZ_ENABLE_LIBPROXY"
2260     then
2261         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2262         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2263     fi
2265 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2267 dnl ========================================================
2268 dnl = dbus support
2269 dnl ========================================================
2271 if test "$MOZ_ENABLE_GTK"
2272 then
2273     MOZ_ENABLE_DBUS=1
2275     MOZ_ARG_DISABLE_BOOL(dbus,
2276     [  --disable-dbus          Disable dbus support ],
2277         MOZ_ENABLE_DBUS=,
2278         MOZ_ENABLE_DBUS=1)
2280     if test "$MOZ_ENABLE_DBUS"
2281     then
2282         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2283         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2284         AC_DEFINE(MOZ_ENABLE_DBUS)
2285     fi
2287 AC_SUBST(MOZ_ENABLE_DBUS)
2289 dnl =========================================================
2290 dnl = Whether to exclude hyphenations files in the build
2291 dnl =========================================================
2292 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2293     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2296 dnl ========================================================
2297 dnl accessibility support on by default on all platforms
2298 dnl ========================================================
2299 MOZ_ARG_DISABLE_BOOL(accessibility,
2300 [  --disable-accessibility Disable accessibility support],
2301     ACCESSIBILITY=,
2302     ACCESSIBILITY=1 )
2303 if test "$ACCESSIBILITY"; then
2304     case "$target" in
2305     *-mingw*)
2306         if test -z "$MIDL"; then
2307             if test "$GCC" != "yes"; then
2308                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2309             else
2310                 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.])
2311             fi
2312         fi
2313     esac
2314     AC_DEFINE(ACCESSIBILITY)
2317 dnl ========================================================
2318 dnl Accessibility is required for the linuxgl widget
2319 dnl backend
2320 dnl ========================================================
2321 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2322     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2325 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2326                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2327                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2329 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2331 if test -n "$MOZ_WEBRTC"; then
2332     MOZ_RAW=1
2333     MOZ_SCTP=1
2334     MOZ_SRTP=1
2335     AC_DEFINE(MOZ_SCTP)
2336     AC_DEFINE(MOZ_SRTP)
2337     if test -n "$MOZ_X11"; then
2338       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2339     fi
2342 dnl ========================================================
2343 dnl = Force hardware AEC, disable webrtc.org AEC
2344 dnl ========================================================
2345 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2346 [  --enable-hardware-aec-ns   Enable support for hardware AEC and noise suppression],
2347     MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2348     MOZ_WEBRTC_HARDWARE_AEC_NS=)
2350 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2351     AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2354 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2355 AC_SUBST(MOZ_SCTP)
2356 AC_SUBST(MOZ_SRTP)
2357 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2359 dnl ========================================================
2360 dnl = Enable Raw Codecs
2361 dnl ========================================================
2362 MOZ_ARG_ENABLE_BOOL(raw,
2363 [  --enable-raw           Enable support for RAW media],
2364     MOZ_RAW=1,
2365     MOZ_RAW=)
2367 if test -n "$MOZ_RAW"; then
2368     AC_DEFINE(MOZ_RAW)
2371 AC_SUBST(MOZ_RAW)
2373 dnl ========================================================
2374 dnl = Apple platform decoder support
2375 dnl ========================================================
2376 if test "$COMPILE_ENVIRONMENT"; then
2377 if test -n "$MOZ_APPLEMEDIA"; then
2378   # hack in frameworks for fmp4 - see bug 1029974
2379   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2380   LDFLAGS="$LDFLAGS -framework AudioToolbox"
2381   dnl Verify CoreMedia is available.
2382   AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2383     [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2385 fi # COMPILE_ENVIRONMENT
2387 dnl system libvpx Support
2388 dnl ========================================================
2389 MOZ_ARG_WITH_BOOL(system-libvpx,
2390 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
2391     MOZ_SYSTEM_LIBVPX=1)
2393 MOZ_LIBVPX_CFLAGS=
2394 MOZ_LIBVPX_LIBS=
2396 _SAVE_CFLAGS=$CFLAGS
2397 _SAVE_LIBS=$LIBS
2398 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2399     dnl ============================
2400     dnl === libvpx Version check ===
2401     dnl ============================
2402     dnl Check to see if we have a system libvpx package.
2403     PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2405     CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2406     LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2408     MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2409      [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.])])
2411     AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2412      [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2414     MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2415      [AC_CHECK_FUNC(vpx_mem_set_functions)])
2416     if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2417             "$ac_cv_func_vpx_mem_set_functions" = no; then
2418         AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2419     fi
2421 CFLAGS=$_SAVE_CFLAGS
2422 LIBS=$_SAVE_LIBS
2424 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2425 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2426 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2428 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2430     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2431     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2432     dnl We currently require gcc on all arm platforms.
2434     dnl See if we have assembly on this platform.
2435     case "$OS_ARCH:$CPU_ARCH" in
2436     Darwin:x86)
2437       VPX_USE_YASM=1
2438       VPX_X86_ASM=1
2439     ;;
2440     Darwin:x86_64)
2441       VPX_USE_YASM=1
2442       VPX_X86_ASM=1
2443     ;;
2444     WINNT:x86_64)
2445       VPX_USE_YASM=1
2446       VPX_X86_ASM=1
2447     ;;
2448     WINNT:x86)
2449       dnl Check for yasm 1.1 or greater.
2450       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2451         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.])
2452       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2453         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.])
2454       else
2455         VPX_USE_YASM=1
2456         VPX_X86_ASM=1
2457         dnl The encoder needs obj_int_extract to get asm offsets.
2458       fi # COMPILE_ENVIRONMENT and others
2459     ;;
2460     *:arm*)
2461       if test -n "$GNU_AS" ; then
2462         dnl These flags are a lie; they're just used to enable the requisite
2463         dnl opcodes; actual arch detection is done at runtime.
2464         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2465         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2466         VPX_ARM_ASM=1
2467         dnl Building with -mfpu=neon requires either the "softfp" or the
2468         dnl "hardfp" ABI. Depending on the compiler's default target, and the
2469         dnl CFLAGS, the default ABI might be neither, in which case it is the
2470         dnl "softfloat" ABI.
2471         dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2472         dnl we can safely mix code built with both ABIs. So, if we detect
2473         dnl that compiling uses the "softfloat" ABI, force the use of the
2474         dnl "softfp" ABI instead.
2475         dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2476         dnl "softfloat" ABI, not the "softfp" ABI.
2477         dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2478         AC_TRY_COMPILE([],
2479           [#ifndef __SOFTFP__
2480            #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2481            #endif],
2482            VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2483            )
2484       fi
2485     ;;
2486     *:x86)
2487       if $CC -E -dM -</dev/null | grep -q __ELF__; then
2488         VPX_USE_YASM=1
2489         VPX_X86_ASM=1
2490       fi
2491     ;;
2492     *:x86_64)
2493       if $CC -E -dM -</dev/null | grep -q __ELF__; then
2494         VPX_USE_YASM=1
2495         VPX_X86_ASM=1
2496       fi
2497     ;;
2498     esac
2500     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2501       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.])
2502     fi # COMPILE_ENVIRONMENT and others
2504     if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2505       VPX_ASFLAGS="-DPIC"
2506     fi
2508     if test -n "$VPX_X86_ASM"; then
2509       AC_DEFINE(VPX_X86_ASM)
2510     elif test -n "$VPX_ARM_ASM"; then
2511       AC_DEFINE(VPX_ARM_ASM)
2512     else
2513       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2514     fi
2516     dnl native libvpx no longer has vpx_mem_set_functions
2517     AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2520 dnl ========================================================
2521 dnl = Handle dependent MEDIA defines
2522 dnl ========================================================
2524 MOZ_WEBM_ENCODER=1
2525 AC_DEFINE(MOZ_WEBM_ENCODER)
2526 AC_SUBST(MOZ_WEBM_ENCODER)
2528 dnl ========================================================
2529 dnl NegotiateAuth
2530 dnl ========================================================
2532 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2533 [  --disable-negotiateauth Disable GSS-API negotiation ],
2534     MOZ_AUTH_EXTENSION=,
2535     MOZ_AUTH_EXTENSION=1 )
2537 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2538    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2541 dnl ========================================================
2542 dnl Pref extensions (autoconfig)
2543 dnl ========================================================
2544 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2545 [  --disable-pref-extensions
2546                           Disable pref extensions such as autoconfig],
2547   MOZ_PREF_EXTENSIONS=,
2548   MOZ_PREF_EXTENSIONS=1 )
2550 dnl ========================================================
2551 dnl Searching of system directories for extensions.
2552 dnl Note: this switch is meant to be used for test builds
2553 dnl whose behavior should not depend on what happens to be
2554 dnl installed on the local machine.
2555 dnl ========================================================
2556 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2557 [  --disable-system-extension-dirs
2558                           Disable searching system- and account-global
2559                           directories for extensions of any kind; use
2560                           only profile-specific extension directories],
2561   ENABLE_SYSTEM_EXTENSION_DIRS=,
2562   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2563 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2564   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2567 dnl ========================================================
2568 dnl = Universalchardet
2569 dnl ========================================================
2570 MOZ_ARG_DISABLE_BOOL(universalchardet,
2571 [  --disable-universalchardet
2572                           Disable universal encoding detection],
2573   MOZ_UNIVERSALCHARDET=,
2574   MOZ_UNIVERSALCHARDET=1 )
2576 dnl ========================================================
2577 dnl = ANGLE OpenGL->D3D translator for WebGL
2578 dnl = * only applies to win32 (and then, not MINGW)
2579 dnl ========================================================
2581 MOZ_ANGLE_RENDERER=
2582 MOZ_D3D_CPU_SUFFIX=
2583 MOZ_HAS_WINSDK_WITH_D3D=
2584 MOZ_D3DCOMPILER_VISTA_DLL=
2585 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2587 if test "$COMPILE_ENVIRONMENT" ; then
2588 case "$target_os" in
2589 *mingw*)
2590     MOZ_ANGLE_RENDERER=1
2591     ;;
2592 esac
2594 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2595 case "${target_cpu}" in
2596 i*86)
2597   MOZ_D3D_CPU_SUFFIX=x86
2598   ;;
2599 x86_64)
2600   MOZ_D3D_CPU_SUFFIX=x64
2601   ;;
2602 esac
2604 dnl ========================================================
2605 dnl D3D compiler DLL
2606 dnl ========================================================
2607 MOZ_FOUND_D3D_COMPILERS=
2609 if test -n "$MOZ_ANGLE_RENDERER"; then
2610   if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2611     AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2612   fi
2614   ######################################
2615   # Find _46+ for use by Vista+.
2617   # Find a D3D compiler DLL in a Windows SDK.
2618   MOZ_D3DCOMPILER_VISTA_DLL=
2619   case "$MOZ_WINSDK_MAXVER" in
2620   0x0603*|0x0A00*)
2621     MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2622     AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2623   ;;
2624   esac
2626   if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2627     # We have a name, now track down the path.
2628     if test -n "$WINDOWSSDKDIR"; then
2629       MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2630       if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2631         AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2632         MOZ_HAS_WINSDK_WITH_D3D=1
2633       else
2634         AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2635         AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2636         MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2637       fi
2638     else
2639       AC_MSG_RESULT([Windows SDK not found.])
2640     fi
2641   else
2642     if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2643       AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2644     else
2645       AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2646     fi
2647   fi
2649   if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2650     MOZ_D3DCOMPILER_VISTA_DLL=
2651   fi
2653   # On mingw, check if headers are provided by toolchain.
2654   if test -n "$GNU_CC"; then
2655     MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2656   fi
2658   ######################################
2659   # Check that we found what we needed.
2660   MOZ_FOUND_A_D3D_COMPILER=
2662   if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2663     MOZ_FOUND_A_D3D_COMPILER=1
2664     AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
2665   fi
2667   if test -z "$CROSS_COMPILE"; then
2668     if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
2669       AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
2670     fi
2671   fi
2672 fi # MOZ_ANGLE_RENDERER
2674 fi # COMPILE_ENVIRONMENT
2677 dnl ========================================================
2678 dnl Gamepad support
2679 dnl ========================================================
2680 MOZ_GAMEPAD_BACKEND=stub
2682 case "$OS_TARGET" in
2683 Darwin)
2684     if test -z "$MOZ_IOS"; then
2685         MOZ_GAMEPAD_BACKEND=cocoa
2686     fi
2687     ;;
2688 WINNT)
2689     MOZ_GAMEPAD_BACKEND=windows
2690     ;;
2691 Linux)
2692     MOZ_CHECK_HEADER([linux/joystick.h])
2693     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2694       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2695     fi
2696     MOZ_GAMEPAD_BACKEND=linux
2697     ;;
2698 Android)
2699     MOZ_GAMEPAD_BACKEND=android
2700     ;;
2702     ;;
2703 esac
2705 AC_SUBST(MOZ_GAMEPAD_BACKEND)
2707 dnl ========================================================
2708 dnl = Breakpad crash reporting (on by default on supported platforms)
2709 dnl ========================================================
2711 case $target in
2712 i?86-*-mingw*|x86_64-*-mingw*)
2713   MOZ_CRASHREPORTER=1
2714   ;;
2715 i?86-apple-darwin*|x86_64-apple-darwin*)
2716   if test -z "$MOZ_IOS"; then
2717     MOZ_CRASHREPORTER=1
2718   fi
2719   ;;
2720 *-android*|*-linuxandroid*)
2721   dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2722   dnl be before Linux condition
2723   MOZ_CRASHREPORTER=1
2724   ;;
2725 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2726   if test "$MOZ_ENABLE_GTK"; then
2727     MOZ_CRASHREPORTER=1
2728   fi
2729   ;;
2730 esac
2732 MOZ_ARG_DISABLE_BOOL(crashreporter,
2733 [  --disable-crashreporter Disable breakpad crash reporting],
2734     [MOZ_CRASHREPORTER=],
2735     [MOZ_CRASHREPORTER=F # Force enable breakpad])
2737 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2738   if test "$MOZ_CRASHREPORTER" = F; then
2739     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2740   fi
2741   MOZ_CRASHREPORTER=
2744 if test -n "$MOZ_CRASHREPORTER"; then
2745    AC_DEFINE(MOZ_CRASHREPORTER)
2747   if test "$OS_TARGET" = "Linux" && \
2748     test -z "$SKIP_LIBRARY_CHECKS"; then
2749     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2750   fi
2752   if test "$OS_ARCH" = "WINNT"; then
2753     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2754       MOZ_CRASHREPORTER_INJECTOR=1
2755       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2756     fi
2757   fi
2760 dnl ========================================================
2761 dnl = libjpeg-turbo configuration
2762 dnl ========================================================
2763 MOZ_LIBJPEG_TURBO=
2764 LIBJPEG_TURBO_USE_YASM=
2765 if test -z "$MOZ_SYSTEM_JPEG"; then
2766     MOZ_LIBJPEG_TURBO=1
2769 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
2770 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
2771     MOZ_LIBJPEG_TURBO=,
2772     MOZ_LIBJPEG_TURBO=1)
2774 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
2775     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
2778 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
2779 dnl files.
2781 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
2783   dnl Do we support libjpeg-turbo on this platform?
2784   case "$OS_ARCH:$CPU_ARCH" in
2785   Darwin:x86)
2786     LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
2787   ;;
2788   Darwin:x86_64)
2789     LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2790   ;;
2791   Darwin:arm*)
2792   ;;
2793   WINNT:x86)
2794     LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
2795   ;;
2796   WINNT:x86_64)
2797     LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2798   ;;
2799   *:arm)
2800     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
2801   ;;
2802   *:aarch64)
2803     LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
2804   ;;
2805   *:mips32)
2806     LIBJPEG_TURBO_ASFLAGS="-mdspr2"
2807   ;;
2808   *:x86)
2809     if $CC -E -dM -</dev/null | grep -q __ELF__; then
2810       LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
2811     fi
2812   ;;
2813   *:x86_64)
2814     if $CC -E -dM -</dev/null | grep -q __ELF__; then
2815       LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2816     fi
2817   ;;
2818   esac
2821 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
2822   case "$CPU_ARCH" in
2823 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
2824 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
2825 dnl it doesn't exist or we have too old of a version.
2826   x86_64|x86)
2827     LIBJPEG_TURBO_USE_YASM=1
2829     if test -z "$YASM" ; then
2830         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.])
2831     fi
2833     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
2834     dnl on Linux and 1.1 or newer everywhere else.
2835     if test "$OS_ARCH" = "Linux" ; then
2836         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
2837             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.])
2838         fi
2839     else
2840         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2841             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.])
2842         fi
2843     fi
2844   ;;
2845   esac
2848 dnl ========================================================
2849 dnl = libav-fft configuration
2850 dnl ========================================================
2852 MOZ_LIBAV_FFT=
2854 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
2855 dnl 32-bit linux/os x have text relocation issues.
2857 case "$OS_ARCH:$CPU_ARCH" in
2858   WINNT:x86)
2859       MOZ_LIBAV_FFT=1
2860   ;;
2861   *:x86_64)
2862       MOZ_LIBAV_FFT=1
2863   ;;
2864 esac
2866 dnl Detect if we can use yasm to compile libav's assembly
2868 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
2869   AC_DEFINE(MOZ_LIBAV_FFT)
2870   dnl Do we support libav-fft on this platform?
2871   case "$OS_ARCH:$CPU_ARCH" in
2872   Darwin:x86_64)
2873     LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2874   ;;
2875   WINNT:x86)
2876     LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
2877   ;;
2878   WINNT:x86_64)
2879     LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2880   ;;
2881   *:x86_64)
2882     if $CC -E -dM -</dev/null | grep -q __ELF__; then
2883       LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2884     fi
2885   ;;
2886   *)
2887     AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
2888   ;;
2889   esac
2892 if test -n "$LIBAV_FFT_ASFLAGS"; then
2893   dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
2894   dnl check for Yasm, and error out if it doesn't exist or we have too old of a
2895   dnl version.
2896   if test -z "$YASM" ; then
2897     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.])
2898   fi
2899   dnl Check that we have the right yasm version.  We require 1.0.1 or newer
2900   dnl on Linux and 1.1 or newer everywhere else.
2901   if test "$OS_ARCH" = "Linux" ; then
2902     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
2903       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.])
2904     fi
2905   else
2906     if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2907       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.])
2908     fi
2909   fi
2910 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
2911   dnl Warn if we're not building either libav or opendl-max optimized routines.
2912   AC_MSG_WARN([No assembler or assembly support for libav-fft.  Using unoptimized C routines.])
2915 dnl ========================================================
2916 dnl = FFmpeg's ffvpx configuration
2917 dnl ========================================================
2919 MOZ_FFVPX=
2920 MOZ_FFVPX_FLACONLY=
2921 case "$CPU_ARCH" in
2922   x86|x86_64)
2923       MOZ_FFVPX=1
2924       dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
2925       if test -n "$LIBAV_FFT_ASFLAGS"; then
2926           FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
2927       else
2928           dnl On x86 system with assembly optimizations disabled, the ffvp9 and
2929           dnl ffvp8 decoders give worse performance than libvpx ones. So we only
2930           dnl enable the FFmpeg FLAC decoder on those machines.
2931           MOZ_FFVPX_FLACONLY=1
2932       fi
2933   ;;
2934   arm*|aarch64)
2935       MOZ_FFVPX=1
2936       MOZ_FFVPX_FLACONLY=1
2937       dnl Use same conditional as MOZ_LIBVPX to enable FFmpeg's ffvpx assembly decoder.
2938       dnl aarch 64 FLAC decoder for now will be C only.
2939       FFVPX_ASFLAGS=$VPX_ASFLAGS
2940   ;;
2941 esac
2943 if test -n "$MOZ_FFVPX"; then
2944   AC_DEFINE(MOZ_FFVPX)
2946 if test -n "$MOZ_FFVPX_FLACONLY"; then
2947   AC_DEFINE(MOZ_FFVPX_FLACONLY)
2950 dnl ========================================================
2951 dnl = Enable compilation of specific extension modules
2952 dnl ========================================================
2954 MOZ_ARG_ENABLE_STRING(extensions,
2955 [  --enable-extensions     Enable extensions],
2956 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2957     if test "$option" = "yes" -o "$option" = "all"; then
2958         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2959     elif test "$option" = "no" -o "$option" = "none"; then
2960         MOZ_EXTENSIONS=""
2961     elif test "$option" = "default"; then
2962         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2963     elif test `echo "$option" | grep -c \^-` != 0; then
2964         option=`echo $option | sed 's/^-//'`
2965         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2966     else
2967         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2968     fi
2969 done],
2970     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2972 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2973 dnl when trying to build a nonexistent extension.
2974 for extension in $MOZ_EXTENSIONS; do
2975     if test ! -d "${srcdir}/extensions/${extension}"; then
2976         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2977     fi
2978 done
2980 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2981   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2984 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2985 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2986 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2987    MOZ_ENABLE_CAIRO_FT=1
2988    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2989    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2990    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2993 AC_CHECK_PROGS(WGET, wget, "")
2994 AC_SUBST(WGET)
2996 dnl ========================================================
2997 dnl Maintenance Service
2998 dnl ========================================================
3000 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3001 [  --enable-maintenance-service       Enable building of maintenanceservice],
3002     MOZ_MAINTENANCE_SERVICE=1,
3003     MOZ_MAINTENANCE_SERVICE= )
3005 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3006   if test "$OS_ARCH" = "WINNT"; then
3007     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3008   else
3009     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3010   fi
3013 dnl ========================================================
3014 dnl Bundled fonts on desktop platforms
3015 dnl ========================================================
3017 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3018 [  --enable-bundled-fonts  Enable support for bundled fonts on desktop platforms],
3019     MOZ_BUNDLED_FONTS=1,
3020     MOZ_BUNDLED_FONTS=)
3022 if test -n "$MOZ_BUNDLED_FONTS"; then
3023   AC_DEFINE(MOZ_BUNDLED_FONTS)
3026 dnl ========================================================
3027 dnl Verify MAR signatures
3028 dnl ========================================================
3030 MOZ_ARG_ENABLE_BOOL(verify-mar,
3031 [  --enable-verify-mar     Enable verifying MAR signatures],
3032     MOZ_VERIFY_MAR_SIGNATURE=1,
3033     MOZ_VERIFY_MAR_SIGNATURE= )
3035 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3036   AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3039 dnl ========================================================
3040 dnl Enable building the signmar program.
3041 dnl This option is much different than the --enable-verify-mar option.
3042 dnl --enable-verify-mar is for enabling the verification check on MAR
3043 dnl files in the updater.  The --enable-signmar option is for building
3044 dnl the signmar program.
3045 dnl ========================================================
3047 MOZ_ARG_ENABLE_BOOL(signmar,
3048 [  --enable-signmar     Enable building the signmar program],
3049     MOZ_ENABLE_SIGNMAR=1,
3050     MOZ_ENABLE_SIGNMAR= )
3052 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3053   if test -z "$COMPILE_ENVIRONMENT" ; then
3054     AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3055     MOZ_ENABLE_SIGNMAR=
3056   else
3057     AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3058   fi
3061 dnl ========================================================
3062 dnl Updater
3063 dnl ========================================================
3065 if test "$MOZ_IOS"; then
3066   MOZ_UPDATER=
3069 MOZ_ARG_DISABLE_BOOL(updater,
3070 [  --disable-updater       Disable building of updater],
3071     MOZ_UPDATER=,
3072     MOZ_UPDATER=1 )
3074 if test -n "$MOZ_UPDATER"; then
3075     AC_DEFINE(MOZ_UPDATER)
3078 dnl ========================================================
3079 dnl parental controls (for Windows Vista)
3080 dnl ========================================================
3081 MOZ_ARG_DISABLE_BOOL(parental-controls,
3082 [  --disable-parental-controls
3083                           Do not build parental controls],
3084    MOZ_DISABLE_PARENTAL_CONTROLS=1,
3085    MOZ_DISABLE_PARENTAL_CONTROLS=)
3086 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3087     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3090 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3092 dnl ========================================================
3093 dnl = Disable smartcard support
3094 dnl ========================================================
3095 if test -n "$MOZ_NO_SMART_CARDS"; then
3096     AC_DEFINE(MOZ_NO_SMART_CARDS)
3098 AC_SUBST(MOZ_NO_SMART_CARDS)
3100 dnl ========================================================
3101 dnl = Sandboxing support
3102 dnl ========================================================
3103 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3104     # Bug 1182565: TSan conflicts with sandboxing on Linux.
3105     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3106     case $OS_TARGET in
3107     Linux|Android)
3108         MOZ_SANDBOX=
3109         ;;
3110     esac
3113 MOZ_ARG_DISABLE_BOOL(sandbox,
3114 [  --disable-sandbox        Disable sandboxing support],
3115     MOZ_SANDBOX=,
3116     MOZ_SANDBOX=1)
3118 dnl ========================================================
3119 dnl = Content process sandboxing
3120 dnl ========================================================
3122 case "$OS_TARGET" in
3123 WINNT)
3124     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3125     ;;
3126 Darwin)
3127     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3128     ;;
3129 Linux)
3130     case $CPU_ARCH in
3131         x86_64|x86)
3132             MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3133         ;;
3134     esac
3135     ;;
3136 esac
3138 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3139 [  --enable-content-sandbox Enable sandboxing support for content-processes
3140   --disable-content-sandbox Disable sandboxing support for content-processes],
3141     MOZ_CONTENT_SANDBOX=1,
3142     MOZ_CONTENT_SANDBOX=)
3144 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3145     AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3148 if test -n "$MOZ_CONTENT_SANDBOX"; then
3149     AC_DEFINE(MOZ_CONTENT_SANDBOX)
3152 AC_SUBST(MOZ_CONTENT_SANDBOX)
3154 dnl ========================================================
3155 dnl = Gecko Media Plugin sandboxing
3156 dnl ========================================================
3157 case $OS_TARGET in
3158 WINNT)
3159     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3160     ;;
3161 Linux)
3162     case $CPU_ARCH in
3163     x86_64|x86)
3164         MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3165         ;;
3166     esac
3167     ;;
3168 Darwin)
3169     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3170     ;;
3171 esac
3173 if test -n "$MOZ_GMP_SANDBOX"; then
3174     AC_DEFINE(MOZ_GMP_SANDBOX)
3177 AC_SUBST(MOZ_GMP_SANDBOX)
3179 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3180     MOZ_SANDBOX=
3183 if test -n "$MOZ_SANDBOX"; then
3184     AC_DEFINE(MOZ_SANDBOX)
3187 AC_SUBST(MOZ_SANDBOX)
3190 dnl ========================================================
3191 dnl =
3192 dnl = Module specific options
3193 dnl =
3194 dnl ========================================================
3195 MOZ_ARG_HEADER(Individual module options)
3197 dnl ========================================================
3198 dnl = Disable feed handling components
3199 dnl ========================================================
3200 MOZ_ARG_DISABLE_BOOL(feeds,
3201 [  --disable-feeds         Disable feed handling and processing components],
3202     MOZ_FEEDS=,
3203     MOZ_FEEDS=1 )
3204 if test -n "$MOZ_FEEDS"; then
3205     AC_DEFINE(MOZ_FEEDS)
3206 else
3207     if test "$MOZ_BUILD_APP" = "browser"; then
3208         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3209     fi
3212 dnl ========================================================
3213 dnl Check for sqlite
3214 dnl ========================================================
3216 MOZ_SYSTEM_SQLITE=
3217 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3218 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
3219 MOZ_SYSTEM_SQLITE=1,
3220 MOZ_SYSTEM_SQLITE= )
3222 if test -n "$MOZ_SYSTEM_SQLITE"
3223 then
3224     dnl ============================
3225     dnl === SQLite Version check ===
3226     dnl ============================
3227     dnl Check to see if the system SQLite package is new enough.
3228     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3230     dnl ==================================
3231     dnl === SQLITE_SECURE_DELETE check ===
3232     dnl ==================================
3233     dnl Check to see if the system SQLite package is compiled with
3234     dnl SQLITE_SECURE_DELETE enabled.
3235     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3236     _SAVE_CFLAGS="$CFLAGS"
3237     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3238     _SAVE_LIBS="$LIBS"
3239     LIBS="$LIBS $SQLITE_LIBS"
3240     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3241         AC_TRY_RUN([
3242             #include "sqlite3.h"
3244             int main(int argc, char **argv){
3245               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3246             }],
3247             ac_cv_sqlite_secure_delete=yes,
3248             ac_cv_sqlite_secure_delete=no,
3249             ac_cv_sqlite_secure_delete=no
3250         )
3251     ])
3252     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3253     CFLAGS="$_SAVE_CFLAGS"
3254     LIBS="$_SAVE_LIBS"
3255     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3256         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3257     fi
3259     dnl ===============================
3260     dnl === SQLITE_THREADSAFE check ===
3261     dnl ===============================
3262     dnl Check to see if the system SQLite package is compiled with
3263     dnl SQLITE_THREADSAFE enabled.
3264     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3265     _SAVE_CFLAGS="$CFLAGS"
3266     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3267     _SAVE_LIBS="$LIBS"
3268     LIBS="$LIBS $SQLITE_LIBS"
3269     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3270         AC_TRY_RUN([
3271             #include "sqlite3.h"
3273             int main(int argc, char **argv){
3274               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3275             }],
3276             ac_cv_sqlite_threadsafe=yes,
3277             ac_cv_sqlite_threadsafe=no,
3278             ac_cv_sqlite_threadsafe=no
3279         )
3280     ])
3281     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3282     CFLAGS="$_SAVE_CFLAGS"
3283     LIBS="$_SAVE_LIBS"
3284     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3285         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3286     fi
3288     dnl ================================
3289     dnl === SQLITE_ENABLE_FTS3 check ===
3290     dnl ================================
3291     dnl check to see if the system SQLite package is compiled with
3292     dnl SQLITE_ENABLE_FTS3 enabled.
3293     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3294     _SAVE_CFLAGS="$CFLAGS"
3295     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3296     _SAVE_LIBS="$LIBS"
3297     LIBS="$LIBS $SQLITE_LIBS"
3298     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3299         AC_TRY_RUN([
3300             #include "sqlite3.h"
3302             int main(int argc, char **argv){
3303               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3304             }],
3305             ac_cv_sqlite_enable_fts3=yes,
3306             ac_cv_sqlite_enable_fts3=no,
3307             ac_cv_sqlite_enable_fts3=no
3308         )
3309     ])
3310     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3311     CFLAGS="$_SAVE_CFLAGS"
3312     LIBS="$_SAVE_LIBS"
3313     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3314         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3315     fi
3317     dnl =========================================
3318     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3319     dnl =========================================
3320     dnl check to see if the system SQLite package is compiled with
3321     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3322     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3323     _SAVE_CFLAGS="$CFLAGS"
3324     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3325     _SAVE_LIBS="$LIBS"
3326     LIBS="$LIBS $SQLITE_LIBS"
3327     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3328         AC_TRY_RUN([
3329             #include "sqlite3.h"
3331             int main(int argc, char **argv){
3332               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3333             }],
3334             ac_cv_sqlite_enable_unlock_notify=yes,
3335             ac_cv_sqlite_enable_unlock_notify=no,
3336             ac_cv_sqlite_enable_unlock_notify=no
3337         )
3338     ])
3339     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3340     CFLAGS="$_SAVE_CFLAGS"
3341     LIBS="$_SAVE_LIBS"
3342     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3343         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3344     fi
3346     dnl =========================================
3347     dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3348     dnl =========================================
3349     dnl check to see if the system SQLite package is compiled with
3350     dnl SQLITE_ENABLE_DBSTAT_VTAB.
3351     AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3352     _SAVE_CFLAGS="$CFLAGS"
3353     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3354     _SAVE_LIBS="$LIBS"
3355     LIBS="$LIBS $SQLITE_LIBS"
3356     AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3357         AC_TRY_RUN([
3358             #include "sqlite3.h"
3360             int main(int argc, char **argv){
3361               return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3362             }],
3363             ac_cv_sqlite_dbstat_vtab=yes,
3364             ac_cv_sqlite_dbstat_vtab=no,
3365             ac_cv_sqlite_dbstat_vtab=no
3366         )
3367     ])
3368     AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3369     CFLAGS="$_SAVE_CFLAGS"
3370     LIBS="$_SAVE_LIBS"
3371     if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3372         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3373     fi
3374 else
3375     dnl ==============================
3376     dnl === SQLite fdatasync check ===
3377     dnl ==============================
3378     dnl Check to see if fdatasync is available
3379     AC_CHECK_FUNC(fdatasync)
3382 if test -n "$MOZ_SYSTEM_SQLITE"; then
3383     AC_DEFINE(MOZ_SYSTEM_SQLITE)
3385 AC_SUBST(MOZ_SYSTEM_SQLITE)
3387 dnl ========================================================
3388 dnl = Disable zipwriter
3389 dnl ========================================================
3390 MOZ_ARG_DISABLE_BOOL(zipwriter,
3391 [  --disable-zipwriter     Disable zipwriter component],
3392     MOZ_ZIPWRITER=,
3393     MOZ_ZIPWRITER=1 )
3394 AC_SUBST(MOZ_ZIPWRITER)
3396 dnl ========================================================
3397 dnl =
3398 dnl = Feature options that require extra sources to be pulled
3399 dnl =
3400 dnl ========================================================
3401 dnl MOZ_ARG_HEADER(Features that require extra sources)
3403 dnl ========================================================
3404 dnl =
3405 dnl = Runtime debugging and Optimization Options
3406 dnl =
3407 dnl ========================================================
3408 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3410 dnl ========================================================
3411 dnl enable mobile optimizations
3412 dnl ========================================================
3413 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3414 [  --enable-mobile-optimize
3415                           Enable mobile optimizations],
3416     MOZ_GFX_OPTIMIZE_MOBILE=1)
3418 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3420 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3421     # We ignore paint will resample on mobile for performance.
3422     # We may want to revisit this later.
3423     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3425     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3426     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3429 dnl ========================================================
3430 dnl = Enable code optimization. ON by default.
3431 dnl ========================================================
3433 # Use value from moz.configure if one is defined. Else use our computed
3434 # value.
3435 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
3436     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
3439 MOZ_SET_FRAMEPTR_FLAGS
3441 if test "$COMPILE_ENVIRONMENT"; then
3442 if test -n "$MOZ_OPTIMIZE"; then
3443     AC_MSG_CHECKING([for valid C compiler optimization flags])
3444     _SAVE_CFLAGS=$CFLAGS
3445     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3446     AC_TRY_COMPILE([#include <stdio.h>],
3447         [printf("Hello World\n");],
3448         _results=yes,
3449         _results=no)
3450     AC_MSG_RESULT([$_results])
3451     if test "$_results" = "no"; then
3452         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3453     fi
3454     CFLAGS=$_SAVE_CFLAGS
3456 fi # COMPILE_ENVIRONMENT
3458 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
3459 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
3460 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
3461 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
3463 dnl ========================================================
3464 dnl = Disable treating compiler warnings as errors
3465 dnl ========================================================
3466 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3467    WARNINGS_AS_ERRORS=''
3470 dnl ========================================================
3471 dnl = Enable runtime logging
3472 dnl ========================================================
3473 AC_DEFINE(MOZ_LOGGING)
3474 AC_DEFINE(FORCE_PR_LOG)
3476 dnl ========================================================
3477 dnl = This will enable logging of addref, release, ctor, dtor.
3478 dnl ========================================================
3479 _ENABLE_LOGREFCNT=42
3480 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3481 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
3482     _ENABLE_LOGREFCNT=1,
3483     _ENABLE_LOGREFCNT= )
3484 if test "$_ENABLE_LOGREFCNT" = "1"; then
3485     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3486 elif test -z "$_ENABLE_LOGREFCNT"; then
3487     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3490 dnl ========================================================
3491 dnl moz_dump_painting
3492 dnl ========================================================
3493 MOZ_ARG_ENABLE_BOOL(dump-painting,
3494 [  --enable-dump-painting          Enable paint debugging.],
3495     MOZ_DUMP_PAINTING=1,
3496     MOZ_DUMP_PAINTING= )
3497 if test -n "$MOZ_DUMP_PAINTING"; then
3498     AC_DEFINE(MOZ_DUMP_PAINTING)
3499     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3501 if test -n "$MOZ_DEBUG"; then
3502     AC_DEFINE(MOZ_DUMP_PAINTING)
3505 case "${OS_TARGET}" in
3506 Android|WINNT|Darwin)
3507   MOZ_GLUE_IN_PROGRAM=
3508   ;;
3510   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3511   MOZ_GLUE_IN_PROGRAM=1
3512   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3513   ;;
3514 esac
3516 dnl ========================================================
3517 dnl = Jemalloc build setup
3518 dnl ========================================================
3519 if test -z "$MOZ_MEMORY"; then
3520   case "${target}" in
3521     *-mingw*)
3522       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3523         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.])
3524       fi
3525       ;;
3526   esac
3527 else
3528   dnl The generic feature tests that determine how to compute ncpus are long and
3529   dnl complicated.  Therefore, simply define special cpp variables for the
3530   dnl platforms we have special knowledge of.
3531   case "${target}" in
3532   *-mingw*)
3533     export MOZ_NO_DEBUG_RTL=1
3534     ;;
3535   esac
3536 fi # MOZ_MEMORY
3537 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3539 # Allow the application to provide a subconfigure script.
3540 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3541 # ldap/c-sdk/configure refers to the enviroment value.
3542 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3543   do_output_subdirs() {
3544     if test -n "$_subconfigure_subdirs"; then
3545       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3546      fi
3547     _subconfigure_subdir="$1"
3548     _subconfigure_config_args="$ac_configure_args"
3549   }
3550   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3551   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3552      "${srcdir}/build/autoconf/altoptions.m4" \
3553      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3554   . $tmpscript
3555   rm -f $tmpscript
3558 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3559 export MOZ_GLUE_WRAP_LDFLAGS
3561 dnl ========================================================
3562 dnl = Enable using the clang plugin to build
3563 dnl ========================================================
3565 if test -n "$COMPILE_ENVIRONMENT"; then
3566 MOZ_CONFIG_CLANG_PLUGIN
3567 fi # COMPILE_ENVIRONMENT
3569 dnl ========================================================
3570 dnl = Enable stripping of libs & executables
3571 dnl ========================================================
3572 MOZ_ARG_ENABLE_BOOL(strip,
3573 [  --enable-strip          Enable stripping of libs & executables ],
3574     ENABLE_STRIP=1,
3575     ENABLE_STRIP= )
3577 dnl ========================================================
3578 dnl = Enable stripping of libs & executables when packaging
3579 dnl ========================================================
3580 MOZ_ARG_ENABLE_BOOL(install-strip,
3581 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
3582     PKG_SKIP_STRIP= ,
3583     PKG_SKIP_STRIP=1)
3585 dnl ========================================================
3586 dnl = frontend JS debug mode
3587 dnl ========================================================
3589 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3590 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
3591    DEBUG_JS_MODULES=1,
3592    DEBUG_JS_MODULES=)
3594 AC_SUBST(DEBUG_JS_MODULES)
3596 dnl ========================================================
3597 dnl =
3598 dnl = Profiling and Instrumenting
3599 dnl =
3600 dnl ========================================================
3601 MOZ_ARG_HEADER(Profiling and Instrumenting)
3603 dnl ========================================================
3604 dnl = Enable TaskTracer
3605 dnl ========================================================
3606 MOZ_ARG_ENABLE_BOOL(tasktracer,
3607 [  --enable-tasktracer       Set compile flags necessary for using TaskTracer],
3608     MOZ_TASK_TRACER=1,
3609     MOZ_TASK_TRACER= )
3610 if test -n "$MOZ_TASK_TRACER"; then
3611     AC_DEFINE(MOZ_TASK_TRACER)
3612     AC_SUBST(MOZ_TASK_TRACER)
3615 dnl ========================================================
3616 dnl Turn on reflow counting
3617 dnl ========================================================
3618 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3619 [  --enable-reflow-perf    Enable reflow performance tracing],
3620     MOZ_REFLOW_PERF=1,
3621     MOZ_REFLOW_PERF= )
3622 if test -n "$MOZ_REFLOW_PERF"; then
3623     AC_DEFINE(MOZ_REFLOW_PERF)
3626 dnl ========================================================
3627 dnl = Offer a way to disable the startup cache
3628 dnl ========================================================
3630 MOZ_ARG_DISABLE_BOOL(startupcache,
3631 [  --disable-startupcache          Disable startup cache ],
3632     MOZ_DISABLE_STARTUPCACHE=1,
3633     MOZ_DISABLE_STARTUPCACHE=)
3635 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
3636   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
3638 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
3640 dnl ========================================================
3641 dnl = Support for demangling undefined symbols
3642 dnl ========================================================
3643 if test -z "$SKIP_LIBRARY_CHECKS"; then
3644     AC_LANG_SAVE
3645     AC_LANG_CPLUSPLUS
3646     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3647     AC_LANG_RESTORE
3650 # Demangle only for debug or DMD builds
3651 MOZ_DEMANGLE_SYMBOLS=
3652 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
3653     MOZ_DEMANGLE_SYMBOLS=1
3654     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3656 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3658 dnl ========================================================
3659 dnl = Support for gcc stack unwinding (from gcc 3.3)
3660 dnl ========================================================
3661 if test -z "$SKIP_LIBRARY_CHECKS"; then
3662     AC_LANG_SAVE
3663     AC_LANG_CPLUSPLUS
3664     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
3665     AC_LANG_RESTORE
3668 dnl ========================================================
3669 dnl JIT observers
3670 dnl ========================================================
3672 MOZ_ARG_WITH_STRING(jitreport-granularity,
3673 [  --jitreport-granularity=N
3674                            Default granularity at which to report JIT code
3675                            to external tools
3676                              0 - no info
3677                              1 - code ranges for whole functions only
3678                              2 - per-line information
3679                              3 - per-op information],
3680   JITREPORT_GRANULARITY=$withval,
3681   JITREPORT_GRANULARITY=3)
3683 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3685 dnl ========================================================
3686 dnl =
3687 dnl = Misc. Options
3688 dnl =
3689 dnl ========================================================
3690 MOZ_ARG_HEADER(Misc. Options)
3692 dnl ========================================================
3693 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
3694 dnl ========================================================
3695 MOZ_ARG_WITH_STRING(user-appdir,
3696 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
3697 [ val=`echo $withval`
3698 if echo "$val" | grep "\/" >/dev/null; then
3699     AC_MSG_ERROR("Homedir must be single relative path.")
3700 else
3701     MOZ_USER_DIR="$val"
3702 fi])
3704 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
3706 if test -z "$SKIP_COMPILER_CHECKS"; then
3707 dnl ========================================================
3708 dnl =
3709 dnl = Compiler Options
3710 dnl =
3711 dnl ========================================================
3712 MOZ_ARG_HEADER(Compiler Options)
3714 dnl ========================================================
3715 dnl Check for gcc -pipe support
3716 dnl ========================================================
3717 AC_MSG_CHECKING([for -pipe support])
3718 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3719     dnl Any gcc that supports firefox supports -pipe.
3720     CFLAGS="$CFLAGS -pipe"
3721     CXXFLAGS="$CXXFLAGS -pipe"
3722     AC_MSG_RESULT([yes])
3723 else
3724     AC_MSG_RESULT([no])
3727 fi # ! SKIP_COMPILER_CHECKS
3729 AC_DEFINE(CPP_THROW_NEW, [throw()])
3730 AC_LANG_C
3732 if test "$COMPILE_ENVIRONMENT"; then
3733 MOZ_EXPAND_LIBS
3734 fi # COMPILE_ENVIRONMENT
3736 dnl ========================================================
3737 dnl =
3738 dnl = Build depencency options
3739 dnl =
3740 dnl ========================================================
3741 MOZ_ARG_HEADER(Build dependencies)
3743 if test "$COMPILE_ENVIRONMENT"; then
3744 if test "$GNU_CC" -a "$GNU_CXX"; then
3745   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3746 else
3747   # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
3748   # the underlying cc1 binary understands how to generate dependency files.
3749   # These options are based on analyzing what the normal clang driver sends to
3750   # cc1 when given the "correct" dependency options.
3751   if test -n "$CLANG_CL"; then
3752    _DEPEND_CFLAGS='-Xclang -MP -Xclang -MG -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
3753   fi
3754   dnl Don't override this for MSVC
3755   if test -z "$_WIN32_MSVC"; then
3756     _USE_CPP_INCLUDE_FLAG=
3757     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3758     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3759   else
3760     echo '#include <stdio.h>' > dummy-hello.c
3761     changequote(,)
3762     dnl This output is localized, split at the first double space or colon and space.
3763     _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
3764     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3765     _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3766     changequote([,])
3767     if ! test -e "$_CL_STDIO_PATH"; then
3768         AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3769     fi
3770     if test -z "$CL_INCLUDES_PREFIX"; then
3771         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3772     fi
3773     AC_SUBST(CL_INCLUDES_PREFIX)
3774     rm -f dummy-hello.c
3776     dnl Make sure that the build system can handle non-ASCII characters
3777     dnl in environment variables to prevent it from breaking silently on
3778     dnl non-English systems.
3779     NONASCII=$'\241\241'
3780     AC_SUBST(NONASCII)
3781   fi
3783 fi # COMPILE_ENVIRONMENT
3785 dnl ========================================================
3786 dnl =
3787 dnl = Static Build Options
3788 dnl =
3789 dnl ========================================================
3790 MOZ_ARG_HEADER(Static build options)
3792 if test -z "$MOZ_SYSTEM_ZLIB"; then
3793 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
3794   ZLIB_IN_MOZGLUE=1
3795   AC_DEFINE(ZLIB_IN_MOZGLUE)
3799 AC_SUBST(ZLIB_IN_MOZGLUE)
3801 dnl ========================================================
3802 dnl =
3803 dnl = Standalone module options
3804 dnl =
3805 dnl ========================================================
3806 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3808 dnl Check for GLib.
3809 dnl ========================================================
3811 if test -z "$SKIP_PATH_CHECKS"; then
3812 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
3813     if test "$MOZ_ENABLE_GTK" ; then
3814         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
3815     fi
3819 if test -z "${GLIB_GMODULE_LIBS}" \
3820    -a -n "${GLIB_CONFIG}"\
3821     -a "${GLIB_CONFIG}" != no\
3822 ; then
3823     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
3826 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
3828 if test "$USE_FC_FREETYPE"; then
3829     if test "$COMPILE_ENVIRONMENT"; then
3830         dnl ========================================================
3831         dnl = Check for freetype2 functionality
3832         dnl ========================================================
3833         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
3834             _SAVE_LIBS="$LIBS"
3835             _SAVE_CFLAGS="$CFLAGS"
3836             LIBS="$LIBS $FT2_LIBS"
3837             CFLAGS="$CFLAGS $FT2_CFLAGS"
3839             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3840                 ac_cv_member_FT_Bitmap_Size_y_ppem,
3841                 [AC_TRY_COMPILE([#include <ft2build.h>
3842                                  #include FT_FREETYPE_H],
3843                                 [FT_Bitmap_Size s;
3844                                  if (sizeof s.y_ppem) return 0;
3845                                  return 1],
3846                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3847                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3848             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3849                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3850             else
3851                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3852             fi
3853             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3854                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3855                                [FT_Bitmap_Size structure includes y_ppem field])
3857             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3859             LIBS="$_SAVE_LIBS"
3860             CFLAGS="$_SAVE_CFLAGS"
3861         fi
3863         _SAVE_CPPFLAGS="$CPPFLAGS"
3864         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3865         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3866             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3867         CPPFLAGS="$_SAVE_CPPFLAGS"
3868     fi
3871 dnl ========================================================
3872 dnl Check if we need the 32-bit Linux SSE2 error dialog
3873 dnl ========================================================
3875 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3877 dnl ========================================================
3878 dnl Check for pixman and cairo
3879 dnl ========================================================
3881 MOZ_TREE_CAIRO=1
3882 MOZ_ARG_ENABLE_BOOL(system-cairo,
3883 [ --enable-system-cairo  Obsolete: do not use this option],
3884 AC_MSG_ERROR(--enable-system-cairo is not supported),
3885 MOZ_TREE_CAIRO=1 )
3887 MOZ_TREE_PIXMAN=1
3888 MOZ_ARG_ENABLE_BOOL(system-pixman,
3889 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
3890 MOZ_TREE_PIXMAN=,
3891 MOZ_TREE_PIXMAN=force,
3892 MOZ_TREE_PIXMAN=1 )
3894 if test "$MOZ_TREE_PIXMAN"; then
3895     AC_DEFINE(MOZ_TREE_PIXMAN)
3896 else
3897     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
3900 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
3901 AC_DEFINE(MOZ_TREE_CAIRO)
3903 if test "$OS_ARCH" = "WINNT"; then
3904     # For now we assume that we will have a uint64_t available through
3905     # one of the above headers or mozstdint.h.
3906     AC_DEFINE(HAVE_UINT64_T)
3909 # Define macros for cairo-features.h
3910 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
3911 if test "$MOZ_X11"; then
3912     XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
3913     XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
3914     PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
3916 if test "$_HAVE_FREETYPE2"; then
3917     FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3918     MOZ_ENABLE_CAIRO_FT=1
3919     CAIRO_FT_CFLAGS="$FT2_CFLAGS"
3922 case "$MOZ_WIDGET_TOOLKIT" in
3923   cocoa | uikit)
3924     QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
3925     QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
3926     QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
3927     ;;
3928   windows)
3929     WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
3930     WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
3931     WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
3932     WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
3933     MOZ_ENABLE_D2D_SURFACE=1
3935     if test "$COMPILE_ENVIRONMENT"; then
3937       dnl D3D10 Layers depend on D2D Surfaces.
3938       if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
3939         MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
3940       fi
3941     fi
3942     ;;
3943 esac
3944 if test "$USE_FC_FREETYPE"; then
3945     FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
3947 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
3948 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
3949 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
3951 AC_SUBST(PS_SURFACE_FEATURE)
3952 AC_SUBST(SVG_SURFACE_FEATURE)
3953 AC_SUBST(XLIB_SURFACE_FEATURE)
3954 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
3955 AC_SUBST(QUARTZ_SURFACE_FEATURE)
3956 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
3957 AC_SUBST(WIN32_SURFACE_FEATURE)
3958 AC_SUBST(OS2_SURFACE_FEATURE)
3959 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
3960 AC_SUBST(FT_FONT_FEATURE)
3961 AC_SUBST(FC_FONT_FEATURE)
3962 AC_SUBST(WIN32_FONT_FEATURE)
3963 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
3964 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
3965 AC_SUBST(QUARTZ_FONT_FEATURE)
3966 AC_SUBST(PNG_FUNCTIONS_FEATURE)
3967 AC_SUBST(QT_SURFACE_FEATURE)
3968 AC_SUBST(TEE_SURFACE_FEATURE)
3970 if test "$MOZ_X11"; then
3971     MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
3974 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
3976 case "$MOZ_WIDGET_TOOLKIT" in
3977 android)
3978     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
3979     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
3980     ;;
3981 esac
3983 AC_SUBST(MOZ_TREE_CAIRO)
3984 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
3985 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
3986 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
3987 AC_SUBST(MOZ_TREE_PIXMAN)
3989 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
3990 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
3992 dnl ========================================================
3993 dnl disable xul
3994 dnl ========================================================
3995 MOZ_ARG_DISABLE_BOOL(xul,
3996 [  --disable-xul           Disable XUL],
3997     MOZ_XUL= )
3998 if test "$MOZ_XUL"; then
3999   AC_DEFINE(MOZ_XUL)
4000 else
4001   dnl remove extensions that require XUL
4002   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4005 AC_SUBST(MOZ_XUL)
4007 dnl ========================================================
4008 dnl necko configuration options
4009 dnl ========================================================
4012 dnl option to disable necko's wifi scanner
4015 if test "$MOZ_WIDGET_TOOLKIT"; then
4017   case "$OS_TARGET" in
4018     Darwin)
4019       if test -z "$MOZ_IOS"; then
4020         NECKO_WIFI=1
4021       fi
4022       ;;
4023     DragonFly|FreeBSD|WINNT)
4024       NECKO_WIFI=1
4025       ;;
4026     Linux)
4027       NECKO_WIFI=1
4028       NECKO_WIFI_DBUS=1
4029       ;;
4030   esac
4034 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4035 [  --disable-necko-wifi    Disable necko wifi scanner],
4036     NECKO_WIFI=,
4037     NECKO_WIFI=1)
4039 if test "$NECKO_WIFI"; then
4040   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4041     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4042   fi
4043   AC_DEFINE(NECKO_WIFI)
4044   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4046 AC_SUBST(NECKO_WIFI)
4047 AC_SUBST(NECKO_WIFI_DBUS)
4050 dnl option to disable cookies
4052 MOZ_ARG_DISABLE_BOOL(cookies,
4053 [  --disable-cookies       Disable cookie support],
4054     NECKO_COOKIES=,
4055     NECKO_COOKIES=1)
4056 AC_SUBST(NECKO_COOKIES)
4057 if test "$NECKO_COOKIES"; then
4058     AC_DEFINE(NECKO_COOKIES)
4059     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4062 dnl ========================================================
4063 dnl =
4064 dnl = Maintainer debug option (no --enable equivalent)
4065 dnl =
4066 dnl ========================================================
4068 AC_SUBST(AR)
4069 AC_SUBST(AR_FLAGS)
4070 AC_SUBST(AR_EXTRACT)
4071 AC_SUBST(AS)
4072 AC_SUBST(NM)
4073 AC_SUBST_LIST(ASFLAGS)
4074 AC_SUBST(AS_DASH_C_FLAG)
4075 AC_SUBST(RC)
4076 AC_SUBST(RCFLAGS)
4077 AC_SUBST(WINDRES)
4078 AC_SUBST(IMPLIB)
4079 AC_SUBST(FILTER)
4080 AC_SUBST(MOZ_AUTH_EXTENSION)
4081 AC_SUBST(MOZ_PREF_EXTENSIONS)
4082 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
4083 AC_SUBST(WARNINGS_AS_ERRORS)
4084 AC_SUBST_SET(MOZ_EXTENSIONS)
4085 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4086 AC_SUBST(MOZ_FEEDS)
4088 AC_SUBST(MOZ_UNIVERSALCHARDET)
4089 AC_SUBST(ACCESSIBILITY)
4090 AC_SUBST(MOZ_SPELLCHECK)
4091 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4092 AC_SUBST(MOZ_CRASHREPORTER)
4093 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4094 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4095 AC_SUBST(MOZ_STUB_INSTALLER)
4096 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4097 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4098 AC_SUBST(MOZ_UPDATER)
4100 AC_SUBST(MOZ_ANGLE_RENDERER)
4101 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4102 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4103 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4104 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4106 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4107 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4108 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4109 AC_SUBST(ENABLE_STRIP)
4110 AC_SUBST(PKG_SKIP_STRIP)
4111 AC_SUBST(STRIP_FLAGS)
4112 AC_SUBST(INCREMENTAL_LINKER)
4114 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
4116 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4117 AC_SUBST(MOZ_LINKER_EXTRACT)
4119 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4120   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4123 AC_SUBST(MOZ_ADDON_SIGNING)
4124 if test "$MOZ_ADDON_SIGNING" = 1; then
4125   AC_DEFINE(MOZ_ADDON_SIGNING)
4127 AC_SUBST(MOZ_REQUIRE_SIGNING)
4128 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4129   AC_DEFINE(MOZ_REQUIRE_SIGNING)
4132 dnl ========================================================
4133 dnl = Mac bundle name prefix
4134 dnl ========================================================
4135 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4136 [  --with-macbundlename-prefix=prefix
4137                           Prefix for MOZ_MACBUNDLE_NAME],
4138 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4140 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
4141 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4142   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4145 if test "$MOZ_DEBUG"; then
4146   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
4147 else
4148   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4150 AC_SUBST(MOZ_MACBUNDLE_NAME)
4152 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4153 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
4154 # Otherwise, use MOZ_APP_DISPLAYNAME
4155 if test -z "$MOZ_MACBUNDLE_ID"; then
4156    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
4158 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4159 if test "$MOZ_DEBUG"; then
4160   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4163 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4164 AC_SUBST(MOZ_MACBUNDLE_ID)
4166 dnl ========================================================
4167 dnl = Child Process Name for IPC
4168 dnl ========================================================
4169 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4170   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4171 else
4172   # We want to let Android unpack the file at install time, but it only does
4173   # so if the file is named libsomething.so. The lib/ path is also required
4174   # because the unpacked file will be under the lib/ subdirectory and will
4175   # need to be executed from that path.
4176   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4178 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4179 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4181 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4182 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4183 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4185 # The following variables are available to branding and application
4186 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4187 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4188 # impacts profile location and user-visible fields.
4189 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4190 # versions of a given application (e.g. Aurora and Firefox both use
4191 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4192 # for application.ini's "Name" field, which controls profile location in
4193 # the absence of a "Profile" field (see below), and various system
4194 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4195 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4196 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4197 # builds (e.g. Aurora for Firefox).
4198 # - MOZ_APP_VERSION: Defines the application version number.
4199 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4200 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4201 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4202 # defaults to a lowercase form of MOZ_APP_BASENAME.
4203 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4204 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4205 # - MOZ_APP_PROFILE: When set, used for application.ini's
4206 # "Profile" field, which controls profile location.
4207 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4208 # crash reporter server url.
4209 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4210 # the main application is set to the value of this variable.  If not
4211 # set, it falls back to a Mozilla-specific value derived from the
4212 # build ID.
4213 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4214 # packages produced.
4215 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used.  GCM
4216 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4217 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4218 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4220 if test -z "$MOZ_APP_NAME"; then
4221    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4224 if test -z "$MOZ_APP_REMOTINGNAME"; then
4225    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4228 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4229    MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4232 if test -z "$ANDROID_PACKAGE_NAME" ; then
4233    # When we got rid of the Aurora channel we decided to replace the old
4234    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4235    # by all mozilla-central based branches we make this the new "default"
4236    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4237    # in their mozconfig, so they will never get this. If there are ever
4238    # non-Fennec builds for Android, they will fall into the else block
4239    # and use their own default name.
4240    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4241    # background on this.
4242    if test "$MOZ_APP_NAME" = "fennec"; then
4243       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4244    else
4245       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4246    fi
4249 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4250 # the public with specific common shared IDs and we need to keep them
4251 # consistent forever.  The specific common values are set by per-channel
4252 # branding; all other channels use a generic sharedID, set below.
4253 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4254    MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4257 # For extensions and langpacks, we require a max version that is compatible
4258 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4259 # 24.0a1 and 24.0a2 aren't affected
4260 # 24.0 becomes 24.*
4261 # 24.1.1 becomes 24.*
4262 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4263 if test -z "$IS_ALPHA"; then
4264   changequote(,)
4265   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4266     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4267   else
4268     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4269   fi
4270   changequote([,])
4271 else
4272   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4275 AC_SUBST(MOZ_APP_NAME)
4276 AC_SUBST(MOZ_APP_REMOTINGNAME)
4277 AC_SUBST(MOZ_APP_DISPLAYNAME)
4278 AC_SUBST(MOZ_APP_BASENAME)
4279 AC_SUBST(MOZ_APP_VENDOR)
4280 AC_SUBST(MOZ_APP_PROFILE)
4281 AC_SUBST(MOZ_APP_ID)
4282 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4283 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4284 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4285 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4286 AC_SUBST(MAR_CHANNEL_ID)
4287 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4288 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4289 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4290 AC_SUBST(MOZ_APP_UA_NAME)
4291 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4292 AC_SUBST(MOZ_APP_VERSION)
4293 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4294 AC_SUBST(MOZ_APP_MAXVERSION)
4295 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4296 AC_SUBST(FIREFOX_VERSION)
4297 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4298 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4299   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4302 AC_SUBST(MOZ_PKG_SPECIAL)
4303 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4305 if test "$MOZILLA_OFFICIAL"; then
4306     # Build revisions should always be present in official builds
4307     MOZ_INCLUDE_SOURCE_INFO=1
4310 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4311 # explicitly set the repository and changeset information in.
4312 AC_SUBST(MOZ_SOURCE_REPO)
4313 AC_SUBST(MOZ_SOURCE_CHANGESET)
4314 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4316 if test "$MOZ_TELEMETRY_REPORTING"; then
4317     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4319     # Enable Telemetry by default for nightly and aurora channels
4320     if test -z "$RELEASE_OR_BETA"; then
4321       AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4322     fi
4325 dnl If we have any service that uploads data (and requires data submission
4326 dnl policy alert), set MOZ_DATA_REPORTING.
4327 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4328 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4329   MOZ_DATA_REPORTING=1
4330   AC_DEFINE(MOZ_DATA_REPORTING)
4331   AC_SUBST(MOZ_DATA_REPORTING)
4334 dnl win32 options
4335 AC_SUBST(WIN32_REDIST_DIR)
4336 AC_SUBST(WIN_UCRT_REDIST_DIR)
4337 AC_SUBST(WIN_DIA_SDK_BIN_DIR)
4339 dnl ========================================================
4340 dnl ICU Support
4341 dnl ========================================================
4343 _INTL_API=yes
4345 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4346     USE_ICU=1
4349 MOZ_CONFIG_ICU()
4351 dnl Echo the CFLAGS to remove extra whitespace.
4352 CFLAGS=`echo \
4353     $_WARNINGS_CFLAGS \
4354     $_COMPILATION_CFLAGS \
4355     $CFLAGS`
4357 CXXFLAGS=`echo \
4358     $_WARNINGS_CXXFLAGS \
4359     $_COMPILATION_CXXFLAGS \
4360     $CXXFLAGS`
4362 COMPILE_CFLAGS=`echo \
4363     $_DEFINES_CFLAGS \
4364     $COMPILE_CFLAGS`
4366 COMPILE_CXXFLAGS=`echo \
4367     $_DEFINES_CXXFLAGS \
4368     $COMPILE_CXXFLAGS`
4370 HOST_CFLAGS=`echo \
4371     $_WARNINGS_HOST_CFLAGS \
4372     $_COMPILATION_HOST_CFLAGS \
4373     $HOST_CFLAGS`
4375 HOST_CXXFLAGS=`echo \
4376     $_WARNINGS_HOST_CXXFLAGS \
4377     $_COMPILATION_HOST_CXXFLAGS \
4378     $HOST_CXXFLAGS`
4380 AC_SUBST(_DEPEND_CFLAGS)
4381 AC_SUBST(MOZ_SYSTEM_JPEG)
4382 AC_SUBST(MOZ_SYSTEM_PNG)
4384 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4385 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4386 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4387 AC_SUBST_LIST(MOZ_PNG_LIBS)
4389 AC_SUBST(MOZ_SYSTEM_NSPR)
4391 AC_SUBST(MOZ_SYSTEM_NSS)
4393 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
4394 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4395 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
4396 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4397 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4398   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4399   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4401 AC_SUBST(HOST_CMFLAGS)
4402 AC_SUBST(HOST_CMMFLAGS)
4403 AC_SUBST(OS_COMPILE_CMFLAGS)
4404 AC_SUBST(OS_COMPILE_CMMFLAGS)
4406 OS_CFLAGS="$CFLAGS"
4407 OS_CXXFLAGS="$CXXFLAGS"
4408 OS_CPPFLAGS="$CPPFLAGS"
4409 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4410 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4411 OS_LDFLAGS="$LDFLAGS"
4412 OS_LIBS="$LIBS"
4413 AC_SUBST_LIST(OS_CFLAGS)
4414 AC_SUBST_LIST(OS_CXXFLAGS)
4415 AC_SUBST_LIST(OS_CPPFLAGS)
4416 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
4417 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
4418 AC_SUBST_LIST(OS_LDFLAGS)
4419 AC_SUBST(OS_LIBS)
4421 AC_SUBST(HOST_CC)
4422 AC_SUBST(HOST_CXX)
4423 AC_SUBST_LIST(HOST_CFLAGS)
4424 AC_SUBST_LIST(HOST_CPPFLAGS)
4425 AC_SUBST_LIST(HOST_CXXFLAGS)
4426 AC_SUBST(HOST_LDFLAGS)
4427 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
4428 AC_SUBST(HOST_AR)
4429 AC_SUBST(HOST_AR_FLAGS)
4430 AC_SUBST(HOST_RANLIB)
4431 AC_SUBST(HOST_BIN_SUFFIX)
4433 AC_SUBST(TARGET_XPCOM_ABI)
4434 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4435 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4436 AC_SUBST(HAVE_X86_AVX2)
4437 AC_SUBST(HAVE_ALTIVEC)
4438 AC_SUBST(GCC_USE_GNU_LD)
4440 AC_SUBST(MKSHLIB)
4441 AC_SUBST(MKCSHLIB)
4442 AC_SUBST_LIST(DSO_CFLAGS)
4443 AC_SUBST_LIST(DSO_PIC_CFLAGS)
4444 AC_SUBST(DSO_LDOPTS)
4445 AC_SUBST(BIN_SUFFIX)
4446 AC_SUBST(USE_N32)
4447 AC_SUBST(CC_VERSION)
4448 AC_SUBST(NS_ENABLE_TSF)
4449 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4450 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4452 AC_SUBST(MOZ_FFVPX)
4453 AC_SUBST(MOZ_FFVPX_FLACONLY)
4454 AC_SUBST_LIST(FFVPX_ASFLAGS)
4455 AC_SUBST(VPX_USE_YASM)
4456 AC_SUBST_LIST(VPX_ASFLAGS)
4457 AC_SUBST(VPX_AS_CONVERSION)
4458 AC_SUBST(VPX_X86_ASM)
4459 AC_SUBST(VPX_ARM_ASM)
4460 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4461 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4462 AC_SUBST(MOZ_LIBAV_FFT)
4463 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4464 AC_SUBST(MOZ_DEVTOOLS)
4466 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4467 AC_SUBST(MOZ_FOLD_LIBS)
4468 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4470 AC_SUBST(DMG_TOOL)
4472 dnl Host JavaScript runtime, if any, to use during cross compiles.
4473 AC_SUBST(JS_BINARY)
4475 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4477 if test -n "$COMPILE_ENVIRONMENT"; then
4478 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4480 dnl Check for missing components
4481 if test "$MOZ_X11"; then
4482     dnl ====================================================
4483     dnl = Check if X headers exist
4484     dnl ====================================================
4485     _SAVE_CFLAGS=$CFLAGS
4486     CFLAGS="$CFLAGS $XCFLAGS"
4487     AC_TRY_COMPILE([
4488         #include <stdio.h>
4489         #include <stdlib.h>
4490         #include <X11/Xlib.h>
4491         #include <X11/Intrinsic.h>
4492         #include <X11/extensions/XShm.h>
4493     ],
4494     [
4495         Display *dpy = 0;
4496         if ((dpy = XOpenDisplay(NULL)) == NULL) {
4497             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4498             exit(1);
4499         }
4500     ], [],
4501     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4502     CFLAGS="$_SAVE_CFLAGS"
4504     if test -n "$MISSING_X"; then
4505         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4506     fi
4508 fi # MOZ_X11
4510 fi # COMPILE_ENVIRONMENT
4512 dnl Set various defines and substitutions
4513 dnl ========================================================
4515 if test "$MOZ_DEBUG"; then
4516     AC_DEFINE(MOZ_REFLOW_PERF)
4517     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4520 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4521     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4522     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4523     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4524     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4525     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4526     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4527     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4528     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4531 AC_SUBST(MOZ_DEV_EDITION)
4532 if test -n "$MOZ_DEV_EDITION"; then
4533     AC_DEFINE(MOZ_DEV_EDITION)
4536 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
4537     A11Y_LOG=1
4539 AC_SUBST(A11Y_LOG)
4540 if test -n "$A11Y_LOG"; then
4541     AC_DEFINE(A11Y_LOG)
4544 dnl Spit out some output
4545 dnl ========================================================
4547 dnl The following defines are used by xpcom
4548 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
4549 CPP_THROW_NEW
4550 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
4551 HAVE_GETPAGESIZE
4552 HAVE_STATVFS64
4553 HAVE_STATVFS
4554 HAVE_STATFS64
4555 HAVE_STATFS
4556 HAVE_SYS_STATVFS_H
4557 HAVE_SYS_STATFS_H
4558 HAVE_SYS_VFS_H
4559 HAVE_SYS_MOUNT_H
4562 # Avoid using obsolete NSPR features
4563 AC_DEFINE(NO_NSPR_10_SUPPORT)
4565 # Don't build NSS libpkix
4566 NSS_DISABLE_LIBPKIX=1
4567 AC_SUBST(NSS_DISABLE_LIBPKIX)
4569 MOZ_CREATE_CONFIG_STATUS()
4571 if test -z "$direct_nspr_config"; then
4572     dnl ========================================================
4573     dnl = Setup a nice relatively clean build environment for
4574     dnl = sub-configures.
4575     dnl ========================================================
4576     CC="$_SUBDIR_CC"
4577     CXX="$_SUBDIR_CXX"
4578     CFLAGS="$_SUBDIR_CFLAGS"
4579     CPPFLAGS="$_SUBDIR_CPPFLAGS"
4580     CXXFLAGS="$_SUBDIR_CXXFLAGS"
4581     LDFLAGS="$_SUBDIR_LDFLAGS"
4582     HOST_CC="$_SUBDIR_HOST_CC"
4583     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4584     HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4585     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4586     RC=
4589 unset MAKEFILES
4590 unset CONFIG_FILES
4592 # Run all configure scripts specified by a subconfigure
4593 if test -n "$_subconfigure_subdir"; then
4594   _save_srcdir="$srcdir"
4595   srcdir="$srcdir/.."
4596   _save_ac_configure_args="$ac_configure_args"
4597   ac_configure_args="$_subconfigure_config_args"
4598   AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
4599   ac_configure_args="$_save_ac_configure_args"
4600   srcdir="$_save_srcdir"
4603 if test "$COMPILE_ENVIRONMENT" -a "$MOZ_WIDGET_TOOLKIT"; then
4606 dnl ========================================================
4607 dnl = Setup a nice relatively clean build environment for
4608 dnl = sub-configures.
4609 dnl ========================================================
4610 CC="$_SUBDIR_CC"
4611 CXX="$_SUBDIR_CXX"
4612 CFLAGS="$_SUBDIR_CFLAGS"
4613 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4614 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4615 LDFLAGS="$_SUBDIR_LDFLAGS"
4616 HOST_CC="$_SUBDIR_HOST_CC"
4617 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4618 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4619 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4622 # Run the SpiderMonkey 'configure' script.
4623 dist=$MOZ_BUILD_ROOT/dist
4624 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4626 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
4627 # and $NSPR_LIBS.
4628 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
4630 if test "$_INTL_API" = no; then
4631     ac_configure_args="$ac_configure_args --without-intl-api"
4634 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
4635     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
4636     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
4638 ac_configure_args="$ac_configure_args --prefix=$dist"
4639 if test -n "$ZLIB_IN_MOZGLUE"; then
4640    MOZ_ZLIB_LIBS=
4642 export MOZ_SYSTEM_ZLIB
4643 export MOZ_ZLIB_CFLAGS
4644 export MOZ_ZLIB_LIBS
4645 export MOZ_APP_NAME
4646 export MOZ_APP_REMOTINGNAME
4647 export MOZ_DEV_EDITION
4648 export RUSTC
4649 export MOZILLA_CENTRAL_PATH=$_topsrcdir
4650 export STLPORT_CPPFLAGS
4651 export STLPORT_LIBS
4652 unset MOZ_BUILD_APP
4653 export DIST
4654 export MOZ_LINKER
4655 export ZLIB_IN_MOZGLUE
4656 export AR
4657 export RANLIB
4658 export CPP
4659 export CC
4660 export CXX
4661 export ARFLAGS
4662 export CPPFLAGS
4663 export CFLAGS
4664 export CXXFLAGS
4665 export LDFLAGS
4666 export HOST_CC
4667 export HOST_CXX
4668 export HOST_CFLAGS
4669 export HOST_CPPFLAGS
4670 export HOST_CXXFLAGS
4671 export HOST_LDFLAGS
4673 if ! test -e js; then
4674     mkdir js
4677 ac_configure_args="$ac_configure_args JS_STANDALONE="
4678 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
4679 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4681 fi # COMPILE_ENVIRONMENT
4683 dnl we need to run config.status after js/src subconfigure because we're
4684 dnl traversing its moz.build and we need its config.status for that.
4685 dnl However, writing our own config.status needs to happen before
4686 dnl subconfigures because the setup surrounding subconfigures alters
4687 dnl many AC_SUBSTed variables.
4688 MOZ_RUN_ALL_SUBCONFIGURES()
4690 rm -fr confdefs* $ac_clean_files