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.10
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:
183 dnl Default to MSVC for win32 and gcc for darwin
184 dnl ==============================================================
185 if test -z "$CROSS_COMPILE"; then
188 if test -z "$CC"; then CC=cl; fi
189 if test -z "$CXX"; then CXX=cl; fi
190 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
191 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
192 if test -z "$LD"; then LD=link; fi
193 if test -z "$AS"; then
194 case "${target_cpu}" in
203 if test -z "$MIDL"; then MIDL=midl; fi
205 # need override this flag since we don't use $(LDFLAGS) for this.
206 if test -z "$HOST_LDFLAGS" ; then
211 # we prefer gcc-4.2 over gcc on older darwin, so
212 # use that specific version if it's available.
213 MOZ_PATH_PROGS(CC, $CC gcc-4.2 gcc)
214 MOZ_PATH_PROGS(CXX, $CXX g++-4.2 g++)
219 COMPILE_ENVIRONMENT=1
220 MOZ_ARG_DISABLE_BOOL(compile-environment,
221 [ --disable-compile-environment
222 Disable compiler/library checks.],
223 COMPILE_ENVIRONMENT= )
224 AC_SUBST(COMPILE_ENVIRONMENT)
226 MOZ_ARG_WITH_STRING(l10n-base,
227 [ --with-l10n-base=DIR path to l10n repositories],
228 L10NBASEDIR=$withval)
229 if test -n "$L10NBASEDIR"; then
230 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
231 AC_MSG_ERROR([--with-l10n-base must specify a path])
232 elif test -d "$L10NBASEDIR"; then
233 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
235 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
238 AC_SUBST(L10NBASEDIR)
240 dnl Check for Perl first -- needed for win32 SDK checks
241 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
242 if test -z "$PERL" -o "$PERL" = ":"; then
243 AC_MSG_ERROR([perl not found in \$PATH])
246 dnl ========================================================
247 dnl = Android uses a very custom (hacky) toolchain; we need to do this
248 dnl = here, so that the compiler checks can succeed
249 dnl ========================================================
251 MOZ_ARG_WITH_STRING(android-ndk,
252 [ --with-android-ndk=DIR
253 location where the Android NDK can be found],
254 android_ndk=$withval)
256 MOZ_ARG_WITH_STRING(android-toolchain,
257 [ --with-android-toolchain=DIR
258 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
259 android_toolchain=$withval)
262 MOZ_ARG_WITH_STRING(android-version,
263 [ --with-android-version=VER
264 android platform version, default 5],
265 android_version=$withval,
268 MOZ_ARG_WITH_STRING(android-sdk,
269 [ --with-android-sdk=DIR
270 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
271 android_sdk=$withval)
273 MOZ_ARG_WITH_STRING(android-platform,
274 [ --with-android-platform=DIR
275 location of platform dir, default NDK/build/platforms/android-5/arch-arm],
276 android_platform=$withval)
278 MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
279 [ --enable-android-libstdcxx
280 use GNU libstdc++ instead of STLPort for NDK >= 5],
281 MOZ_ANDROID_LIBSTDCXX=1,
282 MOZ_ANDROID_LIBSTDCXX= )
285 arm-linux*-android*|*-linuxandroid*)
286 android_tool_prefix="arm-linux-androideabi"
289 android_tool_prefix="i686-android-linux"
292 android_tool_prefix="arm-eabi"
295 android_tool_prefix="$target_os"
299 MOZ_ARG_WITH_STRING(gonk,
301 location of gonk dir],
304 if test -n "$gonkdir" ; then
305 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
306 gonk_toolchain="$gonkdir"/prebuilt/$kernel_name-x86/toolchain/arm-eabi-4.4.3
309 AS="$gonk_toolchain"/bin/"$android_tool_prefix"-as
310 CC="$gonk_toolchain"/bin/"$android_tool_prefix"-gcc
311 CXX="$gonk_toolchain"/bin/"$android_tool_prefix"-g++
312 CPP="$gonk_toolchain"/bin/"$android_tool_prefix"-cpp
313 LD="$gonk_toolchain"/bin/"$android_tool_prefix"-ld
314 AR="$gonk_toolchain"/bin/"$android_tool_prefix"-ar
315 RANLIB="$gonk_toolchain"/bin/"$android_tool_prefix"-ranlib
316 STRIP="$gonk_toolchain"/bin/"$android_tool_prefix"-strip
318 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
319 STLPORT_LIBS="-lstlport"
321 CPPFLAGS="-DANDROID -I$gonkdir/bionic/libc/include/ -I$gonkdir/bionic/libc/kernel/common -I$gonkdir/bionic/libc/arch-arm/include -I$gonkdir/bionic/libc/kernel/arch-arm -I$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 -I$gonkdir/bionic -I$gonkdir/frameworks/base/include $STLPORT_CPPFLAGS $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice"
322 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
323 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
324 LIBS="$LIBS $STLPORT_LIBS"
326 dnl Add -llog by default, since we use it all over the place.
327 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"
329 dnl prevent cross compile section from using these flags as host flags
330 if test -z "$HOST_CPPFLAGS" ; then
333 if test -z "$HOST_CFLAGS" ; then
336 if test -z "$HOST_CXXFLAGS" ; then
339 if test -z "$HOST_LDFLAGS" ; then
344 AC_DEFINE(HAVE_SYS_UIO_H)
345 AC_DEFINE(HAVE_PTHREADS)
347 MOZ_CHROME_FILE_FORMAT=omni
352 *-android*|*-linuxandroid*)
353 if test -z "$android_ndk" ; then
354 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
357 if test -z "$android_sdk" ; then
358 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
360 if ! test -e "$android_sdk"/source.properties ; then
361 AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
364 # Minimum Android SDK API Level we require.
365 android_min_api_level=13
367 # Get the api level from "$android_sdk"/source.properties.
368 android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties`
370 if test -z "$android_api_level" ; then
371 AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
374 if ! test "$android_api_level" -eq "$android_api_level" ; then
375 AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
378 if test $android_api_level -lt $android_min_api_level ; then
379 AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).])
383 android_platform_tools="$android_sdk"/../../platform-tools
384 if test ! -d "$android_platform_tools" ; then
385 android_platform_tools="$android_sdk"/tools # SDK Tools < r8
388 if test -z "$android_toolchain" ; then
389 AC_MSG_CHECKING([for android toolchain directory])
391 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
393 android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
395 # With newer NDK, the toolchain path has changed.
396 if ! test -d "$android_toolchain" ; then
397 android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
400 if test -d "$android_toolchain" ; then
401 AC_MSG_RESULT([$android_toolchain])
403 AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
407 if test -z "$android_platform" ; then
408 AC_MSG_CHECKING([for android platform directory])
410 android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
412 # With newer NDK, the platform path has changed.
413 if ! test -d "$android_platform" ; then
414 android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
417 if test -d "$android_platform" ; then
418 AC_MSG_RESULT([$android_platform])
420 AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
425 AS="$android_toolchain"/bin/"$android_tool_prefix"-as
426 CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
427 CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
428 CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
429 LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
430 AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
431 RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
432 STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
433 OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
435 CPPFLAGS="-isystem $android_platform/usr/include $CPPFLAGS"
436 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
437 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
439 dnl Add -llog by default, since we use it all over the place.
440 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
441 dnl undefined symbol (present on the hardware, just not in the
443 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
445 dnl prevent cross compile section from using these flags as host flags
446 if test -z "$HOST_CPPFLAGS" ; then
449 if test -z "$HOST_CFLAGS" ; then
452 if test -z "$HOST_CXXFLAGS" ; then
455 if test -z "$HOST_LDFLAGS" ; then
459 ANDROID_NDK="${android_ndk}"
460 ANDROID_TOOLCHAIN="${android_toolchain}"
461 ANDROID_PLATFORM="${android_platform}"
462 ANDROID_SDK="${android_sdk}"
463 ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
464 ANDROID_VERSION="${android_version}"
465 if test -z "$ANDROID_PACKAGE_NAME" ; then
466 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
468 if test -z "$MOZ_MOBILE_COMPAT" ; then
469 MOZ_MOBILE_COMPAT='All'
473 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
474 AC_SUBST(ANDROID_VERSION)
476 MOZ_CHROME_FILE_FORMAT=omni
480 AC_PATH_PROG(OBJCOPY,objcopy)
486 AC_SUBST(ANDROID_NDK)
487 AC_SUBST(ANDROID_TOOLCHAIN)
488 AC_SUBST(ANDROID_PLATFORM)
489 AC_SUBST(ANDROID_SDK)
490 AC_SUBST(ANDROID_PLATFORM_TOOLS)
491 AC_SUBST(ANDROID_PACKAGE_NAME)
492 AC_SUBST(MOZ_MOBILE_COMPAT)
495 dnl ========================================================
496 dnl Checks for compilers.
497 dnl ========================================================
498 dnl Set CROSS_COMPILE in the environment when running configure
499 dnl to use the cross-compile setup for now
500 dnl ========================================================
502 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
505 if test "$COMPILE_ENVIRONMENT"; then
507 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
508 echo "cross compiling from $host to $target"
512 _SAVE_CFLAGS="$CFLAGS"
513 _SAVE_LDFLAGS="$LDFLAGS"
515 AC_MSG_CHECKING([for host c compiler])
516 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
517 if test -z "$HOST_CC"; then
518 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
520 AC_MSG_RESULT([$HOST_CC])
521 AC_MSG_CHECKING([for host c++ compiler])
522 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
523 if test -z "$HOST_CXX"; then
524 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
526 AC_MSG_RESULT([$HOST_CXX])
528 if test -z "$HOST_CFLAGS"; then
529 HOST_CFLAGS="$CFLAGS"
531 if test -z "$HOST_CXXFLAGS"; then
532 HOST_CXXFLAGS="$CXXFLAGS"
534 if test -z "$HOST_LDFLAGS"; then
535 HOST_LDFLAGS="$LDFLAGS"
537 if test -z "$HOST_AR_FLAGS"; then
538 HOST_AR_FLAGS="$AR_FLAGS"
540 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
541 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
543 CFLAGS="$HOST_CFLAGS"
544 LDFLAGS="$HOST_LDFLAGS"
546 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
547 AC_TRY_COMPILE([], [return(0);],
548 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
549 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
552 CFLAGS="$HOST_CXXFLAGS"
554 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
555 AC_TRY_COMPILE([], [return(0);],
556 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
557 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
561 LDFLAGS=$_SAVE_LDFLAGS
563 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
566 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
570 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
571 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
572 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
573 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
574 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
575 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
576 AC_DEFINE(CROSS_COMPILE)
581 # Work around the conftest.exe access problem on Windows
586 MOZ_PATH_PROGS(AS, $AS as, $CC)
587 AC_CHECK_PROGS(AR, ar, :)
588 AC_CHECK_PROGS(LD, ld, :)
589 AC_CHECK_PROGS(STRIP, strip, :)
590 AC_CHECK_PROGS(WINDRES, windres, :)
591 if test -z "$HOST_CC"; then
594 if test -z "$HOST_CFLAGS"; then
595 HOST_CFLAGS='$(CFLAGS)'
597 if test -z "$HOST_CXX"; then
600 if test -z "$HOST_CXXFLAGS"; then
601 HOST_CXXFLAGS='$(CXXFLAGS)'
603 if test -z "$HOST_LDFLAGS"; then
604 HOST_LDFLAGS='$(LDFLAGS)'
606 if test -z "$HOST_RANLIB"; then
607 HOST_RANLIB='$(RANLIB)'
609 if test -z "$HOST_AR"; then
612 if test -z "$HOST_AR_FLAGS"; then
613 HOST_AR_FLAGS='$(AR_FLAGS)'
623 if test "$GCC" = "yes"; then
625 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
627 if test "$GXX" = "yes"; then
629 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
631 if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
635 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
638 if test "$GNU_CC"; then
639 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
646 if test "$GCC" = yes; then
647 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
652 if test "$GXX" = yes; then
653 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
660 if test "$GCC" = yes; then
661 if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
666 if test "$GXX" = yes; then
667 if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
672 dnl ========================================================
673 dnl Special win32 checks
674 dnl ========================================================
676 dnl Target the Windows 7 SDK by default
679 MOZ_ARG_WITH_STRING(windows-version,
680 [ --with-windows-version=WINSDK_TARGETVER
681 Highest Windows version to target using this SDK
683 WINSDK_TARGETVER=$withval)
685 case "$WINSDK_TARGETVER" in
687 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
691 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 601]);
698 if test "$GCC" != "yes"; then
699 # Check to see if we are really running in a msvc environemnt
701 AC_CHECK_PROGS(MIDL, midl)
703 # Make sure compilers are valid
704 CFLAGS="$CFLAGS -TC -nologo"
705 CXXFLAGS="$CXXFLAGS -TP -nologo"
708 AC_TRY_COMPILE([#include <stdio.h>],
709 [ printf("Hello World\n"); ],,
710 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
713 AC_TRY_COMPILE([#include <new.h>],
714 [ unsigned *test = new unsigned(42); ],,
715 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
719 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
722 # Determine compiler version
723 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
724 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
725 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
726 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
727 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
728 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
730 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
731 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
733 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
734 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
737 if test "$_CC_MAJOR_VERSION" = "14"; then
738 dnl Require VC8SP1 or newer.
739 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
740 if test "$_CC_RELEASE" -lt 50727 -o \
741 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
742 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.])
746 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
747 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
748 elif test "$_CC_MAJOR_VERSION" = "15"; then
750 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
751 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
752 elif test "$_CC_MAJOR_VERSION" = "16"; then
754 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
755 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
756 elif test "$_CC_MAJOR_VERSION" = "17"; then
758 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
759 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
761 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
764 _MOZ_RTTI_FLAGS_ON='-GR'
765 _MOZ_RTTI_FLAGS_OFF='-GR-'
766 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
768 if test -n "$WIN32_REDIST_DIR"; then
769 if test ! -d "$WIN32_REDIST_DIR"; then
770 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
772 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
775 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
776 dnl not something else like "magnetic tape manipulation utility".
777 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
778 if test -z "$MSMT_TOOL"; then
779 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
783 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
785 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
786 if test -z "$MSMANIFEST_TOOL_VERSION"; then
787 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
793 # Check linker version
794 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
795 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
796 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
797 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
803 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
804 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
805 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
806 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
807 # Add flags if necessary
808 AC_MSG_CHECKING([for midl flags])
811 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
812 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
813 # MIDL version 7.00.0500 or later has no problem.
814 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
815 AC_MSG_RESULT([need -env win32])
817 AC_MSG_RESULT([none needed])
821 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
824 AC_MSG_RESULT([none needed])
828 # Identify which version of the SDK we're building with
829 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
831 MOZ_CHECK_HEADERS([winsdkver.h])
832 if test "$ac_cv_header_winsdkver_h" = "yes"; then
833 # Get the highest _WIN32_WINNT and NTDDI versions supported
834 # Take the higher of the two
835 # This is done because the Windows 7 beta SDK reports its
836 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
837 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
839 [cat > conftest.h <<EOF
840 #include <winsdkver.h>
841 #include <sdkddkver.h>
843 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
844 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
846 #define WINSDK_MAXVER NTDDI_MAXVER
851 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
854 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
856 # Any SDK which doesn't have WinSDKVer.h is too old.
857 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.])
860 unset _MSVC_VER_FILTER
862 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
866 _SAVE_CXXFLAGS="$CXXFLAGS"
867 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
868 AC_TRY_COMPILE([#include <exception>],
869 [std::_Throw(std::exception()); return 0;],
870 ac_cv_have_std__Throw="yes",
871 ac_cv_have_std__Throw="no")
872 CXXFLAGS="$_SAVE_CXXFLAGS"
876 if test "$ac_cv_have_std__Throw" = "yes"; then
877 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
878 ac_cv_have_dllimport_exception_bug,
882 _SAVE_CXXFLAGS="$CXXFLAGS"
883 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
884 AC_TRY_LINK([#include <vector>],
885 [std::vector<int> v; return v.at(1);],
886 ac_cv_have_dllimport_exception_bug="no",
887 ac_cv_have_dllimport_exception_bug="yes")
888 CXXFLAGS="$_SAVE_CXXFLAGS"
891 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
893 MOZ_MSVC_STL_WRAP__Throw=1
894 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
897 AC_CACHE_CHECK(for overridable _RAISE,
902 _SAVE_CXXFLAGS="$CXXFLAGS"
903 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
904 AC_TRY_COMPILE([#include <xstddef>
906 #define _RAISE(x) externallyDefinedFunction((x).what())
909 [std::vector<int> v; return v.at(1);],
910 ac_cv_have__RAISE="no",
911 ac_cv_have__RAISE="yes")
912 CXXFLAGS="$_SAVE_CXXFLAGS"
915 if test "$ac_cv_have__RAISE" = "yes"; then
917 MOZ_MSVC_STL_WRAP__RAISE=1
918 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
920 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
924 if test "$WRAP_STL_INCLUDES" = "1"; then
925 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
928 # Check w32api version
929 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
930 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
931 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
932 AC_TRY_COMPILE([#include <w32api.h>],
933 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
934 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
935 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
936 #error "test failed."
938 , [ res=yes ], [ res=no ])
939 AC_MSG_RESULT([$res])
940 if test "$res" != "yes"; then
941 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
943 # Check windres version
944 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
945 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
946 AC_MSG_RESULT([$_WINDRES_VERSION])
947 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
948 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
949 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
950 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
951 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
952 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
953 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
954 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
955 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
956 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
957 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
958 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
960 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
963 MOZ_WINSDK_MAXVER=0x06010000
966 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
967 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
968 # Require OS features provided by IE 6.0 SP2 (XP SP2)
969 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
971 # If the maximum version supported by this SDK is lower than the target
973 AC_MSG_CHECKING([for Windows SDK being recent enough])
974 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
978 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.])
981 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
982 # Definitions matching sdkddkver.h
983 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
990 if test -n "$_WIN32_MSVC"; then
992 SKIP_COMPILER_CHECKS=1
993 SKIP_LIBRARY_CHECKS=1
995 # Since we're skipping compiler and library checks, hard-code
998 AC_DEFINE(HAVE_SETBUF)
999 AC_DEFINE(HAVE_ISATTY)
1002 fi # COMPILE_ENVIRONMENT
1004 AC_SUBST(MIDL_FLAGS)
1017 AC_SUBST(WRAP_STL_INCLUDES)
1018 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
1019 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
1021 dnl ========================================================
1022 dnl Checks for programs.
1023 dnl ========================================================
1027 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
1028 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
1029 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
1031 AC_MSG_RESULT([$_perl_version])
1033 if test "$_perl_res" != 0; then
1034 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
1038 AC_MSG_CHECKING([for full perl installation])
1039 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
1041 if test "$_perl_res" != 0; then
1043 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
1045 AC_MSG_RESULT([yes])
1048 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
1049 if test -z "$PYTHON"; then
1050 AC_MSG_ERROR([python was not found in \$PATH])
1053 MOZ_ARG_WITH_BOOL(system-ply,
1054 [ --with-system-ply Use system installed python ply library],
1055 [if $PYTHON -c 'import ply' 2>&5; then
1058 AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
1061 AC_SUBST(MOZ_SYSTEM_PLY)
1063 if test -z "$COMPILE_ENVIRONMENT"; then
1064 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1066 AC_SUBST(NSINSTALL_BIN)
1068 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1069 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1070 MOZ_PATH_PROGS(UNZIP, unzip)
1071 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
1072 AC_MSG_ERROR([unzip not found in \$PATH])
1074 MOZ_PATH_PROGS(ZIP, zip)
1075 if test -z "$ZIP" -o "$ZIP" = ":"; then
1076 AC_MSG_ERROR([zip not found in \$PATH])
1078 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1079 MOZ_PATH_PROG(XARGS, xargs)
1080 if test -z "$XARGS" -o "$XARGS" = ":"; then
1081 AC_MSG_ERROR([xargs not found in \$PATH .])
1084 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
1087 if test "$COMPILE_ENVIRONMENT"; then
1089 dnl ========================================================
1090 dnl = Mac OS X toolchain support
1091 dnl ========================================================
1093 case "$target_os" in
1095 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1096 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1097 dnl the environment and includedir purposes (when using an SDK, below),
1098 dnl but remember the full version number for the libdir (SDK).
1100 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1101 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1103 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1104 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1105 dnl 4.0.0/4061 is the default compiler in Tiger.
1107 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1109 if test "$GCC_BUILD" = "4061" ; then
1110 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1111 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1112 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1116 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1117 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1118 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1119 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1121 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1122 dnl it has moved into /usr/bin.
1123 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1127 AC_SUBST(GCC_VERSION)
1129 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1130 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
1131 dnl when we can run target binaries.
1132 AC_SUBST(UNIVERSAL_BINARY)
1133 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
1135 dnl ========================================================
1136 dnl Check for MacOS deployment target version
1137 dnl ========================================================
1139 MOZ_ARG_ENABLE_STRING(macos-target,
1140 [ --enable-macos-target=VER (default=10.5)
1141 Set the minimum MacOS version needed at runtime],
1142 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1146 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1147 dnl Use the specified value
1148 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1150 dnl No value specified on the command line or in the environment,
1151 dnl use architecture minimum.
1152 case "${target_cpu}" in
1154 export MACOSX_DEPLOYMENT_TARGET=10.5
1157 export MACOSX_DEPLOYMENT_TARGET=10.6
1164 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1166 dnl ========================================================
1167 dnl = Mac OS X SDK support
1168 dnl ========================================================
1171 MOZ_ARG_WITH_STRING(macos-sdk,
1172 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1173 MACOS_SDK_DIR=$withval)
1175 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1176 dnl NEXT_ROOT will be set and exported only if it's needed.
1177 AC_SUBST(MACOS_SDK_DIR)
1180 if test "$MACOS_SDK_DIR"; then
1181 dnl Sync this section with the ones in NSPR and NSS.
1182 dnl Changes to the cross environment here need to be accounted for in
1183 dnl the libIDL checks (below) and xpidl build.
1185 if test ! -d "$MACOS_SDK_DIR"; then
1186 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1187 specify a valid SDK. SDKs are installed when the optional cross-development
1188 tools are selected during the Xcode/Developer Tools installation.])
1191 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1192 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1193 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1195 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1196 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1198 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1199 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1200 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1202 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1203 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1204 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1205 dnl be ignored and cause warnings when -syslibroot is specified.
1206 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1207 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1208 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1213 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1215 AC_TRY_COMPILE([#include <new>],[],
1219 AC_MSG_RESULT($result)
1221 if test "$result" = "no" ; then
1222 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1226 fi # COMPILE_ENVIRONMENT
1228 dnl clang prior to 2.9 (including Xcode 4) does not support all the
1229 dnl constructs required by the libtheora inline asm. This is used to
1230 dnl detect and disable it
1231 AC_MSG_CHECKING([whether the C compiler is clang older than version 2.9])
1235 #if defined(__clang__)
1236 # if __clang_major__<2 || (__clang_major__==2 && __clang_minor__<9)
1237 # error "clang older than 2.9 detected"
1245 AC_MSG_RESULT([$result])
1246 if test "$result" = "yes"; then
1249 dnl XCode 4.2 also shipped an llvm-gcc which couldn't compile
1250 dnl the libtheora inline asm.
1251 AC_MSG_CHECKING([bad gcc versions])
1252 if `$CC --version | grep -q "Apple Inc. build 5658"`; then
1253 AC_MSG_RESULT([Apple build 5658])
1256 AC_MSG_RESULT([we're ok])
1259 AC_SUBST(MOZ_NO_THEORA_ASM)
1261 if test "x$MOZ_NO_THEORA_ASM" = x1; then
1262 AC_MSG_WARN([Disabling libtheora inline assembly])
1265 if test -n "$MAKE"; then
1266 if test `echo $MAKE | grep -c make.py` != 1; then
1273 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1276 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1279 if test "$GMAKE" = ":"; then
1280 AC_MSG_ERROR([GNU make not found])
1284 if test "$COMPILE_ENVIRONMENT"; then
1290 fi # COMPILE_ENVIRONMENT
1292 dnl ========================================================
1293 dnl set the defaults first
1294 dnl ========================================================
1297 AR_EXTRACT='$(AR) x'
1311 MOZ_USER_DIR=".mozilla"
1314 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1316 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1318 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1320 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1322 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1323 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1324 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1325 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1326 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1327 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1328 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1329 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1333 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1335 USE_DEPENDENT_LIBS=1
1337 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1339 if test -n "$CROSS_COMPILE"; then
1340 OS_TARGET="${target_os}"
1341 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1343 case "${target_os}" in
1344 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1345 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1346 gnu*) OS_ARCH=GNU ;;
1347 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1348 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1349 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1352 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1355 OS_TARGET=`uname -s`
1356 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1357 OS_RELEASE=`uname -r`
1360 # Before this used `uname -m` when not cross compiling
1361 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1362 OS_TEST="${target_cpu}"
1364 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1366 #######################################################################
1367 # Master "Core Components" macros for getting the OS target #
1368 #######################################################################
1371 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1372 # cross-compilation.
1376 # Define and override various archtecture-specific variables, including
1385 case "$HOST_OS_ARCH" in
1399 if test -z "$GNU_CC"; then
1400 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1405 if test -z "$GNU_CXX"; then
1406 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1407 SOLARIS_SUNPRO_CXX=1
1410 AC_SUBST(SOLARIS_SUNPRO_CC)
1411 AC_SUBST(SOLARIS_SUNPRO_CXX)
1423 if test -z "$CROSS_COMPILE" ; then
1429 # If uname -s returns "Windows_NT", we assume that we are using
1430 # the uname.exe in MKS toolkit.
1432 # The -r option of MKS uname only returns the major version number.
1433 # So we need to use its -v option to get the minor version number.
1434 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1438 OS_MINOR_RELEASE=`uname -v`
1439 if test "$OS_MINOR_RELEASE" = "00"; then
1442 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1446 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1447 # the uname.exe in the MSYS tools.
1449 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1454 OS_RELEASE=`uname -v`.`uname -r`
1455 OS_TEST=${target_cpu}
1463 OS_RELEASE=`uname -v`
1466 case "${target_cpu}" in
1477 if test -z "$CROSS_COMPILE" ; then
1485 # Only set CPU_ARCH if we recognize the value of OS_TEST
1496 powerpc | ppc | rs6000)
1500 Alpha | alpha | ALPHA)
1533 if test -z "$OS_TARGET"; then
1536 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1538 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1539 dnl ===============================================================
1543 INTEL_ARCHITECTURE=1
1546 dnl ========================================================
1547 dnl = ARM toolchain tweaks
1548 dnl ========================================================
1551 case "${CPU_ARCH}-${OS_TARGET}" in
1556 MOZ_FLOAT_ABI=softfp
1559 if test -n "$MOZ_PLATFORM_MAEMO"; then
1562 MOZ_FLOAT_ABI=softfp
1564 if test "$MOZ_PLATFORM_MAEMO" = 6; then
1570 dnl Kept for compatibility with some buildbot mozconfig
1571 MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
1573 MOZ_ARG_WITH_STRING(thumb,
1574 [ --with-thumb[[=yes|no|toolchain-default]]]
1575 [ Use Thumb instruction set (-mthumb)],
1576 if test -z "$GNU_CC"; then
1577 AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
1581 MOZ_ARG_WITH_STRING(thumb-interwork,
1582 [ --with-thumb-interwork[[=yes|no|toolchain-default]]
1583 Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
1584 if test -z "$GNU_CC"; then
1585 AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
1587 MOZ_THUMB_INTERWORK=$withval)
1589 MOZ_ARG_WITH_STRING(arch,
1590 [ --with-arch=[[type|toolchain-default]]
1591 Use specific CPU features (-march=type)],
1592 if test -z "$GNU_CC"; then
1593 AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
1597 MOZ_ARG_WITH_STRING(fpu,
1598 [ --with-fpu=[[type|toolchain-default]]
1599 Use specific FPU type (-mfpu=type)],
1600 if test -z "$GNU_CC"; then
1601 AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
1605 MOZ_ARG_WITH_STRING(float-abi,
1606 [ --with-float-abi=[[type|toolchain-default]]
1607 Use specific arm float ABI (-mfloat-abi=type)],
1608 if test -z "$GNU_CC"; then
1609 AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
1611 MOZ_FLOAT_ABI=$withval)
1613 MOZ_ARG_WITH_STRING(soft-float,
1614 [ --with-soft-float[[=yes|no|toolchain-default]]
1615 Use soft float library (-msoft-float)],
1616 if test -z "$GNU_CC"; then
1617 AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
1619 MOZ_SOFT_FLOAT=$withval)
1622 toolchain-default|"")
1626 arch_flag="-march=$MOZ_ARCH"
1630 case "$MOZ_THUMB" in
1633 thumb_flag="-mthumb"
1640 _SAVE_CFLAGS="$CFLAGS"
1642 AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
1645 CFLAGS="$_SAVE_CFLAGS"
1650 if test "$MOZ_THUMB2" = 1; then
1651 AC_DEFINE(MOZ_THUMB2)
1654 case "$MOZ_THUMB_INTERWORK" in
1656 thumb_interwork_flag="-mthumb-interwork"
1659 thumb_interwork_flag="-mno-thumb-interwork"
1661 *) # toolchain-default
1662 thumb_interwork_flag=""
1667 toolchain-default|"")
1671 fpu_flag="-mfpu=$MOZ_FPU"
1675 case "$MOZ_FLOAT_ABI" in
1676 toolchain-default|"")
1680 float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
1684 case "$MOZ_SOFT_FLOAT" in
1686 soft_float_flag="-msoft-float"
1689 soft_float_flag="-mno-soft-float"
1691 *) # toolchain-default
1696 dnl Use echo to avoid accumulating space characters
1697 all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
1698 if test -n "$all_flags"; then
1699 _SAVE_CFLAGS="$CFLAGS"
1701 AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
1702 AC_TRY_COMPILE([],[return 0;],
1703 AC_MSG_RESULT([yes]),
1706 CFLAGS="$_SAVE_CFLAGS $all_flags"
1707 CXXFLAGS="$CXXFLAGS $all_flags"
1708 ASFLAGS="$ASFLAGS $all_flags"
1709 if test -n "$thumb_flag"; then
1710 LDFLAGS="$LDFLAGS $thumb_flag"
1714 AC_SUBST(MOZ_THUMB2)
1716 if test "$CPU_ARCH" = "arm"; then
1717 AC_MSG_CHECKING(for ARM SIMD support in compiler)
1718 # We try to link so that this also fails when
1719 # building with LTO.
1721 [asm("uqadd8 r1, r1, r2");],
1722 result="yes", result="no")
1723 AC_MSG_RESULT("$result")
1724 if test "$result" = "yes"; then
1725 AC_DEFINE(HAVE_ARM_SIMD)
1729 AC_MSG_CHECKING(for ARM NEON support in compiler)
1730 # We try to link so that this also fails when
1731 # building with LTO.
1733 [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
1734 result="yes", result="no")
1735 AC_MSG_RESULT("$result")
1736 if test "$result" = "yes"; then
1737 AC_DEFINE(HAVE_ARM_NEON)
1742 AC_SUBST(HAVE_ARM_SIMD)
1743 AC_SUBST(HAVE_ARM_NEON)
1745 dnl =================================================================
1746 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1747 dnl which is bad when cross compiling.
1748 dnl =================================================================
1749 if test "$COMPILE_ENVIRONMENT"; then
1750 configure_static_assert_macros='
1751 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1752 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1753 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1756 dnl test that the macros actually work:
1757 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1758 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1761 ac_cv_static_assertion_macros_work="yes"
1762 AC_TRY_COMPILE([$configure_static_assert_macros],
1763 [CONFIGURE_STATIC_ASSERT(1)],
1765 ac_cv_static_assertion_macros_work="no")
1766 AC_TRY_COMPILE([$configure_static_assert_macros],
1767 [CONFIGURE_STATIC_ASSERT(0)],
1768 ac_cv_static_assertion_macros_work="no",
1771 AC_TRY_COMPILE([$configure_static_assert_macros],
1772 [CONFIGURE_STATIC_ASSERT(1)],
1774 ac_cv_static_assertion_macros_work="no")
1775 AC_TRY_COMPILE([$configure_static_assert_macros],
1776 [CONFIGURE_STATIC_ASSERT(0)],
1777 ac_cv_static_assertion_macros_work="no",
1781 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1782 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1783 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1785 fi # COMPILE_ENVIRONMENT
1787 dnl ========================================================
1788 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1790 dnl ========================================================
1792 if test "$OS_TARGET" = "Android"; then
1793 case "${CPU_ARCH}-${MOZ_ARCH}" in
1795 ANDROID_CPU_ARCH=armeabi-v7a
1798 ANDROID_CPU_ARCH=armeabi
1801 ANDROID_CPU_ARCH=x86
1805 if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
1806 if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
1807 AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
1809 STLPORT_CPPFLAGS="-isystem $android_ndk/sources/cxx-stl/gnu-libstdc++/include -isystem $android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
1810 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
1811 STLPORT_LIBS="-lstdc++"
1812 elif test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
1813 STLPORT_CPPFLAGS="-isystem $android_ndk/sources/cxx-stl/stlport/stlport"
1814 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
1815 STLPORT_LIBS="-lstlport_static"
1816 elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
1817 STLPORT_CPPFLAGS="-isystem $android_ndk/sources/cxx-stl/stlport/stlport"
1818 STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH"
1819 STLPORT_LIBS="-lstlport_static"
1820 elif test "$target" != "arm-android-eabi"; then
1821 dnl fail if we're not building with NDKr4
1822 AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
1824 CPPFLAGS="$CPPFLAGS $STLPORT_CPPFLAGS"
1825 LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
1826 LIBS="$LIBS $STLPORT_LIBS"
1829 dnl ========================================================
1830 dnl Suppress Clang Argument Warnings
1831 dnl ========================================================
1832 if test -n "$CLANG_CC"; then
1833 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1834 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1836 if test -n "$CLANG_CXX"; then
1837 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1840 dnl ========================================================
1841 dnl = Use Address Sanitizer
1842 dnl ========================================================
1843 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1844 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1847 if test -n "$MOZ_ASAN"; then
1853 dnl ========================================================
1854 dnl = Enable hacks required for LLVM instrumentations
1855 dnl ========================================================
1856 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1857 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1860 if test -n "$MOZ_LLVM_HACKS"; then
1864 AC_SUBST(MOZ_NO_WLZDEFS)
1865 AC_SUBST(MOZ_CFLAGS_NSS)
1867 dnl ========================================================
1868 dnl GNU specific defaults
1869 dnl ========================================================
1870 if test "$GNU_CC"; then
1871 # FIXME: Let us build with strict aliasing. bug 414641.
1872 CFLAGS="$CFLAGS -fno-strict-aliasing"
1873 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1874 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1875 DSO_LDOPTS='-shared'
1876 if test "$GCC_USE_GNU_LD"; then
1877 # Some tools like ASan use a runtime library that is only
1878 # linked against executables, so we must allow undefined
1879 # symbols for shared objects in some cases.
1880 if test -z "$MOZ_NO_WLZDEFS"; then
1881 # Don't allow undefined symbols in libraries
1882 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1885 WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1887 DSO_PIC_CFLAGS='-fPIC'
1888 ASFLAGS="$ASFLAGS -fPIC"
1889 _MOZ_RTTI_FLAGS_ON=-frtti
1890 _MOZ_RTTI_FLAGS_OFF=-fno-rtti
1892 # Turn on GNU specific features
1893 # -Wall - turn on all warnings
1894 # -pedantic - make compiler warn about non-ANSI stuff, and
1895 # be a little bit stricter
1896 # -Wdeclaration-after-statement - MSVC doesn't like these
1897 # Warnings slamm took out for now (these were giving more noise than help):
1898 # -Wbad-function-cast - warns when casting a function to a new return type
1899 # -Wshadow - removed because it generates more noise than help --pete
1900 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith -Wdeclaration-after-statement"
1901 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1902 # Don't use -Wcast-align with ICC or clang
1904 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1905 hppa | ia64 | sparc | arm)
1908 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1913 dnl Turn pedantic on but disable the warnings for long long
1916 if test -z "$INTEL_CC"; then
1917 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1920 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1921 _USE_CPP_INCLUDE_FLAG=1
1922 elif test "$SOLARIS_SUNPRO_CC"; then
1924 if test "$CPU_ARCH" = "sparc"; then
1925 # for Sun Studio on Solaris/SPARC
1926 DSO_PIC_CFLAGS='-xcode=pic32'
1928 DSO_PIC_CFLAGS='-KPIC'
1930 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1932 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1933 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1935 DSO_LDOPTS='-shared'
1936 if test "$GNU_LD"; then
1937 # Don't allow undefined symbols in libraries
1938 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1942 DSO_PIC_CFLAGS='-KPIC'
1943 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1946 if test "$GNU_CXX"; then
1947 # FIXME: Let us build with strict aliasing. bug 414641.
1948 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1949 # Turn on GNU specific features
1950 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1951 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1952 # Don't use -Wcast-align with ICC or clang
1954 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1955 hppa | ia64 | sparc | arm)
1958 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1963 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1964 _USE_CPP_INCLUDE_FLAG=1
1966 # Recent clang and gcc support C++11 deleted functions without warnings if
1967 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1968 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1969 # unused. But clang's warning can be disabled, so when compiling with clang
1970 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1971 # deleted function syntax.
1972 if test "$CLANG_CXX"; then
1973 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1976 AC_CACHE_CHECK(whether the compiler supports -Wno-extended-offsetof,
1977 ac_has_wno_extended_offsetof,
1981 _SAVE_CXXFLAGS="$CXXFLAGS"
1982 CXXFLAGS="$CXXFLAGS -Wno-extended-offsetof"
1983 AC_TRY_COMPILE([$configure_static_assert_macros
1984 #ifndef __has_warning
1985 #define __has_warning(x) 0
1987 [CONFIGURE_STATIC_ASSERT(__has_warning("-Wextended-offsetof"))],
1988 ac_has_wno_extended_offsetof="yes",
1989 ac_has_wno_extended_offsetof="no")
1990 CXXFLAGS="$_SAVE_CXXFLAGS"
1993 if test "$ac_has_wno_extended_offsetof" = "yes"; then
1994 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-extended-offsetof"
1997 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1998 ac_has_wno_invalid_offsetof,
2002 _SAVE_CXXFLAGS="$CXXFLAGS"
2003 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
2006 ac_has_wno_invalid_offsetof="yes",
2007 ac_has_wno_invalid_offsetof="no")
2008 CXXFLAGS="$_SAVE_CXXFLAGS"
2011 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
2012 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
2015 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
2016 ac_has_wno_variadic_macros,
2020 _SAVE_CXXFLAGS="$CXXFLAGS"
2021 CXXFLAGS="$CXXFLAGS -Wno-variadic-macros"
2024 ac_has_wno_variadic_macros="yes",
2025 ac_has_wno_variadic_macros="no")
2026 CXXFLAGS="$_SAVE_CXXFLAGS"
2029 if test "$ac_has_wno_variadic_macros" = "yes"; then
2030 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-variadic-macros"
2033 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
2034 ac_has_werror_return_type,
2038 _SAVE_CXXFLAGS="$CXXFLAGS"
2039 CXXFLAGS="$CXXFLAGS -Werror=return-type"
2042 ac_has_werror_return_type="yes",
2043 ac_has_werror_return_type="no")
2044 CXXFLAGS="$_SAVE_CXXFLAGS"
2047 if test "$ac_has_werror_return_type" = "yes"; then
2048 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
2052 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
2055 dnl gcc can come with its own linker so it is better to use the pass-thru calls
2056 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
2057 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
2058 dnl normal behavior.
2059 dnl ========================================================
2061 MKSHLIB_UNFORCE_ALL=
2063 if test "$COMPILE_ENVIRONMENT"; then
2064 if test "$GNU_CC"; then
2065 AC_MSG_CHECKING(whether ld has archive extraction flags)
2066 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
2067 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
2068 ac_cv_mkshlib_force_and_unforce="no"
2069 exec 3<&0 <<LOOP_INPUT
2070 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
2071 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
2072 force="-Wl,-all"; unforce="-Wl,-none"
2079 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
2082 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
2084 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
2088 eval $ac_cv_mkshlib_force_and_unforce
2089 MKSHLIB_FORCE_ALL=$force
2090 MKSHLIB_UNFORCE_ALL=$unforce
2093 fi # COMPILE_ENVIRONMENT
2095 dnl ========================================================
2096 dnl Checking for 64-bit OS
2097 dnl ========================================================
2098 if test "$COMPILE_ENVIRONMENT"; then
2101 AC_MSG_CHECKING(for 64-bit OS)
2102 AC_TRY_COMPILE([$configure_static_assert_macros],
2103 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
2104 result="yes", result="no")
2105 AC_MSG_RESULT("$result")
2106 if test "$result" = "yes"; then
2107 AC_DEFINE(HAVE_64BIT_OS)
2110 AC_SUBST(HAVE_64BIT_OS)
2112 fi # COMPILE_ENVIRONMENT
2114 dnl ========================================================
2115 dnl Enable high-memory support on OS/2 by default.
2116 dnl ========================================================
2117 MOZ_OS2_HIGH_MEMORY=1
2118 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
2119 [ --disable-os2-high-mem Disable high-memory support on OS/2],
2120 MOZ_OS2_HIGH_MEMORY=,
2121 MOZ_OS2_HIGH_MEMORY=1 )
2122 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
2124 dnl ========================================================
2125 dnl = Use profiling compile flags
2126 dnl ========================================================
2127 MOZ_ARG_ENABLE_BOOL(profiling,
2128 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
2132 dnl ========================================================
2134 dnl ========================================================
2135 MOZ_ARG_ENABLE_BOOL(valgrind,
2136 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
2139 if test -n "$MOZ_VALGRIND"; then
2140 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
2142 [--enable-valgrind specified but Valgrind is not installed]))
2143 AC_DEFINE(MOZ_VALGRIND)
2145 AC_SUBST(MOZ_VALGRIND)
2147 dnl ========================================================
2149 dnl ========================================================
2150 MOZ_ARG_ENABLE_BOOL(dmd,
2151 [ --enable-dmd Enable DMD; also disables jemalloc (default=no)],
2154 if test -n "$MOZ_DMD"; then
2155 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
2157 [--enable-dmd specified but Valgrind is not installed]))
2162 dnl ========================================================
2164 dnl ========================================================
2165 MOZ_ARG_ENABLE_BOOL(jprof,
2166 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
2169 if test -n "$MOZ_JPROF"; then
2171 AC_DEFINE(MOZ_JPROF)
2174 dnl ========================================================
2176 dnl ========================================================
2177 MOZ_ARG_ENABLE_BOOL(sps,
2178 [ --enable-sps Enable sps profiling tool.],
2179 MOZ_ENABLE_PROFILER_SPS=1,
2180 MOZ_ENABLE_PROFILER_SPS= )
2181 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
2182 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
2185 dnl ========================================================
2187 dnl ========================================================
2188 MOZ_ARG_ENABLE_BOOL(shark,
2189 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
2192 if test -n "$MOZ_SHARK"; then
2194 AC_DEFINE(MOZ_SHARK)
2197 dnl ========================================================
2199 dnl ========================================================
2200 MOZ_ARG_ENABLE_BOOL(callgrind,
2201 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
2204 if test -n "$MOZ_CALLGRIND"; then
2206 AC_DEFINE(MOZ_CALLGRIND)
2209 dnl ========================================================
2211 dnl ========================================================
2212 MOZ_ARG_ENABLE_BOOL(vtune,
2213 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
2216 if test -n "$MOZ_VTUNE"; then
2218 AC_DEFINE(MOZ_VTUNE)
2221 dnl ========================================================
2223 dnl ========================================================
2224 if test -n "$MOZ_PROFILING"; then
2225 AC_DEFINE(MOZ_PROFILING)
2228 dnl ========================================================
2229 dnl System overrides of the defaults for host
2230 dnl ========================================================
2233 if test -n "$_WIN32_MSVC"; then
2235 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
2236 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
2237 HOST_RANLIB='echo ranlib'
2239 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
2241 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
2242 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
2243 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2244 HOST_BIN_SUFFIX=.exe
2247 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
2251 case "${host_cpu}" in
2253 if test -n "$_WIN32_MSVC"; then
2254 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
2258 if test -n "$_WIN32_MSVC"; then
2259 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
2261 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
2267 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
2268 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2269 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
2272 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2273 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
2274 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2275 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
2279 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
2280 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2281 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2282 HOST_BIN_SUFFIX=.exe
2287 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
2288 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2292 dnl We require version 2.5 or newer of Python to build.
2293 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
2295 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
2298 if test "$_python_res" != 0; then
2299 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
2301 AC_MSG_RESULT([yes])
2303 dnl Check for using a custom <stdint.h> implementation
2304 dnl ========================================================
2305 AC_MSG_CHECKING(for custom <stdint.h> implementation)
2306 if test "$MOZ_CUSTOM_STDINT_H"; then
2307 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
2308 AC_SUBST(MOZ_CUSTOM_STDINT_H)
2309 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
2311 AC_MSG_RESULT(none specified)
2314 dnl Get mozilla version from central milestone file
2315 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
2316 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
2318 dnl Get version of various core apps from the version files.
2319 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
2321 if test -z "$FIREFOX_VERSION"; then
2322 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
2325 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
2326 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
2327 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
2329 MOZ_DOING_LTO(lto_is_enabled)
2331 dnl ========================================================
2332 dnl System overrides of the defaults for target
2333 dnl ========================================================
2338 if test ! "$GNU_CC"; then
2339 if test ! "$HAVE_64BIT_OS"; then
2340 # Compiling with Visual Age C++ object model compat is the
2341 # default. To compile with object model ibm, add
2342 # AIX_OBJMODEL=ibm to .mozconfig.
2343 if test "$AIX_OBJMODEL" = "ibm"; then
2344 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
2351 AC_SUBST(AIX_OBJMODEL)
2352 DSO_LDOPTS='-qmkshrobj=1'
2353 DSO_CFLAGS='-qflag=w:w'
2355 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
2357 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2358 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2359 if test "$COMPILE_ENVIRONMENT"; then
2362 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
2364 [#if (__IBMCPP__ < 900)
2365 #error "Bad compiler"
2367 _BAD_COMPILER=,_BAD_COMPILER=1)
2368 if test -n "$_BAD_COMPILER"; then
2370 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
2372 AC_MSG_RESULT([yes])
2375 TARGET_COMPILER_ABI="ibmc"
2376 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
2377 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
2380 case "${target_os}" in
2385 if test "$COMPILE_ENVIRONMENT"; then
2386 MOZ_CHECK_HEADERS(sys/inttypes.h)
2388 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2392 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2401 _WARNINGS_CFLAGS="-Wall"
2402 _WARNINGS_CXXFLAGS="-Wall"
2403 # The test above doesn't work properly, at least on 3.1.
2404 MKSHLIB_FORCE_ALL=''
2405 MKSHLIB_UNFORCE_ALL=''
2411 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2412 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2413 MOZ_OPTIMIZE_FLAGS="-O3"
2415 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
2416 if test "$HAVE_64BIT_OS"; then
2419 CFLAGS="$CFLAGS -fno-common"
2420 CXXFLAGS="$CXXFLAGS -fno-common"
2423 STRIP="$STRIP -x -S"
2424 # Check whether we're targeting OS X or iOS
2425 AC_CACHE_CHECK(for iOS target,
2427 [AC_TRY_COMPILE([#include <TargetConditionals.h>
2428 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
2432 ac_cv_ios_target="yes",
2433 ac_cv_ios_target="no")])
2434 if test "$ac_cv_ios_target" = "yes"; then
2436 AC_DEFINE(XP_DARWIN)
2437 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
2439 AC_DEFINE(XP_MACOSX)
2440 AC_DEFINE(XP_DARWIN)
2441 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2442 # The ExceptionHandling framework is needed for Objective-C exception
2443 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2445 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2447 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2450 if test "x$lto_is_enabled" = "xyes"; then
2451 echo "Skipping -dead_strip because lto is enabled."
2452 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2453 dnl ===================================================================
2454 elif test "x$enable_dtrace" = "xyes"; then
2455 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2457 dnl check for the presence of the -dead_strip linker flag
2458 AC_MSG_CHECKING([for -dead_strip option to ld])
2459 _SAVE_LDFLAGS=$LDFLAGS
2460 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2461 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2462 if test -n "$_HAVE_DEAD_STRIP" ; then
2463 AC_MSG_RESULT([yes])
2464 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2469 LDFLAGS=$_SAVE_LDFLAGS
2471 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2475 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2476 DLL_SUFFIX=".so.1.0"
2477 DSO_LDOPTS="-shared"
2479 if test ! "$GNU_CC"; then
2480 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2486 if test ! "$GNU_CC"; then
2490 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2491 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2492 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2495 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2496 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2500 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2501 AC_DEFINE(_LARGEFILE64_SOURCE)
2506 if test ! "$GNU_CC"; then
2507 DSO_LDOPTS='-b -Wl,+s'
2510 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2511 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2512 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2514 DSO_LDOPTS='-b -E +s'
2515 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2516 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2518 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2519 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2522 *-android*|*-linuxandroid*)
2523 AC_DEFINE(NO_PW_GECOS)
2525 if test -n "$gonkdir"; then
2526 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2530 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2533 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2535 MOZ_GFX_OPTIMIZE_MOBILE=1
2536 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2540 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2541 # Similarly for GNU_CXX and INTEL_CXX.
2542 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2543 # -Os has been broken on Intel's C/C++ compilers for quite a
2544 # while; Intel recommends against using it.
2545 MOZ_OPTIMIZE_FLAGS="-O2"
2546 MOZ_DEBUG_FLAGS="-g"
2547 elif test "$GNU_CC" -o "$GNU_CXX"; then
2548 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2549 case $GCC_VERSION in
2551 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2552 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2554 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2555 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2556 MOZ_DEBUG_FLAGS="-g"
2559 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2563 case "${target_cpu}" in
2565 CFLAGS="$CFLAGS -mieee"
2566 CXXFLAGS="$CXXFLAGS -mieee"
2572 MOZ_DEBUG_FLAGS="-g" # We want inlining
2576 if test -z "$MC"; then
2586 # certain versions of cygwin's makedepend barf on the
2587 # #include <string> vs -I./dist/include/string issue so don't use it
2589 if test -n "$GNU_CC"; then
2591 CXX="$CXX -mwindows"
2592 CPP="$CPP -mwindows"
2593 CFLAGS="$CFLAGS -mms-bitfields"
2594 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2595 DSO_LDOPTS='-shared'
2596 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2597 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2599 # Use temp file for windres (bug 213281)
2600 RCFLAGS='-O coff --use-temp-file'
2601 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2602 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2604 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2605 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2607 IMPORT_LIB_SUFFIX=dll.a
2608 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2610 TARGET_COMPILER_ABI=msvc
2614 if test "$AS_BIN"; then
2615 AS="$(basename "$AS_BIN")"
2618 AR_FLAGS='-NOLOGO -OUT:"$@"'
2620 RANLIB='echo not_ranlib'
2621 STRIP='echo not_strip'
2627 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2633 IMPORT_LIB_SUFFIX=lib
2634 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2635 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2637 MKSHLIB_UNFORCE_ALL=
2638 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2639 _USE_CPP_INCLUDE_FLAG=1
2640 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2641 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2642 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2643 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2644 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2645 # make 'foo == bar;' error out
2646 CFLAGS="$CFLAGS -we4553"
2647 CXXFLAGS="$CXXFLAGS -we4553"
2648 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2649 MOZ_DEBUG_FLAGS='-Zi'
2650 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2651 WARNINGS_AS_ERRORS='-WX'
2652 MOZ_OPTIMIZE_FLAGS='-O1'
2654 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2655 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2656 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2657 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2658 if test $_MSC_VER -ge 1400; then
2659 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2660 dnl For profile-guided optimization
2661 PROFILE_GEN_CFLAGS="-GL"
2662 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2663 dnl XXX: PGO builds can fail with warnings treated as errors,
2664 dnl specifically "no profile data available" appears to be
2665 dnl treated as an error sometimes. This might be a consequence
2666 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2667 dnl with the linker doing most of the work in the whole-program
2668 dnl optimization/PGO case. I think it's probably a compiler bug,
2669 dnl but we work around it here.
2670 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2671 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2672 dnl Probably also a compiler bug, but what can you do?
2673 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2674 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2677 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/media/libjpeg)'
2678 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/media/libpng)'
2679 AC_DEFINE(HAVE_SNPRINTF)
2684 AC_DEFINE(HW_THREADS)
2685 AC_DEFINE(STDC_HEADERS)
2686 AC_DEFINE(NEW_H, <new>)
2687 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2688 TARGET_MD_ARCH=win32
2689 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2691 MOZ_USER_DIR="Mozilla"
2693 dnl Hardcode to win95 for now - cls
2694 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2696 dnl set NO_X11 defines here as the general check is skipped on win32
2702 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2703 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2709 if test -z "$MOZ_TOOLS"; then
2710 AC_MSG_ERROR([MOZ_TOOLS is not set])
2712 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2713 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2714 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2716 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2717 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2718 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2725 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.])
2731 if test "$HAVE_64BIT_OS"; then
2732 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2735 if test $_MSC_VER -ge 1400; then
2736 LDFLAGS="$LDFLAGS -SAFESEH"
2739 if test -n "$GNU_CC"; then
2740 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2741 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2743 AC_DEFINE(HAVE_STDCALL)
2744 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2747 MOZ_CHECK_HEADERS(mmintrin.h)
2751 if test -n "$_WIN32_MSVC"; then
2752 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2757 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2761 if test "$HAVE_64BIT_OS"; then
2768 CFLAGS="$CFLAGS -Dunix"
2769 CXXFLAGS="$CXXFLAGS -Dunix"
2770 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2772 DSO_PIC_CFLAGS='-fPIC -DPIC'
2773 DSO_LDOPTS='-shared'
2774 BIN_FLAGS='-Wl,--export-dynamic'
2776 DSO_PIC_CFLAGS='-fPIC -DPIC'
2777 DLL_SUFFIX=".so.1.0"
2778 DSO_LDOPTS='-shared'
2780 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2781 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2782 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2783 if test "$LIBRUNPATH"; then
2784 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2786 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2787 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2791 if test "$SO_VERSION"; then
2792 DLL_SUFFIX=".so.$SO_VERSION"
2794 DLL_SUFFIX=".so.1.0"
2796 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2798 DSO_PIC_CFLAGS='-fPIC'
2799 DSO_LDOPTS='-shared -fPIC'
2800 if test "$LIBRUNPATH"; then
2801 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2806 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2807 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2810 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2811 AC_DEFINE(TCPV40HDRS)
2817 IMPORT_LIB_SUFFIX=lib
2821 CFLAGS="$CFLAGS -Zomf"
2822 CXXFLAGS="$CXXFLAGS -Zomf"
2824 BIN_FLAGS='-Zlinker /ST:0x100000'
2828 WARNINGS_AS_ERRORS='-Werror'
2829 MOZ_DEBUG_FLAGS="-g -fno-inline"
2830 MOZ_OPTIMIZE_FLAGS="-O2"
2831 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2832 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2833 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2835 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2839 MOZ_USER_DIR="Mozilla"
2842 if test "$MOZTOOLS"; then
2843 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2845 AC_MSG_ERROR([MOZTOOLS is not set])
2847 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2848 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2849 LDFLAGS="$LDFLAGS -Zhigh-mem"
2850 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2851 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2854 # GCC for OS/2 currently predefines these, but we don't want them
2855 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2856 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2858 AC_CACHE_CHECK(for __declspec(dllexport),
2860 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2862 ac_os2_declspec="yes",
2863 ac_os2_declspec="no")])
2864 if test "$ac_os2_declspec" != "yes"; then
2865 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2871 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2874 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2875 # libraries one level up (e.g. libnspr4.so)
2876 if test "$SOLARIS_SUNPRO_CC"; then
2877 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2878 LIBS="-lCrun -lCstd -lc $LIBS"
2879 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2880 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2881 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2882 LDFLAGS="-xildoff $LDFLAGS"
2883 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2884 _SAVE_LDFLAGS=$LDFLAGS
2885 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2886 AC_TRY_LINK([#include <stdio.h>],
2887 [printf("Hello World\n");],
2889 [LDFLAGS=$_SAVE_LDFLAGS])
2891 MOZ_OPTIMIZE_FLAGS="-xO4"
2892 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2893 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2894 MKSHLIB_FORCE_ALL='-z allextract'
2895 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2902 AS='/usr/ccs/bin/as'
2903 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2905 TARGET_COMPILER_ABI="sunc"
2906 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2907 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2908 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2912 [#if (__SUNPRO_CC < 0x590)
2915 _BAD_COMPILER=,_BAD_COMPILER=1)
2916 if test -n "$_BAD_COMPILER"; then
2918 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2923 [#if (__SUNPRO_CC >= 0x5100)
2924 #error "Sun C++ 5.10 or above"
2926 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2927 if test "$_ABOVE_SS12U1"; then
2929 CXXFLAGS="$CXXFLAGS -xannotate=no"
2931 AC_MSG_RESULT([$_res])
2934 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2936 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2937 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2938 ASFLAGS="$ASFLAGS -fPIC"
2939 DSO_LDOPTS='-shared'
2940 WARNINGS_AS_ERRORS='-Werror'
2942 _WARNINGS_CXXFLAGS=''
2943 if test "$OS_RELEASE" = "5.3"; then
2944 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2947 if test "$OS_RELEASE" = "5.5.1"; then
2948 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2953 DSO_LDOPTS='-Bdynamic'
2954 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2955 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2957 AC_DEFINE(SPRINTF_RETURNS_STRING)
2958 case "$(target_os)" in
2960 DLL_SUFFIX='.so.1.0'
2966 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2971 AC_SUBST(MOZ_LINKER)
2972 if test -n "$MOZ_LINKER"; then
2973 AC_DEFINE(MOZ_LINKER)
2975 AC_SUBST(MOZ_ENABLE_SZIP)
2977 dnl Only one oddball right now (QNX), but this gives us flexibility
2978 dnl if any other platforms need to override this in the future.
2979 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2981 dnl ========================================================
2982 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2983 dnl by now will not have any way to link most binaries (tests
2984 dnl as well as viewer, apprunner, etc.), because some symbols
2985 dnl will be left out of the "composite" .so's by ld as unneeded.
2986 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2987 dnl they can link in the static libs that provide the missing
2989 dnl ========================================================
2990 NO_LD_ARCHIVE_FLAGS=
2991 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2992 NO_LD_ARCHIVE_FLAGS=1
2996 NO_LD_ARCHIVE_FLAGS=
2999 NO_LD_ARCHIVE_FLAGS=
3002 if test -z "$GNU_CC"; then
3003 NO_LD_ARCHIVE_FLAGS=
3007 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
3009 dnl ========================================================
3010 dnl = Flags to strip unused symbols from .so components and
3011 dnl = to export jemalloc symbols when linking a program
3012 dnl ========================================================
3014 *-linux*|*-kfreebsd*-gnu|*-gnu*)
3015 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
3018 if test -z "$GNU_CC"; then
3019 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
3021 if test -z "$GCC_USE_GNU_LD"; then
3022 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
3024 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
3029 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
3032 if test -n "$GNU_CC"; then
3033 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
3038 if test -z "$COMPILE_ENVIRONMENT"; then
3039 SKIP_COMPILER_CHECKS=1
3040 SKIP_LIBRARY_CHECKS=1
3043 if test -z "$SKIP_COMPILER_CHECKS"; then
3044 dnl Checks for typedefs, structures, and compiler characteristics.
3045 dnl ========================================================
3053 AC_MSG_CHECKING(for __stdcall)
3054 AC_CACHE_VAL(ac_cv___stdcall,
3055 [AC_TRY_COMPILE([template <typename Method> struct foo;
3056 template <> struct foo<void (*)()> {};
3057 template <> struct foo<void (__stdcall*)()> {};],
3059 [ac_cv___stdcall=true],
3060 [ac_cv___stdcall=false])])
3061 if test "$ac_cv___stdcall" = true ; then
3062 AC_DEFINE(HAVE_STDCALL)
3068 AC_MSG_CHECKING(for ssize_t)
3069 AC_CACHE_VAL(ac_cv_type_ssize_t,
3070 [AC_TRY_COMPILE([#include <stdio.h>
3071 #include <sys/types.h>],
3073 [ac_cv_type_ssize_t=true],
3074 [ac_cv_type_ssize_t=false])])
3075 if test "$ac_cv_type_ssize_t" = true ; then
3076 AC_DEFINE(HAVE_SSIZE_T)
3081 AC_STRUCT_ST_BLKSIZE
3082 AC_MSG_CHECKING(for siginfo_t)
3083 AC_CACHE_VAL(ac_cv_siginfo_t,
3084 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
3085 #include <signal.h>],
3087 [ac_cv_siginfo_t=true],
3088 [ac_cv_siginfo_t=false])])
3089 if test "$ac_cv_siginfo_t" = true ; then
3090 AC_DEFINE(HAVE_SIGINFO_T)
3096 dnl Check for int64, uint, and uint_t.
3097 dnl ========================================================
3098 AC_MSG_CHECKING(for int64)
3099 AC_CACHE_VAL(ac_cv_int64,
3100 [AC_TRY_COMPILE([#include <stdio.h>
3101 #include <sys/types.h>],
3104 [ac_cv_int64=false])])
3105 if test "$ac_cv_int64" = true ; then
3106 AC_DEFINE(HAVE_INT64)
3111 AC_MSG_CHECKING(for uint)
3112 AC_CACHE_VAL(ac_cv_uint,
3113 [AC_TRY_COMPILE([#include <stdio.h>
3114 #include <sys/types.h>],
3117 [ac_cv_uint=false])])
3118 if test "$ac_cv_uint" = true ; then
3119 AC_DEFINE(HAVE_UINT)
3124 AC_MSG_CHECKING(for uint_t)
3125 AC_CACHE_VAL(ac_cv_uint_t,
3126 [AC_TRY_COMPILE([#include <stdio.h>
3127 #include <sys/types.h>],
3129 [ac_cv_uint_t=true],
3130 [ac_cv_uint_t=false])])
3131 if test "$ac_cv_uint_t" = true ; then
3132 AC_DEFINE(HAVE_UINT_T)
3138 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3139 dnl are defined when compiling C++ but not C. Since the result of this
3140 dnl test is used only in C++, do it in C++.
3143 AC_MSG_CHECKING(for uname.domainname)
3144 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3145 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3146 [ struct utsname *res; char *domain;
3147 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
3148 [ac_cv_have_uname_domainname_field=true],
3149 [ac_cv_have_uname_domainname_field=false])])
3151 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3152 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3158 AC_MSG_CHECKING(for uname.__domainname)
3159 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3160 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3161 [ struct utsname *res; char *domain;
3162 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
3163 [ac_cv_have_uname_us_domainname_field=true],
3164 [ac_cv_have_uname_us_domainname_field=false])])
3166 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3167 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3173 dnl ========================================================
3175 dnl Should be smarter and check that the compiler does indeed have rtti
3176 dnl ========================================================
3178 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
3179 [ --enable-cpp-rtti Enable C++ RTTI ],
3180 [ _MOZ_USE_RTTI=1 ],
3183 if test "$_MOZ_USE_RTTI"; then
3184 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
3186 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
3189 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
3191 dnl Check whether we can use gcc's c++0x mode
3194 if test "$GNU_CXX"; then
3195 _SAVE_CXXFLAGS=$CXXFLAGS
3196 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3198 if test -z "$_MOZ_USE_RTTI"; then
3199 CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
3200 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
3201 ac_cv_cxx0x_headers_bug,
3202 [AC_TRY_COMPILE([#include <memory>], [],
3203 ac_cv_cxx0x_headers_bug="no",
3204 ac_cv_cxx0x_headers_bug="yes")])
3205 CXXFLAGS="$_SAVE_CXXFLAGS"
3206 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
3207 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3212 dnl Check for usable char16_t (2 bytes, unsigned)
3213 dnl (we might not need the unsignedness check anymore)
3214 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3215 ac_cv_have_usable_char16_t,
3216 [AC_TRY_COMPILE([$configure_static_assert_macros],
3217 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3218 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3219 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3220 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3221 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3222 ac_cv_have_usable_char16_t="yes",
3223 ac_cv_have_usable_char16_t="no")])
3224 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3225 AC_DEFINE(HAVE_CPP_CHAR16_T)
3227 elif test "$GNU_CXX"; then
3228 CXXFLAGS="$_SAVE_CXXFLAGS"
3231 dnl Check for usable wchar_t (2 bytes, unsigned)
3232 dnl (we really don't need the unsignedness check anymore)
3233 dnl ========================================================
3235 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3236 ac_cv_have_usable_wchar_v2,
3237 [AC_TRY_COMPILE([#include <stddef.h>
3238 $configure_static_assert_macros],
3239 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3240 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3241 ac_cv_have_usable_wchar_v2="yes",
3242 ac_cv_have_usable_wchar_v2="no")])
3243 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3244 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3245 HAVE_CPP_2BYTE_WCHAR_T=1
3246 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3247 dnl This is really gcc-only
3248 dnl Do this test using CXX only since some versions of gcc
3249 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3250 dnl only have short-wchar support for c++.
3251 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3253 _SAVE_CXXFLAGS=$CXXFLAGS
3254 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3256 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3257 ac_cv_have_usable_wchar_option_v2,
3258 [AC_TRY_LINK([#include <stddef.h>
3259 $configure_static_assert_macros],
3260 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3261 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3262 ac_cv_have_usable_wchar_option_v2="yes",
3263 ac_cv_have_usable_wchar_option_v2="no")])
3265 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3266 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3267 HAVE_CPP_2BYTE_WCHAR_T=1
3268 if test "$OS_TARGET" = Android; then
3269 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3270 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3271 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3272 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3274 WCHAR_CFLAGS="-fshort-wchar"
3277 CXXFLAGS=$_SAVE_CXXFLAGS
3283 dnl Check for .hidden assembler directive and visibility attribute.
3284 dnl Borrowed from glibc configure.in
3285 dnl ===============================================================
3286 if test "$GNU_CC"; then
3287 AC_CACHE_CHECK(for visibility(hidden) attribute,
3288 ac_cv_visibility_hidden,
3289 [cat > conftest.c <<EOF
3290 int foo __attribute__ ((visibility ("hidden"))) = 1;
3292 ac_cv_visibility_hidden=no
3293 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3294 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3295 ac_cv_visibility_hidden=yes
3300 if test "$ac_cv_visibility_hidden" = "yes"; then
3301 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3303 AC_CACHE_CHECK(for visibility(default) attribute,
3304 ac_cv_visibility_default,
3305 [cat > conftest.c <<EOF
3306 int foo __attribute__ ((visibility ("default"))) = 1;
3308 ac_cv_visibility_default=no
3309 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3310 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3311 ac_cv_visibility_default=yes
3316 if test "$ac_cv_visibility_default" = "yes"; then
3317 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3319 AC_CACHE_CHECK(for visibility pragma support,
3320 ac_cv_visibility_pragma,
3321 [cat > conftest.c <<EOF
3322 #pragma GCC visibility push(hidden)
3324 #pragma GCC visibility push(default)
3325 int foo_default = 1;
3327 ac_cv_visibility_pragma=no
3328 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3329 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3330 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3331 ac_cv_visibility_pragma=yes
3337 if test "$ac_cv_visibility_pragma" = "yes"; then
3338 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3339 ac_cv_have_visibility_class_bug,
3340 [cat > conftest.c <<EOF
3341 #pragma GCC visibility push(hidden)
3342 struct __attribute__ ((visibility ("default"))) TestStruct {
3345 __attribute__ ((visibility ("default"))) void TestFunc() {
3349 ac_cv_have_visibility_class_bug=no
3350 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3351 ac_cv_have_visibility_class_bug=yes
3353 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3354 ac_cv_have_visibility_class_bug=yes
3357 rm -rf conftest.{c,S}
3360 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3361 ac_cv_have_visibility_builtin_bug,
3362 [cat > conftest.c <<EOF
3363 #pragma GCC visibility push(hidden)
3364 #pragma GCC visibility push(default)
3366 #pragma GCC visibility pop
3368 __attribute__ ((visibility ("default"))) void Func() {
3370 memset(c, 0, sizeof(c));
3373 ac_cv_have_visibility_builtin_bug=no
3374 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3375 ac_cv_have_visibility_builtin_bug=yes
3377 if test `grep -c "@PLT" conftest.S` = 0; then
3378 ac_cv_visibility_builtin_bug=yes
3381 rm -f conftest.{c,S}
3383 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3384 "$ac_cv_have_visibility_class_bug" = "no"; then
3385 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3386 WRAP_SYSTEM_INCLUDES=1
3387 STL_FLAGS='-I$(DIST)/stl_wrappers'
3390 VISIBILITY_FLAGS='-fvisibility=hidden'
3391 fi # have visibility pragma bug
3392 fi # have visibility pragma
3393 fi # have visibility(default) attribute
3394 fi # have visibility(hidden) attribute
3397 # visibility hidden flag for Sun Studio on Solaris
3398 if test "$SOLARIS_SUNPRO_CC"; then
3399 VISIBILITY_FLAGS='-xldscope=hidden'
3400 fi # Sun Studio on Solaris
3402 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3403 AC_SUBST(VISIBILITY_FLAGS)
3408 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3409 dnl ========================================================
3410 if test "$GNU_CC"; then
3411 CFLAGS_save="${CFLAGS}"
3412 CFLAGS="${CFLAGS} -Werror"
3413 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3414 ac_cv_force_align_arg_pointer,
3415 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3417 ac_cv_force_align_arg_pointer="yes",
3418 ac_cv_force_align_arg_pointer="no")])
3419 CFLAGS="${CFLAGS_save}"
3420 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3421 HAVE_GCC_ALIGN_ARG_POINTER=1
3423 HAVE_GCC_ALIGN_ARG_POINTER=
3426 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3428 dnl Checks for header files.
3429 dnl ========================================================
3431 case "$target_os" in
3433 # for stuff like -lXshm
3434 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3437 MOZ_CHECK_COMMON_HEADERS
3439 dnl These are all the places some variant of statfs can be hiding.
3440 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3443 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
3444 MOZ_CHECK_HEADERS(linux/quota.h)
3446 dnl Try for MMX support
3447 dnl NB - later gcc versions require -mmmx for this header to be successfully
3448 dnl included (or another option which implies it, such as -march=pentium-mmx)
3449 MOZ_CHECK_HEADERS(mmintrin.h)
3451 dnl Check whether the compiler supports the new-style C++ standard
3452 dnl library headers (i.e. <new>) or needs the old "new.h"
3455 MOZ_CHECK_HEADER(new, [NEW_H=new])
3456 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3459 AC_ARG_ENABLE(dtrace,
3460 [ --enable-dtrace build with dtrace support if available (default=no)],
3461 [enable_dtrace="yes"],)
3462 if test "x$enable_dtrace" = "xyes"; then
3463 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3464 if test -n "$HAVE_DTRACE"; then
3465 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3467 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3470 AC_SUBST(HAVE_DTRACE)
3476 MOZ_CHECK_HEADERS(sys/cdefs.h)
3480 dnl Checks for libraries.
3481 dnl ========================================================
3486 AC_CHECK_LIB(c_r, gethostbyname_r)
3490 dnl We don't want to link with libdl even if it's present on OS X, since
3491 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3493 dnl We don't want to link against libm or libpthread on Darwin since
3494 dnl they both are just symlinks to libSystem and explicitly linking
3495 dnl against libSystem causes issues when debugging (see bug 299601).
3502 AC_SEARCH_LIBS(dlopen, dl,
3503 MOZ_CHECK_HEADER(dlfcn.h,
3504 AC_DEFINE(HAVE_DLOPEN)))
3508 _SAVE_CFLAGS="$CFLAGS"
3509 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3510 AC_CHECK_FUNCS(dladdr memmem)
3511 CFLAGS="$_SAVE_CFLAGS"
3513 if test ! "$GNU_CXX"; then
3517 AC_CHECK_LIB(C_r, demangle)
3520 AC_CHECK_LIB(C, demangle)
3525 dnl OS/2 has socket in libc.
3530 AC_CHECK_LIB(socket, socket)
3534 XLIBS="$X_EXTRA_LIBS"
3536 dnl ========================================================
3537 dnl Checks for X libraries.
3538 dnl Ordering is important.
3539 dnl Xt is dependent upon SM as of X11R6
3540 dnl ========================================================
3541 if test "$no_x" = "yes"; then
3544 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3545 XLIBS="-lX11 $XLIBS"
3546 _SAVE_LDFLAGS="$LDFLAGS"
3547 LDFLAGS="$XLDFLAGS $LDFLAGS"
3548 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3549 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3550 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3551 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3553 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3554 unset ac_cv_lib_Xt_XtFree
3555 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3556 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3557 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3558 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3561 # AIX needs the motif library linked before libXt to prevent
3562 # crashes in plugins linked against Motif - Bug #98892
3563 case "${target_os}" in
3565 XT_LIBS="-lXm $XT_LIBS"
3569 dnl ========================================================
3570 dnl = Check for XShm
3571 dnl ========================================================
3572 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3575 dnl ========================================================
3577 dnl ========================================================
3578 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3579 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3580 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3581 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3583 LDFLAGS="$_SAVE_LDFLAGS"
3585 dnl ========================================================
3586 dnl = Check for freetype2 and its functionality
3587 dnl ========================================================
3588 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3590 if test "$_HAVE_FREETYPE2"; then
3592 _SAVE_CFLAGS="$CFLAGS"
3593 LIBS="$LIBS $FT2_LIBS"
3594 CFLAGS="$CFLAGS $FT2_CFLAGS"
3596 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3597 ac_cv_member_FT_Bitmap_Size_y_ppem,
3598 [AC_TRY_COMPILE([#include <ft2build.h>
3599 #include FT_FREETYPE_H],
3601 if (sizeof s.y_ppem) return 0;
3603 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3604 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3605 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3606 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3608 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3610 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3611 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3612 [FT_Bitmap_Size structure includes y_ppem field])
3614 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3617 CFLAGS="$_SAVE_CFLAGS"
3629 dnl ========================================================
3630 dnl = pthread support
3631 dnl = Start by checking whether the system support pthreads
3632 dnl ========================================================
3633 case "$target_os" in
3638 MOZ_CHECK_PTHREADS(pthreads,
3639 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3640 MOZ_CHECK_PTHREADS(pthread,
3641 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3642 MOZ_CHECK_PTHREADS(c_r,
3643 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3644 MOZ_CHECK_PTHREADS(c,
3653 dnl ========================================================
3654 dnl Check the command line for --with-pthreads
3655 dnl ========================================================
3656 MOZ_ARG_WITH_BOOL(pthreads,
3657 [ --with-pthreads Force use of system pthread library with NSPR ],
3658 [ if test "$USE_PTHREADS"x = x; then
3659 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3665 dnl ========================================================
3666 dnl Do the platform specific pthread hackery
3667 dnl ========================================================
3668 if test "$USE_PTHREADS"x != x
3671 dnl See if -pthread is supported.
3674 ac_cv_have_dash_pthread=no
3675 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3676 echo 'int main() { return 0; }' | cat > conftest.c
3677 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3678 if test $? -eq 0; then
3679 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3680 ac_cv_have_dash_pthread=yes
3681 case "$target_os" in
3683 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3686 CFLAGS="$CFLAGS -pthread"
3687 CXXFLAGS="$CXXFLAGS -pthread"
3693 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3696 dnl See if -pthreads is supported.
3698 ac_cv_have_dash_pthreads=no
3699 if test "$ac_cv_have_dash_pthread" = "no"; then
3700 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3701 echo 'int main() { return 0; }' | cat > conftest.c
3702 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3703 if test $? -eq 0; then
3704 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3705 ac_cv_have_dash_pthreads=yes
3706 CFLAGS="$CFLAGS -pthreads"
3707 CXXFLAGS="$CXXFLAGS -pthreads"
3711 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3716 AC_DEFINE(_REENTRANT)
3717 AC_DEFINE(_THREAD_SAFE)
3718 dnl -pthread links in -lc_r, so don't specify it explicitly.
3719 if test "$ac_cv_have_dash_pthread" = "yes"; then
3720 _PTHREAD_LDFLAGS="-pthread"
3722 _PTHREAD_LDFLAGS="-lc_r"
3726 *-*-openbsd*|*-*-bsdi*)
3727 AC_DEFINE(_REENTRANT)
3728 AC_DEFINE(_THREAD_SAFE)
3729 dnl -pthread links in -lc_r, so don't specify it explicitly.
3730 if test "$ac_cv_have_dash_pthread" = "yes"; then
3731 _PTHREAD_LDFLAGS="-pthread"
3735 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3736 AC_DEFINE(_REENTRANT)
3740 AC_DEFINE(_REENTRANT)
3744 AC_DEFINE(_REENTRANT)
3748 AC_DEFINE(_REENTRANT)
3749 if test "$SOLARIS_SUNPRO_CC"; then
3750 CFLAGS="$CFLAGS -mt"
3751 CXXFLAGS="$CXXFLAGS -mt"
3755 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3759 dnl Checks for library functions.
3760 dnl ========================================================
3761 AC_PROG_GCC_TRADITIONAL
3763 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3764 AC_CHECK_FUNCS(flockfile getpagesize)
3765 AC_CHECK_FUNCS(localtime_r strtok_r)
3767 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
3768 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
3769 ac_cv_clock_monotonic,
3770 [for libs in "" -lrt; do
3771 _SAVE_LDFLAGS="$LDFLAGS"
3772 LDFLAGS="$LDFLAGS $libs"
3773 AC_TRY_LINK([#include <time.h>],
3774 [ struct timespec ts;
3775 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3776 ac_cv_clock_monotonic=$libs
3778 ac_cv_clock_monotonic=no)
3779 LDFLAGS="$_SAVE_LDFLAGS"
3781 if test "$ac_cv_clock_monotonic" != "no"; then
3782 HAVE_CLOCK_MONOTONIC=1
3783 REALTIME_LIBS=$ac_cv_clock_monotonic
3784 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3785 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3786 AC_SUBST(REALTIME_LIBS)
3789 dnl check for wcrtomb/mbrtowc
3790 dnl =======================================================================
3791 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3794 AC_CACHE_CHECK(for wcrtomb,
3796 [AC_TRY_LINK([#include <wchar.h>],
3797 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3798 ac_cv_have_wcrtomb="yes",
3799 ac_cv_have_wcrtomb="no")])
3800 if test "$ac_cv_have_wcrtomb" = "yes"; then
3801 AC_DEFINE(HAVE_WCRTOMB)
3803 AC_CACHE_CHECK(for mbrtowc,
3805 [AC_TRY_LINK([#include <wchar.h>],
3806 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3807 ac_cv_have_mbrtowc="yes",
3808 ac_cv_have_mbrtowc="no")])
3809 if test "$ac_cv_have_mbrtowc" = "yes"; then
3810 AC_DEFINE(HAVE_MBRTOWC)
3817 ac_cv_func_res_ninit,
3820 #define _BSD_SOURCE 1
3824 [int foo = res_ninit(&_res);],
3825 [ac_cv_func_res_ninit=yes],
3826 [ac_cv_func_res_ninit=no])
3829 if test "$ac_cv_func_res_ninit" = "yes"; then
3830 AC_DEFINE(HAVE_RES_NINIT)
3831 dnl must add the link line we do something as foolish as this... dougt
3833 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3834 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3839 [for gnu_get_libc_version()],
3840 ac_cv_func_gnu_get_libc_version,
3842 #ifdef HAVE_GNU_LIBC_VERSION_H
3843 #include <gnu/libc-version.h>
3846 [const char *glibc_version = gnu_get_libc_version();],
3847 [ac_cv_func_gnu_get_libc_version=yes],
3848 [ac_cv_func_gnu_get_libc_version=no]
3852 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3853 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3857 darwin*|mingw*|os2*)
3861 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3862 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3863 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3865 LIBS="$LIBS $_ICONV_LIBS"
3874 iconv_t h = iconv_open("", "");
3875 iconv(h, NULL, NULL, NULL, NULL);
3878 [ac_cv_func_iconv=yes],
3879 [ac_cv_func_iconv=no]
3882 if test "$ac_cv_func_iconv" = "yes"; then
3883 AC_DEFINE(HAVE_ICONV)
3884 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3885 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3886 LIBICONV="$_ICONV_LIBS"
3888 [for iconv() with const input],
3889 ac_cv_func_const_iconv,
3895 const char *input = "testing";
3896 iconv_t h = iconv_open("", "");
3897 iconv(h, &input, NULL, NULL, NULL);
3900 [ac_cv_func_const_iconv=yes],
3901 [ac_cv_func_const_iconv=no]
3904 if test "$ac_cv_func_const_iconv" = "yes"; then
3905 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3917 dnl **********************
3918 dnl *** va_copy checks ***
3919 dnl **********************
3920 dnl we currently check for all three va_copy possibilities, so we get
3921 dnl all results in config.log for bug reports.
3922 AC_MSG_CHECKING(for an implementation of va_copy())
3923 AC_CACHE_VAL(ac_cv_va_copy,[
3926 void f (int i, ...) {
3927 va_list args1, args2;
3928 va_start (args1, i);
3929 va_copy (args2, args1);
3930 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3932 va_end (args1); va_end (args2);
3934 int main() { f (0, 42); return 0; }],
3940 AC_MSG_RESULT($ac_cv_va_copy)
3941 AC_MSG_CHECKING(for an implementation of __va_copy())
3942 AC_CACHE_VAL(ac_cv___va_copy,[
3945 void f (int i, ...) {
3946 va_list args1, args2;
3947 va_start (args1, i);
3948 __va_copy (args2, args1);
3949 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3951 va_end (args1); va_end (args2);
3953 int main() { f (0, 42); return 0; }],
3954 ac_cv___va_copy=yes,
3959 AC_MSG_RESULT($ac_cv___va_copy)
3960 AC_MSG_CHECKING(whether va_lists can be copied by value)
3961 AC_CACHE_VAL(ac_cv_va_val_copy,[
3964 void f (int i, ...) {
3965 va_list args1, args2;
3966 va_start (args1, i);
3968 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3970 va_end (args1); va_end (args2);
3972 int main() { f (0, 42); return 0; }],
3973 ac_cv_va_val_copy=yes,
3974 ac_cv_va_val_copy=no,
3975 ac_cv_va_val_copy=yes
3978 if test "x$ac_cv_va_copy" = "xyes"; then
3979 AC_DEFINE(VA_COPY, va_copy)
3980 AC_DEFINE(HAVE_VA_COPY)
3981 elif test "x$ac_cv___va_copy" = "xyes"; then
3982 AC_DEFINE(VA_COPY, __va_copy)
3983 AC_DEFINE(HAVE_VA_COPY)
3986 if test "x$ac_cv_va_val_copy" = "xno"; then
3987 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3989 AC_MSG_RESULT($ac_cv_va_val_copy)
3991 dnl ===================================================================
3992 dnl ========================================================
3993 dnl Put your C++ language/feature checks below
3994 dnl ========================================================
3998 if test "$GNU_CC"; then
3999 if test "$CPU_ARCH" = "arm" ; then
4000 AC_CACHE_CHECK(for ARM EABI,
4004 #if defined(__ARM_EABI__)
4007 #error Not ARM EABI.
4010 ac_cv_gcc_arm_eabi="yes",
4011 ac_cv_gcc_arm_eabi="no")])
4012 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4014 ARM_ABI_PREFIX=eabi-
4016 ARM_ABI_PREFIX=oabi-
4020 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4023 dnl Check for support of modern template specialization syntax
4024 dnl Test code and requirement from scc@netscape.com.
4025 dnl Autoconf cut-and-paste job by waterson@netscape.com
4026 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4027 ac_cv_cpp_modern_specialize_template_syntax,
4028 [AC_TRY_COMPILE(template <class T> struct X { int a; };
4030 template <> struct X<Y> { double a; };,
4033 ac_cv_cpp_modern_specialize_template_syntax=yes,
4034 ac_cv_cpp_modern_specialize_template_syntax=no)])
4035 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
4036 AC_MSG_ERROR([The C++ compiler does not support template specialization])
4039 dnl Some compilers support only full specialization, and some don't.
4040 AC_CACHE_CHECK(whether partial template specialization works,
4041 ac_cv_cpp_partial_specialization,
4042 [AC_TRY_COMPILE(template <class T> class Foo {};
4043 template <class T> class Foo<T*> {};,
4045 ac_cv_cpp_partial_specialization=yes,
4046 ac_cv_cpp_partial_specialization=no)])
4047 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4048 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4051 dnl Check to see if we can resolve ambiguity with |using|.
4052 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4053 ac_cv_cpp_ambiguity_resolving_using,
4054 [AC_TRY_COMPILE(class X {
4055 public: int go(const X&) {return 3;}
4056 int jo(const X&) {return 3;}
4058 class Y : public X {
4059 public: int go(int) {return 2;}
4060 int jo(int) {return 2;}
4062 private: using X::go;
4065 ac_cv_cpp_ambiguity_resolving_using=yes,
4066 ac_cv_cpp_ambiguity_resolving_using=no)])
4067 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4068 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4071 dnl See if a dynamic_cast to void* gives the most derived object.
4072 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4073 ac_cv_cpp_dynamic_cast_void_ptr,
4074 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4075 class Y { int j; public: virtual ~Y() { } };
4076 class Z : public X, public Y { int k; };
4082 return !((((void*)&mdo != (void*)subx) &&
4083 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4084 (((void*)&mdo != (void*)suby) &&
4085 ((void*)&mdo == dynamic_cast<void*>(suby))));
4087 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4088 ac_cv_cpp_dynamic_cast_void_ptr=no,
4089 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4090 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4091 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4095 dnl note that this one is reversed - if the test fails, then
4096 dnl we require implementations of unused virtual methods. Which
4097 dnl really blows because it means we'll have useless vtable
4099 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4100 ac_cv_cpp_unused_required,
4101 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4103 ac_cv_cpp_unused_required=no,
4104 ac_cv_cpp_unused_required=yes)])
4105 if test "$ac_cv_cpp_unused_required" = yes ; then
4106 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4110 dnl Some compilers have trouble comparing a constant reference to a templatized
4111 dnl class to zero, and require an explicit operator==() to be defined that takes
4112 dnl an int. This test separates the strong from the weak.
4114 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4115 ac_cv_trouble_comparing_to_zero,
4116 [AC_TRY_COMPILE([#include <algorithm>
4117 template <class T> class Foo {};
4119 template <class T> int operator==(const T2*, const T&) { return 0; }
4120 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4121 [Foo<int> f; return (0 != f);],
4122 ac_cv_trouble_comparing_to_zero=no,
4123 ac_cv_trouble_comparing_to_zero=yes)])
4124 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4125 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4128 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4129 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
4130 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
4132 _SAVE_LDFLAGS=$LDFLAGS
4133 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
4134 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4135 ac_cv_thread_keyword,
4136 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4137 [return tlsIsMainThread;],
4138 ac_cv_thread_keyword=yes,
4139 ac_cv_thread_keyword=no)])
4140 LDFLAGS=$_SAVE_LDFLAGS
4141 # The custom dynamic linker doesn't support TLS variables
4142 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
4143 # mips builds fail with TLS variables because of a binutils bug.
4149 *-android*|*-linuxandroid*)
4153 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4158 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
4159 if test -n "$MOZ_LINKER"; then
4160 if test "$CPU_ARCH" = arm; then
4161 dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
4162 ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
4163 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
4164 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
4165 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
4166 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
4171 dnl The custom linker doesn't support text relocations, but NDK >= r6b
4172 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
4173 dnl We however want to avoid these text relocations, and this can be done
4174 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
4175 dnl doesn't contain anything at all, beside placeholders for some sections,
4176 dnl and crtbegin only contains a finalizer function that calls
4177 dnl __cxa_finalize. The custom linker actually takes care of calling
4178 dnl __cxa_finalize when the library doesn't call it itself, which makes it
4179 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
4180 dnl link crtbegin and crtend at all.
4181 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
4182 AC_CACHE_CHECK([whether the CRT objects have text relocations],
4183 ac_cv_crt_has_text_relocations,
4184 [echo 'int foo() { return 0; }' > conftest.cpp
4185 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
4186 test -s conftest${DLL_SUFFIX}; then
4187 if readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
4188 ac_cv_crt_has_text_relocations=yes
4190 ac_cv_crt_has_text_relocations=no
4193 AC_ERROR([couldn't compile a simple C file])
4196 if test "$ac_cv_crt_has_text_relocations" = yes; then
4197 dnl While we want libraries to skip the CRT files, we don't want
4198 dnl executables to be treated the same way. We thus set the flag
4199 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
4200 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
4201 dnl Using LDFLAGS in nspr is safe, since we only really build
4202 dnl libraries there.
4203 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
4204 NSPR_LDFLAGS=-nostartfiles
4208 dnl Check for the existence of various allocation headers/functions
4211 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4212 if test "$MALLOC_H" = ""; then
4213 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4214 if test "$MALLOC_H" = ""; then
4215 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4218 if test "$MALLOC_H" != ""; then
4219 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4222 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4223 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4225 dnl See if compiler supports some gcc-style attributes
4227 AC_CACHE_CHECK(for __attribute__((always_inline)),
4228 ac_cv_attribute_always_inline,
4229 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
4231 ac_cv_attribute_always_inline=yes,
4232 ac_cv_attribute_always_inline=no)])
4234 AC_CACHE_CHECK(for __attribute__((malloc)),
4235 ac_cv_attribute_malloc,
4236 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
4238 ac_cv_attribute_malloc=yes,
4239 ac_cv_attribute_malloc=no)])
4241 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4242 ac_cv_attribute_warn_unused,
4243 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
4245 ac_cv_attribute_warn_unused=yes,
4246 ac_cv_attribute_warn_unused=no)])
4248 dnl End of C++ language/feature checks
4251 dnl ========================================================
4252 dnl = Internationalization checks
4253 dnl ========================================================
4255 dnl Internationalization and Locale support is different
4256 dnl on various UNIX platforms. Checks for specific i18n
4257 dnl features go here.
4259 dnl check for LC_MESSAGES
4260 AC_CACHE_CHECK(for LC_MESSAGES,
4261 ac_cv_i18n_lc_messages,
4262 [AC_TRY_COMPILE([#include <locale.h>],
4263 [int category = LC_MESSAGES;],
4264 ac_cv_i18n_lc_messages=yes,
4265 ac_cv_i18n_lc_messages=no)])
4266 if test "$ac_cv_i18n_lc_messages" = yes; then
4267 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4270 AC_HAVE_FUNCS(localeconv)
4271 fi # ! SKIP_COMPILER_CHECKS
4274 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4275 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4278 dnl Mozilla specific options
4279 dnl ========================================================
4280 dnl The macros used for command line options
4281 dnl are defined in build/autoconf/altoptions.m4.
4283 dnl If the compiler supports these attributes, define them as
4284 dnl convenience macros.
4285 if test "$ac_cv_attribute_always_inline" = yes ; then
4286 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4288 AC_DEFINE(NS_ALWAYS_INLINE,)
4291 if test "$ac_cv_attribute_malloc" = yes ; then
4292 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4294 AC_DEFINE(NS_ATTR_MALLOC,)
4297 if test "$ac_cv_attribute_warn_unused" = yes ; then
4298 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4300 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4303 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4304 dnl features that Windows actually does support.
4306 if test -n "$SKIP_COMPILER_CHECKS"; then
4307 dnl Windows has malloc.h
4308 AC_DEFINE(MALLOC_H, [<malloc.h>])
4309 AC_DEFINE(HAVE_FORCEINLINE)
4310 AC_DEFINE(HAVE_LOCALECONV)
4311 fi # SKIP_COMPILER_CHECKS
4313 dnl ========================================================
4315 dnl = Check for external package dependencies
4317 dnl ========================================================
4318 MOZ_ARG_HEADER(External Packages)
4320 MOZ_ARG_WITH_STRING(libxul-sdk,
4321 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4322 LIBXUL_SDK_DIR=$withval)
4324 if test "$LIBXUL_SDK_DIR" = "yes"; then
4325 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4326 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4327 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4329 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4330 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4334 AC_SUBST(LIBXUL_SDK)
4336 if test -n "$LIBXUL_SDK"; then
4337 LIBXUL_DIST="$LIBXUL_SDK"
4339 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4341 AC_SUBST(LIBXUL_DIST)
4345 MOZ_ARG_WITH_BOOL(system-libxul,
4346 [ --with-system-libxul Use system installed libxul SDK],
4349 dnl ========================================================
4350 dnl = If NSPR was not detected in the system,
4351 dnl = use the one in the source tree (mozilla/nsprpub)
4352 dnl ========================================================
4353 MOZ_ARG_WITH_BOOL(system-nspr,
4354 [ --with-system-nspr Use system installed NSPR],
4355 _USE_SYSTEM_NSPR=1 )
4357 if test -n "$_USE_SYSTEM_NSPR"; then
4358 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])])
4361 if test -n "$MOZ_NATIVE_NSPR"; then
4362 _SAVE_CFLAGS=$CFLAGS
4363 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4364 AC_TRY_COMPILE([#include "prtypes.h"],
4365 [#ifndef PR_STATIC_ASSERT
4366 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
4368 [MOZ_NATIVE_NSPR=1],
4369 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4370 AC_TRY_COMPILE([#include "prtypes.h"],
4372 #error PR_UINT64 not defined or requires including prtypes.h
4374 [MOZ_NATIVE_NSPR=1],
4375 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
4376 CFLAGS=$_SAVE_CFLAGS
4378 if test "$OS_ARCH" = "WINNT"; then
4379 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4380 if test -n "$GNU_CC"; then
4381 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4383 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4386 NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4387 NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4391 dnl system libevent Support
4392 dnl ========================================================
4393 MOZ_ARG_WITH_STRING(system-libevent,
4394 [ --with-system-libevent=[PFX]
4395 Use system libevent [installed at prefix PFX]],
4396 LIBEVENT_DIR=$withval)
4398 _SAVE_CFLAGS=$CFLAGS
4399 _SAVE_LDFLAGS=$LDFLAGS
4401 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4402 MOZ_NATIVE_LIBEVENT=
4404 if test "${LIBEVENT_DIR}" = "yes"; then
4407 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4408 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4409 MOZ_CHECK_HEADER(event.h,
4410 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4411 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4413 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4414 AC_CHECK_LIB(event, event_init,
4415 [MOZ_NATIVE_LIBEVENT=1
4416 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4417 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4418 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4420 CFLAGS=$_SAVE_CFLAGS
4421 LDFLAGS=$_SAVE_LDFLAGS
4424 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4425 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4426 AC_SUBST(MOZ_LIBEVENT_LIBS)
4428 dnl ========================================================
4429 dnl = If NSS was not detected in the system,
4430 dnl = use the one in the source tree (mozilla/security/nss)
4431 dnl ========================================================
4433 MOZ_ARG_WITH_BOOL(system-nss,
4434 [ --with-system-nss Use system installed NSS],
4437 if test -n "$_USE_SYSTEM_NSS"; then
4438 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])])
4441 if test -n "$MOZ_NATIVE_NSS"; then
4442 NSS_LIBS="$NSS_LIBS -lcrmf"
4444 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4446 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4447 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4448 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4449 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4450 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4452 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4454 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4455 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4456 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4457 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4458 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4460 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4464 dnl ======================
4466 dnl ======================
4468 AC_MSG_CHECKING([for YASM assembler])
4469 AC_CHECK_PROGS(YASM, yasm, "")
4471 if test -n "$YASM"; then
4472 dnl Pull out yasm's version string
4474 _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
4477 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4478 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4479 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4480 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4481 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4484 if test -z "$SKIP_LIBRARY_CHECKS"; then
4485 dnl system JPEG support
4486 dnl ========================================================
4487 MOZ_ARG_WITH_STRING(system-jpeg,
4488 [ --with-system-jpeg[=PFX]
4489 Use system libjpeg [installed at prefix PFX]],
4492 _SAVE_CFLAGS=$CFLAGS
4493 _SAVE_LDFLAGS=$LDFLAGS
4495 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4496 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4497 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4499 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4502 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4505 if test "$SYSTEM_JPEG" = 1; then
4506 LIBS="$JPEG_LIBS $LIBS"
4507 AC_TRY_COMPILE([ #include <stdio.h>
4508 #include <sys/types.h>
4509 #include <jpeglib.h> ],
4510 [ #if JPEG_LIB_VERSION < $MOZJPEG
4511 #error "Insufficient JPEG library version ($MOZJPEG required)."
4514 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4516 CFLAGS=$_SAVE_CFLAGS
4517 LDFLAGS=$_SAVE_LDFLAGS
4520 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4521 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4522 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4525 dnl system ZLIB support
4526 dnl ========================================================
4527 MOZ_ARG_WITH_STRING(system-zlib,
4528 [ --with-system-zlib[=PFX]
4529 Use system libz [installed at prefix PFX]],
4532 _SAVE_CFLAGS=$CFLAGS
4533 _SAVE_LDFLAGS=$LDFLAGS
4535 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4536 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4537 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4539 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4542 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4543 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4545 if test "$SYSTEM_ZLIB" = 1; then
4546 LIBS="$ZLIB_LIBS $LIBS"
4547 AC_TRY_COMPILE([ #include <stdio.h>
4549 #include <zlib.h> ],
4550 [ #if ZLIB_VERNUM < $MOZZLIB
4551 #error "Insufficient zlib version ($MOZZLIB required)."
4554 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4556 CFLAGS=$_SAVE_CFLAGS
4557 LDFLAGS=$_SAVE_LDFLAGS
4560 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4561 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4562 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4565 if test "$MOZ_LINKER" = 1 -a "$SYSTEM_ZLIB" != 1; then
4566 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4569 dnl system BZIP2 Support
4570 dnl ========================================================
4571 MOZ_ARG_WITH_STRING(system-bz2,
4572 [ --with-system-bz2[=PFX]
4573 Use system libbz2 [installed at prefix PFX]],
4576 _SAVE_CFLAGS=$CFLAGS
4577 _SAVE_LDFLAGS=$LDFLAGS
4579 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4580 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4581 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4583 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4586 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4587 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4589 CFLAGS=$_SAVE_CFLAGS
4590 LDFLAGS=$_SAVE_LDFLAGS
4593 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4594 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4595 BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4598 dnl system PNG Support
4599 dnl ========================================================
4600 MOZ_ARG_WITH_STRING(system-png,
4601 [ --with-system-png[=PFX]
4602 Use system libpng [installed at prefix PFX]],
4605 _SAVE_CFLAGS=$CFLAGS
4606 _SAVE_LDFLAGS=$LDFLAGS
4608 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4609 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4610 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4611 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4612 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4614 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4617 _SAVE_PNG_LIBS=$PNG_LIBS
4618 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4619 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4621 AC_CHECK_LIB(png, png_get_acTL, ,
4622 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4625 if test "$SYSTEM_PNG" = 1; then
4626 LIBS="$PNG_LIBS $LIBS"
4627 AC_TRY_COMPILE([ #include <stdio.h>
4628 #include <sys/types.h>
4630 [ #if PNG_LIBPNG_VER < $MOZPNG
4631 #error "Insufficient libpng version ($MOZPNG required)."
4633 #ifndef PNG_UINT_31_MAX
4634 #error "Insufficient libpng version."
4637 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4639 CFLAGS=$_SAVE_CFLAGS
4640 LDFLAGS=$_SAVE_LDFLAGS
4643 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4644 PNG_CFLAGS="-I${PNG_DIR}/include"
4645 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4648 fi # SKIP_LIBRARY_CHECKS
4650 dnl system HunSpell Support
4651 dnl ========================================================
4652 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4653 [ --enable-system-hunspell
4654 Use system hunspell (located with pkgconfig)],
4657 if test -n "$SYSTEM_HUNSPELL"; then
4658 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4661 AC_SUBST(SYSTEM_HUNSPELL)
4663 dnl ========================================================
4664 dnl system libffi Support
4665 dnl ========================================================
4666 MOZ_ARG_ENABLE_BOOL(system-ffi,
4667 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4670 if test -n "$MOZ_NATIVE_FFI"; then
4671 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4672 # for non-GCC compilers.
4673 if test -z "$GNU_CC"; then
4674 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4676 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4678 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4681 dnl ========================================================
4682 dnl Java SDK support
4683 dnl ========================================================
4686 MOZ_ARG_WITH_STRING(java-bin-path,
4687 [ --with-java-bin-path=dir
4688 Location of Java binaries (java, javac, jar)],
4689 JAVA_BIN_PATH=$withval)
4691 dnl ========================================================
4695 dnl ========================================================
4697 MOZ_ARG_HEADER(Application)
4700 ENABLE_SYSTEM_EXTENSION_DIRS=1
4701 MOZ_BRANDING_DIRECTORY=
4702 MOZ_OFFICIAL_BRANDING=
4706 MOZ_AUTH_EXTENSION=1
4716 MOZ_VP8_ERROR_CONCEALMENT=
4726 LIBJPEG_TURBO_ASFLAGS=
4727 LIBJPEG_TURBO_X86_ASM=
4728 LIBJPEG_TURBO_X64_ASM=
4729 LIBJPEG_TURBO_ARM_ASM=
4733 MOZ_PREF_EXTENSIONS=1
4734 MOZ_PROFILELOCKING=1
4740 MOZ_JAVA_COMPOSITOR=
4741 MOZ_ONLY_TOUCH_EVENTS=
4743 MOZ_TOOLKIT_SEARCH=1
4745 MOZ_UNIVERSALCHARDET=1
4752 MOZ_DISABLE_DOMCRYPTO=
4756 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4759 MOZ_USE_NATIVE_POPUP_WINDOWS=
4760 MOZ_ANDROID_HISTORY=
4773 case "$target_os" in
4776 AC_DEFINE(NS_ENABLE_TSF)
4781 *-android*|*-linuxandroid*)
4782 if test "$CPU_ARCH" = "arm" ; then
4789 MOZ_THEME_FASTSTRIPE=1
4796 MOZ_ARG_ENABLE_STRING(application,
4797 [ --enable-application=APP
4801 tools/update-packaging (AUS-related packaging tools)],
4802 [ MOZ_BUILD_APP=$enableval ] )
4804 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4805 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4806 XULRUNNER_STUB_NAME=$withval)
4808 if test -z "$XULRUNNER_STUB_NAME"; then
4809 case "$target_os" in
4811 XULRUNNER_STUB_NAME=xulrunner
4814 XULRUNNER_STUB_NAME=xulrunner-stub
4817 AC_SUBST(XULRUNNER_STUB_NAME)
4819 AC_MSG_CHECKING([for application to build])
4820 if test -z "$MOZ_BUILD_APP"; then
4821 AC_MSG_RESULT([browser])
4822 MOZ_BUILD_APP=browser
4824 # default mobile to be mobile/xul
4825 if test "$MOZ_BUILD_APP" = "mobile" ; then
4826 MOZ_BUILD_APP=mobile/xul
4828 # We have a valid application only if it has a build.mk file in its top
4830 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4831 AC_MSG_RESULT([none])
4832 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4834 AC_MSG_RESULT([$MOZ_BUILD_APP])
4838 # Allow the application to influence configure with a confvars.sh script.
4840 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4841 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4842 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4843 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4848 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4849 MOZ_ARG_WITH_STRING(app-name,
4850 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4851 WITH_APP_NAME=$withval,
4854 if test -n "$WITH_APP_NAME" ; then
4855 MOZ_APP_NAME="$WITH_APP_NAME"
4858 MOZ_ARG_WITH_STRING(app-basename,
4859 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4860 WITH_APP_BASENAME=$withval,
4863 if test -n "$WITH_APP_BASENAME" ; then
4864 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4867 # Now is a good time to test for logic errors, define mismatches, etc.
4868 case "$MOZ_BUILD_APP" in
4870 if test "$LIBXUL_SDK"; then
4871 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4876 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4877 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4879 case "$MOZ_BUILD_APP" in
4881 AC_DEFINE(MOZ_PHOENIX)
4885 AC_DEFINE(MOZ_XULRUNNER)
4889 AC_SUBST(MOZ_BUILD_APP)
4890 AC_SUBST(MOZ_PHOENIX)
4891 AC_SUBST(MOZ_XULRUNNER)
4893 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4895 dnl ========================================================
4897 dnl = Toolkit Options
4899 dnl ========================================================
4900 MOZ_ARG_HEADER(Toolkit Options)
4902 dnl ========================================================
4903 dnl = Select the default toolkit
4904 dnl ========================================================
4905 MOZ_ARG_ENABLE_STRING(default-toolkit,
4906 [ --enable-default-toolkit=TK
4907 Select default toolkit
4908 Platform specific defaults:
4909 Mac OS X - cairo-cocoa
4911 Win32 - cairo-windows
4914 [ _DEFAULT_TOOLKIT=$enableval ],
4915 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4917 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4918 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4919 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4920 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4921 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4922 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4923 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4924 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4925 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4927 dnl nglayout only supports building with one toolkit,
4928 dnl so ignore everything after the first comma (",").
4929 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4931 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4934 MOZ_ARG_WITHOUT_BOOL(x,
4935 [ --without-x Build without X11],
4938 dnl ========================================================
4939 dnl = Enable the toolkit as needed =
4940 dnl ========================================================
4942 case "$MOZ_WIDGET_TOOLKIT" in
4945 MOZ_WIDGET_TOOLKIT=windows
4948 MOZ_INSTRUMENT_EVENT_LOOP=1
4951 cairo-gtk2|cairo-gtk2-x11)
4952 MOZ_WIDGET_TOOLKIT=gtk2
4954 MOZ_ENABLE_XREMOTE=1
4962 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4963 TK_LIBS='$(MOZ_GTK2_LIBS)'
4964 AC_DEFINE(MOZ_WIDGET_GTK2)
4966 MOZ_INSTRUMENT_EVENT_LOOP=1
4970 MOZ_WIDGET_TOOLKIT=qt
4972 if test -z "$WITHOUT_X11"; then
4973 MOZ_ENABLE_XREMOTE=1
4983 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4984 TK_LIBS='$(MOZ_QT_LIBS)'
4985 AC_DEFINE(MOZ_WIDGET_QT)
4990 MOZ_WIDGET_TOOLKIT=os2
4992 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4993 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4998 MOZ_WIDGET_TOOLKIT=cocoa
4999 AC_DEFINE(MOZ_WIDGET_COCOA)
5000 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5001 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5002 TK_CFLAGS="-DNO_X11"
5003 CFLAGS="$CFLAGS $TK_CFLAGS"
5004 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5005 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5006 MOZ_USER_DIR="Mozilla"
5007 MOZ_FS_LAYOUT=bundle
5009 MOZ_INSTRUMENT_EVENT_LOOP=1
5013 MOZ_WIDGET_TOOLKIT=uikit
5014 AC_DEFINE(MOZ_WIDGET_UIKIT)
5015 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
5016 TK_CFLAGS="-DNO_X11"
5017 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
5018 CFLAGS="$CFLAGS $TK_CFLAGS"
5019 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5020 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5021 MOZ_USER_DIR="Mozilla"
5022 MOZ_FS_LAYOUT=bundle
5026 AC_DEFINE(MOZ_WIDGET_ANDROID)
5027 AC_DEFINE(MOZ_TOUCH)
5028 MOZ_WIDGET_TOOLKIT=android
5029 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5030 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5033 MOZ_INSTRUMENT_EVENT_LOOP=1
5034 if test "$MOZ_BUILD_APP" = "mobile/xul"; then
5041 AC_DEFINE(MOZ_WIDGET_GONK)
5042 AC_DEFINE(MOZ_TOUCH)
5043 MOZ_WIDGET_TOOLKIT=gonk
5044 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5045 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5053 AC_SUBST(MOZ_OLD_LINKER)
5054 AC_SUBST(MOZ_PDF_PRINTING)
5055 if test "$MOZ_PDF_PRINTING"; then
5056 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5057 AC_DEFINE(MOZ_PDF_PRINTING)
5060 if test "$MOZ_ENABLE_XREMOTE"; then
5061 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5064 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
5065 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
5068 if test "$COMPILE_ENVIRONMENT"; then
5069 if test "$MOZ_ENABLE_GTK2"; then
5070 if test "$MOZ_X11"; then
5071 GDK_PACKAGES=gdk-x11-2.0
5074 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5077 fi # COMPILE_ENVIRONMENT
5079 AC_SUBST(MOZ_FS_LAYOUT)
5081 dnl ========================================================
5082 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5083 dnl their usage and use them in spidermonkey.
5084 dnl ========================================================
5085 MOZ_ARG_WITH_BOOL(arm-kuser,
5086 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5088 if test -n "$USE_ARM_KUSER"; then
5089 AC_DEFINE(USE_ARM_KUSER)
5092 dnl ========================================================
5093 dnl = startup-notification support module
5094 dnl ========================================================
5096 if test "$MOZ_ENABLE_GTK2"
5098 MOZ_ENABLE_STARTUP_NOTIFICATION=
5100 MOZ_ARG_ENABLE_BOOL(startup-notification,
5101 [ --enable-startup-notification
5102 Enable startup-notification support (default: disabled) ],
5103 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5104 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5105 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5107 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5108 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5109 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5110 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5112 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5114 MOZ_ENABLE_STARTUP_NOTIFICATION=
5118 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5119 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5122 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5124 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5125 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5126 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5128 dnl ========================================================
5130 dnl ========================================================
5131 if test "$MOZ_ENABLE_QT"
5133 MOZ_ARG_WITH_STRING(qtdir,
5134 [ --with-qtdir=\$dir Specify Qt directory ],
5137 if test -z "$QTDIR"; then
5138 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5139 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5140 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
5142 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
5144 MOZ_QT_CFLAGS="-DQT_SHARED"
5145 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5146 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5147 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5148 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5149 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5150 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5151 HOST_MOC="$QTDIR/bin/moc"
5152 HOST_RCC="$QTDIR/bin/rcc"
5154 if test -z "$HOST_MOC"; then
5155 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5158 if test -z "$HOST_RCC"; then
5159 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
5166 MOZ_ENABLE_QMSYSTEM2=
5167 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
5168 MOZ_ENABLE_QMSYSTEM2=1,
5169 MOZ_ENABLE_QMSYSTEM2=)
5171 if test "$MOZ_ENABLE_QMSYSTEM2"; then
5172 MOZ_ENABLE_QMSYSTEM2=1
5173 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
5174 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
5175 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
5178 MOZ_ENABLE_QTNETWORK=
5179 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5180 MOZ_ENABLE_QTNETWORK=1,
5181 MOZ_ENABLE_QTNETWORK=)
5183 if test "$MOZ_ENABLE_QTNETWORK"; then
5184 MOZ_ENABLE_QTNETWORK=1
5185 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5188 MOZ_ENABLE_QTMOBILITY=
5189 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
5190 MOZ_ENABLE_QTMOBILITY=1,
5191 MOZ_ENABLE_QTMOBILITY=)
5192 if test "$MOZ_ENABLE_QTMOBILITY"; then
5193 MOZ_ENABLE_QTMOBILITY=1
5194 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
5195 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
5197 AC_CHECK_LIB(QtSensors, main, [
5198 MOZ_ENABLE_QTMOBILITY=1
5199 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
5200 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
5201 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
5202 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
5203 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
5206 if test "$MOZ_ENABLE_QTMOBILITY"; then
5207 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
5211 AC_SUBST(GTK_CONFIG)
5215 AC_SUBST(MOZ_ENABLE_GTK2)
5216 AC_SUBST(MOZ_ENABLE_QT)
5217 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5218 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
5219 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
5220 AC_SUBST(MOZ_ENABLE_XREMOTE)
5221 AC_SUBST(MOZ_GTK2_CFLAGS)
5222 AC_SUBST(MOZ_GTK2_LIBS)
5223 AC_SUBST(MOZ_QT_CFLAGS)
5224 AC_SUBST(MOZ_QT_LIBS)
5231 dnl ========================================================
5233 dnl = Components & Features
5235 dnl ========================================================
5236 MOZ_ARG_HEADER(Components and Features)
5238 dnl ========================================================
5240 dnl ========================================================
5241 MOZ_ARG_ENABLE_STRING(ui-locale,
5242 [ --enable-ui-locale=ab-CD
5243 Select the user interface locale (default: en-US)],
5244 MOZ_UI_LOCALE=$enableval )
5245 AC_SUBST(MOZ_UI_LOCALE)
5247 dnl ========================================================
5248 dnl = Trademarked Branding
5249 dnl ========================================================
5250 MOZ_ARG_ENABLE_BOOL(official-branding,
5251 [ --enable-official-branding
5252 Enable Official mozilla.org Branding
5253 Do not distribute builds with
5254 --enable-official-branding unless you have
5255 permission to use trademarks per
5256 http://www.mozilla.org/foundation/trademarks/ .],
5258 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5259 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5261 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5262 MOZ_OFFICIAL_BRANDING=1
5264 ], MOZ_OFFICIAL_BRANDING=)
5266 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5267 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5268 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5271 MOZ_ARG_WITH_STRING(branding,
5272 [ --with-branding=dir Use branding from the specified directory.],
5273 MOZ_BRANDING_DIRECTORY=$withval)
5275 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5276 if test -z "$REAL_BRANDING_DIRECTORY"; then
5277 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5280 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5281 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5284 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5286 dnl ========================================================
5287 dnl = Distribution ID
5288 dnl ========================================================
5289 MOZ_ARG_WITH_STRING(distribution-id,
5290 [ --with-distribution-id=ID
5291 Set distribution-specific id (default=org.mozilla)],
5292 [ val=`echo $withval`
5293 MOZ_DISTRIBUTION_ID="$val"])
5295 if test -z "$MOZ_DISTRIBUTION_ID"; then
5296 MOZ_DISTRIBUTION_ID="org.mozilla"
5299 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5300 AC_SUBST(MOZ_DISTRIBUTION_ID)
5303 dnl ========================================================
5304 dnl complex text support off by default
5305 dnl ========================================================
5306 MOZ_ARG_DISABLE_BOOL(pango,
5307 [ --disable-pango Disable usage of Pango ],
5311 dnl ========================================================
5313 dnl ========================================================
5314 if test "$MOZ_ENABLE_GTK2"
5318 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5320 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5321 AC_SUBST(MOZ_PANGO_CFLAGS)
5322 AC_SUBST(MOZ_PANGO_LIBS)
5323 if test "$MOZ_PANGO"
5325 AC_DEFINE(MOZ_PANGO)
5327 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5328 AC_SUBST(FT2_CFLAGS)
5333 if test "$MOZ_ENABLE_QT"
5335 if test "$MOZ_PANGO"
5337 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5339 AC_SUBST(MOZ_PANGO_CFLAGS)
5340 AC_SUBST(MOZ_PANGO_LIBS)
5341 AC_DEFINE(MOZ_PANGO)
5344 echo "Pango library not found, will use FT2 font engine"
5351 dnl ========================================================
5352 dnl = GnomeVFS, GIO and GConf support module
5353 dnl ========================================================
5357 dnl build the gnomevfs extension by default only when the
5358 dnl GTK2 toolkit is in use.
5359 if test "$MOZ_ENABLE_GTK2"
5361 MOZ_ENABLE_GNOMEVFS=1
5365 dnl ========================================================
5366 dnl = GnomeVFS support module
5367 dnl ========================================================
5368 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5369 [ --disable-gnomevfs Disable GnomeVFS support ],
5370 MOZ_ENABLE_GNOMEVFS=,
5371 MOZ_ENABLE_GNOMEVFS=force)
5373 if test "$MOZ_ENABLE_GNOMEVFS"
5375 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5376 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5377 MOZ_ENABLE_GNOMEVFS=1
5378 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5380 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5382 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5384 MOZ_ENABLE_GNOMEVFS=
5387 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5388 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5389 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5394 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5395 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5396 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5398 dnl ========================================================
5399 dnl = GIO support module
5400 dnl ========================================================
5401 MOZ_ARG_ENABLE_BOOL(gio,
5402 [ --enable-gio Enable GIO support (default: disabled)],
5403 MOZ_ENABLE_GIO=force,
5406 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5408 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
5409 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5410 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5411 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5413 AC_DEFINE(MOZ_ENABLE_GIO)
5415 if test "$MOZ_ENABLE_GIO" = "force"
5417 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5423 AC_SUBST(MOZ_ENABLE_GIO)
5424 AC_SUBST(MOZ_GIO_CFLAGS)
5425 AC_SUBST(MOZ_GIO_LIBS)
5427 dnl ========================================================
5428 dnl = GConf support module
5429 dnl ========================================================
5430 MOZ_ARG_DISABLE_BOOL(gconf,
5431 [ --disable-gconf Disable Gconf support ],
5433 MOZ_ENABLE_GCONF=force)
5435 if test "$MOZ_ENABLE_GCONF"
5437 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5438 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5441 if test "$MOZ_ENABLE_GCONF" = "force"
5443 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5449 if test "$MOZ_ENABLE_GCONF"; then
5450 AC_DEFINE(MOZ_ENABLE_GCONF)
5453 AC_SUBST(MOZ_ENABLE_GCONF)
5454 AC_SUBST(MOZ_GCONF_CFLAGS)
5455 AC_SUBST(MOZ_GCONF_LIBS)
5458 dnl ========================================================
5459 dnl = libproxy support
5460 dnl ========================================================
5462 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5464 MOZ_ENABLE_LIBPROXY=
5466 MOZ_ARG_ENABLE_BOOL(libproxy,
5467 [ --enable-libproxy Enable libproxy support ],
5468 MOZ_ENABLE_LIBPROXY=1,
5469 MOZ_ENABLE_LIBPROXY=)
5471 if test "$MOZ_ENABLE_LIBPROXY"
5473 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5474 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5477 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5478 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5479 AC_SUBST(MOZ_LIBPROXY_LIBS)
5481 dnl ========================================================
5482 dnl = libnotify support
5483 dnl ========================================================
5485 if test "$MOZ_ENABLE_GTK2"
5487 MOZ_ENABLE_LIBNOTIFY=1
5489 MOZ_ARG_DISABLE_BOOL(libnotify,
5490 [ --disable-libnotify Disable libnotify support ],
5491 MOZ_ENABLE_LIBNOTIFY=,
5492 MOZ_ENABLE_LIBNOTIFY=1)
5494 if test "$MOZ_ENABLE_LIBNOTIFY"
5496 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5500 if test -z "$SKIP_LIBRARY_CHECKS"
5502 if test "$MOZ_ENABLE_GTK2"
5504 if test "$MOZ_ENABLE_LIBNOTIFY"
5506 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5510 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5511 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5512 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5514 dnl ========================================================
5515 dnl = GNOME component (mozgnome)
5516 dnl ========================================================
5518 # The GNOME component is built if one of
5519 # gnome-vfs, gio, gconf or libnotify is available.
5520 if test "$MOZ_ENABLE_GCONF" -o \
5521 "$MOZ_ENABLE_GNOMEVFS" -o \
5522 "$MOZ_ENABLE_GIO" -o \
5523 "$MOZ_ENABLE_LIBNOTIFY"; then
5524 MOZ_ENABLE_GNOME_COMPONENT=1
5526 MOZ_ENABLE_GNOME_COMPONENT=
5528 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5530 dnl ========================================================
5531 dnl = libgnomeui support module
5532 dnl ========================================================
5534 if test "$MOZ_ENABLE_GTK2"
5536 MOZ_ENABLE_GNOMEUI=1
5538 MOZ_ARG_DISABLE_BOOL(gnomeui,
5539 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5540 MOZ_ENABLE_GNOMEUI=,
5541 MOZ_ENABLE_GNOMEUI=force)
5543 if test "$MOZ_ENABLE_GNOMEUI"
5545 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5547 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5548 MOZ_ENABLE_GNOMEUI=1
5550 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5552 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5558 if test "$MOZ_ENABLE_GNOMEUI"; then
5559 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5563 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5564 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5565 AC_SUBST(MOZ_GNOMEUI_LIBS)
5567 dnl ========================================================
5569 dnl ========================================================
5571 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5575 MOZ_ARG_DISABLE_BOOL(dbus,
5576 [ --disable-dbus Disable dbus support ],
5580 if test "$MOZ_ENABLE_DBUS"
5582 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5583 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5584 AC_DEFINE(MOZ_ENABLE_DBUS)
5587 AC_SUBST(MOZ_ENABLE_DBUS)
5588 AC_SUBST(MOZ_DBUS_CFLAGS)
5589 AC_SUBST(MOZ_DBUS_LIBS)
5590 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5591 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5593 dnl ========================================================
5594 dnl = Enable Android History instead of Places
5595 dnl ========================================================
5596 if test -n "$MOZ_ANDROID_HISTORY"; then
5597 dnl Do this if defined in confvars.sh
5598 AC_DEFINE(MOZ_ANDROID_HISTORY)
5602 dnl ========================================================
5603 dnl = Build with the Android Java compositor
5604 dnl ========================================================
5605 if test -n "$MOZ_JAVA_COMPOSITOR"; then
5606 dnl Do this if defined in confvars.sh
5607 AC_DEFINE(MOZ_JAVA_COMPOSITOR)
5610 dnl ========================================================
5611 dnl = Disable WebSMS backend
5612 dnl ========================================================
5613 MOZ_ARG_DISABLE_BOOL(websms-backend,
5614 [ --disable-websms-backend
5615 Disable WebSMS backend],
5616 MOZ_WEBSMS_BACKEND=,
5617 MOZ_WEBSMS_BACKEND=1)
5619 if test -n "$MOZ_WEBSMS_BACKEND"; then
5620 AC_DEFINE(MOZ_WEBSMS_BACKEND)
5623 dnl ========================================================
5624 dnl = Build Personal Security Manager
5625 dnl ========================================================
5626 MOZ_ARG_DISABLE_BOOL(crypto,
5627 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5631 dnl ========================================================
5632 dnl = JS Debugger XPCOM component (js/jsd)
5633 dnl ========================================================
5634 MOZ_ARG_DISABLE_BOOL(jsd,
5635 [ --disable-jsd Disable JavaScript debug library],
5640 dnl ========================================================
5641 dnl = Enable IPDL's "expensive" unit tests
5642 dnl ========================================================
5645 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5646 [ --enable-ipdl-tests Enable expensive IPDL tests],
5650 if test -n "$MOZ_IPDL_TESTS"; then
5651 AC_DEFINE(MOZ_IPDL_TESTS)
5654 AC_SUBST(MOZ_IPDL_TESTS)
5656 dnl ========================================================
5657 dnl = Turns off code necessary for e10s compatibility
5658 dnl ========================================================
5659 dnl This is a temporary flag to be removed in bug 662601 when
5660 dnl it's no longer needed
5664 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5665 [ --enable-e10s-compat Turns off code for e10s compat],
5669 if test -n "$MOZ_E10S_COMPAT"; then
5670 AC_DEFINE(MOZ_E10S_COMPAT)
5673 dnl ========================================================
5674 dnl = Disable building dbm
5675 dnl ========================================================
5676 MOZ_ARG_DISABLE_BOOL(dbm,
5677 [ --disable-dbm Disable building dbm],
5681 dnl bi-directional support always on
5685 dnl ========================================================
5686 dnl accessibility support on by default on all platforms
5688 dnl ========================================================
5689 MOZ_ARG_DISABLE_BOOL(accessibility,
5690 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5693 if test "$ACCESSIBILITY"; then
5694 AC_DEFINE(ACCESSIBILITY)
5697 dnl ========================================================
5698 dnl Disable printing
5699 dnl ========================================================
5700 MOZ_ARG_DISABLE_BOOL(printing,
5701 [ --disable-printing Disable printing support],
5705 if test "$NS_PRINTING"; then
5706 AC_DEFINE(NS_PRINTING)
5707 AC_DEFINE(NS_PRINT_PREVIEW)
5710 dnl ========================================================
5711 dnl = Enable Raw Codecs
5712 dnl ========================================================
5713 MOZ_ARG_ENABLE_BOOL(raw,
5714 [ --enable-raw Enable support for RAW media],
5718 if test -n "$MOZ_RAW"; then
5725 dnl ========================================================
5726 dnl = Disable Ogg Codecs
5727 dnl ========================================================
5728 MOZ_ARG_DISABLE_BOOL(ogg,
5729 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5733 if test -n "$MOZ_OGG"; then
5738 case "$target_cpu" in
5747 dnl Checks for __attribute__(aligned()) directive
5748 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5749 [ac_cv_c_attribute_aligned],
5750 [ac_cv_c_attribute_aligned=0
5751 CFLAGS_save="${CFLAGS}"
5752 CFLAGS="${CFLAGS} -Werror"
5753 for ac_cv_c_attr_align_try in 64 32 16 8; do
5754 echo "trying $ac_cv_c_attr_align_try"
5756 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5757 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5758 if test "$ac_cv_c_attribute_aligned" != 0; then
5762 CFLAGS="${CFLAGS_save}"])
5763 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5764 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5765 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5769 dnl ========================================================
5770 dnl = Disable VP8 decoder support
5771 dnl ========================================================
5772 MOZ_ARG_DISABLE_BOOL(webm,
5773 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5777 dnl system libvpx Support
5778 dnl ========================================================
5779 MOZ_ARG_WITH_STRING(system-libvpx,
5780 [ --with-system-libvpx=[PFX]
5781 Use system libvpx [installed at prefix PFX]],
5782 LIBVPX_DIR=$withval)
5785 MOZ_LIBVPX_INCLUDES=
5788 if test -n "$MOZ_WEBM"; then
5790 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5791 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5793 if test -n "$MOZ_VP8_ENCODER" ; then
5794 AC_DEFINE(MOZ_VP8_ENCODER)
5797 if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
5798 _SAVE_CFLAGS=$CFLAGS
5799 _SAVE_LDFLAGS=$LDFLAGS
5801 if test "${LIBVPX_DIR}" = "yes"; then
5804 CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
5805 LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
5806 MOZ_NATIVE_LIBVPX_DEC_TEST=
5807 MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
5808 [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
5809 AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
5811 AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
5812 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
5813 [MOZ_NATIVE_LIBVPX_DEC_TEST=1],
5814 ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
5815 if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then
5816 AC_MSG_CHECKING([for libvpx version >= v1.0.0])
5817 dnl We need at least v1.0.0 to fix several crash bugs (for which we
5818 dnl had local patches prior to v1.0.0).
5820 dnl This is a terrible test for the library version, but we don't
5821 dnl have a good one. There is no version number in a public header,
5822 dnl and testing the headers still doesn't guarantee we link against
5823 dnl the right version. While we could call vpx_codec_version() at
5824 dnl run-time, that would break cross-compiling. There are no
5825 dnl additional exported decoder symbols between the v1.0.0 release
5826 dnl and the v0.9.7 one to check for.
5828 #include <vpx/vpx_decoder.h>
5829 #if !defined(VPX_CODEC_USE_INPUT_FRAGMENTS)
5830 #error "test failed."
5834 [AC_MSG_RESULT([yes])
5836 AC_DEFINE(MOZ_NATIVE_LIBVPX)
5837 MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
5838 MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
5839 [AC_MSG_RESULT([no])
5840 AC_MSG_ERROR([--with-system-libvpx requested but it is not v1.0.0 or later])])
5842 CFLAGS=$_SAVE_CFLAGS
5843 LDFLAGS=$_SAVE_LDFLAGS
5848 AC_SUBST(MOZ_NATIVE_LIBVPX)
5849 AC_SUBST(MOZ_LIBVPX_INCLUDES)
5850 AC_SUBST(MOZ_LIBVPX_LIBS)
5852 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
5856 case "$target_cpu" in
5866 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5867 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5868 dnl We currently require gcc on all arm platforms.
5871 VPX_NEED_OBJ_INT_EXTRACT=
5873 dnl See if we have assembly on this platform.
5874 case "$OS_ARCH:$CPU_ARCH" in
5876 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5880 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5884 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5888 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5892 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5896 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5900 if test -z "$GNU_CC"; then
5901 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5906 if test -z "$GNU_CC"; then
5907 dnl Check for yasm 1.1 or greater.
5908 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5909 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.])
5910 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5911 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.])
5913 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5915 dnl The encoder needs obj_int_extract to get asm offsets.
5920 if test -n "$GNU_AS" ; then
5922 dnl These flags are a lie; they're just used to enable the requisite
5923 dnl opcodes; actual arch detection is done at runtime.
5924 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5925 VPX_DASH_C_FLAG="-c"
5926 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5927 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5932 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5933 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.])
5936 if test -n "$MOZ_VP8_ENCODER" -a \
5937 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5938 dnl We prefer to get asm offsets using inline assembler, which the above
5939 dnl compilers can do. When we're not using one of those, we have to fall
5940 dnl back to obj_int_extract, which reads them from a compiled object
5941 dnl file. Unfortunately, that only works if we're compiling on a system
5942 dnl with the header files for the appropriate object file format.
5943 VPX_NEED_OBJ_INT_EXTRACT=1
5946 if test -n "$VPX_X86_ASM"; then
5947 AC_DEFINE(VPX_X86_ASM)
5948 elif test -n "$VPX_ARM_ASM"; then
5949 AC_DEFINE(VPX_ARM_ASM)
5951 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5955 dnl ========================================================
5956 dnl = Disable Wave decoder support
5957 dnl ========================================================
5958 MOZ_ARG_DISABLE_BOOL(wave,
5959 [ --disable-wave Disable Wave decoder support],
5963 if test -n "$MOZ_WAVE"; then
5970 dnl ========================================================
5971 dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
5972 dnl ========================================================
5974 if test -n "$MOZ_SYDNEYAUDIO"; then
5975 AC_DEFINE(MOZ_SYDNEYAUDIO)
5978 if test -n "$MOZ_CUBEB"; then
5981 AC_DEFINE(MOZ_CUBEB)
5984 dnl Other targets will be enabled soon.
5989 if test -n "$MOZ_MEDIA"; then
5990 AC_DEFINE(MOZ_MEDIA)
5993 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5994 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/])
5997 if test -n "$MOZ_VORBIS"; then
5998 AC_DEFINE(MOZ_VORBIS)
6001 if test -n "$MOZ_TREMOR"; then
6002 AC_DEFINE(MOZ_TREMOR)
6005 dnl ========================================================
6006 dnl = Check alsa availability on Linux if using sydneyaudio
6007 dnl ========================================================
6009 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6010 if test -n "$MOZ_SYDNEYAUDIO"; then
6011 case "$target_os" in
6013 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6014 [echo "$MOZ_ALSA_PKG_ERRORS"
6015 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.)])])
6020 dnl ========================================================
6021 dnl Permissions System
6022 dnl ========================================================
6023 MOZ_ARG_DISABLE_BOOL(permissions,
6024 [ --disable-permissions Disable permissions (popup and cookie blocking)],
6029 dnl ========================================================
6031 dnl ========================================================
6032 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6033 [ --disable-negotiateauth Disable GSS-API negotiation ],
6034 MOZ_AUTH_EXTENSION=,
6035 MOZ_AUTH_EXTENSION=1 )
6037 dnl ========================================================
6039 dnl ========================================================
6040 MOZ_ARG_DISABLE_BOOL(xtf,
6041 [ --disable-xtf Disable XTF (pluggable xml tags) support],
6044 if test "$MOZ_XTF"; then
6048 dnl ========================================================
6049 dnl Pref extensions (autoconfig)
6050 dnl ========================================================
6051 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6052 [ --disable-pref-extensions
6053 Disable pref extensions such as autoconfig],
6054 MOZ_PREF_EXTENSIONS=,
6055 MOZ_PREF_EXTENSIONS=1 )
6057 dnl ========================================================
6058 dnl Searching of system directories for extensions.
6059 dnl Note: this switch is meant to be used for test builds
6060 dnl whose behavior should not depend on what happens to be
6061 dnl installed on the local machine.
6062 dnl ========================================================
6063 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
6064 [ --disable-system-extension-dirs
6065 Disable searching system- and account-global
6066 directories for extensions of any kind; use
6067 only profile-specific extension directories],
6068 ENABLE_SYSTEM_EXTENSION_DIRS=,
6069 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
6070 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
6071 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
6074 dnl ========================================================
6075 dnl = Universalchardet
6076 dnl ========================================================
6077 MOZ_ARG_DISABLE_BOOL(universalchardet,
6078 [ --disable-universalchardet
6079 Disable universal encoding detection],
6080 MOZ_UNIVERSALCHARDET=,
6081 MOZ_UNIVERSALCHARDET=1 )
6083 if test -n "${JAVA_BIN_PATH}"; then
6084 dnl Look for javac and jar in the specified path.
6085 JAVA_PATH="$JAVA_BIN_PATH"
6087 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6088 JAVA_PATH="$JAVA_HOME/bin:$PATH"
6091 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6092 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6093 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6095 if test -n "${JAVA_BIN_PATH}" -o \
6096 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
6097 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6098 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}])
6102 dnl ========================================================
6103 dnl = ANGLE OpenGL->D3D translator for WebGL
6104 dnl = * only applies to win32
6105 dnl = * enabled by default (shipping build); requires explicit --disable to disable
6106 dnl ========================================================
6108 MOZ_DIRECTX_SDK_PATH=
6109 MOZ_DIRECTX_SDK_CPU_SUFFIX=
6112 MOZ_D3DCOMPILER_CAB=
6114 MOZ_D3DCOMPILER_DLL=
6115 case "$target_os" in
6121 # The DirectX SDK libraries are split into x86 and x64 sub-directories
6122 case "${target_cpu}" in
6124 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
6127 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
6131 if test -n "$MOZ_ANGLE"; then
6132 MOZ_ARG_DISABLE_BOOL(angle,
6133 [ --disable-angle Disable building of ANGLE for WebGL->D3D translation],
6137 if test -n "$MOZ_ANGLE"; then
6138 if test -z "$_WIN32_MSVC"; then
6139 AC_MSG_ERROR([Building ANGLE requires MSVC. To build without ANGLE, reconfigure with --disable-angle.])
6142 # Get the SDK path from the registry.
6143 # First try to get the June 2010 SDK
6144 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
6145 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
6146 # Otherwise just take whatever comes first
6147 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
6150 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
6151 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.])
6153 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
6158 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6159 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
6160 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
6165 if test -z "$MOZ_ANGLE" ; then
6166 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.])
6169 if test -n "$MOZ_ANGLE" ; then
6170 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
6171 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'`
6173 if test -z "$MOZ_D3DX9_VERSION" ; then
6174 AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for ANGLE. To explicitly build without ANGLE, reconfigure with --disable-angle.])
6177 if test -n "$MOZ_ANGLE" ; then
6178 MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6179 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6181 MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
6182 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6188 dnl ========================================================
6189 dnl = Breakpad crash reporting (on by default on supported platforms)
6190 dnl ========================================================
6193 i?86-*-mingw*|x86_64-*-mingw*)
6196 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6199 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6200 if test "$MOZ_ENABLE_GTK2"; then
6204 *-android*|*-linuxandroid*)
6212 MOZ_ARG_DISABLE_BOOL(crashreporter,
6213 [ --disable-crashreporter Disable breakpad crash reporting],
6215 MOZ_CRASHREPORTER=1)
6217 if test -n "$MOZ_CRASHREPORTER"; then
6218 AC_DEFINE(MOZ_CRASHREPORTER)
6220 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6221 test -z "$SKIP_LIBRARY_CHECKS"; then
6222 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6223 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6224 AC_SUBST(MOZ_GTHREAD_LIBS)
6226 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.])])
6229 if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
6230 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
6234 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6235 [ --with-crashreporter-enable-percent=NN
6236 Enable sending crash reports by default on NN% of users. (default=100)],
6237 [ val=`echo $withval | sed 's/[^0-9]//g'`
6238 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6240 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6241 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6243 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6245 dnl ========================================================
6246 dnl = libjpeg-turbo configuration
6247 dnl ========================================================
6249 if test -z "$SYSTEM_JPEG"; then
6253 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6254 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6256 MOZ_LIBJPEG_TURBO=1)
6258 if test "$SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6259 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6262 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6265 if test -n "$MOZ_LIBJPEG_TURBO"; then
6267 dnl Do we support libjpeg-turbo on this platform?
6268 case "$OS_ARCH:$OS_TEST" in
6269 Linux:x86|Linux:i?86)
6270 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6271 LIBJPEG_TURBO_X86_ASM=1
6274 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6275 LIBJPEG_TURBO_X64_ASM=1
6278 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6279 LIBJPEG_TURBO_X86_ASM=1
6282 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6283 LIBJPEG_TURBO_X64_ASM=1
6286 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6287 LIBJPEG_TURBO_X86_ASM=1
6290 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6291 LIBJPEG_TURBO_X64_ASM=1
6293 WINNT:x86|WINNT:i?86)
6294 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6295 LIBJPEG_TURBO_X86_ASM=1
6298 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6299 LIBJPEG_TURBO_X64_ASM=1
6302 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
6303 LIBJPEG_TURBO_ARM_ASM=1
6309 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
6310 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
6311 dnl it doesn't exist or we have too old of a version.
6312 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6313 AC_MSG_CHECKING([for Yasm assembler])
6314 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6316 if test -z "$LIBJPEG_TURBO_AS" ; then
6317 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.])
6320 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6321 dnl on Linux and 1.1 or newer everywhere else.
6322 if test "$OS_ARCH" = "Linux" ; then
6323 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
6324 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.])
6327 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6328 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.])
6333 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
6334 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
6335 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
6336 echo "Using $AS as the assembler for ARM code."
6337 LIBJPEG_TURBO_AS=$AS
6340 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6341 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6342 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6343 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6344 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
6345 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
6346 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6347 dnl Warn if we're not building the optimized routines, even though the user
6348 dnl didn't specify --disable-libjpeg-turbo.
6349 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6352 dnl ========================================================
6353 dnl = Enable compilation of specific extension modules
6354 dnl ========================================================
6356 MOZ_ARG_ENABLE_STRING(extensions,
6357 [ --enable-extensions Enable extensions],
6358 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6359 if test "$option" = "yes" -o "$option" = "all"; then
6360 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6361 elif test "$option" = "no" -o "$option" = "none"; then
6363 elif test "$option" = "default"; then
6364 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6365 elif test `echo "$option" | grep -c \^-` != 0; then
6366 option=`echo $option | sed 's/^-//'`
6367 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6369 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6372 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6374 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6375 # Suppress warning on non-X11 platforms
6376 if test -n "$MOZ_X11"; then
6377 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6379 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6382 dnl Do not build gnomevfs with libxul based apps
6383 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6384 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6387 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6388 # Suppress warning on non-X11 platforms
6389 if test -n "$MOZ_X11"; then
6390 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6392 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6395 dnl Do not build gio with libxul based apps
6396 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6397 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6400 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6401 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6402 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6405 dnl xforms requires xtf
6406 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6407 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6408 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6412 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6414 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6415 dnl when trying to build a nonexistent extension.
6416 for extension in $MOZ_EXTENSIONS; do
6417 if test ! -d "${srcdir}/extensions/${extension}"; then
6418 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6422 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6423 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6426 dnl ========================================================
6427 dnl SVG Display Lists
6428 dnl ========================================================
6429 if test -n "$MOZ_SVG_DLISTS"; then
6430 AC_DEFINE(MOZ_SVG_DLISTS)
6433 dnl ========================================================
6434 dnl Build Freetype in the tree
6435 dnl ========================================================
6436 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6437 [ --enable-tree-freetype Enable Tree FreeType],
6438 MOZ_TREE_FREETYPE=1,
6439 MOZ_TREE_FREETYPE= )
6440 if test -n "$MOZ_TREE_FREETYPE"; then
6441 if test -n "$_WIN32_MSVC"; then
6442 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6444 AC_DEFINE(MOZ_TREE_FREETYPE)
6445 AC_SUBST(MOZ_TREE_FREETYPE)
6446 MOZ_ENABLE_CAIRO_FT=1
6447 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6448 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6449 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6450 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6451 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6452 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6453 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6454 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6455 AC_SUBST(CAIRO_FT_CFLAGS)
6458 dnl ========================================================
6460 dnl ========================================================
6461 MOZ_ARG_DISABLE_BOOL(installer,
6462 [ --disable-installer Disable building of installer],
6465 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6466 # Disable installer for Windows builds that use the new toolkit if the
6467 # required major version and minimum minor version of Unicode NSIS isn't in
6469 REQ_NSIS_MAJOR_VER=2
6470 MIN_NSIS_MINOR_VER=33
6471 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6472 if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6473 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. To build without the installer reconfigure using --disable-installer.])
6476 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6478 if test ! "$MAKENSISU_VER" = ""; then
6479 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6480 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6482 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6483 if test "$MAKENSISU_VER" = "" ||
6484 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6485 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6487 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. To build without the installer reconfigure using --disable-installer.])
6489 AC_MSG_RESULT([yes])
6492 AC_SUBST(MOZ_INSTALLER)
6494 AC_MSG_CHECKING([for tar archiver])
6495 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6496 if test -z "$TAR"; then
6497 AC_MSG_ERROR([no tar archiver found in \$PATH])
6499 AC_MSG_RESULT([$TAR])
6502 AC_MSG_CHECKING([for wget])
6503 AC_CHECK_PROGS(WGET, wget, "")
6504 AC_MSG_RESULT([$WGET])
6507 dnl ========================================================
6508 dnl Maintenance Service
6509 dnl ========================================================
6511 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6512 [ --enable-maintenance-service Enable building of maintenanceservice],
6513 MOZ_MAINTENANCE_SERVICE=1,
6514 MOZ_MAINTENANCE_SERVICE= )
6516 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6517 if test "$OS_ARCH" = "WINNT"; then
6518 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6520 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6524 dnl ========================================================
6525 dnl Verify MAR signatures
6526 dnl ========================================================
6528 MOZ_ARG_ENABLE_BOOL(verify-mar,
6529 [ --enable-verify-mar Enable verifying MAR signatures],
6530 MOZ_VERIFY_MAR_SIGNATURE=1,
6531 MOZ_VERIFY_MAR_SIGNATURE= )
6533 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6534 if test "$OS_ARCH" = "WINNT"; then
6535 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6537 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6541 dnl ========================================================
6542 dnl Enable building the signmar program.
6543 dnl This option is much different than the --enable-verify-mar option.
6544 dnl --enable-verify-mar is for enabling the verification check on MAR
6545 dnl files in the updater. The --enable-signmar option is for building
6546 dnl the signmar program.
6547 dnl ========================================================
6549 MOZ_ARG_ENABLE_BOOL(sign-mar,
6550 [ --enable-signmar Enable building the signmar program],
6551 MOZ_ENABLE_SIGNMAR=1,
6552 MOZ_ENABLE_SIGNMAR= )
6554 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6555 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6558 dnl ========================================================
6560 dnl ========================================================
6562 MOZ_ARG_DISABLE_BOOL(updater,
6563 [ --disable-updater Disable building of updater],
6567 if test -n "$MOZ_UPDATER"; then
6568 AC_DEFINE(MOZ_UPDATER)
6571 # app update channel is 'default' when not supplied.
6572 MOZ_ARG_ENABLE_STRING([update-channel],
6573 [ --enable-update-channel=CHANNEL
6574 Select application update channel (default=default)],
6575 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6577 if test -z "$MOZ_UPDATE_CHANNEL"; then
6578 MOZ_UPDATE_CHANNEL=default
6580 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6581 AC_SUBST(MOZ_UPDATE_CHANNEL)
6583 # tools/update-packaging is not checked out by default.
6584 MOZ_ARG_ENABLE_BOOL(update-packaging,
6585 [ --enable-update-packaging
6586 Enable tools/update-packaging],
6587 MOZ_UPDATE_PACKAGING=1,
6588 MOZ_UPDATE_PACKAGING= )
6589 AC_SUBST(MOZ_UPDATE_PACKAGING)
6591 dnl ========================================================
6593 dnl ========================================================
6594 MOZ_ARG_ENABLE_BOOL(leaky,
6595 [ --enable-leaky Build leaky memory tool],
6600 dnl ========================================================
6601 dnl build the tests by default
6602 dnl ========================================================
6603 MOZ_ARG_DISABLE_BOOL(tests,
6604 [ --disable-tests Do not build test libraries & programs],
6608 dnl ========================================================
6609 dnl parental controls (for Windows Vista)
6610 dnl ========================================================
6611 MOZ_ARG_DISABLE_BOOL(parental-controls,
6612 [ --disable-parental-controls
6613 Do not build parental controls],
6614 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6615 MOZ_DISABLE_PARENTAL_CONTROLS=)
6616 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6617 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6620 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6622 dnl ========================================================
6623 dnl = Disable DOMCrypto
6624 dnl ========================================================
6625 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6626 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6629 dnl ========================================================
6631 dnl = Module specific options
6633 dnl ========================================================
6634 MOZ_ARG_HEADER(Individual module options)
6636 dnl ========================================================
6637 dnl = Disable feed handling components
6638 dnl ========================================================
6639 MOZ_ARG_DISABLE_BOOL(feeds,
6640 [ --disable-feeds Disable feed handling and processing components],
6643 if test -n "$MOZ_FEEDS"; then
6644 AC_DEFINE(MOZ_FEEDS)
6646 if test "$MOZ_BUILD_APP" = "browser"; then
6647 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6651 dnl ========================================================
6652 dnl Check for sqlite
6653 dnl ========================================================
6656 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6657 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6658 MOZ_NATIVE_SQLITE=1,
6659 MOZ_NATIVE_SQLITE= )
6661 if test -z "$MOZ_NATIVE_SQLITE"
6664 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6666 dnl ============================
6667 dnl === SQLite Version check ===
6668 dnl ============================
6669 dnl Check to see if the system SQLite package is new enough.
6670 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6672 dnl ==================================
6673 dnl === SQLITE_SECURE_DELETE check ===
6674 dnl ==================================
6675 dnl Check to see if the system SQLite package is compiled with
6676 dnl SQLITE_SECURE_DELETE enabled.
6677 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6678 _SAVE_CFLAGS="$CFLAGS"
6679 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6681 LIBS="$LIBS $SQLITE_LIBS"
6682 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6684 #include "sqlite3.h"
6686 int main(int argc, char **argv){
6687 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6689 ac_cv_sqlite_secure_delete=yes,
6690 ac_cv_sqlite_secure_delete=no,
6691 ac_cv_sqlite_secure_delete=no
6694 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6695 CFLAGS="$_SAVE_CFLAGS"
6697 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6698 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6701 dnl ===============================
6702 dnl === SQLITE_THREADSAFE check ===
6703 dnl ===============================
6704 dnl Check to see if the system SQLite package is compiled with
6705 dnl SQLITE_THREADSAFE enabled.
6706 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6707 _SAVE_CFLAGS="$CFLAGS"
6708 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6710 LIBS="$LIBS $SQLITE_LIBS"
6711 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6713 #include "sqlite3.h"
6715 int main(int argc, char **argv){
6716 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6718 ac_cv_sqlite_threadsafe=yes,
6719 ac_cv_sqlite_threadsafe=no,
6720 ac_cv_sqlite_threadsafe=no
6723 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6724 CFLAGS="$_SAVE_CFLAGS"
6726 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6727 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6730 dnl ================================
6731 dnl === SQLITE_ENABLE_FTS3 check ===
6732 dnl ================================
6733 dnl check to see if the system SQLite package is compiled with
6734 dnl SQLITE_ENABLE_FTS3 enabled.
6735 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6736 _SAVE_CFLAGS="$CFLAGS"
6737 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6739 LIBS="$LIBS $SQLITE_LIBS"
6740 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6742 #include "sqlite3.h"
6744 int main(int argc, char **argv){
6745 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6747 ac_cv_sqlite_enable_fts3=yes,
6748 ac_cv_sqlite_enable_fts3=no,
6749 ac_cv_sqlite_enable_fts3=no
6752 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6753 CFLAGS="$_SAVE_CFLAGS"
6755 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6756 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6759 dnl =========================================
6760 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6761 dnl =========================================
6762 dnl check to see if the system SQLite package is compiled with
6763 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6764 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6765 _SAVE_CFLAGS="$CFLAGS"
6766 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6768 LIBS="$LIBS $SQLITE_LIBS"
6769 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6771 #include "sqlite3.h"
6773 int main(int argc, char **argv){
6774 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6776 ac_cv_sqlite_enable_unlock_notify=yes,
6777 ac_cv_sqlite_enable_unlock_notify=no,
6778 ac_cv_sqlite_enable_unlock_notify=no
6781 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6782 CFLAGS="$_SAVE_CFLAGS"
6784 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6785 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6789 if test -n "$MOZ_NATIVE_SQLITE"; then
6790 AC_DEFINE(MOZ_NATIVE_SQLITE)
6792 AC_SUBST(MOZ_NATIVE_SQLITE)
6794 dnl ========================================================
6795 dnl = Enable help viewer (off by default)
6796 dnl ========================================================
6797 if test -n "$MOZ_HELP_VIEWER"; then
6798 dnl Do this if defined in confvars.sh
6799 AC_DEFINE(MOZ_HELP_VIEWER)
6802 dnl ========================================================
6803 dnl = Enable safe browsing (anti-phishing)
6804 dnl ========================================================
6805 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6806 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6807 MOZ_SAFE_BROWSING=1,
6808 MOZ_SAFE_BROWSING= )
6809 if test -n "$MOZ_SAFE_BROWSING"; then
6810 AC_DEFINE(MOZ_SAFE_BROWSING)
6812 AC_SUBST(MOZ_SAFE_BROWSING)
6814 dnl ========================================================
6815 dnl = Enable url-classifier
6816 dnl ========================================================
6817 dnl Implicitly enabled by default if building with safe-browsing
6818 if test -n "$MOZ_SAFE_BROWSING"; then
6819 MOZ_URL_CLASSIFIER=1
6821 MOZ_ARG_ENABLE_BOOL(url-classifier,
6822 [ --enable-url-classifier Enable url classifier module],
6823 MOZ_URL_CLASSIFIER=1,
6824 MOZ_URL_CLASSIFIER= )
6825 if test -n "$MOZ_URL_CLASSIFIER"; then
6826 AC_DEFINE(MOZ_URL_CLASSIFIER)
6828 AC_SUBST(MOZ_URL_CLASSIFIER)
6830 dnl ========================================================
6831 dnl = Disable zipwriter
6832 dnl ========================================================
6833 MOZ_ARG_DISABLE_BOOL(zipwriter,
6834 [ --disable-zipwriter Disable zipwriter component],
6837 AC_SUBST(MOZ_ZIPWRITER)
6839 dnl ========================================================
6841 dnl ========================================================
6842 dnl superseded by QtNetwork starting from 4.7
6843 MOZ_ENABLE_LIBCONIC=1
6845 if test -n "$MOZ_ENABLE_QT"; then
6846 if test "$MOZ_ENABLE_QTNETWORK"; then
6847 MOZ_ENABLE_LIBCONIC=
6851 MOZ_ARG_DISABLE_BOOL(libconic,
6852 [ --disable-libconic Disable libconic],
6853 MOZ_ENABLE_LIBCONIC=,
6854 MOZ_ENABLE_LIBCONIC=1 )
6856 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6857 PKG_CHECK_MODULES(LIBCONIC, conic,
6858 MOZ_ENABLE_LIBCONIC=1,
6859 MOZ_ENABLE_LIBCONIC=)
6861 if test "$MOZ_ENABLE_LIBCONIC"; then
6862 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6865 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6866 AC_SUBST(LIBCONIC_CFLAGS)
6867 AC_SUBST(LIBCONIC_LIBS)
6869 dnl ========================================================
6871 dnl ========================================================
6873 MAEMO_SDK_TARGET_VER=-1
6875 MOZ_ARG_WITH_STRING(maemo-version,
6876 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6878 MAEMO_SDK_TARGET_VER=$withval)
6880 case "$MAEMO_SDK_TARGET_VER" in
6882 MOZ_PLATFORM_MAEMO=5
6886 MOZ_PLATFORM_MAEMO=6
6890 dnl We aren't compiling for Maemo, move on.
6893 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6897 if test $MOZ_PLATFORM_MAEMO; then
6898 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6900 if test -z "$MOZ_ENABLE_DBUS"; then
6901 AC_MSG_ERROR([DBus is required when building for Maemo])
6904 MOZ_GFX_OPTIMIZE_MOBILE=1
6906 MOZ_MAEMO_LIBLOCATION=
6908 if test $MOZ_PLATFORM_MAEMO = 5; then
6909 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6910 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6911 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6912 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6913 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6915 AC_SUBST(XCOMPOSITE_LIBS)
6917 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6918 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6919 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6920 if test -z "$_LIB_FOUND"; then
6921 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6925 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6926 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6927 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6928 if test -z "$_LIB_FOUND"; then
6929 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6932 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6933 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6934 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6935 if test -z "$_LIB_FOUND"; then
6936 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6940 if test $MOZ_PLATFORM_MAEMO = 6; then
6942 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6945 if test "$_LIB_FOUND"; then
6946 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6947 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6948 MOZ_ENABLE_CONTENTMANAGER=1
6949 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6951 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6953 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6955 dnl ========================================================
6956 dnl = Enable meego libcontentaction
6957 dnl ========================================================
6958 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6959 [ --enable-meegocontentaction Enable meegocontentaction support],
6960 MOZ_MEEGOCONTENTACTION=1,
6961 MOZ_MEEGOCONTENTACTION=)
6963 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6965 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6966 if test "$_LIB_FOUND"; then
6967 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6968 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6969 MOZ_ENABLE_CONTENTACTION=1
6970 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6971 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6975 MOZ_ARG_ENABLE_BOOL(meegotouch,
6976 [ --enable-meegotouch Enable meegotouch support],
6977 MOZ_MEEGOTOUCHENABLED=1,
6978 MOZ_MEEGOTOUCHENABLED=)
6980 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6981 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6982 if test "$_LIB_FOUND"; then
6983 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6984 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6985 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6987 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6992 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6993 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6994 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6995 if test "$_LIB_FOUND"; then
6996 MOZ_MAEMO_LIBLOCATION=1
6997 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6999 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7001 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7003 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7004 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7005 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7006 if test "$_LIB_FOUND"; then
7007 MOZ_ENABLE_MEEGOTOUCHSHARE=1
7008 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7010 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7012 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7014 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7015 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7018 dnl ========================================================
7019 dnl = XRender Composite
7020 dnl ========================================================
7021 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
7022 [ --enable-egl-xrender-composite
7023 Enable EGL xrender composite optimizations],
7024 MOZ_EGL_XRENDER_COMPOSITE=1)
7026 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
7027 AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
7030 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
7032 dnl ========================================================
7033 dnl = faststripe theme
7034 dnl ========================================================
7035 MOZ_ARG_ENABLE_BOOL(faststripe,
7036 [ --enable-faststripe Use faststripe theme],
7037 MOZ_THEME_FASTSTRIPE=1,
7038 MOZ_THEME_FASTSTRIPE= )
7039 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7041 dnl ========================================================
7043 dnl = Feature options that require extra sources to be pulled
7045 dnl ========================================================
7046 dnl MOZ_ARG_HEADER(Features that require extra sources)
7048 dnl ========================================================
7050 dnl = Debugging Options
7052 dnl ========================================================
7053 MOZ_ARG_HEADER(Debugging and Optimizations)
7055 dnl ========================================================
7056 dnl = Disable building with debug info.
7057 dnl = Debugging is OFF by default
7058 dnl ========================================================
7059 if test -z "$MOZ_DEBUG_FLAGS"; then
7060 MOZ_DEBUG_FLAGS="-g"
7063 MOZ_ARG_ENABLE_STRING(debug,
7064 [ --enable-debug[=DBG] Enable building with developer debug info
7065 (using compiler flags DBG)],
7066 [ if test "$enableval" != "no"; then
7068 if test -n "$enableval" -a "$enableval" != "yes"; then
7069 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7070 _MOZ_DEBUG_FLAGS_SET=1
7077 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7078 MOZ_ARG_WITH_STRING(debug-label,
7079 [ --with-debug-label=LABELS
7080 Define DEBUG_<value> for each comma-separated
7082 [ for option in `echo $withval | sed 's/,/ /g'`; do
7083 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7086 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7088 if test -n "$MOZ_DEBUG"; then
7089 AC_MSG_CHECKING([for valid debug flags])
7090 _SAVE_CFLAGS=$CFLAGS
7091 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7092 AC_TRY_COMPILE([#include <stdio.h>],
7093 [printf("Hello World\n");],
7096 AC_MSG_RESULT([$_results])
7097 if test "$_results" = "no"; then
7098 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7100 CFLAGS=$_SAVE_CFLAGS
7103 dnl ========================================================
7104 dnl enable mobile optimizations
7105 dnl ========================================================
7106 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7107 [ --enable-mobile-optimize
7108 Enable mobile optimizations],
7109 MOZ_GFX_OPTIMIZE_MOBILE=1)
7111 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7113 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7114 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7117 dnl ========================================================
7118 dnl = Enable code optimization. ON by default.
7119 dnl ========================================================
7120 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7121 MOZ_OPTIMIZE_FLAGS="-O"
7124 MOZ_ARG_ENABLE_STRING(optimize,
7125 [ --disable-optimize Disable compiler optimization
7126 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7127 [ if test "$enableval" != "no"; then
7129 if test -n "$enableval" -a "$enableval" != "yes"; then
7130 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7135 fi ], MOZ_OPTIMIZE=1)
7137 MOZ_SET_FRAMEPTR_FLAGS
7139 if test "$COMPILE_ENVIRONMENT"; then
7140 if test -n "$MOZ_OPTIMIZE"; then
7141 AC_MSG_CHECKING([for valid optimization flags])
7142 _SAVE_CFLAGS=$CFLAGS
7143 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7144 AC_TRY_COMPILE([#include <stdio.h>],
7145 [printf("Hello World\n");],
7148 AC_MSG_RESULT([$_results])
7149 if test "$_results" = "no"; then
7150 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7152 CFLAGS=$_SAVE_CFLAGS
7154 fi # COMPILE_ENVIRONMENT
7156 AC_SUBST(MOZ_OPTIMIZE)
7157 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
7158 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7159 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7160 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7161 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7163 dnl ========================================================
7164 dnl = Enable generation of debug symbols
7165 dnl ========================================================
7166 MOZ_ARG_ENABLE_STRING(debug-symbols,
7167 [ --enable-debug-symbols[=DBG]
7168 Enable debugging symbols (using compiler flags DBG)],
7169 [ if test "$enableval" != "no"; then
7171 if test -n "$enableval" -a "$enableval" != "yes"; then
7172 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7173 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7175 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7181 MOZ_DEBUG_SYMBOLS=1)
7183 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7184 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7185 export MOZ_DEBUG_SYMBOLS
7188 dnl ========================================================
7189 dnl = Enable any treating of compile warnings as errors
7190 dnl ========================================================
7191 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7192 [ --enable-warnings-as-errors
7193 Enable treating of warnings as errors],
7194 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7195 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7196 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7197 WARNINGS_AS_ERRORS=''
7200 dnl ========================================================
7201 dnl = Disable runtime logging checks
7202 dnl ========================================================
7203 MOZ_ARG_DISABLE_BOOL(logging,
7204 [ --disable-logging Disable logging facilities],
7205 NS_DISABLE_LOGGING=1,
7206 NS_DISABLE_LOGGING= )
7207 if test "$NS_DISABLE_LOGGING"; then
7208 AC_DEFINE(NS_DISABLE_LOGGING)
7210 AC_DEFINE(MOZ_LOGGING)
7213 dnl ========================================================
7214 dnl = This will enable logging of addref, release, ctor, dtor.
7215 dnl ========================================================
7216 _ENABLE_LOGREFCNT=42
7217 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7218 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7219 _ENABLE_LOGREFCNT=1,
7220 _ENABLE_LOGREFCNT= )
7221 if test "$_ENABLE_LOGREFCNT" = "1"; then
7222 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7223 elif test -z "$_ENABLE_LOGREFCNT"; then
7224 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7227 dnl ========================================================
7228 dnl moz_dump_painting
7229 dnl ========================================================
7230 MOZ_ARG_ENABLE_BOOL(dump-painting,
7231 [ --enable-dump-painting Enable paint debugging.],
7232 MOZ_DUMP_PAINTING=1,
7233 MOZ_DUMP_PAINTING= )
7234 if test -n "$MOZ_DUMP_PAINTING"; then
7235 AC_DEFINE(MOZ_DUMP_PAINTING)
7236 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7238 if test -n "$MOZ_DEBUG"; then
7239 AC_DEFINE(MOZ_DUMP_PAINTING)
7242 dnl ========================================================
7243 dnl = Enable trace malloc
7244 dnl ========================================================
7245 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7246 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7247 [ --enable-trace-malloc Enable malloc tracing; also disables jemalloc],
7250 if test "$NS_TRACE_MALLOC"; then
7251 # Please, Mr. Linker Man, don't take away our symbol names
7252 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7254 AC_DEFINE(NS_TRACE_MALLOC)
7256 AC_SUBST(NS_TRACE_MALLOC)
7258 dnl ========================================================
7259 dnl = Enable jemalloc
7260 dnl ========================================================
7261 MOZ_ARG_ENABLE_BOOL(jemalloc,
7262 [ --enable-jemalloc Replace memory allocator with jemalloc],
7266 if test "$NS_TRACE_MALLOC"; then
7269 if test "$MOZ_DMD"; then
7273 if test "${OS_TARGET}" = "Android"; then
7274 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7276 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7277 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7278 if test -z "$GNU_CC"; then
7279 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7281 MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
7284 dnl On other Unix systems, we only want to link executables against mozglue
7285 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib) $(MKSHLIB_UNFORCE_ALL)'
7286 if test -n "$GNU_CC"; then
7287 dnl And we need mozglue symbols to be exported.
7288 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7290 if test "$MOZ_LINKER" = 1; then
7291 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
7295 if test -z "$MOZ_MEMORY"; then
7298 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7299 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.])
7304 dnl Don't try to run compiler tests on Windows
7305 if test "$OS_ARCH" = "WINNT"; then
7306 if test -z "$HAVE_64BIT_OS"; then
7307 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7309 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7312 AC_CHECK_SIZEOF([int *], [4])
7313 case "${ac_cv_sizeof_int_p}" in
7315 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7318 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7321 AC_MSG_ERROR([Unexpected pointer size])
7326 AC_DEFINE(MOZ_MEMORY)
7327 if test "x$MOZ_DEBUG" = "x1"; then
7328 AC_DEFINE(MOZ_MEMORY_DEBUG)
7330 dnl The generic feature tests that determine how to compute ncpus are long and
7331 dnl complicated. Therefore, simply define special cpp variables for the
7332 dnl platforms we have special knowledge of.
7335 AC_DEFINE(MOZ_MEMORY_DARWIN)
7338 AC_DEFINE(MOZ_MEMORY_BSD)
7340 *-android*|*-linuxandroid*)
7341 AC_DEFINE(MOZ_MEMORY_LINUX)
7342 AC_DEFINE(MOZ_MEMORY_ANDROID)
7347 AC_DEFINE(MOZ_MEMORY_LINUX)
7350 AC_DEFINE(MOZ_MEMORY_BSD)
7353 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7356 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7357 if test -z "$MOZ_DEBUG"; then
7358 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7360 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7362 dnl Look for a broken crtdll.obj
7363 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7364 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7365 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7366 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7367 dnl Also pass this to NSPR/NSS
7368 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7370 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7377 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7381 if test "$OS_ARCH" != "WINNT"; then
7382 dnl NB: this must be kept in sync with jemalloc.h
7383 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7385 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7386 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7388 AC_SUBST(MOZ_MEMORY)
7389 AC_SUBST(MOZ_GLUE_LDFLAGS)
7390 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7391 AC_SUBST(WIN32_CRT_LIBS)
7392 dnl Need to set this for make because NSS doesn't have configure
7395 dnl We need to wrap dlopen and related functions on Android because we use
7397 if test "$OS_TARGET" = Android; then
7398 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7399 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7400 if test -n "$MOZ_OLD_LINKER"; then
7401 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7403 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7407 dnl ========================================================
7408 dnl = Use malloc wrapper lib
7409 dnl ========================================================
7410 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7411 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7415 if test -n "$_WRAP_MALLOC"; then
7416 if test -n "$GNU_CC"; then
7417 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7418 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7419 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_Free,--wrap=PR_Malloc,--wrap=PR_Calloc,--wrap=PR_Realloc"
7420 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7421 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7423 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7427 dnl ========================================================
7428 dnl = Location of malloc wrapper lib
7429 dnl ========================================================
7430 MOZ_ARG_WITH_STRING(wrap-malloc,
7431 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7432 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7434 dnl ========================================================
7435 dnl = Use JS Call tracing
7436 dnl ========================================================
7437 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7438 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7439 MOZ_TRACE_JSCALLS=1,
7440 MOZ_TRACE_JSCALLS= )
7441 if test -n "$MOZ_TRACE_JSCALLS"; then
7442 AC_DEFINE(MOZ_TRACE_JSCALLS)
7445 dnl ========================================================
7446 dnl = Use incremental GC
7447 dnl ========================================================
7449 MOZ_ARG_DISABLE_BOOL(gcincremental,
7450 [ --disable-gcincremental Disable incremental GC],
7452 if test -n "$JSGC_INCREMENTAL"; then
7453 AC_DEFINE(JSGC_INCREMENTAL)
7456 dnl ========================================================
7457 dnl ETW - Event Tracing for Windows
7458 dnl ========================================================
7459 MOZ_ARG_ENABLE_BOOL(ETW,
7460 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting],
7463 if test -n "$MOZ_ETW"; then
7467 if test -n "$MOZ_ETW"; then
7468 if test -z "$MOZ_WINSDK_TARGETVER"; then
7469 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7473 dnl ========================================================
7474 dnl Zealous JavaScript GC
7475 dnl ========================================================
7476 MOZ_ARG_ENABLE_BOOL(gczeal,
7477 [ --enable-gczeal Enable zealous JavaScript GCing],
7480 if test -n "$JS_GC_ZEAL"; then
7481 AC_DEFINE(JS_GC_ZEAL)
7484 dnl ========================================================
7485 dnl JS opt-mode assertions and minidump instrumentation
7486 dnl ========================================================
7487 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7488 [ --enable-js-diagnostics
7489 Enable JS diagnostic assertions and breakpad data],
7490 JS_CRASH_DIAGNOSTICS=1,
7491 JS_CRASH_DIAGNOSTICS= )
7492 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7493 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7496 dnl ======================================================
7497 dnl = Enable compiling with ccache
7498 dnl ======================================================
7499 MOZ_ARG_WITH_STRING(ccache,
7500 [ --with-ccache[=path/to/ccache]
7501 Enable compiling with ccache],
7502 CCACHE=$withval, CCACHE="no")
7504 if test "$CCACHE" != "no"; then
7505 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7508 if test ! -e "$CCACHE"; then
7509 AC_MSG_ERROR([$CCACHE not found])
7512 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7513 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7514 AC_MSG_ERROR([ccache not found])
7515 elif test -x "$CCACHE"; then
7519 AC_MSG_ERROR([$CCACHE is not executable])
7523 dnl ========================================================
7524 dnl = Enable static checking using gcc-dehydra
7525 dnl ========================================================
7527 MOZ_ARG_WITH_STRING(static-checking,
7528 [ --with-static-checking=path/to/gcc_dehydra.so
7529 Enable static checking of code using GCC-dehydra],
7530 DEHYDRA_PATH=$withval,
7533 if test -n "$DEHYDRA_PATH"; then
7534 if test ! -f "$DEHYDRA_PATH"; then
7535 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7537 AC_DEFINE(NS_STATIC_CHECKING)
7539 AC_SUBST(DEHYDRA_PATH)
7541 dnl ========================================================
7542 dnl = Enable stripping of libs & executables
7543 dnl ========================================================
7544 MOZ_ARG_ENABLE_BOOL(strip,
7545 [ --enable-strip Enable stripping of libs & executables ],
7549 dnl ========================================================
7550 dnl = Enable stripping of libs & executables when packaging
7551 dnl ========================================================
7552 MOZ_ARG_ENABLE_BOOL(install-strip,
7553 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7557 dnl ========================================================
7558 dnl = --enable-elf-dynstr-gc
7559 dnl ========================================================
7560 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7561 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7562 USE_ELF_DYNSTR_GC=1,
7563 USE_ELF_DYNSTR_GC= )
7565 dnl ========================================================
7566 dnl = --disable-elf-hack
7567 dnl ========================================================
7570 MOZ_ARG_DISABLE_BOOL(elf-hack,
7571 [ --disable-elf-hack Disable elf hacks],
7575 # Only enable elfhack where supported
7576 if test "$USE_ELF_HACK" = 1; then
7577 case "${HOST_OS_ARCH},${OS_ARCH}" in
7579 case "${CPU_ARCH}" in
7594 if test "$USE_ELF_HACK" = 1; then
7595 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7596 dnl memory addresses it maps to. The result is that by the time elfhack
7597 dnl kicks in, it is not possible to apply relocations because of that,
7598 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7599 dnl segment. It makes elfhack mostly useless, so considering the problems
7600 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7601 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7602 dnl the linker creates PT_GNU_RELRO segments.
7603 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7604 LINK_WITH_PT_GNU_RELRO,
7605 [echo "int main() {return 0;}" > conftest.${ac_ext}
7606 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7607 test -s conftest${ac_exeext}; then
7608 if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7609 LINK_WITH_PT_GNU_RELRO=yes
7611 LINK_WITH_PT_GNU_RELRO=no
7614 dnl We really don't expect to get here, but just in case
7615 AC_ERROR([couldn't compile a simple C file])
7618 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7619 AC_MSG_WARN([Disabling elfhack])
7624 dnl ========================================================
7625 dnl = libstdc++ compatibility hacks
7626 dnl ========================================================
7629 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7630 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7631 STDCXX_COMPAT=stdc++compat.cpp)
7633 AC_SUBST(STDCXX_COMPAT)
7635 if test -n "$STDCXX_COMPAT"; then
7636 eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7637 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7638 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7641 dnl ========================================================
7643 dnl = Profiling and Instrumenting
7645 dnl ========================================================
7646 MOZ_ARG_HEADER(Profiling and Instrumenting)
7648 dnl ========================================================
7649 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7650 dnl = timing for identifying code bottlenecks
7651 dnl = NS_FUNCTION_TIMER is off by default.
7652 dnl ========================================================
7653 MOZ_ARG_ENABLE_BOOL(functiontimer,
7654 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7655 NS_FUNCTION_TIMER=1,
7656 NS_FUNCTION_TIMER= )
7657 if test -n "$NS_FUNCTION_TIMER"; then
7658 AC_DEFINE(NS_FUNCTION_TIMER)
7661 dnl ========================================================
7662 dnl Turn on reflow counting
7663 dnl ========================================================
7664 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7665 [ --enable-reflow-perf Enable reflow performance tracing],
7668 if test -n "$MOZ_REFLOW_PERF"; then
7669 AC_DEFINE(MOZ_REFLOW_PERF)
7672 dnl ========================================================
7673 dnl Enable code size metrics.
7674 dnl ========================================================
7675 MOZ_ARG_ENABLE_BOOL(codesighs,
7676 [ --enable-codesighs Enable code size analysis tools],
7677 _ENABLE_CODESIGHS=1,
7678 _ENABLE_CODESIGHS= )
7679 if test -n "$_ENABLE_CODESIGHS"; then
7680 if test -d $srcdir/tools/codesighs; then
7683 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7687 dnl ========================================================
7688 dnl = Support for Quantify (Windows)
7689 dnl ========================================================
7690 MOZ_ARG_ENABLE_BOOL(quantify,
7691 [ --enable-quantify Enable Quantify support (Windows only) ],
7695 dnl ========================================================
7696 dnl = Enable Radio Interface for B2G (Gonk usually)
7697 dnl ========================================================
7698 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7699 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7702 if test -n "$MOZ_B2G_RIL"; then
7703 AC_DEFINE(MOZ_B2G_RIL)
7705 AC_SUBST(MOZ_B2G_RIL)
7707 dnl ========================================================
7708 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7709 dnl ========================================================
7710 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7711 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7714 if test -n "$MOZ_B2G_BT"; then
7715 AC_DEFINE(MOZ_B2G_BT)
7717 AC_SUBST(MOZ_B2G_BT)
7719 dnl ========================================================
7720 dnl = Support for demangling undefined symbols
7721 dnl ========================================================
7722 if test -z "$SKIP_LIBRARY_CHECKS"; then
7725 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7729 # Demangle only for debug or trace-malloc builds
7730 MOZ_DEMANGLE_SYMBOLS=
7731 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7732 MOZ_DEMANGLE_SYMBOLS=1
7733 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7735 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7737 dnl ========================================================
7738 dnl = Support for gcc stack unwinding (from gcc 3.3)
7739 dnl ========================================================
7740 if test -z "$SKIP_LIBRARY_CHECKS"; then
7741 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7744 dnl ========================================================
7746 dnl ========================================================
7748 MOZ_ARG_WITH_STRING(jitreport-granularity,
7749 [ --jitreport-granularity=N
7750 Default granularity at which to report JIT code
7753 1 - code ranges for whole functions only
7754 2 - per-line information
7755 3 - per-op information],
7756 JITREPORT_GRANULARITY=$withval,
7757 JITREPORT_GRANULARITY=3)
7759 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7761 dnl ========================================================
7765 dnl ========================================================
7766 MOZ_ARG_HEADER(Misc. Options)
7768 dnl ========================================================
7769 dnl update xterm title
7770 dnl ========================================================
7771 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7772 [ --enable-xterm-updates Update XTERM titles with current command.],
7776 dnl =========================================================
7778 dnl =========================================================
7779 MOZ_ARG_ENABLE_STRING([chrome-format],
7780 [ --enable-chrome-format=jar|flat|both|symlink|omni
7781 Select FORMAT of chrome files (default=jar)],
7782 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7784 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7785 MOZ_CHROME_FILE_FORMAT=jar
7788 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7789 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7790 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7791 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7792 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7793 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7796 dnl =========================================================
7797 dnl Omnijar packaging (bug 552121)
7798 dnl =========================================================
7799 dnl Omnijar packaging is compatible with flat packaging.
7800 dnl In unpackaged builds, omnijar looks for files as if
7801 dnl things were flat packaged. After packaging, all files
7802 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7803 dnl is set to flat since putting files into jars is only
7804 dnl done during packaging with omnijar.
7805 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7807 AC_DEFINE(MOZ_OMNIJAR)
7808 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7809 MOZ_CHROME_FILE_FORMAT=flat
7811 MOZ_CHROME_FILE_FORMAT=symlink
7813 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7814 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7817 OMNIJAR_NAME=omni.ja
7818 AC_SUBST(OMNIJAR_NAME)
7819 AC_SUBST(MOZ_OMNIJAR)
7821 dnl ========================================================
7822 dnl = Define default location for MOZILLA_FIVE_HOME
7823 dnl ========================================================
7824 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7825 [ --with-default-mozilla-five-home
7826 Set the default value for MOZILLA_FIVE_HOME],
7827 [ val=`echo $withval`
7828 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7830 dnl ========================================================
7831 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7832 dnl ========================================================
7833 MOZ_ARG_WITH_STRING(user-appdir,
7834 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7835 [ val=`echo $withval`
7836 if echo "$val" | grep "\/" >/dev/null; then
7837 AC_MSG_ERROR("Homedir must be single relative path.")
7842 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7844 dnl ========================================================
7845 dnl = Doxygen configuration
7846 dnl ========================================================
7847 dnl Use commas to specify multiple dirs to this arg
7848 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7849 MOZ_ARG_WITH_STRING(doc-input-dirs,
7850 [ --with-doc-input-dirs=DIRS
7851 Header/idl dirs to create docs from],
7852 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7853 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7855 dnl Use commas to specify multiple dirs to this arg
7856 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7857 MOZ_ARG_WITH_STRING(doc-include-dirs,
7858 [ --with-doc-include-dirs=DIRS
7859 Include dirs to preprocess doc headers],
7860 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7861 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7863 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7864 MOZ_ARG_WITH_STRING(doc-output-dir,
7865 [ --with-doc-output-dir=DIR
7866 Dir to generate docs into],
7867 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7868 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7870 if test -z "$SKIP_COMPILER_CHECKS"; then
7871 dnl ========================================================
7873 dnl = Compiler Options
7875 dnl ========================================================
7876 MOZ_ARG_HEADER(Compiler Options)
7878 dnl ========================================================
7879 dnl Check for gcc -pipe support
7880 dnl ========================================================
7881 AC_MSG_CHECKING([for -pipe support])
7882 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7883 dnl Any gcc that supports firefox supports -pipe.
7884 CFLAGS="$CFLAGS -pipe"
7885 CXXFLAGS="$CXXFLAGS -pipe"
7886 AC_MSG_RESULT([yes])
7891 dnl ========================================================
7892 dnl Profile guided optimization (gcc checks)
7893 dnl ========================================================
7894 dnl Test for profiling options
7895 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7897 _SAVE_CFLAGS="$CFLAGS"
7898 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7900 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7901 AC_TRY_COMPILE([], [return 0;],
7902 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7903 result="yes" ], result="no")
7904 AC_MSG_RESULT([$result])
7906 if test $result = "yes"; then
7907 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7908 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7909 PROFILE_USE_LDFLAGS="-fprofile-use"
7912 CFLAGS="$_SAVE_CFLAGS"
7914 if test -n "$INTEL_CC"; then
7915 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7916 PROFILE_GEN_LDFLAGS=
7917 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7918 PROFILE_USE_LDFLAGS=
7921 dnl Sun Studio on Solaris
7922 if test "$SOLARIS_SUNPRO_CC"; then
7923 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7924 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7925 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7926 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7929 AC_SUBST(PROFILE_GEN_CFLAGS)
7930 AC_SUBST(PROFILE_GEN_LDFLAGS)
7931 AC_SUBST(PROFILE_USE_CFLAGS)
7932 AC_SUBST(PROFILE_USE_LDFLAGS)
7936 dnl ========================================================
7937 dnl Test for -pedantic bustage
7938 dnl ========================================================
7939 MOZ_ARG_DISABLE_BOOL(pedantic,
7940 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7942 if test "$_PEDANTIC"; then
7943 _SAVE_CXXFLAGS=$CXXFLAGS
7944 CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7945 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7946 AC_TRY_COMPILE([$configure_static_assert_macros],
7947 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7948 result="no", result="yes" )
7949 AC_MSG_RESULT([$result])
7950 CXXFLAGS="$_SAVE_CXXFLAGS"
7954 _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7955 _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7958 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7963 dnl ========================================================
7964 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7965 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7966 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7967 dnl ========================================================
7968 _SAVE_CXXFLAGS=$CXXFLAGS
7969 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7970 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7971 ac_nscap_nonconst_opeq_bug,
7980 template <class T, class U>
7981 int operator==(const Pointer<T>& rhs, U* lhs)
7983 return rhs.myPtr == lhs;
7986 template <class T, class U>
7987 int operator==(const Pointer<T>& rhs, const U* lhs)
7989 return rhs.myPtr == lhs;
7997 ac_nscap_nonconst_opeq_bug="no",
7998 ac_nscap_nonconst_opeq_bug="yes")])
7999 CXXFLAGS="$_SAVE_CXXFLAGS"
8001 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8002 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8004 fi # ! SKIP_COMPILER_CHECKS
8006 AC_DEFINE(CPP_THROW_NEW, [throw()])
8011 dnl ========================================================
8013 dnl = Build depencency options
8015 dnl ========================================================
8016 MOZ_ARG_HEADER(Build dependencies)
8018 dnl ========================================================
8019 dnl = Do not auto generate dependency info
8020 dnl ========================================================
8022 MOZ_ARG_DISABLE_BOOL(auto-deps,
8023 [ --disable-auto-deps Do not automatically generate dependency info],
8027 if test -n "$MOZ_AUTO_DEPS"; then
8028 dnl ========================================================
8029 dnl = Use mkdepend instead of $CC -MD for dependency generation
8030 dnl ========================================================
8032 MOZ_ARG_DISABLE_BOOL(md,
8033 [ --disable-md Do not use compiler-based dependencies ],
8036 [dnl Default is to turn on -MD if using GNU-compatible compilers
8037 if test "$GNU_CC" -a "$GNU_CXX"; then
8040 dnl Default is to use -xM if using Sun Studio on Solaris
8041 if test "$SOLARIS_SUNPRO_CC"; then
8044 if test "$_cpp_md_flag"; then
8046 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8047 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8048 if test "$SOLARIS_SUNPRO_CC"; then
8053 dnl Don't override this for MSVC
8054 if test -z "$_WIN32_MSVC"; then
8055 _USE_CPP_INCLUDE_FLAG=
8056 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8057 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8059 echo '#include <stdio.h>' > dummy-hello.c
8061 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8063 if test -z "$CL_INCLUDES_PREFIX"; then
8064 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8066 AC_SUBST(CL_INCLUDES_PREFIX)
8068 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8069 dnl cl.py provides dependency generation for MSVC
8070 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8071 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8077 AC_SUBST(MOZ_AUTO_DEPS)
8078 AC_SUBST(COMPILER_DEPEND)
8080 AC_SUBST(CC_WRAPPER)
8081 AC_SUBST(CXX_WRAPPER)
8084 dnl ========================================================
8086 dnl = Static Build Options
8088 dnl ========================================================
8089 MOZ_ARG_HEADER(Static build options)
8091 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8092 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
8096 MOZ_ARG_ENABLE_BOOL(shared-js,
8097 [ --enable-shared-js
8098 Create a shared JavaScript library.],
8102 if test -n "$ENABLE_SHARED_JS"; then
8104 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8106 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8107 AC_DEFINE(MOZ_STATIC_JS)
8109 AC_SUBST(JS_SHARED_LIBRARY)
8111 AC_SUBST(LIBXUL_LIBS)
8112 XPCOM_LIBS="$LIBXUL_LIBS"
8114 dnl ========================================================
8116 dnl = Standalone module options
8118 dnl ========================================================
8119 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8122 dnl ========================================================
8124 if test -z "$SKIP_PATH_CHECKS"; then
8125 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8126 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8127 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8129 AM_PATH_GLIB(${GLIB_VERSION})
8134 if test -z "${GLIB_GMODULE_LIBS}" \
8135 -a -n "${GLIB_CONFIG}"\
8136 -a "${GLIB_CONFIG}" != no\
8138 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8141 AC_SUBST(GLIB_CFLAGS)
8143 AC_SUBST(GLIB_GMODULE_LIBS)
8145 dnl ========================================================
8146 dnl Graphics checks.
8147 dnl ========================================================
8149 if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8155 MOZ_ARG_ENABLE_BOOL(skia,
8156 [ --enable-skia Enable use of Skia],
8160 dnl ========================================================
8162 dnl ========================================================
8163 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8166 MOZ_ARG_ENABLE_BOOL(system-cairo,
8167 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8172 MOZ_ARG_ENABLE_BOOL(system-pixman,
8173 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8177 # Check for headers defining standard int types.
8178 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8180 if test "$MOZ_TREE_CAIRO"; then
8181 AC_DEFINE(MOZ_TREE_CAIRO)
8183 # For now we assume that we will have a uint64_t available through
8184 # one of the above headers or mozstdint.h.
8185 AC_DEFINE(HAVE_UINT64_T)
8187 # Define macros for cairo-features.h
8188 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8189 if test "$MOZ_X11"; then
8190 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8191 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8192 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8193 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8194 MOZ_ENABLE_CAIRO_FT=1
8195 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8197 case "$MOZ_WIDGET_TOOLKIT" in
8199 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8202 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8203 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8204 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8207 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8208 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8209 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8210 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8211 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8212 MOZ_ENABLE_D2D_SURFACE=1
8213 MOZ_ENABLE_DWRITE_FONT=1
8215 WIN32_DWRITE_FONT_FEATURE=
8216 WIN32_D2D_SURFACE_FEATURE=
8219 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8221 dnl D3D10 Layers depend on D2D Surfaces.
8222 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8223 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8227 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8228 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8229 MOZ_ENABLE_CAIRO_FT=1
8230 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8231 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8234 if test "$USE_FC_FREETYPE"; then
8235 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8237 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8238 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8239 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8240 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8241 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8242 AC_SUBST(CAIRO_FT_CFLAGS)
8244 AC_SUBST(PS_SURFACE_FEATURE)
8245 AC_SUBST(PDF_SURFACE_FEATURE)
8246 AC_SUBST(SVG_SURFACE_FEATURE)
8247 AC_SUBST(XLIB_SURFACE_FEATURE)
8248 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8249 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8250 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8251 AC_SUBST(WIN32_SURFACE_FEATURE)
8252 AC_SUBST(OS2_SURFACE_FEATURE)
8253 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8254 AC_SUBST(FT_FONT_FEATURE)
8255 AC_SUBST(FC_FONT_FEATURE)
8256 AC_SUBST(WIN32_FONT_FEATURE)
8257 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8258 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8259 AC_SUBST(QUARTZ_FONT_FEATURE)
8260 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8261 AC_SUBST(QT_SURFACE_FEATURE)
8262 AC_SUBST(TEE_SURFACE_FEATURE)
8264 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8266 if test "$MOZ_TREE_PIXMAN"; then
8267 AC_DEFINE(MOZ_TREE_PIXMAN)
8268 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8270 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8271 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8272 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8275 if test "$MOZ_X11"; then
8276 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8279 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8280 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8283 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8284 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8285 MOZ_CAIRO_LIBS=$CAIRO_LIBS
8286 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8287 if test "$MOZ_X11"; then
8288 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8289 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8290 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8294 AC_SUBST(MOZ_TREE_CAIRO)
8295 AC_SUBST(MOZ_CAIRO_CFLAGS)
8296 AC_SUBST(MOZ_CAIRO_LIBS)
8297 AC_SUBST(MOZ_TREE_PIXMAN)
8299 dnl ========================================================
8301 dnl ========================================================
8303 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8306 dnl ========================================================
8308 dnl ========================================================
8309 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8310 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8312 dnl ========================================================
8314 dnl ========================================================
8315 if test "$MOZ_GRAPHITE"; then
8316 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8317 AC_DEFINE(MOZ_GRAPHITE)
8321 AC_SUBST(MOZ_GRAPHITE)
8322 AC_SUBST(MOZ_GRAPHITE_LIBS)
8324 dnl ========================================================
8326 dnl ========================================================
8327 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8328 AC_SUBST(MOZ_OTS_LIBS)
8330 dnl ========================================================
8332 dnl ========================================================
8333 if test "$MOZ_ENABLE_SKIA"; then
8334 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8335 AC_DEFINE(MOZ_ENABLE_SKIA)
8339 AC_SUBST(MOZ_ENABLE_SKIA)
8340 AC_SUBST(MOZ_SKIA_LIBS)
8342 dnl ========================================================
8344 dnl ========================================================
8345 MOZ_ARG_DISABLE_BOOL(xul,
8346 [ --disable-xul Disable XUL],
8348 if test "$MOZ_XUL"; then
8351 dnl remove extensions that require XUL
8352 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8357 dnl ========================================================
8358 dnl disable profile locking
8359 dnl do no use this in applications that can have more than
8360 dnl one process accessing the profile directory.
8361 dnl ========================================================
8362 MOZ_ARG_DISABLE_BOOL(profilelocking,
8363 [ --disable-profilelocking
8364 Disable profile locking],
8365 MOZ_PROFILELOCKING=,
8366 MOZ_PROFILELOCKING=1 )
8367 if test "$MOZ_PROFILELOCKING"; then
8368 AC_DEFINE(MOZ_PROFILELOCKING)
8371 dnl ========================================================
8372 dnl necko configuration options
8373 dnl ========================================================
8376 dnl option to disable various necko protocols
8378 MOZ_ARG_ENABLE_STRING(necko-protocols,
8379 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8380 Enable/disable specific protocol handlers],
8381 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8382 if test "$option" = "yes" -o "$option" = "all"; then
8383 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8384 elif test "$option" = "no" -o "$option" = "none"; then
8386 elif test "$option" = "default"; then
8387 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8388 elif test `echo "$option" | grep -c \^-` != 0; then
8389 option=`echo $option | sed 's/^-//'`
8390 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8392 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8395 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8397 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8398 AC_SUBST(NECKO_PROTOCOLS)
8399 for p in $NECKO_PROTOCOLS; do
8400 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8404 dnl option to disable necko's wifi scanner
8406 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8407 [ --disable-necko-wifi Disable necko wifi scanner],
8411 if test "$OS_ARCH" = "OS2"; then
8412 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8415 if test "$NECKO_WIFI" -a \
8416 "$OS_ARCH" != "Linux" -a \
8417 "$OS_ARCH" != "Darwin" -a \
8418 "$OS_ARCH" != "SunOS" -a \
8419 "$OS_ARCH" != "WINNT"; then
8420 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8423 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8425 MOZ_CHECK_HEADER([iwlib.h])
8426 if test "$ac_cv_header_iwlib_h" != "yes"; then
8427 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])
8431 if test "$NECKO_WIFI"; then
8432 AC_DEFINE(NECKO_WIFI)
8434 AC_SUBST(NECKO_WIFI)
8437 dnl option to disable cookies
8439 MOZ_ARG_DISABLE_BOOL(cookies,
8440 [ --disable-cookies Disable cookie support],
8443 AC_SUBST(NECKO_COOKIES)
8444 if test "$NECKO_COOKIES"; then
8445 AC_DEFINE(NECKO_COOKIES)
8449 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8451 MOZ_ARG_DISABLE_BOOL(ctypes,
8452 [ --disable-ctypes Disable js-ctypes],
8455 AC_SUBST(BUILD_CTYPES)
8456 if test "$BUILD_CTYPES"; then
8457 AC_DEFINE(BUILD_CTYPES)
8460 dnl NECKO_ configuration options are not global
8461 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8463 dnl Build Places if required
8464 if test "$MOZ_PLACES"; then
8465 AC_DEFINE(MOZ_PLACES)
8468 dnl Build Sync Services if required
8469 AC_SUBST(MOZ_SERVICES_SYNC)
8470 if test -n "$MOZ_SERVICES_SYNC"; then
8471 AC_DEFINE(MOZ_SERVICES_SYNC)
8474 dnl ========================================================
8475 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8476 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8479 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8480 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8483 if test "$MOZ_APP_COMPONENT_MODULES"; then
8484 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8487 dnl ========================================================
8489 dnl = Maintainer debug option (no --enable equivalent)
8491 dnl ========================================================
8496 AC_SUBST(AR_EXTRACT)
8500 AC_SUBST(AS_DASH_C_FLAG)
8509 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8510 AC_SUBST(MOZ_UPDATE_XTERM)
8511 AC_SUBST(MOZ_PLATFORM_MAEMO)
8512 AC_SUBST(MOZ_AUTH_EXTENSION)
8513 AC_SUBST(MOZ_PERMISSIONS)
8515 AC_SUBST(MOZ_PREF_EXTENSIONS)
8516 AC_SUBST(MOZ_JS_LIBS)
8519 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8520 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8521 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8522 AC_SUBST(MOZ_DEBUG_FLAGS)
8523 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8524 AC_SUBST(WARNINGS_AS_ERRORS)
8525 AC_SUBST(MOZ_EXTENSIONS)
8526 AC_SUBST(MOZ_JSDEBUGGER)
8527 AC_SUBST(MOZ_LOG_REFCNT)
8529 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8532 AC_SUBST(MOZ_CALLGRIND)
8535 AC_SUBST(MOZ_PROFILING)
8536 AC_SUBST(MOZ_QUANTIFY)
8538 AC_SUBST(MOZ_PLACES)
8539 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8541 AC_SUBST(NS_PRINTING)
8543 AC_SUBST(MOZ_HELP_VIEWER)
8549 AC_SUBST(MOZ_PROFILELOCKING)
8551 AC_SUBST(ENABLE_TESTS)
8553 AC_SUBST(MOZ_UNIVERSALCHARDET)
8554 AC_SUBST(ACCESSIBILITY)
8555 AC_SUBST(MOZ_SPELLCHECK)
8556 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8557 AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
8558 AC_SUBST(MOZ_USER_DIR)
8559 AC_SUBST(MOZ_CRASHREPORTER)
8560 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8561 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8562 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8563 AC_SUBST(MOZ_UPDATER)
8565 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8566 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8567 AC_SUBST(MOZ_D3DX9_VERSION)
8568 AC_SUBST(MOZ_D3DX9_CAB)
8569 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8570 AC_SUBST(MOZ_D3DX9_DLL)
8571 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8573 AC_SUBST(MOZ_ANDROID_HISTORY)
8574 AC_SUBST(MOZ_WEBSMS_BACKEND)
8575 AC_SUBST(ENABLE_STRIP)
8576 AC_SUBST(PKG_SKIP_STRIP)
8577 AC_SUBST(USE_ELF_DYNSTR_GC)
8578 AC_SUBST(USE_ELF_HACK)
8579 AC_SUBST(INCREMENTAL_LINKER)
8580 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8581 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8583 AC_SUBST(MOZ_FIX_LINK_PATHS)
8584 AC_SUBST(XPCOM_LIBS)
8585 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8586 AC_SUBST(XPCOM_GLUE_LDOPTS)
8587 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8589 AC_SUBST(USE_DEPENDENT_LIBS)
8591 AC_SUBST(MOZ_BUILD_ROOT)
8592 AC_SUBST(MOZ_OS2_TOOLS)
8594 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8595 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8597 dnl ========================================================
8598 dnl = Mac bundle name prefix
8599 dnl ========================================================
8600 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8601 [ --with-macbundlename-prefix=prefix
8602 Prefix for MOZ_MACBUNDLE_NAME],
8603 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8605 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8606 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8607 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8610 if test "$MOZ_DEBUG"; then
8611 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8613 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8615 AC_SUBST(MOZ_MACBUNDLE_NAME)
8617 # The following variables are available to branding and application
8618 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8619 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8620 # impacts profile location and user-visible fields.
8621 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8622 # versions of a given application (e.g. Aurora and Firefox both use
8623 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8624 # for application.ini's "Name" field, which controls profile location in
8625 # the absence of a "Profile" field (see below), and various system
8626 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8627 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8628 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8629 # builds (e.g. Aurora for Firefox).
8630 # - MOZ_APP_VERSION: Defines the application version number.
8631 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8632 # defaults to a lowercase form of MOZ_APP_BASENAME.
8633 # - MOZ_APP_PROFILE: When set, used for application.ini's
8634 # "Profile" field, which controls profile location.
8635 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8636 # crash reporter server url.
8637 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8638 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8640 if test -z "$MOZ_APP_NAME"; then
8641 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8644 AC_SUBST(MOZ_APP_NAME)
8645 AC_SUBST(MOZ_APP_DISPLAYNAME)
8646 AC_SUBST(MOZ_APP_BASENAME)
8647 AC_SUBST(MOZ_APP_VENDOR)
8648 AC_SUBST(MOZ_APP_PROFILE)
8649 AC_SUBST(MOZ_APP_ID)
8650 AC_SUBST(MAR_CHANNEL_ID)
8651 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8652 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8653 AC_SUBST(MOZ_EXTENSION_MANAGER)
8654 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8655 AC_SUBST(MOZ_APP_UA_NAME)
8656 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8657 AC_SUBST(MOZ_APP_VERSION)
8658 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
8659 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8660 AC_SUBST(FIREFOX_VERSION)
8661 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8662 AC_SUBST(MOZ_UA_BUILDID)
8664 # We can't use the static application.ini data when building against
8666 if test -n "$LIBXUL_SDK"; then
8669 AC_SUBST(MOZ_APP_STATIC_INI)
8671 AC_SUBST(MOZ_PKG_SPECIAL)
8673 AC_SUBST(MOZILLA_OFFICIAL)
8675 if test "$MOZ_TELEMETRY_REPORTING"; then
8676 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8680 AC_SUBST(MOZ_MAPINFO)
8681 AC_SUBST(MOZ_BROWSE_INFO)
8682 AC_SUBST(MOZ_TOOLS_DIR)
8683 AC_SUBST(WIN32_REDIST_DIR)
8687 dnl Echo the CFLAGS to remove extra whitespace.
8694 $_WARNINGS_CXXFLAGS \
8697 COMPILE_CFLAGS=`echo \
8702 COMPILE_CXXFLAGS=`echo \
8703 $_DEFINES_CXXFLAGS \
8707 AC_SUBST(SYSTEM_MAKEDEPEND)
8708 AC_SUBST(SYSTEM_LIBXUL)
8709 AC_SUBST(SYSTEM_JPEG)
8710 AC_SUBST(SYSTEM_PNG)
8711 AC_SUBST(SYSTEM_ZLIB)
8712 AC_SUBST(SYSTEM_BZ2)
8714 AC_SUBST(JPEG_CFLAGS)
8716 AC_SUBST(ZLIB_CFLAGS)
8718 AC_SUBST(BZ2_CFLAGS)
8720 AC_SUBST(PNG_CFLAGS)
8723 AC_SUBST(MOZ_JPEG_CFLAGS)
8724 AC_SUBST(MOZ_JPEG_LIBS)
8725 AC_SUBST(MOZ_ZLIB_CFLAGS)
8726 AC_SUBST(MOZ_ZLIB_LIBS)
8727 AC_SUBST(MOZ_BZ2_CFLAGS)
8728 AC_SUBST(MOZ_BZ2_LIBS)
8729 AC_SUBST(MOZ_PNG_CFLAGS)
8730 AC_SUBST(MOZ_PNG_LIBS)
8732 AC_SUBST(NSPR_CFLAGS)
8734 AC_SUBST(MOZ_NATIVE_NSPR)
8736 AC_SUBST(NSS_CFLAGS)
8738 AC_SUBST(NSS_DEP_LIBS)
8739 AC_SUBST(MOZ_NATIVE_NSS)
8740 AC_SUBST(NSS_DISABLE_DBM)
8745 AC_SUBST(COMPILE_CFLAGS)
8746 AC_SUBST(COMPILE_CXXFLAGS)
8749 AC_SUBST(CROSS_COMPILE)
8750 AC_SUBST(WCHAR_CFLAGS)
8754 AC_SUBST(HOST_CFLAGS)
8755 AC_SUBST(HOST_CXXFLAGS)
8756 AC_SUBST(HOST_LDFLAGS)
8757 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8759 AC_SUBST(HOST_AR_FLAGS)
8761 AC_SUBST(HOST_RANLIB)
8762 AC_SUBST(HOST_NSPR_MDCPUCFG)
8763 AC_SUBST(HOST_BIN_SUFFIX)
8764 AC_SUBST(HOST_OS_ARCH)
8766 AC_SUBST(TARGET_CPU)
8767 AC_SUBST(TARGET_VENDOR)
8769 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8770 AC_SUBST(TARGET_MD_ARCH)
8771 AC_SUBST(TARGET_XPCOM_ABI)
8774 AC_SUBST(OS_RELEASE)
8777 AC_SUBST(INTEL_ARCHITECTURE)
8779 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8780 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8782 AC_SUBST(WRAP_LDFLAGS)
8785 AC_SUBST(MKSHLIB_FORCE_ALL)
8786 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8787 AC_SUBST(DSO_CFLAGS)
8788 AC_SUBST(DSO_PIC_CFLAGS)
8789 AC_SUBST(DSO_LDOPTS)
8790 AC_SUBST(LIB_PREFIX)
8791 AC_SUBST(DLL_PREFIX)
8792 AC_SUBST(DLL_SUFFIX)
8793 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8794 AC_SUBST(LIB_SUFFIX)
8795 AC_SUBST(OBJ_SUFFIX)
8796 AC_SUBST(BIN_SUFFIX)
8797 AC_SUBST(ASM_SUFFIX)
8798 AC_SUBST(IMPORT_LIB_SUFFIX)
8800 AC_SUBST(CC_VERSION)
8801 AC_SUBST(CXX_VERSION)
8802 AC_SUBST(MSMANIFEST_TOOL)
8803 AC_SUBST(NS_ENABLE_TSF)
8804 AC_SUBST(MOZ_NSS_PATCH)
8805 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8806 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8809 AC_SUBST(MOZ_SYDNEYAUDIO)
8812 AC_SUBST(MOZ_VORBIS)
8813 AC_SUBST(MOZ_TREMOR)
8815 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8816 AC_SUBST(MOZ_VP8_ENCODER)
8818 AC_SUBST(MOZ_ALSA_LIBS)
8820 AC_SUBST(VPX_ASFLAGS)
8821 AC_SUBST(VPX_DASH_C_FLAG)
8822 AC_SUBST(VPX_AS_CONVERSION)
8823 AC_SUBST(VPX_ASM_SUFFIX)
8824 AC_SUBST(VPX_X86_ASM)
8825 AC_SUBST(VPX_ARM_ASM)
8826 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8827 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8828 AC_SUBST(LIBJPEG_TURBO_AS)
8829 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8830 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8831 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8832 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8834 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8836 AC_MSG_CHECKING([for posix_fallocate])
8837 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8838 #include <fcntl.h>],
8839 [posix_fallocate(0, 0, 0);],
8840 [ac_cv___posix_fallocate=true],
8841 [ac_cv___posix_fallocate=false])
8843 if test "$ac_cv___posix_fallocate" = true ; then
8844 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8850 dnl Check for missing components
8851 if test "$COMPILE_ENVIRONMENT"; then
8852 if test "$MOZ_X11"; then
8853 if test "$WITHOUT_X11"; then
8854 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8856 dnl ====================================================
8857 dnl = Check if X headers exist
8858 dnl ====================================================
8859 _SAVE_CFLAGS=$CFLAGS
8860 CFLAGS="$CFLAGS $XCFLAGS"
8864 #include <X11/Xlib.h>
8865 #include <X11/Intrinsic.h>
8866 #include <X11/extensions/XShm.h>
8870 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8871 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8875 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8876 CFLAGS="$_SAVE_CFLAGS"
8878 if test -n "$MISSING_X"; then
8879 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8884 dnl Check for headers, etc. needed by WebGL.
8885 if test -n "$MOZ_WEBGL_GLX"; then
8886 MOZ_CHECK_HEADER(GL/glx.h)
8887 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8888 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))])
8891 fi # COMPILE_ENVIRONMENT
8893 if test "$USE_FC_FREETYPE"; then
8894 if test "$COMPILE_ENVIRONMENT"; then
8895 _SAVE_CPPFLAGS="$CPPFLAGS"
8896 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8897 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8898 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8899 CPPFLAGS="$_SAVE_CPPFLAGS"
8901 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8905 dnl Set various defines and substitutions
8906 dnl ========================================================
8908 if test "$OS_ARCH" = "Darwin"; then
8910 AC_DEFINE(UNIX_ASYNC_DNS)
8911 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8913 AC_DEFINE(UNIX_ASYNC_DNS)
8916 if test "$MOZ_DEBUG"; then
8917 AC_DEFINE(MOZ_REFLOW_PERF)
8918 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8921 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8922 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8923 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8924 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8925 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8926 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8927 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8928 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8929 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8934 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8938 AC_SUBST(WIN_TOP_SRC)
8940 AC_SUBST(MOZILLA_VERSION)
8942 AC_SUBST(ac_configure_args)
8944 dnl Spit out some output
8945 dnl ========================================================
8947 dnl The following defines are used by xpcom
8948 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8950 HAVE_CPP_2BYTE_WCHAR_T
8951 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8953 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8954 HAVE_CPP_PARTIAL_SPECIALIZATION
8955 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8957 NEED_CPP_UNUSED_IMPLEMENTATIONS
8961 HAVE_ICONV_WITH_CONST_INPUT
8969 netwerk/necko-config.h
8970 xpcom/xpcom-config.h
8971 xpcom/xpcom-private.h
8974 # Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
8975 # "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
8976 # binary, even on 64-bit systems. It should work on OS X 10.4.5 and up. We
8977 # (apparently) only need this hack when egrep's "pattern" is particularly
8978 # long (as in the following code). See bug 655339.
8981 FIXED_EGREP="arch -arch i386 egrep"
8988 # Save the defines header file before autoconf removes it.
8989 # (Do not add AC_DEFINE calls after this line.)
8990 _CONFIG_TMP=confdefs-tmp.h
8991 _CONFIG_DEFS_H=mozilla-config.h
8993 cat > $_CONFIG_TMP <<\EOF
8994 /* List of defines generated by configure. Included with preprocessor flag,
8995 * -include, to avoid long list of -D defines on the compile command-line.
8999 #ifndef _MOZILLA_CONFIG_H_
9000 #define _MOZILLA_CONFIG_H_
9003 _EGREP_PATTERN='^#define ('
9004 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9005 for f in $_NON_GLOBAL_ACDEFINES; do
9006 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9009 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9011 sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9013 if test "$?" != 0; then
9014 AC_MSG_ERROR([Error outputting config definitions])
9017 cat >> $_CONFIG_TMP <<\EOF
9019 /* The c99 defining the limit macros (UINT32_MAX for example), says:
9020 * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
9021 * is defined before <stdint.h> is included. */
9022 #define __STDC_LIMIT_MACROS
9024 /* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
9025 * modify it directly.
9027 * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
9028 * unless --enable-system-hunspell is defined.
9030 #if defined(HUNSPELL_STATIC)
9031 #include "hunspell_alloc_hooks.h"
9034 #endif /* _MOZILLA_CONFIG_H_ */
9038 # Only write mozilla-config.h when something changes (or it doesn't exist)
9039 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9042 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9043 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9045 echo ==== $_CONFIG_DEFS_H =================================
9049 dnl Probably shouldn't call this manually but we always want the output of DEFS
9050 rm -f confdefs.h.save
9051 mv confdefs.h confdefs.h.save
9052 $FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9053 if test "$?" != 0; then
9054 AC_MSG_ERROR([Error outputting confdefs.h])
9056 AC_OUTPUT_MAKE_DEFS()
9058 AC_SUBST(MOZ_DEFINES)
9060 mv confdefs.h.save confdefs.h
9062 dnl Load the list of Makefiles to generate.
9063 dnl To add new Makefiles, edit allmakefiles.sh.
9064 dnl allmakefiles.sh sets the variable, MAKEFILES.
9065 . ${srcdir}/allmakefiles.sh
9067 dnl Run a perl script to quickly create the makefiles.
9068 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9069 dnl for the files it cannot handle correctly. This way, config.status
9070 dnl will handle these files.
9071 dnl If it fails, nothing is set and config.status will run as usual.
9073 dnl This does not change the $MAKEFILES variable.
9075 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9079 echo $MAKEFILES > unallmakefiles
9081 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9083 AC_OUTPUT($MAKEFILES)
9085 # Generate a JSON config file for unittest harnesses etc to read
9086 # build configuration details from in a standardized way.
9087 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
9088 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9089 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9090 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9091 rm ./mozinfo.json.tmp
9093 mv -f ./mozinfo.json.tmp ./mozinfo.json
9096 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9097 if test "$CAIRO_FEATURES_H"; then
9098 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9099 echo "$CAIRO_FEATURES_H is unchanged"
9100 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9102 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9106 # Run freetype configure script
9108 if test "$MOZ_TREE_FREETYPE"; then
9109 export CFLAGS="$CFLAGS -std=c99"
9110 export CPPFLAGS="$CPPFLAGS"
9111 export CXXFLAGS="$CXXFLAGS"
9112 export LDFLAGS="$LDFLAGS"
9113 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9114 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9115 AC_OUTPUT_SUBDIRS(modules/freetype2)
9118 if test -z "$direct_nspr_config"; then
9119 dnl ========================================================
9120 dnl = Setup a nice relatively clean build environment for
9121 dnl = sub-configures.
9122 dnl ========================================================
9125 CFLAGS="$_SUBDIR_CFLAGS"
9126 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9127 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9128 LDFLAGS="$_SUBDIR_LDFLAGS"
9129 HOST_CC="$_SUBDIR_HOST_CC"
9130 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9131 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9138 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9139 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9143 if test -n "$_WRAP_MALLOC"; then
9144 # Avoid doubling wrap malloc arguments
9145 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9148 if test -z "$MOZ_NATIVE_NSPR"; then
9149 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9150 if test -z "$MOZ_DEBUG"; then
9151 ac_configure_args="$ac_configure_args --disable-debug"
9153 ac_configure_args="$ac_configure_args --enable-debug"
9155 if test "$MOZ_OPTIMIZE" = "1"; then
9156 ac_configure_args="$ac_configure_args --enable-optimize"
9157 elif test -z "$MOZ_OPTIMIZE"; then
9158 ac_configure_args="$ac_configure_args --disable-optimize"
9160 if test -n "$HAVE_64BIT_OS"; then
9161 ac_configure_args="$ac_configure_args --enable-64bit"
9163 if test -n "$USE_ARM_KUSER"; then
9164 ac_configure_args="$ac_configure_args --with-arm-kuser"
9166 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
9167 # dladdr is supported by the new linker, even when the system linker doesn't
9168 # support it. Trick nspr into using dladdr when it's not supported.
9169 _SAVE_CPPFLAGS="$CPPFLAGS"
9170 export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
9172 _SAVE_LDFLAGS="$LDFLAGS"
9173 export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
9174 AC_OUTPUT_SUBDIRS(nsprpub)
9176 LDFLAGS="$_SAVE_LDFLAGS"
9177 if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
9179 CPPFLAGS="$_SAVE_CFLAGS"
9181 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9184 if test -z "$MOZ_NATIVE_NSPR"; then
9185 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9186 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9187 if test "$OS_ARCH" != "WINNT"; then
9188 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9189 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9190 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9191 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9193 rm -f config/autoconf.mk.bak
9196 if test -n "$direct_nspr_config"; then
9197 dnl ========================================================
9198 dnl = Setup a nice relatively clean build environment for
9199 dnl = sub-configures.
9200 dnl ========================================================
9203 CFLAGS="$_SUBDIR_CFLAGS"
9204 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9205 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9206 LDFLAGS="$_SUBDIR_LDFLAGS"
9207 HOST_CC="$_SUBDIR_HOST_CC"
9208 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9209 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9213 # Run the SpiderMonkey 'configure' script.
9214 dist=$MOZ_BUILD_ROOT/dist
9215 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9216 ac_configure_args="$ac_configure_args --enable-threadsafe"
9217 if test "$BUILD_CTYPES"; then
9218 # Build js-ctypes on the platforms we can.
9219 ac_configure_args="$ac_configure_args --enable-ctypes"
9221 if test -z "$JS_SHARED_LIBRARY" ; then
9222 ac_configure_args="$ac_configure_args --disable-shared-js"
9224 if test -z "$MOZ_NATIVE_NSPR"; then
9225 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9226 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9228 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9229 ac_configure_args="$ac_configure_args --prefix=$dist"
9230 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9231 if test "$MOZ_MEMORY"; then
9232 ac_configure_args="$ac_configure_args --enable-jemalloc"
9234 if test -n "$MOZ_GLUE_LDFLAGS"; then
9235 export MOZ_GLUE_LDFLAGS
9237 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9238 export MOZ_GLUE_PROGRAM_LDFLAGS
9241 AC_OUTPUT_SUBDIRS(js/src)
9242 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9244 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9246 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9247 dnl Needs to be at the end to respect possible changes from NSPR configure
9248 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9249 echo "config/autoconf.mk is unchanged"
9250 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9252 rm -f config/autoconf.mk.orig 2> /dev/null