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