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 ========================================================
10 AC_INIT(config/config.mk)
11 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 dnl ========================================================
16 dnl = Don't change the following lines. Doing so breaks:
18 dnl = CFLAGS="-foo" ./configure
20 dnl ========================================================
22 CPPFLAGS="${CPPFLAGS=}"
23 CXXFLAGS="${CXXFLAGS=}"
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 ========================================================
33 dnl Initialize the Pthread test variables early so they can be
34 dnl overridden by each platform.
35 dnl ========================================================
39 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS $PACK_REL_RELOC_FLAGS"
40 HOST_LDFLAGS="$HOST_LDFLAGS $HOST_LINKER_LDFLAGS"
42 if test "$COMPILE_ENVIRONMENT"; then
44 fi # COMPILE_ENVIRONMENT
46 dnl ========================================================
47 dnl Checks for compilers.
48 dnl ========================================================
50 if test "$COMPILE_ENVIRONMENT"; then
52 # Run some logic to figure out exe extensions (mostly for mingw's sake)
55 if test "$target" != "$host"; then
61 # Work around the conftest.exe access problem on Windows
69 dnl ========================================================
70 dnl Special win32 checks
71 dnl ========================================================
77 if test "$GCC" != "yes"; then
78 # Check to see if we are really running in a msvc environemnt
81 # Make sure compilers are valid
82 CXXFLAGS="$CXXFLAGS -TP"
85 AC_TRY_COMPILE([#include <stdio.h>],
86 [ printf("Hello World\n"); ],,
87 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
90 AC_TRY_COMPILE([#include <new.h>],
91 [ unsigned *test = new unsigned(42); ],,
92 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
95 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
96 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
98 MSVC_C_RUNTIME_DLL=vcruntime140.dll
99 if test "$TARGET_CPU" != "x86"; then
100 MSVC_C_RUNTIME_1_DLL=vcruntime140_1.dll
102 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
104 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
105 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
107 AC_SUBST(MSVC_C_RUNTIME_DLL)
108 AC_SUBST(MSVC_C_RUNTIME_1_DLL)
109 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
111 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
113 # Check w32api version
114 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
115 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
116 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
117 AC_TRY_COMPILE([#include <w32api.h>],
118 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
119 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
120 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
121 #error "test failed."
123 , [ res=yes ], [ res=no ])
124 AC_MSG_RESULT([$res])
125 if test "$res" != "yes"; then
126 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
128 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
129 # causing problems with local implementations with the same name.
130 AC_DEFINE(STRSAFE_NO_DEPRECATE)
133 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise Windows' math.h doesn't #define M_PI.
135 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
136 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
138 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
139 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
140 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0A00)
145 if test -n "$_WIN32_MSVC"; then
147 SKIP_COMPILER_CHECKS=1
148 SKIP_LIBRARY_CHECKS=1
150 # Since we're skipping compiler and library checks, hard-code
153 AC_DEFINE(HAVE_ISATTY)
156 fi # COMPILE_ENVIRONMENT
161 dnl ========================================================
162 dnl set the defaults first
163 dnl ========================================================
164 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
166 dnl Configure platform-specific CPU architecture compiler options.
167 dnl ==============================================================
168 if test "$COMPILE_ENVIRONMENT"; then
170 fi # COMPILE_ENVIRONMENT
172 if test -n "$COMPILE_ENVIRONMENT"; then
176 dnl ========================================================
177 dnl GNU specific defaults
178 dnl ========================================================
179 if test "$GNU_CC"; then
180 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
181 DSO_PIC_CFLAGS='-fPIC'
182 ASFLAGS="$ASFLAGS -fPIC"
186 if test "$GCC_USE_GNU_LD"; then
187 # Some tools like ASan use a runtime library that is only
188 # linked against executables, so we must allow undefined
189 # symbols for shared objects in some cases.
190 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
191 # Don't allow undefined symbols in libraries
192 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
194 # BSDs need `environ' exposed for posix_spawn (bug 753046)
196 DragonFly|FreeBSD|NetBSD|OpenBSD)
197 if test "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED" = 1; then
198 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
200 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
207 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
209 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
212 if test "$GNU_CXX"; then
213 CXXFLAGS="$CXXFLAGS -fno-exceptions"
215 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
218 dnl ========================================================
219 dnl System overrides of the defaults for host
220 dnl ========================================================
223 if test -n "$_WIN32_MSVC"; then
224 HOST_CFLAGS="$HOST_CFLAGS"
226 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
228 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
229 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
232 case "${host_cpu}" in
234 if test -n "$_WIN32_MSVC"; then
235 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
239 if test -n "$_WIN32_MSVC"; then
240 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
242 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
248 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
249 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
252 *-linux*|*-kfreebsd*-gnu|*-gnu*)
253 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
254 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
258 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
259 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
263 dnl ========================================================
264 dnl System overrides of the defaults for target
265 dnl ========================================================
267 MOZ_OPTIMIZE_LDFLAGS="${_COMPILATION_OPTIMIZE_LDFLAGS} ${MOZ_OPTIMIZE_FLAGS}"
271 MOZ_OPTIMIZE_FLAGS="-O3"
276 *-android*|*-linuxandroid*)
277 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
278 # -Oz is smaller than -Os on clang.
279 MOZ_OPTIMIZE_FLAGS="-Oz"
280 # Disable the outliner, which causes performance regressions, and is
281 # enabled on some platforms at -Oz.
282 if test -z "$MOZ_LTO"; then
283 DISABLE_OUTLINER="-mno-outline"
285 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
286 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
287 CFLAGS="$_SAVE_CFLAGS"
289 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
290 _SAVE_LDFLAGS=$LDFLAGS
291 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
292 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
293 LDFLAGS="$_SAVE_LDFLAGS"
298 if test "$GNU_CC" -o "$GNU_CXX"; then
299 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
300 MOZ_OPTIMIZE_FLAGS="-O2"
303 case "${target_cpu}" in
305 CFLAGS="$CFLAGS -mieee"
306 CXXFLAGS="$CXXFLAGS -mieee"
312 # certain versions of cygwin's makedepend barf on the
313 # #include <string> vs -I./dist/include/string issue so don't use it
314 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
315 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
316 if test -z "$CLANG_CC"; then
317 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
323 MOZ_OPTIMIZE_FLAGS="-O2"
325 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
326 WIN32_GUI_EXE_LDFLAGS=-mwindows
328 # Silence problematic clang warnings
329 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
330 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
332 TARGET_COMPILER_ABI=msvc
333 WIN32_SUBSYSTEM_VERSION=10.0
334 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
335 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
336 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
337 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
338 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
339 CFLAGS="$CFLAGS -Gy -Zc:inline"
340 CXXFLAGS="$CXXFLAGS -Gy -Zc:inline"
341 if test "$TARGET_CPU" = "x86"; then
342 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
343 dnl more recent, so set that explicitly here unless another
344 dnl target arch has already been set.
346 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
347 CFLAGS="$CFLAGS -arch:SSE2"
349 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
350 CXXFLAGS="$CXXFLAGS -arch:SSE2"
354 dnl VS2013+ supports -Gw for better linker optimizations.
355 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
356 dnl Disabled on ASan because it causes false-positive ODR violations.
357 if test -z "$MOZ_ASAN"; then
359 CXXFLAGS="$CXXFLAGS -Gw"
361 # String tail merging doesn't play nice with ASan's ODR checker.
362 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
364 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
365 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
366 MOZ_DEBUG_LDFLAGS='-DEBUG'
367 if test "$HOST_OS_ARCH" != "WINNT"; then
368 # %_PDB% is a special signal to emit only the PDB basename. This
369 # avoids problems in Windows tools that don't like forward-slashes.
370 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
372 MOZ_OPTIMIZE_FLAGS='-O2'
374 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
376 AC_DEFINE(WIN32_LEAN_AND_MEAN)
377 dnl See http://support.microsoft.com/kb/143208 to use STL
383 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.])
389 if test -n "$GNU_CC"; then
390 CFLAGS="$CFLAGS -mstackrealign"
391 CXXFLAGS="$CXXFLAGS -mstackrealign"
392 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
394 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
395 LDFLAGS="$LDFLAGS -SAFESEH"
401 if test -n "$_WIN32_MSVC"; then
402 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
407 if test -n "$_WIN32_MSVC"; then
408 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
413 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
419 CFLAGS="$CFLAGS -Dunix"
420 CXXFLAGS="$CXXFLAGS -Dunix"
421 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
422 DSO_PIC_CFLAGS='-fPIC -DPIC'
424 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
426 DSO_PIC_CFLAGS='-fPIC -DPIC'
429 # This will fail on a.out systems prior to 1.5.1_ALPHA.
430 if test "$LIBRUNPATH"; then
431 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
436 if test -z "$X11BASE"; then
439 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
440 DSO_PIC_CFLAGS='-fPIC'
441 DSO_LDOPTS='-shared -fPIC'
442 if test "$LIBRUNPATH"; then
443 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
448 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
453 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
454 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
456 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
457 MOZ_OPTIMIZE_FLAGS="-O"
461 if test -z "$COMPILE_ENVIRONMENT"; then
462 SKIP_COMPILER_CHECKS=1
463 SKIP_LIBRARY_CHECKS=1
467 fi # COMPILE_ENVIRONMENT
469 if test -z "$SKIP_COMPILER_CHECKS"; then
470 dnl Checks for typedefs, structures, and compiler characteristics.
471 dnl ========================================================
478 dnl Checks for header files.
479 dnl ========================================================
482 dnl Checks for libraries.
483 dnl ========================================================
484 AC_CHECK_LIB(c_r, gethostbyname_r)
486 dnl We don't want to link with libdl even if it's present on OS X, since
487 dnl it's not used and not part of the default installation. OS/2 has dlfcn
489 dnl We don't want to link against libm or libpthread on Darwin since
490 dnl they both are just symlinks to libSystem and explicitly linking
491 dnl against libSystem causes issues when debugging (see bug 299601).
496 AC_SEARCH_LIBS(dlopen, dl,
497 MOZ_CHECK_HEADER(dlfcn.h,
498 AC_DEFINE(HAVE_DLOPEN)))
502 _SAVE_CFLAGS="$CFLAGS"
503 CFLAGS="$CFLAGS -D_GNU_SOURCE"
504 AC_CHECK_FUNCS(dladdr)
505 CFLAGS="$_SAVE_CFLAGS"
507 if test ! "$GNU_CXX"; then
508 AC_CHECK_LIB(C, demangle)
511 AC_CHECK_LIB(socket, socket)
513 dnl ========================================================
514 dnl = pthread support
515 dnl = Start by checking whether the system support pthreads
516 dnl ========================================================
522 AC_CHECK_LIB(pthreads, pthread_create,
523 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
524 AC_CHECK_LIB(pthread, pthread_create,
525 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
526 AC_CHECK_LIB(c_r, pthread_create,
527 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
528 AC_CHECK_LIB(c, pthread_create,
537 dnl ========================================================
538 dnl Do the platform specific pthread hackery
539 dnl ========================================================
540 if test "$MOZ_USE_PTHREADS"x != x
543 dnl See if -pthread is supported.
546 ac_cv_have_dash_pthread=no
547 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
548 echo 'int main() { return 0; }' | cat > conftest.c
549 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
550 if test $? -eq 0; then
551 if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
552 ac_cv_have_dash_pthread=yes
555 # Freebsd doesn't use -pthread for compiles, it uses them for linking
558 CFLAGS="$CFLAGS -pthread"
559 CXXFLAGS="$CXXFLAGS -pthread"
565 AC_MSG_RESULT($ac_cv_have_dash_pthread)
568 dnl See if -pthreads is supported.
570 ac_cv_have_dash_pthreads=no
571 if test "$ac_cv_have_dash_pthread" = "no"; then
572 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
573 echo 'int main() { return 0; }' | cat > conftest.c
574 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
575 if test $? -eq 0; then
576 if test -z "`grep -E -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`grep -E -i '(error|incorrect)' conftest.out`" ; then
577 ac_cv_have_dash_pthreads=yes
578 CFLAGS="$CFLAGS -pthreads"
579 CXXFLAGS="$CXXFLAGS -pthreads"
583 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
588 AC_DEFINE(_REENTRANT)
589 AC_DEFINE(_THREAD_SAFE)
590 dnl -pthread links in -lpthread, so don't specify it explicitly.
591 if test "$ac_cv_have_dash_pthread" = "yes"; then
592 _PTHREAD_LDFLAGS="-pthread"
596 *-*-openbsd*|*-*-bsdi*)
597 AC_DEFINE(_REENTRANT)
598 AC_DEFINE(_THREAD_SAFE)
599 dnl -pthread links in -lc_r, so don't specify it explicitly.
600 if test "$ac_cv_have_dash_pthread" = "yes"; then
601 _PTHREAD_LDFLAGS="-pthread"
605 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
606 AC_DEFINE(_REENTRANT)
610 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
611 AC_SUBST(MOZ_USE_PTHREADS)
612 MOZ_CHECK_HEADERS(pthread.h)
616 dnl ========================================================
617 dnl Put your C++ language/feature checks below
618 dnl ========================================================
622 if test "$GNU_CC"; then
623 if test "$TARGET_CPU" = "arm" ; then
624 AC_CACHE_CHECK(for ARM EABI,
628 #if defined(__ARM_EABI__)
634 ac_cv_gcc_arm_eabi="yes",
635 ac_cv_gcc_arm_eabi="no")])
636 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
644 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
647 if test -n "$MOZ_LINKER"; then
648 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
649 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
650 dnl Since the linker only understands the sysv ones, no need to build the
651 dnl gnu style tables anyways.
652 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
655 dnl End of C++ language/feature checks
658 fi # ! SKIP_COMPILER_CHECKS
660 if test -n "${COMPILE_ENVIRONMENT}"; then
665 if test -n "${TARGET_CPU}" -a -n "${TARGET_COMPILER_ABI}"; then
666 TARGET_XPCOM_ABI="${TARGET_CPU}-${TARGET_COMPILER_ABI}"
667 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
670 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
671 dnl features that Windows actually does support.
673 if test -n "$SKIP_COMPILER_CHECKS"; then
674 dnl Windows has malloc.h
675 AC_DEFINE(MALLOC_H, [<malloc.h>])
676 AC_DEFINE(HAVE_FORCEINLINE)
677 fi # SKIP_COMPILER_CHECKS
679 dnl Mozilla specific options
680 dnl ========================================================
681 dnl The macros used for command line options
682 dnl are defined in build/autoconf/altoptions.m4.
684 dnl ========================================================
688 dnl ========================================================
690 MOZ_BRANDING_DIRECTORY=
691 MOZ_OFFICIAL_BRANDING=
693 MOZ_BINARY_EXTENSIONS=
696 dnl ========================================================
697 dnl = Trademarked Branding
698 dnl ========================================================
699 MOZ_ARG_ENABLE_BOOL(official-branding,
700 [ --enable-official-branding
701 Enable Official mozilla.org Branding
702 Do not distribute builds with
703 --enable-official-branding unless you have
704 permission to use trademarks per
705 http://www.mozilla.org/foundation/trademarks/ .],
706 MOZ_OFFICIAL_BRANDING=1,
707 MOZ_OFFICIAL_BRANDING=)
709 # Allow the application to influence configure with a confvars.sh script.
710 AC_MSG_CHECKING([if app-specific confvars.sh exists])
711 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
712 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
713 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
718 AC_SUBST(MOZ_OFFICIAL_BRANDING)
719 if test -n "$MOZ_OFFICIAL_BRANDING"; then
720 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
721 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
723 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
724 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
728 MOZ_ARG_WITH_STRING(branding,
729 [ --with-branding=dir Use branding from the specified directory.],
730 MOZ_BRANDING_DIRECTORY=$withval)
732 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
733 if test -z "$REAL_BRANDING_DIRECTORY"; then
734 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
737 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
738 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
741 AC_SUBST(MOZ_BRANDING_DIRECTORY)
743 dnl ========================================================
744 dnl = Distribution ID
745 dnl ========================================================
746 MOZ_ARG_WITH_STRING(distribution-id,
747 [ --with-distribution-id=ID
748 Set distribution-specific id (default=org.mozilla)],
749 [ val=`echo $withval`
750 MOZ_DISTRIBUTION_ID="$val"])
752 if test -z "$MOZ_DISTRIBUTION_ID"; then
753 MOZ_DISTRIBUTION_ID="org.mozilla"
756 AC_SUBST(MOZ_DISTRIBUTION_ID)
758 dnl ========================================================
759 dnl = Enable code optimization. ON by default.
760 dnl ========================================================
762 # Use value from moz.configure if one is defined. Else use our computed
764 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
765 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
768 if test "$COMPILE_ENVIRONMENT"; then
769 if test -n "$MOZ_OPTIMIZE"; then
770 AC_MSG_CHECKING([for valid C compiler optimization flags])
772 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
773 AC_TRY_COMPILE([#include <stdio.h>],
774 [printf("Hello World\n");],
777 AC_MSG_RESULT([$_results])
778 if test "$_results" = "no"; then
779 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
782 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
783 # When using llvm-based LTO, non numeric optimization levels are
784 # not supported by the linker, so force the linker to use -O2 (
785 # which doesn't influence the level compilation units are actually
787 case " $MOZ_OPTIMIZE_FLAGS " in
789 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
794 fi # COMPILE_ENVIRONMENT
796 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
797 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
798 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
800 case "${OS_TARGET}" in
801 Android|WINNT|Darwin)
805 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
806 MOZ_GLUE_IN_PROGRAM=1
807 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
811 dnl ========================================================
812 dnl = Jemalloc build setup
813 dnl ========================================================
814 if test -n "$MOZ_MEMORY"; then
817 export MOZ_NO_DEBUG_RTL=1
821 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
823 dnl ========================================================
824 dnl = Enable using the clang plugin to build
825 dnl ========================================================
827 if test -n "$COMPILE_ENVIRONMENT"; then
828 MOZ_CONFIG_CLANG_PLUGIN
829 fi # COMPILE_ENVIRONMENT
833 if test "$COMPILE_ENVIRONMENT"; then
835 fi # COMPILE_ENVIRONMENT
837 dnl ========================================================
838 dnl Check if we need the 32-bit Linux SSE2 error dialog
839 dnl ========================================================
841 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
843 dnl ========================================================
845 dnl ========================================================
847 if test "$OS_ARCH" = "WINNT"; then
848 # For now we assume that we will have a uint64_t available through
849 # one of the above headers or mozstdint.h.
850 AC_DEFINE(HAVE_UINT64_T)
853 case "$MOZ_WIDGET_TOOLKIT" in
855 if test "$COMPILE_ENVIRONMENT"; then
856 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
860 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
862 dnl ========================================================
864 dnl = Maintainer debug option (no --enable equivalent)
866 dnl ========================================================
868 AC_SUBST_LIST(ASFLAGS)
869 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
871 AC_SUBST(MOZ_STUB_INSTALLER)
873 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
875 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
877 if test -n "$MOZ_BINARY_EXTENSIONS"; then
878 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
881 dnl ========================================================
882 dnl = Mac bundle name prefix
883 dnl ========================================================
884 MOZ_ARG_WITH_STRING(macbundlename-prefix,
885 [ --with-macbundlename-prefix=prefix
886 Prefix for MOZ_MACBUNDLE_NAME],
887 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
889 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
890 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
891 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
894 if test "$MOZ_DEBUG"; then
895 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
897 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
899 AC_SUBST(MOZ_MACBUNDLE_NAME)
901 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
902 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
903 # Otherwise, use MOZ_APP_DISPLAYNAME
904 if test -z "$MOZ_MACBUNDLE_ID"; then
905 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
907 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
908 if test "$MOZ_DEBUG"; then
909 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
912 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
913 AC_SUBST(MOZ_MACBUNDLE_ID)
915 dnl ========================================================
916 dnl = Child Process Name for IPC
917 dnl ========================================================
918 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
919 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
921 # We want to let Android unpack the file at install time, but it only does
922 # so if the file is named libsomething.so. The lib/ path is also required
923 # because the unpacked file will be under the lib/ subdirectory and will
924 # need to be executed from that path.
925 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
927 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
928 MOZ_CHILD_PROCESS_BUNDLEID=${MOZ_DISTRIBUTION_ID}.plugincontainer
929 MOZ_CHILD_PROCESS_BUNDLENAME="plugin-container.app"
930 MOZ_CHILD_PROCESS_APPNAME="${MOZ_APP_DISPLAYNAME}CP"
932 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
933 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
934 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLEID)
935 AC_SUBST(MOZ_CHILD_PROCESS_APPNAME)
936 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
938 dnl ==========================================================
939 dnl = Mac Media Plugin Helper (GMP Child) Process Name for IPC
940 dnl ==========================================================
941 MOZ_EME_PROCESS_NAME="media-plugin-helper"
942 MOZ_EME_PROCESS_NAME_BRANDED="$MOZ_APP_DISPLAYNAME Media Plugin Helper"
943 MOZ_EME_PROCESS_BUNDLENAME="${MOZ_EME_PROCESS_NAME}.app"
944 # Generate a lower case string with no spaces to be used as the bundle ID
945 # for the EME helper .app of the form org.mozilla.<executable-name>.
946 MOZ_EME_PROCESS_BUNDLEID=`echo "$MOZ_APP_DISPLAYNAME" | tr ' ' '-'`
947 MOZ_EME_PROCESS_BUNDLEID=`echo "$MOZ_EME_PROCESS_BUNDLEID" | tr 'A-Z' 'a-z'`
948 MOZ_EME_PROCESS_BUNDLEID=${MOZ_EME_PROCESS_BUNDLEID}-${MOZ_EME_PROCESS_NAME}
949 MOZ_EME_PROCESS_BUNDLEID=${MOZ_DISTRIBUTION_ID}.${MOZ_EME_PROCESS_BUNDLEID}
951 AC_SUBST(MOZ_EME_PROCESS_NAME)
952 AC_SUBST(MOZ_EME_PROCESS_NAME_BRANDED)
953 AC_SUBST(MOZ_EME_PROCESS_BUNDLENAME)
954 AC_SUBST(MOZ_EME_PROCESS_BUNDLEID)
956 # The following variables are available to branding and application
957 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
958 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
959 # impacts profile location and user-visible fields.
960 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
961 # Mac Bundle name, Updater, Installer), it is typically used for nightly
962 # builds (e.g. Aurora for Firefox).
963 # - MOZ_APP_PROFILE: When set, used for application.ini's
964 # "Profile" field, which controls profile location.
965 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
966 # crash reporter server url.
967 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
969 # The following environment variables used to have an effect, but don't anymore:
970 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
971 # the contents from the version.txt file in the application directory, or
972 # browser/config/version.txt if there isn't one.
973 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
974 # in the "About" window. This was replaced with the contents from the
975 # version_display.txt or version.txt in the application directory, or
976 # browser/config/version_display.txt.
978 # For extensions and langpacks, we require a max version that is compatible
979 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
980 # 24.0a1 and 24.0a2 aren't affected
982 # 24.1.1 becomes 24.*
983 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
984 if test -z "$IS_ALPHA"; then
986 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
987 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
989 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
993 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
996 AC_SUBST(MOZ_APP_DISPLAYNAME)
997 AC_SUBST(MOZ_APP_VENDOR)
998 AC_SUBST(MOZ_APP_PROFILE)
1000 AC_SUBST(MAR_CHANNEL_ID)
1001 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1002 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1003 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1004 AC_SUBST(MOZ_APP_UA_NAME)
1005 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1006 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1007 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1009 AC_SUBST(MOZ_APP_MAXVERSION)
1010 AC_SUBST(MOZ_PKG_SPECIAL)
1011 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1013 if test "$MOZILLA_OFFICIAL"; then
1014 # Build revisions should always be present in official builds
1015 MOZ_INCLUDE_SOURCE_INFO=1
1018 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1019 # explicitly set the repository and changeset information in.
1020 AC_SUBST(MOZ_SOURCE_REPO)
1021 AC_SUBST(MOZ_SOURCE_CHANGESET)
1022 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1024 dnl Echo the CFLAGS to remove extra whitespace.
1026 $_COMPILATION_CFLAGS \
1030 $_COMPILATION_CXXFLAGS \
1034 $_COMPILATION_ASFLAGS \
1037 COMPILE_CFLAGS=`echo \
1041 COMPILE_CXXFLAGS=`echo \
1042 $_DEFINES_CXXFLAGS \
1046 $_COMPILATION_HOST_CFLAGS \
1049 HOST_CXXFLAGS=`echo \
1050 $_COMPILATION_HOST_CXXFLAGS \
1055 $_COMPILATION_LDFLAGS`
1057 HOST_LDFLAGS=`echo \
1059 $_COMPILATION_HOST_LDFLAGS`
1061 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1062 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1063 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1064 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1065 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1066 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1067 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1069 AC_SUBST(HOST_CMFLAGS)
1070 AC_SUBST(HOST_CMMFLAGS)
1071 AC_SUBST(OS_COMPILE_CMFLAGS)
1072 AC_SUBST(OS_COMPILE_CMMFLAGS)
1075 OS_CXXFLAGS="$CXXFLAGS"
1076 OS_CPPFLAGS="$CPPFLAGS"
1077 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1078 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1079 OS_LDFLAGS="$LDFLAGS"
1081 AC_SUBST_LIST(OS_CFLAGS)
1082 AC_SUBST_LIST(OS_CXXFLAGS)
1083 AC_SUBST_LIST(OS_CPPFLAGS)
1084 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1085 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1086 AC_SUBST_LIST(OS_LDFLAGS)
1091 AC_SUBST_LIST(HOST_CFLAGS)
1092 AC_SUBST_LIST(HOST_CPPFLAGS)
1093 AC_SUBST_LIST(HOST_CXXFLAGS)
1094 AC_SUBST(HOST_LDFLAGS)
1095 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1096 AC_SUBST(HOST_BIN_SUFFIX)
1098 AC_SUBST(TARGET_XPCOM_ABI)
1100 AC_SUBST(DSO_LDOPTS)
1101 AC_SUBST(BIN_SUFFIX)
1103 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1104 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1106 AC_SUBST(MOZ_DEVTOOLS)
1108 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1112 dnl Host JavaScript runtime, if any, to use during cross compiles.
1115 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1117 dnl Set various defines and substitutions
1118 dnl ========================================================
1120 AC_SUBST(MOZ_DEV_EDITION)
1121 if test -n "$MOZ_DEV_EDITION"; then
1122 AC_DEFINE(MOZ_DEV_EDITION)
1125 dnl Spit out some output
1126 dnl ========================================================
1128 # Avoid using obsolete NSPR features
1129 AC_DEFINE(NO_NSPR_10_SUPPORT)
1131 MOZ_CREATE_CONFIG_STATUS()
1133 rm -fr confdefs* $ac_clean_files