Bug 1879109 [wpt PR 44441] - Add tests for animation of CSS calc-size()., a=testonly
[gecko.git] / old-configure.in
blobb57348bcc3ea75d62ff92a82589919ec925171c6
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=0A00
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 "$TARGET_CPU" != "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     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0A00)
153     ;;
154 esac
156 if test -n "$_WIN32_MSVC"; then
157     SKIP_PATH_CHECKS=1
158     SKIP_COMPILER_CHECKS=1
159     SKIP_LIBRARY_CHECKS=1
161     # Since we're skipping compiler and library checks, hard-code
162     # some facts here.
163     AC_DEFINE(HAVE_IO_H)
164     AC_DEFINE(HAVE_ISATTY)
167 fi # COMPILE_ENVIRONMENT
169 AC_SUBST(GNU_CC)
170 AC_SUBST(GNU_CXX)
172 dnl ========================================================
173 dnl set the defaults first
174 dnl ========================================================
175 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
177 dnl Configure platform-specific CPU architecture compiler options.
178 dnl ==============================================================
179 if test "$COMPILE_ENVIRONMENT"; then
180     MOZ_ARCH_OPTS
181 fi # COMPILE_ENVIRONMENT
183 if test -n "$COMPILE_ENVIRONMENT"; then
184    MOZ_CONFIG_SANITIZE
187 dnl ========================================================
188 dnl GNU specific defaults
189 dnl ========================================================
190 if test "$GNU_CC"; then
191     if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
192         DSO_PIC_CFLAGS='-fPIC'
193         ASFLAGS="$ASFLAGS -fPIC"
194     fi
196     AC_MSG_CHECKING([for --noexecstack option to as])
197     _SAVE_CFLAGS=$CFLAGS
198     CFLAGS="$CFLAGS -Wa,--noexecstack"
199     AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
200                      [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
201                      AC_MSG_RESULT([no]))
202     CFLAGS=$_SAVE_CFLAGS
204     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
205     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
206     _SAVE_LDFLAGS=$LDFLAGS
207     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
208     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
209                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
210                   AC_MSG_RESULT([no]))
211     LDFLAGS=$_SAVE_LDFLAGS
213     DSO_LDOPTS='-shared'
214     if test "$GCC_USE_GNU_LD"; then
215         # Some tools like ASan use a runtime library that is only
216         # linked against executables, so we must allow undefined
217         # symbols for shared objects in some cases.
218         if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
219             # Don't allow undefined symbols in libraries
220             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
222             # BSDs need `environ' exposed for posix_spawn (bug 753046)
223             case "$OS_TARGET" in
224             DragonFly|FreeBSD|NetBSD|OpenBSD)
225                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
226                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
227                 else
228                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
229                 fi
230                 ;;
231             esac
232         fi
233     fi
235     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
237     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
240 if test "$GNU_CXX"; then
241     CXXFLAGS="$CXXFLAGS -fno-exceptions"
243     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
246 dnl ========================================================
247 dnl System overrides of the defaults for host
248 dnl ========================================================
249 case "$host" in
250 *mingw*)
251     if test -n "$_WIN32_MSVC"; then
252         HOST_CFLAGS="$HOST_CFLAGS"
253     else
254         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
255     fi
256     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
257     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
258     HOST_BIN_SUFFIX=.exe
260     case "${host_cpu}" in
261     i*86)
262         if test -n "$_WIN32_MSVC"; then
263             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
264         fi
265         ;;
266     x86_64)
267         if test -n "$_WIN32_MSVC"; then
268             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
269         fi
270         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
271         ;;
272     esac
273     ;;
275 *-darwin*)
276     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
277     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
278     ;;
280 *-linux*|*-kfreebsd*-gnu|*-gnu*)
281     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
282     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
283     ;;
286     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
287     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
288     ;;
289 esac
291 dnl ========================================================
292 dnl System overrides of the defaults for target
293 dnl ========================================================
295 case "$target" in
296 *-darwin*)
297     MOZ_OPTIMIZE_FLAGS="-O3"
298     DSO_LDOPTS=''
300     dnl DTrace and -dead_strip don't interact well. See bug 403132.
301     dnl ===================================================================
302     if test "x$enable_dtrace" = "xyes"; then
303         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
304     else
305         dnl check for the presence of the -dead_strip linker flag
306         AC_MSG_CHECKING([for -dead_strip option to ld])
307         _SAVE_LDFLAGS=$LDFLAGS
308         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
309         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
310         if test -n "$_HAVE_DEAD_STRIP" ; then
311             AC_MSG_RESULT([yes])
312             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
313         else
314             AC_MSG_RESULT([no])
315         fi
317         LDFLAGS=$_SAVE_LDFLAGS
318     fi
320     MOZ_FIX_LINK_PATHS=
321     ;;
323 *-android*|*-linuxandroid*)
324     # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
325     # -Oz is smaller than -Os on clang.
326     MOZ_OPTIMIZE_FLAGS="-Oz"
327     # Disable the outliner, which causes performance regressions, and is
328     # enabled on some platforms at -Oz.
329     if test -z "$MOZ_LTO"; then
330         DISABLE_OUTLINER="-mno-outline"
331         _SAVE_CFLAGS=$CFLAGS
332         CFLAGS="$CFLAGS $DISABLE_OUTLINER"
333         AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
334         CFLAGS="$_SAVE_CFLAGS"
335    else
336         DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
337         _SAVE_LDFLAGS=$LDFLAGS
338         LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
339         AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
340         LDFLAGS="$_SAVE_LDFLAGS"
341     fi
342     ;;
344 *-*linux*)
345     if test "$GNU_CC" -o "$GNU_CXX"; then
346         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
347         MOZ_OPTIMIZE_FLAGS="-O2"
348     fi
350     case "${target_cpu}" in
351     alpha*)
352         CFLAGS="$CFLAGS -mieee"
353         CXXFLAGS="$CXXFLAGS -mieee"
354     ;;
355     esac
356     ;;
357 *-mingw*)
358     DSO_PIC_CFLAGS=
359     # certain versions of cygwin's makedepend barf on the
360     # #include <string> vs -I./dist/include/string issue so don't use it
361     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
362         # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
363         if test -z "$CLANG_CC"; then
364             AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
365         fi
367         DSO_LDOPTS='-shared'
368         MOZ_FIX_LINK_PATHS=
370         MOZ_OPTIMIZE_FLAGS="-O2"
372         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
373         WIN32_GUI_EXE_LDFLAGS=-mwindows
375         # Silence problematic clang warnings
376         CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
377         LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
378     else
379         TARGET_COMPILER_ABI=msvc
380         WIN32_SUBSYSTEM_VERSION=10.0
381         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
382         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
383         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
384         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
385         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
386         CFLAGS="$CFLAGS -Gy -Zc:inline"
387         CXXFLAGS="$CXXFLAGS -Gy -Zc:inline"
388         if test "$TARGET_CPU" = "x86"; then
389             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
390             dnl more recent, so set that explicitly here unless another
391             dnl target arch has already been set.
392             changequote(,)
393             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
394               CFLAGS="$CFLAGS -arch:SSE2"
395             fi
396             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
397               CXXFLAGS="$CXXFLAGS -arch:SSE2"
398             fi
399             changequote([,])
400         fi
401         dnl VS2013+ supports -Gw for better linker optimizations.
402         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
403         dnl Disabled on ASan because it causes false-positive ODR violations.
404         if test -z "$MOZ_ASAN"; then
405             CFLAGS="$CFLAGS -Gw"
406             CXXFLAGS="$CXXFLAGS -Gw"
407         else
408             # String tail merging doesn't play nice with ASan's ODR checker.
409             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
410         fi
411         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
412         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
413         MOZ_DEBUG_LDFLAGS='-DEBUG'
414         if test "$HOST_OS_ARCH" != "WINNT"; then
415           # %_PDB% is a special signal to emit only the PDB basename. This
416           # avoids problems in Windows tools that don't like forward-slashes.
417           MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
418         fi
419         MOZ_OPTIMIZE_FLAGS='-O2'
420         MOZ_FIX_LINK_PATHS=
421         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
422     fi
423     AC_DEFINE(WIN32_LEAN_AND_MEAN)
424     dnl See http://support.microsoft.com/kb/143208 to use STL
425     AC_DEFINE(NOMINMAX)
426     BIN_SUFFIX='.exe'
428     case "$host_os" in
429     cygwin*|msvc*|mks*)
430         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.])
431         ;;
432     esac
434     case "$target" in
435     i*86-*)
436         if test -n "$GNU_CC"; then
437             CFLAGS="$CFLAGS -mstackrealign"
438             CXXFLAGS="$CXXFLAGS -mstackrealign"
439             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
440         else
441             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
442             LDFLAGS="$LDFLAGS -SAFESEH"
443         fi
445         AC_DEFINE(_X86_)
446         ;;
447     x86_64-*)
448         if test -n "$_WIN32_MSVC"; then
449             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
450         fi
451         AC_DEFINE(_AMD64_)
452         ;;
453     aarch64-*)
454         if test -n "$_WIN32_MSVC"; then
455             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
456         fi
457         AC_DEFINE(_ARM64_)
458         ;;
459     *)
460         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
461         ;;
462     esac
463     ;;
465 *-netbsd*)
466     CFLAGS="$CFLAGS -Dunix"
467     CXXFLAGS="$CXXFLAGS -Dunix"
468     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
469         DSO_PIC_CFLAGS='-fPIC -DPIC'
470         DSO_LDOPTS='-shared'
471         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
472     else
473         DSO_PIC_CFLAGS='-fPIC -DPIC'
474         DSO_LDOPTS='-shared'
475     fi
476     # This will fail on a.out systems prior to 1.5.1_ALPHA.
477     if test "$LIBRUNPATH"; then
478         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
479     fi
480     ;;
482 *-openbsd*)
483     if test -z "$X11BASE"; then
484         X11BASE=/usr/X11R6
485     fi
486     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
487     DSO_PIC_CFLAGS='-fPIC'
488     DSO_LDOPTS='-shared -fPIC'
489     if test "$LIBRUNPATH"; then
490         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
491     fi
492     ;;
494 *-solaris*)
495     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
496     ;;
498 esac
500 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
501 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
503 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
504     MOZ_OPTIMIZE_FLAGS="-O"
508 if test -z "$COMPILE_ENVIRONMENT"; then
509     SKIP_COMPILER_CHECKS=1
510     SKIP_LIBRARY_CHECKS=1
511     MOZ_DEBUGGING_OPTS
512 else
513     MOZ_COMPILER_OPTS
514 fi # COMPILE_ENVIRONMENT
516 if test -z "$SKIP_COMPILER_CHECKS"; then
517 dnl Checks for typedefs, structures, and compiler characteristics.
518 dnl ========================================================
519 AC_C_CONST
520 AC_TYPE_MODE_T
521 AC_TYPE_OFF_T
522 AC_TYPE_PID_T
523 AC_TYPE_SIZE_T
524 AC_LANG_CPLUSPLUS
525 AC_LANG_C
527 AC_LANG_CPLUSPLUS
529 MOZ_CXX11
531 AC_LANG_C
533 dnl Checks for header files.
534 dnl ========================================================
535 AC_HEADER_DIRENT
537 dnl Checks for libraries.
538 dnl ========================================================
539 AC_CHECK_LIB(c_r, gethostbyname_r)
541 dnl We don't want to link with libdl even if it's present on OS X, since
542 dnl it's not used and not part of the default installation. OS/2 has dlfcn
543 dnl in libc.
544 dnl We don't want to link against libm or libpthread on Darwin since
545 dnl they both are just symlinks to libSystem and explicitly linking
546 dnl against libSystem causes issues when debugging (see bug 299601).
547 case $target in
548 *-darwin*)
549     ;;
551     AC_SEARCH_LIBS(dlopen, dl,
552         MOZ_CHECK_HEADER(dlfcn.h,
553         AC_DEFINE(HAVE_DLOPEN)))
554     ;;
555 esac
557 _SAVE_CFLAGS="$CFLAGS"
558 CFLAGS="$CFLAGS -D_GNU_SOURCE"
559 AC_CHECK_FUNCS(dladdr)
560 CFLAGS="$_SAVE_CFLAGS"
562 if test ! "$GNU_CXX"; then
563     AC_CHECK_LIB(C, demangle)
566 AC_CHECK_LIB(socket, socket)
568 dnl ========================================================
569 dnl = pthread support
570 dnl = Start by checking whether the system support pthreads
571 dnl ========================================================
572 case "$target_os" in
573 darwin*)
574     MOZ_USE_PTHREADS=1
575     ;;
577     AC_CHECK_LIB(pthreads, pthread_create,
578         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
579         AC_CHECK_LIB(pthread, pthread_create,
580             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
581             AC_CHECK_LIB(c_r, pthread_create,
582                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
583                 AC_CHECK_LIB(c, pthread_create,
584                     MOZ_USE_PTHREADS=1
585                 )
586             )
587         )
588     )
589     ;;
590 esac
592 dnl ========================================================
593 dnl Do the platform specific pthread hackery
594 dnl ========================================================
595 if test "$MOZ_USE_PTHREADS"x != x
596 then
597     dnl
598     dnl See if -pthread is supported.
599     dnl
600     rm -f conftest*
601     ac_cv_have_dash_pthread=no
602     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
603     echo 'int main() { return 0; }' | cat > conftest.c
604     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
605     if test $? -eq 0; then
606         if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
607             ac_cv_have_dash_pthread=yes
608             case "$target_os" in
609             freebsd*)
610 # Freebsd doesn't use -pthread for compiles, it uses them for linking
611                 ;;
612             *)
613                 CFLAGS="$CFLAGS -pthread"
614                 CXXFLAGS="$CXXFLAGS -pthread"
615                 ;;
616             esac
617         fi
618     fi
619     rm -f conftest*
620     AC_MSG_RESULT($ac_cv_have_dash_pthread)
622     dnl
623     dnl See if -pthreads is supported.
624     dnl
625     ac_cv_have_dash_pthreads=no
626     if test "$ac_cv_have_dash_pthread" = "no"; then
627         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
628         echo 'int main() { return 0; }' | cat > conftest.c
629         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
630         if test $? -eq 0; then
631             if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
632                 ac_cv_have_dash_pthreads=yes
633                 CFLAGS="$CFLAGS -pthreads"
634                 CXXFLAGS="$CXXFLAGS -pthreads"
635             fi
636         fi
637         rm -f conftest*
638         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
639     fi
641     case "$target" in
642         *-*-freebsd*)
643             AC_DEFINE(_REENTRANT)
644             AC_DEFINE(_THREAD_SAFE)
645             dnl -pthread links in -lpthread, so don't specify it explicitly.
646             if test "$ac_cv_have_dash_pthread" = "yes"; then
647                 _PTHREAD_LDFLAGS="-pthread"
648             fi
649             ;;
651         *-*-openbsd*|*-*-bsdi*)
652             AC_DEFINE(_REENTRANT)
653             AC_DEFINE(_THREAD_SAFE)
654             dnl -pthread links in -lc_r, so don't specify it explicitly.
655             if test "$ac_cv_have_dash_pthread" = "yes"; then
656                 _PTHREAD_LDFLAGS="-pthread"
657             fi
658             ;;
660         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
661             AC_DEFINE(_REENTRANT)
662             ;;
664     esac
665     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
666     AC_SUBST(MOZ_USE_PTHREADS)
667     MOZ_CHECK_HEADERS(pthread.h)
671 dnl Checks for library functions.
672 dnl ========================================================
674 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
675 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
676                ac_cv_clock_monotonic,
677                [for libs in "" -lrt; do
678                     _SAVE_LIBS="$LIBS"
679                     LIBS="$LIBS $libs"
680 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
681 dnl we should or not be able to use it. To detect if we can, we need to make the
682 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
683                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
684                                  #include <time.h>],
685                                  [ struct timespec ts;
686                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
687                                  ac_cv_clock_monotonic=$libs
688                                  LIBS="$_SAVE_LIBS"
689                                  break,
690                                  ac_cv_clock_monotonic=no)
691                     LIBS="$_SAVE_LIBS"
692                 done])
693 if test "$ac_cv_clock_monotonic" != "no"; then
694     HAVE_CLOCK_MONOTONIC=1
695     REALTIME_LIBS=$ac_cv_clock_monotonic
696     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
697     AC_SUBST(HAVE_CLOCK_MONOTONIC)
698     AC_SUBST_LIST(REALTIME_LIBS)
701 AC_CACHE_CHECK(
702     [for res_ninit()],
703     ac_cv_func_res_ninit,
704     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
705         dnl no need for res_ninit() on NetBSD and OpenBSD
706         ac_cv_func_res_ninit=no
707      else
708         AC_TRY_LINK([
709             #ifdef linux
710             #define _BSD_SOURCE 1
711             #endif
712             #include <sys/types.h>
713             #include <netinet/in.h>
714             #include <arpa/nameser.h>
715             #include <resolv.h>
716             ],
717             [int foo = res_ninit(&_res);],
718             [ac_cv_func_res_ninit=yes],
719             [ac_cv_func_res_ninit=no])
720      fi
721     ])
723 if test "$ac_cv_func_res_ninit" = "yes"; then
724     AC_DEFINE(HAVE_RES_NINIT)
725 dnl must add the link line we do something as foolish as this... dougt
726 dnl else
727 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
728 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
731 AC_LANG_C
733 dnl ===================================================================
734 dnl ========================================================
735 dnl Put your C++ language/feature checks below
736 dnl ========================================================
737 AC_LANG_CPLUSPLUS
739 ARM_ABI_PREFIX=
740 if test "$GNU_CC"; then
741   if test "$TARGET_CPU" = "arm" ; then
742     AC_CACHE_CHECK(for ARM EABI,
743         ac_cv_gcc_arm_eabi,
744         [AC_TRY_COMPILE([],
745                         [
746 #if defined(__ARM_EABI__)
747   return 0;
748 #else
749 #error Not ARM EABI.
750 #endif
751                         ],
752                         ac_cv_gcc_arm_eabi="yes",
753                         ac_cv_gcc_arm_eabi="no")])
754     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
755         HAVE_ARM_EABI=1
756         ARM_ABI_PREFIX=eabi-
757     else
758         ARM_ABI_PREFIX=oabi-
759     fi
760   fi
762   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
765 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
766 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
767 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
768 # linking XUL.
769 _SAVE_LDFLAGS=$LDFLAGS
770 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
771 AC_CACHE_CHECK(for __thread keyword for TLS variables,
772                ac_cv_thread_keyword,
773                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
774                             [return tlsIsMainThread;],
775                             ac_cv_thread_keyword=yes,
776                             ac_cv_thread_keyword=no)])
777 LDFLAGS=$_SAVE_LDFLAGS
778 # The custom dynamic linker doesn't support TLS variables
779 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
780   # mips builds fail with TLS variables because of a binutils bug.
781   # See bug 528687
782   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
783   case "${target}" in
784     mips*-*)
785       :
786       ;;
787     *-android*|*-linuxandroid*)
788       :
789       ;;
790     *-openbsd*)
791       :
792       ;;
793     *)
794       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
795       ;;
796   esac
799 if test -n "$MOZ_LINKER"; then
800 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
801 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
802 dnl Since the linker only understands the sysv ones, no need to build the
803 dnl gnu style tables anyways.
804   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
807 dnl End of C++ language/feature checks
808 AC_LANG_C
810 fi # ! SKIP_COMPILER_CHECKS
812 if test -n "${COMPILE_ENVIRONMENT}"; then
813   MOZ_CHECK_ALLOCATOR
816 TARGET_XPCOM_ABI=
817 if test -n "${TARGET_CPU}" -a -n "${TARGET_COMPILER_ABI}"; then
818     TARGET_XPCOM_ABI="${TARGET_CPU}-${TARGET_COMPILER_ABI}"
819     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
822 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
823 dnl features that Windows actually does support.
825 if test -n "$SKIP_COMPILER_CHECKS"; then
826    dnl Windows has malloc.h
827    AC_DEFINE(MALLOC_H, [<malloc.h>])
828    AC_DEFINE(HAVE_FORCEINLINE)
829 fi # SKIP_COMPILER_CHECKS
831 dnl Mozilla specific options
832 dnl ========================================================
833 dnl The macros used for command line options
834 dnl are defined in build/autoconf/altoptions.m4.
836 dnl ========================================================
837 dnl =
838 dnl = Application
839 dnl =
840 dnl ========================================================
842 MOZ_BRANDING_DIRECTORY=
843 MOZ_OFFICIAL_BRANDING=
844 MOZ_NO_SMART_CARDS=
845 MOZ_BINARY_EXTENSIONS=
846 MOZ_DEVTOOLS=server
848 dnl ========================================================
849 dnl = Trademarked Branding
850 dnl ========================================================
851 MOZ_ARG_ENABLE_BOOL(official-branding,
852 [  --enable-official-branding
853                           Enable Official mozilla.org Branding
854                           Do not distribute builds with
855                           --enable-official-branding unless you have
856                           permission to use trademarks per
857                           http://www.mozilla.org/foundation/trademarks/ .],
858     MOZ_OFFICIAL_BRANDING=1,
859     MOZ_OFFICIAL_BRANDING=)
861 # Allow the application to influence configure with a confvars.sh script.
862 AC_MSG_CHECKING([if app-specific confvars.sh exists])
863 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
864   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
865   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
866 else
867   AC_MSG_RESULT([no])
870 AC_SUBST(MOZ_OFFICIAL_BRANDING)
871 if test -n "$MOZ_OFFICIAL_BRANDING"; then
872   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
873     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
874   else
875     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
876     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
877   fi
880 MOZ_ARG_WITH_STRING(branding,
881 [  --with-branding=dir     Use branding from the specified directory.],
882     MOZ_BRANDING_DIRECTORY=$withval)
884 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
885 if test -z "$REAL_BRANDING_DIRECTORY"; then
886   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
889 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
890   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
893 AC_SUBST(MOZ_BRANDING_DIRECTORY)
895 dnl ========================================================
896 dnl = Distribution ID
897 dnl ========================================================
898 MOZ_ARG_WITH_STRING(distribution-id,
899 [  --with-distribution-id=ID
900                           Set distribution-specific id (default=org.mozilla)],
901 [ val=`echo $withval`
902     MOZ_DISTRIBUTION_ID="$val"])
904 if test -z "$MOZ_DISTRIBUTION_ID"; then
905    MOZ_DISTRIBUTION_ID="org.mozilla"
908 AC_SUBST(MOZ_DISTRIBUTION_ID)
910 dnl ========================================================
911 dnl = Enable code optimization. ON by default.
912 dnl ========================================================
914 # Use value from moz.configure if one is defined. Else use our computed
915 # value.
916 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
917     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
920 if test "$COMPILE_ENVIRONMENT"; then
921 if test -n "$MOZ_OPTIMIZE"; then
922     AC_MSG_CHECKING([for valid C compiler optimization flags])
923     _SAVE_CFLAGS=$CFLAGS
924     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
925     AC_TRY_COMPILE([#include <stdio.h>],
926         [printf("Hello World\n");],
927         _results=yes,
928         _results=no)
929     AC_MSG_RESULT([$_results])
930     if test "$_results" = "no"; then
931         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
932     fi
933     CFLAGS=$_SAVE_CFLAGS
934     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
935         # When using llvm-based LTO, non numeric optimization levels are
936         # not supported by the linker, so force the linker to use -O2 (
937         # which doesn't influence the level compilation units are actually
938         # compiled at).
939         case " $MOZ_OPTIMIZE_FLAGS " in
940         *\ -Os\ *|*\ -Oz\ *)
941             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
942             ;;
943         esac
944     fi
946 fi # COMPILE_ENVIRONMENT
948 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
949 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
950 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
952 case "${OS_TARGET}" in
953 Android|WINNT|Darwin)
954   MOZ_GLUE_IN_PROGRAM=
955   ;;
957   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
958   MOZ_GLUE_IN_PROGRAM=1
959   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
960   ;;
961 esac
963 dnl ========================================================
964 dnl = Jemalloc build setup
965 dnl ========================================================
966 if test -z "$MOZ_MEMORY"; then
967   case "${target}" in
968     *-mingw*)
969       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
970         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.])
971       fi
972       ;;
973   esac
974 else
975   dnl The generic feature tests that determine how to compute ncpus are long and
976   dnl complicated.  Therefore, simply define special cpp variables for the
977   dnl platforms we have special knowledge of.
978   case "${target}" in
979   *-mingw*)
980     export MOZ_NO_DEBUG_RTL=1
981     ;;
982   esac
983 fi # MOZ_MEMORY
984 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
986 dnl ========================================================
987 dnl = Enable using the clang plugin to build
988 dnl ========================================================
990 if test -n "$COMPILE_ENVIRONMENT"; then
991 MOZ_CONFIG_CLANG_PLUGIN
992 fi # COMPILE_ENVIRONMENT
994 if test -z "$SKIP_COMPILER_CHECKS"; then
995 dnl ========================================================
996 dnl Check for gcc -pipe support
997 dnl ========================================================
998 AC_MSG_CHECKING([for -pipe support])
999 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1000     dnl Any gcc that supports firefox supports -pipe.
1001     CFLAGS="$CFLAGS -pipe"
1002     CXXFLAGS="$CXXFLAGS -pipe"
1003     AC_MSG_RESULT([yes])
1004 else
1005     AC_MSG_RESULT([no])
1008 fi # ! SKIP_COMPILER_CHECKS
1010 AC_LANG_C
1012 if test "$COMPILE_ENVIRONMENT"; then
1013 MOZ_EXPAND_LIBS
1014 fi # COMPILE_ENVIRONMENT
1016 dnl ========================================================
1017 dnl Check if we need the 32-bit Linux SSE2 error dialog
1018 dnl ========================================================
1020 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1022 dnl ========================================================
1023 dnl Check for cairo
1024 dnl ========================================================
1026 if test "$OS_ARCH" = "WINNT"; then
1027     # For now we assume that we will have a uint64_t available through
1028     # one of the above headers or mozstdint.h.
1029     AC_DEFINE(HAVE_UINT64_T)
1032 case "$MOZ_WIDGET_TOOLKIT" in
1033   windows)
1034     if test "$COMPILE_ENVIRONMENT"; then
1035       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1036     fi
1037     ;;
1038 esac
1039 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1041 dnl ========================================================
1042 dnl =
1043 dnl = Maintainer debug option (no --enable equivalent)
1044 dnl =
1045 dnl ========================================================
1047 AC_SUBST_LIST(ASFLAGS)
1048 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1050 AC_SUBST(MOZ_STUB_INSTALLER)
1052 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1054 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1056 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1057   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1060 dnl ========================================================
1061 dnl = Mac bundle name prefix
1062 dnl ========================================================
1063 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1064 [  --with-macbundlename-prefix=prefix
1065                           Prefix for MOZ_MACBUNDLE_NAME],
1066 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1068 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1069 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1070   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1073 if test "$MOZ_DEBUG"; then
1074   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1075 else
1076   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1078 AC_SUBST(MOZ_MACBUNDLE_NAME)
1080 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1081 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1082 # Otherwise, use MOZ_APP_DISPLAYNAME
1083 if test -z "$MOZ_MACBUNDLE_ID"; then
1084    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1086 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1087 if test "$MOZ_DEBUG"; then
1088   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1091 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1092 AC_SUBST(MOZ_MACBUNDLE_ID)
1094 dnl ========================================================
1095 dnl = Child Process Name for IPC
1096 dnl ========================================================
1097 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1098   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1099 else
1100   # We want to let Android unpack the file at install time, but it only does
1101   # so if the file is named libsomething.so. The lib/ path is also required
1102   # because the unpacked file will be under the lib/ subdirectory and will
1103   # need to be executed from that path.
1104   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1106 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1107 MOZ_CHILD_PROCESS_BUNDLEID=${MOZ_DISTRIBUTION_ID}.plugincontainer
1108 MOZ_CHILD_PROCESS_BUNDLENAME="plugin-container.app"
1109 MOZ_CHILD_PROCESS_APPNAME="${MOZ_APP_DISPLAYNAME}CP"
1111 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1112 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1113 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLEID)
1114 AC_SUBST(MOZ_CHILD_PROCESS_APPNAME)
1115 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1117 dnl ==========================================================
1118 dnl = Mac Media Plugin Helper (GMP Child) Process Name for IPC
1119 dnl ==========================================================
1120 MOZ_EME_PROCESS_NAME="media-plugin-helper"
1121 MOZ_EME_PROCESS_NAME_BRANDED="$MOZ_APP_DISPLAYNAME Media Plugin Helper"
1122 MOZ_EME_PROCESS_BUNDLENAME="${MOZ_EME_PROCESS_NAME}.app"
1123 # Generate a lower case string with no spaces to be used as the bundle ID
1124 # for the EME helper .app of the form org.mozilla.<executable-name>.
1125 MOZ_EME_PROCESS_BUNDLEID=`echo "$MOZ_APP_DISPLAYNAME" | tr ' ' '-'`
1126 MOZ_EME_PROCESS_BUNDLEID=`echo "$MOZ_EME_PROCESS_BUNDLEID" | tr 'A-Z' 'a-z'`
1127 MOZ_EME_PROCESS_BUNDLEID=${MOZ_EME_PROCESS_BUNDLEID}-${MOZ_EME_PROCESS_NAME}
1128 MOZ_EME_PROCESS_BUNDLEID=${MOZ_DISTRIBUTION_ID}.${MOZ_EME_PROCESS_BUNDLEID}
1130 AC_SUBST(MOZ_EME_PROCESS_NAME)
1131 AC_SUBST(MOZ_EME_PROCESS_NAME_BRANDED)
1132 AC_SUBST(MOZ_EME_PROCESS_BUNDLENAME)
1133 AC_SUBST(MOZ_EME_PROCESS_BUNDLEID)
1135 # The following variables are available to branding and application
1136 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1137 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1138 # impacts profile location and user-visible fields.
1139 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1140 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1141 # builds (e.g. Aurora for Firefox).
1142 # - MOZ_APP_PROFILE: When set, used for application.ini's
1143 # "Profile" field, which controls profile location.
1144 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1145 # crash reporter server url.
1146 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1148 # The following environment variables used to have an effect, but don't anymore:
1149 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1150 # the contents from the version.txt file in the application directory, or
1151 # browser/config/version.txt if there isn't one.
1152 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1153 # in the "About" window. This was replaced with the contents from the
1154 # version_display.txt or version.txt in the application directory, or
1155 # browser/config/version_display.txt.
1157 # For extensions and langpacks, we require a max version that is compatible
1158 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1159 # 24.0a1 and 24.0a2 aren't affected
1160 # 24.0 becomes 24.*
1161 # 24.1.1 becomes 24.*
1162 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1163 if test -z "$IS_ALPHA"; then
1164   changequote(,)
1165   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1166     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1167   else
1168     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1169   fi
1170   changequote([,])
1171 else
1172   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1175 AC_SUBST(MOZ_APP_DISPLAYNAME)
1176 AC_SUBST(MOZ_APP_VENDOR)
1177 AC_SUBST(MOZ_APP_PROFILE)
1178 AC_SUBST(MOZ_APP_ID)
1179 AC_SUBST(MAR_CHANNEL_ID)
1180 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1181 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1182 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1183 AC_SUBST(MOZ_APP_UA_NAME)
1184 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1185 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1186 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1188 AC_SUBST(MOZ_APP_MAXVERSION)
1189 AC_SUBST(MOZ_PKG_SPECIAL)
1190 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1192 if test "$MOZILLA_OFFICIAL"; then
1193     # Build revisions should always be present in official builds
1194     MOZ_INCLUDE_SOURCE_INFO=1
1197 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1198 # explicitly set the repository and changeset information in.
1199 AC_SUBST(MOZ_SOURCE_REPO)
1200 AC_SUBST(MOZ_SOURCE_CHANGESET)
1201 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1203 dnl win32 options
1204 AC_SUBST(WIN32_REDIST_DIR)
1206 dnl Echo the CFLAGS to remove extra whitespace.
1207 CFLAGS=`echo \
1208     $_COMPILATION_CFLAGS \
1209     $CFLAGS`
1211 CXXFLAGS=`echo \
1212     $_COMPILATION_CXXFLAGS \
1213     $CXXFLAGS`
1215 COMPILE_CFLAGS=`echo \
1216     $_DEFINES_CFLAGS \
1217     $COMPILE_CFLAGS`
1219 COMPILE_CXXFLAGS=`echo \
1220     $_DEFINES_CXXFLAGS \
1221     $COMPILE_CXXFLAGS`
1223 HOST_CFLAGS=`echo \
1224     $_COMPILATION_HOST_CFLAGS \
1225     $HOST_CFLAGS`
1227 HOST_CXXFLAGS=`echo \
1228     $_COMPILATION_HOST_CXXFLAGS \
1229     $HOST_CXXFLAGS`
1231 LDFLAGS=`echo \
1232     $LDFLAGS \
1233     $_COMPILATION_LDFLAGS`
1235 HOST_LDFLAGS=`echo \
1236     $HOST_LDFLAGS \
1237     $_COMPILATION_HOST_LDFLAGS`
1239 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1240 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1241 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1242 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1243 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1244   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1245   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1247 AC_SUBST(HOST_CMFLAGS)
1248 AC_SUBST(HOST_CMMFLAGS)
1249 AC_SUBST(OS_COMPILE_CMFLAGS)
1250 AC_SUBST(OS_COMPILE_CMMFLAGS)
1252 OS_CFLAGS="$CFLAGS"
1253 OS_CXXFLAGS="$CXXFLAGS"
1254 OS_CPPFLAGS="$CPPFLAGS"
1255 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1256 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1257 OS_LDFLAGS="$LDFLAGS"
1258 OS_LIBS="$LIBS"
1259 AC_SUBST_LIST(OS_CFLAGS)
1260 AC_SUBST_LIST(OS_CXXFLAGS)
1261 AC_SUBST_LIST(OS_CPPFLAGS)
1262 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1263 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1264 AC_SUBST_LIST(OS_LDFLAGS)
1265 AC_SUBST(OS_LIBS)
1267 AC_SUBST(HOST_CC)
1268 AC_SUBST(HOST_CXX)
1269 AC_SUBST_LIST(HOST_CFLAGS)
1270 AC_SUBST_LIST(HOST_CPPFLAGS)
1271 AC_SUBST_LIST(HOST_CXXFLAGS)
1272 AC_SUBST(HOST_LDFLAGS)
1273 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1274 AC_SUBST(HOST_BIN_SUFFIX)
1276 AC_SUBST(TARGET_XPCOM_ABI)
1278 AC_SUBST(DSO_LDOPTS)
1279 AC_SUBST(BIN_SUFFIX)
1280 AC_SUBST(USE_N32)
1281 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1282 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1284 AC_SUBST(MOZ_DEVTOOLS)
1286 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1288 AC_SUBST(DMG_TOOL)
1290 dnl Host JavaScript runtime, if any, to use during cross compiles.
1291 AC_SUBST(JS_BINARY)
1293 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1295 dnl Set various defines and substitutions
1296 dnl ========================================================
1298 AC_SUBST(MOZ_DEV_EDITION)
1299 if test -n "$MOZ_DEV_EDITION"; then
1300     AC_DEFINE(MOZ_DEV_EDITION)
1303 dnl Spit out some output
1304 dnl ========================================================
1306 # Avoid using obsolete NSPR features
1307 AC_DEFINE(NO_NSPR_10_SUPPORT)
1309 MOZ_CREATE_CONFIG_STATUS()
1311 rm -fr confdefs* $ac_clean_files