webdriver: Implement Fullscreen command support (#100)
[gecko.git] / old-configure.in
blob7e5f3d085fc3e37d22f680eb15ec307f54b29806
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=10631
50 NSPR_VERSION=4
51 NSPR_MINVER=4.16
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.20.1
71 dnl Set various checks
72 dnl ========================================================
73 MISSING_X=
75 dnl Initialize the Pthread test variables early so they can be
76 dnl  overridden by each platform.
77 dnl ========================================================
78 MOZ_USE_PTHREADS=
79 _PTHREAD_LDFLAGS=""
81 MOZ_DEFAULT_COMPILER
83 if test "$COMPILE_ENVIRONMENT"; then
84     MOZ_ANDROID_NDK
85 fi # COMPILE_ENVIRONMENT
87 case "$target" in
88 *-android*|*-linuxandroid*)
89     AC_DEFINE(ANDROID)
90     ;;
91 *-linux*)
92     AC_PATH_PROG(OBJCOPY,objcopy)
93     ;;
94 esac
96 case "$target" in
97 *-apple-darwin*)
98     MOZ_IOS_SDK
99     ;;
100 esac
102 AC_SUBST(ANDROID_SOURCE)
103 AC_SUBST(ANDROID_PACKAGE_NAME)
104 AC_SUBST(OBJCOPY)
106 dnl ========================================================
107 dnl Checks for compilers.
108 dnl ========================================================
110 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
111 AR_FLAGS='crs $@'
113 if test "$COMPILE_ENVIRONMENT"; then
115 if test "$target" != "$host"; then
116     MOZ_CROSS_COMPILER
117 else
118     AC_PROG_CC
119     case "$target" in
120     *-mingw*)
121       # Work around the conftest.exe access problem on Windows
122       sleep 2
123     esac
124     AC_PROG_CXX
125     AC_PROG_RANLIB
126     MOZ_PATH_PROGS(AS, $AS as, $CC)
127     AC_CHECK_PROGS(AR, ar, :)
128     AC_CHECK_PROGS(STRIP, strip, :)
129     AC_CHECK_PROGS(WINDRES, windres, :)
130     AC_CHECK_PROGS(OTOOL, otool, :)
131     if test -z "$HOST_RANLIB"; then
132         HOST_RANLIB="$RANLIB"
133     fi
134     if test -z "$HOST_AR"; then
135         HOST_AR="$AR"
136     fi
137     if test -z "$HOST_AR_FLAGS"; then
138         HOST_AR_FLAGS="$AR_FLAGS"
139     fi
142 if test -n "$MOZ_WINCONSOLE"; then
143     AC_DEFINE(MOZ_WINCONSOLE)
146 MOZ_TOOL_VARIABLES
148 dnl ========================================================
149 dnl Special win32 checks
150 dnl ========================================================
152 WINVER=601
154 case "$target" in
155 *-mingw*)
156     if test "$GCC" != "yes"; then
157         # Check to see if we are really running in a msvc environemnt
158         _WIN32_MSVC=1
159         AC_CHECK_PROGS(MIDL, midl)
161         # Make sure compilers are valid
162         CFLAGS="$CFLAGS -TC -nologo"
163         CXXFLAGS="$CXXFLAGS -TP -nologo"
164         AC_LANG_SAVE
165         AC_LANG_C
166         AC_TRY_COMPILE([#include <stdio.h>],
167             [ printf("Hello World\n"); ],,
168             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
170         AC_LANG_CPLUSPLUS
171         AC_TRY_COMPILE([#include <new.h>],
172             [ unsigned *test = new unsigned(42); ],,
173             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
174         AC_LANG_RESTORE
176         changequote(,)
177         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
178         changequote([,])
180         _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
182         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
183         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
184         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
186         case "$CC_VERSION" in
187         19*)
188             _CC_SUITE=14
189             MSVC_C_RUNTIME_DLL=vcruntime140.dll
190             MSVC_CXX_RUNTIME_DLL=msvcp140.dll
192             MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
193             if test -n "$MSVC_HAS_DIA_SDK"; then
194                 AC_DEFINE(MSVC_HAS_DIA_SDK)
195             fi
197             # C5026: move constructor was implicitly defined as deleted
198             CXXFLAGS="$CXXFLAGS -wd5026"
200             # C5027: move assignment operator was implicitly defined as deleted
201             CXXFLAGS="$CXXFLAGS -wd5027"
203             # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
204             CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
206             # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
207             # for dbghelp.h, imagehlp.h, and shobj.h
208             # C4091: 'typedef ': ignored on left of '' when no variable is declared
209             CFLAGS="$CFLAGS -wd4091"
210             CXXFLAGS="$CXXFLAGS -wd4091"
212             # This is intended as a temporary hack to support building with VS2015.
213             # 'noexcept' used with no exception handling mode specified;
214             # termination on exception is not guaranteed. Specify /EHsc
215             CXXFLAGS="$CXXFLAGS -wd4577"
217             if test -n "$WIN_UCRT_REDIST_DIR"; then
218               if test ! -d "$WIN_UCRT_REDIST_DIR"; then
219                 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
220               fi
221               WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
222             fi
223             ;;
224         esac
225         AC_SUBST(MSVC_HAS_DIA_SDK)
226         AC_SUBST(MSVC_C_RUNTIME_DLL)
227         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
229         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
231         if test -n "$WIN32_REDIST_DIR"; then
232           if test ! -d "$WIN32_REDIST_DIR"; then
233             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
234           fi
235           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
236         fi
238         # Check linker version
239         _LD_FULL_VERSION=`"${LINK}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
240         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
241         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
242             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
243         fi
245         INCREMENTAL_LINKER=1
247         # Set midl environment
248         case "$target" in
249         i*86-*)
250             MIDL_FLAGS="${MIDL_FLAGS} -env win32"
251             ;;
252         x86_64-*)
253             MIDL_FLAGS="${MIDL_FLAGS} -env x64"
254             ;;
255         esac
257         unset _MSVC_VER_FILTER
259         AC_CACHE_CHECK(for overridable _RAISE,
260                        ac_cv_have__RAISE,
261             [
262                 AC_LANG_SAVE
263                 AC_LANG_CPLUSPLUS
264                 _SAVE_CXXFLAGS="$CXXFLAGS"
265                 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
266                 AC_TRY_COMPILE([#include <xstddef>
267                                 #undef _RAISE
268                                 #define _RAISE(x) externallyDefinedFunction((x).what())
269                                 #include <vector>
270                                ],
271                                [std::vector<int> v; return v.at(1);],
272                                ac_cv_have__RAISE="no",
273                                ac_cv_have__RAISE="yes")
274                 CXXFLAGS="$_SAVE_CXXFLAGS"
275                 AC_LANG_RESTORE
276             ])
277         if test "$ac_cv_have__RAISE" = "yes"; then
278             WRAP_STL_INCLUDES=1
279             MOZ_MSVC_STL_WRAP_RAISE=1
280             AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
281         else
282             AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
283         fi
285         if test "$WRAP_STL_INCLUDES" = "1"; then
286             STL_FLAGS="-I${DIST}/stl_wrappers"
287         fi
288         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
289         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
290     else
291         # Check w32api version
292         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
293         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
294         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
295         AC_TRY_COMPILE([#include <w32api.h>],
296             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
297                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
298                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
299                 #error "test failed."
300             #endif
301             , [ res=yes ], [ res=no ])
302         AC_MSG_RESULT([$res])
303         if test "$res" != "yes"; then
304             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
305         fi
306         # Check windres version
307         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
308         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
309         AC_MSG_RESULT([$_WINDRES_VERSION])
310         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
311         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
312         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
313         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
314         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
315         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
316         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
317                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
318                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
319                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
320                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
321                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
322         then
323             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
324         fi
326         AC_CHECK_PROGS(MIDL, $target-widl widl)
327         if test -n "$MIDL"; then
328             case "$target" in
329             i*86-*)
330                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
331                 ;;
332             x86_64-*)
333                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
334                 ;;
335             esac
336         fi
338         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
339         # causing problems with local implementations with the same name.
340         AC_DEFINE(STRSAFE_NO_DEPRECATE)
341     fi # !GNU_CC
343     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
344     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
345     # Require OS features provided by IE 8.0 (Win7)
346     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
348     ;;
349 esac
351 if test -n "$_WIN32_MSVC"; then
352     SKIP_PATH_CHECKS=1
353     SKIP_COMPILER_CHECKS=1
354     SKIP_LIBRARY_CHECKS=1
356     # Since we're skipping compiler and library checks, hard-code
357     # some facts here.
358     AC_DEFINE(HAVE_IO_H)
359     AC_DEFINE(HAVE_ISATTY)
362 fi # COMPILE_ENVIRONMENT
364 AC_SUBST(MIDL_FLAGS)
365 AC_SUBST(_MSC_VER)
367 AC_SUBST(GNU_AS)
368 AC_SUBST(GNU_CC)
369 AC_SUBST(GNU_CXX)
371 AC_SUBST(STL_FLAGS)
372 AC_SUBST(WRAP_STL_INCLUDES)
373 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
375 dnl ========================================================
376 dnl Checks for programs.
377 dnl ========================================================
378 if test "$COMPILE_ENVIRONMENT"; then
380 dnl ========================================================
381 dnl = Mac OS X SDK support
382 dnl ========================================================
383 MACOS_SDK_DIR=
384 MOZ_ARG_WITH_STRING(macos-sdk,
385 [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
386     MACOS_SDK_DIR=$withval)
388 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
389 MOZ_ARG_WITH_STRING(macos-private-frameworks,
390 [  --with-macos-private-frameworks=dir    Location of private frameworks to use (Mac OS X only)],
391     MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
392     MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
393     MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
395 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
396   if test -z "$CROSS_COMPILE"; then
397     AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
398   fi
399   if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
400     AC_MSG_ERROR([PrivateFrameworks directory not found.])
401   fi
404 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
405 AC_SUBST(MACOS_SDK_DIR)
406 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
408 if test "$MACOS_SDK_DIR"; then
409   dnl Sync this section with the ones in NSPR and NSS.
410   dnl Changes to the cross environment here need to be accounted for in
411   dnl the libIDL checks (below) and xpidl build.
413   if test ! -d "$MACOS_SDK_DIR"; then
414     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
415 specify a valid SDK.  SDKs are installed when the optional cross-development
416 tools are selected during the Xcode/Developer Tools installation.])
417   fi
419   CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
420   CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
422   dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
423   CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
424   CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
426   AC_LANG_SAVE
427   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
428   AC_LANG_CPLUSPLUS
429   AC_TRY_COMPILE([#include <new>],[],
430    result=yes,
431    result=no)
432   AC_LANG_RESTORE
433   AC_MSG_RESULT($result)
435   if test "$result" = "no" ; then
436     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
437   fi
440 AC_PATH_XTRA
442 XCFLAGS="$X_CFLAGS"
444 fi # COMPILE_ENVIRONMENT
446 dnl ========================================================
447 dnl set the defaults first
448 dnl ========================================================
449 AS_BIN=$AS
450 AR_EXTRACT='$(AR) x'
451 AS='$(CC)'
452 AS_DASH_C_FLAG='-c'
453 DIRENT_INO=d_ino
454 MOZ_USER_DIR=".mozilla"
456 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
458 MOZ_FS_LAYOUT=unix
460 dnl Configure platform-specific CPU architecture compiler options.
461 dnl ==============================================================
462 if test "$COMPILE_ENVIRONMENT"; then
463     MOZ_ARCH_OPTS
464 else
465     if test "$OS_TARGET" = Android; then
466         dnl Default Android builds to ARMv7.
467         MOZ_ARCH=armv7-a
468     fi
469 fi # COMPILE_ENVIRONMENT
471 dnl ========================================================
472 dnl Android libstdc++, placed here so it can use MOZ_ARCH
473 dnl computed above.
474 dnl ========================================================
476 MOZ_ANDROID_CPU_ARCH
477 if test "$COMPILE_ENVIRONMENT"; then
478     MOZ_ANDROID_STLPORT
479 fi # COMPILE_ENVIRONMENT
481 dnl ========================================================
482 dnl Suppress Clang Argument Warnings
483 dnl ========================================================
484 if test -n "${CLANG_CC}${CLANG_CL}"; then
485     _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
486     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
488 if test -n "${CLANG_CXX}${CLANG_CL}"; then
489     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
492 if test -n "$COMPILE_ENVIRONMENT"; then
493    MOZ_CONFIG_SANITIZE
496 # Add the hardening flags from moz.configure
497 CFLAGS="$CFLAGS $HARDENING_CFLAGS"
498 CPPFLAGS="$CPPFLAGS $HARDENING_CFLAGS"
499 CXXFLAGS="$CXXFLAGS $HARDENING_CFLAGS"
501 dnl ========================================================
502 dnl GNU specific defaults
503 dnl ========================================================
504 if test "$GNU_CC"; then
505     MMX_FLAGS="-mmmx"
506     SSE_FLAGS="-msse"
507     SSE2_FLAGS="-msse2"
508     SSSE3_FLAGS="-mssse3"
509     # FIXME: Let us build with strict aliasing. bug 414641.
510     CFLAGS="$CFLAGS -fno-strict-aliasing"
511     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
512     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
513     WARNINGS_AS_ERRORS='-Werror'
514     DSO_CFLAGS=''
515     DSO_PIC_CFLAGS='-fPIC'
516     ASFLAGS="$ASFLAGS -fPIC"
517     AC_MSG_CHECKING([for --noexecstack option to as])
518     _SAVE_CFLAGS=$CFLAGS
519     CFLAGS="$CFLAGS -Wa,--noexecstack"
520     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
521                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
522                      AC_MSG_RESULT([no]))
523     CFLAGS=$_SAVE_CFLAGS
524     AC_MSG_CHECKING([for -z noexecstack option to ld])
525     _SAVE_LDFLAGS=$LDFLAGS
526     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
527     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
528                   AC_MSG_RESULT([no])
529                   LDFLAGS=$_SAVE_LDFLAGS)
531     AC_MSG_CHECKING([for -z text option to ld])
532     _SAVE_LDFLAGS=$LDFLAGS
533     LDFLAGS="$LDFLAGS -Wl,-z,text"
534     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
535                   AC_MSG_RESULT([no])
536                   LDFLAGS=$_SAVE_LDFLAGS)
538     AC_MSG_CHECKING([for -z relro option to ld])
539     _SAVE_LDFLAGS=$LDFLAGS
540     LDFLAGS="$LDFLAGS -Wl,-z,relro"
541     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
542                   AC_MSG_RESULT([no])
543                   LDFLAGS=$_SAVE_LDFLAGS)
545     AC_MSG_CHECKING([for --build-id option to ld])
546     _SAVE_LDFLAGS=$LDFLAGS
547     LDFLAGS="$LDFLAGS -Wl,--build-id"
548     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
549                   AC_MSG_RESULT([no])
550                   LDFLAGS=$_SAVE_LDFLAGS)
552     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
553     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
554     _SAVE_LDFLAGS=$LDFLAGS
555     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
556     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
557                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
558                   AC_MSG_RESULT([no]))
559     LDFLAGS=$_SAVE_LDFLAGS
561     # Check for -mssse3 on $CC
562     AC_MSG_CHECKING([if toolchain supports -mssse3 option])
563     HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
564     _SAVE_CFLAGS=$CFLAGS
565     CFLAGS="$CFLAGS -mssse3"
566     AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
567                      [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
568                      AC_MSG_RESULT([no]))
569     CFLAGS=$_SAVE_CFLAGS
571     # Check for -msse4.1 on $CC
572     AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
573     HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
574     _SAVE_CFLAGS=$CFLAGS
575     CFLAGS="$CFLAGS -msse4.1"
576     AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
577                      [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
578                      AC_MSG_RESULT([no]))
579     CFLAGS=$_SAVE_CFLAGS
581     case "${CPU_ARCH}" in
582     x86 | x86_64)
583       AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
584       AC_TRY_COMPILE([],
585                      [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
586                      result="yes", result="no")
587       AC_MSG_RESULT("$result")
588       if test "$result" = "yes"; then
589           HAVE_X86_AVX2=1
590       fi
591       ;;
593     ppc*)
594       AC_MSG_CHECKING([whether we can enable AltiVec support])
595       HAVE_ALTIVEC=
596       _SAVE_CFLAGS=$CFLAGS
597       CFLAGS="$CFLAGS -maltivec"
598       AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
599                        [HAVE_ALTIVEC=1],
600                        AC_MSG_RESULT([no]))
601       CFLAGS=$_SAVE_CFLAGS
602       ;;
603     esac
605     DSO_LDOPTS='-shared'
606     if test "$GCC_USE_GNU_LD"; then
607         # Some tools like ASan use a runtime library that is only
608         # linked against executables, so we must allow undefined
609         # symbols for shared objects in some cases.
610         if test -z "$MOZ_NO_WLZDEFS"; then
611             # Don't allow undefined symbols in libraries
612             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
614             # BSDs need `environ' exposed for posix_spawn (bug 753046)
615             case "$OS_TARGET" in
616             DragonFly|FreeBSD|NetBSD|OpenBSD)
617                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
618                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
619                 else
620                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
621                 fi
622                 ;;
623             esac
624         fi
625     fi
627     _DEFINES_CFLAGS='-include $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
628     _USE_CPP_INCLUDE_FLAG=1
630     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
633 if test "$GNU_CXX"; then
634     # FIXME: Let us build with strict aliasing. bug 414641.
635     CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
637     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/mozilla-config.h'
638     _USE_CPP_INCLUDE_FLAG=1
641 dnl ========================================================
642 dnl = Use Valgrind
643 dnl ========================================================
644 MOZ_ARG_ENABLE_BOOL(valgrind,
645 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
646     MOZ_VALGRIND=1,
647     MOZ_VALGRIND= )
648 if test -n "$MOZ_VALGRIND"; then
649     MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
650         AC_MSG_ERROR(
651             [--enable-valgrind specified but Valgrind is not installed]))
652     AC_DEFINE(MOZ_VALGRIND)
654 AC_SUBST(MOZ_VALGRIND)
656 # For profiling builds keep the symbol information
657 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
658     case "$OS_TARGET" in
659     Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
660         STRIP_FLAGS="--strip-debug"
661         ;;
662     esac
665 dnl ========================================================
666 dnl = Enable DMD
667 dnl ========================================================
669 if test "$MOZ_DMD"; then
670     if test "${CPU_ARCH}" = "arm"; then
671         CFLAGS="$CFLAGS -funwind-tables"
672         CXXFLAGS="$CXXFLAGS -funwind-tables"
673     fi
676 dnl ========================================================
677 dnl System overrides of the defaults for host
678 dnl ========================================================
679 case "$host" in
680 *mingw*)
681     if test -n "$_WIN32_MSVC"; then
682         HOST_AR=lib
683         HOST_AR_FLAGS='-NOLOGO -OUT:$@'
684         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
685         HOST_RANLIB='echo ranlib'
686     else
687         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
688     fi
689     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
690     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
691     HOST_BIN_SUFFIX=.exe
693     case "${host_cpu}" in
694     i*86)
695         if test -n "$_WIN32_MSVC"; then
696             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
697         fi
698         ;;
699     x86_64)
700         if test -n "$_WIN32_MSVC"; then
701             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
702         fi
703         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
704         ;;
705     esac
706     ;;
708 *-darwin*)
709     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
710     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
711     ;;
713 *-linux*|*-kfreebsd*-gnu|*-gnu*)
714     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
715     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
716     ;;
719     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
720     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
721     ;;
722 esac
724 dnl ==============================================================
725 dnl Get mozilla version from central milestone file
726 dnl ==============================================================
727 MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
728 MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
729 MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
730 if test -z "$MOZILLA_VERSION"; then
731   AC_MSG_ERROR([failed to read version info from milestone file])
734 dnl Get version of various core apps from the version files.
735 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
736 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
738 if test -z "$FIREFOX_VERSION"; then
739     AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
742 if test -z "$FIREFOX_VERSION_DISPLAY"; then
743     AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
746 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
747 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
748 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
749 AC_SUBST(MOZILLA_SYMBOLVERSION)
751 MOZ_DOING_LTO(lto_is_enabled)
753 dnl ========================================================
754 dnl System overrides of the defaults for target
755 dnl ========================================================
757 case "$target" in
758 *-darwin*)
759     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
760     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
761     MOZ_OPTIMIZE_FLAGS="-O3"
762     CXXFLAGS="$CXXFLAGS -stdlib=libc++"
763     DSO_LDOPTS=''
764     STRIP_FLAGS="$STRIP_FLAGS -x -S"
765     # Ensure that if we're targeting iOS an SDK was provided.
766     AC_CACHE_CHECK(for iOS target,
767                    ac_cv_ios_target,
768                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
769 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
770 #error not iOS
771 #endif],
772                                    [],
773                                    ac_cv_ios_target="yes",
774                                    ac_cv_ios_target="no")])
775     if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
776        AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
777     fi
778     if test -n "$MOZ_IOS"; then
779         direct_nspr_config=1
780     else
781         # The ExceptionHandling framework is needed for Objective-C exception
782         # logging code in nsObjCExceptions.h. Currently we only use that in debug
783         # builds.
784         MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
785     fi
787     if test "x$lto_is_enabled" = "xyes"; then
788         echo "Skipping -dead_strip because lto is enabled."
789     dnl DTrace and -dead_strip don't interact well. See bug 403132.
790     dnl ===================================================================
791     elif test "x$enable_dtrace" = "xyes"; then
792         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
793     else
794         dnl check for the presence of the -dead_strip linker flag
795         AC_MSG_CHECKING([for -dead_strip option to ld])
796         _SAVE_LDFLAGS=$LDFLAGS
797         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
798         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
799         if test -n "$_HAVE_DEAD_STRIP" ; then
800             AC_MSG_RESULT([yes])
801             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
802         else
803             AC_MSG_RESULT([no])
804         fi
806         LDFLAGS=$_SAVE_LDFLAGS
807     fi
809     MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
810     ;;
812 *-android*|*-linuxandroid*)
813     AC_DEFINE(NO_PW_GECOS)
815     if test "$COMPILE_ENVIRONMENT"; then
816         MOZ_LINKER=1
817     fi
819     MOZ_GFX_OPTIMIZE_MOBILE=1
820     if test -z "$CLANG_CC"; then
821         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
822     else
823         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
824         # -Oz is smaller than -Os on clang.
825         MOZ_OPTIMIZE_FLAGS="-Oz"
826     fi
827     ;;
829 *-*linux*)
830     if test "$GNU_CC" -o "$GNU_CXX"; then
831         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
832         if test -n "$MOZ_DEBUG"; then
833             MOZ_OPTIMIZE_FLAGS="-Os"
834         else
835             MOZ_OPTIMIZE_FLAGS="-O2"
836         fi
837         if test -z "$CLANG_CC"; then
838            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
839         fi
840     fi
842     case "${target_cpu}" in
843     alpha*)
844         CFLAGS="$CFLAGS -mieee"
845         CXXFLAGS="$CXXFLAGS -mieee"
846     ;;
847     esac
848     ;;
849 *-mingw*)
850     DSO_CFLAGS=
851     DSO_PIC_CFLAGS=
852     RC=rc.exe
853     # certain versions of cygwin's makedepend barf on the
854     # #include <string> vs -I./dist/include/string issue so don't use it
855     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
856         CC="$CC -mwindows"
857         CXX="$CXX -mwindows"
858         CPP="$CPP -mwindows"
859         CFLAGS="$CFLAGS -mms-bitfields"
860         CXXFLAGS="$CXXFLAGS -mms-bitfields"
861         DSO_LDOPTS='-shared'
862         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
863         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
864         RC='$(WINDRES)'
865         # Use static libgcc and libstdc++
866         LDFLAGS="$LDFLAGS -static"
867         # Use temp file for windres (bug 213281)
868         RCFLAGS='-O coff --use-temp-file'
869         # mingw doesn't require kernel32, user32, and advapi32 explicitly
870         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
871         MOZ_FIX_LINK_PATHS=
873         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
874         WIN32_GUI_EXE_LDFLAGS=-mwindows
876         # GCC/binutils can't link to a function if we try to include dllexport function
877         # in the same library as dllimport caller. To work around it, we build NSPR
878         # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
879         # function thunks need to be generated for cross-DLL calls.
880         MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
881     else
882         TARGET_COMPILER_ABI=msvc
883         if test "$AS_BIN"; then
884             AS="$(basename "$AS_BIN")"
885         fi
886         AR='lib'
887         AR_FLAGS='-NOLOGO -OUT:$@'
888         AR_EXTRACT=
889         RANLIB='echo not_ranlib'
890         STRIP='echo not_strip'
891         PKG_SKIP_STRIP=1
892         MKSHLIB='$(LINK) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
893         MKCSHLIB='$(LINK) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
894         WIN32_SUBSYSTEM_VERSION=6.01
895         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
896         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
897         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
898         _USE_CPP_INCLUDE_FLAG=1
899         _DEFINES_CFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
900         _DEFINES_CXXFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
901         CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
902         CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
903         if test -z "$CLANG_CL"; then
904             CPPFLAGS="$CPPFLAGS -utf-8"
905         fi
906         if test "$CPU_ARCH" = "x86"; then
907             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
908             dnl more recent, so set that explicitly here unless another
909             dnl target arch has already been set.
910             changequote(,)
911             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
912               CFLAGS="$CFLAGS -arch:SSE2"
913             fi
914             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
915               CXXFLAGS="$CXXFLAGS -arch:SSE2"
916             fi
917             changequote([,])
918             SSE_FLAGS="-arch:SSE"
919             SSE2_FLAGS="-arch:SSE2"
920             dnl MSVC allows the use of intrinsics without any flags
921             dnl and doesn't have a separate arch for SSSE3
922             SSSE3_FLAGS="-arch:SSE2"
923         fi
924         dnl clang-cl requires appropriate flags to enable SSSE3 support
925         dnl on all architectures.
926         if test -n "$CLANG_CL"; then
927             SSSE3_FLAGS="-mssse3"
928         fi
929         dnl VS2013+ supports -Gw for better linker optimizations.
930         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
931         dnl Disabled on ASan because it causes false-positive ODR violations.
932         if test -z "$MOZ_ASAN"; then
933             CFLAGS="$CFLAGS -Gw"
934             CXXFLAGS="$CXXFLAGS -Gw"
935         fi
936         # khuey says we can safely ignore MSVC warning C4251
937         # MSVC warning C4244 (implicit type conversion may lose data) warns
938         # and requires workarounds for perfectly valid code.  Also, GCC/clang
939         # don't warn about it by default. So for consistency/sanity, we turn
940         # it off on MSVC, too.
941         # MSVC warning C4267 warns for narrowing type conversions from size_t
942         # to 32-bit integer types on 64-bit platforms.  Since this is virtually
943         # the same thing as C4244, we disable C4267, too.
944         # MSVC warning C4800 warns when a value is implicitly cast to bool,
945         # because this also forces narrowing to a single byte, which can be a
946         # perf hit.  But this matters so little in practice (and often we want
947         # that behavior) that it's better to turn it off.
948         # MSVC warning C4595 warns non-member operator new or delete functions
949         # may not be declared inline, as of VS2015 Update 2.
950         CFLAGS="$CFLAGS -wd4244 -wd4267"
951         CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
952         if test -n "$CLANG_CL"; then
953             # XXX We should combine some of these with our generic GCC-style
954             # warning checks.
955             #
956             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
957             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
958             # We use offsetof on non-POD objects all the time.
959             # We also suppress this warning on other platforms.
960             CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
961             # This warns for reasonable things like:
962             #   enum { X = 0xffffffffU };
963             # which is annoying for IDL headers.
964             CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
965             # This warns for cases that would be reached by the Microsoft
966             # #include rules, but also currently warns on cases that would
967             # *also* be reached by standard C++ include rules.  That
968             # behavior doesn't seem useful, so we turn it off.
969             CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
970             # We normally error out on unknown pragmas, but since clang-cl
971             # claims to be MSVC, it would be difficult to add
972             # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
973             # use such pragmas, so just ignore them.
974             CFLAGS="$CFLAGS -Wno-unknown-pragmas"
975             CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
976             # We get errors about various #pragma intrinsic directives from
977             # clang-cl, and we don't need to hear about those.
978             CFLAGS="$CFLAGS -Wno-ignored-pragmas"
979             CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
980             # clang-cl's Intrin.h marks things like _ReadWriteBarrier
981             # as __attribute((__deprecated__)).  This is nice to know,
982             # but since we don't get the equivalent warning from MSVC,
983             # let's just ignore it.
984             CFLAGS="$CFLAGS -Wno-deprecated-declarations"
985             CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
986             # We use a function like:
987             #   __declspec(noreturn) __inline void f() {}
988             # which -Winvalid-noreturn complains about.  Again, MSVC seems
989             # OK with it, so let's silence the warning.
990             CFLAGS="$CFLAGS -Wno-invalid-noreturn"
991             CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
992             # Missing |override| on virtual function declarations isn't
993             # something that MSVC currently warns about.
994             CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
995             # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
996             # declaration on |operator delete(void*)|.  However, clang-cl
997             # must internally declare |operator delete(void*)| differently,
998             # which causes this warning for virtually every file in the
999             # tree.  clang-cl doesn't support -fno-exceptions or equivalent,
1000             # so there doesn't seem to be any way to convince clang-cl to
1001             # declare |delete| differently.  Therefore, suppress this
1002             # warning.
1003             CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1004             # At least one MSVC header and several headers in-tree have
1005             # unused typedefs, so turn this on.
1006             CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1007             # jemalloc uses __declspec(allocator) as a profiler hint,
1008             # which clang-cl doesn't understand.
1009             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1010         fi
1011         # make 'foo == bar;' error out
1012         CFLAGS="$CFLAGS -we4553"
1013         CXXFLAGS="$CXXFLAGS -we4553"
1014         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1015         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1016         WARNINGS_AS_ERRORS='-WX'
1017         MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1018         MOZ_FIX_LINK_PATHS=
1019         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1020         if test -z "$DEVELOPER_OPTIONS"; then
1021             LDFLAGS="$LDFLAGS -RELEASE"
1022         fi
1023         LDFLAGS="$LDFLAGS -DYNAMICBASE"
1024         RCFLAGS="-nologo"
1025         dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1026         dnl both SSSE3 and SSE4.1.
1027         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1028         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1029         dnl allow AVX2 code from VS2015
1030         HAVE_X86_AVX2=1
1031     fi
1032     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1033     dnl See http://support.microsoft.com/kb/143208 to use STL
1034     AC_DEFINE(NOMINMAX)
1035     BIN_SUFFIX='.exe'
1036     MOZ_USER_DIR="Mozilla"
1038     case "$host_os" in
1039     cygwin*|msvc*|mks*)
1040         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.])
1041         ;;
1042     esac
1044     case "$target" in
1045     i*86-*)
1046         if test -n "$GNU_CC"; then
1047             CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1048             CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1049             LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1050         else
1051             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1052             LDFLAGS="$LDFLAGS -SAFESEH"
1053         fi
1055         AC_DEFINE(_X86_)
1056         ;;
1057     x86_64-*)
1058         if test -n "$_WIN32_MSVC"; then
1059             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1060         fi
1061         AC_DEFINE(_AMD64_)
1062         ;;
1063     *)
1064         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1065         ;;
1066     esac
1067     ;;
1069 *-netbsd*)
1070     DSO_CFLAGS=''
1071     CFLAGS="$CFLAGS -Dunix"
1072     CXXFLAGS="$CXXFLAGS -Dunix"
1073     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1074         DSO_PIC_CFLAGS='-fPIC -DPIC'
1075         DSO_LDOPTS='-shared'
1076         BIN_FLAGS='-Wl,--export-dynamic'
1077     else
1078         DSO_PIC_CFLAGS='-fPIC -DPIC'
1079         DSO_LDOPTS='-shared'
1080     fi
1081     # This will fail on a.out systems prior to 1.5.1_ALPHA.
1082     if test "$LIBRUNPATH"; then
1083         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1084     fi
1085     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1086     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1087     ;;
1089 *-openbsd*)
1090     if test -z "$X11BASE"; then
1091         X11BASE=/usr/X11R6
1092     fi
1093     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1094     DSO_CFLAGS=''
1095     DSO_PIC_CFLAGS='-fPIC'
1096     DSO_LDOPTS='-shared -fPIC'
1097     if test "$LIBRUNPATH"; then
1098         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1099     fi
1100     ;;
1102 *-solaris*)
1103     MOZ_FIX_LINK_PATHS=
1104     ;;
1106 esac
1108 AC_SUBST_LIST(MMX_FLAGS)
1109 AC_SUBST_LIST(SSE_FLAGS)
1110 AC_SUBST_LIST(SSE2_FLAGS)
1111 AC_SUBST_LIST(SSSE3_FLAGS)
1113 AC_SUBST(MOZ_LINKER)
1114 if test -n "$MOZ_LINKER"; then
1115   AC_DEFINE(MOZ_LINKER)
1116   MOZ_LINKER_EXTRACT=1
1117   AC_CHECK_PROGS(XZ, xz)
1120 dnl Only one oddball right now (QNX), but this gives us flexibility
1121 dnl if any other platforms need to override this in the future.
1122 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1124 if test -z "$COMPILE_ENVIRONMENT"; then
1125     SKIP_COMPILER_CHECKS=1
1126     SKIP_LIBRARY_CHECKS=1
1127     PKG_SKIP_STRIP=1
1128     MOZ_DEBUGGING_OPTS
1129 else
1130     MOZ_COMPILER_OPTS
1131 fi # COMPILE_ENVIRONMENT
1133 if test -z "$SKIP_COMPILER_CHECKS"; then
1134 dnl Checks for typedefs, structures, and compiler characteristics.
1135 dnl ========================================================
1136 AC_C_CONST
1137 AC_TYPE_MODE_T
1138 AC_TYPE_OFF_T
1139 AC_TYPE_PID_T
1140 AC_TYPE_SIZE_T
1141 AC_LANG_CPLUSPLUS
1142 AC_LANG_C
1144 AC_LANG_CPLUSPLUS
1146 MOZ_CXX11
1148 AC_LANG_C
1150 case "${OS_TARGET}" in
1151 Darwin)
1152   ;;
1154   STL_FLAGS="-I${DIST}/stl_wrappers"
1155   WRAP_STL_INCLUDES=1
1156   ;;
1157 esac
1159 dnl Checks for header files.
1160 dnl ========================================================
1161 AC_HEADER_DIRENT
1162 case "$target_os" in
1163 bitrig*|dragonfly*|freebsd*|openbsd*)
1164 # for stuff like -lXshm
1165     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1166     ;;
1167 esac
1169 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1170 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1171                    ac_cv_sockaddr_in_sin_len,
1172                    [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1173                                     #include <sys/types.h>
1174                                     #endif
1175                                     #include <netinet/in.h>
1176                                     struct sockaddr_in x;
1177                                     void *foo = (void*) &x.sin_len;],
1178                                    [],
1179                                    [ac_cv_sockaddr_in_sin_len=true],
1180                                    [ac_cv_sockaddr_in_sin_len=false])])
1181 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1182   AC_DEFINE(HAVE_SIN_LEN)
1183 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1184   AC_DEFINE(HAVE_SCONN_LEN)
1187 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1188                ac_cv_sockaddr_in6_sin6_len,
1189                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1190                                 #include <sys/types.h>
1191                                 #endif
1192                                 #include <netinet/in.h>
1193                                 struct sockaddr_in6 x;
1194                                 void *foo = (void*) &x.sin6_len;],
1195                                [],
1196                                [ac_cv_sockaddr_in6_sin6_len=true],
1197                                [ac_cv_sockaddr_in6_sin6_len=false])])
1198 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1199   AC_DEFINE(HAVE_SIN6_LEN)
1202 AC_CACHE_CHECK(for sockaddr.sa_len,
1203                ac_cv_sockaddr_sa_len,
1204                [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1205                                 #include <sys/types.h>
1206                                 #endif
1207                                 #include <sys/socket.h>
1208                                 struct sockaddr x;
1209                                 void *foo = (void*) &x.sa_len;],
1210                                [],
1211                                [ac_cv_sockaddr_sa_len=true],
1212                                [ac_cv_sockaddr_sa_len=false])])
1213 if test "$ac_cv_sockaddr_sa_len" = true ; then
1214   AC_DEFINE(HAVE_SA_LEN)
1217 MOZ_ARG_ENABLE_BOOL(dtrace,
1218               [  --enable-dtrace         build with dtrace support if available (default=no)],
1219               [enable_dtrace="yes"],)
1220 if test "x$enable_dtrace" = "xyes"; then
1221   MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1222   if test -n "$HAVE_DTRACE"; then
1223       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1224   else
1225       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1226   fi
1228 AC_SUBST(HAVE_DTRACE)
1230 dnl Checks for libraries.
1231 dnl ========================================================
1232 AC_CHECK_LIB(c_r, gethostbyname_r)
1234 dnl We don't want to link with libdl even if it's present on OS X, since
1235 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1236 dnl in libc.
1237 dnl We don't want to link against libm or libpthread on Darwin since
1238 dnl they both are just symlinks to libSystem and explicitly linking
1239 dnl against libSystem causes issues when debugging (see bug 299601).
1240 case $target in
1241 *-darwin*)
1242     ;;
1244     AC_SEARCH_LIBS(dlopen, dl,
1245         MOZ_CHECK_HEADER(dlfcn.h,
1246         AC_DEFINE(HAVE_DLOPEN)))
1247     ;;
1248 esac
1250 _SAVE_CFLAGS="$CFLAGS"
1251 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1252 AC_CHECK_FUNCS(dladdr memmem)
1253 CFLAGS="$_SAVE_CFLAGS"
1255 if test ! "$GNU_CXX"; then
1256     AC_CHECK_LIB(C, demangle)
1259 AC_CHECK_LIB(socket, socket)
1261 XLDFLAGS="$X_LIBS"
1262 XLIBS="$X_EXTRA_LIBS"
1264 dnl ========================================================
1265 dnl Checks for X libraries.
1266 dnl Ordering is important.
1267 dnl Xt is dependent upon SM as of X11R6
1268 dnl ========================================================
1269 if test -n "$MOZ_X11"; then
1270     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1271     _SAVE_LDFLAGS="$LDFLAGS"
1272     _SAVE_LIBS="$LIBS"
1273     LDFLAGS="$XLDFLAGS $LDFLAGS"
1274     AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1275         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1276     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1277         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1279     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1280         unset ac_cv_lib_Xt_XtFree
1281         AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1282         AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1283         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1284             [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1285         ])
1287     dnl ========================================================
1288     dnl = Check for xcb
1289     dnl ========================================================
1290     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1291         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1292     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1293         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1294     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1295         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1297     dnl ========================================================
1298     dnl = Check for Xss
1299     dnl ========================================================
1300     MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
1301         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
1302             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
1303              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
1305     LDFLAGS="$_SAVE_LDFLAGS"
1306     LIBS="$_SAVE_LIBS"
1307 fi # $MOZ_X11
1309 AC_SUBST_LIST(XCFLAGS)
1310 AC_SUBST_LIST(XLDFLAGS)
1311 AC_SUBST_LIST(XLIBS)
1312 AC_SUBST_LIST(XEXT_LIBS)
1313 AC_SUBST_LIST(XT_LIBS)
1314 AC_SUBST_LIST(XSS_LIBS)
1316 dnl ========================================================
1317 dnl = pthread support
1318 dnl = Start by checking whether the system support pthreads
1319 dnl ========================================================
1320 case "$target_os" in
1321 darwin*)
1322     MOZ_USE_PTHREADS=1
1323     ;;
1325     AC_CHECK_LIB(pthreads, pthread_create,
1326         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1327         AC_CHECK_LIB(pthread, pthread_create,
1328             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1329             AC_CHECK_LIB(c_r, pthread_create,
1330                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1331                 AC_CHECK_LIB(c, pthread_create,
1332                     MOZ_USE_PTHREADS=1
1333                 )
1334             )
1335         )
1336     )
1337     ;;
1338 esac
1340 dnl ========================================================
1341 dnl Check the command line for --with-pthreads
1342 dnl ========================================================
1343 MOZ_ARG_WITH_BOOL(pthreads,
1344 [  --with-pthreads         Force use of system pthread library with NSPR ],
1345 [ if test "$MOZ_USE_PTHREADS"x = x; then
1346     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
1347 fi],
1348     MOZ_USE_PTHREADS=
1349     _PTHREAD_LDFLAGS=
1352 dnl ========================================================
1353 dnl Do the platform specific pthread hackery
1354 dnl ========================================================
1355 if test "$MOZ_USE_PTHREADS"x != x
1356 then
1357     dnl
1358     dnl See if -pthread is supported.
1359     dnl
1360     rm -f conftest*
1361     ac_cv_have_dash_pthread=no
1362     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1363     echo 'int main() { return 0; }' | cat > conftest.c
1364     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1365     if test $? -eq 0; then
1366         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1367             ac_cv_have_dash_pthread=yes
1368             case "$target_os" in
1369             freebsd*)
1370 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1371                 ;;
1372             *)
1373                 CFLAGS="$CFLAGS -pthread"
1374                 CXXFLAGS="$CXXFLAGS -pthread"
1375                 ;;
1376             esac
1377         fi
1378     fi
1379     rm -f conftest*
1380     AC_MSG_RESULT($ac_cv_have_dash_pthread)
1382     dnl
1383     dnl See if -pthreads is supported.
1384     dnl
1385     ac_cv_have_dash_pthreads=no
1386     if test "$ac_cv_have_dash_pthread" = "no"; then
1387         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1388         echo 'int main() { return 0; }' | cat > conftest.c
1389         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1390         if test $? -eq 0; then
1391             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1392                 ac_cv_have_dash_pthreads=yes
1393                 CFLAGS="$CFLAGS -pthreads"
1394                 CXXFLAGS="$CXXFLAGS -pthreads"
1395             fi
1396         fi
1397         rm -f conftest*
1398         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1399     fi
1401     case "$target" in
1402         *-*-freebsd*)
1403             AC_DEFINE(_REENTRANT)
1404             AC_DEFINE(_THREAD_SAFE)
1405             dnl -pthread links in -lpthread, so don't specify it explicitly.
1406             if test "$ac_cv_have_dash_pthread" = "yes"; then
1407                 _PTHREAD_LDFLAGS="-pthread"
1408             fi
1409             ;;
1411         *-*-openbsd*|*-*-bsdi*)
1412             AC_DEFINE(_REENTRANT)
1413             AC_DEFINE(_THREAD_SAFE)
1414             dnl -pthread links in -lc_r, so don't specify it explicitly.
1415             if test "$ac_cv_have_dash_pthread" = "yes"; then
1416                 _PTHREAD_LDFLAGS="-pthread"
1417             fi
1418             ;;
1420         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1421             AC_DEFINE(_REENTRANT)
1422             ;;
1424     esac
1425     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1426     AC_SUBST(MOZ_USE_PTHREADS)
1427     MOZ_CHECK_HEADERS(pthread.h)
1431 dnl Checks for library functions.
1432 dnl ========================================================
1433 AC_PROG_GCC_TRADITIONAL
1434 AC_FUNC_MEMCMP
1435 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1437 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1438 dnl avoid this on Darwin, since depending on your system config, we may think
1439 dnl it exists but it really doesn't
1440 case "$OS_TARGET" in
1441 Darwin)
1442   ;;
1444   AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1445                  ac_cv_clock_monotonic,
1446                  [for libs in "" -lrt; do
1447                       _SAVE_LIBS="$LIBS"
1448                       LIBS="$LIBS $libs"
1449                       AC_TRY_LINK([#include <time.h>],
1450                                    [ struct timespec ts;
1451                                      clock_gettime(CLOCK_MONOTONIC, &ts); ],
1452                                    ac_cv_clock_monotonic=$libs
1453                                    LIBS="$_SAVE_LIBS"
1454                                    break,
1455                                    ac_cv_clock_monotonic=no)
1456                       LIBS="$_SAVE_LIBS"
1457                   done])
1458   if test "$ac_cv_clock_monotonic" != "no"; then
1459       HAVE_CLOCK_MONOTONIC=1
1460       REALTIME_LIBS=$ac_cv_clock_monotonic
1461       AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1462       AC_SUBST(HAVE_CLOCK_MONOTONIC)
1463       AC_SUBST_LIST(REALTIME_LIBS)
1464   fi
1465   ;;
1466 esac
1468 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1469                ac_cv_pthread_cond_timedwait_monotonic_np,
1470                AC_TRY_LINK([#include <pthread.h>],
1471                            [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1472                            ac_cv_pthread_cond_timewait_monotonic_np=yes,
1473                            ac_cv_pthread_cond_timewait_monotonic_np=no))
1474 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1475     AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1478 dnl check for wcrtomb/mbrtowc
1479 dnl =======================================================================
1480 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
1481 AC_LANG_SAVE
1482 AC_LANG_CPLUSPLUS
1483 AC_CACHE_CHECK(for wcrtomb,
1484     ac_cv_have_wcrtomb,
1485     [AC_TRY_LINK([#include <wchar.h>],
1486                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
1487                  ac_cv_have_wcrtomb="yes",
1488                  ac_cv_have_wcrtomb="no")])
1489 if test "$ac_cv_have_wcrtomb" = "yes"; then
1490     AC_DEFINE(HAVE_WCRTOMB)
1492 AC_CACHE_CHECK(for mbrtowc,
1493     ac_cv_have_mbrtowc,
1494     [AC_TRY_LINK([#include <wchar.h>],
1495                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
1496                  ac_cv_have_mbrtowc="yes",
1497                  ac_cv_have_mbrtowc="no")])
1498 if test "$ac_cv_have_mbrtowc" = "yes"; then
1499     AC_DEFINE(HAVE_MBRTOWC)
1501 AC_LANG_RESTORE
1504 AC_CACHE_CHECK(
1505     [for res_ninit()],
1506     ac_cv_func_res_ninit,
1507     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1508         dnl no need for res_ninit() on NetBSD and OpenBSD
1509         ac_cv_func_res_ninit=no
1510      else
1511         AC_TRY_LINK([
1512             #ifdef linux
1513             #define _BSD_SOURCE 1
1514             #endif
1515             #include <sys/types.h>
1516             #include <netinet/in.h>
1517             #include <arpa/nameser.h>
1518             #include <resolv.h>
1519             ],
1520             [int foo = res_ninit(&_res);],
1521             [ac_cv_func_res_ninit=yes],
1522             [ac_cv_func_res_ninit=no])
1523      fi
1524     ])
1526 if test "$ac_cv_func_res_ninit" = "yes"; then
1527     AC_DEFINE(HAVE_RES_NINIT)
1528 dnl must add the link line we do something as foolish as this... dougt
1529 dnl else
1530 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1531 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1534 AC_LANG_CPLUSPLUS
1536 ICONV_LIBS=
1538 case $target_os in
1539     darwin*|mingw*)
1540         ;;
1541     *)
1543 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
1544     AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
1545         AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
1546 _SAVE_LIBS=$LIBS
1547 LIBS="$LIBS $ICONV_LIBS"
1548 AC_CACHE_CHECK(
1549     [for iconv()],
1550     ac_cv_func_iconv,
1551     [AC_TRY_LINK([
1552         #include <stdlib.h>
1553         #include <iconv.h>
1554         ],
1555         [
1556             iconv_t h = iconv_open("", "");
1557             iconv(h, NULL, NULL, NULL, NULL);
1558             iconv_close(h);
1559         ],
1560         [ac_cv_func_iconv=yes],
1561         [ac_cv_func_iconv=no]
1562         )]
1563     )
1564 if test "$ac_cv_func_iconv" = "yes"; then
1565     AC_DEFINE(HAVE_ICONV)
1566     LIBICONV="$ICONV_LIBS"
1567     AC_CACHE_CHECK(
1568         [for iconv() with const input],
1569         ac_cv_func_const_iconv,
1570         [AC_TRY_COMPILE([
1571             #include <stdlib.h>
1572             #include <iconv.h>
1573             ],
1574             [
1575                 const char *input = "testing";
1576                 iconv_t h = iconv_open("", "");
1577                 iconv(h, &input, NULL, NULL, NULL);
1578                 iconv_close(h);
1579             ],
1580             [ac_cv_func_const_iconv=yes],
1581             [ac_cv_func_const_iconv=no]
1582             )]
1583         )
1584     if test "$ac_cv_func_const_iconv" = "yes"; then
1585         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
1586     fi
1588 LIBS=$_SAVE_LIBS
1590     ;;
1591 esac
1593 AC_SUBST_LIST(ICONV_LIBS)
1595 AM_LANGINFO_CODESET
1597 AC_LANG_C
1599 dnl **********************
1600 dnl *** va_copy checks ***
1601 AC_CACHE_CHECK([for an implementation of va_copy()],
1602                ac_cv_va_copy,
1603     [AC_TRY_COMPILE([#include <stdarg.h>
1604                      #include <stdlib.h>
1605         void f (int i, ...) {
1606             va_list args1, args2;
1607             va_start (args1, i);
1608             va_copy (args2, args1);
1609             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1610                 exit (1);
1611             va_end (args1); va_end (args2);
1612         }],
1613         [f(0, 42); return 0],
1614         [ac_cv_va_copy=yes],
1615         [ac_cv_va_copy=no]
1616     )]
1618 AC_CACHE_CHECK([whether va_list can be copied by value],
1619                ac_cv_va_val_copy,
1620     [AC_TRY_COMPILE([#include <stdarg.h>
1621                      #include <stdlib.h>
1622         void f (int i, ...) {
1623             va_list args1, args2;
1624             va_start (args1, i);
1625             args2 = args1;
1626             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1627                 exit (1);
1628             va_end (args1); va_end (args2);
1629         }],
1630         [f(0, 42); return 0],
1631         [ac_cv_va_val_copy=yes],
1632         [ac_cv_va_val_copy=no],
1633     )]
1635 if test "x$ac_cv_va_copy" = "xyes"; then
1636     AC_DEFINE(VA_COPY, va_copy)
1637     AC_DEFINE(HAVE_VA_COPY)
1640 if test "x$ac_cv_va_val_copy" = "xno"; then
1641    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1644 dnl ===================================================================
1645 dnl ========================================================
1646 dnl Put your C++ language/feature checks below
1647 dnl ========================================================
1648 AC_LANG_CPLUSPLUS
1650 ARM_ABI_PREFIX=
1651 if test "$GNU_CC"; then
1652   if test "$CPU_ARCH" = "arm" ; then
1653     AC_CACHE_CHECK(for ARM EABI,
1654         ac_cv_gcc_arm_eabi,
1655         [AC_TRY_COMPILE([],
1656                         [
1657 #if defined(__ARM_EABI__)
1658   return 0;
1659 #else
1660 #error Not ARM EABI.
1661 #endif
1662                         ],
1663                         ac_cv_gcc_arm_eabi="yes",
1664                         ac_cv_gcc_arm_eabi="no")])
1665     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1666         HAVE_ARM_EABI=1
1667         ARM_ABI_PREFIX=eabi-
1668     else
1669         ARM_ABI_PREFIX=oabi-
1670     fi
1671   fi
1673   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1676 dnl See if a dynamic_cast to void* gives the most derived object.
1677 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1678                ac_cv_cpp_dynamic_cast_void_ptr,
1679                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1680                             class Y { int j; public: virtual ~Y() { } };
1681                             class Z : public X, public Y { int k; };
1683                             int main() {
1684                                  Z mdo;
1685                                  X *subx = (X*)&mdo;
1686                                  Y *suby = (Y*)&mdo;
1687                                  return !((((void*)&mdo != (void*)subx) &&
1688                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1689                                           (((void*)&mdo != (void*)suby) &&
1690                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
1691                             }],
1692                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
1693                            ac_cv_cpp_dynamic_cast_void_ptr=no,
1694                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
1695 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1696    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1700 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1701 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1702 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1703 # linking XUL.
1704 _SAVE_LDFLAGS=$LDFLAGS
1705 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1706 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1707                ac_cv_thread_keyword,
1708                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1709                             [return tlsIsMainThread;],
1710                             ac_cv_thread_keyword=yes,
1711                             ac_cv_thread_keyword=no)])
1712 LDFLAGS=$_SAVE_LDFLAGS
1713 # The custom dynamic linker doesn't support TLS variables
1714 MOZ_TLS=
1715 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1716   # mips builds fail with TLS variables because of a binutils bug.
1717   # See bug 528687
1718   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1719   case "${target}" in
1720     mips*-*)
1721       :
1722       ;;
1723     *-android*|*-linuxandroid*)
1724       :
1725       ;;
1726     *-openbsd*)
1727       :
1728       ;;
1729     *)
1730       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1731       MOZ_TLS=1
1732       ;;
1733   esac
1736 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1737 if test -n "$MOZ_LINKER"; then
1738   if test "$CPU_ARCH" = arm; then
1739     dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1740     if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1741       LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1742       _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1743     fi
1744   fi
1746 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1747 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1748 dnl Since the linker only understands the sysv ones, no need to build the
1749 dnl gnu style tables anyways.
1750   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1753 dnl The custom linker doesn't support text relocations, but NDK >= r6b
1754 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
1755 dnl We however want to avoid these text relocations, and this can be done
1756 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
1757 dnl doesn't contain anything at all, beside placeholders for some sections,
1758 dnl and crtbegin only contains a finalizer function that calls
1759 dnl __cxa_finalize. The custom linker actually takes care of calling
1760 dnl __cxa_finalize when the library doesn't call it itself, which makes it
1761 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
1762 dnl link crtbegin and crtend at all.
1763 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
1764   AC_CACHE_CHECK([whether the CRT objects have text relocations],
1765     ac_cv_crt_has_text_relocations,
1766     [echo 'int foo() { return 0; }' > conftest.cpp
1767      if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
1768         test -s conftest${DLL_SUFFIX}; then
1769        if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
1770          ac_cv_crt_has_text_relocations=yes
1771        else
1772          ac_cv_crt_has_text_relocations=no
1773        fi
1774      else
1775        AC_ERROR([couldn't compile a simple C file])
1776      fi
1777      rm -rf conftest*])
1778   if test "$ac_cv_crt_has_text_relocations" = yes; then
1779     dnl While we want libraries to skip the CRT files, we don't want
1780     dnl executables to be treated the same way. We thus set the flag
1781     dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
1782     dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
1783     dnl Using LDFLAGS in nspr is safe, since we only really build
1784     dnl libraries there.
1785     DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
1786   fi
1789 dnl End of C++ language/feature checks
1790 AC_LANG_C
1792 dnl ========================================================
1793 dnl =  Internationalization checks
1794 dnl ========================================================
1796 dnl Internationalization and Locale support is different
1797 dnl on various UNIX platforms.  Checks for specific i18n
1798 dnl features go here.
1800 dnl check for LC_MESSAGES
1801 AC_CACHE_CHECK(for LC_MESSAGES,
1802                ac_cv_i18n_lc_messages,
1803                [AC_TRY_COMPILE([#include <locale.h>],
1804                                [int category = LC_MESSAGES;],
1805                                ac_cv_i18n_lc_messages=yes,
1806                                ac_cv_i18n_lc_messages=no)])
1807 if test "$ac_cv_i18n_lc_messages" = yes; then
1808    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
1811 AC_HAVE_FUNCS(localeconv)
1813 fi # ! SKIP_COMPILER_CHECKS
1815 if test -n "${COMPILE_ENVIRONMENT}"; then
1816   MOZ_CHECK_ALLOCATOR
1819 TARGET_XPCOM_ABI=
1820 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1821     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1822     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1825 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1826 dnl features that Windows actually does support.
1828 if test -n "$SKIP_COMPILER_CHECKS"; then
1829    dnl Windows has malloc.h
1830    AC_DEFINE(MALLOC_H, [<malloc.h>])
1831    AC_DEFINE(HAVE_FORCEINLINE)
1832    AC_DEFINE(HAVE_LOCALECONV)
1833 fi # SKIP_COMPILER_CHECKS
1835 dnl Mozilla specific options
1836 dnl ========================================================
1837 dnl The macros used for command line options
1838 dnl are defined in build/autoconf/altoptions.m4.
1840 dnl ========================================================
1841 dnl =
1842 dnl = Check for external package dependencies
1843 dnl =
1844 dnl ========================================================
1845 MOZ_ARG_HEADER(External Packages)
1847 case "$OS_TARGET" in
1848 WINNT|Darwin|Android)
1849   MOZ_FOLD_LIBS=1
1850   ;;
1852   MOZ_FOLD_LIBS=
1853   ;;
1854 esac
1856 MOZ_CONFIG_NSPR()
1858 dnl ========================================================
1859 dnl system libevent Support
1860 dnl ========================================================
1861 MOZ_ARG_WITH_STRING(system-libevent,
1862 [  --with-system-libevent[=PFX]
1863                           Use system libevent [installed at prefix PFX]],
1864     LIBEVENT_DIR=$withval)
1866 _SAVE_CFLAGS=$CFLAGS
1867 _SAVE_LDFLAGS=$LDFLAGS
1868 _SAVE_LIBS=$LIBS
1869 if test "$LIBEVENT_DIR" = yes; then
1870     PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1871         MOZ_SYSTEM_LIBEVENT=1,
1872         LIBEVENT_DIR=/usr)
1874 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1875     MOZ_SYSTEM_LIBEVENT=
1876 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1877     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1878     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1879     MOZ_CHECK_HEADER(event.h,
1880         [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1881              AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1882          fi],
1883         AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1884     AC_CHECK_LIB(event, event_init,
1885                  [MOZ_SYSTEM_LIBEVENT=1
1886                   MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1887                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1888                  [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1890 CFLAGS=$_SAVE_CFLAGS
1891 LDFLAGS=$_SAVE_LDFLAGS
1892 LIBS=$_SAVE_LIBS
1894 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1896 dnl ========================================================
1897 dnl = If NSS was not detected in the system,
1898 dnl = use the one in the source tree (mozilla/security/nss)
1899 dnl ========================================================
1901 MOZ_ARG_WITH_BOOL(system-nss,
1902 [  --with-system-nss       Use system installed NSS],
1903     _USE_SYSTEM_NSS=1 )
1905 if test -n "$_USE_SYSTEM_NSS"; then
1906     AM_PATH_NSS(3.33, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1909 if test -n "$MOZ_SYSTEM_NSS"; then
1910    NSS_LIBS="$NSS_LIBS -lcrmf"
1911 else
1912    NSS_CFLAGS="-I${DIST}/include/nss"
1913    case "${OS_ARCH}" in
1914         # Only few platforms have been tested with GYP
1915         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1916             ;;
1917         *)
1918             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1919             ;;
1920    esac
1923 if test -z "$SKIP_LIBRARY_CHECKS"; then
1924 dnl system JPEG support
1925 dnl ========================================================
1926 MOZ_ARG_WITH_STRING(system-jpeg,
1927 [  --with-system-jpeg[=PFX]
1928                           Use system libjpeg [installed at prefix PFX]],
1929     JPEG_DIR=$withval)
1931 _SAVE_CFLAGS=$CFLAGS
1932 _SAVE_LDFLAGS=$LDFLAGS
1933 _SAVE_LIBS=$LIBS
1934 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1935     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1936     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1938 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1939     MOZ_SYSTEM_JPEG=
1940 else
1941     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1944 if test "$MOZ_SYSTEM_JPEG" = 1; then
1945     AC_TRY_COMPILE([ #include <stdio.h>
1946                      #include <sys/types.h>
1947                      #include <jpeglib.h> ],
1948                    [ #if JPEG_LIB_VERSION < $MOZJPEG
1949                      #error "Insufficient JPEG library version ($MOZJPEG required)."
1950                      #endif
1951                      #ifndef JCS_EXTENSIONS
1952                      #error "libjpeg-turbo JCS_EXTENSIONS required"
1953                      #endif
1954                      ],
1955                    MOZ_SYSTEM_JPEG=1,
1956                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1958 CFLAGS=$_SAVE_CFLAGS
1959 LDFLAGS=$_SAVE_LDFLAGS
1960 LIBS=$_SAVE_LIBS
1962 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1963     MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1964     MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1966 fi # SKIP_LIBRARY_CHECKS
1968 dnl system ZLIB support
1969 dnl ========================================================
1970 MOZ_ZLIB_CHECK([1.2.3])
1972 if test -z "$SKIP_LIBRARY_CHECKS"; then
1973 dnl system BZIP2 Support
1974 dnl ========================================================
1975 MOZ_ARG_WITH_STRING(system-bz2,
1976 [  --with-system-bz2[=PFX]
1977                           Use system libbz2 [installed at prefix PFX]],
1978     BZ2_DIR=$withval)
1980 _SAVE_CFLAGS=$CFLAGS
1981 _SAVE_LDFLAGS=$LDFLAGS
1982 _SAVE_LIBS=$LIBS
1983 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
1984     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
1985     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
1987 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
1988     MOZ_SYSTEM_BZ2=
1989 else
1990     AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
1991     [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
1993 CFLAGS=$_SAVE_CFLAGS
1994 LDFLAGS=$_SAVE_LDFLAGS
1995 LIBS=$_SAVE_LIBS
1997 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
1998     MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
1999     MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
2002 dnl ========================================================
2003 dnl system PNG Support
2004 dnl ========================================================
2005 MOZ_ARG_WITH_STRING(system-png,
2006 [  --with-system-png[=PFX]
2007                           Use system libpng [installed at prefix PFX]],
2008     PNG_DIR=$withval)
2010 _SAVE_CFLAGS=$CFLAGS
2011 _SAVE_LDFLAGS=$LDFLAGS
2012 _SAVE_LIBS=$LIBS
2013 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
2014     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
2015     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
2017 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
2018     MOZ_SYSTEM_PNG=
2019 else
2020     AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
2021                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2022     AC_CHECK_LIB(png, png_get_acTL, ,
2023                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
2025 if test "$MOZ_SYSTEM_PNG" = 1; then
2026     AC_TRY_COMPILE([ #include <stdio.h>
2027                      #include <sys/types.h>
2028                      #include <png.h> ],
2029                    [ #if PNG_LIBPNG_VER < $MOZPNG
2030                      #error "Insufficient libpng version ($MOZPNG required)."
2031                      #endif
2032                      #ifndef PNG_UINT_31_MAX
2033                      #error "Insufficient libpng version."
2034                      #endif ],
2035                    MOZ_SYSTEM_PNG=1,
2036                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2038 CFLAGS=$_SAVE_CFLAGS
2039 LDFLAGS=$_SAVE_LDFLAGS
2040 LIBS=$_SAVE_LIBS
2042 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
2043     MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
2044     MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
2047 fi # SKIP_LIBRARY_CHECKS
2049 dnl ========================================================
2050 dnl =
2051 dnl = Application
2052 dnl =
2053 dnl ========================================================
2055 MOZ_ARG_HEADER(Application)
2057 ENABLE_SYSTEM_EXTENSION_DIRS=1
2058 MOZ_BRANDING_DIRECTORY=
2059 MOZ_OFFICIAL_BRANDING=
2060 MOZ_FEEDS=1
2061 MOZ_AUTH_EXTENSION=1
2062 if test "$MOZ_IOS"; then
2063    MOZ_AUTH_EXTENSION=
2065 MOZ_RAW=
2066 MOZ_VORBIS=
2067 MOZ_TREMOR=
2068 MOZ_SAMPLE_TYPE_FLOAT32=
2069 MOZ_SAMPLE_TYPE_S16=
2070 MOZ_WEBRTC=1
2071 MOZ_PEERCONNECTION=
2072 MOZ_SRTP=
2073 MOZ_WEBRTC_SIGNALING=
2074 MOZ_WEBRTC_ASSERT_ALWAYS=1
2075 MOZ_WEBRTC_HARDWARE_AEC_NS=
2076 MOZ_SCTP=
2077 VPX_USE_YASM=
2078 VPX_ASFLAGS=
2079 VPX_AS_CONVERSION=
2080 VPX_X86_ASM=
2081 VPX_ARM_ASM=
2082 LIBJPEG_TURBO_AS=
2083 LIBJPEG_TURBO_ASFLAGS=
2084 MOZ_PREF_EXTENSIONS=1
2085 MOZ_REFLOW_PERF=
2086 MOZ_SPELLCHECK=1
2087 MOZ_TOOLKIT_SEARCH=1
2088 MOZ_UI_LOCALE=en-US
2089 MOZ_UNIVERSALCHARDET=1
2090 MOZ_XUL=1
2091 MOZ_ZIPWRITER=1
2092 MOZ_NO_SMART_CARDS=
2093 NECKO_COOKIES=1
2094 MOZ_USE_NATIVE_POPUP_WINDOWS=
2095 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
2096 ACCESSIBILITY=1
2097 MOZ_TIME_MANAGER=
2098 MOZ_CONTENT_SANDBOX=
2099 MOZ_GMP_SANDBOX=
2100 MOZ_SANDBOX=1
2101 MOZ_BINARY_EXTENSIONS=
2102 MOZ_DEVTOOLS=server
2104 case "$target_os" in
2105     mingw*)
2106         NS_ENABLE_TSF=1
2107         AC_DEFINE(NS_ENABLE_TSF)
2108         ;;
2109 esac
2111 case "${target}" in
2112     *-android*|*-linuxandroid*)
2113         MOZ_RAW=1
2114         ;;
2116 esac
2118 # Optional Firefox for Android partner distribution directory.
2119 MOZ_ARG_WITH_STRING(android-distribution-directory,
2120 [  --with-android-distribution-directory=dir
2121                           Optional Firefox for Android partner distribution directory.],
2122   MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
2124 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
2125   # A distribution directory must have an assets/distribution directory.
2126   # See https://wiki.mozilla.org/Mobile/Distribution_Files.
2127   if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
2128     AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
2129                   (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
2130   fi
2132 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
2134 dnl ========================================================
2135 dnl = Trademarked Branding
2136 dnl ========================================================
2137 MOZ_ARG_ENABLE_BOOL(official-branding,
2138 [  --enable-official-branding
2139                           Enable Official mozilla.org Branding
2140                           Do not distribute builds with
2141                           --enable-official-branding unless you have
2142                           permission to use trademarks per
2143                           http://www.mozilla.org/foundation/trademarks/ .],
2144     MOZ_OFFICIAL_BRANDING=1,
2145     MOZ_OFFICIAL_BRANDING=)
2147 # Allow the application to influence configure with a confvars.sh script.
2148 AC_MSG_CHECKING([if app-specific confvars.sh exists])
2149 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
2150   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
2151   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2152 else
2153   AC_MSG_RESULT([no])
2156 # Allow influencing configure with a defines.sh script.
2157 . "${srcdir}/build/defines.sh"
2159 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2160 # set in defines.sh
2161 if test "$BUILDING_RELEASE"; then
2162   # Override value in defines.sh, if any
2163   EARLY_BETA_OR_EARLIER=
2164 elif test "$EARLY_BETA_OR_EARLIER"; then
2165   AC_DEFINE(EARLY_BETA_OR_EARLIER)
2167 AC_SUBST(EARLY_BETA_OR_EARLIER)
2169 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2170 MOZ_ARG_WITH_STRING(app-name,
2171 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2172 WITH_APP_NAME=$withval,
2175 if test -n "$WITH_APP_NAME" ; then
2176     MOZ_APP_NAME="$WITH_APP_NAME"
2179 MOZ_ARG_WITH_STRING(app-basename,
2180 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2181 WITH_APP_BASENAME=$withval,
2184 if test -n "$WITH_APP_BASENAME" ; then
2185     MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2188 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2189 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2190 # MOZ_BUILD_APP.
2191 case "$MOZ_BUILD_APP" in
2192 browser)
2193   AC_DEFINE(MOZ_PHOENIX)
2194   ;;
2196 xulrunner)
2197   AC_DEFINE(MOZ_XULRUNNER)
2198   ;;
2199 esac
2201 # Graphene is a desktop runtime for running applications with a HTML UI.
2202 if test -n "$MOZ_GRAPHENE"; then
2203     AC_DEFINE(MOZ_GRAPHENE)
2206 if test -n "$MOZ_MULET"; then
2207     AC_DEFINE(MOZ_MULET)
2210 # Propagate feature switches for code written in rust from confvars.sh
2211 if test -n "$MOZ_RUST_URLPARSE"; then
2212     AC_DEFINE(MOZ_RUST_URLPARSE)
2213     AC_SUBST(MOZ_RUST_URLPARSE)
2216 AC_SUBST(MOZ_PHOENIX)
2217 AC_SUBST(MOZ_XULRUNNER)
2218 AC_SUBST(MOZ_MULET)
2220 dnl ========================================================
2221 dnl Ensure Android SDK and build-tools versions depending on
2222 dnl mobile target.
2223 dnl ========================================================
2225 case "$MOZ_BUILD_APP" in
2226 mobile/android)
2227     MOZ_ANDROID_SDK(23, 23, 23.0.3 23.0.1, 25.3.2 25.3.1)
2228     ;;
2229 esac
2231 dnl ========================================================
2232 dnl =
2233 dnl = Toolkit Options
2234 dnl =
2235 dnl ========================================================
2236 MOZ_ARG_HEADER(Toolkit Options)
2238 dnl ========================================================
2239 dnl = Enable the toolkit as needed                         =
2240 dnl ========================================================
2242 case "$MOZ_WIDGET_TOOLKIT" in
2244 cocoa)
2245     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2246     # Use -Wl as a trick to avoid -framework and framework names from
2247     # being separated by AC_SUBST_LIST.
2248     TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL -Wl,-framework,Security -Wl,-framework,ServiceManagement'
2249     TK_CFLAGS=""
2250     CFLAGS="$CFLAGS $TK_CFLAGS"
2251     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2252     MOZ_USER_DIR="Mozilla"
2253     MOZ_FS_LAYOUT=bundle
2254     ;;
2256 uikit)
2257     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2258     TK_CFLAGS=""
2259     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'
2260     CFLAGS="$CFLAGS $TK_CFLAGS"
2261     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2262     MOZ_USER_DIR="Mozilla"
2263     MOZ_FS_LAYOUT=bundle
2264     ;;
2266 esac
2268 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2269 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2270 case "$MOZ_WIDGET_TOOLKIT" in
2271 gtk*)
2272     MOZ_ENABLE_GTK=1
2273     ;;
2274 esac
2276 if test "$COMPILE_ENVIRONMENT"; then
2277   if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2278     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
2279     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2280     TK_CFLAGS=$MOZ_GTK3_CFLAGS
2281     TK_LIBS=$MOZ_GTK3_LIBS
2282     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2283     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2284     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2285     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2286   fi
2287   if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2288     GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2289   fi
2290   if test "$MOZ_ENABLE_GTK"; then
2291     if test "$MOZ_X11"; then
2292       GDK_PACKAGES=gdk-x11-2.0
2293     fi
2294     AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2295     AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2297     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
2298     MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2299   fi
2300   if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2301     TK_CFLAGS=$MOZ_GTK2_CFLAGS
2302     TK_LIBS=$MOZ_GTK2_LIBS
2303   fi
2304 fi # COMPILE_ENVIRONMENT
2306 AC_SUBST(MOZ_FS_LAYOUT)
2308 dnl ========================================================
2309 dnl = startup-notification support module
2310 dnl ========================================================
2312 if test "$MOZ_ENABLE_GTK"
2313 then
2314     MOZ_ENABLE_STARTUP_NOTIFICATION=
2316     MOZ_ARG_ENABLE_BOOL(startup-notification,
2317     [  --enable-startup-notification
2318                           Enable startup-notification support (default: disabled) ],
2319         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2320         MOZ_ENABLE_STARTUP_NOTIFICATION=)
2321     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2322     then
2323         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2324                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2325         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2326             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2327             then
2328                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2329             fi
2330             MOZ_ENABLE_STARTUP_NOTIFICATION=
2331         ])
2332     fi
2334     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2335         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2336     fi
2338     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2340 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2342 AC_SUBST_LIST(TK_CFLAGS)
2343 AC_SUBST_LIST(TK_LIBS)
2345 AC_SUBST(MOC)
2346 AC_SUBST(RCC)
2348 dnl ========================================================
2349 dnl =
2350 dnl = Components & Features
2351 dnl =
2352 dnl ========================================================
2353 MOZ_ARG_HEADER(Components and Features)
2355 dnl ========================================================
2356 dnl = Localization
2357 dnl ========================================================
2358 MOZ_ARG_ENABLE_STRING(ui-locale,
2359 [  --enable-ui-locale=ab-CD
2360                           Select the user interface locale (default: en-US)],
2361     MOZ_UI_LOCALE=$enableval )
2362 AC_SUBST(MOZ_UI_LOCALE)
2364 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2365 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2366   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2367     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2368   else
2369     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2370     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2371   fi
2374 MOZ_ARG_WITH_STRING(branding,
2375 [  --with-branding=dir     Use branding from the specified directory.],
2376     MOZ_BRANDING_DIRECTORY=$withval)
2378 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2379 if test -z "$REAL_BRANDING_DIRECTORY"; then
2380   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2383 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2384   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2385 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2386   . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2389 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2391 dnl ========================================================
2392 dnl = Distribution ID
2393 dnl ========================================================
2394 MOZ_ARG_WITH_STRING(distribution-id,
2395 [  --with-distribution-id=ID
2396                           Set distribution-specific id (default=org.mozilla)],
2397 [ val=`echo $withval`
2398     MOZ_DISTRIBUTION_ID="$val"])
2400 if test -z "$MOZ_DISTRIBUTION_ID"; then
2401    MOZ_DISTRIBUTION_ID="org.mozilla"
2404 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2405 AC_SUBST(MOZ_DISTRIBUTION_ID)
2408 dnl ========================================================
2409 dnl Google Play Services, placed here so it can depend on
2410 dnl values set by configure.sh above.
2411 dnl ========================================================
2413 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
2414 MOZ_ANDROID_GOOGLE_CLOUD_MESSAGING
2415 MOZ_ANDROID_INSTALL_TRACKING
2418 dnl ========================================================
2419 dnl = GConf support module
2420 dnl ========================================================
2422 if test "$MOZ_X11"
2423 then
2424     if test "$MOZ_ENABLE_GTK"
2425     then
2426         MOZ_ENABLE_GCONF=1
2427     fi
2429     dnl ========================================================
2430     dnl = GConf support module
2431     dnl ========================================================
2432     MOZ_ARG_DISABLE_BOOL(gconf,
2433     [  --disable-gconf      Disable Gconf support ],
2434         MOZ_ENABLE_GCONF=,
2435         MOZ_ENABLE_GCONF=1)
2437     if test "$MOZ_ENABLE_GCONF"
2438     then
2439         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2440             MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2441             MOZ_ENABLE_GCONF=1
2442         ],[
2443             if test -n "$MOZ_ENABLE_GCONF";
2444             then
2445                 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2446             else
2447                 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2448             fi
2449         ])
2450     fi
2452     if test "$MOZ_ENABLE_GCONF"; then
2453         AC_DEFINE(MOZ_ENABLE_GCONF)
2454     fi
2456     AC_SUBST(MOZ_ENABLE_GCONF)
2459 dnl ========================================================
2460 dnl = libproxy support
2461 dnl ========================================================
2463 if test "$MOZ_ENABLE_GTK"
2464 then
2465     MOZ_ENABLE_LIBPROXY=
2467     MOZ_ARG_ENABLE_BOOL(libproxy,
2468     [  --enable-libproxy         Enable libproxy support ],
2469     MOZ_ENABLE_LIBPROXY=1,
2470     MOZ_ENABLE_LIBPROXY=)
2472     if test "$MOZ_ENABLE_LIBPROXY"
2473     then
2474         PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2475         AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2476     fi
2478 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2480 dnl ========================================================
2481 dnl = dbus support
2482 dnl ========================================================
2484 if test "$MOZ_ENABLE_GTK"
2485 then
2486     MOZ_ENABLE_DBUS=1
2488     MOZ_ARG_DISABLE_BOOL(dbus,
2489     [  --disable-dbus          Disable dbus support ],
2490         MOZ_ENABLE_DBUS=,
2491         MOZ_ENABLE_DBUS=1)
2493     if test "$MOZ_ENABLE_DBUS"
2494     then
2495         PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2496         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2497         AC_DEFINE(MOZ_ENABLE_DBUS)
2498     fi
2500 AC_SUBST(MOZ_ENABLE_DBUS)
2502 dnl =========================================================
2503 dnl = Whether to exclude hyphenations files in the build
2504 dnl =========================================================
2505 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2506     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2509 dnl ========================================================
2510 dnl accessibility support on by default on all platforms
2511 dnl ========================================================
2512 MOZ_ARG_DISABLE_BOOL(accessibility,
2513 [  --disable-accessibility Disable accessibility support],
2514     ACCESSIBILITY=,
2515     ACCESSIBILITY=1 )
2516 if test "$ACCESSIBILITY"; then
2517     case "$target" in
2518     *-mingw*)
2519         if test -z "$MIDL"; then
2520             if test "$GCC" != "yes"; then
2521                 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2522             else
2523                 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.])
2524             fi
2525         fi
2526     esac
2527     AC_DEFINE(ACCESSIBILITY)
2530 dnl ========================================================
2531 dnl Accessibility is required for the linuxgl widget
2532 dnl backend
2533 dnl ========================================================
2534 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2535     AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2538 dnl Turn off webrtc for OS's we don't handle yet, but allow
2539 dnl --enable-webrtc to override.  Can disable for everything in
2540 dnl the master list above.
2541 if test -n "$MOZ_WEBRTC"; then
2542     case "$target" in
2543     *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
2544         dnl Leave enabled
2545         ;;
2546     *)
2547         dnl default to disabled for all others
2548         MOZ_WEBRTC=
2549         ;;
2550     esac
2553 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2554                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2555                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2557 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2559 # target_arch is from {ia32|x64|arm|ppc}
2560 case "$CPU_ARCH" in
2561 x86_64 | arm | aarch64 | x86 | ppc* | ia64)
2562     :
2563     ;;
2565 # unsupported arch for webrtc
2566     MOZ_WEBRTC=
2567     ;;
2569 esac
2571 dnl ========================================================
2572 dnl = Disable WebRTC code
2573 dnl ========================================================
2574 MOZ_ARG_DISABLE_BOOL(webrtc,
2575 [  --disable-webrtc        Disable support for WebRTC],
2576     MOZ_WEBRTC=,
2577     MOZ_WEBRTC=1)
2579 if test -n "$MOZ_WEBRTC"; then
2580     AC_DEFINE(MOZ_WEBRTC)
2581     dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
2582     dnl opt/production builds (via MOZ_CRASH())
2583     AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
2584     MOZ_RAW=1
2586 dnl enable once Signaling lands
2587     MOZ_WEBRTC_SIGNALING=1
2588     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
2589 dnl enable once PeerConnection lands
2590     MOZ_PEERCONNECTION=1
2591     AC_DEFINE(MOZ_PEERCONNECTION)
2592     MOZ_SCTP=1
2593     MOZ_SRTP=1
2594     AC_DEFINE(MOZ_SCTP)
2595     AC_DEFINE(MOZ_SRTP)
2596     if test -n "$MOZ_X11"; then
2597       MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2598     fi
2599 else
2600     MOZ_SYNTH_PICO=
2603 dnl ========================================================
2604 dnl = Force hardware AEC, disable webrtc.org AEC
2605 dnl ========================================================
2606 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2607 [  --enable-hardware-aec-ns   Enable support for hardware AEC and noise suppression],
2608     MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2609     MOZ_WEBRTC_HARDWARE_AEC_NS=)
2611 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2612     AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2615 AC_SUBST(MOZ_WEBRTC)
2616 AC_SUBST(MOZ_WEBRTC_SIGNALING)
2617 AC_SUBST(MOZ_PEERCONNECTION)
2618 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
2619 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2620 AC_SUBST(MOZ_SCTP)
2621 AC_SUBST(MOZ_SRTP)
2622 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2624 dnl Use integers over floats for audio on B2G and Android
2625 dnl (regarless of the CPU architecture, because audio
2626 dnl backends for those platforms don't support floats. We also
2627 dnl use integers on ARM with other OS, because it's more efficient.
2628 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
2629     MOZ_SAMPLE_TYPE_S16=1
2630     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
2631     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
2632 else
2633     MOZ_SAMPLE_TYPE_FLOAT32=1
2634     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
2635     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
2638 dnl ========================================================
2639 dnl = Enable Raw Codecs
2640 dnl ========================================================
2641 MOZ_ARG_ENABLE_BOOL(raw,
2642 [  --enable-raw           Enable support for RAW media],
2643     MOZ_RAW=1,
2644     MOZ_RAW=)
2646 if test -n "$MOZ_RAW"; then
2647     AC_DEFINE(MOZ_RAW)
2650 AC_SUBST(MOZ_RAW)
2652 dnl ========================================================
2653 dnl = Apple platform decoder support
2654 dnl ========================================================
2655 if test "$COMPILE_ENVIRONMENT"; then
2656 if test -n "$MOZ_APPLEMEDIA"; then
2657   # hack in frameworks for fmp4 - see bug 1029974
2658   # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2659   LDFLAGS="$LDFLAGS -framework AudioToolbox"
2660   dnl Verify CoreMedia is available.
2661   AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2662     [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
2664 fi # COMPILE_ENVIRONMENT
2666 dnl system libvpx Support
2667 dnl ========================================================
2668 MOZ_ARG_WITH_BOOL(system-libvpx,
2669 [  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
2670     MOZ_SYSTEM_LIBVPX=1)
2672 MOZ_LIBVPX_CFLAGS=
2673 MOZ_LIBVPX_LIBS=
2675 _SAVE_CFLAGS=$CFLAGS
2676 _SAVE_LIBS=$LIBS
2677 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2678     dnl ============================
2679     dnl === libvpx Version check ===
2680     dnl ============================
2681     dnl Check to see if we have a system libvpx package.
2682     PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2684     CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2685     LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2687     MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2688      [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.])])
2690     AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2691      [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2693     MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2694      [AC_CHECK_FUNC(vpx_mem_set_functions)])
2695     if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2696             "$ac_cv_func_vpx_mem_set_functions" = no; then
2697         AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2698     fi
2700 CFLAGS=$_SAVE_CFLAGS
2701 LIBS=$_SAVE_LIBS
2703 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2704 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2705 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2707 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
2708     MOZ_VORBIS=1
2709 else
2710     MOZ_TREMOR=1
2713 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2715     dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2716     dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2717     dnl We currently require gcc on all arm platforms.
2719     dnl See if we have assembly on this platform.
2720     case "$OS_ARCH:$CPU_ARCH" in
2721     Darwin:x86)
2722       VPX_USE_YASM=1
2723       VPX_X86_ASM=1
2724     ;;
2725     Darwin:x86_64)
2726       VPX_USE_YASM=1
2727       VPX_X86_ASM=1
2728     ;;
2729     WINNT:x86_64)
2730       VPX_USE_YASM=1
2731       VPX_X86_ASM=1
2732     ;;
2733     WINNT:x86)
2734       dnl Check for yasm 1.1 or greater.
2735       if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2736         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.])
2737       elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2738         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.])
2739       else
2740         VPX_USE_YASM=1
2741         VPX_X86_ASM=1
2742         dnl The encoder needs obj_int_extract to get asm offsets.
2743       fi # COMPILE_ENVIRONMENT and others
2744     ;;
2745     *:arm*)
2746       if test -n "$GNU_AS" ; then
2747         dnl These flags are a lie; they're just used to enable the requisite
2748         dnl opcodes; actual arch detection is done at runtime.
2749         VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2750         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2751         VPX_ARM_ASM=1
2752         dnl Building with -mfpu=neon requires either the "softfp" or the
2753         dnl "hardfp" ABI. Depending on the compiler's default target, and the
2754         dnl CFLAGS, the default ABI might be neither, in which case it is the
2755         dnl "softfloat" ABI.
2756         dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2757         dnl we can safely mix code built with both ABIs. So, if we detect
2758         dnl that compiling uses the "softfloat" ABI, force the use of the
2759         dnl "softfp" ABI instead.
2760         dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2761         dnl "softfloat" ABI, not the "softfp" ABI.
2762         dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2763         AC_TRY_COMPILE([],
2764           [#ifndef __SOFTFP__
2765            #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2766            #endif],
2767            VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2768            )
2769       fi
2770     ;;
2771     *:x86)
2772       if $CC -E -dM -</dev/null | grep -q __ELF__; then
2773         VPX_USE_YASM=1
2774         VPX_X86_ASM=1
2775       fi
2776     ;;
2777     *:x86_64)
2778       if $CC -E -dM -</dev/null | grep -q __ELF__; then
2779         VPX_USE_YASM=1
2780         VPX_X86_ASM=1
2781       fi
2782     ;;
2783     esac
2785     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2786       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.])
2787     fi # COMPILE_ENVIRONMENT and others
2789     if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2790       VPX_ASFLAGS="-DPIC"
2791     fi
2793     if test -n "$VPX_X86_ASM"; then
2794       AC_DEFINE(VPX_X86_ASM)
2795     elif test -n "$VPX_ARM_ASM"; then
2796       AC_DEFINE(VPX_ARM_ASM)
2797     else
2798       AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2799     fi
2801     dnl native libvpx no longer has vpx_mem_set_functions
2802     AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2805 dnl ========================================================
2806 dnl = Handle dependent MEDIA defines
2807 dnl ========================================================
2809 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
2810     AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
2813 if test -n "$MOZ_VORBIS"; then
2814     AC_DEFINE(MOZ_VORBIS)
2817 if test -n "$MOZ_TREMOR"; then
2818     AC_DEFINE(MOZ_TREMOR)
2821 MOZ_WEBM_ENCODER=1
2822 AC_DEFINE(MOZ_WEBM_ENCODER)
2823 AC_SUBST(MOZ_WEBM_ENCODER)
2825 dnl ==================================
2826 dnl = Check alsa availability on Linux
2827 dnl ==================================
2829 MOZ_ARG_ENABLE_BOOL(alsa,
2830 [  --enable-alsa          Enable Alsa support],
2831    MOZ_ALSA=1,
2832    MOZ_ALSA=)
2834 if test -n "$MOZ_ALSA"; then
2835     PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
2836          [echo "$MOZ_ALSA_PKG_ERRORS"
2837           AC_MSG_ERROR([Need alsa for audio output on Linux. (On Ubuntu, you might try installing the package libasound2-dev.)])])
2840 AC_SUBST(MOZ_ALSA)
2842 dnl ========================================================
2843 dnl = Disable PulseAudio
2844 dnl ========================================================
2846 dnl If using Desktop Linux, ensure that the PA library is available
2847 case "$OS_TARGET" in
2848 WINNT|Darwin|Android|OpenBSD)
2849     ;;
2851     MOZ_PULSEAUDIO=1
2852     ;;
2853 esac
2855 MOZ_ARG_DISABLE_BOOL(pulseaudio,
2856 [  --disable-pulseaudio          Disable PulseAudio support],
2857    MOZ_PULSEAUDIO=,
2858    MOZ_PULSEAUDIO=1)
2860 if test -n "$MOZ_PULSEAUDIO"; then
2861     AC_DEFINE(MOZ_PULSEAUDIO)
2862     PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
2863          [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
2864           AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
2867 AC_SUBST(MOZ_PULSEAUDIO)
2869 dnl ========================================================
2870 dnl NegotiateAuth
2871 dnl ========================================================
2873 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2874 [  --disable-negotiateauth Disable GSS-API negotiation ],
2875     MOZ_AUTH_EXTENSION=,
2876     MOZ_AUTH_EXTENSION=1 )
2878 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2879    AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2882 dnl ========================================================
2883 dnl Pref extensions (autoconfig)
2884 dnl ========================================================
2885 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2886 [  --disable-pref-extensions
2887                           Disable pref extensions such as autoconfig],
2888   MOZ_PREF_EXTENSIONS=,
2889   MOZ_PREF_EXTENSIONS=1 )
2891 dnl ========================================================
2892 dnl Searching of system directories for extensions.
2893 dnl Note: this switch is meant to be used for test builds
2894 dnl whose behavior should not depend on what happens to be
2895 dnl installed on the local machine.
2896 dnl ========================================================
2897 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2898 [  --disable-system-extension-dirs
2899                           Disable searching system- and account-global
2900                           directories for extensions of any kind; use
2901                           only profile-specific extension directories],
2902   ENABLE_SYSTEM_EXTENSION_DIRS=,
2903   ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2904 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2905   AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2908 dnl ========================================================
2909 dnl = Universalchardet
2910 dnl ========================================================
2911 MOZ_ARG_DISABLE_BOOL(universalchardet,
2912 [  --disable-universalchardet
2913                           Disable universal encoding detection],
2914   MOZ_UNIVERSALCHARDET=,
2915   MOZ_UNIVERSALCHARDET=1 )
2917 dnl ========================================================
2918 dnl = ANGLE OpenGL->D3D translator for WebGL
2919 dnl = * only applies to win32 (and then, not MINGW)
2920 dnl ========================================================
2922 MOZ_ANGLE_RENDERER=
2923 MOZ_D3D_CPU_SUFFIX=
2924 MOZ_HAS_WINSDK_WITH_D3D=
2925 MOZ_D3DCOMPILER_VISTA_DLL=
2926 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2928 if test "$COMPILE_ENVIRONMENT" ; then
2929 case "$target_os" in
2930 *mingw*)
2931     MOZ_ANGLE_RENDERER=1
2932     ;;
2933 esac
2935 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2936 case "${target_cpu}" in
2937 i*86)
2938   MOZ_D3D_CPU_SUFFIX=x86
2939   ;;
2940 x86_64)
2941   MOZ_D3D_CPU_SUFFIX=x64
2942   ;;
2943 esac
2945 dnl ========================================================
2946 dnl D3D compiler DLL
2947 dnl ========================================================
2948 MOZ_FOUND_D3D_COMPILERS=
2950 if test -n "$MOZ_ANGLE_RENDERER"; then
2951   if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2952     AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2953   fi
2955   ######################################
2956   # Find _46+ for use by Vista+.
2958   # Find a D3D compiler DLL in a Windows SDK.
2959   MOZ_D3DCOMPILER_VISTA_DLL=
2960   case "$MOZ_WINSDK_MAXVER" in
2961   0x0603*|0x0A00*)
2962     MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2963     AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2964   ;;
2965   esac
2967   if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2968     # We have a name, now track down the path.
2969     if test -n "$WINDOWSSDKDIR"; then
2970       MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2971       if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2972         AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2973         MOZ_HAS_WINSDK_WITH_D3D=1
2974       else
2975         AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2976         AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2977         MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2978       fi
2979     else
2980       AC_MSG_RESULT([Windows SDK not found.])
2981     fi
2982   else
2983     if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2984       AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2985     else
2986       AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2987     fi
2988   fi
2990   if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2991     MOZ_D3DCOMPILER_VISTA_DLL=
2992   fi
2994   # On mingw, check if headers are provided by toolchain.
2995   if test -n "$GNU_CC"; then
2996     MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2997   fi
2999   ######################################
3000   # Check that we found what we needed.
3001   MOZ_FOUND_A_D3D_COMPILER=
3003   if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3004     MOZ_FOUND_A_D3D_COMPILER=1
3005     AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
3006   fi
3008   if test -z "$CROSS_COMPILE"; then
3009     if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
3010       AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
3011     fi
3012   fi
3013 fi # MOZ_ANGLE_RENDERER
3015 fi # COMPILE_ENVIRONMENT
3018 dnl ========================================================
3019 dnl Gamepad support
3020 dnl ========================================================
3021 MOZ_GAMEPAD_BACKEND=stub
3023 case "$OS_TARGET" in
3024 Darwin)
3025     if test -z "$MOZ_IOS"; then
3026         MOZ_GAMEPAD_BACKEND=cocoa
3027     fi
3028     ;;
3029 WINNT)
3030     MOZ_GAMEPAD_BACKEND=windows
3031     ;;
3032 Linux)
3033     MOZ_CHECK_HEADER([linux/joystick.h])
3034     if test "$ac_cv_header_linux_joystick_h" != "yes"; then
3035       AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
3036     fi
3037     MOZ_GAMEPAD_BACKEND=linux
3038     ;;
3039 Android)
3040     MOZ_GAMEPAD_BACKEND=android
3041     ;;
3043     ;;
3044 esac
3046 AC_SUBST(MOZ_GAMEPAD_BACKEND)
3048 dnl ========================================================
3049 dnl = Breakpad crash reporting (on by default on supported platforms)
3050 dnl ========================================================
3052 case $target in
3053 i?86-*-mingw*|x86_64-*-mingw*)
3054   MOZ_CRASHREPORTER=1
3055   ;;
3056 i?86-apple-darwin*|x86_64-apple-darwin*)
3057   if test -z "$MOZ_IOS"; then
3058     MOZ_CRASHREPORTER=1
3059   fi
3060   ;;
3061 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
3062   if test "$MOZ_ENABLE_GTK"; then
3063     MOZ_CRASHREPORTER=1
3064   fi
3065   ;;
3066 *-android*|*-linuxandroid*)
3067   MOZ_CRASHREPORTER=1
3068   ;;
3069 esac
3071 MOZ_ARG_DISABLE_BOOL(crashreporter,
3072 [  --disable-crashreporter Disable breakpad crash reporting],
3073     [MOZ_CRASHREPORTER=],
3074     [MOZ_CRASHREPORTER=F # Force enable breakpad])
3076 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
3077   if test "$MOZ_CRASHREPORTER" = F; then
3078     AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
3079   fi
3080   MOZ_CRASHREPORTER=
3083 if test -n "$MOZ_CRASHREPORTER"; then
3084    AC_DEFINE(MOZ_CRASHREPORTER)
3086   if test "$OS_TARGET" = "Linux" && \
3087     test -z "$SKIP_LIBRARY_CHECKS"; then
3088     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
3089   fi
3091   if test "$OS_ARCH" = "WINNT"; then
3092     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
3093       MOZ_CRASHREPORTER_INJECTOR=1
3094       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
3095     fi
3096   fi
3099 dnl ========================================================
3100 dnl = libjpeg-turbo configuration
3101 dnl ========================================================
3102 MOZ_LIBJPEG_TURBO=
3103 LIBJPEG_TURBO_USE_YASM=
3104 if test -z "$MOZ_SYSTEM_JPEG"; then
3105     MOZ_LIBJPEG_TURBO=1
3108 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
3109 [ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
3110     MOZ_LIBJPEG_TURBO=,
3111     MOZ_LIBJPEG_TURBO=1)
3113 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
3114     AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
3117 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
3118 dnl files.
3120 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
3122   dnl Do we support libjpeg-turbo on this platform?
3123   case "$OS_ARCH:$CPU_ARCH" in
3124   Darwin:x86)
3125     LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
3126   ;;
3127   Darwin:x86_64)
3128     LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3129   ;;
3130   Darwin:arm*)
3131   ;;
3132   WINNT:x86)
3133     LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
3134   ;;
3135   WINNT:x86_64)
3136     LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3137   ;;
3138   *:arm)
3139     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
3140   ;;
3141   *:aarch64)
3142     LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
3143   ;;
3144   *:mips32)
3145     LIBJPEG_TURBO_ASFLAGS="-mdspr2"
3146   ;;
3147   *:x86)
3148     if $CC -E -dM -</dev/null | grep -q __ELF__; then
3149       LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
3150     fi
3151   ;;
3152   *:x86_64)
3153     if $CC -E -dM -</dev/null | grep -q __ELF__; then
3154       LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3155     fi
3156   ;;
3157   esac
3160 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
3161   case "$CPU_ARCH" in
3162 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
3163 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
3164 dnl it doesn't exist or we have too old of a version.
3165   x86_64|x86)
3166     LIBJPEG_TURBO_USE_YASM=1
3168     if test -z "$YASM" ; then
3169         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.])
3170     fi
3172     dnl Check that we have the right yasm version.  We require 1.0.1 or newer
3173     dnl on Linux and 1.1 or newer everywhere else.
3174     if test "$OS_ARCH" = "Linux" ; then
3175         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
3176             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.])
3177         fi
3178     else
3179         if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3180             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.])
3181         fi
3182     fi
3183   ;;
3184   esac
3187 dnl ========================================================
3188 dnl = libav-fft configuration
3189 dnl ========================================================
3191 MOZ_LIBAV_FFT=
3193 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
3194 dnl 32-bit linux/os x have text relocation issues.
3196 case "$OS_ARCH:$CPU_ARCH" in
3197   WINNT:x86)
3198       MOZ_LIBAV_FFT=1
3199   ;;
3200   *:x86_64)
3201       MOZ_LIBAV_FFT=1
3202   ;;
3203 esac
3205 dnl Detect if we can use yasm to compile libav's assembly
3207 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
3208   AC_DEFINE(MOZ_LIBAV_FFT)
3209   dnl Do we support libav-fft on this platform?
3210   case "$OS_ARCH:$CPU_ARCH" in
3211   Darwin:x86_64)
3212     LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3213   ;;
3214   WINNT:x86)
3215     LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
3216   ;;
3217   WINNT:x86_64)
3218     LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3219   ;;
3220   *:x86_64)
3221     if $CC -E -dM -</dev/null | grep -q __ELF__; then
3222       LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3223     fi
3224   ;;
3225   *)
3226     AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
3227   ;;
3228   esac
3231 if test -n "$LIBAV_FFT_ASFLAGS"; then
3232   dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
3233   dnl check for Yasm, and error out if it doesn't exist or we have too old of a
3234   dnl version.
3235   if test -z "$YASM" ; then
3236     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.])
3237   fi
3238   dnl Check that we have the right yasm version.  We require 1.0.1 or newer
3239   dnl on Linux and 1.1 or newer everywhere else.
3240   if test "$OS_ARCH" = "Linux" ; then
3241     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
3242       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.])
3243     fi
3244   else
3245     if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3246       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.])
3247     fi
3248   fi
3249 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
3250   dnl Warn if we're not building either libav or opendl-max optimized routines.
3251   AC_MSG_WARN([No assembler or assembly support for libav-fft.  Using unoptimized C routines.])
3254 dnl ========================================================
3255 dnl = FFmpeg's ffvpx configuration
3256 dnl ========================================================
3258 MOZ_FFVPX=
3259 case "$CPU_ARCH" in
3260   x86)
3261       MOZ_FFVPX=1
3262   ;;
3263   x86_64)
3264       MOZ_FFVPX=1
3265   ;;
3266 esac
3268 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
3269 if test -n "$MOZ_LIBAV_FFT"; then
3270   FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
3272 if test -n "$MOZ_FFVPX"; then
3273   AC_DEFINE(MOZ_FFVPX)
3276 dnl ========================================================
3277 dnl = Enable compilation of specific extension modules
3278 dnl ========================================================
3280 MOZ_ARG_ENABLE_STRING(extensions,
3281 [  --enable-extensions     Enable extensions],
3282 [ for option in `echo $enableval | sed 's/,/ /g'`; do
3283     if test "$option" = "yes" -o "$option" = "all"; then
3284         AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
3285     elif test "$option" = "no" -o "$option" = "none"; then
3286         MOZ_EXTENSIONS=""
3287     elif test "$option" = "default"; then
3288         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
3289     elif test `echo "$option" | grep -c \^-` != 0; then
3290         option=`echo $option | sed 's/^-//'`
3291         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
3292     else
3293         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
3294     fi
3295 done],
3296     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
3298 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
3299 dnl when trying to build a nonexistent extension.
3300 for extension in $MOZ_EXTENSIONS; do
3301     if test ! -d "${srcdir}/extensions/${extension}"; then
3302         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
3303     fi
3304 done
3306 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
3307   AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
3310 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
3311 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
3312 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
3313    MOZ_ENABLE_CAIRO_FT=1
3314    FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3315    CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
3316    AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3319 AC_CHECK_PROGS(WGET, wget, "")
3320 AC_SUBST(WGET)
3322 dnl ========================================================
3323 dnl Maintenance Service
3324 dnl ========================================================
3326 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3327 [  --enable-maintenance-service       Enable building of maintenanceservice],
3328     MOZ_MAINTENANCE_SERVICE=1,
3329     MOZ_MAINTENANCE_SERVICE= )
3331 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3332   if test "$OS_ARCH" = "WINNT"; then
3333     AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3334   else
3335     AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3336   fi
3339 dnl ========================================================
3340 dnl Bundled fonts on desktop platforms
3341 dnl ========================================================
3343 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3344 [  --enable-bundled-fonts  Enable support for bundled fonts on desktop platforms],
3345     MOZ_BUNDLED_FONTS=1,
3346     MOZ_BUNDLED_FONTS=)
3348 if test -n "$MOZ_BUNDLED_FONTS"; then
3349   AC_DEFINE(MOZ_BUNDLED_FONTS)
3352 dnl ========================================================
3353 dnl Verify MAR signatures
3354 dnl ========================================================
3356 MOZ_ARG_ENABLE_BOOL(verify-mar,
3357 [  --enable-verify-mar     Enable verifying MAR signatures],
3358     MOZ_VERIFY_MAR_SIGNATURE=1,
3359     MOZ_VERIFY_MAR_SIGNATURE= )
3361 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3362   AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3365 dnl ========================================================
3366 dnl Enable building the signmar program.
3367 dnl This option is much different than the --enable-verify-mar option.
3368 dnl --enable-verify-mar is for enabling the verification check on MAR
3369 dnl files in the updater.  The --enable-signmar option is for building
3370 dnl the signmar program.
3371 dnl ========================================================
3373 MOZ_ARG_ENABLE_BOOL(signmar,
3374 [  --enable-signmar     Enable building the signmar program],
3375     MOZ_ENABLE_SIGNMAR=1,
3376     MOZ_ENABLE_SIGNMAR= )
3378 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3379   if test -z "$COMPILE_ENVIRONMENT" ; then
3380     AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3381     MOZ_ENABLE_SIGNMAR=
3382   else
3383     AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3384   fi
3387 dnl ========================================================
3388 dnl Updater
3389 dnl ========================================================
3391 if test "$MOZ_IOS"; then
3392   MOZ_UPDATER=
3395 MOZ_ARG_DISABLE_BOOL(updater,
3396 [  --disable-updater       Disable building of updater],
3397     MOZ_UPDATER=,
3398     MOZ_UPDATER=1 )
3400 if test -n "$MOZ_UPDATER"; then
3401     AC_DEFINE(MOZ_UPDATER)
3404 dnl ========================================================
3405 dnl parental controls (for Windows Vista)
3406 dnl ========================================================
3407 MOZ_ARG_DISABLE_BOOL(parental-controls,
3408 [  --disable-parental-controls
3409                           Do not build parental controls],
3410    MOZ_DISABLE_PARENTAL_CONTROLS=1,
3411    MOZ_DISABLE_PARENTAL_CONTROLS=)
3412 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3413     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3416 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3418 dnl ========================================================
3419 dnl = Disable smartcard support
3420 dnl ========================================================
3421 if test -n "$MOZ_NO_SMART_CARDS"; then
3422     AC_DEFINE(MOZ_NO_SMART_CARDS)
3424 AC_SUBST(MOZ_NO_SMART_CARDS)
3426 dnl ========================================================
3427 dnl = Sandboxing support
3428 dnl ========================================================
3429 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3430     # Bug 1182565: TSan conflicts with sandboxing on Linux.
3431     # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3432     case $OS_TARGET in
3433     Linux|Android)
3434         MOZ_SANDBOX=
3435         ;;
3436     esac
3439 MOZ_ARG_DISABLE_BOOL(sandbox,
3440 [  --disable-sandbox        Disable sandboxing support],
3441     MOZ_SANDBOX=,
3442     MOZ_SANDBOX=1)
3444 dnl ========================================================
3445 dnl = Content process sandboxing
3446 dnl ========================================================
3448 case "$OS_TARGET" in
3449 WINNT)
3450     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3451     ;;
3452 Darwin)
3453     MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3454     ;;
3455 Linux)
3456     case $CPU_ARCH in
3457         x86_64|x86)
3458             MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3459         ;;
3460     esac
3461     ;;
3462 esac
3464 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3465 [  --enable-content-sandbox Enable sandboxing support for content-processes
3466   --disable-content-sandbox Disable sandboxing support for content-processes],
3467     MOZ_CONTENT_SANDBOX=1,
3468     MOZ_CONTENT_SANDBOX=)
3470 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3471     AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3474 if test -n "$MOZ_CONTENT_SANDBOX"; then
3475     AC_DEFINE(MOZ_CONTENT_SANDBOX)
3478 AC_SUBST(MOZ_CONTENT_SANDBOX)
3480 dnl ========================================================
3481 dnl = Gecko Media Plugin sandboxing
3482 dnl ========================================================
3483 case $OS_TARGET in
3484 WINNT)
3485     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3486     ;;
3487 Linux)
3488     case $CPU_ARCH in
3489     x86_64|x86)
3490         MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3491         ;;
3492     esac
3493     ;;
3494 Darwin)
3495     MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3496     ;;
3497 esac
3499 if test -n "$MOZ_GMP_SANDBOX"; then
3500     AC_DEFINE(MOZ_GMP_SANDBOX)
3503 AC_SUBST(MOZ_GMP_SANDBOX)
3505 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3506     MOZ_SANDBOX=
3509 if test -n "$MOZ_SANDBOX"; then
3510     AC_DEFINE(MOZ_SANDBOX)
3513 AC_SUBST(MOZ_SANDBOX)
3516 dnl ========================================================
3517 dnl =
3518 dnl = Module specific options
3519 dnl =
3520 dnl ========================================================
3521 MOZ_ARG_HEADER(Individual module options)
3523 dnl ========================================================
3524 dnl = Disable feed handling components
3525 dnl ========================================================
3526 MOZ_ARG_DISABLE_BOOL(feeds,
3527 [  --disable-feeds         Disable feed handling and processing components],
3528     MOZ_FEEDS=,
3529     MOZ_FEEDS=1 )
3530 if test -n "$MOZ_FEEDS"; then
3531     AC_DEFINE(MOZ_FEEDS)
3532 else
3533     if test "$MOZ_BUILD_APP" = "browser"; then
3534         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3535     fi
3538 dnl ========================================================
3539 dnl Check for sqlite
3540 dnl ========================================================
3542 MOZ_SYSTEM_SQLITE=
3543 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3544 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
3545 MOZ_SYSTEM_SQLITE=1,
3546 MOZ_SYSTEM_SQLITE= )
3548 if test -n "$MOZ_SYSTEM_SQLITE"
3549 then
3550     dnl ============================
3551     dnl === SQLite Version check ===
3552     dnl ============================
3553     dnl Check to see if the system SQLite package is new enough.
3554     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3556     dnl ==================================
3557     dnl === SQLITE_SECURE_DELETE check ===
3558     dnl ==================================
3559     dnl Check to see if the system SQLite package is compiled with
3560     dnl SQLITE_SECURE_DELETE enabled.
3561     AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3562     _SAVE_CFLAGS="$CFLAGS"
3563     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3564     _SAVE_LIBS="$LIBS"
3565     LIBS="$LIBS $SQLITE_LIBS"
3566     AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3567         AC_TRY_RUN([
3568             #include "sqlite3.h"
3570             int main(int argc, char **argv){
3571               return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3572             }],
3573             ac_cv_sqlite_secure_delete=yes,
3574             ac_cv_sqlite_secure_delete=no,
3575             ac_cv_sqlite_secure_delete=no
3576         )
3577     ])
3578     AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3579     CFLAGS="$_SAVE_CFLAGS"
3580     LIBS="$_SAVE_LIBS"
3581     if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3582         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3583     fi
3585     dnl ===============================
3586     dnl === SQLITE_THREADSAFE check ===
3587     dnl ===============================
3588     dnl Check to see if the system SQLite package is compiled with
3589     dnl SQLITE_THREADSAFE enabled.
3590     AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3591     _SAVE_CFLAGS="$CFLAGS"
3592     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3593     _SAVE_LIBS="$LIBS"
3594     LIBS="$LIBS $SQLITE_LIBS"
3595     AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3596         AC_TRY_RUN([
3597             #include "sqlite3.h"
3599             int main(int argc, char **argv){
3600               return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3601             }],
3602             ac_cv_sqlite_threadsafe=yes,
3603             ac_cv_sqlite_threadsafe=no,
3604             ac_cv_sqlite_threadsafe=no
3605         )
3606     ])
3607     AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3608     CFLAGS="$_SAVE_CFLAGS"
3609     LIBS="$_SAVE_LIBS"
3610     if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3611         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3612     fi
3614     dnl ================================
3615     dnl === SQLITE_ENABLE_FTS3 check ===
3616     dnl ================================
3617     dnl check to see if the system SQLite package is compiled with
3618     dnl SQLITE_ENABLE_FTS3 enabled.
3619     AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3620     _SAVE_CFLAGS="$CFLAGS"
3621     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3622     _SAVE_LIBS="$LIBS"
3623     LIBS="$LIBS $SQLITE_LIBS"
3624     AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3625         AC_TRY_RUN([
3626             #include "sqlite3.h"
3628             int main(int argc, char **argv){
3629               return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3630             }],
3631             ac_cv_sqlite_enable_fts3=yes,
3632             ac_cv_sqlite_enable_fts3=no,
3633             ac_cv_sqlite_enable_fts3=no
3634         )
3635     ])
3636     AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3637     CFLAGS="$_SAVE_CFLAGS"
3638     LIBS="$_SAVE_LIBS"
3639     if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3640         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3641     fi
3643     dnl =========================================
3644     dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3645     dnl =========================================
3646     dnl check to see if the system SQLite package is compiled with
3647     dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3648     AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3649     _SAVE_CFLAGS="$CFLAGS"
3650     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3651     _SAVE_LIBS="$LIBS"
3652     LIBS="$LIBS $SQLITE_LIBS"
3653     AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3654         AC_TRY_RUN([
3655             #include "sqlite3.h"
3657             int main(int argc, char **argv){
3658               return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3659             }],
3660             ac_cv_sqlite_enable_unlock_notify=yes,
3661             ac_cv_sqlite_enable_unlock_notify=no,
3662             ac_cv_sqlite_enable_unlock_notify=no
3663         )
3664     ])
3665     AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3666     CFLAGS="$_SAVE_CFLAGS"
3667     LIBS="$_SAVE_LIBS"
3668     if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3669         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3670     fi
3672     dnl =========================================
3673     dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3674     dnl =========================================
3675     dnl check to see if the system SQLite package is compiled with
3676     dnl SQLITE_ENABLE_DBSTAT_VTAB.
3677     AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3678     _SAVE_CFLAGS="$CFLAGS"
3679     CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3680     _SAVE_LIBS="$LIBS"
3681     LIBS="$LIBS $SQLITE_LIBS"
3682     AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3683         AC_TRY_RUN([
3684             #include "sqlite3.h"
3686             int main(int argc, char **argv){
3687               return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3688             }],
3689             ac_cv_sqlite_dbstat_vtab=yes,
3690             ac_cv_sqlite_dbstat_vtab=no,
3691             ac_cv_sqlite_dbstat_vtab=no
3692         )
3693     ])
3694     AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3695     CFLAGS="$_SAVE_CFLAGS"
3696     LIBS="$_SAVE_LIBS"
3697     if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3698         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3699     fi
3702 if test -n "$MOZ_SYSTEM_SQLITE"; then
3703     AC_DEFINE(MOZ_SYSTEM_SQLITE)
3705 AC_SUBST(MOZ_SYSTEM_SQLITE)
3707 dnl ========================================================
3708 dnl = Disable zipwriter
3709 dnl ========================================================
3710 MOZ_ARG_DISABLE_BOOL(zipwriter,
3711 [  --disable-zipwriter     Disable zipwriter component],
3712     MOZ_ZIPWRITER=,
3713     MOZ_ZIPWRITER=1 )
3714 AC_SUBST(MOZ_ZIPWRITER)
3716 dnl ========================================================
3717 dnl =
3718 dnl = Feature options that require extra sources to be pulled
3719 dnl =
3720 dnl ========================================================
3721 dnl MOZ_ARG_HEADER(Features that require extra sources)
3723 dnl ========================================================
3724 dnl =
3725 dnl = Runtime debugging and Optimization Options
3726 dnl =
3727 dnl ========================================================
3728 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3730 dnl ========================================================
3731 dnl enable mobile optimizations
3732 dnl ========================================================
3733 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3734 [  --enable-mobile-optimize
3735                           Enable mobile optimizations],
3736     MOZ_GFX_OPTIMIZE_MOBILE=1)
3738 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3740 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3741     # We ignore paint will resample on mobile for performance.
3742     # We may want to revisit this later.
3743     MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3745     AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3746     AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3749 dnl ========================================================
3750 dnl = Enable code optimization. ON by default.
3751 dnl ========================================================
3752 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
3753     MOZ_OPTIMIZE_FLAGS="-O"
3756 MOZ_ARG_ENABLE_STRING(optimize,
3757 [  --disable-optimize      Disable compiler optimization
3758   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
3759 [ if test "$enableval" != "no"; then
3760     MOZ_OPTIMIZE=1
3761     if test -n "$enableval" -a "$enableval" != "yes"; then
3762         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
3763         MOZ_OPTIMIZE=2
3764     fi
3765 else
3766     MOZ_OPTIMIZE=
3767 fi ], MOZ_OPTIMIZE=1)
3769 MOZ_SET_FRAMEPTR_FLAGS
3771 if test "$COMPILE_ENVIRONMENT"; then
3772 if test -n "$MOZ_OPTIMIZE"; then
3773     AC_MSG_CHECKING([for valid C compiler optimization flags])
3774     _SAVE_CFLAGS=$CFLAGS
3775     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3776     AC_TRY_COMPILE([#include <stdio.h>],
3777         [printf("Hello World\n");],
3778         _results=yes,
3779         _results=no)
3780     AC_MSG_RESULT([$_results])
3781     if test "$_results" = "no"; then
3782         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3783     fi
3784     CFLAGS=$_SAVE_CFLAGS
3786 fi # COMPILE_ENVIRONMENT
3788 AC_SUBST(MOZ_OPTIMIZE)
3789 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
3790 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
3791 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
3792 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
3794 dnl ========================================================
3795 dnl = Disable treating compiler warnings as errors
3796 dnl ========================================================
3797 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3798    WARNINGS_AS_ERRORS=''
3801 dnl ========================================================
3802 dnl = Enable runtime logging
3803 dnl ========================================================
3804 AC_DEFINE(MOZ_LOGGING)
3805 AC_DEFINE(FORCE_PR_LOG)
3807 dnl ========================================================
3808 dnl = This will enable logging of addref, release, ctor, dtor.
3809 dnl ========================================================
3810 _ENABLE_LOGREFCNT=42
3811 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3812 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
3813     _ENABLE_LOGREFCNT=1,
3814     _ENABLE_LOGREFCNT= )
3815 if test "$_ENABLE_LOGREFCNT" = "1"; then
3816     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3817 elif test -z "$_ENABLE_LOGREFCNT"; then
3818     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3821 dnl ========================================================
3822 dnl moz_dump_painting
3823 dnl ========================================================
3824 MOZ_ARG_ENABLE_BOOL(dump-painting,
3825 [  --enable-dump-painting          Enable paint debugging.],
3826     MOZ_DUMP_PAINTING=1,
3827     MOZ_DUMP_PAINTING= )
3828 if test -n "$MOZ_DUMP_PAINTING"; then
3829     AC_DEFINE(MOZ_DUMP_PAINTING)
3830     AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3832 if test -n "$MOZ_DEBUG"; then
3833     AC_DEFINE(MOZ_DUMP_PAINTING)
3836 case "${OS_TARGET}" in
3837 Android|WINNT|Darwin)
3838   MOZ_GLUE_IN_PROGRAM=
3839   ;;
3841   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3842   MOZ_GLUE_IN_PROGRAM=1
3843   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3844   ;;
3845 esac
3847 dnl ========================================================
3848 dnl = Jemalloc build setup
3849 dnl ========================================================
3850 if test -z "$MOZ_MEMORY"; then
3851   case "${target}" in
3852     *-mingw*)
3853       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3854         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.])
3855       fi
3856       ;;
3857   esac
3858 else
3859   dnl The generic feature tests that determine how to compute ncpus are long and
3860   dnl complicated.  Therefore, simply define special cpp variables for the
3861   dnl platforms we have special knowledge of.
3862   case "${target}" in
3863   *-mingw*)
3864     export MOZ_NO_DEBUG_RTL=1
3865     ;;
3866   esac
3867 fi # MOZ_MEMORY
3868 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3870 # Allow the application to provide a subconfigure script.
3871 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3872 # ldap/c-sdk/configure refers to the enviroment value.
3873 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3874   do_output_subdirs() {
3875     if test -n "$_subconfigure_subdirs"; then
3876       AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3877      fi
3878     _subconfigure_subdir="$1"
3879     _subconfigure_config_args="$ac_configure_args"
3880   }
3881   tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3882   m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3883      "${srcdir}/build/autoconf/altoptions.m4" \
3884      "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3885   . $tmpscript
3886   rm -f $tmpscript
3889 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3890 export MOZ_GLUE_WRAP_LDFLAGS
3892 dnl ========================================================
3893 dnl = Enable using the clang plugin to build
3894 dnl ========================================================
3896 if test -n "$COMPILE_ENVIRONMENT"; then
3897 MOZ_CONFIG_CLANG_PLUGIN
3898 fi # COMPILE_ENVIRONMENT
3900 dnl ========================================================
3901 dnl = Enable stripping of libs & executables
3902 dnl ========================================================
3903 MOZ_ARG_ENABLE_BOOL(strip,
3904 [  --enable-strip          Enable stripping of libs & executables ],
3905     ENABLE_STRIP=1,
3906     ENABLE_STRIP= )
3908 dnl ========================================================
3909 dnl = Enable stripping of libs & executables when packaging
3910 dnl ========================================================
3911 MOZ_ARG_ENABLE_BOOL(install-strip,
3912 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
3913     PKG_SKIP_STRIP= ,
3914     PKG_SKIP_STRIP=1)
3916 dnl ========================================================
3917 dnl = --disable-elf-hack
3918 dnl ========================================================
3920 USE_ELF_HACK=1
3921 MOZ_ARG_DISABLE_BOOL(elf-hack,
3922 [  --disable-elf-hack      Disable elf hacks],
3923     [USE_ELF_HACK=],
3924     [USE_ELF_HACK=1])
3926 # Only enable elfhack where supported
3927 if test "$USE_ELF_HACK" = 1; then
3928     case "${HOST_OS_ARCH},${OS_ARCH}" in
3929     Linux,Linux)
3930         case "${CPU_ARCH}" in
3931         arm | x86 | x86_64)
3932             USE_ELF_HACK=1
3933             ;;
3934         *)
3935             USE_ELF_HACK=
3936             ;;
3937         esac
3938         ;;
3939     *)
3940         USE_ELF_HACK=
3941         ;;
3942     esac
3945 dnl ========================================================
3946 dnl = libstdc++ compatibility hacks
3947 dnl ========================================================
3949 STDCXX_COMPAT=
3950 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
3951 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
3952     STDCXX_COMPAT=1)
3954 if test -n "$STDCXX_COMPAT" -a -n "$COMPILE_ENVIRONMENT"; then
3955    eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
3956    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
3957    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
3958    CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
3959    HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
3962 dnl ========================================================
3963 dnl = frontend JS debug mode
3964 dnl ========================================================
3966 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3967 [  --enable-debug-js-modules  Enable debug mode for frontend JS libraries],
3968    DEBUG_JS_MODULES=1,
3969    DEBUG_JS_MODULES=)
3971 AC_SUBST(DEBUG_JS_MODULES)
3973 dnl ========================================================
3974 dnl =
3975 dnl = Profiling and Instrumenting
3976 dnl =
3977 dnl ========================================================
3978 MOZ_ARG_HEADER(Profiling and Instrumenting)
3980 dnl ========================================================
3981 dnl = Enable TaskTracer
3982 dnl ========================================================
3983 MOZ_ARG_ENABLE_BOOL(tasktracer,
3984 [  --enable-tasktracer       Set compile flags necessary for using TaskTracer],
3985     MOZ_TASK_TRACER=1,
3986     MOZ_TASK_TRACER= )
3987 if test -n "$MOZ_TASK_TRACER"; then
3988     AC_DEFINE(MOZ_TASK_TRACER)
3989     AC_SUBST(MOZ_TASK_TRACER)
3992 dnl ========================================================
3993 dnl Turn on reflow counting
3994 dnl ========================================================
3995 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3996 [  --enable-reflow-perf    Enable reflow performance tracing],
3997     MOZ_REFLOW_PERF=1,
3998     MOZ_REFLOW_PERF= )
3999 if test -n "$MOZ_REFLOW_PERF"; then
4000     AC_DEFINE(MOZ_REFLOW_PERF)
4003 dnl ========================================================
4004 dnl = Horizon build options - set default preferences for
4005 dnl   the horizon project. Horizon is a browser built on
4006 dnl   top of the graphene runtime.
4007 dnl ========================================================
4008 if test -n "$MOZ_HORIZON"; then
4009     AC_DEFINE(MOZ_HORIZON)
4011 AC_SUBST(MOZ_HORIZON)
4013 dnl ========================================================
4014 dnl = Offer a way to disable the startup cache
4015 dnl ========================================================
4017 MOZ_ARG_DISABLE_BOOL(startupcache,
4018 [  --disable-startupcache          Disable startup cache ],
4019     MOZ_DISABLE_STARTUPCACHE=1,
4020     MOZ_DISABLE_STARTUPCACHE=)
4022 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
4023   AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
4025 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
4027 dnl ========================================================
4028 dnl = Enable Pico Speech Synthesis
4029 dnl ========================================================
4030 MOZ_ARG_ENABLE_BOOL(synth-pico,
4031 [  --enable-synth-pico  Set compile flags necessary for compiling Pico Web Speech API ],
4032     MOZ_SYNTH_PICO=1,
4033     MOZ_SYNTH_PICO= )
4034 if test -n "$MOZ_SYNTH_PICO"; then
4035     AC_DEFINE(MOZ_SYNTH_PICO)
4037 AC_SUBST(MOZ_SYNTH_PICO)
4039 dnl ========================================================
4040 dnl = Enable Support for Time Manager API
4041 dnl ========================================================
4042 if test -n "$MOZ_TIME_MANAGER"; then
4043     AC_DEFINE(MOZ_TIME_MANAGER)
4045 AC_SUBST(MOZ_TIME_MANAGER)
4047 dnl ========================================================
4048 dnl = Enable Support for Secure Element API
4049 dnl ========================================================
4050    MOZ_SECUREELEMENT=1,
4051 if test -n "$MOZ_SECUREELEMENT"; then
4052    AC_DEFINE(MOZ_SECUREELEMENT)
4054  AC_SUBST(MOZ_SECUREELEMENT)
4056 dnl ========================================================
4057 dnl = Support for demangling undefined symbols
4058 dnl ========================================================
4059 if test -z "$SKIP_LIBRARY_CHECKS"; then
4060     AC_LANG_SAVE
4061     AC_LANG_CPLUSPLUS
4062     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4063     AC_LANG_RESTORE
4066 # Demangle only for debug or DMD builds
4067 MOZ_DEMANGLE_SYMBOLS=
4068 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
4069     MOZ_DEMANGLE_SYMBOLS=1
4070     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4072 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4074 dnl ========================================================
4075 dnl = Support for gcc stack unwinding (from gcc 3.3)
4076 dnl ========================================================
4077 if test -z "$SKIP_LIBRARY_CHECKS"; then
4078     AC_LANG_SAVE
4079     AC_LANG_CPLUSPLUS
4080     MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4081     AC_LANG_RESTORE
4084 dnl ========================================================
4085 dnl JIT observers
4086 dnl ========================================================
4088 MOZ_ARG_WITH_STRING(jitreport-granularity,
4089 [  --jitreport-granularity=N
4090                            Default granularity at which to report JIT code
4091                            to external tools
4092                              0 - no info
4093                              1 - code ranges for whole functions only
4094                              2 - per-line information
4095                              3 - per-op information],
4096   JITREPORT_GRANULARITY=$withval,
4097   JITREPORT_GRANULARITY=3)
4099 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
4101 dnl ========================================================
4102 dnl =
4103 dnl = Misc. Options
4104 dnl =
4105 dnl ========================================================
4106 MOZ_ARG_HEADER(Misc. Options)
4108 dnl ========================================================
4109 dnl = Define default location for MOZILLA_FIVE_HOME
4110 dnl ========================================================
4111 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
4112 [  --with-default-mozilla-five-home
4113                           Set the default value for MOZILLA_FIVE_HOME],
4114 [ val=`echo $withval`
4115   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
4117 dnl ========================================================
4118 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
4119 dnl ========================================================
4120 MOZ_ARG_WITH_STRING(user-appdir,
4121 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
4122 [ val=`echo $withval`
4123 if echo "$val" | grep "\/" >/dev/null; then
4124     AC_MSG_ERROR("Homedir must be single relative path.")
4125 else
4126     MOZ_USER_DIR="$val"
4127 fi])
4129 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
4131 dnl ========================================================
4132 dnl = Doxygen configuration
4133 dnl ========================================================
4134 dnl Use commas to specify multiple dirs to this arg
4135 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
4136 MOZ_ARG_WITH_STRING(doc-input-dirs,
4137 [  --with-doc-input-dirs=DIRS
4138                           Header/idl dirs to create docs from],
4139 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4140 AC_SUBST(MOZ_DOC_INPUT_DIRS)
4142 dnl Use commas to specify multiple dirs to this arg
4143 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
4144 MOZ_ARG_WITH_STRING(doc-include-dirs,
4145 [  --with-doc-include-dirs=DIRS
4146                           Include dirs to preprocess doc headers],
4147 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4148 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
4150 MOZ_DOC_OUTPUT_DIR='./dist/docs'
4151 MOZ_ARG_WITH_STRING(doc-output-dir,
4152 [  --with-doc-output-dir=DIR
4153                           Dir to generate docs into],
4154 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
4155 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
4157 if test -z "$SKIP_COMPILER_CHECKS"; then
4158 dnl ========================================================
4159 dnl =
4160 dnl = Compiler Options
4161 dnl =
4162 dnl ========================================================
4163 MOZ_ARG_HEADER(Compiler Options)
4165 dnl ========================================================
4166 dnl Check for gcc -pipe support
4167 dnl ========================================================
4168 AC_MSG_CHECKING([for -pipe support])
4169 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
4170     dnl Any gcc that supports firefox supports -pipe.
4171     CFLAGS="$CFLAGS -pipe"
4172     CXXFLAGS="$CXXFLAGS -pipe"
4173     AC_MSG_RESULT([yes])
4174 else
4175     AC_MSG_RESULT([no])
4178 fi # ! SKIP_COMPILER_CHECKS
4180 AC_DEFINE(CPP_THROW_NEW, [throw()])
4181 AC_LANG_C
4183 if test "$COMPILE_ENVIRONMENT"; then
4184 MOZ_EXPAND_LIBS
4185 fi # COMPILE_ENVIRONMENT
4187 dnl ========================================================
4188 dnl =
4189 dnl = Build depencency options
4190 dnl =
4191 dnl ========================================================
4192 MOZ_ARG_HEADER(Build dependencies)
4194 if test "$GNU_CC" -a "$GNU_CXX"; then
4195   _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
4196 else
4197   dnl Don't override this for MSVC
4198   if test -z "$_WIN32_MSVC"; then
4199     _USE_CPP_INCLUDE_FLAG=
4200     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4201     _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4202   else
4203     echo '#include <stdio.h>' > dummy-hello.c
4204     changequote(,)
4205     dnl This output is localized, split at the first double space or colon and space.
4206     _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
4207     CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
4208     _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
4209     changequote([,])
4210     if ! test -e "$_CL_STDIO_PATH"; then
4211         AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
4212     fi
4213     if test -z "$CL_INCLUDES_PREFIX"; then
4214         AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
4215     fi
4216     AC_SUBST(CL_INCLUDES_PREFIX)
4217     rm -f dummy-hello.c
4219     dnl Make sure that the build system can handle non-ASCII characters
4220     dnl in environment variables to prevent it from breaking silently on
4221     dnl non-English systems.
4222     NONASCII=$'\241\241'
4223     AC_SUBST(NONASCII)
4224   fi
4227 dnl ========================================================
4228 dnl =
4229 dnl = Static Build Options
4230 dnl =
4231 dnl ========================================================
4232 MOZ_ARG_HEADER(Static build options)
4234 if test -z "$MOZ_SYSTEM_ZLIB"; then
4235 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
4236   ZLIB_IN_MOZGLUE=1
4237   AC_DEFINE(ZLIB_IN_MOZGLUE)
4241 AC_SUBST(ZLIB_IN_MOZGLUE)
4243 dnl ========================================================
4244 dnl =
4245 dnl = Standalone module options
4246 dnl =
4247 dnl ========================================================
4248 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4250 dnl Check for GLib.
4251 dnl ========================================================
4253 if test -z "$SKIP_PATH_CHECKS"; then
4254 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
4255     if test "$MOZ_ENABLE_GTK" ; then
4256         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
4257     fi
4261 if test -z "${GLIB_GMODULE_LIBS}" \
4262    -a -n "${GLIB_CONFIG}"\
4263     -a "${GLIB_CONFIG}" != no\
4264 ; then
4265     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
4268 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
4270 if test "$USE_FC_FREETYPE"; then
4271     if test "$COMPILE_ENVIRONMENT"; then
4272         dnl ========================================================
4273         dnl = Check for freetype2 functionality
4274         dnl ========================================================
4275         if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
4276             _SAVE_LIBS="$LIBS"
4277             _SAVE_CFLAGS="$CFLAGS"
4278             LIBS="$LIBS $FT2_LIBS"
4279             CFLAGS="$CFLAGS $FT2_CFLAGS"
4281             AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
4282                 ac_cv_member_FT_Bitmap_Size_y_ppem,
4283                 [AC_TRY_COMPILE([#include <ft2build.h>
4284                                  #include FT_FREETYPE_H],
4285                                 [FT_Bitmap_Size s;
4286                                  if (sizeof s.y_ppem) return 0;
4287                                  return 1],
4288                                 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
4289                                 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
4290             if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
4291                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
4292             else
4293                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
4294             fi
4295             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
4296                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
4297                                [FT_Bitmap_Size structure includes y_ppem field])
4299             AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
4301             LIBS="$_SAVE_LIBS"
4302             CFLAGS="$_SAVE_CFLAGS"
4303         fi
4305         _SAVE_CPPFLAGS="$CPPFLAGS"
4306         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
4307         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
4308             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
4309         CPPFLAGS="$_SAVE_CPPFLAGS"
4310     fi
4313 dnl ========================================================
4314 dnl Check if we need the 32-bit Linux SSE2 error dialog
4315 dnl ========================================================
4317 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
4319 dnl ========================================================
4320 dnl Check for pixman and cairo
4321 dnl ========================================================
4323 MOZ_TREE_CAIRO=1
4324 MOZ_ARG_ENABLE_BOOL(system-cairo,
4325 [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
4326 MOZ_TREE_CAIRO=,
4327 MOZ_TREE_CAIRO=1 )
4329 MOZ_TREE_PIXMAN=1
4330 MOZ_ARG_ENABLE_BOOL(system-pixman,
4331 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
4332 MOZ_TREE_PIXMAN=,
4333 MOZ_TREE_PIXMAN=force,
4334 MOZ_TREE_PIXMAN=1 )
4336 # System cairo depends on system pixman
4337 if test "$MOZ_TREE_PIXMAN" = "force"; then
4338     if test -z "$MOZ_TREE_CAIRO"; then
4339         AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
4340     else
4341         MOZ_TREE_PIXMAN=1
4342     fi
4343 elif test -z "$MOZ_TREE_CAIRO"; then
4344     MOZ_TREE_PIXMAN=
4347 if test "$MOZ_TREE_PIXMAN"; then
4348     AC_DEFINE(MOZ_TREE_PIXMAN)
4349 else
4350     PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
4353 if test "$MOZ_TREE_CAIRO"; then
4354     MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
4355     AC_DEFINE(MOZ_TREE_CAIRO)
4357     if test "$OS_ARCH" = "WINNT"; then
4358         # For now we assume that we will have a uint64_t available through
4359         # one of the above headers or mozstdint.h.
4360         AC_DEFINE(HAVE_UINT64_T)
4361     fi
4363     # Define macros for cairo-features.h
4364     TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
4365     if test "$MOZ_X11"; then
4366         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
4367         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
4368         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
4369     fi
4370     if test "$_HAVE_FREETYPE2"; then
4371         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
4372         MOZ_ENABLE_CAIRO_FT=1
4373         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
4374     fi
4376     case "$MOZ_WIDGET_TOOLKIT" in
4377       cocoa | uikit)
4378         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
4379         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
4380         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
4381         ;;
4382       windows)
4383         WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
4384         WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
4385         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
4386         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
4387         MOZ_ENABLE_D2D_SURFACE=1
4389         if test "$COMPILE_ENVIRONMENT"; then
4391           dnl D3D10 Layers depend on D2D Surfaces.
4392           if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
4393             MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
4394           fi
4395         fi
4396         ;;
4397     esac
4398     if test "$USE_FC_FREETYPE"; then
4399         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
4400     fi
4401     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
4402     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
4403     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
4405     AC_SUBST(PS_SURFACE_FEATURE)
4406     AC_SUBST(SVG_SURFACE_FEATURE)
4407     AC_SUBST(XLIB_SURFACE_FEATURE)
4408     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
4409     AC_SUBST(QUARTZ_SURFACE_FEATURE)
4410     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
4411     AC_SUBST(WIN32_SURFACE_FEATURE)
4412     AC_SUBST(OS2_SURFACE_FEATURE)
4413     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
4414     AC_SUBST(FT_FONT_FEATURE)
4415     AC_SUBST(FC_FONT_FEATURE)
4416     AC_SUBST(WIN32_FONT_FEATURE)
4417     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
4418     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
4419     AC_SUBST(QUARTZ_FONT_FEATURE)
4420     AC_SUBST(PNG_FUNCTIONS_FEATURE)
4421     AC_SUBST(QT_SURFACE_FEATURE)
4422     AC_SUBST(TEE_SURFACE_FEATURE)
4424     if test "$MOZ_X11"; then
4425         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
4426     fi
4428     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
4429 else
4430     PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
4431     MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
4432     MOZ_CAIRO_LIBS="$CAIRO_LIBS"
4433     PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
4434     if test "$MOZ_X11"; then
4435         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
4436         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
4437         MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
4438         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
4439     fi
4442 case "$MOZ_WIDGET_TOOLKIT" in
4443 android)
4444     TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
4445     TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
4446     ;;
4447 esac
4449 AC_SUBST(MOZ_TREE_CAIRO)
4450 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
4451 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
4452 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
4453 AC_SUBST(MOZ_TREE_PIXMAN)
4455 dnl ========================================================
4456 dnl disable xul
4457 dnl ========================================================
4458 MOZ_ARG_DISABLE_BOOL(xul,
4459 [  --disable-xul           Disable XUL],
4460     MOZ_XUL= )
4461 if test "$MOZ_XUL"; then
4462   AC_DEFINE(MOZ_XUL)
4463 else
4464   dnl remove extensions that require XUL
4465   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4468 AC_SUBST(MOZ_XUL)
4470 dnl ========================================================
4471 dnl necko configuration options
4472 dnl ========================================================
4475 dnl option to disable necko's wifi scanner
4478 case "$OS_TARGET" in
4479   Darwin)
4480     if test -z "$MOZ_IOS"; then
4481       NECKO_WIFI=1
4482     fi
4483     ;;
4484   DragonFly|FreeBSD|WINNT)
4485     NECKO_WIFI=1
4486     ;;
4487   Linux)
4488     NECKO_WIFI=1
4489     NECKO_WIFI_DBUS=1
4490     ;;
4491 esac
4493 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4494 [  --disable-necko-wifi    Disable necko wifi scanner],
4495     NECKO_WIFI=,
4496     NECKO_WIFI=1)
4498 if test "$NECKO_WIFI"; then
4499   if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4500     AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4501   fi
4502   AC_DEFINE(NECKO_WIFI)
4503   _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4505 AC_SUBST(NECKO_WIFI)
4506 AC_SUBST(NECKO_WIFI_DBUS)
4509 dnl option to disable cookies
4511 MOZ_ARG_DISABLE_BOOL(cookies,
4512 [  --disable-cookies       Disable cookie support],
4513     NECKO_COOKIES=,
4514     NECKO_COOKIES=1)
4515 AC_SUBST(NECKO_COOKIES)
4516 if test "$NECKO_COOKIES"; then
4517     AC_DEFINE(NECKO_COOKIES)
4518     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4521 dnl ========================================================
4522 dnl =
4523 dnl = Maintainer debug option (no --enable equivalent)
4524 dnl =
4525 dnl ========================================================
4527 AC_SUBST(AR)
4528 AC_SUBST(AR_FLAGS)
4529 AC_SUBST(AR_EXTRACT)
4530 AC_SUBST(AS)
4531 AC_SUBST(ASFLAGS)
4532 AC_SUBST(AS_DASH_C_FLAG)
4533 AC_SUBST(RC)
4534 AC_SUBST(RCFLAGS)
4535 AC_SUBST(WINDRES)
4536 AC_SUBST(IMPLIB)
4537 AC_SUBST(FILTER)
4538 AC_SUBST(BIN_FLAGS)
4539 AC_SUBST(MOZ_AUTH_EXTENSION)
4540 AC_SUBST(MOZ_PREF_EXTENSIONS)
4541 AC_SUBST(MOZ_DEBUG)
4542 AC_SUBST(MOZ_DEBUG_LDFLAGS)
4543 AC_SUBST(WARNINGS_AS_ERRORS)
4544 AC_SUBST_SET(MOZ_EXTENSIONS)
4545 AC_SUBST(LIBICONV)
4546 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4547 AC_SUBST(MOZ_FEEDS)
4549 AC_SUBST(MOZ_UNIVERSALCHARDET)
4550 AC_SUBST(ACCESSIBILITY)
4551 AC_SUBST(MOZ_SPELLCHECK)
4552 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4553 AC_SUBST(MOZ_CRASHREPORTER)
4554 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4555 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4556 AC_SUBST(MOZ_STUB_INSTALLER)
4557 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4558 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4559 AC_SUBST(MOZ_UPDATER)
4561 AC_SUBST(MOZ_ANGLE_RENDERER)
4562 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4563 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4564 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4565 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4567 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4568 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4569 AC_SUBST(MOZ_ANDROID_SEARCH_INTENT_CLASS)
4570 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4571 AC_SUBST(ENABLE_STRIP)
4572 AC_SUBST(PKG_SKIP_STRIP)
4573 AC_SUBST(STRIP_FLAGS)
4574 AC_SUBST(USE_ELF_HACK)
4575 AC_SUBST(INCREMENTAL_LINKER)
4577 AC_SUBST(MOZ_FIX_LINK_PATHS)
4579 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4580 AC_SUBST(MOZ_LINKER_EXTRACT)
4582 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4583   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4586 AC_SUBST(MOZ_ADDON_SIGNING)
4587 if test "$MOZ_ADDON_SIGNING" = 1; then
4588   AC_DEFINE(MOZ_ADDON_SIGNING)
4590 AC_SUBST(MOZ_REQUIRE_SIGNING)
4591 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4592   AC_DEFINE(MOZ_REQUIRE_SIGNING)
4595 dnl ========================================================
4596 dnl = Mac bundle name prefix
4597 dnl ========================================================
4598 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4599 [  --with-macbundlename-prefix=prefix
4600                           Prefix for MOZ_MACBUNDLE_NAME],
4601 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4603 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
4604 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4605   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4608 if test "$MOZ_DEBUG"; then
4609   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
4610 else
4611   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4613 AC_SUBST(MOZ_MACBUNDLE_NAME)
4615 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4616 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
4617 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4618 if test "$MOZ_DEBUG"; then
4619   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4622 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4623 AC_SUBST(MOZ_MACBUNDLE_ID)
4625 dnl ========================================================
4626 dnl = Child Process Name for IPC
4627 dnl ========================================================
4628 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4629   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4630 else
4631   # We want to let Android unpack the file at install time, but it only does
4632   # so if the file is named libsomething.so. The lib/ path is also required
4633   # because the unpacked file will be under the lib/ subdirectory and will
4634   # need to be executed from that path.
4635   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4636   MOZ_CHILD_PROCESS_NAME_PIE="libplugin-container-pie.so"
4637   AC_SUBST(MOZ_CHILD_PROCESS_NAME_PIE)
4639 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4640 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4642 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4643 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4644 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4646 # The following variables are available to branding and application
4647 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4648 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4649 # impacts profile location and user-visible fields.
4650 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4651 # versions of a given application (e.g. Aurora and Firefox both use
4652 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4653 # for application.ini's "Name" field, which controls profile location in
4654 # the absence of a "Profile" field (see below), and various system
4655 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4656 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4657 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4658 # builds (e.g. Aurora for Firefox).
4659 # - MOZ_APP_VERSION: Defines the application version number.
4660 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4661 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4662 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4663 # defaults to a lowercase form of MOZ_APP_BASENAME.
4664 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4665 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4666 # - MOZ_APP_PROFILE: When set, used for application.ini's
4667 # "Profile" field, which controls profile location.
4668 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4669 # crash reporter server url.
4670 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4671 # the main application is set to the value of this variable.  If not
4672 # set, it falls back to a Mozilla-specific value derived from the
4673 # build ID.
4674 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4675 # packages produced.
4676 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used.  GCM
4677 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4678 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4679 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4681 if test -z "$MOZ_APP_NAME"; then
4682    MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4685 if test -z "$MOZ_APP_REMOTINGNAME"; then
4686    MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4689 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4690    MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4693 if test -z "$ANDROID_PACKAGE_NAME" ; then
4694    # When we got rid of the Aurora channel we decided to replace the old
4695    # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4696    # by all mozilla-central based branches we make this the new "default"
4697    # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4698    # in their mozconfig, so they will never get this. If there are ever
4699    # non-Fennec builds for Android, they will fall into the else block
4700    # and use their own default name.
4701    # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4702    # background on this.
4703    if test "$MOZ_APP_NAME" = "fennec"; then
4704       ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4705    else
4706       ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4707    fi
4710 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4711 # the public with specific common shared IDs and we need to keep them
4712 # consistent forever.  The specific common values are set by per-channel
4713 # branding; all other channels use a generic sharedID, set below.
4714 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4715    MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4718 # For extensions and langpacks, we require a max version that is compatible
4719 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4720 # 24.0a1 and 24.0a2 aren't affected
4721 # 24.0 becomes 24.*
4722 # 24.1.1 becomes 24.*
4723 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4724 if test -z "$IS_ALPHA"; then
4725   changequote(,)
4726   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4727     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4728   else
4729     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4730   fi
4731   changequote([,])
4732 else
4733   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4736 AC_SUBST(MOZ_APP_NAME)
4737 AC_SUBST(MOZ_APP_REMOTINGNAME)
4738 AC_SUBST(MOZ_APP_DISPLAYNAME)
4739 AC_SUBST(MOZ_APP_BASENAME)
4740 AC_SUBST(MOZ_APP_VENDOR)
4741 AC_SUBST(MOZ_APP_PROFILE)
4742 AC_SUBST(MOZ_APP_ID)
4743 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4744 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4745 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4746 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4747 AC_SUBST(MAR_CHANNEL_ID)
4748 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4749 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4750 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4751 AC_SUBST(MOZ_APP_UA_NAME)
4752 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4753 AC_SUBST(MOZ_APP_VERSION)
4754 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4755 AC_SUBST(MOZ_APP_MAXVERSION)
4756 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4757 AC_SUBST(FIREFOX_VERSION)
4758 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4759 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4760   AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4763 AC_SUBST(MOZ_PKG_SPECIAL)
4764 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4766 if test "$MOZILLA_OFFICIAL"; then
4767     # Build revisions should always be present in official builds
4768     MOZ_INCLUDE_SOURCE_INFO=1
4771 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4772 # explicitly set the repository and changeset information in.
4773 AC_SUBST(MOZ_SOURCE_REPO)
4774 AC_SUBST(MOZ_SOURCE_CHANGESET)
4775 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4777 if test "$MOZ_TELEMETRY_REPORTING"; then
4778     AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4780     # Enable Telemetry by default for nightly and aurora channels
4781     if test -z "$RELEASE_OR_BETA"; then
4782       AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4783     fi
4786 dnl If we have any service that uploads data (and requires data submission
4787 dnl policy alert), set MOZ_DATA_REPORTING.
4788 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4789 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4790   MOZ_DATA_REPORTING=1
4791   AC_DEFINE(MOZ_DATA_REPORTING)
4792   AC_SUBST(MOZ_DATA_REPORTING)
4795 dnl win32 options
4796 AC_SUBST(WIN32_REDIST_DIR)
4797 AC_SUBST(WIN_UCRT_REDIST_DIR)
4799 dnl ========================================================
4800 dnl ICU Support
4801 dnl ========================================================
4803 _INTL_API=yes
4805 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4806     USE_ICU=1
4809 MOZ_CONFIG_ICU()
4811 dnl Echo the CFLAGS to remove extra whitespace.
4812 CFLAGS=`echo \
4813     $_WARNINGS_CFLAGS \
4814     $CFLAGS`
4816 CXXFLAGS=`echo \
4817     $_WARNINGS_CXXFLAGS \
4818     $CXXFLAGS`
4820 COMPILE_CFLAGS=`echo \
4821     $_DEFINES_CFLAGS \
4822     $COMPILE_CFLAGS`
4824 COMPILE_CXXFLAGS=`echo \
4825     $_DEFINES_CXXFLAGS \
4826     $COMPILE_CXXFLAGS`
4828 HOST_CFLAGS=`echo \
4829     $HOST_CFLAGS`
4831 HOST_CXXFLAGS=`echo \
4832     $HOST_CXXFLAGS`
4834 AC_SUBST(_DEPEND_CFLAGS)
4835 AC_SUBST(MOZ_SYSTEM_JPEG)
4836 AC_SUBST(MOZ_SYSTEM_PNG)
4837 AC_SUBST(MOZ_SYSTEM_BZ2)
4839 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4840 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4841 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
4842 AC_SUBST_LIST(MOZ_BZ2_LIBS)
4843 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4844 AC_SUBST_LIST(MOZ_PNG_LIBS)
4846 AC_SUBST(MOZ_SYSTEM_NSPR)
4848 AC_SUBST(MOZ_SYSTEM_NSS)
4850 HOST_CMFLAGS=-fobjc-exceptions
4851 HOST_CMMFLAGS=-fobjc-exceptions
4852 OS_COMPILE_CMFLAGS=-fobjc-exceptions
4853 OS_COMPILE_CMMFLAGS=-fobjc-exceptions
4854 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4855   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4856   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4858 AC_SUBST(HOST_CMFLAGS)
4859 AC_SUBST(HOST_CMMFLAGS)
4860 AC_SUBST(OS_COMPILE_CMFLAGS)
4861 AC_SUBST(OS_COMPILE_CMMFLAGS)
4863 OS_CFLAGS="$CFLAGS"
4864 OS_CXXFLAGS="$CXXFLAGS"
4865 OS_CPPFLAGS="$CPPFLAGS"
4866 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4867 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4868 OS_LDFLAGS="$LDFLAGS"
4869 OS_LIBS="$LIBS"
4870 AC_SUBST(OS_CFLAGS)
4871 AC_SUBST(OS_CXXFLAGS)
4872 AC_SUBST(OS_CPPFLAGS)
4873 AC_SUBST(OS_COMPILE_CFLAGS)
4874 AC_SUBST(OS_COMPILE_CXXFLAGS)
4875 AC_SUBST(OS_LDFLAGS)
4876 AC_SUBST(OS_LIBS)
4878 AC_SUBST(HOST_CC)
4879 AC_SUBST(HOST_CXX)
4880 AC_SUBST(HOST_CFLAGS)
4881 AC_SUBST(HOST_CPPFLAGS)
4882 AC_SUBST(HOST_CXXFLAGS)
4883 AC_SUBST(HOST_LDFLAGS)
4884 AC_SUBST(HOST_OPTIMIZE_FLAGS)
4885 AC_SUBST(HOST_AR)
4886 AC_SUBST(HOST_AR_FLAGS)
4887 AC_SUBST(HOST_RANLIB)
4888 AC_SUBST(HOST_BIN_SUFFIX)
4890 AC_SUBST(TARGET_XPCOM_ABI)
4891 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4892 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4893 AC_SUBST(HAVE_X86_AVX2)
4894 AC_SUBST(HAVE_ALTIVEC)
4895 AC_SUBST(GCC_USE_GNU_LD)
4897 AC_SUBST(WRAP_LDFLAGS)
4898 AC_SUBST(MKSHLIB)
4899 AC_SUBST(MKCSHLIB)
4900 AC_SUBST(DSO_CFLAGS)
4901 AC_SUBST(DSO_PIC_CFLAGS)
4902 AC_SUBST(DSO_LDOPTS)
4903 AC_SUBST(BIN_SUFFIX)
4904 AC_SUBST(USE_N32)
4905 AC_SUBST(CC_VERSION)
4906 AC_SUBST(NS_ENABLE_TSF)
4907 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4908 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4910 AC_SUBST(MOZ_VORBIS)
4911 AC_SUBST(MOZ_TREMOR)
4912 AC_SUBST(MOZ_FFVPX)
4913 AC_SUBST_LIST(FFVPX_ASFLAGS)
4914 AC_SUBST(VPX_USE_YASM)
4915 AC_SUBST_LIST(VPX_ASFLAGS)
4916 AC_SUBST(VPX_AS_CONVERSION)
4917 AC_SUBST(VPX_X86_ASM)
4918 AC_SUBST(VPX_ARM_ASM)
4919 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4920 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4921 AC_SUBST(MOZ_LIBAV_FFT)
4922 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4923 AC_SUBST(MOZ_DEVTOOLS)
4925 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4926 AC_SUBST(MOZ_FOLD_LIBS)
4927 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4928 AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
4930 AC_SUBST(DMG_TOOL)
4932 dnl Host JavaScript runtime, if any, to use during cross compiles.
4933 AC_SUBST(JS_BINARY)
4935 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4937 if test -n "$COMPILE_ENVIRONMENT"; then
4938 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4940 dnl Check for missing components
4941 if test "$MOZ_X11"; then
4942     dnl ====================================================
4943     dnl = Check if X headers exist
4944     dnl ====================================================
4945     _SAVE_CFLAGS=$CFLAGS
4946     CFLAGS="$CFLAGS $XCFLAGS"
4947     AC_TRY_COMPILE([
4948         #include <stdio.h>
4949         #include <stdlib.h>
4950         #include <X11/Xlib.h>
4951         #include <X11/Intrinsic.h>
4952         #include <X11/extensions/XShm.h>
4953     ],
4954     [
4955         Display *dpy = 0;
4956         if ((dpy = XOpenDisplay(NULL)) == NULL) {
4957             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4958             exit(1);
4959         }
4960     ], [],
4961     [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4962     CFLAGS="$_SAVE_CFLAGS"
4964     if test -n "$MISSING_X"; then
4965         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4966     fi
4968 fi # MOZ_X11
4970 fi # COMPILE_ENVIRONMENT
4972 dnl Set various defines and substitutions
4973 dnl ========================================================
4975 if test "$MOZ_DEBUG"; then
4976     AC_DEFINE(MOZ_REFLOW_PERF)
4977     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4980 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4981     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4982     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4983     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4984     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4985     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4986     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4987     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4988     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4991 AC_SUBST(MOZ_DEV_EDITION)
4992 if test -n "$MOZ_DEV_EDITION"; then
4993     AC_DEFINE(MOZ_DEV_EDITION)
4996 if test "$MOZ_DEBUG"; then
4997     A11Y_LOG=1
4999 case "$MOZ_UPDATE_CHANNEL" in
5000 aurora|beta|release|esr)
5001     ;;
5003     A11Y_LOG=1
5004     ;;
5005 esac
5006 AC_SUBST(A11Y_LOG)
5007 if test -n "$A11Y_LOG"; then
5008     AC_DEFINE(A11Y_LOG)
5011 AC_SUBST(MOZILLA_VERSION)
5013 dnl Spit out some output
5014 dnl ========================================================
5016 dnl The following defines are used by xpcom
5017 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
5018 CPP_THROW_NEW
5019 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
5020 HAVE_CPP_PARTIAL_SPECIALIZATION
5021 HAVE_GETPAGESIZE
5022 HAVE_ICONV
5023 HAVE_ICONV_WITH_CONST_INPUT
5024 HAVE_MBRTOWC
5025 HAVE_WCRTOMB
5026 HAVE_STATVFS64
5027 HAVE_STATVFS
5028 HAVE_STATFS64
5029 HAVE_STATFS
5030 HAVE_SYS_STATVFS_H
5031 HAVE_SYS_STATFS_H
5032 HAVE_SYS_VFS_H
5033 HAVE_SYS_MOUNT_H
5036 dnl ========================================================
5037 dnl Determine options to use for running the preprocessor.
5038 dnl ========================================================
5040 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
5041     PREPROCESS_OPTION="-P -Fi"
5042 else
5043     PREPROCESS_OPTION="-E -o "
5046 AC_SUBST(PREPROCESS_OPTION)
5048 dnl ========================================================
5049 dnl mask as shorthand property
5050 dnl ========================================================
5052 # The control structure code will be removed as soon as the feature is stable
5053 # Refer to bug 1281101 for more details.
5054 MOZ_ENABLE_MASK_AS_SHORTHAND=1
5055 AC_DEFINE(MOZ_ENABLE_MASK_AS_SHORTHAND)
5056 AC_SUBST(MOZ_ENABLE_MASK_AS_SHORTHAND)
5058 # Avoid using obsolete NSPR features
5059 AC_DEFINE(NO_NSPR_10_SUPPORT)
5061 # Don't build NSS libpkix
5062 NSS_DISABLE_LIBPKIX=1
5063 AC_SUBST(NSS_DISABLE_LIBPKIX)
5065 MOZ_CREATE_CONFIG_STATUS()
5067 if test -z "$direct_nspr_config"; then
5068     dnl ========================================================
5069     dnl = Setup a nice relatively clean build environment for
5070     dnl = sub-configures.
5071     dnl ========================================================
5072     CC="$_SUBDIR_CC"
5073     CXX="$_SUBDIR_CXX"
5074     CFLAGS="$_SUBDIR_CFLAGS"
5075     CPPFLAGS="$_SUBDIR_CPPFLAGS"
5076     CXXFLAGS="$_SUBDIR_CXXFLAGS"
5077     LDFLAGS="$_SUBDIR_LDFLAGS"
5078     HOST_CC="$_SUBDIR_HOST_CC"
5079     HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5080     HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5081     HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5082     RC=
5085 unset MAKEFILES
5086 unset CONFIG_FILES
5088 # Run all configure scripts specified by a subconfigure
5089 if test -n "$_subconfigure_subdir"; then
5090   _save_srcdir="$srcdir"
5091   srcdir="$srcdir/.."
5092   _save_ac_configure_args="$ac_configure_args"
5093   ac_configure_args="$_subconfigure_config_args"
5094   AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
5095   ac_configure_args="$_save_ac_configure_args"
5096   srcdir="$_save_srcdir"
5099 if test "$COMPILE_ENVIRONMENT"; then
5101 export WRAP_LDFLAGS
5103 dnl ========================================================
5104 dnl = Setup a nice relatively clean build environment for
5105 dnl = sub-configures.
5106 dnl ========================================================
5107 CC="$_SUBDIR_CC"
5108 CXX="$_SUBDIR_CXX"
5109 CFLAGS="$_SUBDIR_CFLAGS"
5110 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5111 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5112 LDFLAGS="$_SUBDIR_LDFLAGS"
5113 HOST_CC="$_SUBDIR_HOST_CC"
5114 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5115 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5116 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5119 # Run the SpiderMonkey 'configure' script.
5120 dist=$MOZ_BUILD_ROOT/dist
5121 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5123 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
5124 # and $NSPR_LIBS.
5125 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
5127 if test "$_INTL_API" = no; then
5128     ac_configure_args="$ac_configure_args --without-intl-api"
5131 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
5132     ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
5133     ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
5135 ac_configure_args="$ac_configure_args --prefix=$dist"
5136 if test -n "$ZLIB_IN_MOZGLUE"; then
5137    MOZ_ZLIB_LIBS=
5139 export MOZ_SYSTEM_ZLIB
5140 export MOZ_ZLIB_CFLAGS
5141 export MOZ_ZLIB_LIBS
5142 export MOZ_APP_NAME
5143 export MOZ_APP_REMOTINGNAME
5144 export RUSTC
5145 export MOZILLA_CENTRAL_PATH=$_topsrcdir
5146 export STLPORT_CPPFLAGS
5147 export STLPORT_LIBS
5148 unset MOZ_BUILD_APP
5149 export DIST
5150 export MOZ_LINKER
5151 export ZLIB_IN_MOZGLUE
5152 export AR
5153 export RANLIB
5154 export CPP
5155 export CC
5156 export CXX
5157 export ARFLAGS
5158 export CPPFLAGS
5159 export CFLAGS
5160 export CXXFLAGS
5161 export LDFLAGS
5162 export HOST_CC
5163 export HOST_CXX
5164 export HOST_CFLAGS
5165 export HOST_CPPFLAGS
5166 export HOST_CXXFLAGS
5167 export HOST_LDFLAGS
5169 if ! test -e js; then
5170     mkdir js
5173 ac_configure_args="$ac_configure_args JS_STANDALONE="
5174 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
5175 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5177 fi # COMPILE_ENVIRONMENT
5179 dnl we need to run config.status after js/src subconfigure because we're
5180 dnl traversing its moz.build and we need its config.status for that.
5181 dnl However, writing our own config.status needs to happen before
5182 dnl subconfigures because the setup surrounding subconfigures alters
5183 dnl many AC_SUBSTed variables.
5184 MOZ_RUN_ALL_SUBCONFIGURES()
5186 rm -fr confdefs* $ac_clean_files