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