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