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