Bug 1837620 - Part 2: Remove baseline ICs that guard objects when the objects becomes...
[gecko.git] / old-configure.in
blobf9ca433541e7ab81d0498a0304d0d7c7212cd749
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 Set the minimum version of toolkit libs used by mozilla
30 dnl ========================================================
31 W32API_VERSION=3.14
33 dnl Set various checks
34 dnl ========================================================
35 MISSING_X=
37 dnl Initialize the Pthread test variables early so they can be
38 dnl  overridden by each platform.
39 dnl ========================================================
40 MOZ_USE_PTHREADS=
41 _PTHREAD_LDFLAGS=""
43 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS $PACK_REL_RELOC_FLAGS"
44 HOST_LDFLAGS="$HOST_LDFLAGS $HOST_LINKER_LDFLAGS"
46 if test "$COMPILE_ENVIRONMENT"; then
47     MOZ_ANDROID_NDK
48 fi # COMPILE_ENVIRONMENT
50 dnl ========================================================
51 dnl Checks for compilers.
52 dnl ========================================================
54 if test "$COMPILE_ENVIRONMENT"; then
56 # Run some logic to figure out exe extensions (mostly for mingw's sake)
57 AC_EXEEXT
59 if test "$target" != "$host"; then
60     MOZ_CROSS_COMPILER
61 else
62     AC_PROG_CC
63     case "$target" in
64     *-mingw*)
65       # Work around the conftest.exe access problem on Windows
66       sleep 2
67     esac
68     AC_PROG_CXX
71 MOZ_TOOL_VARIABLES
73 dnl ========================================================
74 dnl Special win32 checks
75 dnl ========================================================
77 WINVER=601
79 case "$target" in
80 *-mingw*)
81     if test "$GCC" != "yes"; then
82         # Check to see if we are really running in a msvc environemnt
83         _WIN32_MSVC=1
85         # Make sure compilers are valid
86         CXXFLAGS="$CXXFLAGS -TP"
87         AC_LANG_SAVE
88         AC_LANG_C
89         AC_TRY_COMPILE([#include <stdio.h>],
90             [ printf("Hello World\n"); ],,
91             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
93         AC_LANG_CPLUSPLUS
94         AC_TRY_COMPILE([#include <new.h>],
95             [ unsigned *test = new unsigned(42); ],,
96             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
97         AC_LANG_RESTORE
99         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
100         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
102         MSVC_C_RUNTIME_DLL=vcruntime140.dll
103         if test -n "$IS_VS2019_OR_MORE" -a "$CPU_ARCH" != "x86"; then
104             MSVC_C_RUNTIME_1_DLL=vcruntime140_1.dll
105         fi
106         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
108         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
109         CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
111         if test -n "$WIN_UCRT_REDIST_DIR"; then
112           if test ! -d "$WIN_UCRT_REDIST_DIR"; then
113             AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
114           fi
115           WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
116         fi
118         AC_SUBST(MSVC_C_RUNTIME_DLL)
119         AC_SUBST(MSVC_C_RUNTIME_1_DLL)
120         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
122         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
124         if test -n "$WIN32_REDIST_DIR"; then
125           if test ! -d "$WIN32_REDIST_DIR"; then
126             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
127           fi
128           WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
129         fi
130     else
131         # Check w32api version
132         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
133         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
134         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
135         AC_TRY_COMPILE([#include <w32api.h>],
136             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
137                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
138                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
139                 #error "test failed."
140             #endif
141             , [ res=yes ], [ res=no ])
142         AC_MSG_RESULT([$res])
143         if test "$res" != "yes"; then
144             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
145         fi
146         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
147         # causing problems with local implementations with the same name.
148         AC_DEFINE(STRSAFE_NO_DEPRECATE)
149     fi # !GNU_CC
151     AC_DEFINE(_USE_MATH_DEFINES) # Otherwise Windows' math.h doesn't #define M_PI.
153     CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
154     CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
156     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
157     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
158     # Require OS features provided by IE 8.0 (Win7)
159     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
161     ;;
162 esac
164 if test -n "$_WIN32_MSVC"; then
165     SKIP_PATH_CHECKS=1
166     SKIP_COMPILER_CHECKS=1
167     SKIP_LIBRARY_CHECKS=1
169     # Since we're skipping compiler and library checks, hard-code
170     # some facts here.
171     AC_DEFINE(HAVE_IO_H)
172     AC_DEFINE(HAVE_ISATTY)
175 fi # COMPILE_ENVIRONMENT
177 AC_SUBST(GNU_CC)
178 AC_SUBST(GNU_CXX)
180 dnl ========================================================
181 dnl set the defaults first
182 dnl ========================================================
183 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
185 dnl Configure platform-specific CPU architecture compiler options.
186 dnl ==============================================================
187 if test "$COMPILE_ENVIRONMENT"; then
188     MOZ_ARCH_OPTS
189 fi # COMPILE_ENVIRONMENT
191 if test -n "$COMPILE_ENVIRONMENT"; then
192    MOZ_CONFIG_SANITIZE
195 dnl ========================================================
196 dnl GNU specific defaults
197 dnl ========================================================
198 if test "$GNU_CC"; then
199     if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
200         DSO_PIC_CFLAGS='-fPIC'
201         ASFLAGS="$ASFLAGS -fPIC"
202     fi
204     AC_MSG_CHECKING([for --noexecstack option to as])
205     _SAVE_CFLAGS=$CFLAGS
206     CFLAGS="$CFLAGS -Wa,--noexecstack"
207     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
208                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
209                      AC_MSG_RESULT([no]))
210     CFLAGS=$_SAVE_CFLAGS
211     AC_MSG_CHECKING([for -z noexecstack option to ld])
212     _SAVE_LDFLAGS=$LDFLAGS
213     LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
214     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
215                   AC_MSG_RESULT([no])
216                   LDFLAGS=$_SAVE_LDFLAGS)
218     AC_MSG_CHECKING([for -z text option to ld])
219     _SAVE_LDFLAGS=$LDFLAGS
220     LDFLAGS="$LDFLAGS -Wl,-z,text"
221     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
222                   AC_MSG_RESULT([no])
223                   LDFLAGS=$_SAVE_LDFLAGS)
225     AC_MSG_CHECKING([for -z relro option to ld])
226     _SAVE_LDFLAGS=$LDFLAGS
227     LDFLAGS="$LDFLAGS -Wl,-z,relro"
228     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
229                   AC_MSG_RESULT([no])
230                   LDFLAGS=$_SAVE_LDFLAGS)
232     AC_MSG_CHECKING([for -z nocopyreloc option to ld])
233     _SAVE_LDFLAGS=$LDFLAGS
234     LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
235     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
236                   AC_MSG_RESULT([no])
237                   LDFLAGS=$_SAVE_LDFLAGS)
239     AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
240     _SAVE_LDFLAGS=$LDFLAGS
241     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
242     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
243                   AC_MSG_RESULT([no])
244                   LDFLAGS=$_SAVE_LDFLAGS)
246     # While sha1 is deterministic, it is slower.
247     if test -z "$DEVELOPER_OPTIONS"; then
248         build_id=sha1
249     else
250         build_id=uuid
251     fi
252     AC_MSG_CHECKING([for --build-id=$build_id option to ld])
253     _SAVE_LDFLAGS=$LDFLAGS
254     LDFLAGS="$LDFLAGS -Wl,--build-id=$build_id"
255     AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
256                   AC_MSG_RESULT([no])
257                   LDFLAGS=$_SAVE_LDFLAGS)
259     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
260     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
261     _SAVE_LDFLAGS=$LDFLAGS
262     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
263     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
264                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
265                   AC_MSG_RESULT([no]))
266     LDFLAGS=$_SAVE_LDFLAGS
268     DSO_LDOPTS='-shared'
269     if test "$GCC_USE_GNU_LD"; then
270         # Some tools like ASan use a runtime library that is only
271         # linked against executables, so we must allow undefined
272         # symbols for shared objects in some cases.
273         if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
274             # Don't allow undefined symbols in libraries
275             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
277             # BSDs need `environ' exposed for posix_spawn (bug 753046)
278             case "$OS_TARGET" in
279             DragonFly|FreeBSD|NetBSD|OpenBSD)
280                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
281                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
282                 else
283                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
284                 fi
285                 ;;
286             esac
287         fi
288     fi
290     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
292     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
295 if test "$GNU_CXX"; then
296     CXXFLAGS="$CXXFLAGS -fno-exceptions"
298     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
301 dnl ========================================================
302 dnl System overrides of the defaults for host
303 dnl ========================================================
304 case "$host" in
305 *mingw*)
306     if test -n "$_WIN32_MSVC"; then
307         HOST_CFLAGS="$HOST_CFLAGS"
308     else
309         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
310     fi
311     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
312     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
313     HOST_BIN_SUFFIX=.exe
315     case "${host_cpu}" in
316     i*86)
317         if test -n "$_WIN32_MSVC"; then
318             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
319         fi
320         ;;
321     x86_64)
322         if test -n "$_WIN32_MSVC"; then
323             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
324         fi
325         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
326         ;;
327     esac
328     ;;
330 *-darwin*)
331     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
332     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
333     ;;
335 *-linux*|*-kfreebsd*-gnu|*-gnu*)
336     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
337     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
338     ;;
341     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
342     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
343     ;;
344 esac
346 dnl ========================================================
347 dnl System overrides of the defaults for target
348 dnl ========================================================
350 case "$target" in
351 *-darwin*)
352     MOZ_OPTIMIZE_FLAGS="-O3"
353     DSO_LDOPTS=''
355     dnl DTrace and -dead_strip don't interact well. See bug 403132.
356     dnl ===================================================================
357     if test "x$enable_dtrace" = "xyes"; then
358         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
359     else
360         dnl check for the presence of the -dead_strip linker flag
361         AC_MSG_CHECKING([for -dead_strip option to ld])
362         _SAVE_LDFLAGS=$LDFLAGS
363         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
364         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
365         if test -n "$_HAVE_DEAD_STRIP" ; then
366             AC_MSG_RESULT([yes])
367             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
368         else
369             AC_MSG_RESULT([no])
370         fi
372         LDFLAGS=$_SAVE_LDFLAGS
373     fi
375     MOZ_FIX_LINK_PATHS=
376     ;;
378 *-android*|*-linuxandroid*)
379     if test -z "$CLANG_CC"; then
380         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
381     else
382         if test -n "$NIGHTLY_BUILD"; then
383             MOZ_OPTIMIZE_FLAGS="-O2"
384         else
385             # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
386             # -Oz is smaller than -Os on clang.
387             MOZ_OPTIMIZE_FLAGS="-Oz"
388             # Disable the outliner, which causes performance regressions, and is
389             # enabled on some platforms at -Oz.
390             if test -z "$MOZ_LTO"; then
391                 DISABLE_OUTLINER="-mno-outline"
392                 _SAVE_CFLAGS=$CFLAGS
393                 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
394                 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
395                 CFLAGS="$_SAVE_CFLAGS"
396             else
397                 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
398                 _SAVE_LDFLAGS=$LDFLAGS
399                 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
400                 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
401                 LDFLAGS="$_SAVE_LDFLAGS" 
402             fi
403         fi
404     fi
405     ;;
407 *-*linux*)
408     if test "$GNU_CC" -o "$GNU_CXX"; then
409         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
410         if test -n "$MOZ_DEBUG"; then
411             MOZ_OPTIMIZE_FLAGS="-Os"
412         else
413             MOZ_OPTIMIZE_FLAGS="-O2"
414         fi
415         if test -z "$CLANG_CC"; then
416            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
417         fi
418     fi
420     case "${target_cpu}" in
421     alpha*)
422         CFLAGS="$CFLAGS -mieee"
423         CXXFLAGS="$CXXFLAGS -mieee"
424     ;;
425     esac
426     ;;
427 *-mingw*)
428     DSO_PIC_CFLAGS=
429     # certain versions of cygwin's makedepend barf on the
430     # #include <string> vs -I./dist/include/string issue so don't use it
431     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
432         # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
433         if test -z "$CLANG_CC"; then
434             AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
435         fi
437         DSO_LDOPTS='-shared'
438         MOZ_FIX_LINK_PATHS=
440         MOZ_OPTIMIZE_FLAGS="-O2"
442         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
443         WIN32_GUI_EXE_LDFLAGS=-mwindows
445         # Silence problematic clang warnings
446         CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
447         LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
448     else
449         TARGET_COMPILER_ABI=msvc
450         # aarch64 doesn't support subsystems below 6.02
451         if test "$CPU_ARCH" = "aarch64"; then
452             WIN32_SUBSYSTEM_VERSION=6.02
453         else
454             WIN32_SUBSYSTEM_VERSION=6.01
455         fi
456         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
457         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
458         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
459         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
460         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
461         CFLAGS="$CFLAGS -Gy -Zc:inline"
462         CXXFLAGS="$CXXFLAGS -Gy -Zc:inline"
463         if test "$CPU_ARCH" = "x86"; then
464             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
465             dnl more recent, so set that explicitly here unless another
466             dnl target arch has already been set.
467             changequote(,)
468             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
469               CFLAGS="$CFLAGS -arch:SSE2"
470             fi
471             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
472               CXXFLAGS="$CXXFLAGS -arch:SSE2"
473             fi
474             changequote([,])
475         fi
476         dnl VS2013+ supports -Gw for better linker optimizations.
477         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
478         dnl Disabled on ASan because it causes false-positive ODR violations.
479         if test -z "$MOZ_ASAN"; then
480             CFLAGS="$CFLAGS -Gw"
481             CXXFLAGS="$CXXFLAGS -Gw"
482         else
483             # String tail merging doesn't play nice with ASan's ODR checker.
484             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
485         fi
486         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
487         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
488         MOZ_DEBUG_LDFLAGS='-DEBUG'
489         if test "$HOST_OS_ARCH" != "WINNT"; then
490           # %_PDB% is a special signal to emit only the PDB basename. This
491           # avoids problems in Windows tools that don't like forward-slashes.
492           MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
493         fi
494         MOZ_OPTIMIZE_FLAGS='-O2'
495         MOZ_FIX_LINK_PATHS=
496         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
497     fi
498     AC_DEFINE(WIN32_LEAN_AND_MEAN)
499     dnl See http://support.microsoft.com/kb/143208 to use STL
500     AC_DEFINE(NOMINMAX)
501     BIN_SUFFIX='.exe'
503     case "$host_os" in
504     cygwin*|msvc*|mks*)
505         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.])
506         ;;
507     esac
509     case "$target" in
510     i*86-*)
511         if test -n "$GNU_CC"; then
512             CFLAGS="$CFLAGS -mstackrealign"
513             CXXFLAGS="$CXXFLAGS -mstackrealign"
514             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
515         else
516             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
517             LDFLAGS="$LDFLAGS -SAFESEH"
518         fi
520         AC_DEFINE(_X86_)
521         ;;
522     x86_64-*)
523         if test -n "$_WIN32_MSVC"; then
524             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
525         fi
526         AC_DEFINE(_AMD64_)
527         ;;
528     aarch64-*)
529         if test -n "$_WIN32_MSVC"; then
530             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
531         fi
532         AC_DEFINE(_ARM64_)
533         ;;
534     *)
535         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
536         ;;
537     esac
538     ;;
540 *-netbsd*)
541     CFLAGS="$CFLAGS -Dunix"
542     CXXFLAGS="$CXXFLAGS -Dunix"
543     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
544         DSO_PIC_CFLAGS='-fPIC -DPIC'
545         DSO_LDOPTS='-shared'
546         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
547     else
548         DSO_PIC_CFLAGS='-fPIC -DPIC'
549         DSO_LDOPTS='-shared'
550     fi
551     # This will fail on a.out systems prior to 1.5.1_ALPHA.
552     if test "$LIBRUNPATH"; then
553         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
554     fi
555     ;;
557 *-openbsd*)
558     if test -z "$X11BASE"; then
559         X11BASE=/usr/X11R6
560     fi
561     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
562     DSO_PIC_CFLAGS='-fPIC'
563     DSO_LDOPTS='-shared -fPIC'
564     if test "$LIBRUNPATH"; then
565         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
566     fi
567     ;;
569 *-solaris*)
570     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
571     ;;
573 esac
575 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
576 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
578 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
579     MOZ_OPTIMIZE_FLAGS="-O"
583 if test -z "$COMPILE_ENVIRONMENT"; then
584     SKIP_COMPILER_CHECKS=1
585     SKIP_LIBRARY_CHECKS=1
586     MOZ_DEBUGGING_OPTS
587 else
588     MOZ_COMPILER_OPTS
589 fi # COMPILE_ENVIRONMENT
591 if test -z "$SKIP_COMPILER_CHECKS"; then
592 dnl Checks for typedefs, structures, and compiler characteristics.
593 dnl ========================================================
594 AC_C_CONST
595 AC_TYPE_MODE_T
596 AC_TYPE_OFF_T
597 AC_TYPE_PID_T
598 AC_TYPE_SIZE_T
599 AC_LANG_CPLUSPLUS
600 AC_LANG_C
602 AC_LANG_CPLUSPLUS
604 MOZ_CXX11
606 AC_LANG_C
608 dnl Checks for header files.
609 dnl ========================================================
610 AC_HEADER_DIRENT
612 dnl Checks for libraries.
613 dnl ========================================================
614 AC_CHECK_LIB(c_r, gethostbyname_r)
616 dnl We don't want to link with libdl even if it's present on OS X, since
617 dnl it's not used and not part of the default installation. OS/2 has dlfcn
618 dnl in libc.
619 dnl We don't want to link against libm or libpthread on Darwin since
620 dnl they both are just symlinks to libSystem and explicitly linking
621 dnl against libSystem causes issues when debugging (see bug 299601).
622 case $target in
623 *-darwin*)
624     ;;
626     AC_SEARCH_LIBS(dlopen, dl,
627         MOZ_CHECK_HEADER(dlfcn.h,
628         AC_DEFINE(HAVE_DLOPEN)))
629     ;;
630 esac
632 _SAVE_CFLAGS="$CFLAGS"
633 CFLAGS="$CFLAGS -D_GNU_SOURCE"
634 AC_CHECK_FUNCS(dladdr)
635 CFLAGS="$_SAVE_CFLAGS"
637 if test ! "$GNU_CXX"; then
638     AC_CHECK_LIB(C, demangle)
641 AC_CHECK_LIB(socket, socket)
643 dnl ========================================================
644 dnl = pthread support
645 dnl = Start by checking whether the system support pthreads
646 dnl ========================================================
647 case "$target_os" in
648 darwin*)
649     MOZ_USE_PTHREADS=1
650     ;;
652     AC_CHECK_LIB(pthreads, pthread_create,
653         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
654         AC_CHECK_LIB(pthread, pthread_create,
655             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
656             AC_CHECK_LIB(c_r, pthread_create,
657                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
658                 AC_CHECK_LIB(c, pthread_create,
659                     MOZ_USE_PTHREADS=1
660                 )
661             )
662         )
663     )
664     ;;
665 esac
667 dnl ========================================================
668 dnl Do the platform specific pthread hackery
669 dnl ========================================================
670 if test "$MOZ_USE_PTHREADS"x != x
671 then
672     dnl
673     dnl See if -pthread is supported.
674     dnl
675     rm -f conftest*
676     ac_cv_have_dash_pthread=no
677     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
678     echo 'int main() { return 0; }' | cat > conftest.c
679     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
680     if test $? -eq 0; then
681         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
682             ac_cv_have_dash_pthread=yes
683             case "$target_os" in
684             freebsd*)
685 # Freebsd doesn't use -pthread for compiles, it uses them for linking
686                 ;;
687             *)
688                 CFLAGS="$CFLAGS -pthread"
689                 CXXFLAGS="$CXXFLAGS -pthread"
690                 ;;
691             esac
692         fi
693     fi
694     rm -f conftest*
695     AC_MSG_RESULT($ac_cv_have_dash_pthread)
697     dnl
698     dnl See if -pthreads is supported.
699     dnl
700     ac_cv_have_dash_pthreads=no
701     if test "$ac_cv_have_dash_pthread" = "no"; then
702         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
703         echo 'int main() { return 0; }' | cat > conftest.c
704         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
705         if test $? -eq 0; then
706             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
707                 ac_cv_have_dash_pthreads=yes
708                 CFLAGS="$CFLAGS -pthreads"
709                 CXXFLAGS="$CXXFLAGS -pthreads"
710             fi
711         fi
712         rm -f conftest*
713         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
714     fi
716     case "$target" in
717         *-*-freebsd*)
718             AC_DEFINE(_REENTRANT)
719             AC_DEFINE(_THREAD_SAFE)
720             dnl -pthread links in -lpthread, so don't specify it explicitly.
721             if test "$ac_cv_have_dash_pthread" = "yes"; then
722                 _PTHREAD_LDFLAGS="-pthread"
723             fi
724             ;;
726         *-*-openbsd*|*-*-bsdi*)
727             AC_DEFINE(_REENTRANT)
728             AC_DEFINE(_THREAD_SAFE)
729             dnl -pthread links in -lc_r, so don't specify it explicitly.
730             if test "$ac_cv_have_dash_pthread" = "yes"; then
731                 _PTHREAD_LDFLAGS="-pthread"
732             fi
733             ;;
735         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
736             AC_DEFINE(_REENTRANT)
737             ;;
739     esac
740     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
741     AC_SUBST(MOZ_USE_PTHREADS)
742     MOZ_CHECK_HEADERS(pthread.h)
746 dnl Checks for library functions.
747 dnl ========================================================
749 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
750 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
751                ac_cv_clock_monotonic,
752                [for libs in "" -lrt; do
753                     _SAVE_LIBS="$LIBS"
754                     LIBS="$LIBS $libs"
755 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
756 dnl we should or not be able to use it. To detect if we can, we need to make the
757 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
758                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
759                                  #include <time.h>],
760                                  [ struct timespec ts;
761                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
762                                  ac_cv_clock_monotonic=$libs
763                                  LIBS="$_SAVE_LIBS"
764                                  break,
765                                  ac_cv_clock_monotonic=no)
766                     LIBS="$_SAVE_LIBS"
767                 done])
768 if test "$ac_cv_clock_monotonic" != "no"; then
769     HAVE_CLOCK_MONOTONIC=1
770     REALTIME_LIBS=$ac_cv_clock_monotonic
771     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
772     AC_SUBST(HAVE_CLOCK_MONOTONIC)
773     AC_SUBST_LIST(REALTIME_LIBS)
776 AC_CACHE_CHECK(
777     [for res_ninit()],
778     ac_cv_func_res_ninit,
779     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
780         dnl no need for res_ninit() on NetBSD and OpenBSD
781         ac_cv_func_res_ninit=no
782      else
783         AC_TRY_LINK([
784             #ifdef linux
785             #define _BSD_SOURCE 1
786             #endif
787             #include <sys/types.h>
788             #include <netinet/in.h>
789             #include <arpa/nameser.h>
790             #include <resolv.h>
791             ],
792             [int foo = res_ninit(&_res);],
793             [ac_cv_func_res_ninit=yes],
794             [ac_cv_func_res_ninit=no])
795      fi
796     ])
798 if test "$ac_cv_func_res_ninit" = "yes"; then
799     AC_DEFINE(HAVE_RES_NINIT)
800 dnl must add the link line we do something as foolish as this... dougt
801 dnl else
802 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
803 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
806 AC_LANG_C
808 dnl ===================================================================
809 dnl ========================================================
810 dnl Put your C++ language/feature checks below
811 dnl ========================================================
812 AC_LANG_CPLUSPLUS
814 ARM_ABI_PREFIX=
815 if test "$GNU_CC"; then
816   if test "$CPU_ARCH" = "arm" ; then
817     AC_CACHE_CHECK(for ARM EABI,
818         ac_cv_gcc_arm_eabi,
819         [AC_TRY_COMPILE([],
820                         [
821 #if defined(__ARM_EABI__)
822   return 0;
823 #else
824 #error Not ARM EABI.
825 #endif
826                         ],
827                         ac_cv_gcc_arm_eabi="yes",
828                         ac_cv_gcc_arm_eabi="no")])
829     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
830         HAVE_ARM_EABI=1
831         ARM_ABI_PREFIX=eabi-
832     else
833         ARM_ABI_PREFIX=oabi-
834     fi
835   fi
837   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
840 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
841 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
842 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
843 # linking XUL.
844 _SAVE_LDFLAGS=$LDFLAGS
845 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
846 AC_CACHE_CHECK(for __thread keyword for TLS variables,
847                ac_cv_thread_keyword,
848                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
849                             [return tlsIsMainThread;],
850                             ac_cv_thread_keyword=yes,
851                             ac_cv_thread_keyword=no)])
852 LDFLAGS=$_SAVE_LDFLAGS
853 # The custom dynamic linker doesn't support TLS variables
854 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
855   # mips builds fail with TLS variables because of a binutils bug.
856   # See bug 528687
857   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
858   case "${target}" in
859     mips*-*)
860       :
861       ;;
862     *-android*|*-linuxandroid*)
863       :
864       ;;
865     *-openbsd*)
866       :
867       ;;
868     *)
869       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
870       ;;
871   esac
874 if test -n "$MOZ_LINKER"; then
875 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
876 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
877 dnl Since the linker only understands the sysv ones, no need to build the
878 dnl gnu style tables anyways.
879   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
882 dnl End of C++ language/feature checks
883 AC_LANG_C
885 fi # ! SKIP_COMPILER_CHECKS
887 if test -n "${COMPILE_ENVIRONMENT}"; then
888   MOZ_CHECK_ALLOCATOR
891 TARGET_XPCOM_ABI=
892 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
893     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
894     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
897 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
898 dnl features that Windows actually does support.
900 if test -n "$SKIP_COMPILER_CHECKS"; then
901    dnl Windows has malloc.h
902    AC_DEFINE(MALLOC_H, [<malloc.h>])
903    AC_DEFINE(HAVE_FORCEINLINE)
904 fi # SKIP_COMPILER_CHECKS
906 dnl Mozilla specific options
907 dnl ========================================================
908 dnl The macros used for command line options
909 dnl are defined in build/autoconf/altoptions.m4.
911 dnl ========================================================
912 dnl =
913 dnl = Application
914 dnl =
915 dnl ========================================================
917 MOZ_BRANDING_DIRECTORY=
918 MOZ_OFFICIAL_BRANDING=
919 MOZ_NO_SMART_CARDS=
920 MOZ_BINARY_EXTENSIONS=
921 MOZ_DEVTOOLS=server
923 dnl ========================================================
924 dnl = Trademarked Branding
925 dnl ========================================================
926 MOZ_ARG_ENABLE_BOOL(official-branding,
927 [  --enable-official-branding
928                           Enable Official mozilla.org Branding
929                           Do not distribute builds with
930                           --enable-official-branding unless you have
931                           permission to use trademarks per
932                           http://www.mozilla.org/foundation/trademarks/ .],
933     MOZ_OFFICIAL_BRANDING=1,
934     MOZ_OFFICIAL_BRANDING=)
936 # Allow the application to influence configure with a confvars.sh script.
937 AC_MSG_CHECKING([if app-specific confvars.sh exists])
938 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
939   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
940   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
941 else
942   AC_MSG_RESULT([no])
945 AC_SUBST(MOZ_OFFICIAL_BRANDING)
946 if test -n "$MOZ_OFFICIAL_BRANDING"; then
947   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
948     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
949   else
950     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
951     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
952   fi
955 MOZ_ARG_WITH_STRING(branding,
956 [  --with-branding=dir     Use branding from the specified directory.],
957     MOZ_BRANDING_DIRECTORY=$withval)
959 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
960 if test -z "$REAL_BRANDING_DIRECTORY"; then
961   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
964 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
965   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
968 AC_SUBST(MOZ_BRANDING_DIRECTORY)
970 dnl ========================================================
971 dnl = Distribution ID
972 dnl ========================================================
973 MOZ_ARG_WITH_STRING(distribution-id,
974 [  --with-distribution-id=ID
975                           Set distribution-specific id (default=org.mozilla)],
976 [ val=`echo $withval`
977     MOZ_DISTRIBUTION_ID="$val"])
979 if test -z "$MOZ_DISTRIBUTION_ID"; then
980    MOZ_DISTRIBUTION_ID="org.mozilla"
983 AC_SUBST(MOZ_DISTRIBUTION_ID)
985 dnl ========================================================
986 dnl = Enable code optimization. ON by default.
987 dnl ========================================================
989 # Use value from moz.configure if one is defined. Else use our computed
990 # value.
991 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
992     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
995 if test "$COMPILE_ENVIRONMENT"; then
996 if test -n "$MOZ_OPTIMIZE"; then
997     AC_MSG_CHECKING([for valid C compiler optimization flags])
998     _SAVE_CFLAGS=$CFLAGS
999     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1000     AC_TRY_COMPILE([#include <stdio.h>],
1001         [printf("Hello World\n");],
1002         _results=yes,
1003         _results=no)
1004     AC_MSG_RESULT([$_results])
1005     if test "$_results" = "no"; then
1006         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1007     fi
1008     CFLAGS=$_SAVE_CFLAGS
1009     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1010         # When using llvm-based LTO, non numeric optimization levels are
1011         # not supported by the linker, so force the linker to use -O2 (
1012         # which doesn't influence the level compilation units are actually
1013         # compiled at).
1014         case " $MOZ_OPTIMIZE_FLAGS " in
1015         *\ -Os\ *|*\ -Oz\ *)
1016             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1017             ;;
1018         esac
1019     fi
1021 fi # COMPILE_ENVIRONMENT
1023 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1024 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1025 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1027 case "${OS_TARGET}" in
1028 Android|WINNT|Darwin)
1029   MOZ_GLUE_IN_PROGRAM=
1030   ;;
1032   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1033   MOZ_GLUE_IN_PROGRAM=1
1034   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1035   ;;
1036 esac
1038 dnl ========================================================
1039 dnl = Jemalloc build setup
1040 dnl ========================================================
1041 if test -z "$MOZ_MEMORY"; then
1042   case "${target}" in
1043     *-mingw*)
1044       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1045         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.])
1046       fi
1047       ;;
1048   esac
1049 else
1050   dnl The generic feature tests that determine how to compute ncpus are long and
1051   dnl complicated.  Therefore, simply define special cpp variables for the
1052   dnl platforms we have special knowledge of.
1053   case "${target}" in
1054   *-mingw*)
1055     export MOZ_NO_DEBUG_RTL=1
1056     ;;
1057   esac
1058 fi # MOZ_MEMORY
1059 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1061 dnl ========================================================
1062 dnl = Enable using the clang plugin to build
1063 dnl ========================================================
1065 if test -n "$COMPILE_ENVIRONMENT"; then
1066 MOZ_CONFIG_CLANG_PLUGIN
1067 fi # COMPILE_ENVIRONMENT
1069 if test -z "$SKIP_COMPILER_CHECKS"; then
1070 dnl ========================================================
1071 dnl Check for gcc -pipe support
1072 dnl ========================================================
1073 AC_MSG_CHECKING([for -pipe support])
1074 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1075     dnl Any gcc that supports firefox supports -pipe.
1076     CFLAGS="$CFLAGS -pipe"
1077     CXXFLAGS="$CXXFLAGS -pipe"
1078     AC_MSG_RESULT([yes])
1079 else
1080     AC_MSG_RESULT([no])
1083 fi # ! SKIP_COMPILER_CHECKS
1085 AC_LANG_C
1087 if test "$COMPILE_ENVIRONMENT"; then
1088 MOZ_EXPAND_LIBS
1089 fi # COMPILE_ENVIRONMENT
1091 dnl ========================================================
1092 dnl Check if we need the 32-bit Linux SSE2 error dialog
1093 dnl ========================================================
1095 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1097 dnl ========================================================
1098 dnl Check for cairo
1099 dnl ========================================================
1101 if test "$OS_ARCH" = "WINNT"; then
1102     # For now we assume that we will have a uint64_t available through
1103     # one of the above headers or mozstdint.h.
1104     AC_DEFINE(HAVE_UINT64_T)
1107 case "$MOZ_WIDGET_TOOLKIT" in
1108   windows)
1109     if test "$COMPILE_ENVIRONMENT"; then
1110       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1111     fi
1112     ;;
1113 esac
1114 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1116 dnl ========================================================
1117 dnl =
1118 dnl = Maintainer debug option (no --enable equivalent)
1119 dnl =
1120 dnl ========================================================
1122 AC_SUBST_LIST(ASFLAGS)
1123 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1125 AC_SUBST(MOZ_STUB_INSTALLER)
1127 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1129 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1131 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1132   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1135 dnl ========================================================
1136 dnl = Mac bundle name prefix
1137 dnl ========================================================
1138 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1139 [  --with-macbundlename-prefix=prefix
1140                           Prefix for MOZ_MACBUNDLE_NAME],
1141 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1143 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1144 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1145   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1148 if test "$MOZ_DEBUG"; then
1149   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1150 else
1151   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1153 AC_SUBST(MOZ_MACBUNDLE_NAME)
1155 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1156 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1157 # Otherwise, use MOZ_APP_DISPLAYNAME
1158 if test -z "$MOZ_MACBUNDLE_ID"; then
1159    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1161 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1162 if test "$MOZ_DEBUG"; then
1163   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1166 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1167 AC_SUBST(MOZ_MACBUNDLE_ID)
1169 dnl ========================================================
1170 dnl = Child Process Name for IPC
1171 dnl ========================================================
1172 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1173   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1174 else
1175   # We want to let Android unpack the file at install time, but it only does
1176   # so if the file is named libsomething.so. The lib/ path is also required
1177   # because the unpacked file will be under the lib/ subdirectory and will
1178   # need to be executed from that path.
1179   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1181 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1182 MOZ_CHILD_PROCESS_BUNDLEID=${MOZ_DISTRIBUTION_ID}.plugincontainer
1183 MOZ_CHILD_PROCESS_BUNDLENAME="plugin-container.app"
1184 MOZ_CHILD_PROCESS_APPNAME="${MOZ_APP_DISPLAYNAME}CP"
1186 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1187 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1188 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLEID)
1189 AC_SUBST(MOZ_CHILD_PROCESS_APPNAME)
1190 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1192 dnl ==========================================================
1193 dnl = Mac Media Plugin Helper (GMP Child) Process Name for IPC
1194 dnl ==========================================================
1195 MOZ_EME_PROCESS_NAME="media-plugin-helper"
1196 MOZ_EME_PROCESS_NAME_BRANDED="$MOZ_APP_DISPLAYNAME Media Plugin Helper"
1197 MOZ_EME_PROCESS_BUNDLENAME="${MOZ_EME_PROCESS_NAME}.app"
1198 # Generate a lower case string with no spaces to be used as the bundle ID
1199 # for the EME helper .app of the form org.mozilla.<executable-name>.
1200 MOZ_EME_PROCESS_BUNDLEID=`echo "$MOZ_APP_DISPLAYNAME" | tr ' ' '-'`
1201 MOZ_EME_PROCESS_BUNDLEID=`echo "$MOZ_EME_PROCESS_BUNDLEID" | tr 'A-Z' 'a-z'`
1202 MOZ_EME_PROCESS_BUNDLEID=${MOZ_EME_PROCESS_BUNDLEID}-${MOZ_EME_PROCESS_NAME}
1203 MOZ_EME_PROCESS_BUNDLEID=${MOZ_DISTRIBUTION_ID}.${MOZ_EME_PROCESS_BUNDLEID}
1205 AC_SUBST(MOZ_EME_PROCESS_NAME)
1206 AC_SUBST(MOZ_EME_PROCESS_NAME_BRANDED)
1207 AC_SUBST(MOZ_EME_PROCESS_BUNDLENAME)
1208 AC_SUBST(MOZ_EME_PROCESS_BUNDLEID)
1210 # The following variables are available to branding and application
1211 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1212 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1213 # impacts profile location and user-visible fields.
1214 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1215 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1216 # builds (e.g. Aurora for Firefox).
1217 # - MOZ_APP_PROFILE: When set, used for application.ini's
1218 # "Profile" field, which controls profile location.
1219 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1220 # crash reporter server url.
1221 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1223 # The following environment variables used to have an effect, but don't anymore:
1224 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1225 # the contents from the version.txt file in the application directory, or
1226 # browser/config/version.txt if there isn't one.
1227 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1228 # in the "About" window. This was replaced with the contents from the
1229 # version_display.txt or version.txt in the application directory, or
1230 # browser/config/version_display.txt.
1232 # For extensions and langpacks, we require a max version that is compatible
1233 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1234 # 24.0a1 and 24.0a2 aren't affected
1235 # 24.0 becomes 24.*
1236 # 24.1.1 becomes 24.*
1237 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1238 if test -z "$IS_ALPHA"; then
1239   changequote(,)
1240   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1241     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1242   else
1243     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1244   fi
1245   changequote([,])
1246 else
1247   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1250 AC_SUBST(MOZ_APP_DISPLAYNAME)
1251 AC_SUBST(MOZ_APP_VENDOR)
1252 AC_SUBST(MOZ_APP_PROFILE)
1253 AC_SUBST(MOZ_APP_ID)
1254 AC_SUBST(MAR_CHANNEL_ID)
1255 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1256 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1257 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1258 AC_SUBST(MOZ_APP_UA_NAME)
1259 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1260 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1261 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1263 AC_SUBST(MOZ_APP_MAXVERSION)
1264 AC_SUBST(MOZ_PKG_SPECIAL)
1265 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1267 if test "$MOZILLA_OFFICIAL"; then
1268     # Build revisions should always be present in official builds
1269     MOZ_INCLUDE_SOURCE_INFO=1
1272 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1273 # explicitly set the repository and changeset information in.
1274 AC_SUBST(MOZ_SOURCE_REPO)
1275 AC_SUBST(MOZ_SOURCE_CHANGESET)
1276 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1278 dnl win32 options
1279 AC_SUBST(WIN32_REDIST_DIR)
1280 AC_SUBST(WIN_UCRT_REDIST_DIR)
1282 dnl Echo the CFLAGS to remove extra whitespace.
1283 CFLAGS=`echo \
1284     $_COMPILATION_CFLAGS \
1285     $CFLAGS`
1287 CXXFLAGS=`echo \
1288     $_COMPILATION_CXXFLAGS \
1289     $CXXFLAGS`
1291 COMPILE_CFLAGS=`echo \
1292     $_DEFINES_CFLAGS \
1293     $COMPILE_CFLAGS`
1295 COMPILE_CXXFLAGS=`echo \
1296     $_DEFINES_CXXFLAGS \
1297     $COMPILE_CXXFLAGS`
1299 HOST_CFLAGS=`echo \
1300     $_COMPILATION_HOST_CFLAGS \
1301     $HOST_CFLAGS`
1303 HOST_CXXFLAGS=`echo \
1304     $_COMPILATION_HOST_CXXFLAGS \
1305     $HOST_CXXFLAGS`
1307 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1308 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1309 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1310 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1311 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1312   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1313   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1315 AC_SUBST(HOST_CMFLAGS)
1316 AC_SUBST(HOST_CMMFLAGS)
1317 AC_SUBST(OS_COMPILE_CMFLAGS)
1318 AC_SUBST(OS_COMPILE_CMMFLAGS)
1320 OS_CFLAGS="$CFLAGS"
1321 OS_CXXFLAGS="$CXXFLAGS"
1322 OS_CPPFLAGS="$CPPFLAGS"
1323 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1324 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1325 OS_LDFLAGS="$LDFLAGS"
1326 OS_LIBS="$LIBS"
1327 AC_SUBST_LIST(OS_CFLAGS)
1328 AC_SUBST_LIST(OS_CXXFLAGS)
1329 AC_SUBST_LIST(OS_CPPFLAGS)
1330 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1331 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1332 AC_SUBST_LIST(OS_LDFLAGS)
1333 AC_SUBST(OS_LIBS)
1335 AC_SUBST(HOST_CC)
1336 AC_SUBST(HOST_CXX)
1337 AC_SUBST_LIST(HOST_CFLAGS)
1338 AC_SUBST_LIST(HOST_CPPFLAGS)
1339 AC_SUBST_LIST(HOST_CXXFLAGS)
1340 AC_SUBST(HOST_LDFLAGS)
1341 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1342 AC_SUBST(HOST_BIN_SUFFIX)
1344 AC_SUBST(TARGET_XPCOM_ABI)
1346 AC_SUBST(DSO_LDOPTS)
1347 AC_SUBST(BIN_SUFFIX)
1348 AC_SUBST(USE_N32)
1349 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1350 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1352 AC_SUBST(MOZ_DEVTOOLS)
1354 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1356 AC_SUBST(DMG_TOOL)
1358 dnl Host JavaScript runtime, if any, to use during cross compiles.
1359 AC_SUBST(JS_BINARY)
1361 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1363 dnl Set various defines and substitutions
1364 dnl ========================================================
1366 AC_SUBST(MOZ_DEV_EDITION)
1367 if test -n "$MOZ_DEV_EDITION"; then
1368     AC_DEFINE(MOZ_DEV_EDITION)
1371 dnl Spit out some output
1372 dnl ========================================================
1374 # Avoid using obsolete NSPR features
1375 AC_DEFINE(NO_NSPR_10_SUPPORT)
1377 MOZ_CREATE_CONFIG_STATUS()
1379 rm -fr confdefs* $ac_clean_files