Bug 1805294 [wpt PR 37463] - WebKit export of https://bugs.webkit.org/show_bug.cgi...
[gecko.git] / old-configure.in
blob36867dc94563f024f322f008596a167f319685ef
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     if test -z "$DEVELOPER_OPTIONS" -o "$OS_TARGET" = "Android"; then
257         AC_MSG_CHECKING([for --build-id=sha1 option to ld])
258         _SAVE_LDFLAGS=$LDFLAGS
259         LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
260         AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
261                       AC_MSG_RESULT([no])
262                       LDFLAGS=$_SAVE_LDFLAGS)
263     fi
265     AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
266     HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
267     _SAVE_LDFLAGS=$LDFLAGS
268     LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
269     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
270                   [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
271                   AC_MSG_RESULT([no]))
272     LDFLAGS=$_SAVE_LDFLAGS
274     DSO_LDOPTS='-shared'
275     if test "$GCC_USE_GNU_LD"; then
276         # Some tools like ASan use a runtime library that is only
277         # linked against executables, so we must allow undefined
278         # symbols for shared objects in some cases.
279         if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
280             # Don't allow undefined symbols in libraries
281             DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
283             # BSDs need `environ' exposed for posix_spawn (bug 753046)
284             case "$OS_TARGET" in
285             DragonFly|FreeBSD|NetBSD|OpenBSD)
286                 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
287                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
288                 else
289                     DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
290                 fi
291                 ;;
292             esac
293         fi
294     fi
296     _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
298     ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
301 if test "$GNU_CXX"; then
302     CXXFLAGS="$CXXFLAGS -fno-exceptions"
304     _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
307 dnl ========================================================
308 dnl System overrides of the defaults for host
309 dnl ========================================================
310 case "$host" in
311 *mingw*)
312     if test -n "$_WIN32_MSVC"; then
313         HOST_CFLAGS="$HOST_CFLAGS"
314     else
315         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
316     fi
317     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
318     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
319     HOST_BIN_SUFFIX=.exe
321     case "${host_cpu}" in
322     i*86)
323         if test -n "$_WIN32_MSVC"; then
324             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
325         fi
326         ;;
327     x86_64)
328         if test -n "$_WIN32_MSVC"; then
329             HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
330         fi
331         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
332         ;;
333     esac
334     ;;
336 *-darwin*)
337     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
338     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
339     ;;
341 *-linux*|*-kfreebsd*-gnu|*-gnu*)
342     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
343     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
344     ;;
347     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
348     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
349     ;;
350 esac
352 dnl ========================================================
353 dnl System overrides of the defaults for target
354 dnl ========================================================
356 case "$target" in
357 *-darwin*)
358     MOZ_OPTIMIZE_FLAGS="-O3"
359     DSO_LDOPTS=''
361     dnl DTrace and -dead_strip don't interact well. See bug 403132.
362     dnl ===================================================================
363     if test "x$enable_dtrace" = "xyes"; then
364         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
365     else
366         dnl check for the presence of the -dead_strip linker flag
367         AC_MSG_CHECKING([for -dead_strip option to ld])
368         _SAVE_LDFLAGS=$LDFLAGS
369         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
370         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
371         if test -n "$_HAVE_DEAD_STRIP" ; then
372             AC_MSG_RESULT([yes])
373             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
374         else
375             AC_MSG_RESULT([no])
376         fi
378         LDFLAGS=$_SAVE_LDFLAGS
379     fi
381     MOZ_FIX_LINK_PATHS=
382     ;;
384 *-android*|*-linuxandroid*)
385     if test -z "$CLANG_CC"; then
386         MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
387     else
388         # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
389         # -Oz is smaller than -Os on clang.
390         MOZ_OPTIMIZE_FLAGS="-Oz"
391         # Disable the outliner, which causes performance regressions, and is
392         # enabled on some platforms at -Oz.
393         if test -z "$MOZ_LTO"; then
394             DISABLE_OUTLINER="-mno-outline"
395             _SAVE_CFLAGS=$CFLAGS
396             CFLAGS="$CFLAGS $DISABLE_OUTLINER"
397             AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
398             CFLAGS="$_SAVE_CFLAGS"
399         else
400             DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
401             _SAVE_LDFLAGS=$LDFLAGS
402             LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
403             AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
404             LDFLAGS="$_SAVE_LDFLAGS"
405         fi
406     fi
407     ;;
409 *-*linux*)
410     if test "$GNU_CC" -o "$GNU_CXX"; then
411         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
412         if test -n "$MOZ_DEBUG"; then
413             MOZ_OPTIMIZE_FLAGS="-Os"
414         else
415             MOZ_OPTIMIZE_FLAGS="-O2"
416         fi
417         if test -z "$CLANG_CC"; then
418            MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
419         fi
420     fi
422     case "${target_cpu}" in
423     alpha*)
424         CFLAGS="$CFLAGS -mieee"
425         CXXFLAGS="$CXXFLAGS -mieee"
426     ;;
427     esac
428     ;;
429 *-mingw*)
430     DSO_PIC_CFLAGS=
431     # certain versions of cygwin's makedepend barf on the
432     # #include <string> vs -I./dist/include/string issue so don't use it
433     if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
434         # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
435         if test -z "$CLANG_CC"; then
436             AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
437         fi
439         DSO_LDOPTS='-shared'
440         MOZ_FIX_LINK_PATHS=
442         MOZ_OPTIMIZE_FLAGS="-O2"
444         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
445         WIN32_GUI_EXE_LDFLAGS=-mwindows
447         # Silence problematic clang warnings
448         CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
449         LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
450     else
451         TARGET_COMPILER_ABI=msvc
452         # aarch64 doesn't support subsystems below 6.02
453         if test "$CPU_ARCH" = "aarch64"; then
454             WIN32_SUBSYSTEM_VERSION=6.02
455         else
456             WIN32_SUBSYSTEM_VERSION=6.01
457         fi
458         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
459         WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
460         DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
461         _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
462         _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
463         CFLAGS="$CFLAGS -Gy -Zc:inline"
464         CXXFLAGS="$CXXFLAGS -Gy -Zc:inline"
465         if test "$CPU_ARCH" = "x86"; then
466             dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
467             dnl more recent, so set that explicitly here unless another
468             dnl target arch has already been set.
469             changequote(,)
470             if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
471               CFLAGS="$CFLAGS -arch:SSE2"
472             fi
473             if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
474               CXXFLAGS="$CXXFLAGS -arch:SSE2"
475             fi
476             changequote([,])
477         fi
478         dnl VS2013+ supports -Gw for better linker optimizations.
479         dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
480         dnl Disabled on ASan because it causes false-positive ODR violations.
481         if test -z "$MOZ_ASAN"; then
482             CFLAGS="$CFLAGS -Gw"
483             CXXFLAGS="$CXXFLAGS -Gw"
484         else
485             # String tail merging doesn't play nice with ASan's ODR checker.
486             LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
487         fi
488         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
489         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
490         MOZ_DEBUG_LDFLAGS='-DEBUG'
491         if test "$HOST_OS_ARCH" != "WINNT"; then
492           # %_PDB% is a special signal to emit only the PDB basename. This
493           # avoids problems in Windows tools that don't like forward-slashes.
494           MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
495         fi
496         MOZ_OPTIMIZE_FLAGS='-O2'
497         MOZ_FIX_LINK_PATHS=
498         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
499     fi
500     AC_DEFINE(WIN32_LEAN_AND_MEAN)
501     dnl See http://support.microsoft.com/kb/143208 to use STL
502     AC_DEFINE(NOMINMAX)
503     BIN_SUFFIX='.exe'
505     case "$host_os" in
506     cygwin*|msvc*|mks*)
507         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.])
508         ;;
509     esac
511     case "$target" in
512     i*86-*)
513         if test -n "$GNU_CC"; then
514             CFLAGS="$CFLAGS -mstackrealign"
515             CXXFLAGS="$CXXFLAGS -mstackrealign"
516             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
517         else
518             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
519             LDFLAGS="$LDFLAGS -SAFESEH"
520         fi
522         AC_DEFINE(_X86_)
523         ;;
524     x86_64-*)
525         if test -n "$_WIN32_MSVC"; then
526             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
527         fi
528         AC_DEFINE(_AMD64_)
529         ;;
530     aarch64-*)
531         if test -n "$_WIN32_MSVC"; then
532             DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
533         fi
534         AC_DEFINE(_ARM64_)
535         ;;
536     *)
537         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
538         ;;
539     esac
540     ;;
542 *-netbsd*)
543     CFLAGS="$CFLAGS -Dunix"
544     CXXFLAGS="$CXXFLAGS -Dunix"
545     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
546         DSO_PIC_CFLAGS='-fPIC -DPIC'
547         DSO_LDOPTS='-shared'
548         MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
549     else
550         DSO_PIC_CFLAGS='-fPIC -DPIC'
551         DSO_LDOPTS='-shared'
552     fi
553     # This will fail on a.out systems prior to 1.5.1_ALPHA.
554     if test "$LIBRUNPATH"; then
555         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
556     fi
557     ;;
559 *-openbsd*)
560     if test -z "$X11BASE"; then
561         X11BASE=/usr/X11R6
562     fi
563     MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
564     DSO_PIC_CFLAGS='-fPIC'
565     DSO_LDOPTS='-shared -fPIC'
566     if test "$LIBRUNPATH"; then
567         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
568     fi
569     ;;
571 *-solaris*)
572     MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
573     ;;
575 esac
577 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
578 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
580 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
581     MOZ_OPTIMIZE_FLAGS="-O"
585 if test -z "$COMPILE_ENVIRONMENT"; then
586     SKIP_COMPILER_CHECKS=1
587     SKIP_LIBRARY_CHECKS=1
588     MOZ_DEBUGGING_OPTS
589 else
590     MOZ_COMPILER_OPTS
591 fi # COMPILE_ENVIRONMENT
593 if test -z "$SKIP_COMPILER_CHECKS"; then
594 dnl Checks for typedefs, structures, and compiler characteristics.
595 dnl ========================================================
596 AC_C_CONST
597 AC_TYPE_MODE_T
598 AC_TYPE_OFF_T
599 AC_TYPE_PID_T
600 AC_TYPE_SIZE_T
601 AC_LANG_CPLUSPLUS
602 AC_LANG_C
604 AC_LANG_CPLUSPLUS
606 MOZ_CXX11
608 AC_LANG_C
610 case "${OS_TARGET}" in
611 Darwin)
612   ;;
614   STL_FLAGS="-I${DIST}/stl_wrappers"
615   WRAP_STL_INCLUDES=1
616   ;;
617 esac
619 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
620     WRAP_STL_INCLUDES=
623 dnl Checks for header files.
624 dnl ========================================================
625 AC_HEADER_DIRENT
627 dnl Checks for libraries.
628 dnl ========================================================
629 AC_CHECK_LIB(c_r, gethostbyname_r)
631 dnl We don't want to link with libdl even if it's present on OS X, since
632 dnl it's not used and not part of the default installation. OS/2 has dlfcn
633 dnl in libc.
634 dnl We don't want to link against libm or libpthread on Darwin since
635 dnl they both are just symlinks to libSystem and explicitly linking
636 dnl against libSystem causes issues when debugging (see bug 299601).
637 case $target in
638 *-darwin*)
639     ;;
641     AC_SEARCH_LIBS(dlopen, dl,
642         MOZ_CHECK_HEADER(dlfcn.h,
643         AC_DEFINE(HAVE_DLOPEN)))
644     ;;
645 esac
647 _SAVE_CFLAGS="$CFLAGS"
648 CFLAGS="$CFLAGS -D_GNU_SOURCE"
649 AC_CHECK_FUNCS(dladdr)
650 CFLAGS="$_SAVE_CFLAGS"
652 if test ! "$GNU_CXX"; then
653     AC_CHECK_LIB(C, demangle)
656 AC_CHECK_LIB(socket, socket)
658 dnl ========================================================
659 dnl = pthread support
660 dnl = Start by checking whether the system support pthreads
661 dnl ========================================================
662 case "$target_os" in
663 darwin*)
664     MOZ_USE_PTHREADS=1
665     ;;
667     AC_CHECK_LIB(pthreads, pthread_create,
668         MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
669         AC_CHECK_LIB(pthread, pthread_create,
670             MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
671             AC_CHECK_LIB(c_r, pthread_create,
672                 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
673                 AC_CHECK_LIB(c, pthread_create,
674                     MOZ_USE_PTHREADS=1
675                 )
676             )
677         )
678     )
679     ;;
680 esac
682 dnl ========================================================
683 dnl Do the platform specific pthread hackery
684 dnl ========================================================
685 if test "$MOZ_USE_PTHREADS"x != x
686 then
687     dnl
688     dnl See if -pthread is supported.
689     dnl
690     rm -f conftest*
691     ac_cv_have_dash_pthread=no
692     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
693     echo 'int main() { return 0; }' | cat > conftest.c
694     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
695     if test $? -eq 0; then
696         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
697             ac_cv_have_dash_pthread=yes
698             case "$target_os" in
699             freebsd*)
700 # Freebsd doesn't use -pthread for compiles, it uses them for linking
701                 ;;
702             *)
703                 CFLAGS="$CFLAGS -pthread"
704                 CXXFLAGS="$CXXFLAGS -pthread"
705                 ;;
706             esac
707         fi
708     fi
709     rm -f conftest*
710     AC_MSG_RESULT($ac_cv_have_dash_pthread)
712     dnl
713     dnl See if -pthreads is supported.
714     dnl
715     ac_cv_have_dash_pthreads=no
716     if test "$ac_cv_have_dash_pthread" = "no"; then
717         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
718         echo 'int main() { return 0; }' | cat > conftest.c
719         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
720         if test $? -eq 0; then
721             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
722                 ac_cv_have_dash_pthreads=yes
723                 CFLAGS="$CFLAGS -pthreads"
724                 CXXFLAGS="$CXXFLAGS -pthreads"
725             fi
726         fi
727         rm -f conftest*
728         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
729     fi
731     case "$target" in
732         *-*-freebsd*)
733             AC_DEFINE(_REENTRANT)
734             AC_DEFINE(_THREAD_SAFE)
735             dnl -pthread links in -lpthread, so don't specify it explicitly.
736             if test "$ac_cv_have_dash_pthread" = "yes"; then
737                 _PTHREAD_LDFLAGS="-pthread"
738             fi
739             ;;
741         *-*-openbsd*|*-*-bsdi*)
742             AC_DEFINE(_REENTRANT)
743             AC_DEFINE(_THREAD_SAFE)
744             dnl -pthread links in -lc_r, so don't specify it explicitly.
745             if test "$ac_cv_have_dash_pthread" = "yes"; then
746                 _PTHREAD_LDFLAGS="-pthread"
747             fi
748             ;;
750         *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
751             AC_DEFINE(_REENTRANT)
752             ;;
754     esac
755     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
756     AC_SUBST(MOZ_USE_PTHREADS)
757     MOZ_CHECK_HEADERS(pthread.h)
761 dnl Checks for library functions.
762 dnl ========================================================
764 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
765 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
766                ac_cv_clock_monotonic,
767                [for libs in "" -lrt; do
768                     _SAVE_LIBS="$LIBS"
769                     LIBS="$LIBS $libs"
770 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
771 dnl we should or not be able to use it. To detect if we can, we need to make the
772 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
773                     AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
774                                  #include <time.h>],
775                                  [ struct timespec ts;
776                                    clock_gettime(CLOCK_MONOTONIC, &ts); ],
777                                  ac_cv_clock_monotonic=$libs
778                                  LIBS="$_SAVE_LIBS"
779                                  break,
780                                  ac_cv_clock_monotonic=no)
781                     LIBS="$_SAVE_LIBS"
782                 done])
783 if test "$ac_cv_clock_monotonic" != "no"; then
784     HAVE_CLOCK_MONOTONIC=1
785     REALTIME_LIBS=$ac_cv_clock_monotonic
786     AC_DEFINE(HAVE_CLOCK_MONOTONIC)
787     AC_SUBST(HAVE_CLOCK_MONOTONIC)
788     AC_SUBST_LIST(REALTIME_LIBS)
791 AC_CACHE_CHECK(
792     [for res_ninit()],
793     ac_cv_func_res_ninit,
794     [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
795         dnl no need for res_ninit() on NetBSD and OpenBSD
796         ac_cv_func_res_ninit=no
797      else
798         AC_TRY_LINK([
799             #ifdef linux
800             #define _BSD_SOURCE 1
801             #endif
802             #include <sys/types.h>
803             #include <netinet/in.h>
804             #include <arpa/nameser.h>
805             #include <resolv.h>
806             ],
807             [int foo = res_ninit(&_res);],
808             [ac_cv_func_res_ninit=yes],
809             [ac_cv_func_res_ninit=no])
810      fi
811     ])
813 if test "$ac_cv_func_res_ninit" = "yes"; then
814     AC_DEFINE(HAVE_RES_NINIT)
815 dnl must add the link line we do something as foolish as this... dougt
816 dnl else
817 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
818 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
821 AC_LANG_C
823 dnl ===================================================================
824 dnl ========================================================
825 dnl Put your C++ language/feature checks below
826 dnl ========================================================
827 AC_LANG_CPLUSPLUS
829 ARM_ABI_PREFIX=
830 if test "$GNU_CC"; then
831   if test "$CPU_ARCH" = "arm" ; then
832     AC_CACHE_CHECK(for ARM EABI,
833         ac_cv_gcc_arm_eabi,
834         [AC_TRY_COMPILE([],
835                         [
836 #if defined(__ARM_EABI__)
837   return 0;
838 #else
839 #error Not ARM EABI.
840 #endif
841                         ],
842                         ac_cv_gcc_arm_eabi="yes",
843                         ac_cv_gcc_arm_eabi="no")])
844     if test "$ac_cv_gcc_arm_eabi" = "yes"; then
845         HAVE_ARM_EABI=1
846         ARM_ABI_PREFIX=eabi-
847     else
848         ARM_ABI_PREFIX=oabi-
849     fi
850   fi
852   TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
855 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
856 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
857 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
858 # linking XUL.
859 _SAVE_LDFLAGS=$LDFLAGS
860 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
861 AC_CACHE_CHECK(for __thread keyword for TLS variables,
862                ac_cv_thread_keyword,
863                [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
864                             [return tlsIsMainThread;],
865                             ac_cv_thread_keyword=yes,
866                             ac_cv_thread_keyword=no)])
867 LDFLAGS=$_SAVE_LDFLAGS
868 # The custom dynamic linker doesn't support TLS variables
869 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
870   # mips builds fail with TLS variables because of a binutils bug.
871   # See bug 528687
872   # OpenBSD doesn't have TLS support, and the test succeeds with clang++
873   case "${target}" in
874     mips*-*)
875       :
876       ;;
877     *-android*|*-linuxandroid*)
878       :
879       ;;
880     *-openbsd*)
881       :
882       ;;
883     *)
884       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
885       ;;
886   esac
889 if test -n "$MOZ_LINKER"; then
890 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
891 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
892 dnl Since the linker only understands the sysv ones, no need to build the
893 dnl gnu style tables anyways.
894   LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
897 dnl End of C++ language/feature checks
898 AC_LANG_C
900 fi # ! SKIP_COMPILER_CHECKS
902 if test -n "${COMPILE_ENVIRONMENT}"; then
903   MOZ_CHECK_ALLOCATOR
906 TARGET_XPCOM_ABI=
907 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
908     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
909     AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
912 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
913 dnl features that Windows actually does support.
915 if test -n "$SKIP_COMPILER_CHECKS"; then
916    dnl Windows has malloc.h
917    AC_DEFINE(MALLOC_H, [<malloc.h>])
918    AC_DEFINE(HAVE_FORCEINLINE)
919 fi # SKIP_COMPILER_CHECKS
921 dnl Mozilla specific options
922 dnl ========================================================
923 dnl The macros used for command line options
924 dnl are defined in build/autoconf/altoptions.m4.
926 dnl ========================================================
927 dnl =
928 dnl = Application
929 dnl =
930 dnl ========================================================
932 MOZ_BRANDING_DIRECTORY=
933 MOZ_OFFICIAL_BRANDING=
934 MOZ_NO_SMART_CARDS=
935 MOZ_BINARY_EXTENSIONS=
936 MOZ_DEVTOOLS=server
938 dnl ========================================================
939 dnl = Trademarked Branding
940 dnl ========================================================
941 MOZ_ARG_ENABLE_BOOL(official-branding,
942 [  --enable-official-branding
943                           Enable Official mozilla.org Branding
944                           Do not distribute builds with
945                           --enable-official-branding unless you have
946                           permission to use trademarks per
947                           http://www.mozilla.org/foundation/trademarks/ .],
948     MOZ_OFFICIAL_BRANDING=1,
949     MOZ_OFFICIAL_BRANDING=)
951 # Allow the application to influence configure with a confvars.sh script.
952 AC_MSG_CHECKING([if app-specific confvars.sh exists])
953 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
954   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
955   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
956 else
957   AC_MSG_RESULT([no])
960 AC_SUBST(MOZ_OFFICIAL_BRANDING)
961 if test -n "$MOZ_OFFICIAL_BRANDING"; then
962   if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
963     AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
964   else
965     MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
966     AC_DEFINE(MOZ_OFFICIAL_BRANDING)
967   fi
970 MOZ_ARG_WITH_STRING(branding,
971 [  --with-branding=dir     Use branding from the specified directory.],
972     MOZ_BRANDING_DIRECTORY=$withval)
974 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
975 if test -z "$REAL_BRANDING_DIRECTORY"; then
976   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
979 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
980   . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
983 AC_SUBST(MOZ_BRANDING_DIRECTORY)
985 dnl ========================================================
986 dnl = Distribution ID
987 dnl ========================================================
988 MOZ_ARG_WITH_STRING(distribution-id,
989 [  --with-distribution-id=ID
990                           Set distribution-specific id (default=org.mozilla)],
991 [ val=`echo $withval`
992     MOZ_DISTRIBUTION_ID="$val"])
994 if test -z "$MOZ_DISTRIBUTION_ID"; then
995    MOZ_DISTRIBUTION_ID="org.mozilla"
998 AC_SUBST(MOZ_DISTRIBUTION_ID)
1000 dnl ========================================================
1001 dnl = Enable code optimization. ON by default.
1002 dnl ========================================================
1004 # Use value from moz.configure if one is defined. Else use our computed
1005 # value.
1006 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1007     MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1010 if test "$COMPILE_ENVIRONMENT"; then
1011 if test -n "$MOZ_OPTIMIZE"; then
1012     AC_MSG_CHECKING([for valid C compiler optimization flags])
1013     _SAVE_CFLAGS=$CFLAGS
1014     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1015     AC_TRY_COMPILE([#include <stdio.h>],
1016         [printf("Hello World\n");],
1017         _results=yes,
1018         _results=no)
1019     AC_MSG_RESULT([$_results])
1020     if test "$_results" = "no"; then
1021         AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1022     fi
1023     CFLAGS=$_SAVE_CFLAGS
1024     if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1025         # When using llvm-based LTO, non numeric optimization levels are
1026         # not supported by the linker, so force the linker to use -O2 (
1027         # which doesn't influence the level compilation units are actually
1028         # compiled at).
1029         case " $MOZ_OPTIMIZE_FLAGS " in
1030         *\ -Os\ *|*\ -Oz\ *)
1031             MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1032             ;;
1033         esac
1034     fi
1036 fi # COMPILE_ENVIRONMENT
1038 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1039 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1040 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1042 case "${OS_TARGET}" in
1043 Android|WINNT|Darwin)
1044   MOZ_GLUE_IN_PROGRAM=
1045   ;;
1047   dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1048   MOZ_GLUE_IN_PROGRAM=1
1049   AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1050   ;;
1051 esac
1053 dnl ========================================================
1054 dnl = Jemalloc build setup
1055 dnl ========================================================
1056 if test -z "$MOZ_MEMORY"; then
1057   case "${target}" in
1058     *-mingw*)
1059       if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1060         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.])
1061       fi
1062       ;;
1063   esac
1064 else
1065   dnl The generic feature tests that determine how to compute ncpus are long and
1066   dnl complicated.  Therefore, simply define special cpp variables for the
1067   dnl platforms we have special knowledge of.
1068   case "${target}" in
1069   *-mingw*)
1070     export MOZ_NO_DEBUG_RTL=1
1071     ;;
1072   esac
1073 fi # MOZ_MEMORY
1074 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1076 dnl ========================================================
1077 dnl = Enable using the clang plugin to build
1078 dnl ========================================================
1080 if test -n "$COMPILE_ENVIRONMENT"; then
1081 MOZ_CONFIG_CLANG_PLUGIN
1082 fi # COMPILE_ENVIRONMENT
1084 if test -z "$SKIP_COMPILER_CHECKS"; then
1085 dnl ========================================================
1086 dnl Check for gcc -pipe support
1087 dnl ========================================================
1088 AC_MSG_CHECKING([for -pipe support])
1089 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1090     dnl Any gcc that supports firefox supports -pipe.
1091     CFLAGS="$CFLAGS -pipe"
1092     CXXFLAGS="$CXXFLAGS -pipe"
1093     AC_MSG_RESULT([yes])
1094 else
1095     AC_MSG_RESULT([no])
1098 fi # ! SKIP_COMPILER_CHECKS
1100 AC_LANG_C
1102 if test "$COMPILE_ENVIRONMENT"; then
1103 MOZ_EXPAND_LIBS
1104 fi # COMPILE_ENVIRONMENT
1106 dnl ========================================================
1107 dnl Check if we need the 32-bit Linux SSE2 error dialog
1108 dnl ========================================================
1110 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1112 dnl ========================================================
1113 dnl Check for cairo
1114 dnl ========================================================
1116 if test "$OS_ARCH" = "WINNT"; then
1117     # For now we assume that we will have a uint64_t available through
1118     # one of the above headers or mozstdint.h.
1119     AC_DEFINE(HAVE_UINT64_T)
1122 case "$MOZ_WIDGET_TOOLKIT" in
1123   windows)
1124     if test "$COMPILE_ENVIRONMENT"; then
1125       MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1126     fi
1127     ;;
1128 esac
1129 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1131 dnl ========================================================
1132 dnl =
1133 dnl = Maintainer debug option (no --enable equivalent)
1134 dnl =
1135 dnl ========================================================
1137 AC_SUBST_LIST(ASFLAGS)
1138 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1140 AC_SUBST(MOZ_STUB_INSTALLER)
1142 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1144 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1146 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1147   AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1150 dnl ========================================================
1151 dnl = Mac bundle name prefix
1152 dnl ========================================================
1153 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1154 [  --with-macbundlename-prefix=prefix
1155                           Prefix for MOZ_MACBUNDLE_NAME],
1156 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1158 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1159 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1160   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1163 if test "$MOZ_DEBUG"; then
1164   MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1165 else
1166   MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1168 AC_SUBST(MOZ_MACBUNDLE_NAME)
1170 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1171 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1172 # Otherwise, use MOZ_APP_DISPLAYNAME
1173 if test -z "$MOZ_MACBUNDLE_ID"; then
1174    MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1176 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1177 if test "$MOZ_DEBUG"; then
1178   MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1181 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1182 AC_SUBST(MOZ_MACBUNDLE_ID)
1184 dnl ========================================================
1185 dnl = Child Process Name for IPC
1186 dnl ========================================================
1187 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1188   MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1189 else
1190   # We want to let Android unpack the file at install time, but it only does
1191   # so if the file is named libsomething.so. The lib/ path is also required
1192   # because the unpacked file will be under the lib/ subdirectory and will
1193   # need to be executed from that path.
1194   MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1196 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1197 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
1199 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1200 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1201 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1203 # The following variables are available to branding and application
1204 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1205 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1206 # impacts profile location and user-visible fields.
1207 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1208 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1209 # builds (e.g. Aurora for Firefox).
1210 # - MOZ_APP_PROFILE: When set, used for application.ini's
1211 # "Profile" field, which controls profile location.
1212 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1213 # crash reporter server url.
1214 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1216 # The following environment variables used to have an effect, but don't anymore:
1217 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1218 # the contents from the version.txt file in the application directory, or
1219 # browser/config/version.txt if there isn't one.
1220 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1221 # in the "About" window. This was replaced with the contents from the
1222 # version_display.txt or version.txt in the application directory, or
1223 # browser/config/version_display.txt.
1225 # For extensions and langpacks, we require a max version that is compatible
1226 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1227 # 24.0a1 and 24.0a2 aren't affected
1228 # 24.0 becomes 24.*
1229 # 24.1.1 becomes 24.*
1230 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1231 if test -z "$IS_ALPHA"; then
1232   changequote(,)
1233   if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1234     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1235   else
1236     MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1237   fi
1238   changequote([,])
1239 else
1240   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1243 AC_SUBST(MOZ_APP_DISPLAYNAME)
1244 AC_SUBST(MOZ_APP_VENDOR)
1245 AC_SUBST(MOZ_APP_PROFILE)
1246 AC_SUBST(MOZ_APP_ID)
1247 AC_SUBST(MAR_CHANNEL_ID)
1248 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1249 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1250 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1251 AC_SUBST(MOZ_APP_UA_NAME)
1252 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1253 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1254 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1256 AC_SUBST(MOZ_APP_MAXVERSION)
1257 AC_SUBST(MOZ_PKG_SPECIAL)
1258 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1260 if test "$MOZILLA_OFFICIAL"; then
1261     # Build revisions should always be present in official builds
1262     MOZ_INCLUDE_SOURCE_INFO=1
1265 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1266 # explicitly set the repository and changeset information in.
1267 AC_SUBST(MOZ_SOURCE_REPO)
1268 AC_SUBST(MOZ_SOURCE_CHANGESET)
1269 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1271 dnl win32 options
1272 AC_SUBST(WIN32_REDIST_DIR)
1273 AC_SUBST(WIN_UCRT_REDIST_DIR)
1275 dnl Echo the CFLAGS to remove extra whitespace.
1276 CFLAGS=`echo \
1277     $_COMPILATION_CFLAGS \
1278     $CFLAGS`
1280 CXXFLAGS=`echo \
1281     $_COMPILATION_CXXFLAGS \
1282     $CXXFLAGS`
1284 COMPILE_CFLAGS=`echo \
1285     $_DEFINES_CFLAGS \
1286     $COMPILE_CFLAGS`
1288 COMPILE_CXXFLAGS=`echo \
1289     $_DEFINES_CXXFLAGS \
1290     $COMPILE_CXXFLAGS`
1292 HOST_CFLAGS=`echo \
1293     $_COMPILATION_HOST_CFLAGS \
1294     $HOST_CFLAGS`
1296 HOST_CXXFLAGS=`echo \
1297     $_COMPILATION_HOST_CXXFLAGS \
1298     $HOST_CXXFLAGS`
1300 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1301 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1302 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1303 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1304 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1305   OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1306   OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1308 AC_SUBST(HOST_CMFLAGS)
1309 AC_SUBST(HOST_CMMFLAGS)
1310 AC_SUBST(OS_COMPILE_CMFLAGS)
1311 AC_SUBST(OS_COMPILE_CMMFLAGS)
1313 OS_CFLAGS="$CFLAGS"
1314 OS_CXXFLAGS="$CXXFLAGS"
1315 OS_CPPFLAGS="$CPPFLAGS"
1316 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1317 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1318 OS_LDFLAGS="$LDFLAGS"
1319 OS_LIBS="$LIBS"
1320 AC_SUBST_LIST(OS_CFLAGS)
1321 AC_SUBST_LIST(OS_CXXFLAGS)
1322 AC_SUBST_LIST(OS_CPPFLAGS)
1323 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1324 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1325 AC_SUBST_LIST(OS_LDFLAGS)
1326 AC_SUBST(OS_LIBS)
1328 AC_SUBST(HOST_CC)
1329 AC_SUBST(HOST_CXX)
1330 AC_SUBST_LIST(HOST_CFLAGS)
1331 AC_SUBST_LIST(HOST_CPPFLAGS)
1332 AC_SUBST_LIST(HOST_CXXFLAGS)
1333 AC_SUBST(HOST_LDFLAGS)
1334 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1335 AC_SUBST(HOST_BIN_SUFFIX)
1337 AC_SUBST(TARGET_XPCOM_ABI)
1339 AC_SUBST(DSO_LDOPTS)
1340 AC_SUBST(BIN_SUFFIX)
1341 AC_SUBST(USE_N32)
1342 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1343 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1345 AC_SUBST(MOZ_DEVTOOLS)
1347 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1349 AC_SUBST(DMG_TOOL)
1351 dnl Host JavaScript runtime, if any, to use during cross compiles.
1352 AC_SUBST(JS_BINARY)
1354 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1356 dnl Set various defines and substitutions
1357 dnl ========================================================
1359 AC_SUBST(MOZ_DEV_EDITION)
1360 if test -n "$MOZ_DEV_EDITION"; then
1361     AC_DEFINE(MOZ_DEV_EDITION)
1364 dnl Windows AccessibilityHandler
1365 dnl ========================================================
1367 if test -z "$MOZ_HANDLER_CLSID"; then
1368     MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
1369     MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
1370     MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
1371     MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
1374 AC_SUBST(MOZ_HANDLER_CLSID)
1375 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
1376 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
1377 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
1379 dnl Spit out some output
1380 dnl ========================================================
1382 # Avoid using obsolete NSPR features
1383 AC_DEFINE(NO_NSPR_10_SUPPORT)
1385 MOZ_CREATE_CONFIG_STATUS()
1387 rm -fr confdefs* $ac_clean_files