1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
16 dnl The Original Code is this file as it was released upon August 6, 1998.
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
24 dnl Jamie Zawinski <jwz@jwz.org>
25 dnl gettimeofday args check
26 dnl Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl gnomefe update & enable-pthreads
28 dnl Ramiro Estrugo <ramiro@netscape.com>
29 dnl X11 makedepend support
31 dnl Henry Sobotka <sobotka@axess.com>
33 dnl Dan Mosedale <dmose@mozilla.org>
35 dnl Seth Spitzer <sspitzer@netscape.com>
37 dnl Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl Howard Chu <hyc@symas.com>
40 dnl Mark Mentovai <mark@moxienet.com>:
41 dnl Mac OS X 10.4 support
42 dnl Giorgio Maone <g.maone@informaction.com>
43 dnl MSVC l10n compatible version check
44 dnl Ben Turner <mozilla@songbirdnest.com>
45 dnl Windows x64 support
46 dnl Makoto Kato <m_kato@ga2.so-net.ne.jp>
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
73 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
74 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
78 dnl = Don't change the following two lines. Doing so breaks:
80 dnl = CFLAGS="-foo" ./configure
82 dnl ========================================================
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
124 WINDRES_VERSION=2.14.90
127 GNOMEUI_VERSION=2.2.0
130 STARTUP_NOTIFICATION_VERSION=0.8
132 SQLITE_VERSION=3.7.11
133 LIBNOTIFY_VERSION=0.4
137 dnl Set various checks
138 dnl ========================================================
142 dnl Initialize the Pthread test variables early so they can be
143 dnl overridden by each platform.
144 dnl ========================================================
148 dnl Do not allow a separate objdir build if a srcdir build exists.
149 dnl ==============================================================
150 _topsrcdir=`cd \`dirname $0\`; pwd`
153 if test "$_topsrcdir" != "$_objdir"
155 # Check for a couple representative files in the source tree
157 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
158 if test -f $file; then
159 _conflict_files="$_conflict_files $file"
162 if test "$_conflict_files"; then
164 echo "* Your source tree contains these files:"
165 for file in $_conflict_files; do
169 * This indicates that you previously built in the source tree.
170 * A source tree build can confuse the separate objdir build.
172 * To clean up the source tree:
185 COMPILE_ENVIRONMENT=1
186 MOZ_ARG_DISABLE_BOOL(compile-environment,
187 [ --disable-compile-environment
188 Disable compiler/library checks.],
189 COMPILE_ENVIRONMENT= )
190 AC_SUBST(COMPILE_ENVIRONMENT)
192 MOZ_ARG_WITH_STRING(l10n-base,
193 [ --with-l10n-base=DIR path to l10n repositories],
194 L10NBASEDIR=$withval)
195 if test -n "$L10NBASEDIR"; then
196 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
197 AC_MSG_ERROR([--with-l10n-base must specify a path])
198 elif test -d "$L10NBASEDIR"; then
199 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
201 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
204 AC_SUBST(L10NBASEDIR)
206 dnl Check for Perl first -- needed for win32 SDK checks
207 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
208 if test -z "$PERL" -o "$PERL" = ":"; then
209 AC_MSG_ERROR([perl not found in \$PATH])
212 dnl ========================================================
213 dnl = Android uses a very custom (hacky) toolchain; we need to do this
214 dnl = here, so that the compiler checks can succeed
215 dnl ========================================================
217 MOZ_ARG_WITH_STRING(android-ndk,
218 [ --with-android-ndk=DIR
219 location where the Android NDK can be found],
220 android_ndk=$withval)
222 MOZ_ARG_WITH_STRING(android-toolchain,
223 [ --with-android-toolchain=DIR
224 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
225 android_toolchain=$withval)
228 MOZ_ARG_WITH_STRING(android-version,
229 [ --with-android-version=VER
230 android platform version, default 5],
231 android_version=$withval,
234 MOZ_ARG_WITH_STRING(android-sdk,
235 [ --with-android-sdk=DIR
236 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
237 android_sdk=$withval)
239 MOZ_ARG_WITH_STRING(android-platform,
240 [ --with-android-platform=DIR
241 location of platform dir, default NDK/build/platforms/android-5/arch-arm],
242 android_platform=$withval)
244 MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
245 [ --enable-android-libstdcxx
246 use GNU libstdc++ instead of STLPort for NDK >= 5],
247 MOZ_ANDROID_LIBSTDCXX=1,
248 MOZ_ANDROID_LIBSTDCXX= )
251 arm-linux*-android*|*-linuxandroid*)
252 android_tool_prefix="arm-linux-androideabi"
255 android_tool_prefix="i686-android-linux"
258 android_tool_prefix="arm-eabi"
261 android_tool_prefix="$target_os"
265 MOZ_ARG_WITH_STRING(gonk,
267 location of gonk dir],
270 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
271 [ --with-gonk-toolchain-prefix=DIR
272 prefix to gonk toolchain commands],
273 gonk_toolchain_prefix=$withval)
275 if test -n "$gonkdir" ; then
276 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
277 android_source="$gonkdir"
278 ANDROID_SOURCE="$android_source"
279 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
282 AS="$gonk_toolchain_prefix"as
283 CC="$gonk_toolchain_prefix"gcc
284 CXX="$gonk_toolchain_prefix"g++
285 CPP="$gonk_toolchain_prefix"cpp
286 LD="$gonk_toolchain_prefix"ld
287 AR="$gonk_toolchain_prefix"ar
288 RANLIB="$gonk_toolchain_prefix"ranlib
289 STRIP="$gonk_toolchain_prefix"strip
291 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
292 STLPORT_LIBS="-lstlport"
294 case "$target_cpu" in
303 CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice"
304 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
305 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
306 LIBS="$LIBS $STLPORT_LIBS"
308 dnl Add -llog by default, since we use it all over the place.
309 LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
311 dnl prevent cross compile section from using these flags as host flags
312 if test -z "$HOST_CPPFLAGS" ; then
315 if test -z "$HOST_CFLAGS" ; then
318 if test -z "$HOST_CXXFLAGS" ; then
321 if test -z "$HOST_LDFLAGS" ; then
326 AC_DEFINE(HAVE_SYS_UIO_H)
327 AC_DEFINE(HAVE_PTHREADS)
329 MOZ_CHROME_FILE_FORMAT=omni
334 *-android*|*-linuxandroid*)
335 if test -z "$android_ndk" ; then
336 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
339 if test -z "$android_sdk" ; then
340 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
342 if ! test -e "$android_sdk"/source.properties ; then
343 AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
346 # Minimum Android SDK API Level we require.
347 android_min_api_level=13
349 # Get the api level from "$android_sdk"/source.properties.
350 android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties`
352 if test -z "$android_api_level" ; then
353 AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
356 if ! test "$android_api_level" -eq "$android_api_level" ; then
357 AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
360 if test $android_api_level -lt $android_min_api_level ; then
361 AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).])
365 android_platform_tools="$android_sdk"/../../platform-tools
366 if test ! -d "$android_platform_tools" ; then
367 android_platform_tools="$android_sdk"/tools # SDK Tools < r8
370 if test -z "$android_toolchain" ; then
371 AC_MSG_CHECKING([for android toolchain directory])
373 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
375 android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
377 # With newer NDK, the toolchain path has changed.
378 if ! test -d "$android_toolchain" ; then
379 case "$target_cpu" in
381 target_name=arm-linux-androideabi-4.4.3
384 target_name=x86-4.4.3
387 android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86
390 if test -d "$android_toolchain" ; then
391 AC_MSG_RESULT([$android_toolchain])
393 AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
397 if test -z "$android_platform" ; then
398 AC_MSG_CHECKING([for android platform directory])
400 android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
402 # With newer NDK, the platform path has changed.
403 if ! test -d "$android_platform" ; then
404 android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
407 if test -d "$android_platform" ; then
408 AC_MSG_RESULT([$android_platform])
410 AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
415 AS="$android_toolchain"/bin/"$android_tool_prefix"-as
416 CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
417 CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
418 CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
419 LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
420 AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
421 RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
422 STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
423 OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
425 CPPFLAGS="-isystem $android_platform/usr/include $CPPFLAGS"
426 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
427 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
429 dnl Add -llog by default, since we use it all over the place.
430 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
431 dnl undefined symbol (present on the hardware, just not in the
433 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
435 dnl prevent cross compile section from using these flags as host flags
436 if test -z "$HOST_CPPFLAGS" ; then
439 if test -z "$HOST_CFLAGS" ; then
442 if test -z "$HOST_CXXFLAGS" ; then
445 if test -z "$HOST_LDFLAGS" ; then
449 ANDROID_NDK="${android_ndk}"
450 ANDROID_TOOLCHAIN="${android_toolchain}"
451 ANDROID_PLATFORM="${android_platform}"
452 ANDROID_SDK="${android_sdk}"
453 ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
454 ANDROID_VERSION="${android_version}"
455 if test -z "$ANDROID_PACKAGE_NAME" ; then
456 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
458 if test -z "$MOZ_MOBILE_COMPAT" ; then
459 MOZ_MOBILE_COMPAT='All'
463 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
464 AC_SUBST(ANDROID_VERSION)
466 MOZ_CHROME_FILE_FORMAT=omni
470 AC_PATH_PROG(OBJCOPY,objcopy)
476 AC_SUBST(ANDROID_NDK)
477 AC_SUBST(ANDROID_TOOLCHAIN)
478 AC_SUBST(ANDROID_PLATFORM)
479 AC_SUBST(ANDROID_SDK)
480 AC_SUBST(ANDROID_PLATFORM_TOOLS)
481 AC_SUBST(ANDROID_PACKAGE_NAME)
482 AC_SUBST(MOZ_MOBILE_COMPAT)
485 dnl ========================================================
486 dnl Checks for compilers.
487 dnl ========================================================
488 dnl Set CROSS_COMPILE in the environment when running configure
489 dnl to use the cross-compile setup for now
490 dnl ========================================================
492 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
495 if test "$COMPILE_ENVIRONMENT"; then
497 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
498 echo "cross compiling from $host to $target"
502 _SAVE_CFLAGS="$CFLAGS"
503 _SAVE_LDFLAGS="$LDFLAGS"
505 AC_MSG_CHECKING([for host c compiler])
506 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
507 if test -z "$HOST_CC"; then
508 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
510 AC_MSG_RESULT([$HOST_CC])
511 AC_MSG_CHECKING([for host c++ compiler])
512 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
513 if test -z "$HOST_CXX"; then
514 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
516 AC_MSG_RESULT([$HOST_CXX])
518 if test -z "$HOST_CFLAGS"; then
519 HOST_CFLAGS="$CFLAGS"
521 if test -z "$HOST_CXXFLAGS"; then
522 HOST_CXXFLAGS="$CXXFLAGS"
524 if test -z "$HOST_LDFLAGS"; then
525 HOST_LDFLAGS="$LDFLAGS"
527 if test -z "$HOST_AR_FLAGS"; then
528 HOST_AR_FLAGS="$AR_FLAGS"
530 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
531 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
533 CFLAGS="$HOST_CFLAGS"
534 LDFLAGS="$HOST_LDFLAGS"
536 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
537 AC_TRY_COMPILE([], [return(0);],
538 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
539 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
542 CFLAGS="$HOST_CXXFLAGS"
544 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
545 AC_TRY_COMPILE([], [return(0);],
546 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
547 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
551 LDFLAGS=$_SAVE_LDFLAGS
553 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
556 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
560 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
561 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
562 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
563 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
564 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
565 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
566 AC_DEFINE(CROSS_COMPILE)
571 # Work around the conftest.exe access problem on Windows
576 MOZ_PATH_PROGS(AS, $AS as, $CC)
577 AC_CHECK_PROGS(AR, ar, :)
578 AC_CHECK_PROGS(LD, ld, :)
579 AC_CHECK_PROGS(STRIP, strip, :)
580 AC_CHECK_PROGS(WINDRES, windres, :)
581 if test -z "$HOST_CC"; then
584 if test -z "$HOST_CFLAGS"; then
585 HOST_CFLAGS='$(CFLAGS)'
587 if test -z "$HOST_CXX"; then
590 if test -z "$HOST_CXXFLAGS"; then
591 HOST_CXXFLAGS='$(CXXFLAGS)'
593 if test -z "$HOST_LDFLAGS"; then
594 HOST_LDFLAGS='$(LDFLAGS)'
596 if test -z "$HOST_RANLIB"; then
597 HOST_RANLIB='$(RANLIB)'
599 if test -z "$HOST_AR"; then
602 if test -z "$HOST_AR_FLAGS"; then
603 HOST_AR_FLAGS='$(AR_FLAGS)'
613 if test "$GCC" = "yes"; then
615 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
617 if test "$GXX" = "yes"; then
619 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
621 if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
625 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
628 if test "$GNU_CC"; then
629 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
636 if test "$GCC" = yes; then
637 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
642 if test "$GXX" = yes; then
643 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
650 if test "$GCC" = yes; then
651 if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
656 if test "$GXX" = yes; then
657 if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
662 dnl ========================================================
663 dnl Special win32 checks
664 dnl ========================================================
666 # With win8, sdk target=602, WINVER=602
667 MOZ_ARG_ENABLE_BOOL(metro,
668 [ --enable-metro Enable Windows Metro build targets],
671 if test -n "$MOZ_METRO"; then
673 # Target the Windows 8 Kit
675 # Allow a higher api set
678 # Target the Windows 7 SDK by default
683 if test -n "$MOZ_METRO"; then
688 AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
693 MOZ_ARG_WITH_STRING(windows-version,
694 [ --with-windows-version=WINSDK_TARGETVER
695 Windows SDK version to target. Lowest version
696 currently allowed is 601 (Win7), highest is 602 (Win8)],
697 WINSDK_TARGETVER=$withval)
699 # Currently only two sdk versions allowed, 601 and 602
700 case "$WINSDK_TARGETVER" in
702 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
706 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
712 if test "$GCC" != "yes"; then
713 # Check to see if we are really running in a msvc environemnt
715 AC_CHECK_PROGS(MIDL, midl)
717 # Make sure compilers are valid
718 CFLAGS="$CFLAGS -TC -nologo"
719 CXXFLAGS="$CXXFLAGS -TP -nologo"
722 AC_TRY_COMPILE([#include <stdio.h>],
723 [ printf("Hello World\n"); ],,
724 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
727 AC_TRY_COMPILE([#include <new.h>],
728 [ unsigned *test = new unsigned(42); ],,
729 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
733 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
736 # Determine compiler version
737 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
738 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
739 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
740 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
741 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
742 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
744 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
745 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
747 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
748 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
751 if test "$_CC_MAJOR_VERSION" = "14"; then
752 dnl Require VC8SP1 or newer.
753 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
754 if test "$_CC_RELEASE" -lt 50727 -o \
755 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
756 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
760 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
761 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
762 elif test "$_CC_MAJOR_VERSION" = "15"; then
764 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
765 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
766 elif test "$_CC_MAJOR_VERSION" = "16"; then
768 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
769 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
770 elif test "$_CC_MAJOR_VERSION" = "17"; then
772 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
773 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
775 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
778 _MOZ_RTTI_FLAGS_ON='-GR'
779 _MOZ_RTTI_FLAGS_OFF='-GR-'
780 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
782 if test -n "$WIN32_REDIST_DIR"; then
783 if test ! -d "$WIN32_REDIST_DIR"; then
784 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
786 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
789 dnl Confirm we have the pri tools on win8 builds
790 if test -n "$MOZ_METRO"; then
791 AC_MSG_CHECKING([for makepri])
792 AC_CHECK_PROGS(MAKEPRI, makepri, "")
793 if test -z "MAKEPRI" ; then
794 AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
799 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
800 dnl not something else like "magnetic tape manipulation utility".
801 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
802 if test -z "$MSMT_TOOL"; then
803 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
807 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
809 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
810 if test -z "$MSMANIFEST_TOOL_VERSION"; then
811 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
817 # Check linker version
818 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
819 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
820 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
821 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
827 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
828 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
829 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
830 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
831 # Add flags if necessary
832 AC_MSG_CHECKING([for midl flags])
835 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
836 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
837 # MIDL version 7.00.0500 or later has no problem.
838 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
839 AC_MSG_RESULT([need -env win32])
841 AC_MSG_RESULT([none needed])
845 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
848 AC_MSG_RESULT([none needed])
852 # Identify which version of the SDK we're building with
853 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
855 MOZ_CHECK_HEADERS([winsdkver.h])
856 if test "$ac_cv_header_winsdkver_h" = "yes"; then
857 # Get the highest _WIN32_WINNT and NTDDI versions supported
858 # Take the higher of the two
859 # This is done because the Windows 7 beta SDK reports its
860 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
861 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
863 [cat > conftest.h <<EOF
864 #include <winsdkver.h>
865 #include <sdkddkver.h>
867 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
868 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
870 #define WINSDK_MAXVER NTDDI_MAXVER
875 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
878 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
880 # Any SDK which doesn't have WinSDKVer.h is too old.
881 AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
884 unset _MSVC_VER_FILTER
886 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
890 _SAVE_CXXFLAGS="$CXXFLAGS"
891 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
892 AC_TRY_COMPILE([#include <exception>],
893 [std::_Throw(std::exception()); return 0;],
894 ac_cv_have_std__Throw="yes",
895 ac_cv_have_std__Throw="no")
896 CXXFLAGS="$_SAVE_CXXFLAGS"
900 if test "$ac_cv_have_std__Throw" = "yes"; then
901 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
902 ac_cv_have_dllimport_exception_bug,
906 _SAVE_CXXFLAGS="$CXXFLAGS"
907 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
908 AC_TRY_LINK([#include <vector>],
909 [std::vector<int> v; return v.at(1);],
910 ac_cv_have_dllimport_exception_bug="no",
911 ac_cv_have_dllimport_exception_bug="yes")
912 CXXFLAGS="$_SAVE_CXXFLAGS"
915 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
917 MOZ_MSVC_STL_WRAP__Throw=1
918 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
921 AC_CACHE_CHECK(for overridable _RAISE,
926 _SAVE_CXXFLAGS="$CXXFLAGS"
927 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
928 AC_TRY_COMPILE([#include <xstddef>
930 #define _RAISE(x) externallyDefinedFunction((x).what())
933 [std::vector<int> v; return v.at(1);],
934 ac_cv_have__RAISE="no",
935 ac_cv_have__RAISE="yes")
936 CXXFLAGS="$_SAVE_CXXFLAGS"
939 if test "$ac_cv_have__RAISE" = "yes"; then
941 MOZ_MSVC_STL_WRAP__RAISE=1
942 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
944 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
948 if test "$WRAP_STL_INCLUDES" = "1"; then
949 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
952 # Check w32api version
953 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
954 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
955 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
956 AC_TRY_COMPILE([#include <w32api.h>],
957 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
958 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
959 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
960 #error "test failed."
962 , [ res=yes ], [ res=no ])
963 AC_MSG_RESULT([$res])
964 if test "$res" != "yes"; then
965 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
967 # Check windres version
968 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
969 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
970 AC_MSG_RESULT([$_WINDRES_VERSION])
971 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
972 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
973 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
974 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
975 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
976 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
977 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
978 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
979 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
980 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
981 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
982 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
984 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
987 MOZ_WINSDK_MAXVER=0x06020000
990 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
991 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
992 # Require OS features provided by IE 6.0 SP2 (XP SP2)
993 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
995 # If the maximum version supported by this SDK is lower than the target
997 AC_MSG_CHECKING([for Windows SDK being recent enough])
998 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
1002 AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
1005 # Make sure the sdk / code we're targeting has the right toolset
1006 AC_MSG_CHECKING([SDK and tools are in sync])
1007 if test -n "$MOZ_METRO"; then
1008 if test "$MOZ_MSVCVERSION" -gt "10"; then
1009 AC_MSG_RESULT("yes")
1012 AC_MSG_ERROR([Your MOZ_MSVCVERSION equals $MOZ_MSVCVERSION and you've enabled metro build support. You can't target metro without msvc 11 or higher. Disable metro support or switch to a newer set of tools.])
1016 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
1017 # Definitions matching sdkddkver.h
1018 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
1025 if test -n "$_WIN32_MSVC"; then
1027 SKIP_COMPILER_CHECKS=1
1028 SKIP_LIBRARY_CHECKS=1
1030 # Since we're skipping compiler and library checks, hard-code
1032 AC_DEFINE(HAVE_IO_H)
1033 AC_DEFINE(HAVE_SETBUF)
1034 AC_DEFINE(HAVE_ISATTY)
1037 fi # COMPILE_ENVIRONMENT
1039 AC_SUBST(MIDL_FLAGS)
1052 AC_SUBST(WRAP_STL_INCLUDES)
1053 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
1054 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
1056 dnl ========================================================
1057 dnl Checks for programs.
1058 dnl ========================================================
1062 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
1063 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
1064 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
1066 AC_MSG_RESULT([$_perl_version])
1068 if test "$_perl_res" != 0; then
1069 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
1073 AC_MSG_CHECKING([for full perl installation])
1074 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
1076 if test "$_perl_res" != 0; then
1078 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
1080 AC_MSG_RESULT([yes])
1083 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
1084 if test -z "$PYTHON"; then
1085 AC_MSG_ERROR([python was not found in \$PATH])
1088 MOZ_ARG_WITH_BOOL(system-ply,
1089 [ --with-system-ply Use system installed python ply library],
1090 [if $PYTHON -c 'import ply' 2>&5; then
1093 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
1096 AC_SUBST(MOZ_SYSTEM_PLY)
1098 if test -z "$COMPILE_ENVIRONMENT"; then
1099 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1101 AC_SUBST(NSINSTALL_BIN)
1103 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1104 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1105 MOZ_PATH_PROGS(UNZIP, unzip)
1106 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
1107 AC_MSG_ERROR([unzip not found in \$PATH])
1109 MOZ_PATH_PROGS(ZIP, zip)
1110 if test -z "$ZIP" -o "$ZIP" = ":"; then
1111 AC_MSG_ERROR([zip not found in \$PATH])
1113 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1114 MOZ_PATH_PROG(XARGS, xargs)
1115 if test -z "$XARGS" -o "$XARGS" = ":"; then
1116 AC_MSG_ERROR([xargs not found in \$PATH .])
1119 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
1122 if test "$COMPILE_ENVIRONMENT"; then
1124 dnl ========================================================
1125 dnl = Mac OS X toolchain support
1126 dnl ========================================================
1128 case "$target_os" in
1130 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1131 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1132 dnl the environment and includedir purposes (when using an SDK, below),
1133 dnl but remember the full version number for the libdir (SDK).
1135 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1136 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1138 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1139 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1140 dnl 4.0.0/4061 is the default compiler in Tiger.
1142 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1144 if test "$GCC_BUILD" = "4061" ; then
1145 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1146 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1147 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1151 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1152 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1153 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1154 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1156 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1157 dnl it has moved into /usr/bin.
1158 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1162 AC_SUBST(GCC_VERSION)
1164 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1165 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
1166 dnl when we can run target binaries.
1167 AC_SUBST(UNIVERSAL_BINARY)
1168 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
1170 dnl ========================================================
1171 dnl Check for MacOS deployment target version
1172 dnl ========================================================
1174 MOZ_ARG_ENABLE_STRING(macos-target,
1175 [ --enable-macos-target=VER (default=10.5)
1176 Set the minimum MacOS version needed at runtime],
1177 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1181 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1182 dnl Use the specified value
1183 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1185 dnl No value specified on the command line or in the environment,
1186 dnl use architecture minimum.
1187 case "${target_cpu}" in
1189 export MACOSX_DEPLOYMENT_TARGET=10.5
1192 export MACOSX_DEPLOYMENT_TARGET=10.6
1199 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1201 dnl ========================================================
1202 dnl = Mac OS X SDK support
1203 dnl ========================================================
1206 MOZ_ARG_WITH_STRING(macos-sdk,
1207 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1208 MACOS_SDK_DIR=$withval)
1210 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1211 dnl NEXT_ROOT will be set and exported only if it's needed.
1212 AC_SUBST(MACOS_SDK_DIR)
1215 if test "$MACOS_SDK_DIR"; then
1216 dnl Sync this section with the ones in NSPR and NSS.
1217 dnl Changes to the cross environment here need to be accounted for in
1218 dnl the libIDL checks (below) and xpidl build.
1220 if test ! -d "$MACOS_SDK_DIR"; then
1221 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1222 specify a valid SDK. SDKs are installed when the optional cross-development
1223 tools are selected during the Xcode/Developer Tools installation.])
1226 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1227 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1228 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1230 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1231 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1233 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1234 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1235 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1237 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1238 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1239 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1240 dnl be ignored and cause warnings when -syslibroot is specified.
1241 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1242 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1243 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1248 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1250 AC_TRY_COMPILE([#include <new>],[],
1254 AC_MSG_RESULT($result)
1256 if test "$result" = "no" ; then
1257 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1261 fi # COMPILE_ENVIRONMENT
1263 dnl clang prior to 2.9 (including Xcode 4) does not support all the
1264 dnl constructs required by the libtheora inline asm. This is used to
1265 dnl detect and disable it
1266 AC_MSG_CHECKING([whether the C compiler is clang older than version 2.9])
1270 #if defined(__clang__)
1271 # if __clang_major__<2 || (__clang_major__==2 && __clang_minor__<9)
1272 # error "clang older than 2.9 detected"
1280 AC_MSG_RESULT([$result])
1281 if test "$result" = "yes"; then
1284 dnl XCode 4.2 also shipped an llvm-gcc which couldn't compile
1285 dnl the libtheora inline asm.
1286 AC_MSG_CHECKING([bad gcc versions])
1287 if `$CC --version | grep -q "Apple Inc. build 5658"`; then
1288 AC_MSG_RESULT([Apple build 5658])
1291 AC_MSG_RESULT([we're ok])
1294 AC_SUBST(MOZ_NO_THEORA_ASM)
1296 if test "x$MOZ_NO_THEORA_ASM" = x1; then
1297 AC_MSG_WARN([Disabling libtheora inline assembly])
1300 if test -n "$MAKE"; then
1301 if test `echo $MAKE | grep -c make.py` != 1; then
1308 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1311 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1314 if test "$GMAKE" = ":"; then
1315 AC_MSG_ERROR([GNU make not found])
1319 if test "$COMPILE_ENVIRONMENT"; then
1325 fi # COMPILE_ENVIRONMENT
1327 dnl ========================================================
1328 dnl set the defaults first
1329 dnl ========================================================
1332 AR_EXTRACT='$(AR) x'
1346 MOZ_USER_DIR=".mozilla"
1349 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1351 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1353 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1355 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1357 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1358 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1359 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1360 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1361 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1362 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1363 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1364 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1368 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1370 USE_DEPENDENT_LIBS=1
1372 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1374 if test -n "$CROSS_COMPILE"; then
1375 OS_TARGET="${target_os}"
1376 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1378 case "${target_os}" in
1379 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1380 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1381 gnu*) OS_ARCH=GNU ;;
1382 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1383 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1384 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1387 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1390 OS_TARGET=`uname -s`
1391 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1392 OS_RELEASE=`uname -r`
1395 # Before this used `uname -m` when not cross compiling
1396 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1397 OS_TEST="${target_cpu}"
1399 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1401 #######################################################################
1402 # Master "Core Components" macros for getting the OS target #
1403 #######################################################################
1406 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1407 # cross-compilation.
1411 # Define and override various archtecture-specific variables, including
1420 case "$HOST_OS_ARCH" in
1434 if test -z "$GNU_CC"; then
1435 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1440 if test -z "$GNU_CXX"; then
1441 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1442 SOLARIS_SUNPRO_CXX=1
1445 AC_SUBST(SOLARIS_SUNPRO_CC)
1446 AC_SUBST(SOLARIS_SUNPRO_CXX)
1458 if test -z "$CROSS_COMPILE" ; then
1464 # If uname -s returns "Windows_NT", we assume that we are using
1465 # the uname.exe in MKS toolkit.
1467 # The -r option of MKS uname only returns the major version number.
1468 # So we need to use its -v option to get the minor version number.
1469 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1473 OS_MINOR_RELEASE=`uname -v`
1474 if test "$OS_MINOR_RELEASE" = "00"; then
1477 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1481 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1482 # the uname.exe in the MSYS tools.
1484 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1489 OS_RELEASE=`uname -v`.`uname -r`
1490 OS_TEST=${target_cpu}
1498 OS_RELEASE=`uname -v`
1501 case "${target_cpu}" in
1512 if test -z "$CROSS_COMPILE" ; then
1520 # Only set CPU_ARCH if we recognize the value of OS_TEST
1531 powerpc | ppc | rs6000)
1535 Alpha | alpha | ALPHA)
1568 if test -z "$OS_TARGET"; then
1571 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1573 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1574 dnl ===============================================================
1578 INTEL_ARCHITECTURE=1
1581 dnl Configure platform-specific CPU architecture compiler options.
1582 dnl ==============================================================
1585 dnl =================================================================
1586 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1587 dnl which is bad when cross compiling.
1588 dnl =================================================================
1589 if test "$COMPILE_ENVIRONMENT"; then
1590 configure_static_assert_macros='
1591 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1592 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1593 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1596 dnl test that the macros actually work:
1597 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1598 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1601 ac_cv_static_assertion_macros_work="yes"
1602 AC_TRY_COMPILE([$configure_static_assert_macros],
1603 [CONFIGURE_STATIC_ASSERT(1)],
1605 ac_cv_static_assertion_macros_work="no")
1606 AC_TRY_COMPILE([$configure_static_assert_macros],
1607 [CONFIGURE_STATIC_ASSERT(0)],
1608 ac_cv_static_assertion_macros_work="no",
1611 AC_TRY_COMPILE([$configure_static_assert_macros],
1612 [CONFIGURE_STATIC_ASSERT(1)],
1614 ac_cv_static_assertion_macros_work="no")
1615 AC_TRY_COMPILE([$configure_static_assert_macros],
1616 [CONFIGURE_STATIC_ASSERT(0)],
1617 ac_cv_static_assertion_macros_work="no",
1621 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1622 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1623 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1625 fi # COMPILE_ENVIRONMENT
1627 dnl ========================================================
1628 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1630 dnl ========================================================
1632 if test "$OS_TARGET" = "Android"; then
1633 case "${CPU_ARCH}-${MOZ_ARCH}" in
1635 ANDROID_CPU_ARCH=armeabi-v7a
1638 ANDROID_CPU_ARCH=armeabi
1641 ANDROID_CPU_ARCH=x86
1646 if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
1647 if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
1648 if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
1649 AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
1651 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
1652 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
1653 STLPORT_LIBS="-lstdc++"
1654 elif test -e "$android_ndk/sources/cxx-stl/stlport/src/iostream.cpp" ; then
1655 if test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
1656 STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
1657 elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
1658 STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
1660 AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
1662 STLPORT_SOURCES="$android_ndk/sources/cxx-stl/stlport"
1663 STLPORT_CPPFLAGS="-I$_objdir/build/stlport -I$android_ndk/sources/cxx-stl/stlport/stlport"
1664 STLPORT_LIBS="-lstlport_static"
1665 elif test "$target" != "arm-android-eabi"; then
1666 dnl fail if we're not building with NDKr4
1667 AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
1669 CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
1670 LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
1671 LIBS="$LIBS $STLPORT_LIBS"
1674 AC_SUBST([STLPORT_SOURCES])
1676 dnl ========================================================
1677 dnl Suppress Clang Argument Warnings
1678 dnl ========================================================
1679 if test -n "$CLANG_CC"; then
1680 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1681 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1683 if test -n "$CLANG_CXX"; then
1684 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1687 dnl ========================================================
1688 dnl = Use Address Sanitizer
1689 dnl ========================================================
1690 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1691 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1694 if test -n "$MOZ_ASAN"; then
1700 dnl ========================================================
1701 dnl = Enable hacks required for LLVM instrumentations
1702 dnl ========================================================
1703 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1704 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1707 if test -n "$MOZ_LLVM_HACKS"; then
1711 AC_SUBST(MOZ_NO_WLZDEFS)
1712 AC_SUBST(MOZ_CFLAGS_NSS)
1714 dnl ========================================================
1715 dnl GNU specific defaults
1716 dnl ========================================================
1717 if test "$GNU_CC"; then
1718 # FIXME: Let us build with strict aliasing. bug 414641.
1719 CFLAGS="$CFLAGS -fno-strict-aliasing"
1720 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1721 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1722 DSO_LDOPTS='-shared'
1723 if test "$GCC_USE_GNU_LD"; then
1724 # Some tools like ASan use a runtime library that is only
1725 # linked against executables, so we must allow undefined
1726 # symbols for shared objects in some cases.
1727 if test -z "$MOZ_NO_WLZDEFS"; then
1728 # Don't allow undefined symbols in libraries
1729 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1732 WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1734 DSO_PIC_CFLAGS='-fPIC'
1735 ASFLAGS="$ASFLAGS -fPIC"
1736 AC_MSG_CHECKING([for --noexecstack option to as])
1737 _SAVE_CFLAGS=$CFLAGS
1738 CFLAGS="$CFLAGS -Wa,--noexecstack"
1739 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1740 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1741 AC_MSG_RESULT([no]))
1742 CFLAGS=$_SAVE_CFLAGS
1743 AC_MSG_CHECKING([for -z noexecstack option to ld])
1744 _SAVE_LDFLAGS=$LDFLAGS
1745 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1746 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1748 LDFLAGS=$_SAVE_LDFLAGS)
1749 _MOZ_RTTI_FLAGS_ON=-frtti
1750 _MOZ_RTTI_FLAGS_OFF=-fno-rtti
1752 # Turn on GNU-specific warnings:
1753 # -Wall - turn on a lot of warnings
1754 # -pedantic - this is turned on below
1755 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1756 # -Wdeclaration-after-statement - MSVC doesn't like these
1757 # -Werror=return-type - catches missing returns, zero false positives
1758 # -Wtype-limits - catches overflow bugs, few false positives
1759 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1761 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1762 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1763 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1764 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1766 # Turn off the following warnings that -Wall/-pedantic turn on:
1767 # -Wno-unused - lots of violations in third-party code
1768 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1770 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1771 MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1773 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1774 # Don't use -Wcast-align with ICC or clang
1776 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1777 hppa | ia64 | sparc | arm)
1780 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1785 dnl Turn pedantic on but disable the warnings for long long
1788 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1789 _USE_CPP_INCLUDE_FLAG=1
1791 elif test "$SOLARIS_SUNPRO_CC"; then
1793 if test "$CPU_ARCH" = "sparc"; then
1794 # for Sun Studio on Solaris/SPARC
1795 DSO_PIC_CFLAGS='-xcode=pic32'
1797 DSO_PIC_CFLAGS='-KPIC'
1799 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1801 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1802 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1804 DSO_LDOPTS='-shared'
1805 if test "$GNU_LD"; then
1806 # Don't allow undefined symbols in libraries
1807 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1811 DSO_PIC_CFLAGS='-KPIC'
1812 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1815 if test "$GNU_CXX"; then
1816 # FIXME: Let us build with strict aliasing. bug 414641.
1817 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1819 # Turn on GNU-specific warnings:
1820 # -Wall - turn on a lot of warnings
1821 # -pedantic - this is turned on below
1822 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1823 # -Woverloaded-virtual - ???
1824 # -Werror=return-type - catches missing returns, zero false positives
1825 # -Wtype-limits - catches overflow bugs, few false positives
1826 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1828 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1829 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1830 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1831 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1833 # Turn off the following warnings that -Wall/-pedantic turn on:
1834 # -Wno-ctor-dtor-privacy - ???
1835 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1836 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1837 # -Wno-variadic-macros - ???
1839 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1840 MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1841 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1842 MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1844 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1845 # Don't use -Wcast-align with ICC or clang
1847 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1848 hppa | ia64 | sparc | arm)
1851 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1856 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1857 _USE_CPP_INCLUDE_FLAG=1
1859 # Recent clang and gcc support C++11 deleted functions without warnings if
1860 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1861 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1862 # unused. But clang's warning can be disabled, so when compiling with clang
1863 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1864 # deleted function syntax.
1865 if test "$CLANG_CXX"; then
1866 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1867 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1871 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1874 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1875 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1876 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1877 dnl normal behavior.
1878 dnl ========================================================
1880 MKSHLIB_UNFORCE_ALL=
1882 if test "$COMPILE_ENVIRONMENT"; then
1883 if test "$GNU_CC"; then
1884 AC_MSG_CHECKING(whether ld has archive extraction flags)
1885 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1886 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1887 ac_cv_mkshlib_force_and_unforce="no"
1888 exec 3<&0 <<LOOP_INPUT
1889 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1890 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1891 force="-Wl,-all"; unforce="-Wl,-none"
1898 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1901 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1903 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1907 eval $ac_cv_mkshlib_force_and_unforce
1908 MKSHLIB_FORCE_ALL=$force
1909 MKSHLIB_UNFORCE_ALL=$unforce
1912 fi # COMPILE_ENVIRONMENT
1914 dnl ========================================================
1915 dnl Checking for 64-bit OS
1916 dnl ========================================================
1917 if test "$COMPILE_ENVIRONMENT"; then
1920 AC_MSG_CHECKING(for 64-bit OS)
1921 AC_TRY_COMPILE([$configure_static_assert_macros],
1922 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1923 result="yes", result="no")
1924 AC_MSG_RESULT("$result")
1925 if test "$result" = "yes"; then
1926 AC_DEFINE(HAVE_64BIT_OS)
1929 AC_SUBST(HAVE_64BIT_OS)
1931 fi # COMPILE_ENVIRONMENT
1933 dnl ========================================================
1934 dnl Enable high-memory support on OS/2 by default.
1935 dnl ========================================================
1936 MOZ_OS2_HIGH_MEMORY=1
1937 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1938 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1939 MOZ_OS2_HIGH_MEMORY=,
1940 MOZ_OS2_HIGH_MEMORY=1 )
1941 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1943 dnl ========================================================
1944 dnl = Use profiling compile flags
1945 dnl ========================================================
1946 MOZ_ARG_ENABLE_BOOL(profiling,
1947 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1951 # For profiling builds keep the symbol information
1952 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1953 STRIP_FLAGS="--strip-debug"
1956 dnl ========================================================
1958 dnl ========================================================
1959 MOZ_ARG_ENABLE_BOOL(valgrind,
1960 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1963 if test -n "$MOZ_VALGRIND"; then
1964 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1966 [--enable-valgrind specified but Valgrind is not installed]))
1967 AC_DEFINE(MOZ_VALGRIND)
1969 AC_SUBST(MOZ_VALGRIND)
1971 dnl ========================================================
1973 dnl ========================================================
1974 MOZ_ARG_ENABLE_BOOL(dmd,
1975 [ --enable-dmd Enable DMD; also disables jemalloc (default=no)],
1978 if test -n "$MOZ_DMD"; then
1979 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1981 [--enable-dmd specified but Valgrind is not installed]))
1986 dnl ========================================================
1988 dnl ========================================================
1989 MOZ_ARG_ENABLE_BOOL(jprof,
1990 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1993 if test -n "$MOZ_JPROF"; then
1995 AC_DEFINE(MOZ_JPROF)
1998 dnl ========================================================
2000 dnl ========================================================
2001 MOZ_ENABLE_PROFILER_SPS=1
2003 case "${OS_TARGET}" in
2005 case "${CPU_ARCH}" in
2008 MOZ_ENABLE_PROFILER_SPS=
2012 case "${CPU_ARCH}" in
2015 MOZ_ENABLE_PROFILER_SPS=
2020 MOZ_ENABLE_PROFILER_SPS=
2024 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
2025 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
2028 dnl ========================================================
2030 dnl ========================================================
2031 MOZ_ARG_ENABLE_BOOL(shark,
2032 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
2035 if test -n "$MOZ_SHARK"; then
2037 AC_DEFINE(MOZ_SHARK)
2040 dnl ========================================================
2042 dnl ========================================================
2043 MOZ_ARG_ENABLE_BOOL(callgrind,
2044 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
2047 if test -n "$MOZ_CALLGRIND"; then
2049 AC_DEFINE(MOZ_CALLGRIND)
2052 dnl ========================================================
2054 dnl ========================================================
2055 MOZ_ARG_ENABLE_BOOL(vtune,
2056 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
2059 if test -n "$MOZ_VTUNE"; then
2061 AC_DEFINE(MOZ_VTUNE)
2064 dnl ========================================================
2066 dnl ========================================================
2067 if test -n "$MOZ_PROFILING"; then
2068 AC_DEFINE(MOZ_PROFILING)
2071 dnl ========================================================
2072 dnl System overrides of the defaults for host
2073 dnl ========================================================
2076 if test -n "$_WIN32_MSVC"; then
2078 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
2079 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
2080 HOST_RANLIB='echo ranlib'
2082 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
2084 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
2085 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
2086 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2087 HOST_BIN_SUFFIX=.exe
2090 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
2094 case "${host_cpu}" in
2096 if test -n "$_WIN32_MSVC"; then
2097 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
2101 if test -n "$_WIN32_MSVC"; then
2102 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
2104 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
2110 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
2111 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2112 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
2115 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2116 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
2117 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2118 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
2122 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
2123 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2124 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2125 HOST_BIN_SUFFIX=.exe
2130 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
2131 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2135 dnl We require version 2.5 or newer of Python to build.
2136 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
2138 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
2141 if test "$_python_res" != 0; then
2142 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
2144 AC_MSG_RESULT([yes])
2146 dnl Check for using a custom <stdint.h> implementation
2147 dnl ========================================================
2148 AC_MSG_CHECKING(for custom <stdint.h> implementation)
2149 if test "$MOZ_CUSTOM_STDINT_H"; then
2150 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
2151 AC_SUBST(MOZ_CUSTOM_STDINT_H)
2152 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
2154 AC_MSG_RESULT(none specified)
2157 dnl Get mozilla version from central milestone file
2158 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
2159 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
2161 dnl Get version of various core apps from the version files.
2162 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
2164 if test -z "$FIREFOX_VERSION"; then
2165 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
2168 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
2169 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
2170 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
2172 MOZ_DOING_LTO(lto_is_enabled)
2174 dnl ========================================================
2175 dnl System overrides of the defaults for target
2176 dnl ========================================================
2181 if test ! "$GNU_CC"; then
2182 if test ! "$HAVE_64BIT_OS"; then
2183 # Compiling with Visual Age C++ object model compat is the
2184 # default. To compile with object model ibm, add
2185 # AIX_OBJMODEL=ibm to .mozconfig.
2186 if test "$AIX_OBJMODEL" = "ibm"; then
2187 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
2194 AC_SUBST(AIX_OBJMODEL)
2195 DSO_LDOPTS='-qmkshrobj=1'
2196 DSO_CFLAGS='-qflag=w:w'
2198 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
2200 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2201 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2202 if test "$COMPILE_ENVIRONMENT"; then
2205 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
2207 [#if (__IBMCPP__ < 900)
2208 #error "Bad compiler"
2210 _BAD_COMPILER=,_BAD_COMPILER=1)
2211 if test -n "$_BAD_COMPILER"; then
2213 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
2215 AC_MSG_RESULT([yes])
2218 TARGET_COMPILER_ABI="ibmc"
2219 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
2220 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
2223 case "${target_os}" in
2228 if test "$COMPILE_ENVIRONMENT"; then
2229 MOZ_CHECK_HEADERS(sys/inttypes.h)
2231 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2235 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2244 _WARNINGS_CFLAGS="-Wall"
2245 _WARNINGS_CXXFLAGS="-Wall"
2246 # The test above doesn't work properly, at least on 3.1.
2247 MKSHLIB_FORCE_ALL=''
2248 MKSHLIB_UNFORCE_ALL=''
2254 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2255 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2256 MOZ_OPTIMIZE_FLAGS="-O3"
2258 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
2259 if test "$HAVE_64BIT_OS"; then
2264 STRIP="$STRIP -x -S"
2265 # Check whether we're targeting OS X or iOS
2266 AC_CACHE_CHECK(for iOS target,
2268 [AC_TRY_COMPILE([#include <TargetConditionals.h>
2269 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
2273 ac_cv_ios_target="yes",
2274 ac_cv_ios_target="no")])
2275 if test "$ac_cv_ios_target" = "yes"; then
2277 AC_DEFINE(XP_DARWIN)
2278 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
2280 AC_DEFINE(XP_MACOSX)
2281 AC_DEFINE(XP_DARWIN)
2282 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2283 # The ExceptionHandling framework is needed for Objective-C exception
2284 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2286 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2288 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2291 if test "x$lto_is_enabled" = "xyes"; then
2292 echo "Skipping -dead_strip because lto is enabled."
2293 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2294 dnl ===================================================================
2295 elif test "x$enable_dtrace" = "xyes"; then
2296 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2298 dnl check for the presence of the -dead_strip linker flag
2299 AC_MSG_CHECKING([for -dead_strip option to ld])
2300 _SAVE_LDFLAGS=$LDFLAGS
2301 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2302 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2303 if test -n "$_HAVE_DEAD_STRIP" ; then
2304 AC_MSG_RESULT([yes])
2305 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2310 LDFLAGS=$_SAVE_LDFLAGS
2312 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2316 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2317 DLL_SUFFIX=".so.1.0"
2318 DSO_LDOPTS="-shared"
2320 if test ! "$GNU_CC"; then
2321 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2327 if test ! "$GNU_CC"; then
2331 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2332 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2333 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2336 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2337 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2341 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2342 AC_DEFINE(_LARGEFILE64_SOURCE)
2347 if test ! "$GNU_CC"; then
2348 DSO_LDOPTS='-b -Wl,+s'
2351 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2352 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2353 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2355 DSO_LDOPTS='-b -E +s'
2356 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2357 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2359 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2360 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2363 *-android*|*-linuxandroid*)
2364 AC_DEFINE(NO_PW_GECOS)
2366 if test -n "$gonkdir"; then
2367 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2371 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2374 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2376 MOZ_GFX_OPTIMIZE_MOBILE=1
2377 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2381 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2382 # Similarly for GNU_CXX and INTEL_CXX.
2383 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2384 # -Os has been broken on Intel's C/C++ compilers for quite a
2385 # while; Intel recommends against using it.
2386 MOZ_OPTIMIZE_FLAGS="-O2"
2387 MOZ_DEBUG_FLAGS="-g"
2388 elif test "$GNU_CC" -o "$GNU_CXX"; then
2389 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2390 case $GCC_VERSION in
2392 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2393 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2395 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2396 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2397 MOZ_DEBUG_FLAGS="-g"
2400 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2404 case "${target_cpu}" in
2406 CFLAGS="$CFLAGS -mieee"
2407 CXXFLAGS="$CXXFLAGS -mieee"
2413 MOZ_DEBUG_FLAGS="-g" # We want inlining
2417 if test -z "$MC"; then
2427 # certain versions of cygwin's makedepend barf on the
2428 # #include <string> vs -I./dist/include/string issue so don't use it
2430 if test -n "$GNU_CC"; then
2432 CXX="$CXX -mwindows"
2433 CPP="$CPP -mwindows"
2434 CFLAGS="$CFLAGS -mms-bitfields"
2435 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2436 DSO_LDOPTS='-shared'
2437 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2438 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2440 # Use temp file for windres (bug 213281)
2441 RCFLAGS='-O coff --use-temp-file'
2442 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2443 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2445 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2446 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2448 IMPORT_LIB_SUFFIX=dll.a
2449 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2451 TARGET_COMPILER_ABI=msvc
2455 if test "$AS_BIN"; then
2456 AS="$(basename "$AS_BIN")"
2459 AR_FLAGS='-NOLOGO -OUT:"$@"'
2461 RANLIB='echo not_ranlib'
2462 STRIP='echo not_strip'
2473 IMPORT_LIB_SUFFIX=lib
2474 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2475 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2477 MKSHLIB_UNFORCE_ALL=
2478 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2479 _USE_CPP_INCLUDE_FLAG=1
2480 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2481 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2482 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2483 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2484 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2485 # make 'foo == bar;' error out
2486 CFLAGS="$CFLAGS -we4553"
2487 CXXFLAGS="$CXXFLAGS -we4553"
2488 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2489 MOZ_DEBUG_FLAGS='-Zi'
2490 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2491 WARNINGS_AS_ERRORS='-WX'
2492 MOZ_OPTIMIZE_FLAGS='-O1'
2494 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2495 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2496 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2497 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2498 if test $_MSC_VER -ge 1400; then
2499 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2500 dnl For profile-guided optimization
2501 PROFILE_GEN_CFLAGS="-GL"
2502 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2503 dnl XXX: PGO builds can fail with warnings treated as errors,
2504 dnl specifically "no profile data available" appears to be
2505 dnl treated as an error sometimes. This might be a consequence
2506 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2507 dnl with the linker doing most of the work in the whole-program
2508 dnl optimization/PGO case. I think it's probably a compiler bug,
2509 dnl but we work around it here.
2510 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2511 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2512 dnl Probably also a compiler bug, but what can you do?
2513 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2514 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2517 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/media/libjpeg)'
2518 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/media/libpng)'
2519 AC_DEFINE(HAVE_SNPRINTF)
2524 AC_DEFINE(HW_THREADS)
2525 AC_DEFINE(STDC_HEADERS)
2526 AC_DEFINE(NEW_H, <new>)
2527 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2528 TARGET_MD_ARCH=win32
2529 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2531 MOZ_USER_DIR="Mozilla"
2533 dnl Hardcode to win95 for now - cls
2534 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2536 dnl set NO_X11 defines here as the general check is skipped on win32
2542 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2543 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2549 if test -z "$MOZ_TOOLS"; then
2550 AC_MSG_ERROR([MOZ_TOOLS is not set])
2552 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2553 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2554 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2556 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2557 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2558 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2565 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.])
2571 if test "$HAVE_64BIT_OS"; then
2572 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2575 if test $_MSC_VER -ge 1400; then
2576 LDFLAGS="$LDFLAGS -SAFESEH"
2579 if test -n "$GNU_CC"; then
2580 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2581 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2583 AC_DEFINE(HAVE_STDCALL)
2584 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2587 MOZ_CHECK_HEADERS(mmintrin.h)
2591 if test -n "$_WIN32_MSVC"; then
2592 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2597 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2601 if test "$HAVE_64BIT_OS"; then
2608 CFLAGS="$CFLAGS -Dunix"
2609 CXXFLAGS="$CXXFLAGS -Dunix"
2610 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2612 DSO_PIC_CFLAGS='-fPIC -DPIC'
2613 DSO_LDOPTS='-shared'
2614 BIN_FLAGS='-Wl,--export-dynamic'
2616 DSO_PIC_CFLAGS='-fPIC -DPIC'
2617 DLL_SUFFIX=".so.1.0"
2618 DSO_LDOPTS='-shared'
2620 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2621 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2622 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2623 if test "$LIBRUNPATH"; then
2624 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2626 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2627 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2631 if test "$SO_VERSION"; then
2632 DLL_SUFFIX=".so.$SO_VERSION"
2634 DLL_SUFFIX=".so.1.0"
2636 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2638 DSO_PIC_CFLAGS='-fPIC'
2639 DSO_LDOPTS='-shared -fPIC'
2640 if test "$LIBRUNPATH"; then
2641 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2646 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2647 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2650 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2651 AC_DEFINE(TCPV40HDRS)
2657 IMPORT_LIB_SUFFIX=lib
2661 CFLAGS="$CFLAGS -Zomf"
2662 CXXFLAGS="$CXXFLAGS -Zomf"
2664 BIN_FLAGS='-Zlinker /ST:0x100000'
2668 WARNINGS_AS_ERRORS='-Werror'
2669 MOZ_DEBUG_FLAGS="-g -fno-inline"
2670 MOZ_OPTIMIZE_FLAGS="-O2"
2671 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2672 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2673 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2675 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2679 MOZ_USER_DIR="Mozilla"
2682 if test "$MOZTOOLS"; then
2683 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2685 AC_MSG_ERROR([MOZTOOLS is not set])
2687 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2688 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2689 LDFLAGS="$LDFLAGS -Zhigh-mem"
2690 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2691 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2694 # GCC for OS/2 currently predefines these, but we don't want them
2695 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2696 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2698 AC_CACHE_CHECK(for __declspec(dllexport),
2700 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2702 ac_os2_declspec="yes",
2703 ac_os2_declspec="no")])
2704 if test "$ac_os2_declspec" != "yes"; then
2705 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2711 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2714 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2715 # libraries one level up (e.g. libnspr4.so)
2716 if test "$SOLARIS_SUNPRO_CC"; then
2717 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2718 LIBS="-lCrun -lCstd -lc $LIBS"
2719 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2720 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2721 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2722 LDFLAGS="-xildoff $LDFLAGS"
2723 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2724 _SAVE_LDFLAGS=$LDFLAGS
2725 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2726 AC_TRY_LINK([#include <stdio.h>],
2727 [printf("Hello World\n");],
2729 [LDFLAGS=$_SAVE_LDFLAGS])
2731 MOZ_OPTIMIZE_FLAGS="-xO4"
2732 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2733 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2734 MKSHLIB_FORCE_ALL='-z allextract'
2735 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2742 AS='/usr/ccs/bin/as'
2743 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2745 TARGET_COMPILER_ABI="sunc"
2746 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2747 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2748 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2752 [#if (__SUNPRO_CC < 0x590)
2755 _BAD_COMPILER=,_BAD_COMPILER=1)
2756 if test -n "$_BAD_COMPILER"; then
2758 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2763 [#if (__SUNPRO_CC >= 0x5100)
2764 #error "Sun C++ 5.10 or above"
2766 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2767 if test "$_ABOVE_SS12U1"; then
2769 CXXFLAGS="$CXXFLAGS -xannotate=no"
2771 AC_MSG_RESULT([$_res])
2774 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2776 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2777 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2778 ASFLAGS="$ASFLAGS -fPIC"
2779 DSO_LDOPTS='-shared'
2780 WARNINGS_AS_ERRORS='-Werror'
2782 _WARNINGS_CXXFLAGS=''
2783 if test "$OS_RELEASE" = "5.3"; then
2784 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2787 if test "$OS_RELEASE" = "5.5.1"; then
2788 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2793 DSO_LDOPTS='-Bdynamic'
2794 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2795 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2797 AC_DEFINE(SPRINTF_RETURNS_STRING)
2798 case "$(target_os)" in
2800 DLL_SUFFIX='.so.1.0'
2806 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2811 AC_SUBST(MOZ_LINKER)
2812 if test -n "$MOZ_LINKER"; then
2813 AC_DEFINE(MOZ_LINKER)
2815 AC_SUBST(MOZ_ENABLE_SZIP)
2817 dnl Only one oddball right now (QNX), but this gives us flexibility
2818 dnl if any other platforms need to override this in the future.
2819 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2821 dnl ========================================================
2822 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2823 dnl by now will not have any way to link most binaries (tests
2824 dnl as well as viewer, apprunner, etc.), because some symbols
2825 dnl will be left out of the "composite" .so's by ld as unneeded.
2826 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2827 dnl they can link in the static libs that provide the missing
2829 dnl ========================================================
2830 NO_LD_ARCHIVE_FLAGS=
2831 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2832 NO_LD_ARCHIVE_FLAGS=1
2836 NO_LD_ARCHIVE_FLAGS=
2839 NO_LD_ARCHIVE_FLAGS=
2842 if test -z "$GNU_CC"; then
2843 NO_LD_ARCHIVE_FLAGS=
2847 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2849 dnl ========================================================
2850 dnl = Flags to strip unused symbols from .so components and
2851 dnl = to export jemalloc symbols when linking a program
2852 dnl ========================================================
2854 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2855 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2858 if test -z "$GNU_CC"; then
2859 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2861 if test -z "$GCC_USE_GNU_LD"; then
2862 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2864 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2869 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2872 if test -n "$GNU_CC"; then
2873 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2878 if test -z "$COMPILE_ENVIRONMENT"; then
2879 SKIP_COMPILER_CHECKS=1
2880 SKIP_LIBRARY_CHECKS=1
2883 if test -z "$SKIP_COMPILER_CHECKS"; then
2884 dnl Checks for typedefs, structures, and compiler characteristics.
2885 dnl ========================================================
2893 AC_MSG_CHECKING(for __stdcall)
2894 AC_CACHE_VAL(ac_cv___stdcall,
2895 [AC_TRY_COMPILE([template <typename Method> struct foo;
2896 template <> struct foo<void (*)()> {};
2897 template <> struct foo<void (__stdcall*)()> {};],
2899 [ac_cv___stdcall=true],
2900 [ac_cv___stdcall=false])])
2901 if test "$ac_cv___stdcall" = true ; then
2902 AC_DEFINE(HAVE_STDCALL)
2908 AC_MSG_CHECKING(for ssize_t)
2909 AC_CACHE_VAL(ac_cv_type_ssize_t,
2910 [AC_TRY_COMPILE([#include <stdio.h>
2911 #include <sys/types.h>],
2913 [ac_cv_type_ssize_t=true],
2914 [ac_cv_type_ssize_t=false])])
2915 if test "$ac_cv_type_ssize_t" = true ; then
2916 AC_DEFINE(HAVE_SSIZE_T)
2921 AC_STRUCT_ST_BLKSIZE
2922 AC_MSG_CHECKING(for siginfo_t)
2923 AC_CACHE_VAL(ac_cv_siginfo_t,
2924 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2925 #include <signal.h>],
2927 [ac_cv_siginfo_t=true],
2928 [ac_cv_siginfo_t=false])])
2929 if test "$ac_cv_siginfo_t" = true ; then
2930 AC_DEFINE(HAVE_SIGINFO_T)
2936 dnl Check for int64, uint, and uint_t.
2937 dnl ========================================================
2938 AC_MSG_CHECKING(for int64)
2939 AC_CACHE_VAL(ac_cv_int64,
2940 [AC_TRY_COMPILE([#include <stdio.h>
2941 #include <sys/types.h>],
2944 [ac_cv_int64=false])])
2945 if test "$ac_cv_int64" = true ; then
2946 AC_DEFINE(HAVE_INT64)
2951 AC_MSG_CHECKING(for uint)
2952 AC_CACHE_VAL(ac_cv_uint,
2953 [AC_TRY_COMPILE([#include <stdio.h>
2954 #include <sys/types.h>],
2957 [ac_cv_uint=false])])
2958 if test "$ac_cv_uint" = true ; then
2959 AC_DEFINE(HAVE_UINT)
2964 AC_MSG_CHECKING(for uint_t)
2965 AC_CACHE_VAL(ac_cv_uint_t,
2966 [AC_TRY_COMPILE([#include <stdio.h>
2967 #include <sys/types.h>],
2969 [ac_cv_uint_t=true],
2970 [ac_cv_uint_t=false])])
2971 if test "$ac_cv_uint_t" = true ; then
2972 AC_DEFINE(HAVE_UINT_T)
2978 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2979 dnl are defined when compiling C++ but not C. Since the result of this
2980 dnl test is used only in C++, do it in C++.
2983 AC_MSG_CHECKING(for uname.domainname)
2984 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2985 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2986 [ struct utsname *res; char *domain;
2987 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2988 [ac_cv_have_uname_domainname_field=true],
2989 [ac_cv_have_uname_domainname_field=false])])
2991 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2992 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2998 AC_MSG_CHECKING(for uname.__domainname)
2999 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3000 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3001 [ struct utsname *res; char *domain;
3002 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
3003 [ac_cv_have_uname_us_domainname_field=true],
3004 [ac_cv_have_uname_us_domainname_field=false])])
3006 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3007 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3013 dnl ========================================================
3015 dnl Should be smarter and check that the compiler does indeed have rtti
3016 dnl ========================================================
3018 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
3019 [ --enable-cpp-rtti Enable C++ RTTI ],
3020 [ _MOZ_USE_RTTI=1 ],
3023 if test "$_MOZ_USE_RTTI"; then
3024 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
3026 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
3029 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
3031 dnl Check whether we can use gcc's c++0x mode
3034 if test "$GNU_CXX"; then
3035 _SAVE_CXXFLAGS=$CXXFLAGS
3036 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3038 if test -z "$_MOZ_USE_RTTI"; then
3039 CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
3040 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
3041 ac_cv_cxx0x_headers_bug,
3042 [AC_TRY_COMPILE([#include <memory>], [],
3043 ac_cv_cxx0x_headers_bug="no",
3044 ac_cv_cxx0x_headers_bug="yes")])
3045 CXXFLAGS="$_SAVE_CXXFLAGS"
3046 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
3047 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3052 dnl Check for usable char16_t (2 bytes, unsigned)
3053 dnl (we might not need the unsignedness check anymore)
3054 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3055 ac_cv_have_usable_char16_t,
3056 [AC_TRY_COMPILE([$configure_static_assert_macros],
3057 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3058 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3059 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3060 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3061 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3062 ac_cv_have_usable_char16_t="yes",
3063 ac_cv_have_usable_char16_t="no")])
3064 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3065 AC_DEFINE(HAVE_CPP_CHAR16_T)
3067 elif test "$GNU_CXX"; then
3068 CXXFLAGS="$_SAVE_CXXFLAGS"
3071 dnl Check for usable wchar_t (2 bytes, unsigned)
3072 dnl (we really don't need the unsignedness check anymore)
3073 dnl ========================================================
3075 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3076 ac_cv_have_usable_wchar_v2,
3077 [AC_TRY_COMPILE([#include <stddef.h>
3078 $configure_static_assert_macros],
3079 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3080 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3081 ac_cv_have_usable_wchar_v2="yes",
3082 ac_cv_have_usable_wchar_v2="no")])
3083 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3084 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3085 HAVE_CPP_2BYTE_WCHAR_T=1
3086 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3087 dnl This is really gcc-only
3088 dnl Do this test using CXX only since some versions of gcc
3089 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3090 dnl only have short-wchar support for c++.
3091 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3093 _SAVE_CXXFLAGS=$CXXFLAGS
3094 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3096 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3097 ac_cv_have_usable_wchar_option_v2,
3098 [AC_TRY_LINK([#include <stddef.h>
3099 $configure_static_assert_macros],
3100 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3101 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3102 ac_cv_have_usable_wchar_option_v2="yes",
3103 ac_cv_have_usable_wchar_option_v2="no")])
3105 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3106 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3107 HAVE_CPP_2BYTE_WCHAR_T=1
3108 if test "$OS_TARGET" = Android; then
3109 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3110 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3111 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3112 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3114 WCHAR_CFLAGS="-fshort-wchar"
3117 CXXFLAGS=$_SAVE_CXXFLAGS
3123 dnl Check for .hidden assembler directive and visibility attribute.
3124 dnl Borrowed from glibc configure.in
3125 dnl ===============================================================
3126 if test "$GNU_CC"; then
3127 AC_CACHE_CHECK(for visibility(hidden) attribute,
3128 ac_cv_visibility_hidden,
3129 [cat > conftest.c <<EOF
3130 int foo __attribute__ ((visibility ("hidden"))) = 1;
3132 ac_cv_visibility_hidden=no
3133 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3134 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3135 ac_cv_visibility_hidden=yes
3140 if test "$ac_cv_visibility_hidden" = "yes"; then
3141 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3143 AC_CACHE_CHECK(for visibility(default) attribute,
3144 ac_cv_visibility_default,
3145 [cat > conftest.c <<EOF
3146 int foo __attribute__ ((visibility ("default"))) = 1;
3148 ac_cv_visibility_default=no
3149 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3150 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3151 ac_cv_visibility_default=yes
3156 if test "$ac_cv_visibility_default" = "yes"; then
3157 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3159 AC_CACHE_CHECK(for visibility pragma support,
3160 ac_cv_visibility_pragma,
3161 [cat > conftest.c <<EOF
3162 #pragma GCC visibility push(hidden)
3164 #pragma GCC visibility push(default)
3165 int foo_default = 1;
3167 ac_cv_visibility_pragma=no
3168 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3169 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3170 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3171 ac_cv_visibility_pragma=yes
3177 if test "$ac_cv_visibility_pragma" = "yes"; then
3178 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3179 ac_cv_have_visibility_class_bug,
3180 [cat > conftest.c <<EOF
3181 #pragma GCC visibility push(hidden)
3182 struct __attribute__ ((visibility ("default"))) TestStruct {
3185 __attribute__ ((visibility ("default"))) void TestFunc() {
3189 ac_cv_have_visibility_class_bug=no
3190 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3191 ac_cv_have_visibility_class_bug=yes
3193 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3194 ac_cv_have_visibility_class_bug=yes
3197 rm -rf conftest.{c,S}
3200 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3201 ac_cv_have_visibility_builtin_bug,
3202 [cat > conftest.c <<EOF
3203 #pragma GCC visibility push(hidden)
3204 #pragma GCC visibility push(default)
3206 #pragma GCC visibility pop
3208 __attribute__ ((visibility ("default"))) void Func() {
3210 memset(c, 0, sizeof(c));
3213 ac_cv_have_visibility_builtin_bug=no
3214 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3215 ac_cv_have_visibility_builtin_bug=yes
3217 if test `grep -c "@PLT" conftest.S` = 0; then
3218 ac_cv_visibility_builtin_bug=yes
3221 rm -f conftest.{c,S}
3223 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3224 "$ac_cv_have_visibility_class_bug" = "no"; then
3225 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3226 WRAP_SYSTEM_INCLUDES=1
3227 STL_FLAGS='-I$(DIST)/stl_wrappers'
3230 VISIBILITY_FLAGS='-fvisibility=hidden'
3231 fi # have visibility pragma bug
3232 fi # have visibility pragma
3233 fi # have visibility(default) attribute
3234 fi # have visibility(hidden) attribute
3237 # visibility hidden flag for Sun Studio on Solaris
3238 if test "$SOLARIS_SUNPRO_CC"; then
3239 VISIBILITY_FLAGS='-xldscope=hidden'
3240 fi # Sun Studio on Solaris
3242 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3243 AC_SUBST(VISIBILITY_FLAGS)
3248 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3249 dnl ========================================================
3250 if test "$GNU_CC"; then
3251 CFLAGS_save="${CFLAGS}"
3252 CFLAGS="${CFLAGS} -Werror"
3253 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3254 ac_cv_force_align_arg_pointer,
3255 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3257 ac_cv_force_align_arg_pointer="yes",
3258 ac_cv_force_align_arg_pointer="no")])
3259 CFLAGS="${CFLAGS_save}"
3260 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3261 HAVE_GCC_ALIGN_ARG_POINTER=1
3263 HAVE_GCC_ALIGN_ARG_POINTER=
3266 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3268 dnl Checks for header files.
3269 dnl ========================================================
3271 case "$target_os" in
3273 # for stuff like -lXshm
3274 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3277 MOZ_CHECK_COMMON_HEADERS
3279 dnl These are all the places some variant of statfs can be hiding.
3280 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3283 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
3284 MOZ_CHECK_HEADERS(linux/quota.h)
3286 dnl Try for MMX support
3287 dnl NB - later gcc versions require -mmmx for this header to be successfully
3288 dnl included (or another option which implies it, such as -march=pentium-mmx)
3289 MOZ_CHECK_HEADERS(mmintrin.h)
3291 dnl Check whether the compiler supports the new-style C++ standard
3292 dnl library headers (i.e. <new>) or needs the old "new.h"
3295 MOZ_CHECK_HEADER(new, [NEW_H=new])
3296 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3299 AC_ARG_ENABLE(dtrace,
3300 [ --enable-dtrace build with dtrace support if available (default=no)],
3301 [enable_dtrace="yes"],)
3302 if test "x$enable_dtrace" = "xyes"; then
3303 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3304 if test -n "$HAVE_DTRACE"; then
3305 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3307 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3310 AC_SUBST(HAVE_DTRACE)
3316 MOZ_CHECK_HEADERS(sys/cdefs.h)
3320 dnl Checks for libraries.
3321 dnl ========================================================
3326 AC_CHECK_LIB(c_r, gethostbyname_r)
3330 dnl We don't want to link with libdl even if it's present on OS X, since
3331 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3333 dnl We don't want to link against libm or libpthread on Darwin since
3334 dnl they both are just symlinks to libSystem and explicitly linking
3335 dnl against libSystem causes issues when debugging (see bug 299601).
3342 AC_SEARCH_LIBS(dlopen, dl,
3343 MOZ_CHECK_HEADER(dlfcn.h,
3344 AC_DEFINE(HAVE_DLOPEN)))
3348 _SAVE_CFLAGS="$CFLAGS"
3349 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3350 AC_CHECK_FUNCS(dladdr memmem)
3351 CFLAGS="$_SAVE_CFLAGS"
3353 if test ! "$GNU_CXX"; then
3357 AC_CHECK_LIB(C_r, demangle)
3360 AC_CHECK_LIB(C, demangle)
3365 dnl OS/2 has socket in libc.
3370 AC_CHECK_LIB(socket, socket)
3374 XLIBS="$X_EXTRA_LIBS"
3376 dnl ========================================================
3377 dnl Checks for X libraries.
3378 dnl Ordering is important.
3379 dnl Xt is dependent upon SM as of X11R6
3380 dnl ========================================================
3381 if test "$no_x" = "yes"; then
3384 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3385 XLIBS="-lX11 $XLIBS"
3386 _SAVE_LDFLAGS="$LDFLAGS"
3387 LDFLAGS="$XLDFLAGS $LDFLAGS"
3388 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3389 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3390 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3391 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3393 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3394 unset ac_cv_lib_Xt_XtFree
3395 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3396 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3397 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3398 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3401 # AIX needs the motif library linked before libXt to prevent
3402 # crashes in plugins linked against Motif - Bug #98892
3403 case "${target_os}" in
3405 XT_LIBS="-lXm $XT_LIBS"
3409 dnl ========================================================
3410 dnl = Check for XShm
3411 dnl ========================================================
3412 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3415 dnl ========================================================
3417 dnl ========================================================
3418 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3419 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3420 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3421 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3423 LDFLAGS="$_SAVE_LDFLAGS"
3425 dnl ========================================================
3426 dnl = Check for freetype2 and its functionality
3427 dnl ========================================================
3428 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
3430 if test "$_HAVE_FREETYPE2"; then
3432 _SAVE_CFLAGS="$CFLAGS"
3433 LIBS="$LIBS $FT2_LIBS"
3434 CFLAGS="$CFLAGS $FT2_CFLAGS"
3436 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3437 ac_cv_member_FT_Bitmap_Size_y_ppem,
3438 [AC_TRY_COMPILE([#include <ft2build.h>
3439 #include FT_FREETYPE_H],
3441 if (sizeof s.y_ppem) return 0;
3443 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3444 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3445 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3446 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3448 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3450 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3451 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3452 [FT_Bitmap_Size structure includes y_ppem field])
3454 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3457 CFLAGS="$_SAVE_CFLAGS"
3469 dnl ========================================================
3470 dnl = pthread support
3471 dnl = Start by checking whether the system support pthreads
3472 dnl ========================================================
3473 case "$target_os" in
3478 MOZ_CHECK_PTHREADS(pthreads,
3479 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3480 MOZ_CHECK_PTHREADS(pthread,
3481 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3482 MOZ_CHECK_PTHREADS(c_r,
3483 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3484 MOZ_CHECK_PTHREADS(c,
3493 dnl ========================================================
3494 dnl Check the command line for --with-pthreads
3495 dnl ========================================================
3496 MOZ_ARG_WITH_BOOL(pthreads,
3497 [ --with-pthreads Force use of system pthread library with NSPR ],
3498 [ if test "$USE_PTHREADS"x = x; then
3499 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3505 dnl ========================================================
3506 dnl Do the platform specific pthread hackery
3507 dnl ========================================================
3508 if test "$USE_PTHREADS"x != x
3511 dnl See if -pthread is supported.
3514 ac_cv_have_dash_pthread=no
3515 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3516 echo 'int main() { return 0; }' | cat > conftest.c
3517 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3518 if test $? -eq 0; then
3519 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3520 ac_cv_have_dash_pthread=yes
3521 case "$target_os" in
3523 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3526 CFLAGS="$CFLAGS -pthread"
3527 CXXFLAGS="$CXXFLAGS -pthread"
3533 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3536 dnl See if -pthreads is supported.
3538 ac_cv_have_dash_pthreads=no
3539 if test "$ac_cv_have_dash_pthread" = "no"; then
3540 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3541 echo 'int main() { return 0; }' | cat > conftest.c
3542 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3543 if test $? -eq 0; then
3544 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3545 ac_cv_have_dash_pthreads=yes
3546 CFLAGS="$CFLAGS -pthreads"
3547 CXXFLAGS="$CXXFLAGS -pthreads"
3551 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3556 AC_DEFINE(_REENTRANT)
3557 AC_DEFINE(_THREAD_SAFE)
3558 dnl -pthread links in -lc_r, so don't specify it explicitly.
3559 if test "$ac_cv_have_dash_pthread" = "yes"; then
3560 _PTHREAD_LDFLAGS="-pthread"
3562 _PTHREAD_LDFLAGS="-lc_r"
3566 *-*-openbsd*|*-*-bsdi*)
3567 AC_DEFINE(_REENTRANT)
3568 AC_DEFINE(_THREAD_SAFE)
3569 dnl -pthread links in -lc_r, so don't specify it explicitly.
3570 if test "$ac_cv_have_dash_pthread" = "yes"; then
3571 _PTHREAD_LDFLAGS="-pthread"
3575 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3576 AC_DEFINE(_REENTRANT)
3580 AC_DEFINE(_REENTRANT)
3584 AC_DEFINE(_REENTRANT)
3588 AC_DEFINE(_REENTRANT)
3589 if test "$SOLARIS_SUNPRO_CC"; then
3590 CFLAGS="$CFLAGS -mt"
3591 CXXFLAGS="$CXXFLAGS -mt"
3595 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3599 dnl Checks for library functions.
3600 dnl ========================================================
3601 AC_PROG_GCC_TRADITIONAL
3603 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3604 AC_CHECK_FUNCS(flockfile getpagesize)
3605 AC_CHECK_FUNCS(localtime_r strtok_r)
3607 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3608 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3609 ac_cv_clock_monotonic,
3610 [for libs in "" -lrt; do
3613 AC_TRY_LINK([#include <time.h>],
3614 [ struct timespec ts;
3615 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3616 ac_cv_clock_monotonic=$libs
3618 ac_cv_clock_monotonic=no)
3621 if test "$ac_cv_clock_monotonic" != "no"; then
3622 HAVE_CLOCK_MONOTONIC=1
3623 REALTIME_LIBS=$ac_cv_clock_monotonic
3624 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3625 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3626 AC_SUBST(REALTIME_LIBS)
3629 dnl check for wcrtomb/mbrtowc
3630 dnl =======================================================================
3631 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3634 AC_CACHE_CHECK(for wcrtomb,
3636 [AC_TRY_LINK([#include <wchar.h>],
3637 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3638 ac_cv_have_wcrtomb="yes",
3639 ac_cv_have_wcrtomb="no")])
3640 if test "$ac_cv_have_wcrtomb" = "yes"; then
3641 AC_DEFINE(HAVE_WCRTOMB)
3643 AC_CACHE_CHECK(for mbrtowc,
3645 [AC_TRY_LINK([#include <wchar.h>],
3646 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3647 ac_cv_have_mbrtowc="yes",
3648 ac_cv_have_mbrtowc="no")])
3649 if test "$ac_cv_have_mbrtowc" = "yes"; then
3650 AC_DEFINE(HAVE_MBRTOWC)
3657 ac_cv_func_res_ninit,
3660 #define _BSD_SOURCE 1
3664 [int foo = res_ninit(&_res);],
3665 [ac_cv_func_res_ninit=yes],
3666 [ac_cv_func_res_ninit=no])
3669 if test "$ac_cv_func_res_ninit" = "yes"; then
3670 AC_DEFINE(HAVE_RES_NINIT)
3671 dnl must add the link line we do something as foolish as this... dougt
3673 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3674 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3679 [for gnu_get_libc_version()],
3680 ac_cv_func_gnu_get_libc_version,
3682 #ifdef HAVE_GNU_LIBC_VERSION_H
3683 #include <gnu/libc-version.h>
3686 [const char *glibc_version = gnu_get_libc_version();],
3687 [ac_cv_func_gnu_get_libc_version=yes],
3688 [ac_cv_func_gnu_get_libc_version=no]
3692 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3693 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3697 darwin*|mingw*|os2*)
3701 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3702 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3703 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3705 LIBS="$LIBS $_ICONV_LIBS"
3714 iconv_t h = iconv_open("", "");
3715 iconv(h, NULL, NULL, NULL, NULL);
3718 [ac_cv_func_iconv=yes],
3719 [ac_cv_func_iconv=no]
3722 if test "$ac_cv_func_iconv" = "yes"; then
3723 AC_DEFINE(HAVE_ICONV)
3724 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3725 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3726 LIBICONV="$_ICONV_LIBS"
3728 [for iconv() with const input],
3729 ac_cv_func_const_iconv,
3735 const char *input = "testing";
3736 iconv_t h = iconv_open("", "");
3737 iconv(h, &input, NULL, NULL, NULL);
3740 [ac_cv_func_const_iconv=yes],
3741 [ac_cv_func_const_iconv=no]
3744 if test "$ac_cv_func_const_iconv" = "yes"; then
3745 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3757 dnl **********************
3758 dnl *** va_copy checks ***
3759 dnl **********************
3760 dnl we currently check for all three va_copy possibilities, so we get
3761 dnl all results in config.log for bug reports.
3762 AC_MSG_CHECKING(for an implementation of va_copy())
3763 AC_CACHE_VAL(ac_cv_va_copy,[
3766 void f (int i, ...) {
3767 va_list args1, args2;
3768 va_start (args1, i);
3769 va_copy (args2, args1);
3770 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3772 va_end (args1); va_end (args2);
3774 int main() { f (0, 42); return 0; }],
3780 AC_MSG_RESULT($ac_cv_va_copy)
3781 AC_MSG_CHECKING(for an implementation of __va_copy())
3782 AC_CACHE_VAL(ac_cv___va_copy,[
3785 void f (int i, ...) {
3786 va_list args1, args2;
3787 va_start (args1, i);
3788 __va_copy (args2, args1);
3789 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3791 va_end (args1); va_end (args2);
3793 int main() { f (0, 42); return 0; }],
3794 ac_cv___va_copy=yes,
3799 AC_MSG_RESULT($ac_cv___va_copy)
3800 AC_MSG_CHECKING(whether va_lists can be copied by value)
3801 AC_CACHE_VAL(ac_cv_va_val_copy,[
3804 void f (int i, ...) {
3805 va_list args1, args2;
3806 va_start (args1, i);
3808 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3810 va_end (args1); va_end (args2);
3812 int main() { f (0, 42); return 0; }],
3813 ac_cv_va_val_copy=yes,
3814 ac_cv_va_val_copy=no,
3815 ac_cv_va_val_copy=yes
3818 if test "x$ac_cv_va_copy" = "xyes"; then
3819 AC_DEFINE(VA_COPY, va_copy)
3820 AC_DEFINE(HAVE_VA_COPY)
3821 elif test "x$ac_cv___va_copy" = "xyes"; then
3822 AC_DEFINE(VA_COPY, __va_copy)
3823 AC_DEFINE(HAVE_VA_COPY)
3826 if test "x$ac_cv_va_val_copy" = "xno"; then
3827 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3829 AC_MSG_RESULT($ac_cv_va_val_copy)
3831 dnl ===================================================================
3832 dnl ========================================================
3833 dnl Put your C++ language/feature checks below
3834 dnl ========================================================
3838 if test "$GNU_CC"; then
3839 if test "$CPU_ARCH" = "arm" ; then
3840 AC_CACHE_CHECK(for ARM EABI,
3844 #if defined(__ARM_EABI__)
3847 #error Not ARM EABI.
3850 ac_cv_gcc_arm_eabi="yes",
3851 ac_cv_gcc_arm_eabi="no")])
3852 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3854 ARM_ABI_PREFIX=eabi-
3856 ARM_ABI_PREFIX=oabi-
3860 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3863 dnl Check for support of modern template specialization syntax
3864 dnl Test code and requirement from scc@netscape.com.
3865 dnl Autoconf cut-and-paste job by waterson@netscape.com
3866 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3867 ac_cv_cpp_modern_specialize_template_syntax,
3868 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3870 template <> struct X<Y> { double a; };,
3873 ac_cv_cpp_modern_specialize_template_syntax=yes,
3874 ac_cv_cpp_modern_specialize_template_syntax=no)])
3875 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3876 AC_MSG_ERROR([The C++ compiler does not support template specialization])
3879 dnl Some compilers support only full specialization, and some don't.
3880 AC_CACHE_CHECK(whether partial template specialization works,
3881 ac_cv_cpp_partial_specialization,
3882 [AC_TRY_COMPILE(template <class T> class Foo {};
3883 template <class T> class Foo<T*> {};,
3885 ac_cv_cpp_partial_specialization=yes,
3886 ac_cv_cpp_partial_specialization=no)])
3887 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3888 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3891 dnl Check to see if we can resolve ambiguity with |using|.
3892 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3893 ac_cv_cpp_ambiguity_resolving_using,
3894 [AC_TRY_COMPILE(class X {
3895 public: int go(const X&) {return 3;}
3896 int jo(const X&) {return 3;}
3898 class Y : public X {
3899 public: int go(int) {return 2;}
3900 int jo(int) {return 2;}
3902 private: using X::go;
3905 ac_cv_cpp_ambiguity_resolving_using=yes,
3906 ac_cv_cpp_ambiguity_resolving_using=no)])
3907 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3908 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3911 dnl See if a dynamic_cast to void* gives the most derived object.
3912 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3913 ac_cv_cpp_dynamic_cast_void_ptr,
3914 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3915 class Y { int j; public: virtual ~Y() { } };
3916 class Z : public X, public Y { int k; };
3922 return !((((void*)&mdo != (void*)subx) &&
3923 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3924 (((void*)&mdo != (void*)suby) &&
3925 ((void*)&mdo == dynamic_cast<void*>(suby))));
3927 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3928 ac_cv_cpp_dynamic_cast_void_ptr=no,
3929 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3930 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3931 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3935 dnl note that this one is reversed - if the test fails, then
3936 dnl we require implementations of unused virtual methods. Which
3937 dnl really blows because it means we'll have useless vtable
3939 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3940 ac_cv_cpp_unused_required,
3941 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3943 ac_cv_cpp_unused_required=no,
3944 ac_cv_cpp_unused_required=yes)])
3945 if test "$ac_cv_cpp_unused_required" = yes ; then
3946 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3950 dnl Some compilers have trouble comparing a constant reference to a templatized
3951 dnl class to zero, and require an explicit operator==() to be defined that takes
3952 dnl an int. This test separates the strong from the weak.
3954 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3955 ac_cv_trouble_comparing_to_zero,
3956 [AC_TRY_COMPILE([#include <algorithm>
3957 template <class T> class Foo {};
3959 template <class T> int operator==(const T2*, const T&) { return 0; }
3960 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3961 [Foo<int> f; return (0 != f);],
3962 ac_cv_trouble_comparing_to_zero=no,
3963 ac_cv_trouble_comparing_to_zero=yes)])
3964 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3965 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3968 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3969 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3970 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3972 _SAVE_LDFLAGS=$LDFLAGS
3973 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3974 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3975 ac_cv_thread_keyword,
3976 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3977 [return tlsIsMainThread;],
3978 ac_cv_thread_keyword=yes,
3979 ac_cv_thread_keyword=no)])
3980 LDFLAGS=$_SAVE_LDFLAGS
3981 # The custom dynamic linker doesn't support TLS variables
3982 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3983 # mips builds fail with TLS variables because of a binutils bug.
3989 *-android*|*-linuxandroid*)
3993 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3998 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3999 if test -n "$MOZ_LINKER"; then
4000 if test "$CPU_ARCH" = arm; then
4001 dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
4002 ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
4003 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
4004 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
4005 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
4006 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
4011 dnl The custom linker doesn't support text relocations, but NDK >= r6b
4012 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
4013 dnl We however want to avoid these text relocations, and this can be done
4014 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
4015 dnl doesn't contain anything at all, beside placeholders for some sections,
4016 dnl and crtbegin only contains a finalizer function that calls
4017 dnl __cxa_finalize. The custom linker actually takes care of calling
4018 dnl __cxa_finalize when the library doesn't call it itself, which makes it
4019 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
4020 dnl link crtbegin and crtend at all.
4021 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
4022 AC_CACHE_CHECK([whether the CRT objects have text relocations],
4023 ac_cv_crt_has_text_relocations,
4024 [echo 'int foo() { return 0; }' > conftest.cpp
4025 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
4026 test -s conftest${DLL_SUFFIX}; then
4027 if readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
4028 ac_cv_crt_has_text_relocations=yes
4030 ac_cv_crt_has_text_relocations=no
4033 AC_ERROR([couldn't compile a simple C file])
4036 if test "$ac_cv_crt_has_text_relocations" = yes; then
4037 dnl While we want libraries to skip the CRT files, we don't want
4038 dnl executables to be treated the same way. We thus set the flag
4039 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
4040 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
4041 dnl Using LDFLAGS in nspr is safe, since we only really build
4042 dnl libraries there.
4043 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
4044 NSPR_LDFLAGS=-nostartfiles
4048 dnl Check for the existence of various allocation headers/functions
4051 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4052 if test "$MALLOC_H" = ""; then
4053 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4054 if test "$MALLOC_H" = ""; then
4055 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4058 if test "$MALLOC_H" != ""; then
4059 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4062 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4063 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4065 dnl See if compiler supports some gcc-style attributes
4067 AC_CACHE_CHECK(for __attribute__((always_inline)),
4068 ac_cv_attribute_always_inline,
4069 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
4071 ac_cv_attribute_always_inline=yes,
4072 ac_cv_attribute_always_inline=no)])
4074 AC_CACHE_CHECK(for __attribute__((malloc)),
4075 ac_cv_attribute_malloc,
4076 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
4078 ac_cv_attribute_malloc=yes,
4079 ac_cv_attribute_malloc=no)])
4081 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4082 ac_cv_attribute_warn_unused,
4083 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
4085 ac_cv_attribute_warn_unused=yes,
4086 ac_cv_attribute_warn_unused=no)])
4088 dnl End of C++ language/feature checks
4091 dnl ========================================================
4092 dnl = Internationalization checks
4093 dnl ========================================================
4095 dnl Internationalization and Locale support is different
4096 dnl on various UNIX platforms. Checks for specific i18n
4097 dnl features go here.
4099 dnl check for LC_MESSAGES
4100 AC_CACHE_CHECK(for LC_MESSAGES,
4101 ac_cv_i18n_lc_messages,
4102 [AC_TRY_COMPILE([#include <locale.h>],
4103 [int category = LC_MESSAGES;],
4104 ac_cv_i18n_lc_messages=yes,
4105 ac_cv_i18n_lc_messages=no)])
4106 if test "$ac_cv_i18n_lc_messages" = yes; then
4107 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4110 AC_HAVE_FUNCS(localeconv)
4111 fi # ! SKIP_COMPILER_CHECKS
4114 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4115 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4118 dnl Mozilla specific options
4119 dnl ========================================================
4120 dnl The macros used for command line options
4121 dnl are defined in build/autoconf/altoptions.m4.
4123 dnl If the compiler supports these attributes, define them as
4124 dnl convenience macros.
4125 if test "$ac_cv_attribute_always_inline" = yes ; then
4126 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4128 AC_DEFINE(NS_ALWAYS_INLINE,)
4131 if test "$ac_cv_attribute_malloc" = yes ; then
4132 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4134 AC_DEFINE(NS_ATTR_MALLOC,)
4137 if test "$ac_cv_attribute_warn_unused" = yes ; then
4138 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4140 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4143 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4144 dnl features that Windows actually does support.
4146 if test -n "$SKIP_COMPILER_CHECKS"; then
4147 dnl Windows has malloc.h
4148 AC_DEFINE(MALLOC_H, [<malloc.h>])
4149 AC_DEFINE(HAVE_FORCEINLINE)
4150 AC_DEFINE(HAVE_LOCALECONV)
4151 fi # SKIP_COMPILER_CHECKS
4153 dnl ========================================================
4155 dnl = Check for external package dependencies
4157 dnl ========================================================
4158 MOZ_ARG_HEADER(External Packages)
4160 MOZ_ARG_WITH_STRING(libxul-sdk,
4161 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4162 LIBXUL_SDK_DIR=$withval)
4164 if test "$LIBXUL_SDK_DIR" = "yes"; then
4165 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4166 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4167 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4169 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4170 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4174 AC_SUBST(LIBXUL_SDK)
4176 if test -n "$LIBXUL_SDK"; then
4177 LIBXUL_DIST="$LIBXUL_SDK"
4179 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4181 AC_SUBST(LIBXUL_DIST)
4185 MOZ_ARG_WITH_BOOL(system-libxul,
4186 [ --with-system-libxul Use system installed libxul SDK],
4189 dnl ========================================================
4190 dnl = If NSPR was not detected in the system,
4191 dnl = use the one in the source tree (mozilla/nsprpub)
4192 dnl ========================================================
4193 MOZ_ARG_WITH_BOOL(system-nspr,
4194 [ --with-system-nspr Use system installed NSPR],
4195 _USE_SYSTEM_NSPR=1 )
4197 if test -n "$_USE_SYSTEM_NSPR"; then
4198 AM_PATH_NSPR(4.9.0, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
4201 if test -n "$MOZ_NATIVE_NSPR"; then
4202 _SAVE_CFLAGS=$CFLAGS
4203 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4204 AC_TRY_COMPILE([#include "prtypes.h"],
4205 [#ifndef PR_STATIC_ASSERT
4206 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
4208 [MOZ_NATIVE_NSPR=1],
4209 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4210 AC_TRY_COMPILE([#include "prtypes.h"],
4212 #error PR_UINT64 not defined or requires including prtypes.h
4214 [MOZ_NATIVE_NSPR=1],
4215 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
4216 CFLAGS=$_SAVE_CFLAGS
4218 if test "$OS_ARCH" = "WINNT"; then
4219 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4220 if test -n "$GNU_CC"; then
4221 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4223 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4226 NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4227 NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4231 dnl system libevent Support
4232 dnl ========================================================
4233 MOZ_ARG_WITH_STRING(system-libevent,
4234 [ --with-system-libevent=[PFX]
4235 Use system libevent [installed at prefix PFX]],
4236 LIBEVENT_DIR=$withval)
4238 _SAVE_CFLAGS=$CFLAGS
4239 _SAVE_LDFLAGS=$LDFLAGS
4241 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4242 MOZ_NATIVE_LIBEVENT=
4244 if test "${LIBEVENT_DIR}" = "yes"; then
4247 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4248 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4249 MOZ_CHECK_HEADER(event.h,
4250 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4251 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4253 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4254 AC_CHECK_LIB(event, event_init,
4255 [MOZ_NATIVE_LIBEVENT=1
4256 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4257 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4258 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4260 CFLAGS=$_SAVE_CFLAGS
4261 LDFLAGS=$_SAVE_LDFLAGS
4264 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4265 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4266 AC_SUBST(MOZ_LIBEVENT_LIBS)
4268 dnl ========================================================
4269 dnl = If NSS was not detected in the system,
4270 dnl = use the one in the source tree (mozilla/security/nss)
4271 dnl ========================================================
4273 MOZ_ARG_WITH_BOOL(system-nss,
4274 [ --with-system-nss Use system installed NSS],
4277 if test -n "$_USE_SYSTEM_NSS"; then
4278 AM_PATH_NSS(3.13.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4281 if test -n "$MOZ_NATIVE_NSS"; then
4282 NSS_LIBS="$NSS_LIBS -lcrmf"
4284 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4286 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4287 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4288 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4289 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4290 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4292 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4294 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4295 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4296 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4297 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4298 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4300 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4304 dnl ======================
4306 dnl ======================
4308 AC_MSG_CHECKING([for YASM assembler])
4309 AC_CHECK_PROGS(YASM, yasm, "")
4311 if test -n "$YASM"; then
4312 dnl Pull out yasm's version string
4314 _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
4317 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4318 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4319 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4320 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4321 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4324 if test -z "$SKIP_LIBRARY_CHECKS"; then
4325 dnl system JPEG support
4326 dnl ========================================================
4327 MOZ_ARG_WITH_STRING(system-jpeg,
4328 [ --with-system-jpeg[=PFX]
4329 Use system libjpeg [installed at prefix PFX]],
4332 _SAVE_CFLAGS=$CFLAGS
4333 _SAVE_LDFLAGS=$LDFLAGS
4335 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4336 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4337 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4339 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4342 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4345 if test "$SYSTEM_JPEG" = 1; then
4346 LIBS="$JPEG_LIBS $LIBS"
4347 AC_TRY_COMPILE([ #include <stdio.h>
4348 #include <sys/types.h>
4349 #include <jpeglib.h> ],
4350 [ #if JPEG_LIB_VERSION < $MOZJPEG
4351 #error "Insufficient JPEG library version ($MOZJPEG required)."
4354 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4356 CFLAGS=$_SAVE_CFLAGS
4357 LDFLAGS=$_SAVE_LDFLAGS
4360 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4361 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4362 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4365 dnl system ZLIB support
4366 dnl ========================================================
4367 MOZ_ARG_WITH_STRING(system-zlib,
4368 [ --with-system-zlib[=PFX]
4369 Use system libz [installed at prefix PFX]],
4372 _SAVE_CFLAGS=$CFLAGS
4373 _SAVE_LDFLAGS=$LDFLAGS
4375 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4376 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4377 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4379 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4382 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4383 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4385 if test "$SYSTEM_ZLIB" = 1; then
4386 LIBS="$ZLIB_LIBS $LIBS"
4387 AC_TRY_COMPILE([ #include <stdio.h>
4389 #include <zlib.h> ],
4390 [ #if ZLIB_VERNUM < $MOZZLIB
4391 #error "Insufficient zlib version ($MOZZLIB required)."
4394 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4396 CFLAGS=$_SAVE_CFLAGS
4397 LDFLAGS=$_SAVE_LDFLAGS
4400 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4401 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4402 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4405 if test "$MOZ_LINKER" = 1 -a "$SYSTEM_ZLIB" != 1; then
4406 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4409 dnl system BZIP2 Support
4410 dnl ========================================================
4411 MOZ_ARG_WITH_STRING(system-bz2,
4412 [ --with-system-bz2[=PFX]
4413 Use system libbz2 [installed at prefix PFX]],
4416 _SAVE_CFLAGS=$CFLAGS
4417 _SAVE_LDFLAGS=$LDFLAGS
4419 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4420 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4421 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4423 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4426 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4427 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4429 CFLAGS=$_SAVE_CFLAGS
4430 LDFLAGS=$_SAVE_LDFLAGS
4433 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4434 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4435 BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4438 dnl system PNG Support
4439 dnl ========================================================
4440 MOZ_ARG_WITH_STRING(system-png,
4441 [ --with-system-png[=PFX]
4442 Use system libpng [installed at prefix PFX]],
4445 _SAVE_CFLAGS=$CFLAGS
4446 _SAVE_LDFLAGS=$LDFLAGS
4448 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4449 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4450 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4451 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4452 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4454 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4457 _SAVE_PNG_LIBS=$PNG_LIBS
4458 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4459 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4461 AC_CHECK_LIB(png, png_get_acTL, ,
4462 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4465 if test "$SYSTEM_PNG" = 1; then
4466 LIBS="$PNG_LIBS $LIBS"
4467 AC_TRY_COMPILE([ #include <stdio.h>
4468 #include <sys/types.h>
4470 [ #if PNG_LIBPNG_VER < $MOZPNG
4471 #error "Insufficient libpng version ($MOZPNG required)."
4473 #ifndef PNG_UINT_31_MAX
4474 #error "Insufficient libpng version."
4477 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4479 CFLAGS=$_SAVE_CFLAGS
4480 LDFLAGS=$_SAVE_LDFLAGS
4483 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4484 PNG_CFLAGS="-I${PNG_DIR}/include"
4485 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4488 fi # SKIP_LIBRARY_CHECKS
4490 dnl system HunSpell Support
4491 dnl ========================================================
4492 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4493 [ --enable-system-hunspell
4494 Use system hunspell (located with pkgconfig)],
4497 if test -n "$SYSTEM_HUNSPELL"; then
4498 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4501 AC_SUBST(SYSTEM_HUNSPELL)
4503 dnl ========================================================
4504 dnl system libffi Support
4505 dnl ========================================================
4506 MOZ_ARG_ENABLE_BOOL(system-ffi,
4507 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4510 if test -n "$MOZ_NATIVE_FFI"; then
4511 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4512 # for non-GCC compilers.
4513 if test -z "$GNU_CC"; then
4514 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4516 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4518 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4521 dnl ========================================================
4522 dnl Java SDK support
4523 dnl ========================================================
4526 MOZ_ARG_WITH_STRING(java-bin-path,
4527 [ --with-java-bin-path=dir
4528 Location of Java binaries (java, javac, jar)],
4529 JAVA_BIN_PATH=$withval)
4531 dnl ========================================================
4535 dnl ========================================================
4537 MOZ_ARG_HEADER(Application)
4540 ENABLE_SYSTEM_EXTENSION_DIRS=1
4541 MOZ_BRANDING_DIRECTORY=
4542 MOZ_OFFICIAL_BRANDING=
4547 MOZ_AUTH_EXTENSION=1
4551 MOZ_SPEEX_RESAMPLER=1
4559 MOZ_VP8_ERROR_CONCEALMENT=
4569 LIBJPEG_TURBO_ASFLAGS=
4570 LIBJPEG_TURBO_X86_ASM=
4571 LIBJPEG_TURBO_X64_ASM=
4572 LIBJPEG_TURBO_ARM_ASM=
4576 MOZ_PREF_EXTENSIONS=1
4577 MOZ_PROFILELOCKING=1
4583 MOZ_JAVA_COMPOSITOR=
4584 MOZ_ONLY_TOUCH_EVENTS=
4586 MOZ_TOOLKIT_SEARCH=1
4588 MOZ_UNIVERSALCHARDET=1
4595 MOZ_DISABLE_DOMCRYPTO=
4599 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4602 MOZ_USE_NATIVE_POPUP_WINDOWS=
4603 MOZ_ANDROID_HISTORY=
4608 case "$target_os" in
4611 AC_DEFINE(NS_ENABLE_TSF)
4616 *-android*|*-linuxandroid*)
4617 if test "$CPU_ARCH" = "arm" ; then
4623 MOZ_THEME_FASTSTRIPE=1
4630 MOZ_ARG_ENABLE_STRING(application,
4631 [ --enable-application=APP
4635 tools/update-packaging (AUS-related packaging tools)],
4636 [ MOZ_BUILD_APP=$enableval ] )
4638 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4639 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4640 XULRUNNER_STUB_NAME=$withval)
4642 if test -z "$XULRUNNER_STUB_NAME"; then
4643 case "$target_os" in
4645 XULRUNNER_STUB_NAME=xulrunner
4648 XULRUNNER_STUB_NAME=xulrunner-stub
4651 AC_SUBST(XULRUNNER_STUB_NAME)
4653 AC_MSG_CHECKING([for application to build])
4654 if test -z "$MOZ_BUILD_APP"; then
4655 AC_MSG_RESULT([browser])
4656 MOZ_BUILD_APP=browser
4658 # default mobile to be mobile/xul
4659 if test "$MOZ_BUILD_APP" = "mobile" ; then
4660 MOZ_BUILD_APP=mobile/xul
4662 # We have a valid application only if it has a build.mk file in its top
4664 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4665 AC_MSG_RESULT([none])
4666 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4668 AC_MSG_RESULT([$MOZ_BUILD_APP])
4672 # Allow the application to influence configure with a confvars.sh script.
4674 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4675 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4676 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4677 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4682 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4683 MOZ_ARG_WITH_STRING(app-name,
4684 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4685 WITH_APP_NAME=$withval,
4688 if test -n "$WITH_APP_NAME" ; then
4689 MOZ_APP_NAME="$WITH_APP_NAME"
4692 MOZ_ARG_WITH_STRING(app-basename,
4693 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4694 WITH_APP_BASENAME=$withval,
4697 if test -n "$WITH_APP_BASENAME" ; then
4698 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4701 # Now is a good time to test for logic errors, define mismatches, etc.
4702 case "$MOZ_BUILD_APP" in
4704 if test "$LIBXUL_SDK"; then
4705 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4710 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4711 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4713 case "$MOZ_BUILD_APP" in
4715 AC_DEFINE(MOZ_PHOENIX)
4719 AC_DEFINE(MOZ_XULRUNNER)
4723 AC_SUBST(MOZ_BUILD_APP)
4724 AC_SUBST(MOZ_PHOENIX)
4725 AC_SUBST(MOZ_XULRUNNER)
4727 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4729 dnl ========================================================
4731 dnl = Toolkit Options
4733 dnl ========================================================
4734 MOZ_ARG_HEADER(Toolkit Options)
4736 dnl ========================================================
4737 dnl = Select the default toolkit
4738 dnl ========================================================
4739 MOZ_ARG_ENABLE_STRING(default-toolkit,
4740 [ --enable-default-toolkit=TK
4741 Select default toolkit
4742 Platform specific defaults:
4743 Mac OS X - cairo-cocoa
4745 Win32 - cairo-windows
4748 [ _DEFAULT_TOOLKIT=$enableval ],
4749 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4751 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4752 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4753 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4754 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4755 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4756 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4757 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4758 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4759 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4761 dnl nglayout only supports building with one toolkit,
4762 dnl so ignore everything after the first comma (",").
4763 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4765 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4768 MOZ_ARG_WITHOUT_BOOL(x,
4769 [ --without-x Build without X11],
4772 dnl ========================================================
4773 dnl = Enable the toolkit as needed =
4774 dnl ========================================================
4776 case "$MOZ_WIDGET_TOOLKIT" in
4779 MOZ_WIDGET_TOOLKIT=windows
4782 MOZ_INSTRUMENT_EVENT_LOOP=1
4785 cairo-gtk2|cairo-gtk2-x11)
4786 MOZ_WIDGET_TOOLKIT=gtk2
4788 MOZ_ENABLE_XREMOTE=1
4790 MOZ_GL_DEFAULT_PROVIDER=GLX
4796 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4797 TK_LIBS='$(MOZ_GTK2_LIBS)'
4798 AC_DEFINE(MOZ_WIDGET_GTK2)
4800 MOZ_INSTRUMENT_EVENT_LOOP=1
4804 MOZ_WIDGET_TOOLKIT=qt
4806 if test -z "$WITHOUT_X11"; then
4807 MOZ_ENABLE_XREMOTE=1
4808 MOZ_GL_DEFAULT_PROVIDER=GLX
4817 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4818 TK_LIBS='$(MOZ_QT_LIBS)'
4819 AC_DEFINE(MOZ_WIDGET_QT)
4824 MOZ_WIDGET_TOOLKIT=os2
4826 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4827 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4832 MOZ_WIDGET_TOOLKIT=cocoa
4833 AC_DEFINE(MOZ_WIDGET_COCOA)
4834 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4835 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4836 TK_CFLAGS="-DNO_X11"
4837 CFLAGS="$CFLAGS $TK_CFLAGS"
4838 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4839 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4840 MOZ_USER_DIR="Mozilla"
4841 MOZ_FS_LAYOUT=bundle
4843 MOZ_INSTRUMENT_EVENT_LOOP=1
4847 MOZ_WIDGET_TOOLKIT=uikit
4848 AC_DEFINE(MOZ_WIDGET_UIKIT)
4849 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4850 TK_CFLAGS="-DNO_X11"
4851 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4852 CFLAGS="$CFLAGS $TK_CFLAGS"
4853 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4854 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4855 MOZ_USER_DIR="Mozilla"
4856 MOZ_FS_LAYOUT=bundle
4860 AC_DEFINE(MOZ_WIDGET_ANDROID)
4861 MOZ_WIDGET_TOOLKIT=android
4862 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4863 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4866 MOZ_INSTRUMENT_EVENT_LOOP=1
4867 if test "$MOZ_BUILD_APP" = "mobile/xul"; then
4873 AC_DEFINE(MOZ_WIDGET_GONK)
4874 AC_DEFINE(MOZ_TOUCH)
4875 MOZ_WIDGET_TOOLKIT=gonk
4876 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4877 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4885 AC_SUBST(MOZ_OLD_LINKER)
4886 AC_SUBST(MOZ_PDF_PRINTING)
4887 if test "$MOZ_PDF_PRINTING"; then
4888 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4889 AC_DEFINE(MOZ_PDF_PRINTING)
4892 if test "$MOZ_ENABLE_XREMOTE"; then
4893 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4896 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4897 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4900 if test "$COMPILE_ENVIRONMENT"; then
4901 if test "$MOZ_ENABLE_GTK2"; then
4902 if test "$MOZ_X11"; then
4903 GDK_PACKAGES=gdk-x11-2.0
4906 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4909 fi # COMPILE_ENVIRONMENT
4911 AC_SUBST(MOZ_FS_LAYOUT)
4913 dnl ========================================================
4914 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4915 dnl their usage and use them in spidermonkey.
4916 dnl ========================================================
4917 MOZ_ARG_WITH_BOOL(arm-kuser,
4918 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4920 if test -n "$USE_ARM_KUSER"; then
4921 AC_DEFINE(USE_ARM_KUSER)
4924 dnl ========================================================
4925 dnl = startup-notification support module
4926 dnl ========================================================
4928 if test "$MOZ_ENABLE_GTK2"
4930 MOZ_ENABLE_STARTUP_NOTIFICATION=
4932 MOZ_ARG_ENABLE_BOOL(startup-notification,
4933 [ --enable-startup-notification
4934 Enable startup-notification support (default: disabled) ],
4935 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4936 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4937 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4939 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4940 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4941 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4942 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4944 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4946 MOZ_ENABLE_STARTUP_NOTIFICATION=
4950 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4951 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4954 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4956 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4957 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4958 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4960 dnl ========================================================
4962 dnl ========================================================
4963 if test "$MOZ_ENABLE_QT"
4965 MOZ_ARG_WITH_STRING(qtdir,
4966 [ --with-qtdir=\$dir Specify Qt directory ],
4969 if test -z "$QTDIR"; then
4970 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
4971 PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport QtQuick1,
4974 if test "$MOZ_ENABLE_QT5"; then
4976 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
4977 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
4980 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4981 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4983 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
4985 MOZ_QT_CFLAGS="-DQT_SHARED"
4986 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4987 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
4988 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4989 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4990 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4991 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4992 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4993 HOST_MOC="$QTDIR/bin/moc"
4994 HOST_RCC="$QTDIR/bin/rcc"
4996 # QtWidgets was introduced only in Qt5
4997 if test -d $QTDIR/include/QtWidgets; then
4999 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
5000 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMultimedia"
5001 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
5002 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtQuick1"
5003 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtMultimedia -lQtPrintSupport -lQtQuick1"
5006 if test -z "$HOST_MOC"; then
5007 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5010 if test -z "$HOST_RCC"; then
5011 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
5018 MOZ_ENABLE_QMSYSTEM2=
5019 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
5020 MOZ_ENABLE_QMSYSTEM2=1,
5021 MOZ_ENABLE_QMSYSTEM2=)
5023 if test "$MOZ_ENABLE_QMSYSTEM2"; then
5024 MOZ_ENABLE_QMSYSTEM2=1
5025 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
5026 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
5027 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
5030 MOZ_ENABLE_QTNETWORK=
5031 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5032 MOZ_ENABLE_QTNETWORK=1,
5033 MOZ_ENABLE_QTNETWORK=)
5035 if test "$MOZ_ENABLE_QTNETWORK"; then
5036 MOZ_ENABLE_QTNETWORK=1
5037 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5040 MOZ_ENABLE_QTMOBILITY=
5041 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
5042 MOZ_ENABLE_QTMOBILITY=1,
5043 MOZ_ENABLE_QTMOBILITY=)
5044 if test "$MOZ_ENABLE_QTMOBILITY"; then
5045 MOZ_ENABLE_QTMOBILITY=1
5046 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
5047 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
5049 AC_CHECK_LIB(QtSensors, main, [
5050 MOZ_ENABLE_QTMOBILITY=1
5051 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
5052 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
5053 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
5054 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
5055 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
5058 if test "$MOZ_ENABLE_QTMOBILITY"; then
5059 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
5063 AC_SUBST(GTK_CONFIG)
5067 AC_SUBST(MOZ_ENABLE_GTK2)
5068 AC_SUBST(MOZ_ENABLE_QT)
5069 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5070 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
5071 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
5072 AC_SUBST(MOZ_ENABLE_XREMOTE)
5073 AC_SUBST(MOZ_GTK2_CFLAGS)
5074 AC_SUBST(MOZ_GTK2_LIBS)
5075 AC_SUBST(MOZ_QT_CFLAGS)
5076 AC_SUBST(MOZ_QT_LIBS)
5083 dnl ========================================================
5085 dnl = Components & Features
5087 dnl ========================================================
5088 MOZ_ARG_HEADER(Components and Features)
5090 dnl ========================================================
5092 dnl ========================================================
5093 MOZ_ARG_ENABLE_STRING(ui-locale,
5094 [ --enable-ui-locale=ab-CD
5095 Select the user interface locale (default: en-US)],
5096 MOZ_UI_LOCALE=$enableval )
5097 AC_SUBST(MOZ_UI_LOCALE)
5099 dnl ========================================================
5100 dnl = Trademarked Branding
5101 dnl ========================================================
5102 MOZ_ARG_ENABLE_BOOL(official-branding,
5103 [ --enable-official-branding
5104 Enable Official mozilla.org Branding
5105 Do not distribute builds with
5106 --enable-official-branding unless you have
5107 permission to use trademarks per
5108 http://www.mozilla.org/foundation/trademarks/ .],
5110 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5111 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5113 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5114 MOZ_OFFICIAL_BRANDING=1
5116 ], MOZ_OFFICIAL_BRANDING=)
5118 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5119 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5120 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5123 MOZ_ARG_WITH_STRING(branding,
5124 [ --with-branding=dir Use branding from the specified directory.],
5125 MOZ_BRANDING_DIRECTORY=$withval)
5127 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5128 if test -z "$REAL_BRANDING_DIRECTORY"; then
5129 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5132 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5133 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5136 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5138 dnl ========================================================
5139 dnl = Distribution ID
5140 dnl ========================================================
5141 MOZ_ARG_WITH_STRING(distribution-id,
5142 [ --with-distribution-id=ID
5143 Set distribution-specific id (default=org.mozilla)],
5144 [ val=`echo $withval`
5145 MOZ_DISTRIBUTION_ID="$val"])
5147 if test -z "$MOZ_DISTRIBUTION_ID"; then
5148 MOZ_DISTRIBUTION_ID="org.mozilla"
5151 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5152 AC_SUBST(MOZ_DISTRIBUTION_ID)
5155 dnl ========================================================
5156 dnl complex text support off by default
5157 dnl ========================================================
5158 MOZ_ARG_DISABLE_BOOL(pango,
5159 [ --disable-pango Disable usage of Pango ],
5163 dnl ========================================================
5165 dnl ========================================================
5166 if test "$MOZ_ENABLE_GTK2"
5170 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5172 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5173 AC_SUBST(MOZ_PANGO_CFLAGS)
5174 AC_SUBST(MOZ_PANGO_LIBS)
5175 if test "$MOZ_PANGO"
5177 AC_DEFINE(MOZ_PANGO)
5179 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5180 AC_SUBST(FT2_CFLAGS)
5185 if test "$MOZ_ENABLE_QT"
5187 if test "$MOZ_PANGO"
5189 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5191 AC_SUBST(MOZ_PANGO_CFLAGS)
5192 AC_SUBST(MOZ_PANGO_LIBS)
5193 AC_DEFINE(MOZ_PANGO)
5196 echo "Pango library not found, will use FT2 font engine"
5203 dnl ========================================================
5204 dnl = GnomeVFS, GIO and GConf support module
5205 dnl ========================================================
5209 dnl build the gnomevfs extension by default only when the
5210 dnl GTK2 toolkit is in use.
5211 if test "$MOZ_ENABLE_GTK2"
5213 MOZ_ENABLE_GNOMEVFS=1
5217 dnl ========================================================
5218 dnl = GnomeVFS support module
5219 dnl ========================================================
5220 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5221 [ --disable-gnomevfs Disable GnomeVFS support ],
5222 MOZ_ENABLE_GNOMEVFS=,
5223 MOZ_ENABLE_GNOMEVFS=force)
5225 if test "$MOZ_ENABLE_GNOMEVFS"
5227 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5228 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5229 MOZ_ENABLE_GNOMEVFS=1
5230 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5232 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5234 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5236 MOZ_ENABLE_GNOMEVFS=
5239 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5240 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5241 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5246 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5247 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5248 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5250 dnl ========================================================
5251 dnl = GIO support module
5252 dnl ========================================================
5253 MOZ_ARG_ENABLE_BOOL(gio,
5254 [ --enable-gio Enable GIO support (default: disabled)],
5255 MOZ_ENABLE_GIO=force,
5258 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5260 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
5261 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5262 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5263 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5265 AC_DEFINE(MOZ_ENABLE_GIO)
5267 if test "$MOZ_ENABLE_GIO" = "force"
5269 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5275 AC_SUBST(MOZ_ENABLE_GIO)
5276 AC_SUBST(MOZ_GIO_CFLAGS)
5277 AC_SUBST(MOZ_GIO_LIBS)
5279 dnl ========================================================
5280 dnl = GConf support module
5281 dnl ========================================================
5282 MOZ_ARG_DISABLE_BOOL(gconf,
5283 [ --disable-gconf Disable Gconf support ],
5285 MOZ_ENABLE_GCONF=force)
5287 if test "$MOZ_ENABLE_GCONF"
5289 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5290 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5293 if test "$MOZ_ENABLE_GCONF" = "force"
5295 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5301 if test "$MOZ_ENABLE_GCONF"; then
5302 AC_DEFINE(MOZ_ENABLE_GCONF)
5305 AC_SUBST(MOZ_ENABLE_GCONF)
5306 AC_SUBST(MOZ_GCONF_CFLAGS)
5307 AC_SUBST(MOZ_GCONF_LIBS)
5310 dnl ========================================================
5311 dnl = libproxy support
5312 dnl ========================================================
5314 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5316 MOZ_ENABLE_LIBPROXY=
5318 MOZ_ARG_ENABLE_BOOL(libproxy,
5319 [ --enable-libproxy Enable libproxy support ],
5320 MOZ_ENABLE_LIBPROXY=1,
5321 MOZ_ENABLE_LIBPROXY=)
5323 if test "$MOZ_ENABLE_LIBPROXY"
5325 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5326 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5329 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5330 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5331 AC_SUBST(MOZ_LIBPROXY_LIBS)
5333 dnl ========================================================
5334 dnl = libnotify support
5335 dnl ========================================================
5337 if test "$MOZ_ENABLE_GTK2"
5339 MOZ_ENABLE_LIBNOTIFY=1
5341 MOZ_ARG_DISABLE_BOOL(libnotify,
5342 [ --disable-libnotify Disable libnotify support ],
5343 MOZ_ENABLE_LIBNOTIFY=,
5344 MOZ_ENABLE_LIBNOTIFY=1)
5346 if test "$MOZ_ENABLE_LIBNOTIFY"
5348 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5352 if test -z "$SKIP_LIBRARY_CHECKS"
5354 if test "$MOZ_ENABLE_GTK2"
5356 if test "$MOZ_ENABLE_LIBNOTIFY"
5358 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5362 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5363 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5364 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5366 dnl ========================================================
5367 dnl = GNOME component (mozgnome)
5368 dnl ========================================================
5370 # The GNOME component is built if one of
5371 # gnome-vfs, gio, gconf or libnotify is available.
5372 if test "$MOZ_ENABLE_GCONF" -o \
5373 "$MOZ_ENABLE_GNOMEVFS" -o \
5374 "$MOZ_ENABLE_GIO" -o \
5375 "$MOZ_ENABLE_LIBNOTIFY"; then
5376 MOZ_ENABLE_GNOME_COMPONENT=1
5378 MOZ_ENABLE_GNOME_COMPONENT=
5380 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5382 dnl ========================================================
5383 dnl = libgnomeui support module
5384 dnl ========================================================
5386 if test "$MOZ_ENABLE_GTK2"
5388 MOZ_ENABLE_GNOMEUI=1
5390 MOZ_ARG_DISABLE_BOOL(gnomeui,
5391 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5392 MOZ_ENABLE_GNOMEUI=,
5393 MOZ_ENABLE_GNOMEUI=force)
5395 if test "$MOZ_ENABLE_GNOMEUI"
5397 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5399 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5400 MOZ_ENABLE_GNOMEUI=1
5402 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5404 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5410 if test "$MOZ_ENABLE_GNOMEUI"; then
5411 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5415 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5416 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5417 AC_SUBST(MOZ_GNOMEUI_LIBS)
5419 dnl ========================================================
5421 dnl ========================================================
5423 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5427 MOZ_ARG_DISABLE_BOOL(dbus,
5428 [ --disable-dbus Disable dbus support ],
5432 if test "$MOZ_ENABLE_DBUS"
5434 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5435 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5436 AC_DEFINE(MOZ_ENABLE_DBUS)
5439 AC_SUBST(MOZ_ENABLE_DBUS)
5440 AC_SUBST(MOZ_DBUS_CFLAGS)
5441 AC_SUBST(MOZ_DBUS_LIBS)
5442 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5443 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5445 dnl ========================================================
5446 dnl = Enable Android History instead of Places
5447 dnl ========================================================
5448 if test -n "$MOZ_ANDROID_HISTORY"; then
5449 dnl Do this if defined in confvars.sh
5450 AC_DEFINE(MOZ_ANDROID_HISTORY)
5454 dnl ========================================================
5455 dnl = Build with the Android Java compositor
5456 dnl ========================================================
5457 if test -n "$MOZ_JAVA_COMPOSITOR"; then
5458 dnl Do this if defined in confvars.sh
5459 AC_DEFINE(MOZ_JAVA_COMPOSITOR)
5462 dnl ========================================================
5463 dnl = Disable WebSMS backend
5464 dnl ========================================================
5465 MOZ_ARG_DISABLE_BOOL(websms-backend,
5466 [ --disable-websms-backend
5467 Disable WebSMS backend],
5468 MOZ_WEBSMS_BACKEND=,
5469 MOZ_WEBSMS_BACKEND=1)
5471 if test -n "$MOZ_WEBSMS_BACKEND"; then
5472 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5475 dnl ========================================================
5476 dnl = Build Personal Security Manager
5477 dnl ========================================================
5478 MOZ_ARG_DISABLE_BOOL(crypto,
5479 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5483 dnl ========================================================
5484 dnl = JS Debugger XPCOM component (js/jsd)
5485 dnl ========================================================
5486 MOZ_ARG_DISABLE_BOOL(jsd,
5487 [ --disable-jsd Disable JavaScript debug library],
5492 dnl ========================================================
5493 dnl = Enable IPDL's "expensive" unit tests
5494 dnl ========================================================
5497 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5498 [ --enable-ipdl-tests Enable expensive IPDL tests],
5502 if test -n "$MOZ_IPDL_TESTS"; then
5503 AC_DEFINE(MOZ_IPDL_TESTS)
5506 AC_SUBST(MOZ_IPDL_TESTS)
5508 dnl ========================================================
5509 dnl = Turns off code necessary for e10s compatibility
5510 dnl ========================================================
5511 dnl This is a temporary flag to be removed in bug 662601 when
5512 dnl it's no longer needed
5516 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5517 [ --enable-e10s-compat Turns off code for e10s compat],
5521 if test -n "$MOZ_E10S_COMPAT"; then
5522 AC_DEFINE(MOZ_E10S_COMPAT)
5525 dnl ========================================================
5526 dnl = Disable building dbm
5527 dnl ========================================================
5528 MOZ_ARG_DISABLE_BOOL(dbm,
5529 [ --disable-dbm Disable building dbm],
5533 dnl bi-directional support always on
5537 dnl ========================================================
5538 dnl accessibility support on by default on all platforms
5539 dnl ========================================================
5540 MOZ_ARG_DISABLE_BOOL(accessibility,
5541 [ --disable-accessibility Disable accessibility support],
5544 if test "$ACCESSIBILITY"; then
5545 AC_DEFINE(ACCESSIBILITY)
5548 dnl ========================================================
5549 dnl Disable printing
5550 dnl ========================================================
5551 MOZ_ARG_DISABLE_BOOL(printing,
5552 [ --disable-printing Disable printing support],
5556 if test "$NS_PRINTING"; then
5557 AC_DEFINE(NS_PRINTING)
5558 AC_DEFINE(NS_PRINT_PREVIEW)
5561 dnl ========================================================
5562 dnl = Enable Raw Codecs
5563 dnl ========================================================
5564 MOZ_ARG_ENABLE_BOOL(raw,
5565 [ --enable-raw Enable support for RAW media],
5569 if test -n "$MOZ_RAW"; then
5576 dnl ========================================================
5577 dnl = Disable Ogg Codecs
5578 dnl ========================================================
5579 MOZ_ARG_DISABLE_BOOL(ogg,
5580 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5584 if test -n "$MOZ_OGG"; then
5589 case "$target_cpu" in
5598 dnl Checks for __attribute__(aligned()) directive
5599 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5600 [ac_cv_c_attribute_aligned],
5601 [ac_cv_c_attribute_aligned=0
5602 CFLAGS_save="${CFLAGS}"
5603 CFLAGS="${CFLAGS} -Werror"
5604 for ac_cv_c_attr_align_try in 64 32 16 8; do
5605 echo "trying $ac_cv_c_attr_align_try"
5607 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5608 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5609 if test "$ac_cv_c_attribute_aligned" != 0; then
5613 CFLAGS="${CFLAGS_save}"])
5614 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5615 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5616 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5620 dnl ========================================================
5621 dnl = Disable Opus audio codec support
5622 dnl ========================================================
5623 MOZ_ARG_DISABLE_BOOL(opus,
5624 [ --disable-opus Disable support for Opus audio],
5628 dnl ========================================================
5629 dnl = Disable VP8 decoder support
5630 dnl ========================================================
5631 MOZ_ARG_DISABLE_BOOL(webm,
5632 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5636 dnl system libvpx Support
5637 dnl ========================================================
5638 MOZ_ARG_WITH_BOOL(system-libvpx,
5639 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5640 MOZ_NATIVE_LIBVPX=1)
5642 MOZ_LIBVPX_INCLUDES=
5645 if test -n "$MOZ_WEBM"; then
5647 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5648 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5650 if test -n "$MOZ_VP8_ENCODER" ; then
5651 AC_DEFINE(MOZ_VP8_ENCODER)
5654 if test -n "$MOZ_NATIVE_LIBVPX"; then
5655 dnl ============================
5656 dnl === libvpx Version check ===
5657 dnl ============================
5658 dnl Check to see if we have a system libvpx package.
5659 PKG_CHECK_MODULES(LIBVPX, vpx >= 1.0.0)
5661 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5662 [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
5664 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5665 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5669 AC_SUBST(MOZ_NATIVE_LIBVPX)
5670 AC_SUBST(MOZ_LIBVPX_INCLUDES)
5671 AC_SUBST(MOZ_LIBVPX_LIBS)
5673 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
5677 case "$target_cpu" in
5687 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5688 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5689 dnl We currently require gcc on all arm platforms.
5692 VPX_NEED_OBJ_INT_EXTRACT=
5694 dnl See if we have assembly on this platform.
5695 case "$OS_ARCH:$CPU_ARCH" in
5697 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5701 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5705 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5709 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5713 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5717 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5721 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5725 dnl Check for yasm 1.1 or greater.
5726 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5727 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
5728 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5729 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
5731 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5733 dnl The encoder needs obj_int_extract to get asm offsets.
5737 if test -n "$GNU_AS" ; then
5739 dnl These flags are a lie; they're just used to enable the requisite
5740 dnl opcodes; actual arch detection is done at runtime.
5741 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5742 VPX_DASH_C_FLAG="-c"
5743 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5744 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5749 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5750 AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
5753 if test -n "$MOZ_VP8_ENCODER" -a \
5754 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5755 dnl We prefer to get asm offsets using inline assembler, which the above
5756 dnl compilers can do. When we're not using one of those, we have to fall
5757 dnl back to obj_int_extract, which reads them from a compiled object
5758 dnl file. Unfortunately, that only works if we're compiling on a system
5759 dnl with the header files for the appropriate object file format.
5760 VPX_NEED_OBJ_INT_EXTRACT=1
5763 if test -n "$VPX_X86_ASM"; then
5764 AC_DEFINE(VPX_X86_ASM)
5765 elif test -n "$VPX_ARM_ASM"; then
5766 AC_DEFINE(VPX_ARM_ASM)
5768 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5772 dnl ========================================================
5773 dnl = Disable Wave decoder support
5774 dnl ========================================================
5775 MOZ_ARG_DISABLE_BOOL(wave,
5776 [ --disable-wave Disable Wave decoder support],
5780 if test -n "$MOZ_WAVE"; then
5787 dnl ========================================================
5788 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5789 dnl ========================================================
5791 if test -n "$MOZ_SYDNEYAUDIO"; then
5792 AC_DEFINE(MOZ_SYDNEYAUDIO)
5795 if test -n "$MOZ_SPEEX_RESAMPLER"; then
5796 AC_DEFINE(MOZ_SPEEX_RESAMPLER)
5799 if test -n "$MOZ_CUBEB"; then
5802 AC_DEFINE(MOZ_CUBEB)
5805 dnl Other targets will be enabled soon.
5810 if test -n "$MOZ_MEDIA"; then
5811 AC_DEFINE(MOZ_MEDIA)
5814 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5815 AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive! The build system should not allow them both to be set, but they are. Please file a bug at https://bugzilla.mozilla.org/])
5818 if test -n "$MOZ_VORBIS"; then
5819 AC_DEFINE(MOZ_VORBIS)
5822 if test -n "$MOZ_TREMOR"; then
5823 AC_DEFINE(MOZ_TREMOR)
5826 if test -n "$MOZ_OPUS"; then
5830 dnl ========================================================
5831 dnl = Check alsa availability on Linux if using sydneyaudio
5832 dnl ========================================================
5834 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5835 if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
5836 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5837 [echo "$MOZ_ALSA_PKG_ERRORS"
5838 AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
5841 dnl ========================================================
5842 dnl = Enable GStreamer
5843 dnl ========================================================
5844 MOZ_ARG_ENABLE_BOOL(gstreamer,
5845 [ --enable-gstreamer Enable GStreamer support],
5849 if test "$MOZ_GSTREAMER"; then
5850 # API version, eg 0.10, 1.0 etc
5851 GST_API_VERSION=0.10
5852 # core/base release number
5853 # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
5856 PKG_CHECK_MODULES(GSTREAMER,
5857 gstreamer-$GST_API_VERSION >= $GST_VERSION
5858 gstreamer-app-$GST_API_VERSION
5859 gstreamer-plugins-base-$GST_API_VERSION)
5860 if test -n "$GSTREAMER_LIBS"; then
5861 _SAVE_LDFLAGS=$LDFLAGS
5862 LDFLAGS="$LDFLAGS -lgstvideo-$GST_API_VERSION"
5863 AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
5864 if test -n "$_HAVE_LIBGSTVIDEO" ; then
5865 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
5867 AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
5869 LDFLAGS=$_SAVE_LDFLAGS
5871 AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
5874 AC_SUBST(GSTREAMER_CFLAGS)
5875 AC_SUBST(GSTREAMER_LIBS)
5876 AC_SUBST(MOZ_GSTREAMER)
5878 if test -n "$MOZ_GSTREAMER"; then
5879 AC_DEFINE(MOZ_GSTREAMER)
5884 dnl ========================================================
5885 dnl Permissions System
5886 dnl ========================================================
5887 MOZ_ARG_DISABLE_BOOL(permissions,
5888 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5893 dnl ========================================================
5895 dnl ========================================================
5896 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5897 [ --disable-negotiateauth Disable GSS-API negotiation ],
5898 MOZ_AUTH_EXTENSION=,
5899 MOZ_AUTH_EXTENSION=1 )
5901 dnl ========================================================
5903 dnl ========================================================
5904 MOZ_ARG_DISABLE_BOOL(xtf,
5905 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5908 if test "$MOZ_XTF"; then
5912 dnl ========================================================
5913 dnl Pref extensions (autoconfig)
5914 dnl ========================================================
5915 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5916 [ --disable-pref-extensions
5917 Disable pref extensions such as autoconfig],
5918 MOZ_PREF_EXTENSIONS=,
5919 MOZ_PREF_EXTENSIONS=1 )
5921 dnl ========================================================
5922 dnl Searching of system directories for extensions.
5923 dnl Note: this switch is meant to be used for test builds
5924 dnl whose behavior should not depend on what happens to be
5925 dnl installed on the local machine.
5926 dnl ========================================================
5927 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5928 [ --disable-system-extension-dirs
5929 Disable searching system- and account-global
5930 directories for extensions of any kind; use
5931 only profile-specific extension directories],
5932 ENABLE_SYSTEM_EXTENSION_DIRS=,
5933 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5934 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5935 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5938 dnl ========================================================
5939 dnl = Universalchardet
5940 dnl ========================================================
5941 MOZ_ARG_DISABLE_BOOL(universalchardet,
5942 [ --disable-universalchardet
5943 Disable universal encoding detection],
5944 MOZ_UNIVERSALCHARDET=,
5945 MOZ_UNIVERSALCHARDET=1 )
5947 if test -n "${JAVA_BIN_PATH}"; then
5948 dnl Look for javac and jar in the specified path.
5949 JAVA_PATH="$JAVA_BIN_PATH"
5951 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5952 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5955 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5956 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5957 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5959 if test -n "${JAVA_BIN_PATH}" -o \
5960 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5961 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5962 AC_MSG_ERROR([The programs java, javac and jar were not found. Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
5966 dnl ========================================================
5967 dnl = ANGLE OpenGL->D3D translator for WebGL
5968 dnl = * only applies to win32
5969 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5970 dnl ========================================================
5972 MOZ_DIRECTX_SDK_PATH=
5973 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5976 MOZ_D3DCOMPILER_CAB=
5978 MOZ_D3DCOMPILER_DLL=
5979 case "$target_os" in
5985 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5986 case "${target_cpu}" in
5988 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5991 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5995 if test -n "$MOZ_ANGLE"; then
5996 MOZ_ARG_DISABLE_BOOL(angle,
5997 [ --disable-angle Disable building of ANGLE for WebGL->D3D translation],
6001 if test -n "$MOZ_ANGLE"; then
6002 # Get the SDK path from the registry.
6003 # First try to get the June 2010 SDK
6004 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
6005 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
6006 # Otherwise just take whatever comes first
6007 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
6010 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
6011 AC_MSG_ERROR([Found the February 2010 DirectX SDK. This is too old. We now require the June 2010 DirectX SDK, or newer. Upgrade your SDK or to explicitly build without ANGLE, reconfigure with --disable-angle.])
6013 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
6018 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6019 if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
6020 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
6025 if test -z "$MOZ_ANGLE" ; then
6026 AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for ANGLE. Please install it (June 2010 or newer). To explicitly build without ANGLE, reconfigure with --disable-angle.])
6029 if test -n "$MOZ_ANGLE" ; then
6030 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
6031 MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
6033 if test -z "$MOZ_D3DX9_VERSION" ; then
6034 AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for ANGLE. To explicitly build without ANGLE, reconfigure with --disable-angle.])
6037 if test -n "$MOZ_ANGLE" ; then
6038 MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6039 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6041 MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
6042 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6048 dnl ========================================================
6049 dnl = Breakpad crash reporting (on by default on supported platforms)
6050 dnl ========================================================
6053 i?86-*-mingw*|x86_64-*-mingw*)
6056 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6059 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6060 if test "$MOZ_ENABLE_GTK2"; then
6064 *-android*|*-linuxandroid*)
6072 MOZ_ARG_DISABLE_BOOL(crashreporter,
6073 [ --disable-crashreporter Disable breakpad crash reporting],
6075 MOZ_CRASHREPORTER=1)
6077 if test -n "$MOZ_CRASHREPORTER"; then
6078 AC_DEFINE(MOZ_CRASHREPORTER)
6080 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6081 test -z "$SKIP_LIBRARY_CHECKS"; then
6082 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6083 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6084 AC_SUBST(MOZ_GTHREAD_LIBS)
6086 MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter. Use --disable-crashreporter to disable the crash reporter.])])
6089 if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
6090 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
6094 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6095 [ --with-crashreporter-enable-percent=NN
6096 Enable sending crash reports by default on NN% of users. (default=100)],
6097 [ val=`echo $withval | sed 's/[^0-9]//g'`
6098 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6100 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6101 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6103 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6105 dnl ========================================================
6106 dnl = libjpeg-turbo configuration
6107 dnl ========================================================
6109 if test -z "$SYSTEM_JPEG"; then
6113 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6114 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6116 MOZ_LIBJPEG_TURBO=1)
6118 if test "$SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6119 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6122 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6125 if test -n "$MOZ_LIBJPEG_TURBO"; then
6127 dnl Do we support libjpeg-turbo on this platform?
6128 case "$OS_ARCH:$OS_TEST" in
6129 Linux:x86|Linux:i?86)
6130 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6131 LIBJPEG_TURBO_X86_ASM=1
6134 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6135 LIBJPEG_TURBO_X64_ASM=1
6138 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6139 LIBJPEG_TURBO_X86_ASM=1
6142 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6143 LIBJPEG_TURBO_X64_ASM=1
6146 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6147 LIBJPEG_TURBO_X86_ASM=1
6150 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6151 LIBJPEG_TURBO_X64_ASM=1
6153 WINNT:x86|WINNT:i?86)
6154 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6155 LIBJPEG_TURBO_X86_ASM=1
6158 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6159 LIBJPEG_TURBO_X64_ASM=1
6162 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6163 LIBJPEG_TURBO_ARM_ASM=1
6169 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6170 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6171 dnl it doesn't exist or we have too old of a version.
6172 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6173 AC_MSG_CHECKING([for Yasm assembler])
6174 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6176 if test -z "$LIBJPEG_TURBO_AS" ; then
6177 AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed. Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
6180 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6181 dnl on Linux and 1.1 or newer everywhere else.
6182 if test "$OS_ARCH" = "Linux" ; then
6183 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
6184 AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
6187 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6188 AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
6193 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6194 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6195 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6196 echo "Using $AS as the assembler for ARM code."
6197 LIBJPEG_TURBO_AS=$AS
6200 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6201 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6202 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6203 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6204 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6205 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6206 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6207 dnl Warn if we're not building the optimized routines, even though the user
6208 dnl didn't specify --disable-libjpeg-turbo.
6209 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6212 dnl ========================================================
6213 dnl = Enable compilation of specific extension modules
6214 dnl ========================================================
6216 MOZ_ARG_ENABLE_STRING(extensions,
6217 [ --enable-extensions Enable extensions],
6218 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6219 if test "$option" = "yes" -o "$option" = "all"; then
6220 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6221 elif test "$option" = "no" -o "$option" = "none"; then
6223 elif test "$option" = "default"; then
6224 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6225 elif test `echo "$option" | grep -c \^-` != 0; then
6226 option=`echo $option | sed 's/^-//'`
6227 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6229 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6232 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6234 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6235 # Suppress warning on non-X11 platforms
6236 if test -n "$MOZ_X11"; then
6237 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6239 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6242 dnl Do not build gnomevfs with libxul based apps
6243 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6244 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6247 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6248 # Suppress warning on non-X11 platforms
6249 if test -n "$MOZ_X11"; then
6250 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6252 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6255 dnl Do not build gio with libxul based apps
6256 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6257 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6260 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6261 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6262 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6265 dnl xforms requires xtf
6266 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6267 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6268 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6272 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6274 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6275 dnl when trying to build a nonexistent extension.
6276 for extension in $MOZ_EXTENSIONS; do
6277 if test ! -d "${srcdir}/extensions/${extension}"; then
6278 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6282 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6283 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6286 dnl ========================================================
6287 dnl CSS3 Flexbox Support
6288 dnl ========================================================
6289 if test -n "$MOZ_FLEXBOX"; then
6290 AC_DEFINE(MOZ_FLEXBOX)
6293 dnl ========================================================
6294 dnl SVG Display Lists
6295 dnl ========================================================
6296 if test -n "$MOZ_SVG_DLISTS"; then
6297 AC_DEFINE(MOZ_SVG_DLISTS)
6300 dnl ========================================================
6301 dnl Build Freetype in the tree
6302 dnl ========================================================
6303 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6304 [ --enable-tree-freetype Enable Tree FreeType],
6305 MOZ_TREE_FREETYPE=1,
6306 MOZ_TREE_FREETYPE= )
6307 if test -n "$MOZ_TREE_FREETYPE"; then
6308 if test -n "$_WIN32_MSVC"; then
6309 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6311 AC_DEFINE(MOZ_TREE_FREETYPE)
6312 AC_SUBST(MOZ_TREE_FREETYPE)
6313 MOZ_ENABLE_CAIRO_FT=1
6314 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6315 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6316 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6317 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6319 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6320 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6321 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6322 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6323 AC_SUBST(CAIRO_FT_CFLAGS)
6326 dnl ========================================================
6328 dnl ========================================================
6329 dnl Abort Windows build if the required major version and
6330 dnl minimum minor version of Unicode NSIS isn't in the path
6331 dnl (unless in case of cross compiling, for which Unicode
6332 dnl is not yet sufficient).
6333 if test "$OS_ARCH" = "WINNT"; then
6334 REQ_NSIS_MAJOR_VER=2
6335 MIN_NSIS_MINOR_VER=33
6336 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6337 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
6338 AC_MSG_RESULT([yes])
6340 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6342 if test ! "$MAKENSISU_VER" = ""; then
6343 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6344 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6346 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6347 if test "$MAKENSISU_VER" = "" || \
6348 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6349 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6351 if test -z "$CROSS_COMPILE"; then
6352 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path.])
6357 elif test -z "$CROSS_COMPILE"; then
6358 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path.])
6364 dnl ========================================================
6366 dnl ========================================================
6367 MOZ_ARG_DISABLE_BOOL(webapp-runtime,
6368 [ --disable-webapp-runtime Disable Web App Runtime],
6369 MOZ_WEBAPP_RUNTIME=,
6370 MOZ_WEBAPP_RUNTIME=1)
6371 if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
6374 AC_SUBST(MOZ_WEBAPP_RUNTIME)
6375 if test "$MOZ_WEBAPP_RUNTIME"; then
6376 AC_DEFINE(MOZ_WEBAPP_RUNTIME)
6379 AC_MSG_CHECKING([for tar archiver])
6380 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6381 if test -z "$TAR"; then
6382 AC_MSG_ERROR([no tar archiver found in \$PATH])
6384 AC_MSG_RESULT([$TAR])
6387 AC_MSG_CHECKING([for wget])
6388 AC_CHECK_PROGS(WGET, wget, "")
6389 AC_MSG_RESULT([$WGET])
6392 dnl ========================================================
6393 dnl Maintenance Service
6394 dnl ========================================================
6396 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6397 [ --enable-maintenance-service Enable building of maintenanceservice],
6398 MOZ_MAINTENANCE_SERVICE=1,
6399 MOZ_MAINTENANCE_SERVICE= )
6401 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6402 if test "$OS_ARCH" = "WINNT"; then
6403 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6405 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6409 dnl ========================================================
6410 dnl Verify MAR signatures
6411 dnl ========================================================
6413 MOZ_ARG_ENABLE_BOOL(verify-mar,
6414 [ --enable-verify-mar Enable verifying MAR signatures],
6415 MOZ_VERIFY_MAR_SIGNATURE=1,
6416 MOZ_VERIFY_MAR_SIGNATURE= )
6418 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6419 if test "$OS_ARCH" = "WINNT"; then
6420 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6422 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6426 dnl ========================================================
6427 dnl Enable building the signmar program.
6428 dnl This option is much different than the --enable-verify-mar option.
6429 dnl --enable-verify-mar is for enabling the verification check on MAR
6430 dnl files in the updater. The --enable-signmar option is for building
6431 dnl the signmar program.
6432 dnl ========================================================
6434 MOZ_ARG_ENABLE_BOOL(signmar,
6435 [ --enable-signmar Enable building the signmar program],
6436 MOZ_ENABLE_SIGNMAR=1,
6437 MOZ_ENABLE_SIGNMAR= )
6439 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6440 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6443 dnl ========================================================
6445 dnl ========================================================
6447 MOZ_ARG_DISABLE_BOOL(updater,
6448 [ --disable-updater Disable building of updater],
6452 if test -n "$MOZ_UPDATER"; then
6453 AC_DEFINE(MOZ_UPDATER)
6456 # app update channel is 'default' when not supplied.
6457 MOZ_ARG_ENABLE_STRING([update-channel],
6458 [ --enable-update-channel=CHANNEL
6459 Select application update channel (default=default)],
6460 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6462 if test -z "$MOZ_UPDATE_CHANNEL"; then
6463 MOZ_UPDATE_CHANNEL=default
6465 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6466 AC_SUBST(MOZ_UPDATE_CHANNEL)
6468 # tools/update-packaging is not checked out by default.
6469 MOZ_ARG_ENABLE_BOOL(update-packaging,
6470 [ --enable-update-packaging
6471 Enable tools/update-packaging],
6472 MOZ_UPDATE_PACKAGING=1,
6473 MOZ_UPDATE_PACKAGING= )
6474 AC_SUBST(MOZ_UPDATE_PACKAGING)
6476 dnl ========================================================
6477 dnl build the tests by default
6478 dnl ========================================================
6479 MOZ_ARG_DISABLE_BOOL(tests,
6480 [ --disable-tests Do not build test libraries & programs],
6484 dnl ========================================================
6485 dnl parental controls (for Windows Vista)
6486 dnl ========================================================
6487 MOZ_ARG_DISABLE_BOOL(parental-controls,
6488 [ --disable-parental-controls
6489 Do not build parental controls],
6490 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6491 MOZ_DISABLE_PARENTAL_CONTROLS=)
6492 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6493 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6496 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6498 dnl ========================================================
6499 dnl = Disable DOMCrypto
6500 dnl ========================================================
6501 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6502 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6505 dnl ========================================================
6507 dnl = Module specific options
6509 dnl ========================================================
6510 MOZ_ARG_HEADER(Individual module options)
6512 dnl ========================================================
6513 dnl = Disable feed handling components
6514 dnl ========================================================
6515 MOZ_ARG_DISABLE_BOOL(feeds,
6516 [ --disable-feeds Disable feed handling and processing components],
6519 if test -n "$MOZ_FEEDS"; then
6520 AC_DEFINE(MOZ_FEEDS)
6522 if test "$MOZ_BUILD_APP" = "browser"; then
6523 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6527 dnl ========================================================
6528 dnl Check for sqlite
6529 dnl ========================================================
6532 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6533 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6534 MOZ_NATIVE_SQLITE=1,
6535 MOZ_NATIVE_SQLITE= )
6537 if test -z "$MOZ_NATIVE_SQLITE"
6540 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6542 dnl ============================
6543 dnl === SQLite Version check ===
6544 dnl ============================
6545 dnl Check to see if the system SQLite package is new enough.
6546 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6548 dnl ==================================
6549 dnl === SQLITE_SECURE_DELETE check ===
6550 dnl ==================================
6551 dnl Check to see if the system SQLite package is compiled with
6552 dnl SQLITE_SECURE_DELETE enabled.
6553 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6554 _SAVE_CFLAGS="$CFLAGS"
6555 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6557 LIBS="$LIBS $SQLITE_LIBS"
6558 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6560 #include "sqlite3.h"
6562 int main(int argc, char **argv){
6563 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6565 ac_cv_sqlite_secure_delete=yes,
6566 ac_cv_sqlite_secure_delete=no,
6567 ac_cv_sqlite_secure_delete=no
6570 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6571 CFLAGS="$_SAVE_CFLAGS"
6573 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6574 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6577 dnl ===============================
6578 dnl === SQLITE_THREADSAFE check ===
6579 dnl ===============================
6580 dnl Check to see if the system SQLite package is compiled with
6581 dnl SQLITE_THREADSAFE enabled.
6582 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6583 _SAVE_CFLAGS="$CFLAGS"
6584 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6586 LIBS="$LIBS $SQLITE_LIBS"
6587 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6589 #include "sqlite3.h"
6591 int main(int argc, char **argv){
6592 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6594 ac_cv_sqlite_threadsafe=yes,
6595 ac_cv_sqlite_threadsafe=no,
6596 ac_cv_sqlite_threadsafe=no
6599 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6600 CFLAGS="$_SAVE_CFLAGS"
6602 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6603 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6606 dnl ================================
6607 dnl === SQLITE_ENABLE_FTS3 check ===
6608 dnl ================================
6609 dnl check to see if the system SQLite package is compiled with
6610 dnl SQLITE_ENABLE_FTS3 enabled.
6611 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6612 _SAVE_CFLAGS="$CFLAGS"
6613 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6615 LIBS="$LIBS $SQLITE_LIBS"
6616 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6618 #include "sqlite3.h"
6620 int main(int argc, char **argv){
6621 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6623 ac_cv_sqlite_enable_fts3=yes,
6624 ac_cv_sqlite_enable_fts3=no,
6625 ac_cv_sqlite_enable_fts3=no
6628 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6629 CFLAGS="$_SAVE_CFLAGS"
6631 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6632 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6635 dnl =========================================
6636 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6637 dnl =========================================
6638 dnl check to see if the system SQLite package is compiled with
6639 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6640 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6641 _SAVE_CFLAGS="$CFLAGS"
6642 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6644 LIBS="$LIBS $SQLITE_LIBS"
6645 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6647 #include "sqlite3.h"
6649 int main(int argc, char **argv){
6650 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6652 ac_cv_sqlite_enable_unlock_notify=yes,
6653 ac_cv_sqlite_enable_unlock_notify=no,
6654 ac_cv_sqlite_enable_unlock_notify=no
6657 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6658 CFLAGS="$_SAVE_CFLAGS"
6660 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6661 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6665 if test -n "$MOZ_NATIVE_SQLITE"; then
6666 AC_DEFINE(MOZ_NATIVE_SQLITE)
6668 AC_SUBST(MOZ_NATIVE_SQLITE)
6670 dnl ========================================================
6671 dnl = Enable help viewer (off by default)
6672 dnl ========================================================
6673 if test -n "$MOZ_HELP_VIEWER"; then
6674 dnl Do this if defined in confvars.sh
6675 AC_DEFINE(MOZ_HELP_VIEWER)
6678 dnl ========================================================
6679 dnl = Enable safe browsing (anti-phishing)
6680 dnl ========================================================
6681 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6682 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6683 MOZ_SAFE_BROWSING=1,
6684 MOZ_SAFE_BROWSING= )
6685 if test -n "$MOZ_SAFE_BROWSING"; then
6686 AC_DEFINE(MOZ_SAFE_BROWSING)
6688 AC_SUBST(MOZ_SAFE_BROWSING)
6690 dnl ========================================================
6691 dnl = Enable url-classifier
6692 dnl ========================================================
6693 dnl Implicitly enabled by default if building with safe-browsing
6694 if test -n "$MOZ_SAFE_BROWSING"; then
6695 MOZ_URL_CLASSIFIER=1
6697 MOZ_ARG_ENABLE_BOOL(url-classifier,
6698 [ --enable-url-classifier Enable url classifier module],
6699 MOZ_URL_CLASSIFIER=1,
6700 MOZ_URL_CLASSIFIER= )
6701 if test -n "$MOZ_URL_CLASSIFIER"; then
6702 AC_DEFINE(MOZ_URL_CLASSIFIER)
6704 AC_SUBST(MOZ_URL_CLASSIFIER)
6706 dnl ========================================================
6707 dnl = Disable zipwriter
6708 dnl ========================================================
6709 MOZ_ARG_DISABLE_BOOL(zipwriter,
6710 [ --disable-zipwriter Disable zipwriter component],
6713 AC_SUBST(MOZ_ZIPWRITER)
6715 dnl ========================================================
6717 dnl ========================================================
6718 dnl superseded by QtNetwork starting from 4.7
6719 MOZ_ENABLE_LIBCONIC=1
6721 if test -n "$MOZ_ENABLE_QT"; then
6722 if test "$MOZ_ENABLE_QTNETWORK"; then
6723 MOZ_ENABLE_LIBCONIC=
6727 MOZ_ARG_DISABLE_BOOL(libconic,
6728 [ --disable-libconic Disable libconic],
6729 MOZ_ENABLE_LIBCONIC=,
6730 MOZ_ENABLE_LIBCONIC=1 )
6732 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6733 PKG_CHECK_MODULES(LIBCONIC, conic,
6734 MOZ_ENABLE_LIBCONIC=1,
6735 MOZ_ENABLE_LIBCONIC=)
6737 if test "$MOZ_ENABLE_LIBCONIC"; then
6738 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6741 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6742 AC_SUBST(LIBCONIC_CFLAGS)
6743 AC_SUBST(LIBCONIC_LIBS)
6745 dnl ========================================================
6747 dnl ========================================================
6749 MAEMO_SDK_TARGET_VER=-1
6751 MOZ_ARG_WITH_STRING(maemo-version,
6752 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6754 MAEMO_SDK_TARGET_VER=$withval)
6756 case "$MAEMO_SDK_TARGET_VER" in
6758 MOZ_PLATFORM_MAEMO=5
6762 MOZ_PLATFORM_MAEMO=6
6766 dnl We aren't compiling for Maemo, move on.
6769 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6773 if test $MOZ_PLATFORM_MAEMO; then
6774 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6776 if test -z "$MOZ_ENABLE_DBUS"; then
6777 AC_MSG_ERROR([DBus is required when building for Maemo])
6780 MOZ_GFX_OPTIMIZE_MOBILE=1
6781 MOZ_GL_DEFAULT_PROVIDER=EGL
6782 MOZ_MAEMO_LIBLOCATION=
6784 if test $MOZ_PLATFORM_MAEMO = 5; then
6785 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6786 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6787 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6788 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6789 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6791 AC_SUBST(XCOMPOSITE_LIBS)
6793 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6794 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6795 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6796 if test -z "$_LIB_FOUND"; then
6797 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6801 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6802 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6803 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6804 if test -z "$_LIB_FOUND"; then
6805 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6808 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6809 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6810 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6811 if test -z "$_LIB_FOUND"; then
6812 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6816 if test $MOZ_PLATFORM_MAEMO = 6; then
6818 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6821 if test "$_LIB_FOUND"; then
6822 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6823 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6824 MOZ_ENABLE_CONTENTMANAGER=1
6825 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6827 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6829 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6831 dnl ========================================================
6832 dnl = Enable meego libcontentaction
6833 dnl ========================================================
6834 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6835 [ --enable-meegocontentaction Enable meegocontentaction support],
6836 MOZ_MEEGOCONTENTACTION=1,
6837 MOZ_MEEGOCONTENTACTION=)
6839 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6841 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6842 if test "$_LIB_FOUND"; then
6843 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6844 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6845 MOZ_ENABLE_CONTENTACTION=1
6846 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6847 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6851 MOZ_ARG_ENABLE_BOOL(meegotouch,
6852 [ --enable-meegotouch Enable meegotouch support],
6853 MOZ_MEEGOTOUCHENABLED=1,
6854 MOZ_MEEGOTOUCHENABLED=)
6856 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6857 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6858 if test "$_LIB_FOUND"; then
6859 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6860 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6861 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6863 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6868 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6869 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6870 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6871 if test "$_LIB_FOUND"; then
6872 MOZ_MAEMO_LIBLOCATION=1
6873 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6875 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6877 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6879 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6880 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6881 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6882 if test "$_LIB_FOUND"; then
6883 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6884 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6886 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6888 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6890 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6891 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6894 dnl ========================================================
6895 dnl = XRender Composite
6896 dnl ========================================================
6897 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6898 [ --enable-egl-xrender-composite
6899 Enable EGL xrender composite optimizations],
6900 MOZ_EGL_XRENDER_COMPOSITE=1)
6902 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6903 AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6906 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6908 dnl ========================================================
6910 dnl ========================================================
6912 MOZ_ARG_WITH_STRING(gl-provider,
6913 [ --with-gl-provider=ID
6914 Set GL provider backend type],
6915 [ val=`echo $withval`
6916 MOZ_GL_PROVIDER="$val"])
6918 if test -n "$MOZ_GL_PROVIDER"; then
6919 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6920 AC_SUBST(MOZ_GL_PROVIDER)
6921 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6923 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6925 dnl ========================================================
6926 dnl = faststripe theme
6927 dnl ========================================================
6928 MOZ_ARG_ENABLE_BOOL(faststripe,
6929 [ --enable-faststripe Use faststripe theme],
6930 MOZ_THEME_FASTSTRIPE=1,
6931 MOZ_THEME_FASTSTRIPE= )
6932 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6934 dnl ========================================================
6936 dnl = Feature options that require extra sources to be pulled
6938 dnl ========================================================
6939 dnl MOZ_ARG_HEADER(Features that require extra sources)
6941 dnl ========================================================
6943 dnl = Debugging Options
6945 dnl ========================================================
6946 MOZ_ARG_HEADER(Debugging and Optimizations)
6948 dnl ========================================================
6949 dnl = Disable building with debug info.
6950 dnl = Debugging is OFF by default
6951 dnl ========================================================
6952 if test -z "$MOZ_DEBUG_FLAGS"; then
6953 MOZ_DEBUG_FLAGS="-g"
6956 MOZ_ARG_ENABLE_STRING(debug,
6957 [ --enable-debug[=DBG] Enable building with developer debug info
6958 (using compiler flags DBG)],
6959 [ if test "$enableval" != "no"; then
6961 if test -n "$enableval" -a "$enableval" != "yes"; then
6962 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6963 _MOZ_DEBUG_FLAGS_SET=1
6970 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6971 MOZ_ARG_WITH_STRING(debug-label,
6972 [ --with-debug-label=LABELS
6973 Define DEBUG_<value> for each comma-separated
6975 [ for option in `echo $withval | sed 's/,/ /g'`; do
6976 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6979 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6981 if test -n "$MOZ_DEBUG"; then
6982 AC_MSG_CHECKING([for valid debug flags])
6983 _SAVE_CFLAGS=$CFLAGS
6984 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6985 AC_TRY_COMPILE([#include <stdio.h>],
6986 [printf("Hello World\n");],
6989 AC_MSG_RESULT([$_results])
6990 if test "$_results" = "no"; then
6991 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6993 CFLAGS=$_SAVE_CFLAGS
6996 dnl ========================================================
6997 dnl enable mobile optimizations
6998 dnl ========================================================
6999 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7000 [ --enable-mobile-optimize
7001 Enable mobile optimizations],
7002 MOZ_GFX_OPTIMIZE_MOBILE=1)
7004 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7006 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7007 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7010 dnl ========================================================
7011 dnl = Enable code optimization. ON by default.
7012 dnl ========================================================
7013 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7014 MOZ_OPTIMIZE_FLAGS="-O"
7017 MOZ_ARG_ENABLE_STRING(optimize,
7018 [ --disable-optimize Disable compiler optimization
7019 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7020 [ if test "$enableval" != "no"; then
7022 if test -n "$enableval" -a "$enableval" != "yes"; then
7023 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7028 fi ], MOZ_OPTIMIZE=1)
7030 MOZ_SET_FRAMEPTR_FLAGS
7032 if test "$COMPILE_ENVIRONMENT"; then
7033 if test -n "$MOZ_OPTIMIZE"; then
7034 AC_MSG_CHECKING([for valid optimization flags])
7035 _SAVE_CFLAGS=$CFLAGS
7036 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7037 AC_TRY_COMPILE([#include <stdio.h>],
7038 [printf("Hello World\n");],
7041 AC_MSG_RESULT([$_results])
7042 if test "$_results" = "no"; then
7043 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7045 CFLAGS=$_SAVE_CFLAGS
7047 fi # COMPILE_ENVIRONMENT
7049 AC_SUBST(MOZ_OPTIMIZE)
7050 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
7051 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7052 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7053 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7054 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7056 dnl ========================================================
7057 dnl = Enable generation of debug symbols
7058 dnl ========================================================
7059 MOZ_ARG_ENABLE_STRING(debug-symbols,
7060 [ --enable-debug-symbols[=DBG]
7061 Enable debugging symbols (using compiler flags DBG)],
7062 [ if test "$enableval" != "no"; then
7064 if test -n "$enableval" -a "$enableval" != "yes"; then
7065 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7066 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7068 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7074 MOZ_DEBUG_SYMBOLS=1)
7076 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7077 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7078 export MOZ_DEBUG_SYMBOLS
7081 dnl ========================================================
7082 dnl = Enable any treating of compile warnings as errors
7083 dnl ========================================================
7084 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7085 [ --enable-warnings-as-errors
7086 Enable treating of warnings as errors],
7087 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7088 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7089 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7090 WARNINGS_AS_ERRORS=''
7093 dnl ========================================================
7094 dnl = Disable runtime logging checks
7095 dnl ========================================================
7096 MOZ_ARG_DISABLE_BOOL(logging,
7097 [ --disable-logging Disable logging facilities],
7098 NS_DISABLE_LOGGING=1,
7099 NS_DISABLE_LOGGING= )
7100 if test "$NS_DISABLE_LOGGING"; then
7101 AC_DEFINE(NS_DISABLE_LOGGING)
7103 AC_DEFINE(MOZ_LOGGING)
7106 dnl ========================================================
7107 dnl = This will enable logging of addref, release, ctor, dtor.
7108 dnl ========================================================
7109 _ENABLE_LOGREFCNT=42
7110 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7111 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7112 _ENABLE_LOGREFCNT=1,
7113 _ENABLE_LOGREFCNT= )
7114 if test "$_ENABLE_LOGREFCNT" = "1"; then
7115 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7116 elif test -z "$_ENABLE_LOGREFCNT"; then
7117 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7120 dnl ========================================================
7121 dnl moz_dump_painting
7122 dnl ========================================================
7123 MOZ_ARG_ENABLE_BOOL(dump-painting,
7124 [ --enable-dump-painting Enable paint debugging.],
7125 MOZ_DUMP_PAINTING=1,
7126 MOZ_DUMP_PAINTING= )
7127 if test -n "$MOZ_DUMP_PAINTING"; then
7128 AC_DEFINE(MOZ_DUMP_PAINTING)
7129 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7131 if test -n "$MOZ_DEBUG"; then
7132 AC_DEFINE(MOZ_DUMP_PAINTING)
7135 dnl ========================================================
7136 dnl = Enable trace malloc
7137 dnl ========================================================
7138 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7139 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7140 [ --enable-trace-malloc Enable malloc tracing; also disables jemalloc],
7143 if test "$NS_TRACE_MALLOC"; then
7144 # Please, Mr. Linker Man, don't take away our symbol names
7145 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7147 AC_DEFINE(NS_TRACE_MALLOC)
7149 AC_SUBST(NS_TRACE_MALLOC)
7151 dnl ========================================================
7152 dnl = Enable jemalloc
7153 dnl ========================================================
7154 MOZ_ARG_ENABLE_BOOL(jemalloc,
7155 [ --enable-jemalloc Replace memory allocator with jemalloc],
7159 if test "$NS_TRACE_MALLOC"; then
7162 if test "$MOZ_DMD"; then
7166 if test "${OS_TARGET}" = "Android"; then
7167 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7169 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7170 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7171 if test -z "$GNU_CC"; then
7172 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7174 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7177 dnl On other Unix systems, we only want to link executables against mozglue
7178 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7179 dnl On other Unix systems, where mozglue is a static library, jemalloc is
7180 dnl separated for the SDK, so we need to add it here.
7181 if test "$MOZ_MEMORY" = 1; then
7182 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
7184 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
7185 if test -n "$GNU_CC"; then
7186 dnl And we need mozglue symbols to be exported.
7187 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7189 if test "$MOZ_LINKER" = 1; then
7190 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
7194 if test -z "$MOZ_MEMORY"; then
7197 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7198 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.])
7203 dnl Don't try to run compiler tests on Windows
7204 if test "$OS_ARCH" = "WINNT"; then
7205 if test -z "$HAVE_64BIT_OS"; then
7206 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7208 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7211 AC_CHECK_SIZEOF([int *], [4])
7212 case "${ac_cv_sizeof_int_p}" in
7214 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7217 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7220 AC_MSG_ERROR([Unexpected pointer size])
7225 AC_DEFINE(MOZ_MEMORY)
7226 if test "x$MOZ_DEBUG" = "x1"; then
7227 AC_DEFINE(MOZ_MEMORY_DEBUG)
7229 dnl The generic feature tests that determine how to compute ncpus are long and
7230 dnl complicated. Therefore, simply define special cpp variables for the
7231 dnl platforms we have special knowledge of.
7234 AC_DEFINE(MOZ_MEMORY_DARWIN)
7237 AC_DEFINE(MOZ_MEMORY_BSD)
7239 *-android*|*-linuxandroid*)
7240 AC_DEFINE(MOZ_MEMORY_LINUX)
7241 AC_DEFINE(MOZ_MEMORY_ANDROID)
7246 AC_DEFINE(MOZ_MEMORY_LINUX)
7249 AC_DEFINE(MOZ_MEMORY_BSD)
7252 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7255 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7256 if test -z "$MOZ_DEBUG"; then
7257 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7259 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7261 dnl Look for a broken crtdll.obj
7262 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7263 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7264 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7265 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7266 dnl Also pass this to NSPR/NSS
7267 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7269 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7276 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7280 AC_SUBST(MOZ_MEMORY)
7281 AC_SUBST(MOZ_GLUE_LDFLAGS)
7282 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7283 AC_SUBST(WIN32_CRT_LIBS)
7284 dnl Need to set this for make because NSS doesn't have configure
7287 dnl We need to wrap dlopen and related functions on Android because we use
7289 if test "$OS_TARGET" = Android; then
7290 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7291 if test -n "$MOZ_OLD_LINKER"; then
7292 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7294 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7295 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
7298 dnl ========================================================
7299 dnl = Use malloc wrapper lib
7300 dnl ========================================================
7301 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7302 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7306 if test -n "$_WRAP_MALLOC"; then
7307 if test -n "$GNU_CC"; then
7308 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7309 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7310 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7311 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7313 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7317 dnl ========================================================
7318 dnl = Location of malloc wrapper lib
7319 dnl ========================================================
7320 MOZ_ARG_WITH_STRING(wrap-malloc,
7321 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7322 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7324 dnl ========================================================
7325 dnl = Use JS Call tracing
7326 dnl ========================================================
7327 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7328 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7329 MOZ_TRACE_JSCALLS=1,
7330 MOZ_TRACE_JSCALLS= )
7331 if test -n "$MOZ_TRACE_JSCALLS"; then
7332 AC_DEFINE(MOZ_TRACE_JSCALLS)
7335 dnl ========================================================
7336 dnl = Use incremental GC
7337 dnl ========================================================
7339 MOZ_ARG_DISABLE_BOOL(gcincremental,
7340 [ --disable-gcincremental Disable incremental GC],
7342 if test -n "$JSGC_INCREMENTAL"; then
7343 AC_DEFINE(JSGC_INCREMENTAL)
7346 dnl ========================================================
7347 dnl ETW - Event Tracing for Windows
7348 dnl ========================================================
7349 MOZ_ARG_ENABLE_BOOL(ETW,
7350 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting],
7353 if test -n "$MOZ_ETW"; then
7357 if test -n "$MOZ_ETW"; then
7358 if test -z "$MOZ_WINSDK_TARGETVER"; then
7359 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7363 dnl ========================================================
7364 dnl Zealous JavaScript GC
7365 dnl ========================================================
7366 MOZ_ARG_ENABLE_BOOL(gczeal,
7367 [ --enable-gczeal Enable zealous JavaScript GCing],
7370 if test -n "$JS_GC_ZEAL"; then
7371 AC_DEFINE(JS_GC_ZEAL)
7374 dnl ========================================================
7375 dnl JS opt-mode assertions and minidump instrumentation
7376 dnl ========================================================
7377 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7378 [ --enable-js-diagnostics
7379 Enable JS diagnostic assertions and breakpad data],
7380 JS_CRASH_DIAGNOSTICS=1,
7381 JS_CRASH_DIAGNOSTICS= )
7382 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7383 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7386 dnl ======================================================
7387 dnl = Enable compiling with ccache
7388 dnl ======================================================
7389 MOZ_ARG_WITH_STRING(ccache,
7390 [ --with-ccache[=path/to/ccache]
7391 Enable compiling with ccache],
7392 CCACHE=$withval, CCACHE="no")
7394 if test "$CCACHE" != "no"; then
7395 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7398 if test ! -e "$CCACHE"; then
7399 AC_MSG_ERROR([$CCACHE not found])
7402 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7403 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7404 AC_MSG_ERROR([ccache not found])
7405 elif test -x "$CCACHE"; then
7409 AC_MSG_ERROR([$CCACHE is not executable])
7413 dnl ========================================================
7414 dnl = Enable static checking using gcc-dehydra
7415 dnl ========================================================
7417 MOZ_ARG_WITH_STRING(static-checking,
7418 [ --with-static-checking=path/to/gcc_dehydra.so
7419 Enable static checking of code using GCC-dehydra],
7420 DEHYDRA_PATH=$withval,
7423 if test -n "$DEHYDRA_PATH"; then
7424 if test ! -f "$DEHYDRA_PATH"; then
7425 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7427 AC_DEFINE(NS_STATIC_CHECKING)
7429 AC_SUBST(DEHYDRA_PATH)
7431 dnl ========================================================
7432 dnl = Enable stripping of libs & executables
7433 dnl ========================================================
7434 MOZ_ARG_ENABLE_BOOL(strip,
7435 [ --enable-strip Enable stripping of libs & executables ],
7439 dnl ========================================================
7440 dnl = Enable stripping of libs & executables when packaging
7441 dnl ========================================================
7442 MOZ_ARG_ENABLE_BOOL(install-strip,
7443 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7447 dnl ========================================================
7448 dnl = --enable-elf-dynstr-gc
7449 dnl ========================================================
7450 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7451 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7452 USE_ELF_DYNSTR_GC=1,
7453 USE_ELF_DYNSTR_GC= )
7455 dnl ========================================================
7456 dnl = --disable-elf-hack
7457 dnl ========================================================
7460 MOZ_ARG_DISABLE_BOOL(elf-hack,
7461 [ --disable-elf-hack Disable elf hacks],
7465 # Disable elf hack for profiling because the built in profiler
7466 # doesn't read the segments properly with elf hack. This is
7467 # temporary and should be fixed soon in the profiler.
7468 if test "$MOZ_PROFILING" = 1; then
7472 # Only enable elfhack where supported
7473 if test "$USE_ELF_HACK" = 1; then
7474 case "${HOST_OS_ARCH},${OS_ARCH}" in
7476 case "${CPU_ARCH}" in
7491 if test "$USE_ELF_HACK" = 1; then
7492 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7493 dnl memory addresses it maps to. The result is that by the time elfhack
7494 dnl kicks in, it is not possible to apply relocations because of that,
7495 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7496 dnl segment. It makes elfhack mostly useless, so considering the problems
7497 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7498 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7499 dnl the linker creates PT_GNU_RELRO segments.
7500 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7501 LINK_WITH_PT_GNU_RELRO,
7502 [echo "int main() {return 0;}" > conftest.${ac_ext}
7503 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7504 test -s conftest${ac_exeext}; then
7505 if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7506 LINK_WITH_PT_GNU_RELRO=yes
7508 LINK_WITH_PT_GNU_RELRO=no
7511 dnl We really don't expect to get here, but just in case
7512 AC_ERROR([couldn't compile a simple C file])
7515 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7516 AC_MSG_WARN([Disabling elfhack])
7521 dnl ========================================================
7522 dnl = libstdc++ compatibility hacks
7523 dnl ========================================================
7526 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7527 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7530 AC_SUBST(STDCXX_COMPAT)
7532 if test -n "$STDCXX_COMPAT"; then
7533 eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7534 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7535 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7538 dnl ========================================================
7540 dnl = Profiling and Instrumenting
7542 dnl ========================================================
7543 MOZ_ARG_HEADER(Profiling and Instrumenting)
7545 dnl ========================================================
7546 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7547 dnl = timing for identifying code bottlenecks
7548 dnl = NS_FUNCTION_TIMER is off by default.
7549 dnl ========================================================
7550 MOZ_ARG_ENABLE_BOOL(functiontimer,
7551 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7552 NS_FUNCTION_TIMER=1,
7553 NS_FUNCTION_TIMER= )
7554 if test -n "$NS_FUNCTION_TIMER"; then
7555 AC_DEFINE(NS_FUNCTION_TIMER)
7558 dnl ========================================================
7559 dnl Turn on reflow counting
7560 dnl ========================================================
7561 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7562 [ --enable-reflow-perf Enable reflow performance tracing],
7565 if test -n "$MOZ_REFLOW_PERF"; then
7566 AC_DEFINE(MOZ_REFLOW_PERF)
7569 dnl ========================================================
7570 dnl Enable code size metrics.
7571 dnl ========================================================
7572 MOZ_ARG_ENABLE_BOOL(codesighs,
7573 [ --enable-codesighs Enable code size analysis tools],
7574 _ENABLE_CODESIGHS=1,
7575 _ENABLE_CODESIGHS= )
7576 if test -n "$_ENABLE_CODESIGHS"; then
7577 if test -d $srcdir/tools/codesighs; then
7580 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7584 dnl ========================================================
7585 dnl = Enable Radio Interface for B2G (Gonk usually)
7586 dnl ========================================================
7587 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7588 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7591 if test -n "$MOZ_B2G_RIL"; then
7592 AC_DEFINE(MOZ_B2G_RIL)
7594 AC_SUBST(MOZ_B2G_RIL)
7596 dnl ========================================================
7597 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7598 dnl ========================================================
7599 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7600 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7603 if test -n "$MOZ_B2G_BT"; then
7604 AC_DEFINE(MOZ_B2G_BT)
7606 AC_SUBST(MOZ_B2G_BT)
7608 dnl ========================================================
7609 dnl = Support for demangling undefined symbols
7610 dnl ========================================================
7611 if test -z "$SKIP_LIBRARY_CHECKS"; then
7614 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7618 # Demangle only for debug or trace-malloc builds
7619 MOZ_DEMANGLE_SYMBOLS=
7620 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7621 MOZ_DEMANGLE_SYMBOLS=1
7622 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7624 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7626 dnl ========================================================
7627 dnl = Support for gcc stack unwinding (from gcc 3.3)
7628 dnl ========================================================
7629 if test -z "$SKIP_LIBRARY_CHECKS"; then
7630 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7633 dnl ========================================================
7635 dnl ========================================================
7637 MOZ_ARG_WITH_STRING(jitreport-granularity,
7638 [ --jitreport-granularity=N
7639 Default granularity at which to report JIT code
7642 1 - code ranges for whole functions only
7643 2 - per-line information
7644 3 - per-op information],
7645 JITREPORT_GRANULARITY=$withval,
7646 JITREPORT_GRANULARITY=3)
7648 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7650 dnl ========================================================
7654 dnl ========================================================
7655 MOZ_ARG_HEADER(Misc. Options)
7657 dnl ========================================================
7658 dnl update xterm title
7659 dnl ========================================================
7660 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7661 [ --enable-xterm-updates Update XTERM titles with current command.],
7665 dnl =========================================================
7667 dnl =========================================================
7668 MOZ_ARG_ENABLE_STRING([chrome-format],
7669 [ --enable-chrome-format=jar|flat|both|symlink|omni
7670 Select FORMAT of chrome files (default=jar)],
7671 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7673 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7674 MOZ_CHROME_FILE_FORMAT=jar
7677 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7678 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7679 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7680 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7681 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7682 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7685 dnl =========================================================
7686 dnl Omnijar packaging (bug 552121)
7687 dnl =========================================================
7688 dnl Omnijar packaging is compatible with flat packaging.
7689 dnl In unpackaged builds, omnijar looks for files as if
7690 dnl things were flat packaged. After packaging, all files
7691 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7692 dnl is set to flat since putting files into jars is only
7693 dnl done during packaging with omnijar.
7694 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7696 AC_DEFINE(MOZ_OMNIJAR)
7697 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7698 MOZ_CHROME_FILE_FORMAT=flat
7700 MOZ_CHROME_FILE_FORMAT=symlink
7702 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7703 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7706 OMNIJAR_NAME=omni.ja
7707 AC_SUBST(OMNIJAR_NAME)
7708 AC_SUBST(MOZ_OMNIJAR)
7710 dnl ========================================================
7711 dnl = Define default location for MOZILLA_FIVE_HOME
7712 dnl ========================================================
7713 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7714 [ --with-default-mozilla-five-home
7715 Set the default value for MOZILLA_FIVE_HOME],
7716 [ val=`echo $withval`
7717 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7719 dnl ========================================================
7720 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7721 dnl ========================================================
7722 MOZ_ARG_WITH_STRING(user-appdir,
7723 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7724 [ val=`echo $withval`
7725 if echo "$val" | grep "\/" >/dev/null; then
7726 AC_MSG_ERROR("Homedir must be single relative path.")
7731 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7733 dnl ========================================================
7734 dnl = Doxygen configuration
7735 dnl ========================================================
7736 dnl Use commas to specify multiple dirs to this arg
7737 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7738 MOZ_ARG_WITH_STRING(doc-input-dirs,
7739 [ --with-doc-input-dirs=DIRS
7740 Header/idl dirs to create docs from],
7741 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7742 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7744 dnl Use commas to specify multiple dirs to this arg
7745 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7746 MOZ_ARG_WITH_STRING(doc-include-dirs,
7747 [ --with-doc-include-dirs=DIRS
7748 Include dirs to preprocess doc headers],
7749 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7750 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7752 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7753 MOZ_ARG_WITH_STRING(doc-output-dir,
7754 [ --with-doc-output-dir=DIR
7755 Dir to generate docs into],
7756 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7757 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7759 if test -z "$SKIP_COMPILER_CHECKS"; then
7760 dnl ========================================================
7762 dnl = Compiler Options
7764 dnl ========================================================
7765 MOZ_ARG_HEADER(Compiler Options)
7767 dnl ========================================================
7768 dnl Check for gcc -pipe support
7769 dnl ========================================================
7770 AC_MSG_CHECKING([for -pipe support])
7771 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7772 dnl Any gcc that supports firefox supports -pipe.
7773 CFLAGS="$CFLAGS -pipe"
7774 CXXFLAGS="$CXXFLAGS -pipe"
7775 AC_MSG_RESULT([yes])
7780 dnl ========================================================
7781 dnl Profile guided optimization (gcc checks)
7782 dnl ========================================================
7783 dnl Test for profiling options
7784 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7786 _SAVE_CFLAGS="$CFLAGS"
7787 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7789 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7790 AC_TRY_COMPILE([], [return 0;],
7791 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7792 result="yes" ], result="no")
7793 AC_MSG_RESULT([$result])
7795 if test $result = "yes"; then
7796 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7797 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7798 PROFILE_USE_LDFLAGS="-fprofile-use"
7801 CFLAGS="$_SAVE_CFLAGS"
7803 if test -n "$INTEL_CC"; then
7804 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7805 PROFILE_GEN_LDFLAGS=
7806 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7807 PROFILE_USE_LDFLAGS=
7810 dnl Sun Studio on Solaris
7811 if test "$SOLARIS_SUNPRO_CC"; then
7812 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7813 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7814 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7815 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7818 AC_SUBST(PROFILE_GEN_CFLAGS)
7819 AC_SUBST(PROFILE_GEN_LDFLAGS)
7820 AC_SUBST(PROFILE_USE_CFLAGS)
7821 AC_SUBST(PROFILE_USE_LDFLAGS)
7825 dnl ========================================================
7826 dnl Test for -pedantic bustage
7827 dnl ========================================================
7828 MOZ_ARG_DISABLE_BOOL(pedantic,
7829 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7831 if test "$_PEDANTIC"; then
7832 _SAVE_CXXFLAGS=$CXXFLAGS
7833 CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7834 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7835 AC_TRY_COMPILE([$configure_static_assert_macros],
7836 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7837 result="no", result="yes" )
7838 AC_MSG_RESULT([$result])
7839 CXXFLAGS="$_SAVE_CXXFLAGS"
7843 _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7844 _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7847 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7852 dnl ========================================================
7853 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7854 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7855 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7856 dnl ========================================================
7857 _SAVE_CXXFLAGS=$CXXFLAGS
7858 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7859 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7860 ac_nscap_nonconst_opeq_bug,
7869 template <class T, class U>
7870 int operator==(const Pointer<T>& rhs, U* lhs)
7872 return rhs.myPtr == lhs;
7875 template <class T, class U>
7876 int operator==(const Pointer<T>& rhs, const U* lhs)
7878 return rhs.myPtr == lhs;
7886 ac_nscap_nonconst_opeq_bug="no",
7887 ac_nscap_nonconst_opeq_bug="yes")])
7888 CXXFLAGS="$_SAVE_CXXFLAGS"
7890 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7891 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7893 fi # ! SKIP_COMPILER_CHECKS
7895 AC_DEFINE(CPP_THROW_NEW, [throw()])
7898 if test "$COMPILE_ENVIRONMENT"; then
7900 fi # COMPILE_ENVIRONMENT
7902 dnl ========================================================
7904 dnl = Build depencency options
7906 dnl ========================================================
7907 MOZ_ARG_HEADER(Build dependencies)
7909 dnl ========================================================
7910 dnl = Do not auto generate dependency info
7911 dnl ========================================================
7913 MOZ_ARG_DISABLE_BOOL(auto-deps,
7914 [ --disable-auto-deps Do not automatically generate dependency info],
7918 if test -n "$MOZ_AUTO_DEPS"; then
7919 dnl ========================================================
7920 dnl = Use mkdepend instead of $CC -MD for dependency generation
7921 dnl ========================================================
7923 MOZ_ARG_DISABLE_BOOL(md,
7924 [ --disable-md Do not use compiler-based dependencies ],
7927 [dnl Default is to turn on -MD if using GNU-compatible compilers
7928 if test "$GNU_CC" -a "$GNU_CXX"; then
7931 dnl Default is to use -xM if using Sun Studio on Solaris
7932 if test "$SOLARIS_SUNPRO_CC"; then
7935 if test "$_cpp_md_flag"; then
7937 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
7938 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7939 if test "$SOLARIS_SUNPRO_CC"; then
7944 dnl Don't override this for MSVC
7945 if test -z "$_WIN32_MSVC"; then
7946 _USE_CPP_INCLUDE_FLAG=
7947 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7948 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7950 echo '#include <stdio.h>' > dummy-hello.c
7952 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7954 if test -z "$CL_INCLUDES_PREFIX"; then
7955 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7957 AC_SUBST(CL_INCLUDES_PREFIX)
7959 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
7960 dnl cl.py provides dependency generation for MSVC
7961 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
7962 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
7968 AC_SUBST(MOZ_AUTO_DEPS)
7969 AC_SUBST(COMPILER_DEPEND)
7971 AC_SUBST(CC_WRAPPER)
7972 AC_SUBST(CXX_WRAPPER)
7975 dnl ========================================================
7977 dnl = Static Build Options
7979 dnl ========================================================
7980 MOZ_ARG_HEADER(Static build options)
7982 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7983 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7987 MOZ_ARG_ENABLE_BOOL(shared-js,
7988 [ --enable-shared-js
7989 Create a shared JavaScript library.],
7993 if test -n "$ENABLE_SHARED_JS"; then
7995 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7997 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7998 AC_DEFINE(MOZ_STATIC_JS)
8000 AC_SUBST(JS_SHARED_LIBRARY)
8002 AC_SUBST(LIBXUL_LIBS)
8003 XPCOM_LIBS="$LIBXUL_LIBS"
8005 dnl ========================================================
8007 dnl = Standalone module options
8009 dnl ========================================================
8010 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8013 dnl ========================================================
8015 if test -z "$SKIP_PATH_CHECKS"; then
8016 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8017 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8018 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8023 if test -z "${GLIB_GMODULE_LIBS}" \
8024 -a -n "${GLIB_CONFIG}"\
8025 -a "${GLIB_CONFIG}" != no\
8027 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8030 AC_SUBST(GLIB_CFLAGS)
8032 AC_SUBST(GLIB_GMODULE_LIBS)
8034 dnl ========================================================
8035 dnl Graphics checks.
8036 dnl ========================================================
8038 if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8044 MOZ_ARG_ENABLE_BOOL(skia,
8045 [ --enable-skia Enable use of Skia],
8049 dnl ========================================================
8051 dnl ========================================================
8052 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8055 MOZ_ARG_ENABLE_BOOL(system-cairo,
8056 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8061 MOZ_ARG_ENABLE_BOOL(system-pixman,
8062 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8066 # Check for headers defining standard int types.
8067 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8069 if test "$MOZ_TREE_CAIRO"; then
8070 AC_DEFINE(MOZ_TREE_CAIRO)
8072 # For now we assume that we will have a uint64_t available through
8073 # one of the above headers or mozstdint.h.
8074 AC_DEFINE(HAVE_UINT64_T)
8076 # Define macros for cairo-features.h
8077 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8078 if test "$MOZ_X11"; then
8079 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8080 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8081 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8082 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8083 MOZ_ENABLE_CAIRO_FT=1
8084 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8086 case "$MOZ_WIDGET_TOOLKIT" in
8088 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8091 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8092 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8093 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8096 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8097 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8098 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8099 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8100 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8101 MOZ_ENABLE_D2D_SURFACE=1
8102 MOZ_ENABLE_DWRITE_FONT=1
8104 WIN32_DWRITE_FONT_FEATURE=
8105 WIN32_D2D_SURFACE_FEATURE=
8108 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8110 dnl D3D10 Layers depend on D2D Surfaces.
8111 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8112 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8116 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8117 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8118 MOZ_ENABLE_CAIRO_FT=1
8119 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8120 CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8124 if test "$USE_FC_FREETYPE"; then
8125 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8127 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8128 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8129 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8130 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8131 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8132 AC_SUBST(CAIRO_FT_CFLAGS)
8134 AC_SUBST(PS_SURFACE_FEATURE)
8135 AC_SUBST(PDF_SURFACE_FEATURE)
8136 AC_SUBST(SVG_SURFACE_FEATURE)
8137 AC_SUBST(XLIB_SURFACE_FEATURE)
8138 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8139 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8140 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8141 AC_SUBST(WIN32_SURFACE_FEATURE)
8142 AC_SUBST(OS2_SURFACE_FEATURE)
8143 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8144 AC_SUBST(FT_FONT_FEATURE)
8145 AC_SUBST(FC_FONT_FEATURE)
8146 AC_SUBST(WIN32_FONT_FEATURE)
8147 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8148 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8149 AC_SUBST(QUARTZ_FONT_FEATURE)
8150 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8151 AC_SUBST(QT_SURFACE_FEATURE)
8152 AC_SUBST(TEE_SURFACE_FEATURE)
8154 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8155 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
8157 if test "$MOZ_TREE_PIXMAN"; then
8158 AC_DEFINE(MOZ_TREE_PIXMAN)
8159 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8161 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8162 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8163 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8166 if test "$MOZ_X11"; then
8167 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8170 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8171 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8174 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8175 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8176 MOZ_CAIRO_LIBS=$CAIRO_LIBS
8177 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8178 if test "$MOZ_X11"; then
8179 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8180 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8181 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8185 AC_SUBST(MOZ_TREE_CAIRO)
8186 AC_SUBST(MOZ_CAIRO_CFLAGS)
8187 AC_SUBST(MOZ_CAIRO_LIBS)
8188 AC_SUBST(MOZ_CAIRO_OSLIBS)
8189 AC_SUBST(MOZ_TREE_PIXMAN)
8191 dnl ========================================================
8193 dnl ========================================================
8195 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8198 dnl ========================================================
8200 dnl ========================================================
8201 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8202 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8204 dnl ========================================================
8206 dnl ========================================================
8207 if test "$MOZ_GRAPHITE"; then
8208 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8209 AC_DEFINE(MOZ_GRAPHITE)
8213 AC_SUBST(MOZ_GRAPHITE)
8214 AC_SUBST(MOZ_GRAPHITE_LIBS)
8216 dnl ========================================================
8218 dnl ========================================================
8219 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8220 AC_SUBST(MOZ_OTS_LIBS)
8222 dnl ========================================================
8224 dnl ========================================================
8225 if test "$MOZ_ENABLE_SKIA"; then
8226 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8227 AC_DEFINE(MOZ_ENABLE_SKIA)
8231 AC_SUBST(MOZ_ENABLE_SKIA)
8232 AC_SUBST(MOZ_SKIA_LIBS)
8234 dnl ========================================================
8236 dnl ========================================================
8237 MOZ_ARG_DISABLE_BOOL(xul,
8238 [ --disable-xul Disable XUL],
8240 if test "$MOZ_XUL"; then
8243 dnl remove extensions that require XUL
8244 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8249 dnl ========================================================
8250 dnl disable profile locking
8251 dnl do no use this in applications that can have more than
8252 dnl one process accessing the profile directory.
8253 dnl ========================================================
8254 MOZ_ARG_DISABLE_BOOL(profilelocking,
8255 [ --disable-profilelocking
8256 Disable profile locking],
8257 MOZ_PROFILELOCKING=,
8258 MOZ_PROFILELOCKING=1 )
8259 if test "$MOZ_PROFILELOCKING"; then
8260 AC_DEFINE(MOZ_PROFILELOCKING)
8263 dnl ========================================================
8264 dnl necko configuration options
8265 dnl ========================================================
8268 dnl option to disable various necko protocols
8270 MOZ_ARG_ENABLE_STRING(necko-protocols,
8271 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8272 Enable/disable specific protocol handlers],
8273 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8274 if test "$option" = "yes" -o "$option" = "all"; then
8275 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8276 elif test "$option" = "no" -o "$option" = "none"; then
8278 elif test "$option" = "default"; then
8279 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8280 elif test `echo "$option" | grep -c \^-` != 0; then
8281 option=`echo $option | sed 's/^-//'`
8282 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8284 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8287 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8289 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8290 AC_SUBST(NECKO_PROTOCOLS)
8291 for p in $NECKO_PROTOCOLS; do
8292 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8296 dnl option to disable necko's wifi scanner
8298 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8299 [ --disable-necko-wifi Disable necko wifi scanner],
8303 if test "$OS_ARCH" = "OS2"; then
8304 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8307 if test "$NECKO_WIFI" -a \
8308 "$OS_ARCH" != "Linux" -a \
8309 "$OS_ARCH" != "Darwin" -a \
8310 "$OS_ARCH" != "SunOS" -a \
8311 "$OS_ARCH" != "WINNT"; then
8312 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8315 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8317 MOZ_CHECK_HEADER([iwlib.h])
8318 if test "$ac_cv_header_iwlib_h" != "yes"; then
8319 AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora) or libiw-devel (openSUSE)); use --disable-necko-wifi to disable])
8323 if test "$NECKO_WIFI"; then
8324 AC_DEFINE(NECKO_WIFI)
8326 AC_SUBST(NECKO_WIFI)
8329 dnl option to disable cookies
8331 MOZ_ARG_DISABLE_BOOL(cookies,
8332 [ --disable-cookies Disable cookie support],
8335 AC_SUBST(NECKO_COOKIES)
8336 if test "$NECKO_COOKIES"; then
8337 AC_DEFINE(NECKO_COOKIES)
8341 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8343 MOZ_ARG_DISABLE_BOOL(ctypes,
8344 [ --disable-ctypes Disable js-ctypes],
8347 AC_SUBST(BUILD_CTYPES)
8348 if test "$BUILD_CTYPES"; then
8349 AC_DEFINE(BUILD_CTYPES)
8352 dnl NECKO_ configuration options are not global
8353 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8355 dnl Build Places if required
8356 if test "$MOZ_PLACES"; then
8357 AC_DEFINE(MOZ_PLACES)
8360 dnl Build Sync Services if required
8361 AC_SUBST(MOZ_SERVICES_SYNC)
8362 if test -n "$MOZ_SERVICES_SYNC"; then
8363 AC_DEFINE(MOZ_SERVICES_SYNC)
8366 dnl ========================================================
8367 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8368 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8371 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8372 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8375 if test "$MOZ_APP_COMPONENT_MODULES"; then
8376 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8379 dnl ========================================================
8381 dnl = Maintainer debug option (no --enable equivalent)
8383 dnl ========================================================
8388 AC_SUBST(AR_EXTRACT)
8392 AC_SUBST(AS_DASH_C_FLAG)
8401 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8402 AC_SUBST(MOZ_UPDATE_XTERM)
8403 AC_SUBST(MOZ_PLATFORM_MAEMO)
8404 AC_SUBST(MOZ_AUTH_EXTENSION)
8405 AC_SUBST(MOZ_PERMISSIONS)
8407 AC_SUBST(MOZ_PREF_EXTENSIONS)
8408 AC_SUBST(MOZ_JS_LIBS)
8411 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8412 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8413 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8414 AC_SUBST(MOZ_DEBUG_FLAGS)
8415 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8416 AC_SUBST(WARNINGS_AS_ERRORS)
8417 AC_SUBST(MOZ_EXTENSIONS)
8418 AC_SUBST(MOZ_JSDEBUGGER)
8419 AC_SUBST(MOZ_LOG_REFCNT)
8420 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8423 AC_SUBST(MOZ_CALLGRIND)
8426 AC_SUBST(MOZ_PROFILING)
8427 AC_SUBST(MOZ_QUANTIFY)
8429 AC_SUBST(MOZ_PLACES)
8430 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8432 AC_SUBST(NS_PRINTING)
8434 AC_SUBST(MOZ_HELP_VIEWER)
8440 AC_SUBST(MOZ_PROFILELOCKING)
8442 AC_SUBST(ENABLE_TESTS)
8443 AC_SUBST(ENABLE_MARIONETTE)
8445 AC_SUBST(MOZ_UNIVERSALCHARDET)
8446 AC_SUBST(ACCESSIBILITY)
8447 AC_SUBST(MOZ_SPELLCHECK)
8448 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8449 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8450 AC_SUBST(MOZ_USER_DIR)
8451 AC_SUBST(MOZ_CRASHREPORTER)
8452 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8453 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8454 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8455 AC_SUBST(MOZ_UPDATER)
8457 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8458 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8459 AC_SUBST(MOZ_D3DX9_VERSION)
8460 AC_SUBST(MOZ_D3DX9_CAB)
8461 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8462 AC_SUBST(MOZ_D3DX9_DLL)
8463 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8466 AC_SUBST(MOZ_ANDROID_HISTORY)
8467 AC_SUBST(MOZ_WEBSMS_BACKEND)
8468 AC_SUBST(ENABLE_STRIP)
8469 AC_SUBST(PKG_SKIP_STRIP)
8470 AC_SUBST(STRIP_FLAGS)
8471 AC_SUBST(USE_ELF_DYNSTR_GC)
8472 AC_SUBST(USE_ELF_HACK)
8473 AC_SUBST(INCREMENTAL_LINKER)
8474 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8475 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8477 AC_SUBST(MOZ_FIX_LINK_PATHS)
8478 AC_SUBST(XPCOM_LIBS)
8479 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8480 AC_SUBST(XPCOM_GLUE_LDOPTS)
8481 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8483 AC_SUBST(USE_DEPENDENT_LIBS)
8485 AC_SUBST(MOZ_BUILD_ROOT)
8486 AC_SUBST(MOZ_OS2_TOOLS)
8488 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8489 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8490 AC_SUBST(MOZ_LINKER_EXTRACT)
8492 dnl ========================================================
8493 dnl = Mac bundle name prefix
8494 dnl ========================================================
8495 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8496 [ --with-macbundlename-prefix=prefix
8497 Prefix for MOZ_MACBUNDLE_NAME],
8498 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8500 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8501 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8502 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8505 if test "$MOZ_DEBUG"; then
8506 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8508 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8510 AC_SUBST(MOZ_MACBUNDLE_NAME)
8512 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8513 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8514 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8515 if test "$MOZ_DEBUG"; then
8516 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8519 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8520 AC_SUBST(MOZ_MACBUNDLE_ID)
8522 # The following variables are available to branding and application
8523 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8524 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8525 # impacts profile location and user-visible fields.
8526 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8527 # versions of a given application (e.g. Aurora and Firefox both use
8528 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8529 # for application.ini's "Name" field, which controls profile location in
8530 # the absence of a "Profile" field (see below), and various system
8531 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8532 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8533 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8534 # builds (e.g. Aurora for Firefox).
8535 # - MOZ_APP_VERSION: Defines the application version number.
8536 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8537 # defaults to a lowercase form of MOZ_APP_BASENAME.
8538 # - MOZ_APP_PROFILE: When set, used for application.ini's
8539 # "Profile" field, which controls profile location.
8540 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8541 # crash reporter server url.
8542 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8543 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8545 if test -z "$MOZ_APP_NAME"; then
8546 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8549 # For extensions and langpacks, we require a max version that is compatible
8550 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8551 # 10.0a1 and 10.0a2 aren't affected
8552 # 10.0 becomes 10.0.*
8553 # 10.0.1 becomes 10.0.*
8554 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8555 if test -z "$IS_ALPHA"; then
8557 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
8560 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8563 AC_SUBST(MOZ_APP_NAME)
8564 AC_SUBST(MOZ_APP_DISPLAYNAME)
8565 AC_SUBST(MOZ_APP_BASENAME)
8566 AC_SUBST(MOZ_APP_VENDOR)
8567 AC_SUBST(MOZ_APP_PROFILE)
8568 AC_SUBST(MOZ_APP_ID)
8569 AC_SUBST(MAR_CHANNEL_ID)
8570 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8571 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8572 AC_SUBST(MOZ_EXTENSION_MANAGER)
8573 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8574 AC_SUBST(MOZ_APP_UA_NAME)
8575 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8576 AC_SUBST(MOZ_APP_VERSION)
8577 AC_SUBST(MOZ_APP_MAXVERSION)
8578 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
8579 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8580 AC_SUBST(FIREFOX_VERSION)
8582 # We can't use the static application.ini data when building against
8584 if test -n "$LIBXUL_SDK"; then
8587 AC_SUBST(MOZ_APP_STATIC_INI)
8589 AC_SUBST(MOZ_PKG_SPECIAL)
8591 AC_SUBST(MOZILLA_OFFICIAL)
8593 if test "$MOZ_TELEMETRY_REPORTING"; then
8594 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8598 AC_SUBST(MOZ_MAPINFO)
8599 AC_SUBST(MOZ_BROWSE_INFO)
8600 AC_SUBST(MOZ_TOOLS_DIR)
8601 AC_SUBST(WIN32_REDIST_DIR)
8605 dnl Echo the CFLAGS to remove extra whitespace.
8612 $_WARNINGS_CXXFLAGS \
8615 COMPILE_CFLAGS=`echo \
8620 COMPILE_CXXFLAGS=`echo \
8621 $_DEFINES_CXXFLAGS \
8625 AC_SUBST(SYSTEM_MAKEDEPEND)
8626 AC_SUBST(SYSTEM_LIBXUL)
8627 AC_SUBST(SYSTEM_JPEG)
8628 AC_SUBST(SYSTEM_PNG)
8629 AC_SUBST(SYSTEM_ZLIB)
8630 AC_SUBST(SYSTEM_BZ2)
8632 AC_SUBST(JPEG_CFLAGS)
8634 AC_SUBST(ZLIB_CFLAGS)
8636 AC_SUBST(BZ2_CFLAGS)
8638 AC_SUBST(PNG_CFLAGS)
8641 AC_SUBST(MOZ_FLEXBOX)
8642 AC_SUBST(MOZ_JPEG_CFLAGS)
8643 AC_SUBST(MOZ_JPEG_LIBS)
8644 AC_SUBST(MOZ_ZLIB_CFLAGS)
8645 AC_SUBST(MOZ_ZLIB_LIBS)
8646 AC_SUBST(MOZ_BZ2_CFLAGS)
8647 AC_SUBST(MOZ_BZ2_LIBS)
8648 AC_SUBST(MOZ_PNG_CFLAGS)
8649 AC_SUBST(MOZ_PNG_LIBS)
8651 AC_SUBST(NSPR_CFLAGS)
8653 AC_SUBST(MOZ_NATIVE_NSPR)
8655 AC_SUBST(NSS_CFLAGS)
8657 AC_SUBST(NSS_DEP_LIBS)
8658 AC_SUBST(MOZ_NATIVE_NSS)
8659 AC_SUBST(NSS_DISABLE_DBM)
8664 AC_SUBST(COMPILE_CFLAGS)
8665 AC_SUBST(COMPILE_CXXFLAGS)
8668 AC_SUBST(CROSS_COMPILE)
8669 AC_SUBST(WCHAR_CFLAGS)
8673 AC_SUBST(HOST_CFLAGS)
8674 AC_SUBST(HOST_CXXFLAGS)
8675 AC_SUBST(HOST_LDFLAGS)
8676 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8678 AC_SUBST(HOST_AR_FLAGS)
8680 AC_SUBST(HOST_RANLIB)
8681 AC_SUBST(HOST_NSPR_MDCPUCFG)
8682 AC_SUBST(HOST_BIN_SUFFIX)
8683 AC_SUBST(HOST_OS_ARCH)
8685 AC_SUBST(TARGET_CPU)
8686 AC_SUBST(TARGET_VENDOR)
8688 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8689 AC_SUBST(TARGET_MD_ARCH)
8690 AC_SUBST(TARGET_XPCOM_ABI)
8693 AC_SUBST(OS_RELEASE)
8696 AC_SUBST(INTEL_ARCHITECTURE)
8698 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8699 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8701 AC_SUBST(WRAP_LDFLAGS)
8704 AC_SUBST(MKSHLIB_FORCE_ALL)
8705 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8706 AC_SUBST(DSO_CFLAGS)
8707 AC_SUBST(DSO_PIC_CFLAGS)
8708 AC_SUBST(DSO_LDOPTS)
8709 AC_SUBST(LIB_PREFIX)
8710 AC_SUBST(DLL_PREFIX)
8711 AC_SUBST(DLL_SUFFIX)
8712 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8713 AC_SUBST(LIB_SUFFIX)
8714 AC_SUBST(OBJ_SUFFIX)
8715 AC_SUBST(BIN_SUFFIX)
8716 AC_SUBST(ASM_SUFFIX)
8717 AC_SUBST(IMPORT_LIB_SUFFIX)
8719 AC_SUBST(CC_VERSION)
8720 AC_SUBST(CXX_VERSION)
8721 AC_SUBST(MSMANIFEST_TOOL)
8722 AC_SUBST(NS_ENABLE_TSF)
8723 AC_SUBST(MOZ_NSS_PATCH)
8724 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8725 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8728 AC_SUBST(MOZ_SYDNEYAUDIO)
8729 AC_SUBST(MOZ_SPEEX_RESAMPLER)
8732 AC_SUBST(MOZ_VORBIS)
8733 AC_SUBST(MOZ_TREMOR)
8736 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8737 AC_SUBST(MOZ_VP8_ENCODER)
8739 AC_SUBST(MOZ_ALSA_LIBS)
8740 AC_SUBST(MOZ_ALSA_CFLAGS)
8742 AC_SUBST(VPX_ASFLAGS)
8743 AC_SUBST(VPX_DASH_C_FLAG)
8744 AC_SUBST(VPX_AS_CONVERSION)
8745 AC_SUBST(VPX_ASM_SUFFIX)
8746 AC_SUBST(VPX_X86_ASM)
8747 AC_SUBST(VPX_ARM_ASM)
8748 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8749 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8750 AC_SUBST(LIBJPEG_TURBO_AS)
8751 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8752 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8753 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8754 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8756 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8758 AC_MSG_CHECKING([for posix_fallocate])
8759 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8760 #include <fcntl.h>],
8761 [posix_fallocate(0, 0, 0);],
8762 [ac_cv___posix_fallocate=true],
8763 [ac_cv___posix_fallocate=false])
8765 if test "$ac_cv___posix_fallocate" = true ; then
8766 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8772 dnl Check for missing components
8773 if test "$COMPILE_ENVIRONMENT"; then
8774 if test "$MOZ_X11"; then
8775 if test "$WITHOUT_X11"; then
8776 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8778 dnl ====================================================
8779 dnl = Check if X headers exist
8780 dnl ====================================================
8781 _SAVE_CFLAGS=$CFLAGS
8782 CFLAGS="$CFLAGS $XCFLAGS"
8786 #include <X11/Xlib.h>
8787 #include <X11/Intrinsic.h>
8788 #include <X11/extensions/XShm.h>
8792 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8793 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8797 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8798 CFLAGS="$_SAVE_CFLAGS"
8800 if test -n "$MISSING_X"; then
8801 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8806 dnl Check for headers, etc. needed by WebGL.
8807 if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
8808 MOZ_CHECK_HEADER(GL/glx.h)
8809 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8810 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa-devel (openSUSE))])
8812 fi # MOZ_GL_DEFAULT_PROVIDER=GLX
8813 fi # COMPILE_ENVIRONMENT
8815 if test "$USE_FC_FREETYPE"; then
8816 if test "$COMPILE_ENVIRONMENT"; then
8817 _SAVE_CPPFLAGS="$CPPFLAGS"
8818 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8819 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8820 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8821 CPPFLAGS="$_SAVE_CPPFLAGS"
8823 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8827 dnl Set various defines and substitutions
8828 dnl ========================================================
8830 if test "$OS_ARCH" = "Darwin"; then
8832 AC_DEFINE(UNIX_ASYNC_DNS)
8833 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8835 AC_DEFINE(UNIX_ASYNC_DNS)
8838 if test "$MOZ_DEBUG"; then
8839 AC_DEFINE(MOZ_REFLOW_PERF)
8840 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8843 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8844 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8845 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8846 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8847 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8848 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8849 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8850 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8851 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8856 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8860 AC_SUBST(WIN_TOP_SRC)
8862 AC_SUBST(MOZILLA_VERSION)
8864 AC_SUBST(ac_configure_args)
8866 dnl Spit out some output
8867 dnl ========================================================
8869 dnl The following defines are used by xpcom
8870 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8872 HAVE_CPP_2BYTE_WCHAR_T
8873 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8875 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8876 HAVE_CPP_PARTIAL_SPECIALIZATION
8877 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8879 NEED_CPP_UNUSED_IMPLEMENTATIONS
8883 HAVE_ICONV_WITH_CONST_INPUT
8891 netwerk/necko-config.h
8892 xpcom/xpcom-config.h
8893 xpcom/xpcom-private.h
8896 # Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
8897 # "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
8898 # binary, even on 64-bit systems. It should work on OS X 10.4.5 and up. We
8899 # (apparently) only need this hack when egrep's "pattern" is particularly
8900 # long (as in the following code). See bug 655339.
8903 FIXED_EGREP="arch -arch i386 egrep"
8910 # Save the defines header file before autoconf removes it.
8911 # (Do not add AC_DEFINE calls after this line.)
8912 _CONFIG_TMP=confdefs-tmp.h
8913 _CONFIG_DEFS_H=mozilla-config.h
8915 cat > $_CONFIG_TMP <<\EOF
8916 /* List of defines generated by configure. Included with preprocessor flag,
8917 * -include, to avoid long list of -D defines on the compile command-line.
8921 #ifndef _MOZILLA_CONFIG_H_
8922 #define _MOZILLA_CONFIG_H_
8925 _EGREP_PATTERN='^#define ('
8926 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8927 for f in $_NON_GLOBAL_ACDEFINES; do
8928 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8931 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8933 sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8935 if test "$?" != 0; then
8936 AC_MSG_ERROR([Error outputting config definitions])
8939 cat >> $_CONFIG_TMP <<\EOF
8941 /* The c99 defining the limit macros (UINT32_MAX for example), says:
8942 * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
8943 * is defined before <stdint.h> is included. */
8944 #define __STDC_LIMIT_MACROS
8946 /* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
8947 * modify it directly.
8949 * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
8950 * unless --enable-system-hunspell is defined.
8952 #if defined(HUNSPELL_STATIC)
8953 #include "hunspell_alloc_hooks.h"
8956 #endif /* _MOZILLA_CONFIG_H_ */
8960 # Only write mozilla-config.h when something changes (or it doesn't exist)
8961 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8964 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8965 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8967 echo ==== $_CONFIG_DEFS_H =================================
8971 dnl Probably shouldn't call this manually but we always want the output of DEFS
8972 rm -f confdefs.h.save
8973 mv confdefs.h confdefs.h.save
8974 $FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8975 if test "$?" != 0; then
8976 AC_MSG_ERROR([Error outputting confdefs.h])
8978 AC_OUTPUT_MAKE_DEFS()
8980 AC_SUBST(MOZ_DEFINES)
8982 mv confdefs.h.save confdefs.h
8984 dnl Load the list of Makefiles to generate.
8985 dnl To add new Makefiles, edit allmakefiles.sh.
8986 dnl allmakefiles.sh sets the variable, MAKEFILES.
8987 . ${srcdir}/allmakefiles.sh
8989 dnl Run a perl script to quickly create the makefiles.
8990 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8991 dnl for the files it cannot handle correctly. This way, config.status
8992 dnl will handle these files.
8993 dnl If it fails, nothing is set and config.status will run as usual.
8995 dnl This does not change the $MAKEFILES variable.
8997 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9001 echo $MAKEFILES > unallmakefiles
9003 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9005 AC_OUTPUT($MAKEFILES)
9007 # Generate a JSON config file for unittest harnesses etc to read
9008 # build configuration details from in a standardized way.
9009 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
9010 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9011 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9012 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9013 rm ./mozinfo.json.tmp
9015 mv -f ./mozinfo.json.tmp ./mozinfo.json
9018 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9019 if test "$CAIRO_FEATURES_H"; then
9020 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9021 echo "$CAIRO_FEATURES_H is unchanged"
9022 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9024 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9028 dnl Build libunwind for Android profiling builds
9029 if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
9030 old_ac_configure_arg="$ac_configure_args"
9031 ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
9032 if test "$MOZ_DEBUG"; then
9033 ac_configure_args="$ac_configure_args --enable-debug"
9035 if test "$DSO_PIC_CFLAGS"; then
9036 ac_configure_args="$ac_configure_args --with-pic"
9038 ac_configure_args="$ac_configure_args \
9042 CFLAGS=\"$CFLAGS\" \
9043 CXXFLAGS=\"$CXXFLAGS\" \
9044 CPPFLAGS=\"$CPPFLAGS\" \
9046 LDFLAGS=\"$LDFLAGS\" \
9048 RANLIB=\"$RANLIB\" \
9052 # Use a separate cache file for libunwind, since it does not use caching.
9053 mkdir -p $_objdir/tools/profiler/libunwind/src
9054 old_cache_file=$cache_file
9055 cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
9056 old_config_files=$CONFIG_FILES
9058 AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
9059 cache_file=$old_cache_file
9060 ac_configure_args="$old_ac_configure_args"
9061 CONFIG_FILES=$old_config_files
9064 # Run freetype configure script
9066 if test "$MOZ_TREE_FREETYPE"; then
9067 export CFLAGS="$CFLAGS -std=c99"
9068 export CPPFLAGS="$CPPFLAGS"
9069 export CXXFLAGS="$CXXFLAGS"
9070 export LDFLAGS="$LDFLAGS"
9071 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9072 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9073 AC_OUTPUT_SUBDIRS(modules/freetype2)
9076 if test -z "$direct_nspr_config"; then
9077 dnl ========================================================
9078 dnl = Setup a nice relatively clean build environment for
9079 dnl = sub-configures.
9080 dnl ========================================================
9083 CFLAGS="$_SUBDIR_CFLAGS"
9084 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9085 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9086 LDFLAGS="$_SUBDIR_LDFLAGS"
9087 HOST_CC="$_SUBDIR_HOST_CC"
9088 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9089 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9096 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9097 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9101 if test -n "$_WRAP_MALLOC"; then
9102 # Avoid doubling wrap malloc arguments
9103 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9106 if test -z "$MOZ_NATIVE_NSPR"; then
9107 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9108 if test -z "$MOZ_DEBUG"; then
9109 ac_configure_args="$ac_configure_args --disable-debug"
9111 ac_configure_args="$ac_configure_args --enable-debug"
9113 if test "$MOZ_OPTIMIZE" = "1"; then
9114 ac_configure_args="$ac_configure_args --enable-optimize"
9115 elif test -z "$MOZ_OPTIMIZE"; then
9116 ac_configure_args="$ac_configure_args --disable-optimize"
9118 if test -n "$HAVE_64BIT_OS"; then
9119 ac_configure_args="$ac_configure_args --enable-64bit"
9121 if test -n "$USE_ARM_KUSER"; then
9122 ac_configure_args="$ac_configure_args --with-arm-kuser"
9124 ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
9125 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9126 # dladdr is supported by the new linker, even when the system linker doesn't
9127 # support it. Trick nspr into using dladdr when it's not supported.
9128 _SAVE_CPPFLAGS="$CPPFLAGS"
9129 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9131 _SAVE_LDFLAGS="$LDFLAGS"
9132 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9133 AC_OUTPUT_SUBDIRS(nsprpub)
9134 LDFLAGS="$_SAVE_LDFLAGS"
9135 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9137 CPPFLAGS="$_SAVE_CFLAGS"
9139 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9142 if test -z "$MOZ_NATIVE_NSPR"; then
9143 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9144 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9145 if test "$OS_ARCH" != "WINNT"; then
9146 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9147 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9148 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9149 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9151 rm -f config/autoconf.mk.bak
9154 dnl ========================================================
9155 dnl = Setup a nice relatively clean build environment for
9156 dnl = sub-configures.
9157 dnl ========================================================
9160 CFLAGS="$_SUBDIR_CFLAGS"
9161 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9162 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9163 LDFLAGS="$_SUBDIR_LDFLAGS"
9164 HOST_CC="$_SUBDIR_HOST_CC"
9165 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9166 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9169 # Run the SpiderMonkey 'configure' script.
9170 dist=$MOZ_BUILD_ROOT/dist
9171 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9172 ac_configure_args="$ac_configure_args --enable-threadsafe"
9173 if test "$BUILD_CTYPES"; then
9174 # Build js-ctypes on the platforms we can.
9175 ac_configure_args="$ac_configure_args --enable-ctypes"
9177 if test -z "$JS_SHARED_LIBRARY" ; then
9178 ac_configure_args="$ac_configure_args --disable-shared-js"
9180 if test -z "$MOZ_NATIVE_NSPR"; then
9181 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9182 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9184 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9185 ac_configure_args="$ac_configure_args --prefix=$dist"
9186 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9187 if test "$MOZ_MEMORY"; then
9188 ac_configure_args="$ac_configure_args --enable-jemalloc"
9190 if test -n "$MOZ_GLUE_LDFLAGS"; then
9191 export MOZ_GLUE_LDFLAGS
9193 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9194 export MOZ_GLUE_PROGRAM_LDFLAGS
9197 export STLPORT_CPPFLAGS
9198 export STLPORT_LDFLAGS
9200 AC_OUTPUT_SUBDIRS(js/src)
9201 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9203 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9205 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9206 dnl Needs to be at the end to respect possible changes from NSPR configure
9207 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9208 echo "config/autoconf.mk is unchanged"
9209 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9211 rm -f config/autoconf.mk.orig 2> /dev/null