Bug 1777562 [wpt PR 34663] - [FedCM] Rename FederatedCredential to IdentityCredential...
[gecko.git] / old-configure.in
blob5ac38affc9d25691b6499ad87a37b7ab533d42c9
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
9 AC_PREREQ(2.13)
10 AC_INIT(config/config.mk)
11 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
12 AC_CANONICAL_SYSTEM
14 dnl ========================================================
15 dnl =
16 dnl = Don't change the following lines. Doing so breaks:
17 dnl =
18 dnl = CFLAGS="-foo" ./configure
19 dnl =
20 dnl ========================================================
21 CFLAGS="${CFLAGS=}"
22 CPPFLAGS="${CPPFLAGS=}"
23 CXXFLAGS="${CXXFLAGS=}"
24 LDFLAGS="${LDFLAGS=}"
25 HOST_CFLAGS="${HOST_CFLAGS=}"
26 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
27 HOST_LDFLAGS="${HOST_LDFLAGS=}"
29 dnl ========================================================
30 dnl = Preserve certain environment flags passed to configure
31 dnl = We want sub projects to receive the same flags
32 dnl = untainted by this configure script
33 dnl ========================================================
34 _SUBDIR_CC="$CC"
35 _SUBDIR_CXX="$CXX"
36 _SUBDIR_CFLAGS="$CFLAGS"
37 _SUBDIR_CPPFLAGS="$CPPFLAGS"
38 _SUBDIR_CXXFLAGS="$CXXFLAGS"
39 _SUBDIR_LDFLAGS="$LDFLAGS"
40 _SUBDIR_HOST_CC="$HOST_CC"
41 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
42 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
43 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
44 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
46 dnl Set the minimum version of toolkit libs used by mozilla
47 dnl ========================================================
48 W32API_VERSION=3.14
50 dnl Set various checks
51 dnl ========================================================
52 MISSING_X=
54 dnl Initialize the Pthread test variables early so they can be
55 dnl  overridden by each platform.
56 dnl ========================================================
57 MOZ_USE_PTHREADS=
58 _PTHREAD_LDFLAGS=""
60 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
62 if test "$COMPILE_ENVIRONMENT"; then
63     MOZ_ANDROID_NDK
64 fi # COMPILE_ENVIRONMENT
66 dnl ========================================================
67 dnl Checks for compilers.
68 dnl ========================================================
70 if test "$COMPILE_ENVIRONMENT"; then
72 # Run some logic to figure out exe extensions (mostly for mingw's sake)
73 AC_EXEEXT
75 if test "$target" != "$host"; then
76     MOZ_CROSS_COMPILER
77 else
78     AC_PROG_CC
79     case "$target" in
80     *-mingw*)
81       # Work around the conftest.exe access problem on Windows
82       sleep 2
83     esac
84     AC_PROG_CXX
85     AC_CHECK_PROGS(OTOOL, otool, :)
88 MOZ_TOOL_VARIABLES
90 dnl ========================================================
91 dnl Special win32 checks
92 dnl ========================================================
94 WINVER=601
96 case "$target" in
97 *-mingw*)
98     if test "$GCC" != "yes"; then
99         # Check to see if we are really running in a msvc environemnt
100         _WIN32_MSVC=1
102         # Make sure compilers are valid
103         CXXFLAGS="$CXXFLAGS -TP"
104         AC_LANG_SAVE
105         AC_LANG_C
106         AC_TRY_COMPILE([#include <stdio.h>],
107             [ printf("Hello World\n"); ],,
108             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
110         AC_LANG_CPLUSPLUS
111         AC_TRY_COMPILE([#include <new.h>],
112             [ unsigned *test = new unsigned(42); ],,
113             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
114         AC_LANG_RESTORE
116         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
117         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
118         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
120         MSVC_C_RUNTIME_DLL=vcruntime140.dll
121         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
123         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
124         CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
126         if test -n "$WIN_UCRT_REDIST_DIR"; then
127           if test ! -d "$WIN_UCRT_REDIST_DIR"; then
128             AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
129           fi
130           WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
131         fi
133         AC_SUBST(MSVC_C_RUNTIME_DLL)
134         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
136         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
138         if test -n "$WIN32_REDIST_DIR"; then
139           if test ! -d "$WIN32_REDIST_DIR"; then
140             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
141           fi
142           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
143         fi
145         WRAP_STL_INCLUDES=1
146         STL_FLAGS="-I${DIST}/stl_wrappers"
147     else
148         # Check w32api version
149         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
150         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
151         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
152         AC_TRY_COMPILE([#include <w32api.h>],
153             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
154                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
155                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
156                 #error "test failed."
157             #endif
158             , [ res=yes ], [ res=no ])
159         AC_MSG_RESULT([$res])
160         if test "$res" != "yes"; then
161             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
162         fi
163         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
164         # causing problems with local implementations with the same name.
165         AC_DEFINE(STRSAFE_NO_DEPRECATE)
166     fi # !GNU_CC
168     CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
169     CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
171     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
172     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
173     # Require OS features provided by IE 8.0 (Win7)
174     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
176     ;;
177 esac
179 if test -n "$_WIN32_MSVC"; then
180     SKIP_PATH_CHECKS=1
181     SKIP_COMPILER_CHECKS=1
182     SKIP_LIBRARY_CHECKS=1
184     # Since we're skipping compiler and library checks, hard-code
185     # some facts here.
186     AC_DEFINE(HAVE_IO_H)
187     AC_DEFINE(HAVE_ISATTY)
190 fi # COMPILE_ENVIRONMENT
192 AC_SUBST(GNU_CC)
193 AC_SUBST(GNU_CXX)
195 AC_SUBST_LIST(STL_FLAGS)
196 AC_SUBST(WRAP_STL_INCLUDES)
198 dnl ========================================================
199 dnl set the defaults first
200 dnl ========================================================
201 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
203 dnl Configure platform-specific CPU architecture compiler options.
204 dnl ==============================================================
205 if test "$COMPILE_ENVIRONMENT"; then
206     MOZ_ARCH_OPTS
207 fi # COMPILE_ENVIRONMENT
209 dnl ========================================================
210 dnl Android libstdc++
211 dnl ========================================================
213 if test "$COMPILE_ENVIRONMENT"; then
214     MOZ_ANDROID_STLPORT
215 fi # COMPILE_ENVIRONMENT
217 dnl ========================================================
218 dnl Suppress Clang Argument Warnings
219 dnl ========================================================
220 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
221 if test -n "${CLANG_CC}${CLANG_CL}"; then
222     WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
223     CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
225 if test -n "${CLANG_CXX}${CLANG_CL}"; then
226     _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
229 if test -n "$COMPILE_ENVIRONMENT"; then
230    MOZ_CONFIG_SANITIZE
233 dnl ========================================================
234 dnl GNU specific defaults
235 dnl ========================================================
236 if test "$GNU_CC"; then
237     if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
238         DSO_PIC_CFLAGS='-fPIC'
239         ASFLAGS="$ASFLAGS -fPIC"
240     fi
242     AC_MSG_CHECKING([for --noexecstack option to as])
243     _SAVE_CFLAGS=$CFLAGS
244     CFLAGS="$CFLAGS -Wa,--noexecstack"
245     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
246                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
247                      AC_MSG_RESULT([no]))
248     CFLAGS=$_SAVE_CFLAGS
249     AC_MSG_CHECKING([for -z noexecstack option to ld])
250     _SAVE_LDFLAGS=$LDFLAGS
251     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
252     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
253                   AC_MSG_RESULT([no])
254                   LDFLAGS=$_SAVE_LDFLAGS)
256     AC_MSG_CHECKING([for -z text option to ld])
257     _SAVE_LDFLAGS=$LDFLAGS
258     LDFLAGS="$LDFLAGS -Wl,-z,text"
259     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
260                   AC_MSG_RESULT([no])
261                   LDFLAGS=$_SAVE_LDFLAGS)
263     AC_MSG_CHECKING([for -z relro option to ld])
264     _SAVE_LDFLAGS=$LDFLAGS
265     LDFLAGS="$LDFLAGS -Wl,-z,relro"
266     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
267                   AC_MSG_RESULT([no])
268                   LDFLAGS=$_SAVE_LDFLAGS)
270     AC_MSG_CHECKING([for -z nocopyreloc option to ld])
271     _SAVE_LDFLAGS=$LDFLAGS
272     LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
273     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
274                   AC_MSG_RESULT([no])
275                   LDFLAGS=$_SAVE_LDFLAGS)
277     AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
278     _SAVE_LDFLAGS=$LDFLAGS
279     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
280     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
281                   AC_MSG_RESULT([no])
282                   LDFLAGS=$_SAVE_LDFLAGS)
284     AC_MSG_CHECKING([for --build-id=sha1 option to ld])
285     _SAVE_LDFLAGS=$LDFLAGS
286     LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
287     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
288                   AC_MSG_RESULT([no])
289                   LDFLAGS=$_SAVE_LDFLAGS)
291     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
292     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
293     _SAVE_LDFLAGS=$LDFLAGS
294     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
295     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
296                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
297                   AC_MSG_RESULT([no]))
298     LDFLAGS=$_SAVE_LDFLAGS
300     DSO_LDOPTS='-shared'
301     if test "$GCC_USE_GNU_LD"; then
302         # Some tools like ASan use a runtime library that is only
303         # linked against executables, so we must allow undefined
304         # symbols for shared objects in some cases.
305         if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
306             # Don't allow undefined symbols in libraries
307             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
309             # BSDs need `environ' exposed for posix_spawn (bug 753046)
310             case "$OS_TARGET" in
311             DragonFly|FreeBSD|NetBSD|OpenBSD)
312                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
313                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
314                 else
315                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
316                 fi
317                 ;;
318             esac
319         fi
320     fi
322     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
324     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
327 if test "$GNU_CXX"; then
328     CXXFLAGS="$CXXFLAGS -fno-exceptions"
330     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
333 dnl ========================================================
334 dnl System overrides of the defaults for host
335 dnl ========================================================
336 case "$host" in
337 *mingw*)
338     if test -n "$_WIN32_MSVC"; then
339         HOST_CFLAGS="$HOST_CFLAGS"
340     else
341         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
342     fi
343     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
344     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
345     HOST_BIN_SUFFIX=.exe
347     case "${host_cpu}" in
348     i*86)
349         if test -n "$_WIN32_MSVC"; then
350             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
351         fi
352         ;;
353     x86_64)
354         if test -n "$_WIN32_MSVC"; then
355             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
356         fi
357         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
358         ;;
359     esac
360     ;;
362 *-darwin*)
363     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
364     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
365     ;;
367 *-linux*|*-kfreebsd*-gnu|*-gnu*)
368     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
369     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
370     ;;
373     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
374     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
375     ;;
376 esac
378 dnl ========================================================
379 dnl System overrides of the defaults for target
380 dnl ========================================================
382 case "$target" in
383 *-darwin*)
384     MOZ_OPTIMIZE_FLAGS="-O3"
385     DSO_LDOPTS=''
387     dnl DTrace and -dead_strip don't interact well. See bug 403132.
388     dnl ===================================================================
389     if test "x$enable_dtrace" = "xyes"; then
390         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
391     else
392         dnl check for the presence of the -dead_strip linker flag
393         AC_MSG_CHECKING([for -dead_strip option to ld])
394         _SAVE_LDFLAGS=$LDFLAGS
395         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
396         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
397         if test -n "$_HAVE_DEAD_STRIP" ; then
398             AC_MSG_RESULT([yes])
399             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
400         else
401             AC_MSG_RESULT([no])
402         fi
404         LDFLAGS=$_SAVE_LDFLAGS
405     fi
407     MOZ_FIX_LINK_PATHS=
408     ;;
410 *-android*|*-linuxandroid*)
411     if test -z "$CLANG_CC"; then
412         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
413     else
414         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
415         # -Oz is smaller than -Os on clang.
416         MOZ_OPTIMIZE_FLAGS="-Oz"
417         # Disable the outliner, which causes performance regressions, and is
418         # enabled on some platforms at -Oz.
419         if test -z "$MOZ_LTO"; then
420             DISABLE_OUTLINER="-mno-outline"
421             _SAVE_CFLAGS=$CFLAGS
422             CFLAGS="$CFLAGS $DISABLE_OUTLINER"
423             AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
424             CFLAGS="$_SAVE_CFLAGS"
425         else
426             DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
427             _SAVE_LDFLAGS=$LDFLAGS
428             LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
429             AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
430             LDFLAGS="$_SAVE_LDFLAGS"
431         fi
432     fi
433     ;;
435 *-*linux*)
436     if test "$GNU_CC" -o "$GNU_CXX"; then
437         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
438         if test -n "$MOZ_DEBUG"; then
439             MOZ_OPTIMIZE_FLAGS="-Os"
440         else
441             MOZ_OPTIMIZE_FLAGS="-O2"
442         fi
443         if test -z "$CLANG_CC"; then
444            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
445         fi
446     fi
448     case "${target_cpu}" in
449     alpha*)
450         CFLAGS="$CFLAGS -mieee"
451         CXXFLAGS="$CXXFLAGS -mieee"
452     ;;
453     esac
454     ;;
455 *-mingw*)
456     DSO_PIC_CFLAGS=
457     # certain versions of cygwin's makedepend barf on the
458     # #include <string> vs -I./dist/include/string issue so don't use it
459     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
460         # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
461         if test -z "$CLANG_CC"; then
462             AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
463         fi
465         DSO_LDOPTS='-shared'
466         MOZ_FIX_LINK_PATHS=
468         MOZ_OPTIMIZE_FLAGS="-O2"
470         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
471         WIN32_GUI_EXE_LDFLAGS=-mwindows
473         # Silence problematic clang warnings
474         CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
475         LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
476     else
477         TARGET_COMPILER_ABI=msvc
478         # aarch64 doesn't support subsystems below 6.02
479         if test "$CPU_ARCH" = "aarch64"; then
480             WIN32_SUBSYSTEM_VERSION=6.02
481         else
482             WIN32_SUBSYSTEM_VERSION=6.01
483         fi
484         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
485         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
486         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
487         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
488         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
489         CFLAGS="$CFLAGS -Gy -Zc:inline"
490         CXXFLAGS="$CXXFLAGS -Gy -Zc:inline"
491         if test "$CPU_ARCH" = "x86"; then
492             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
493             dnl more recent, so set that explicitly here unless another
494             dnl target arch has already been set.
495             changequote(,)
496             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
497               CFLAGS="$CFLAGS -arch:SSE2"
498             fi
499             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
500               CXXFLAGS="$CXXFLAGS -arch:SSE2"
501             fi
502             changequote([,])
503         fi
504         dnl VS2013+ supports -Gw for better linker optimizations.
505         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
506         dnl Disabled on ASan because it causes false-positive ODR violations.
507         if test -z "$MOZ_ASAN"; then
508             CFLAGS="$CFLAGS -Gw"
509             CXXFLAGS="$CXXFLAGS -Gw"
510         else
511             # String tail merging doesn't play nice with ASan's ODR checker.
512             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
513         fi
514         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
515         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
516         MOZ_DEBUG_LDFLAGS='-DEBUG'
517         if test "$HOST_OS_ARCH" != "WINNT"; then
518           # %_PDB% is a special signal to emit only the PDB basename. This
519           # avoids problems in Windows tools that don't like forward-slashes.
520           MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
521         fi
522         MOZ_OPTIMIZE_FLAGS='-O2'
523         MOZ_FIX_LINK_PATHS=
524         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
525     fi
526     AC_DEFINE(WIN32_LEAN_AND_MEAN)
527     dnl See http://support.microsoft.com/kb/143208 to use STL
528     AC_DEFINE(NOMINMAX)
529     BIN_SUFFIX='.exe'
531     case "$host_os" in
532     cygwin*|msvc*|mks*)
533         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.])
534         ;;
535     esac
537     case "$target" in
538     i*86-*)
539         if test -n "$GNU_CC"; then
540             CFLAGS="$CFLAGS -mstackrealign"
541             CXXFLAGS="$CXXFLAGS -mstackrealign"
542             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
543         else
544             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
545             LDFLAGS="$LDFLAGS -SAFESEH"
546         fi
548         AC_DEFINE(_X86_)
549         ;;
550     x86_64-*)
551         if test -n "$_WIN32_MSVC"; then
552             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
553         fi
554         AC_DEFINE(_AMD64_)
555         ;;
556     aarch64-*)
557         if test -n "$_WIN32_MSVC"; then
558             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
559         fi
560         AC_DEFINE(_ARM64_)
561         ;;
562     *)
563         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
564         ;;
565     esac
566     ;;
568 *-netbsd*)
569     CFLAGS="$CFLAGS -Dunix"
570     CXXFLAGS="$CXXFLAGS -Dunix"
571     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
572         DSO_PIC_CFLAGS='-fPIC -DPIC'
573         DSO_LDOPTS='-shared'
574         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
575     else
576         DSO_PIC_CFLAGS='-fPIC -DPIC'
577         DSO_LDOPTS='-shared'
578     fi
579     # This will fail on a.out systems prior to 1.5.1_ALPHA.
580     if test "$LIBRUNPATH"; then
581         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
582     fi
583     ;;
585 *-openbsd*)
586     if test -z "$X11BASE"; then
587         X11BASE=/usr/X11R6
588     fi
589     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
590     DSO_PIC_CFLAGS='-fPIC'
591     DSO_LDOPTS='-shared -fPIC'
592     if test "$LIBRUNPATH"; then
593         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
594     fi
595     ;;
597 *-solaris*)
598     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
599     ;;
601 esac
603 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
604 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
606 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
607     MOZ_OPTIMIZE_FLAGS="-O"
611 if test -z "$COMPILE_ENVIRONMENT"; then
612     SKIP_COMPILER_CHECKS=1
613     SKIP_LIBRARY_CHECKS=1
614     MOZ_DEBUGGING_OPTS
615 else
616     MOZ_COMPILER_OPTS
617 fi # COMPILE_ENVIRONMENT
619 if test -z "$SKIP_COMPILER_CHECKS"; then
620 dnl Checks for typedefs, structures, and compiler characteristics.
621 dnl ========================================================
622 AC_C_CONST
623 AC_TYPE_MODE_T
624 AC_TYPE_OFF_T
625 AC_TYPE_PID_T
626 AC_TYPE_SIZE_T
627 AC_LANG_CPLUSPLUS
628 AC_LANG_C
630 AC_LANG_CPLUSPLUS
632 MOZ_CXX11
634 AC_LANG_C
636 case "${OS_TARGET}" in
637 Darwin)
638   ;;
640   STL_FLAGS="-I${DIST}/stl_wrappers"
641   WRAP_STL_INCLUDES=1
642   ;;
643 esac
645 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
646     WRAP_STL_INCLUDES=
649 dnl Checks for header files.
650 dnl ========================================================
651 AC_HEADER_DIRENT
653 dnl Checks for libraries.
654 dnl ========================================================
655 AC_CHECK_LIB(c_r, gethostbyname_r)
657 dnl We don't want to link with libdl even if it's present on OS X, since
658 dnl it's not used and not part of the default installation. OS/2 has dlfcn
659 dnl in libc.
660 dnl We don't want to link against libm or libpthread on Darwin since
661 dnl they both are just symlinks to libSystem and explicitly linking
662 dnl against libSystem causes issues when debugging (see bug 299601).
663 case $target in
664 *-darwin*)
665     ;;
667     AC_SEARCH_LIBS(dlopen, dl,
668         MOZ_CHECK_HEADER(dlfcn.h,
669         AC_DEFINE(HAVE_DLOPEN)))
670     ;;
671 esac
673 _SAVE_CFLAGS="$CFLAGS"
674 CFLAGS="$CFLAGS -D_GNU_SOURCE"
675 AC_CHECK_FUNCS(dladdr)
676 CFLAGS="$_SAVE_CFLAGS"
678 if test ! "$GNU_CXX"; then
679     AC_CHECK_LIB(C, demangle)
682 AC_CHECK_LIB(socket, socket)
684 dnl ========================================================
685 dnl = pthread support
686 dnl = Start by checking whether the system support pthreads
687 dnl ========================================================
688 case "$target_os" in
689 darwin*)
690     MOZ_USE_PTHREADS=1
691     ;;
693     AC_CHECK_LIB(pthreads, pthread_create,
694         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
695         AC_CHECK_LIB(pthread, pthread_create,
696             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
697             AC_CHECK_LIB(c_r, pthread_create,
698                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
699                 AC_CHECK_LIB(c, pthread_create,
700                     MOZ_USE_PTHREADS=1
701                 )
702             )
703         )
704     )
705     ;;
706 esac
708 dnl ========================================================
709 dnl Do the platform specific pthread hackery
710 dnl ========================================================
711 if test "$MOZ_USE_PTHREADS"x != x
712 then
713     dnl
714     dnl See if -pthread is supported.
715     dnl
716     rm -f conftest*
717     ac_cv_have_dash_pthread=no
718     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
719     echo 'int main() { return 0; }' | cat > conftest.c
720     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
721     if test $? -eq 0; then
722         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
723             ac_cv_have_dash_pthread=yes
724             case "$target_os" in
725             freebsd*)
726 # Freebsd doesn't use -pthread for compiles, it uses them for linking
727                 ;;
728             *)
729                 CFLAGS="$CFLAGS -pthread"
730                 CXXFLAGS="$CXXFLAGS -pthread"
731                 ;;
732             esac
733         fi
734     fi
735     rm -f conftest*
736     AC_MSG_RESULT($ac_cv_have_dash_pthread)
738     dnl
739     dnl See if -pthreads is supported.
740     dnl
741     ac_cv_have_dash_pthreads=no
742     if test "$ac_cv_have_dash_pthread" = "no"; then
743         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
744         echo 'int main() { return 0; }' | cat > conftest.c
745         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
746         if test $? -eq 0; then
747             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
748                 ac_cv_have_dash_pthreads=yes
749                 CFLAGS="$CFLAGS -pthreads"
750                 CXXFLAGS="$CXXFLAGS -pthreads"
751             fi
752         fi
753         rm -f conftest*
754         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
755     fi
757     case "$target" in
758         *-*-freebsd*)
759             AC_DEFINE(_REENTRANT)
760             AC_DEFINE(_THREAD_SAFE)
761             dnl -pthread links in -lpthread, so don't specify it explicitly.
762             if test "$ac_cv_have_dash_pthread" = "yes"; then
763                 _PTHREAD_LDFLAGS="-pthread"
764             fi
765             ;;
767         *-*-openbsd*|*-*-bsdi*)
768             AC_DEFINE(_REENTRANT)
769             AC_DEFINE(_THREAD_SAFE)
770             dnl -pthread links in -lc_r, so don't specify it explicitly.
771             if test "$ac_cv_have_dash_pthread" = "yes"; then
772                 _PTHREAD_LDFLAGS="-pthread"
773             fi
774             ;;
776         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
777             AC_DEFINE(_REENTRANT)
778             ;;
780     esac
781     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
782     AC_SUBST(MOZ_USE_PTHREADS)
783     MOZ_CHECK_HEADERS(pthread.h)
787 dnl Checks for library functions.
788 dnl ========================================================
790 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
791 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
792                ac_cv_clock_monotonic,
793                [for libs in "" -lrt; do
794                     _SAVE_LIBS="$LIBS"
795                     LIBS="$LIBS $libs"
796 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
797 dnl we should or not be able to use it. To detect if we can, we need to make the
798 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
799                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
800                                  #include <time.h>],
801                                  [ struct timespec ts;
802                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
803                                  ac_cv_clock_monotonic=$libs
804                                  LIBS="$_SAVE_LIBS"
805                                  break,
806                                  ac_cv_clock_monotonic=no)
807                     LIBS="$_SAVE_LIBS"
808                 done])
809 if test "$ac_cv_clock_monotonic" != "no"; then
810     HAVE_CLOCK_MONOTONIC=1
811     REALTIME_LIBS=$ac_cv_clock_monotonic
812     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
813     AC_SUBST(HAVE_CLOCK_MONOTONIC)
814     AC_SUBST_LIST(REALTIME_LIBS)
817 AC_CACHE_CHECK(
818     [for res_ninit()],
819     ac_cv_func_res_ninit,
820     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
821         dnl no need for res_ninit() on NetBSD and OpenBSD
822         ac_cv_func_res_ninit=no
823      else
824         AC_TRY_LINK([
825             #ifdef linux
826             #define _BSD_SOURCE 1
827             #endif
828             #include <sys/types.h>
829             #include <netinet/in.h>
830             #include <arpa/nameser.h>
831             #include <resolv.h>
832             ],
833             [int foo = res_ninit(&_res);],
834             [ac_cv_func_res_ninit=yes],
835             [ac_cv_func_res_ninit=no])
836      fi
837     ])
839 if test "$ac_cv_func_res_ninit" = "yes"; then
840     AC_DEFINE(HAVE_RES_NINIT)
841 dnl must add the link line we do something as foolish as this... dougt
842 dnl else
843 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
844 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
847 AC_LANG_C
849 dnl ===================================================================
850 dnl ========================================================
851 dnl Put your C++ language/feature checks below
852 dnl ========================================================
853 AC_LANG_CPLUSPLUS
855 ARM_ABI_PREFIX=
856 if test "$GNU_CC"; then
857   if test "$CPU_ARCH" = "arm" ; then
858     AC_CACHE_CHECK(for ARM EABI,
859         ac_cv_gcc_arm_eabi,
860         [AC_TRY_COMPILE([],
861                         [
862 #if defined(__ARM_EABI__)
863   return 0;
864 #else
865 #error Not ARM EABI.
866 #endif
867                         ],
868                         ac_cv_gcc_arm_eabi="yes",
869                         ac_cv_gcc_arm_eabi="no")])
870     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
871         HAVE_ARM_EABI=1
872         ARM_ABI_PREFIX=eabi-
873     else
874         ARM_ABI_PREFIX=oabi-
875     fi
876   fi
878   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
881 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
882 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
883 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
884 # linking XUL.
885 _SAVE_LDFLAGS=$LDFLAGS
886 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
887 AC_CACHE_CHECK(for __thread keyword for TLS variables,
888                ac_cv_thread_keyword,
889                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
890                             [return tlsIsMainThread;],
891                             ac_cv_thread_keyword=yes,
892                             ac_cv_thread_keyword=no)])
893 LDFLAGS=$_SAVE_LDFLAGS
894 # The custom dynamic linker doesn't support TLS variables
895 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
896   # mips builds fail with TLS variables because of a binutils bug.
897   # See bug 528687
898   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
899   case "${target}" in
900     mips*-*)
901       :
902       ;;
903     *-android*|*-linuxandroid*)
904       :
905       ;;
906     *-openbsd*)
907       :
908       ;;
909     *)
910       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
911       ;;
912   esac
915 if test -n "$MOZ_LINKER"; then
916 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
917 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
918 dnl Since the linker only understands the sysv ones, no need to build the
919 dnl gnu style tables anyways.
920   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
923 dnl End of C++ language/feature checks
924 AC_LANG_C
926 fi # ! SKIP_COMPILER_CHECKS
928 if test -n "${COMPILE_ENVIRONMENT}"; then
929   MOZ_CHECK_ALLOCATOR
932 TARGET_XPCOM_ABI=
933 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
934     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
935     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
938 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
939 dnl features that Windows actually does support.
941 if test -n "$SKIP_COMPILER_CHECKS"; then
942    dnl Windows has malloc.h
943    AC_DEFINE(MALLOC_H, [<malloc.h>])
944    AC_DEFINE(HAVE_FORCEINLINE)
945 fi # SKIP_COMPILER_CHECKS
947 dnl Mozilla specific options
948 dnl ========================================================
949 dnl The macros used for command line options
950 dnl are defined in build/autoconf/altoptions.m4.
952 dnl ========================================================
953 dnl =
954 dnl = Application
955 dnl =
956 dnl ========================================================
958 MOZ_BRANDING_DIRECTORY=
959 MOZ_OFFICIAL_BRANDING=
960 MOZ_NO_SMART_CARDS=
961 MOZ_BINARY_EXTENSIONS=
962 MOZ_DEVTOOLS=server
964 dnl ========================================================
965 dnl = Trademarked Branding
966 dnl ========================================================
967 MOZ_ARG_ENABLE_BOOL(official-branding,
968 [  --enable-official-branding
969                           Enable Official mozilla.org Branding
970                           Do not distribute builds with
971                           --enable-official-branding unless you have
972                           permission to use trademarks per
973                           http://www.mozilla.org/foundation/trademarks/ .],
974     MOZ_OFFICIAL_BRANDING=1,
975     MOZ_OFFICIAL_BRANDING=)
977 # Allow the application to influence configure with a confvars.sh script.
978 AC_MSG_CHECKING([if app-specific confvars.sh exists])
979 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
980   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
981   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
982 else
983   AC_MSG_RESULT([no])
986 AC_SUBST(MOZ_OFFICIAL_BRANDING)
987 if test -n "$MOZ_OFFICIAL_BRANDING"; then
988   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
989     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
990   else
991     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
992     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
993   fi
996 MOZ_ARG_WITH_STRING(branding,
997 [  --with-branding=dir     Use branding from the specified directory.],
998     MOZ_BRANDING_DIRECTORY=$withval)
1000 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1001 if test -z "$REAL_BRANDING_DIRECTORY"; then
1002   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1005 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1006   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1009 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1011 dnl ========================================================
1012 dnl = Distribution ID
1013 dnl ========================================================
1014 MOZ_ARG_WITH_STRING(distribution-id,
1015 [  --with-distribution-id=ID
1016                           Set distribution-specific id (default=org.mozilla)],
1017 [ val=`echo $withval`
1018     MOZ_DISTRIBUTION_ID="$val"])
1020 if test -z "$MOZ_DISTRIBUTION_ID"; then
1021    MOZ_DISTRIBUTION_ID="org.mozilla"
1024 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1025 AC_SUBST(MOZ_DISTRIBUTION_ID)
1027 dnl ========================================================
1028 dnl = Enable code optimization. ON by default.
1029 dnl ========================================================
1031 # Use value from moz.configure if one is defined. Else use our computed
1032 # value.
1033 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1034     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1037 if test "$COMPILE_ENVIRONMENT"; then
1038 if test -n "$MOZ_OPTIMIZE"; then
1039     AC_MSG_CHECKING([for valid C compiler optimization flags])
1040     _SAVE_CFLAGS=$CFLAGS
1041     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1042     AC_TRY_COMPILE([#include <stdio.h>],
1043         [printf("Hello World\n");],
1044         _results=yes,
1045         _results=no)
1046     AC_MSG_RESULT([$_results])
1047     if test "$_results" = "no"; then
1048         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1049     fi
1050     CFLAGS=$_SAVE_CFLAGS
1051     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1052         # When using llvm-based LTO, non numeric optimization levels are
1053         # not supported by the linker, so force the linker to use -O2 (
1054         # which doesn't influence the level compilation units are actually
1055         # compiled at).
1056         case " $MOZ_OPTIMIZE_FLAGS " in
1057         *\ -Os\ *|*\ -Oz\ *)
1058             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1059             ;;
1060         esac
1061     fi
1063 fi # COMPILE_ENVIRONMENT
1065 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1066 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1067 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1069 case "${OS_TARGET}" in
1070 Android|WINNT|Darwin)
1071   MOZ_GLUE_IN_PROGRAM=
1072   ;;
1074   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1075   MOZ_GLUE_IN_PROGRAM=1
1076   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1077   ;;
1078 esac
1080 dnl ========================================================
1081 dnl = Jemalloc build setup
1082 dnl ========================================================
1083 if test -z "$MOZ_MEMORY"; then
1084   case "${target}" in
1085     *-mingw*)
1086       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1087         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.])
1088       fi
1089       ;;
1090   esac
1091 else
1092   dnl The generic feature tests that determine how to compute ncpus are long and
1093   dnl complicated.  Therefore, simply define special cpp variables for the
1094   dnl platforms we have special knowledge of.
1095   case "${target}" in
1096   *-mingw*)
1097     export MOZ_NO_DEBUG_RTL=1
1098     ;;
1099   esac
1100 fi # MOZ_MEMORY
1101 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1103 dnl ========================================================
1104 dnl = Enable using the clang plugin to build
1105 dnl ========================================================
1107 if test -n "$COMPILE_ENVIRONMENT"; then
1108 MOZ_CONFIG_CLANG_PLUGIN
1109 fi # COMPILE_ENVIRONMENT
1111 if test -z "$SKIP_COMPILER_CHECKS"; then
1112 dnl ========================================================
1113 dnl Check for gcc -pipe support
1114 dnl ========================================================
1115 AC_MSG_CHECKING([for -pipe support])
1116 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1117     dnl Any gcc that supports firefox supports -pipe.
1118     CFLAGS="$CFLAGS -pipe"
1119     CXXFLAGS="$CXXFLAGS -pipe"
1120     AC_MSG_RESULT([yes])
1121 else
1122     AC_MSG_RESULT([no])
1125 fi # ! SKIP_COMPILER_CHECKS
1127 AC_LANG_C
1129 if test "$COMPILE_ENVIRONMENT"; then
1130 MOZ_EXPAND_LIBS
1131 fi # COMPILE_ENVIRONMENT
1133 dnl ========================================================
1134 dnl Check if we need the 32-bit Linux SSE2 error dialog
1135 dnl ========================================================
1137 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1139 dnl ========================================================
1140 dnl Check for cairo
1141 dnl ========================================================
1143 if test "$OS_ARCH" = "WINNT"; then
1144     # For now we assume that we will have a uint64_t available through
1145     # one of the above headers or mozstdint.h.
1146     AC_DEFINE(HAVE_UINT64_T)
1149 case "$MOZ_WIDGET_TOOLKIT" in
1150   windows)
1151     if test "$COMPILE_ENVIRONMENT"; then
1152       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1153     fi
1154     ;;
1155 esac
1156 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1158 dnl ========================================================
1159 dnl =
1160 dnl = Maintainer debug option (no --enable equivalent)
1161 dnl =
1162 dnl ========================================================
1164 AC_SUBST_LIST(ASFLAGS)
1165 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1166 AC_SUBST_LIST(WARNINGS_CFLAGS)
1168 AC_SUBST(MOZ_STUB_INSTALLER)
1170 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1172 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1174 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1175   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1178 dnl ========================================================
1179 dnl = Mac bundle name prefix
1180 dnl ========================================================
1181 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1182 [  --with-macbundlename-prefix=prefix
1183                           Prefix for MOZ_MACBUNDLE_NAME],
1184 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1186 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1187 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1188   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1191 if test "$MOZ_DEBUG"; then
1192   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1193 else
1194   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1196 AC_SUBST(MOZ_MACBUNDLE_NAME)
1198 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1199 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1200 # Otherwise, use MOZ_APP_DISPLAYNAME
1201 if test -z "$MOZ_MACBUNDLE_ID"; then
1202    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1204 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1205 if test "$MOZ_DEBUG"; then
1206   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1209 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1210 AC_SUBST(MOZ_MACBUNDLE_ID)
1212 dnl ========================================================
1213 dnl = Child Process Name for IPC
1214 dnl ========================================================
1215 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1216   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1217 else
1218   # We want to let Android unpack the file at install time, but it only does
1219   # so if the file is named libsomething.so. The lib/ path is also required
1220   # because the unpacked file will be under the lib/ subdirectory and will
1221   # need to be executed from that path.
1222   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1224 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1225 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
1227 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1228 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1229 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1231 # The following variables are available to branding and application
1232 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1233 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1234 # impacts profile location and user-visible fields.
1235 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1236 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1237 # builds (e.g. Aurora for Firefox).
1238 # - MOZ_APP_PROFILE: When set, used for application.ini's
1239 # "Profile" field, which controls profile location.
1240 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1241 # crash reporter server url.
1242 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1244 # The following environment variables used to have an effect, but don't anymore:
1245 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1246 # the contents from the version.txt file in the application directory, or
1247 # browser/config/version.txt if there isn't one.
1248 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1249 # in the "About" window. This was replaced with the contents from the
1250 # version_display.txt or version.txt in the application directory, or
1251 # browser/config/version_display.txt.
1253 # For extensions and langpacks, we require a max version that is compatible
1254 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1255 # 24.0a1 and 24.0a2 aren't affected
1256 # 24.0 becomes 24.*
1257 # 24.1.1 becomes 24.*
1258 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1259 if test -z "$IS_ALPHA"; then
1260   changequote(,)
1261   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1262     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1263   else
1264     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1265   fi
1266   changequote([,])
1267 else
1268   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1271 AC_SUBST(MOZ_APP_DISPLAYNAME)
1272 AC_SUBST(MOZ_APP_VENDOR)
1273 AC_SUBST(MOZ_APP_PROFILE)
1274 AC_SUBST(MOZ_APP_ID)
1275 AC_SUBST(MAR_CHANNEL_ID)
1276 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1277 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1278 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1279 AC_SUBST(MOZ_APP_UA_NAME)
1280 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1281 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1282 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1284 AC_SUBST(MOZ_APP_MAXVERSION)
1285 AC_SUBST(MOZ_PKG_SPECIAL)
1286 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1288 if test "$MOZILLA_OFFICIAL"; then
1289     # Build revisions should always be present in official builds
1290     MOZ_INCLUDE_SOURCE_INFO=1
1293 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1294 # explicitly set the repository and changeset information in.
1295 AC_SUBST(MOZ_SOURCE_REPO)
1296 AC_SUBST(MOZ_SOURCE_CHANGESET)
1297 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1299 dnl If we have any service that uploads data (and requires data submission
1300 dnl policy alert), set MOZ_DATA_REPORTING.
1301 dnl We need SUBST for build system and DEFINE for xul preprocessor.
1302 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"  || test -n "$MOZ_NORMANDY"; then
1303   MOZ_DATA_REPORTING=1
1304   AC_DEFINE(MOZ_DATA_REPORTING)
1305   AC_SUBST(MOZ_DATA_REPORTING)
1308 dnl win32 options
1309 AC_SUBST(WIN32_REDIST_DIR)
1310 AC_SUBST(WIN_UCRT_REDIST_DIR)
1312 dnl Echo the CFLAGS to remove extra whitespace.
1313 CFLAGS=`echo \
1314     $_COMPILATION_CFLAGS \
1315     $CFLAGS`
1317 CXXFLAGS=`echo \
1318     $_WARNINGS_CXXFLAGS \
1319     $_COMPILATION_CXXFLAGS \
1320     $CXXFLAGS`
1322 COMPILE_CFLAGS=`echo \
1323     $_DEFINES_CFLAGS \
1324     $COMPILE_CFLAGS`
1326 COMPILE_CXXFLAGS=`echo \
1327     $_DEFINES_CXXFLAGS \
1328     $COMPILE_CXXFLAGS`
1330 HOST_CFLAGS=`echo \
1331     $_WARNINGS_HOST_CFLAGS \
1332     $_COMPILATION_HOST_CFLAGS \
1333     $HOST_CFLAGS`
1335 HOST_CXXFLAGS=`echo \
1336     $_WARNINGS_HOST_CXXFLAGS \
1337     $_COMPILATION_HOST_CXXFLAGS \
1338     $HOST_CXXFLAGS`
1340 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1341 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1342 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1343 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1344 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1345   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1346   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1348 AC_SUBST(HOST_CMFLAGS)
1349 AC_SUBST(HOST_CMMFLAGS)
1350 AC_SUBST(OS_COMPILE_CMFLAGS)
1351 AC_SUBST(OS_COMPILE_CMMFLAGS)
1353 OS_CFLAGS="$CFLAGS"
1354 OS_CXXFLAGS="$CXXFLAGS"
1355 OS_CPPFLAGS="$CPPFLAGS"
1356 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1357 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1358 OS_LDFLAGS="$LDFLAGS"
1359 OS_LIBS="$LIBS"
1360 AC_SUBST_LIST(OS_CFLAGS)
1361 AC_SUBST_LIST(OS_CXXFLAGS)
1362 AC_SUBST_LIST(OS_CPPFLAGS)
1363 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1364 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1365 AC_SUBST_LIST(OS_LDFLAGS)
1366 AC_SUBST(OS_LIBS)
1368 AC_SUBST(HOST_CC)
1369 AC_SUBST(HOST_CXX)
1370 AC_SUBST_LIST(HOST_CFLAGS)
1371 AC_SUBST_LIST(HOST_CPPFLAGS)
1372 AC_SUBST_LIST(HOST_CXXFLAGS)
1373 AC_SUBST(HOST_LDFLAGS)
1374 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1375 AC_SUBST(HOST_BIN_SUFFIX)
1377 AC_SUBST(TARGET_XPCOM_ABI)
1379 AC_SUBST(DSO_LDOPTS)
1380 AC_SUBST(BIN_SUFFIX)
1381 AC_SUBST(USE_N32)
1382 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1383 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1385 AC_SUBST(MOZ_DEVTOOLS)
1387 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1389 AC_SUBST(DMG_TOOL)
1391 dnl Host JavaScript runtime, if any, to use during cross compiles.
1392 AC_SUBST(JS_BINARY)
1394 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1396 dnl Set various defines and substitutions
1397 dnl ========================================================
1399 AC_SUBST(MOZ_DEV_EDITION)
1400 if test -n "$MOZ_DEV_EDITION"; then
1401     AC_DEFINE(MOZ_DEV_EDITION)
1404 dnl Windows AccessibilityHandler
1405 dnl ========================================================
1407 if test -z "$MOZ_HANDLER_CLSID"; then
1408     MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
1409     MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
1410     MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
1411     MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
1414 AC_SUBST(MOZ_HANDLER_CLSID)
1415 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
1416 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
1417 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
1419 dnl Spit out some output
1420 dnl ========================================================
1422 # Avoid using obsolete NSPR features
1423 AC_DEFINE(NO_NSPR_10_SUPPORT)
1425 MOZ_CREATE_CONFIG_STATUS()
1427 rm -fr confdefs* $ac_clean_files