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 ========================================================
125 WINDRES_VERSION=2.14.90
128 GNOMEUI_VERSION=2.2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
134 LIBNOTIFY_VERSION=0.4
138 dnl Set various checks
139 dnl ========================================================
143 dnl Initialize the Pthread test variables early so they can be
144 dnl overridden by each platform.
145 dnl ========================================================
149 dnl Do not allow a separate objdir build if a srcdir build exists.
150 dnl ==============================================================
151 _topsrcdir=`cd \`dirname $0\`; pwd`
154 if test "$_topsrcdir" != "$_objdir"
156 # Check for a couple representative files in the source tree
158 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
159 if test -f $file; then
160 _conflict_files="$_conflict_files $file"
163 if test "$_conflict_files"; then
165 echo "* Your source tree contains these files:"
166 for file in $_conflict_files; do
170 * This indicates that you previously built in the source tree.
171 * A source tree build can confuse the separate objdir build.
173 * To clean up the source tree:
184 dnl Default to MSVC for win32 and gcc-4.2 for darwin
185 dnl ==============================================================
186 if test -z "$CROSS_COMPILE"; then
189 if test -z "$CC"; then CC=cl; fi
190 if test -z "$CXX"; then CXX=cl; fi
191 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
192 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
193 if test -z "$LD"; then LD=link; fi
194 if test -z "$AS"; then
195 case "${target_cpu}" in
204 if test -z "$MIDL"; then MIDL=midl; fi
207 if test -z "$CC"; then CC=gcc-4.2; fi
208 if test -z "$CXX"; then CXX=g++-4.2; fi
213 COMPILE_ENVIRONMENT=1
214 MOZ_ARG_DISABLE_BOOL(compile-environment,
215 [ --disable-compile-environment
216 Disable compiler/library checks.],
217 COMPILE_ENVIRONMENT= )
218 AC_SUBST(COMPILE_ENVIRONMENT)
220 MOZ_ARG_WITH_STRING(l10n-base,
221 [ --with-l10n-base=DIR path to l10n repositories],
222 L10NBASEDIR=$withval)
223 if test -n "$L10NBASEDIR"; then
224 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
225 AC_MSG_ERROR([--with-l10n-base must specify a path])
226 elif test -d "$L10NBASEDIR"; then
227 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
229 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
232 AC_SUBST(L10NBASEDIR)
234 dnl Check for Perl first -- needed for win32 SDK checks
235 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
236 if test -z "$PERL" -o "$PERL" = ":"; then
237 AC_MSG_ERROR([perl not found in \$PATH])
240 dnl ========================================================
241 dnl = Android uses a very custom (hacky) toolchain; we need to do this
242 dnl = here, so that the compiler checks can succeed
243 dnl ========================================================
245 MOZ_ARG_WITH_STRING(android-ndk,
246 [ --with-android-ndk=DIR
247 location where the Android NDK can be found],
248 android_ndk=$withval)
250 MOZ_ARG_WITH_STRING(android-toolchain,
251 [ --with-android-toolchain=DIR
252 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
253 android_toolchain=$withval)
256 MOZ_ARG_WITH_STRING(android-version,
257 [ --with-android-version=VER
258 android platform version, default 5],
259 android_version=$withval,
262 MOZ_ARG_WITH_STRING(android-sdk,
263 [ --with-android-sdk=DIR
264 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
265 android_sdk=$withval)
267 MOZ_ARG_WITH_STRING(android-platform,
268 [ --with-android-platform=DIR
269 location of platform dir, default NDK/build/platforms/android-5/arch-arm],
270 android_platform=$withval)
272 MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
273 [ --enable-android-libstdcxx
274 use GNU libstdc++ instead of STLPort for NDK >= 5],
275 MOZ_ANDROID_LIBSTDCXX=1,
276 MOZ_ANDROID_LIBSTDCXX= )
279 arm-linux*-android*|*-linuxandroid*)
280 android_tool_prefix="arm-linux-androideabi"
283 android_tool_prefix="arm-eabi"
286 android_tool_prefix="$target_os"
291 *-android*|*-linuxandroid*)
292 if test -z "$android_ndk" ; then
293 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
296 if test -z "$android_sdk" ; then
297 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
300 android_platform_tools="$android_sdk"/../../platform-tools
301 if test ! -d "$android_platform_tools" ; then
302 android_platform_tools="$android_sdk"/tools # SDK Tools < r8
305 if test -z "$android_toolchain" ; then
306 AC_MSG_CHECKING([for android toolchain directory])
308 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
310 android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
312 # With newer NDK, the toolchain path has changed.
313 if ! test -d "$android_toolchain" ; then
314 android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
317 if test -d "$android_toolchain" ; then
318 AC_MSG_RESULT([$android_toolchain])
320 AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
324 if test -z "$android_platform" ; then
325 AC_MSG_CHECKING([for android platform directory])
327 android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
329 # With newer NDK, the platform path has changed.
330 if ! test -d "$android_platform" ; then
331 android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
334 if test -d "$android_platform" ; then
335 AC_MSG_RESULT([$android_platform])
337 AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
342 AS="$android_toolchain"/bin/"$android_tool_prefix"-as
343 CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
344 CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
345 CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
346 LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
347 AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
348 RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
349 STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
351 if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
352 if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libstdc++.a" ; then
353 AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
355 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
356 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a"
357 STLPORT_LIBS="-lstdc++"
358 elif test -e "$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
359 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
360 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/"
361 STLPORT_LIBS="-lstlport_static"
362 elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
363 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
364 STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/armeabi-v7a"
365 STLPORT_LIBS="-lstlport_static"
366 elif test "$target" != "arm-android-eabi"; then
367 dnl fail if we're not building with NDKr4
368 AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
371 CPPFLAGS="-I$android_platform/usr/include $STLPORT_CPPFLAGS $CPPFLAGS"
372 CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
373 CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
374 LIBS="$LIBS $STLPORT_LIBS"
376 dnl Add -llog by default, since we use it all over the place.
377 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
378 dnl undefined symbol (present on the hardware, just not in the
380 LDFLAGS="-mandroid $STLPORT_LDFLAGS -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
382 dnl prevent cross compile section from using these flags as host flags
383 if test -z "$HOST_CPPFLAGS" ; then
386 if test -z "$HOST_CFLAGS" ; then
389 if test -z "$HOST_CXXFLAGS" ; then
392 if test -z "$HOST_LDFLAGS" ; then
396 ANDROID_NDK="${android_ndk}"
397 ANDROID_TOOLCHAIN="${android_toolchain}"
398 ANDROID_PLATFORM="${android_platform}"
399 ANDROID_SDK="${android_sdk}"
400 ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
401 ANDROID_VERSION="${android_version}"
402 if test -z "$ANDROID_PACKAGE_NAME" ; then
403 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
407 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
408 AC_SUBST(ANDROID_VERSION)
410 MOZ_CHROME_FILE_FORMAT=omni
415 AC_SUBST(ANDROID_NDK)
416 AC_SUBST(ANDROID_TOOLCHAIN)
417 AC_SUBST(ANDROID_PLATFORM)
418 AC_SUBST(ANDROID_SDK)
419 AC_SUBST(ANDROID_PLATFORM_TOOLS)
420 AC_SUBST(ANDROID_PACKAGE_NAME)
422 dnl ========================================================
423 dnl Checks for compilers.
424 dnl ========================================================
425 dnl Set CROSS_COMPILE in the environment when running configure
426 dnl to use the cross-compile setup for now
427 dnl ========================================================
429 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
432 if test "$COMPILE_ENVIRONMENT"; then
434 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
435 echo "cross compiling from $host to $target"
439 _SAVE_CFLAGS="$CFLAGS"
440 _SAVE_LDFLAGS="$LDFLAGS"
442 AC_MSG_CHECKING([for host c compiler])
443 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
444 if test -z "$HOST_CC"; then
445 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
447 AC_MSG_RESULT([$HOST_CC])
448 AC_MSG_CHECKING([for host c++ compiler])
449 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
450 if test -z "$HOST_CXX"; then
451 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
453 AC_MSG_RESULT([$HOST_CXX])
455 if test -z "$HOST_CFLAGS"; then
456 HOST_CFLAGS="$CFLAGS"
458 if test -z "$HOST_CXXFLAGS"; then
459 HOST_CXXFLAGS="$CXXFLAGS"
461 if test -z "$HOST_LDFLAGS"; then
462 HOST_LDFLAGS="$LDFLAGS"
464 if test -z "$HOST_AR_FLAGS"; then
465 HOST_AR_FLAGS="$AR_FLAGS"
467 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
468 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
470 CFLAGS="$HOST_CFLAGS"
471 LDFLAGS="$HOST_LDFLAGS"
473 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
474 AC_TRY_COMPILE([], [return(0);],
475 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
476 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
479 CFLAGS="$HOST_CXXFLAGS"
481 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
482 AC_TRY_COMPILE([], [return(0);],
483 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
484 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
488 LDFLAGS=$_SAVE_LDFLAGS
490 case "$build:$target" in
491 powerpc-apple-darwin8*:i?86-apple-darwin*)
492 dnl The Darwin cross compiler doesn't necessarily point itself at a
493 dnl root that has libraries for the proper architecture, it defaults
494 dnl to the system root. The libraries in the system root on current
495 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
496 dnl checks will fail. Fake a working SDK in that case.
498 _SAVE_CXXFLAGS=$CXXLAGS
499 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
500 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
504 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
507 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
511 case "$build:$target" in
512 powerpc-apple-darwin8*:i?86-apple-darwin*)
513 dnl Revert the changes made above. From this point on, the target
514 dnl compiler will never be used without applying the SDK to CFLAGS
515 dnl (see --with-macos-sdk below).
517 CXXFLAGS=$_SAVE_CXXFLAGS
521 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
522 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
523 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
524 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
525 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
526 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
527 AC_DEFINE(CROSS_COMPILE)
532 MOZ_PATH_PROGS(AS, $AS as, $CC)
533 AC_CHECK_PROGS(AR, ar, :)
534 AC_CHECK_PROGS(LD, ld, :)
535 AC_CHECK_PROGS(STRIP, strip, :)
536 AC_CHECK_PROGS(WINDRES, windres, :)
537 if test -z "$HOST_CC"; then
540 if test -z "$HOST_CFLAGS"; then
541 HOST_CFLAGS='$(CFLAGS)'
543 if test -z "$HOST_CXX"; then
546 if test -z "$HOST_CXXFLAGS"; then
547 HOST_CXXFLAGS='$(CXXFLAGS)'
549 if test -z "$HOST_LDFLAGS"; then
550 HOST_LDFLAGS='$(LDFLAGS)'
552 if test -z "$HOST_RANLIB"; then
553 HOST_RANLIB='$(RANLIB)'
555 if test -z "$HOST_AR"; then
558 if test -z "$HOST_AR_FLAGS"; then
559 HOST_AR_FLAGS='$(AR_FLAGS)'
569 if test "$GCC" = "yes"; then
571 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
573 if test "$GXX" = "yes"; then
575 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
577 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
580 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
583 if test "$GNU_CC"; then
584 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
591 if test "$GCC" = yes; then
592 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
597 if test "$GXX" = yes; then
598 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
605 if test "$GCC" = yes; then
606 if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
611 if test "$GXX" = yes; then
612 if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
617 dnl ========================================================
618 dnl Special win32 checks
619 dnl ========================================================
621 dnl Target the Windows 7 SDK by default
624 MOZ_ARG_WITH_STRING(windows-version,
625 [ --with-windows-version=WINSDK_TARGETVER
626 Highest Windows version to target using this SDK
627 502: Windows Server 2003
630 WINSDK_TARGETVER=$withval)
632 case "$WINSDK_TARGETVER" in
634 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
638 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
643 if test -n "$COMPILE_ENVIRONMENT"; then
644 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
645 # We can't build parental controls either
646 MOZ_DISABLE_PARENTAL_CONTROLS=1
652 if test "$GCC" != "yes"; then
653 # Check to see if we are really running in a msvc environemnt
655 AC_CHECK_PROGS(MIDL, midl)
657 # Make sure compilers are valid
658 CFLAGS="$CFLAGS -TC -nologo"
659 CXXFLAGS="$CXXFLAGS -TP -nologo"
662 AC_TRY_COMPILE([#include <stdio.h>],
663 [ printf("Hello World\n"); ],,
664 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
667 AC_TRY_COMPILE([#include <new.h>],
668 [ unsigned *test = new unsigned(42); ],,
669 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
673 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
676 # Determine compiler version
677 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
678 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
679 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
680 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
681 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
682 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
684 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
685 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
687 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
688 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
691 if test "$_CC_MAJOR_VERSION" = "14"; then
692 dnl Require VC8SP1 or newer.
693 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
694 if test "$_CC_RELEASE" -lt 50727 -o \
695 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
696 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.])
700 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
701 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
702 elif test "$_CC_MAJOR_VERSION" = "15"; then
704 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
705 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
706 elif test "$_CC_MAJOR_VERSION" = "16"; then
708 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
709 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
711 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
714 _MOZ_RTTI_FLAGS_ON='-GR'
715 _MOZ_RTTI_FLAGS_OFF='-GR-'
716 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
717 _MOZ_EXCEPTIONS_FLAGS_OFF=''
718 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
720 if test -n "$WIN32_REDIST_DIR"; then
721 if test ! -d "$WIN32_REDIST_DIR"; then
722 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
724 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
727 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
728 dnl not something else like "magnetic tape manipulation utility".
729 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
730 if test -z "$MSMT_TOOL"; then
731 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
735 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
737 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
738 if test -z "$MSMANIFEST_TOOL_VERSION"; then
739 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
745 # Check linker version
746 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
747 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
748 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
749 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
755 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
756 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
757 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
758 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
759 # Add flags if necessary
760 AC_MSG_CHECKING([for midl flags])
763 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
764 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
765 # MIDL version 7.00.0500 or later has no problem.
766 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
767 AC_MSG_RESULT([need -env win32])
769 AC_MSG_RESULT([none needed])
773 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
776 AC_MSG_RESULT([none needed])
780 # Identify which version of the SDK we're building with
781 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
783 MOZ_CHECK_HEADERS([winsdkver.h])
784 if test "$ac_cv_header_winsdkver_h" = "yes"; then
785 # Get the highest _WIN32_WINNT and NTDDI versions supported
786 # Take the higher of the two
787 # This is done because the Windows 7 beta SDK reports its
788 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
789 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
791 [cat > conftest.h <<EOF
792 #include <winsdkver.h>
793 #include <sdkddkver.h>
795 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
796 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
798 #define WINSDK_MAXVER NTDDI_MAXVER
803 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
806 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
808 # The Vista SDK is the only one to have sdkddkver.h but not
810 MOZ_CHECK_HEADERS([sdkddkver.h])
811 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
812 MOZ_WINSDK_MAXVER=0x06000000
814 # Assume the Server 2003 Platform SDK
815 MOZ_WINSDK_MAXVER=0x05020000
819 unset _MSVC_VER_FILTER
821 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
825 _SAVE_CXXFLAGS="$CXXFLAGS"
826 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
827 AC_TRY_COMPILE([#include <exception>],
828 [std::_Throw(std::exception()); return 0;],
829 ac_cv_have_std__Throw="yes",
830 ac_cv_have_std__Throw="no")
831 CXXFLAGS="$_SAVE_CXXFLAGS"
835 if test "$ac_cv_have_std__Throw" = "yes"; then
836 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
837 ac_cv_have_dllimport_exception_bug,
841 _SAVE_CXXFLAGS="$CXXFLAGS"
842 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
843 AC_TRY_LINK([#include <vector>],
844 [std::vector<int> v; return v.at(1);],
845 ac_cv_have_dllimport_exception_bug="no",
846 ac_cv_have_dllimport_exception_bug="yes")
847 CXXFLAGS="$_SAVE_CXXFLAGS"
850 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
852 MOZ_MSVC_STL_WRAP__Throw=1
853 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
856 AC_CACHE_CHECK(for overridable _RAISE,
861 _SAVE_CXXFLAGS="$CXXFLAGS"
862 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
863 AC_TRY_COMPILE([#include <xstddef>
865 #define _RAISE(x) externallyDefinedFunction((x).what())
868 [std::vector<int> v; return v.at(1);],
869 ac_cv_have__RAISE="no",
870 ac_cv_have__RAISE="yes")
871 CXXFLAGS="$_SAVE_CXXFLAGS"
874 if test "$ac_cv_have__RAISE" = "yes"; then
876 MOZ_MSVC_STL_WRAP__RAISE=1
877 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
879 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
883 if test "$WRAP_STL_INCLUDES" = "1"; then
884 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
887 # Check w32api version
888 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
889 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
890 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
891 AC_TRY_COMPILE([#include <w32api.h>],
892 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
893 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
894 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
895 #error "test failed."
897 , [ res=yes ], [ res=no ])
898 AC_MSG_RESULT([$res])
899 if test "$res" != "yes"; then
900 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
902 # Check windres version
903 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
904 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
905 AC_MSG_RESULT([$_WINDRES_VERSION])
906 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
907 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
908 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
909 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
910 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
911 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
912 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
913 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
914 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
915 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
916 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
917 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
919 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
922 MOZ_WINSDK_MAXVER=0x06010000
925 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
926 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
927 # Require OS features provided by IE 5.0
928 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
930 # If the maximum version supported by this SDK is lower than the target
932 AC_MSG_CHECKING([for Windows SDK being recent enough])
933 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
937 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.])
940 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
941 # Definitions matching sdkddkver.h
942 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
943 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
944 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
948 dnl Test breaks icc on OS/2 && MSVC
949 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
951 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
955 CC="${srcdir}/build/hcc '$CC'"
956 CXX="${srcdir}/build/hcpp '$CXX'"
963 if test -n "$_WIN32_MSVC"; then
965 SKIP_COMPILER_CHECKS=1
966 SKIP_LIBRARY_CHECKS=1
968 # Since we're skipping compiler and library checks, hard-code
971 AC_DEFINE(HAVE_SETBUF)
972 AC_DEFINE(HAVE_ISATTY)
975 fi # COMPILE_ENVIRONMENT
990 AC_SUBST(WRAP_STL_INCLUDES)
991 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
992 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
994 dnl ========================================================
995 dnl Checks for programs.
996 dnl ========================================================
1000 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
1001 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
1002 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
1004 AC_MSG_RESULT([$_perl_version])
1006 if test "$_perl_res" != 0; then
1007 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
1011 AC_MSG_CHECKING([for full perl installation])
1012 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
1014 if test "$_perl_res" != 0; then
1016 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
1018 AC_MSG_RESULT([yes])
1021 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
1022 if test -z "$PYTHON"; then
1023 AC_MSG_ERROR([python was not found in \$PATH])
1026 if test -z "$COMPILE_ENVIRONMENT"; then
1027 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1029 AC_SUBST(NSINSTALL_BIN)
1031 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1032 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1033 MOZ_PATH_PROGS(UNZIP, unzip)
1034 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
1035 AC_MSG_ERROR([unzip not found in \$PATH])
1037 MOZ_PATH_PROGS(ZIP, zip)
1038 if test -z "$ZIP" -o "$ZIP" = ":"; then
1039 AC_MSG_ERROR([zip not found in \$PATH])
1041 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1042 MOZ_PATH_PROG(XARGS, xargs)
1043 if test -z "$XARGS" -o "$XARGS" = ":"; then
1044 AC_MSG_ERROR([xargs not found in \$PATH .])
1047 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
1050 if test "$COMPILE_ENVIRONMENT"; then
1052 dnl ========================================================
1053 dnl = Mac OS X toolchain support
1054 dnl ========================================================
1056 case "$target_os" in
1058 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1059 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1060 dnl the environment and includedir purposes (when using an SDK, below),
1061 dnl but remember the full version number for the libdir (SDK).
1063 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1064 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1066 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1067 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1068 dnl 4.0.0/4061 is the default compiler in Tiger.
1070 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1072 if test "$GCC_BUILD" = "4061" ; then
1073 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1074 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1075 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1079 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1080 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1081 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1082 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1084 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1085 dnl it has moved into /usr/bin.
1086 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1090 AC_SUBST(GCC_VERSION)
1092 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1093 dnl that a universal binary is being produced.
1094 AC_SUBST(UNIVERSAL_BINARY)
1096 dnl ========================================================
1097 dnl Check for MacOS deployment target version
1098 dnl ========================================================
1100 MOZ_ARG_ENABLE_STRING(macos-target,
1101 [ --enable-macos-target=VER (default=10.5)
1102 Set the minimum MacOS version needed at runtime],
1103 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1107 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1108 dnl Use the specified value
1109 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1111 dnl No value specified on the command line or in the environment,
1112 dnl use architecture minimum.
1113 case "${target_cpu}" in
1115 export MACOSX_DEPLOYMENT_TARGET=10.5
1118 export MACOSX_DEPLOYMENT_TARGET=10.5
1121 export MACOSX_DEPLOYMENT_TARGET=10.6
1128 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1130 dnl ========================================================
1131 dnl = Mac OS X SDK support
1132 dnl ========================================================
1135 MOZ_ARG_WITH_STRING(macos-sdk,
1136 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1137 MACOS_SDK_DIR=$withval)
1139 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1140 dnl NEXT_ROOT will be set and exported only if it's needed.
1141 AC_SUBST(MACOS_SDK_DIR)
1144 if test "$MACOS_SDK_DIR"; then
1145 dnl Sync this section with the ones in NSPR and NSS.
1146 dnl Changes to the cross environment here need to be accounted for in
1147 dnl the libIDL checks (below) and xpidl build.
1149 if test ! -d "$MACOS_SDK_DIR"; then
1150 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1151 specify a valid SDK. SDKs are installed when the optional cross-development
1152 tools are selected during the Xcode/Developer Tools installation.])
1155 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1156 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1157 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1159 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1160 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1162 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1163 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1164 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1166 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1167 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1168 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1169 dnl be ignored and cause warnings when -syslibroot is specified.
1170 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1171 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1172 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1177 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1179 AC_TRY_COMPILE([#include <new>],[],
1183 AC_MSG_RESULT($result)
1185 if test "$result" = "no" ; then
1186 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1190 fi # COMPILE_ENVIRONMENT
1192 dnl clang prior to 2.9 (including Xcode 4) does not support all the
1193 dnl constructs required by the libtheora inline asm. This is used to
1194 dnl detect and disable it
1198 #if defined(__clang__)
1199 # if __clang_major__<2 || (__clang_major__==2 && __clang_minor__<9)
1200 # error "clang older than 2.9 detected"
1207 if test "$result" = "no"; then
1208 AC_DEFINE(HAVE_OLD_CLANG)
1212 AC_SUBST(HAVE_OLD_CLANG)
1214 if test -n "$MAKE"; then
1215 if test `echo $MAKE | grep -c make.py` != 1; then
1222 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1225 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1228 if test "$GMAKE" = ":"; then
1229 AC_MSG_ERROR([GNU make not found])
1233 if test "$COMPILE_ENVIRONMENT"; then
1239 fi # COMPILE_ENVIRONMENT
1241 dnl ========================================================
1242 dnl set the defaults first
1243 dnl ========================================================
1246 AR_EXTRACT='$(AR) x'
1260 MOZ_USER_DIR=".mozilla"
1263 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1265 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1267 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1269 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1271 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1272 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1273 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1274 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1275 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1276 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1277 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1278 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1282 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1284 USE_DEPENDENT_LIBS=1
1286 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1288 if test -n "$CROSS_COMPILE"; then
1289 OS_TARGET="${target_os}"
1290 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1292 case "${target_os}" in
1293 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1294 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1295 gnu*) OS_ARCH=GNU ;;
1296 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1297 mingw*) OS_ARCH=WINNT ;;
1298 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1301 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1304 OS_TARGET=`uname -s`
1305 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1306 OS_RELEASE=`uname -r`
1309 # Before this used `uname -m` when not cross compiling
1310 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1311 OS_TEST="${target_cpu}"
1315 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1317 #######################################################################
1318 # Master "Core Components" macros for getting the OS target #
1319 #######################################################################
1322 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1323 # cross-compilation.
1327 # Define and override various archtecture-specific variables, including
1336 case "$HOST_OS_ARCH" in
1350 if test -z "$GNU_CC"; then
1351 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1356 if test -z "$GNU_CXX"; then
1357 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1358 SOLARIS_SUNPRO_CXX=1
1361 AC_SUBST(SOLARIS_SUNPRO_CC)
1362 AC_SUBST(SOLARIS_SUNPRO_CXX)
1374 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1377 HOST_OS_ARCH=UNIXWARE
1394 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1398 HOST_OS_ARCH=UNIXWARE
1404 if test -z "$CROSS_COMPILE" ; then
1410 # If uname -s returns "Windows_NT", we assume that we are using
1411 # the uname.exe in MKS toolkit.
1413 # The -r option of MKS uname only returns the major version number.
1414 # So we need to use its -v option to get the minor version number.
1415 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1419 OS_MINOR_RELEASE=`uname -v`
1420 if test "$OS_MINOR_RELEASE" = "00"; then
1423 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1427 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1428 # the uname.exe in the MSYS tools.
1430 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1435 OS_RELEASE=`uname -v`.`uname -r`
1436 OS_TEST=${target_cpu}
1448 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1452 OS_RELEASE=`uname -v`
1477 OS_RELEASE=`uname -v`
1483 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1489 OS_RELEASE=`uname -v`
1492 case "${target_cpu}" in
1503 if test -z "$CROSS_COMPILE" ; then
1511 if test "$OS_ARCH" = "NCR"; then
1513 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1517 # Only set CPU_ARCH if we recognize the value of OS_TEST
1528 powerpc | ppc | rs6000)
1532 Alpha | alpha | ALPHA)
1565 if test -z "$OS_TARGET"; then
1568 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1570 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1571 dnl ===============================================================
1575 INTEL_ARCHITECTURE=1
1578 dnl ========================================================
1579 dnl GNU specific defaults
1580 dnl ========================================================
1581 if test "$GNU_CC"; then
1582 # FIXME: Let us build with strict aliasing. bug 414641.
1583 CFLAGS="$CFLAGS -fno-strict-aliasing"
1584 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1585 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1586 DSO_LDOPTS='-shared'
1587 if test "$GCC_USE_GNU_LD"; then
1588 # Don't allow undefined symbols in libraries
1589 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1591 WARNINGS_AS_ERRORS='-Werror'
1593 DSO_PIC_CFLAGS='-fPIC'
1594 ASFLAGS="$ASFLAGS -fPIC"
1595 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1596 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1597 _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1598 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1600 # Turn on GNU specific features
1601 # -Wall - turn on all warnings
1602 # -pedantic - make compiler warn about non-ANSI stuff, and
1603 # be a little bit stricter
1604 # -Wdeclaration-after-statement - MSVC doesn't like these
1605 # Warnings slamm took out for now (these were giving more noise than help):
1606 # -Wbad-function-cast - warns when casting a function to a new return type
1607 # -Wshadow - removed because it generates more noise than help --pete
1608 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith -Wdeclaration-after-statement"
1609 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1610 # Don't use -Wcast-align with ICC or clang
1612 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1613 hppa | ia64 | sparc | arm)
1616 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1621 dnl Turn pedantic on but disable the warnings for long long
1624 if test -z "$INTEL_CC"; then
1625 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1628 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1629 _USE_CPP_INCLUDE_FLAG=1
1630 elif test "$SOLARIS_SUNPRO_CC"; then
1632 if test "$CPU_ARCH" = "sparc"; then
1633 # for Sun Studio on Solaris/SPARC
1634 DSO_PIC_CFLAGS='-xcode=pic32'
1636 DSO_PIC_CFLAGS='-KPIC'
1638 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1640 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1641 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1643 DSO_LDOPTS='-shared'
1644 if test "$GNU_LD"; then
1645 # Don't allow undefined symbols in libraries
1646 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1650 DSO_PIC_CFLAGS='-KPIC'
1651 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1654 if test "$GNU_CXX"; then
1655 # FIXME: Let us build with strict aliasing. bug 414641.
1656 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1657 # Turn on GNU specific features
1658 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1659 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1660 # Don't use -Wcast-align with ICC or clang
1662 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1663 hppa | ia64 | sparc | arm)
1666 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1671 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1672 _USE_CPP_INCLUDE_FLAG=1
1674 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1675 ac_has_wno_invalid_offsetof,
1679 _SAVE_CXXFLAGS="$CXXFLAGS"
1680 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1683 ac_has_wno_invalid_offsetof="yes",
1684 ac_has_wno_invalid_offsetof="no")
1685 CXXFLAGS="$_SAVE_CXXFLAGS"
1688 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1689 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1692 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1693 ac_has_wno_variadic_macros,
1697 _SAVE_CXXFLAGS="$CXXFLAGS"
1698 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1701 ac_has_wno_variadic_macros="yes",
1702 ac_has_wno_variadic_macros="no")
1703 CXXFLAGS="$_SAVE_CXXFLAGS"
1706 if test "$ac_has_wno_variadic_macros" = "yes"; then
1707 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1710 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1711 ac_has_werror_return_type,
1715 _SAVE_CXXFLAGS="$CXXFLAGS"
1716 CXXFLAGS="$CXXFLAGS -Werror=return-type"
1719 ac_has_werror_return_type="yes",
1720 ac_has_werror_return_type="no")
1721 CXXFLAGS="$_SAVE_CXXFLAGS"
1724 if test "$ac_has_werror_return_type" = "yes"; then
1725 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1729 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1732 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1733 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1734 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1735 dnl normal behavior.
1736 dnl ========================================================
1738 MKSHLIB_UNFORCE_ALL=
1740 if test "$COMPILE_ENVIRONMENT"; then
1741 if test "$GNU_CC"; then
1742 AC_MSG_CHECKING(whether ld has archive extraction flags)
1743 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1744 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1745 ac_cv_mkshlib_force_and_unforce="no"
1746 exec 3<&0 <<LOOP_INPUT
1747 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1748 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1749 force="-Wl,-all"; unforce="-Wl,-none"
1756 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1759 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1761 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1765 eval $ac_cv_mkshlib_force_and_unforce
1766 MKSHLIB_FORCE_ALL=$force
1767 MKSHLIB_UNFORCE_ALL=$unforce
1770 fi # COMPILE_ENVIRONMENT
1772 dnl =================================================================
1773 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1774 dnl which is bad when cross compiling.
1775 dnl =================================================================
1776 if test "$COMPILE_ENVIRONMENT"; then
1777 configure_static_assert_macros='
1778 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1779 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1780 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1783 dnl test that the macros actually work:
1784 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1785 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1788 ac_cv_static_assertion_macros_work="yes"
1789 AC_TRY_COMPILE([$configure_static_assert_macros],
1790 [CONFIGURE_STATIC_ASSERT(1)],
1792 ac_cv_static_assertion_macros_work="no")
1793 AC_TRY_COMPILE([$configure_static_assert_macros],
1794 [CONFIGURE_STATIC_ASSERT(0)],
1795 ac_cv_static_assertion_macros_work="no",
1798 AC_TRY_COMPILE([$configure_static_assert_macros],
1799 [CONFIGURE_STATIC_ASSERT(1)],
1801 ac_cv_static_assertion_macros_work="no")
1802 AC_TRY_COMPILE([$configure_static_assert_macros],
1803 [CONFIGURE_STATIC_ASSERT(0)],
1804 ac_cv_static_assertion_macros_work="no",
1808 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1809 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1810 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1812 fi # COMPILE_ENVIRONMENT
1814 dnl ========================================================
1815 dnl Checking for 64-bit OS
1816 dnl ========================================================
1817 if test "$COMPILE_ENVIRONMENT"; then
1820 AC_MSG_CHECKING(for 64-bit OS)
1821 AC_TRY_COMPILE([$configure_static_assert_macros],
1822 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1823 result="yes", result="no")
1824 AC_MSG_RESULT("$result")
1825 if test "$result" = "yes"; then
1826 AC_DEFINE(HAVE_64BIT_OS)
1829 AC_SUBST(HAVE_64BIT_OS)
1831 fi # COMPILE_ENVIRONMENT
1833 dnl ========================================================
1834 dnl Enable high-memory support on OS/2 by default.
1835 dnl ========================================================
1836 MOZ_OS2_HIGH_MEMORY=1
1837 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1838 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1839 MOZ_OS2_HIGH_MEMORY=,
1840 MOZ_OS2_HIGH_MEMORY=1 )
1841 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1843 dnl ========================================================
1844 dnl = Use profiling compile flags
1845 dnl ========================================================
1846 MOZ_ARG_ENABLE_BOOL(profiling,
1847 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1851 dnl ========================================================
1853 dnl ========================================================
1854 MOZ_ARG_ENABLE_BOOL(valgrind,
1855 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1858 if test -n "$MOZ_VALGRIND"; then
1859 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1861 [--enable-valgrind specified but Valgrind is not installed]))
1862 AC_DEFINE(MOZ_VALGRIND)
1865 AC_SUBST(MOZ_VALGRIND)
1867 dnl ========================================================
1869 dnl ========================================================
1870 MOZ_ARG_ENABLE_BOOL(jprof,
1871 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1874 if test -n "$MOZ_JPROF"; then
1876 AC_DEFINE(MOZ_JPROF)
1879 dnl ========================================================
1881 dnl ========================================================
1882 MOZ_ARG_ENABLE_BOOL(shark,
1883 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1886 if test -n "$MOZ_SHARK"; then
1888 AC_DEFINE(MOZ_SHARK)
1891 dnl ========================================================
1893 dnl ========================================================
1894 MOZ_ARG_ENABLE_BOOL(callgrind,
1895 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1898 if test -n "$MOZ_CALLGRIND"; then
1900 AC_DEFINE(MOZ_CALLGRIND)
1903 dnl ========================================================
1905 dnl ========================================================
1906 MOZ_ARG_ENABLE_BOOL(vtune,
1907 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1910 if test -n "$MOZ_VTUNE"; then
1912 AC_DEFINE(MOZ_VTUNE)
1915 dnl ========================================================
1917 dnl ========================================================
1918 if test -n "$MOZ_PROFILING"; then
1919 AC_DEFINE(MOZ_PROFILING)
1922 dnl ========================================================
1923 dnl System overrides of the defaults for host
1924 dnl ========================================================
1927 if test -n "$_WIN32_MSVC"; then
1929 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1930 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1931 HOST_RANLIB='echo ranlib'
1933 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1935 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1936 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1937 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1938 HOST_BIN_SUFFIX=.exe
1941 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1945 case "${host_cpu}" in
1947 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1953 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1954 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1955 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1958 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1959 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1960 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1961 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1965 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1966 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1967 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1968 HOST_BIN_SUFFIX=.exe
1973 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1974 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1975 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1979 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1980 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1984 dnl We require version 2.5 or newer of Python to build.
1985 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1987 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1990 if test "$_python_res" != 0; then
1991 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1993 AC_MSG_RESULT([yes])
1995 dnl Get mozilla version from central milestone file
1996 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1998 dnl Get version of various core apps from the version files.
1999 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
2001 if test -z "$FIREFOX_VERSION"; then
2002 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
2005 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
2006 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
2008 MOZ_DOING_LTO(lto_is_enabled)
2010 dnl ========================================================
2011 dnl System overrides of the defaults for target
2012 dnl ========================================================
2017 if test ! "$GNU_CC"; then
2018 if test ! "$HAVE_64BIT_OS"; then
2019 # Compiling with Visual Age C++ object model compat is the
2020 # default. To compile with object model ibm, add
2021 # AIX_OBJMODEL=ibm to .mozconfig.
2022 if test "$AIX_OBJMODEL" = "ibm"; then
2023 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
2030 AC_SUBST(AIX_OBJMODEL)
2031 DSO_LDOPTS='-qmkshrobj=1'
2032 DSO_CFLAGS='-qflag=w:w'
2034 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
2036 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2037 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2038 if test "$COMPILE_ENVIRONMENT"; then
2041 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
2043 [#if (__IBMCPP__ < 900)
2044 #error "Bad compiler"
2046 _BAD_COMPILER=,_BAD_COMPILER=1)
2047 if test -n "$_BAD_COMPILER"; then
2049 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
2051 AC_MSG_RESULT([yes])
2054 TARGET_COMPILER_ABI="ibmc"
2055 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
2056 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
2059 case "${target_os}" in
2064 if test "$COMPILE_ENVIRONMENT"; then
2065 MOZ_CHECK_HEADERS(sys/inttypes.h)
2067 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2071 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2080 _WARNINGS_CFLAGS="-Wall"
2081 _WARNINGS_CXXFLAGS="-Wall"
2082 # The test above doesn't work properly, at least on 3.1.
2083 MKSHLIB_FORCE_ALL=''
2084 MKSHLIB_UNFORCE_ALL=''
2090 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2091 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2092 # If we're building with --enable-profiling, we need a frame pointer.
2093 if test -z "$MOZ_PROFILING"; then
2094 MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2096 MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2099 CFLAGS="$CFLAGS -fno-common"
2100 CXXFLAGS="$CXXFLAGS -fno-common"
2103 STRIP="$STRIP -x -S"
2104 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2105 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2106 # The ExceptionHandling framework is needed for Objective-C exception
2107 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2109 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2111 if test "x$lto_is_enabled" = "xyes"; then
2112 echo "Skipping -dead_strip because lto is enabled."
2113 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2114 dnl ===================================================================
2115 elif test "x$enable_dtrace" = "xyes"; then
2116 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2118 dnl check for the presence of the -dead_strip linker flag
2119 AC_MSG_CHECKING([for -dead_strip option to ld])
2120 _SAVE_LDFLAGS=$LDFLAGS
2121 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2122 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2123 if test -n "$_HAVE_DEAD_STRIP" ; then
2124 AC_MSG_RESULT([yes])
2125 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2130 LDFLAGS=$_SAVE_LDFLAGS
2132 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2136 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2137 DLL_SUFFIX=".so.1.0"
2138 DSO_LDOPTS="-shared"
2140 if test ! "$GNU_CC"; then
2141 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2147 if test ! "$GNU_CC"; then
2151 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2152 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2153 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2156 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2157 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2161 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2162 AC_DEFINE(_LARGEFILE64_SOURCE)
2167 if test ! "$GNU_CC"; then
2168 DSO_LDOPTS='-b -Wl,+s'
2171 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2172 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2173 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2175 DSO_LDOPTS='-b -E +s'
2176 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2177 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2179 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2180 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2185 DSO_LDOPTS='-elf -shared'
2187 if test "$GNU_CC"; then
2188 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2189 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2190 MKSHLIB_FORCE_ALL='-Wl,-all'
2191 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2192 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2194 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2195 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2196 MKSHLIB_FORCE_ALL='-all'
2197 MKSHLIB_UNFORCE_ALL='-none'
2203 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
2204 dnl compile and link using -n32
2206 TARGET_COMPILER_ABI=n32
2207 DSO_LDOPTS='-elf -shared'
2208 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2209 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2210 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2211 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2212 if test "$GNU_CC"; then
2213 MKSHLIB_FORCE_ALL='-Wl,-all'
2214 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2215 _WARNINGS_CFLAGS="-Wall"
2216 _WARNINGS_CXXFLAGS="-Wall"
2217 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2219 MKSHLIB_FORCE_ALL='-all'
2220 MKSHLIB_UNFORCE_ALL='-none'
2226 CFLAGS="$CFLAGS -woff 3262 -G 4"
2227 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2228 if test -n "$USE_N32"; then
2229 ASFLAGS="$ASFLAGS -n32"
2230 CFLAGS="$CFLAGS -n32"
2231 CXXFLAGS="$CXXFLAGS -n32"
2232 LDFLAGS="$LDFLAGS -n32"
2234 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2235 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2238 if test -z "$GNU_CXX"; then
2243 *-android*|*-linuxandroid*)
2244 AC_DEFINE(NO_PW_GECOS)
2246 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2247 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2249 MOZ_GFX_OPTIMIZE_MOBILE=1
2250 # If we're building with --enable-profiling, we need a frame pointer.
2251 if test -z "$MOZ_PROFILING"; then
2252 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2254 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2259 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2260 # Similarly for GNU_CXX and INTEL_CXX.
2261 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2262 # -Os has been broken on Intel's C/C++ compilers for quite a
2263 # while; Intel recommends against using it.
2264 MOZ_OPTIMIZE_FLAGS="-O2"
2265 MOZ_DEBUG_FLAGS="-g"
2266 elif test "$GNU_CC" -o "$GNU_CXX"; then
2267 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2268 case $GCC_VERSION in
2270 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2271 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2273 # If we're building with --enable-profiling, we need a frame pointer.
2274 if test -z "$MOZ_PROFILING"; then
2275 MOZ_FRAMEPTR_FLAGS="-fomit-frame-pointer"
2277 MOZ_FRAMEPTR_FLAGS="-fno-omit-frame-pointer"
2279 MOZ_PGO_OPTIMIZE_FLAGS="-O3 $MOZ_FRAMEPTR_FLAGS"
2280 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK $MOZ_FRAMEPTR_FLAGS"
2281 MOZ_DEBUG_FLAGS="-g"
2284 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2288 case "${target_cpu}" in
2290 CFLAGS="$CFLAGS -mieee"
2291 CXXFLAGS="$CXXFLAGS -mieee"
2297 MOZ_DEBUG_FLAGS="-g" # We want inlining
2301 if test -z "$MC"; then
2311 # certain versions of cygwin's makedepend barf on the
2312 # #include <string> vs -I./dist/include/string issue so don't use it
2314 if test -n "$GNU_CC"; then
2316 CXX="$CXX -mwindows"
2317 CPP="$CPP -mwindows"
2318 CFLAGS="$CFLAGS -mms-bitfields"
2319 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2320 DSO_LDOPTS='-shared'
2321 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2322 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2324 # Use temp file for windres (bug 213281)
2325 RCFLAGS='-O coff --use-temp-file'
2326 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2327 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2329 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2330 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2332 IMPORT_LIB_SUFFIX=dll.a
2333 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2335 TARGET_COMPILER_ABI=msvc
2339 if test "$AS_BIN"; then
2340 AS="$(basename "$AS_BIN")"
2343 AR_FLAGS='-NOLOGO -OUT:"$@"'
2345 RANLIB='echo not_ranlib'
2346 STRIP='echo not_strip'
2352 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2358 IMPORT_LIB_SUFFIX=lib
2359 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2360 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2362 MKSHLIB_UNFORCE_ALL=
2363 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2364 _USE_CPP_INCLUDE_FLAG=1
2365 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2366 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2367 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2368 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2369 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2370 # make 'foo == bar;' error out
2371 CFLAGS="$CFLAGS -we4553"
2372 CXXFLAGS="$CXXFLAGS -we4553"
2373 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2374 MOZ_DEBUG_FLAGS='-Zi'
2375 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2376 WARNINGS_AS_ERRORS='-WX'
2377 # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2378 if test -z "$MOZ_PROFILING"; then
2379 MOZ_OPTIMIZE_FLAGS='-O1'
2381 MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2384 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2385 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2386 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2387 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2388 if test $_MSC_VER -ge 1400; then
2389 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2390 dnl For profile-guided optimization
2391 PROFILE_GEN_CFLAGS="-GL"
2392 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2393 dnl XXX: PGO builds can fail with warnings treated as errors,
2394 dnl specifically "no profile data available" appears to be
2395 dnl treated as an error sometimes. This might be a consequence
2396 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2397 dnl with the linker doing most of the work in the whole-program
2398 dnl optimization/PGO case. I think it's probably a compiler bug,
2399 dnl but we work around it here.
2400 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2401 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2402 dnl Probably also a compiler bug, but what can you do?
2403 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2404 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2407 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2408 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2409 AC_DEFINE(HAVE_SNPRINTF)
2414 AC_DEFINE(HW_THREADS)
2415 AC_DEFINE(STDC_HEADERS)
2416 AC_DEFINE(NEW_H, <new>)
2417 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2418 TARGET_MD_ARCH=win32
2419 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2421 MOZ_USER_DIR="Mozilla"
2423 dnl Hardcode to win95 for now - cls
2424 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2426 dnl set NO_X11 defines here as the general check is skipped on win32
2432 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2438 if test -z "$MOZ_TOOLS"; then
2439 AC_MSG_ERROR([MOZ_TOOLS is not set])
2441 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2442 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2443 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2445 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2446 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2447 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2454 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.])
2457 AC_CHECK_HEADERS(oleacc.idl)
2460 MOZ_CHECK_HEADERS(atlbase.h)
2467 if test "$HAVE_64BIT_OS"; then
2468 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2471 if test $_MSC_VER -ge 1400; then
2472 LDFLAGS="$LDFLAGS -SAFESEH"
2475 if test -n "$GNU_CC"; then
2476 CFLAGS="$CFLAGS -mstackrealign"
2477 CXXFLAGS="$CXXFLAGS -mstackrealign"
2480 MOZ_CHECK_HEADERS(mmintrin.h)
2487 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2491 if test "$HAVE_64BIT_OS"; then
2498 CFLAGS="$CFLAGS -Dunix"
2499 CXXFLAGS="$CXXFLAGS -Dunix"
2500 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2502 DSO_PIC_CFLAGS='-fPIC -DPIC'
2503 DSO_LDOPTS='-shared'
2504 BIN_FLAGS='-Wl,--export-dynamic'
2506 DSO_PIC_CFLAGS='-fPIC -DPIC'
2507 DLL_SUFFIX=".so.1.0"
2508 DSO_LDOPTS='-shared'
2510 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2511 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2512 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2513 if test "$LIBRUNPATH"; then
2514 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2516 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2517 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2521 if test "$SO_VERSION"; then
2522 DLL_SUFFIX=".so.$SO_VERSION"
2524 DLL_SUFFIX=".so.1.0"
2526 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2528 DSO_PIC_CFLAGS='-fPIC'
2529 DSO_LDOPTS='-shared -fPIC'
2530 if test "$LIBRUNPATH"; then
2531 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2536 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2537 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2540 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2541 AC_DEFINE(TCPV40HDRS)
2547 IMPORT_LIB_SUFFIX=lib
2551 CFLAGS="$CFLAGS -Zomf"
2552 CXXFLAGS="$CXXFLAGS -Zomf"
2554 BIN_FLAGS='-Zlinker /ST:0x100000'
2558 WARNINGS_AS_ERRORS='-Werror'
2559 MOZ_DEBUG_FLAGS="-g -fno-inline"
2560 MOZ_OPTIMIZE_FLAGS="-O2"
2561 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2562 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2563 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2565 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2569 MOZ_USER_DIR="Mozilla"
2572 if test "$MOZTOOLS"; then
2573 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2575 AC_MSG_ERROR([MOZTOOLS is not set])
2577 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2578 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2579 LDFLAGS="$LDFLAGS -Zhigh-mem"
2580 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2581 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2584 # GCC for OS/2 currently predefines these, but we don't want them
2585 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2586 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2588 AC_CACHE_CHECK(for __declspec(dllexport),
2590 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2592 ac_os2_declspec="yes",
2593 ac_os2_declspec="no")])
2594 if test "$ac_os2_declspec" != "yes"; then
2595 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2600 if test "$GNU_CC"; then
2601 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2602 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2605 MOZ_DEBUG_FLAGS='-g'
2606 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2607 CFLAGS="$CFLAGS -ieee"
2608 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2609 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2612 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2613 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2614 MKSHLIB_FORCE_ALL='-all'
2615 MKSHLIB_UNFORCE_ALL='-none'
2616 dnl Might fix the libxpcom.so breakage on this platform as well....
2617 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2618 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2620 if test -z "$GNU_CXX"; then
2623 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2627 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2628 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2629 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2630 if test ! "$GNU_CC"; then
2637 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2640 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2641 # libraries one level up (e.g. libnspr4.so)
2642 if test "$SOLARIS_SUNPRO_CC"; then
2643 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2644 LIBS="-lCrun -lCstd -lc $LIBS"
2646 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2647 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2648 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2649 _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2650 _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2651 LDFLAGS="-xildoff $LDFLAGS"
2652 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2653 _SAVE_LDFLAGS=$LDFLAGS
2654 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2655 AC_TRY_LINK([#include <stdio.h>],
2656 [printf("Hello World\n");],
2658 [LDFLAGS=$_SAVE_LDFLAGS])
2660 MOZ_OPTIMIZE_FLAGS="-xO4"
2661 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2662 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2663 MKSHLIB_FORCE_ALL='-z allextract'
2664 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2671 AS='/usr/ccs/bin/as'
2672 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2674 TARGET_COMPILER_ABI="sunc"
2675 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2676 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2677 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2681 [#if (__SUNPRO_CC < 0x590)
2684 _BAD_COMPILER=,_BAD_COMPILER=1)
2685 if test -n "$_BAD_COMPILER"; then
2687 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2692 [#if (__SUNPRO_CC >= 0x5100)
2693 #error "Sun C++ 5.10 or above"
2695 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2696 if test "$_ABOVE_SS12U1"; then
2698 CXXFLAGS="$CXXFLAGS -xannotate=no"
2700 AC_MSG_RESULT([$_res])
2703 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2705 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2706 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2707 ASFLAGS="$ASFLAGS -fPIC"
2708 DSO_LDOPTS='-shared'
2709 WARNINGS_AS_ERRORS='-Werror'
2711 _WARNINGS_CXXFLAGS=''
2712 if test "$OS_RELEASE" = "5.3"; then
2713 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2716 if test "$OS_RELEASE" = "5.5.1"; then
2717 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2722 DSO_LDOPTS='-Bdynamic'
2723 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2724 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2726 AC_DEFINE(SPRINTF_RETURNS_STRING)
2727 case "$(target_os)" in
2729 DLL_SUFFIX='.so.1.0'
2735 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2739 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2744 dnl Only one oddball right now (QNX), but this gives us flexibility
2745 dnl if any other platforms need to override this in the future.
2746 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2748 dnl ========================================================
2749 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2750 dnl by now will not have any way to link most binaries (tests
2751 dnl as well as viewer, apprunner, etc.), because some symbols
2752 dnl will be left out of the "composite" .so's by ld as unneeded.
2753 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2754 dnl they can link in the static libs that provide the missing
2756 dnl ========================================================
2757 NO_LD_ARCHIVE_FLAGS=
2758 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2759 NO_LD_ARCHIVE_FLAGS=1
2763 NO_LD_ARCHIVE_FLAGS=
2766 NO_LD_ARCHIVE_FLAGS=
2769 if test -z "$GNU_CC"; then
2770 NO_LD_ARCHIVE_FLAGS=
2774 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2776 dnl ========================================================
2777 dnl = Flags to strip unused symbols from .so components and
2778 dnl = to export jemalloc symbols when linking a program
2779 dnl ========================================================
2781 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2782 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2783 MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
2786 if test -z "$GNU_CC"; then
2787 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2789 if test -z "$GCC_USE_GNU_LD"; then
2790 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2792 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2797 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2800 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2803 if test -n "$GNU_CC"; then
2804 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2809 if test -z "$COMPILE_ENVIRONMENT"; then
2810 SKIP_COMPILER_CHECKS=1
2811 SKIP_LIBRARY_CHECKS=1
2814 if test -z "$SKIP_COMPILER_CHECKS"; then
2815 dnl Checks for typedefs, structures, and compiler characteristics.
2816 dnl ========================================================
2824 AC_MSG_CHECKING(for __stdcall)
2825 AC_CACHE_VAL(ac_cv___stdcall,
2826 [AC_TRY_COMPILE([template <typename Method> struct foo;
2827 template <> struct foo<void (*)()> {};
2828 template <> struct foo<void (__stdcall*)()> {};],
2830 [ac_cv___stdcall=true],
2831 [ac_cv___stdcall=false])])
2832 if test "$ac_cv___stdcall" = true ; then
2833 AC_DEFINE(HAVE_STDCALL)
2839 AC_MSG_CHECKING(for ssize_t)
2840 AC_CACHE_VAL(ac_cv_type_ssize_t,
2841 [AC_TRY_COMPILE([#include <stdio.h>
2842 #include <sys/types.h>],
2844 [ac_cv_type_ssize_t=true],
2845 [ac_cv_type_ssize_t=false])])
2846 if test "$ac_cv_type_ssize_t" = true ; then
2847 AC_DEFINE(HAVE_SSIZE_T)
2852 AC_STRUCT_ST_BLKSIZE
2853 AC_MSG_CHECKING(for siginfo_t)
2854 AC_CACHE_VAL(ac_cv_siginfo_t,
2855 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2856 #include <signal.h>],
2858 [ac_cv_siginfo_t=true],
2859 [ac_cv_siginfo_t=false])])
2860 if test "$ac_cv_siginfo_t" = true ; then
2861 AC_DEFINE(HAVE_SIGINFO_T)
2867 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2868 dnl ========================================================
2869 AC_MSG_CHECKING(for int16_t)
2870 AC_CACHE_VAL(ac_cv_int16_t,
2871 [AC_TRY_COMPILE([#include <stdio.h>
2872 #include <sys/types.h>],
2874 [ac_cv_int16_t=true],
2875 [ac_cv_int16_t=false])])
2876 if test "$ac_cv_int16_t" = true ; then
2877 AC_DEFINE(HAVE_INT16_T)
2882 AC_MSG_CHECKING(for int32_t)
2883 AC_CACHE_VAL(ac_cv_int32_t,
2884 [AC_TRY_COMPILE([#include <stdio.h>
2885 #include <sys/types.h>],
2887 [ac_cv_int32_t=true],
2888 [ac_cv_int32_t=false])])
2889 if test "$ac_cv_int32_t" = true ; then
2890 AC_DEFINE(HAVE_INT32_T)
2895 AC_MSG_CHECKING(for int64_t)
2896 AC_CACHE_VAL(ac_cv_int64_t,
2897 [AC_TRY_COMPILE([#include <stdio.h>
2898 #include <sys/types.h>],
2900 [ac_cv_int64_t=true],
2901 [ac_cv_int64_t=false])])
2902 if test "$ac_cv_int64_t" = true ; then
2903 AC_DEFINE(HAVE_INT64_T)
2908 AC_MSG_CHECKING(for int64)
2909 AC_CACHE_VAL(ac_cv_int64,
2910 [AC_TRY_COMPILE([#include <stdio.h>
2911 #include <sys/types.h>],
2914 [ac_cv_int64=false])])
2915 if test "$ac_cv_int64" = true ; then
2916 AC_DEFINE(HAVE_INT64)
2921 AC_MSG_CHECKING(for uint)
2922 AC_CACHE_VAL(ac_cv_uint,
2923 [AC_TRY_COMPILE([#include <stdio.h>
2924 #include <sys/types.h>],
2927 [ac_cv_uint=false])])
2928 if test "$ac_cv_uint" = true ; then
2929 AC_DEFINE(HAVE_UINT)
2934 AC_MSG_CHECKING(for uint_t)
2935 AC_CACHE_VAL(ac_cv_uint_t,
2936 [AC_TRY_COMPILE([#include <stdio.h>
2937 #include <sys/types.h>],
2939 [ac_cv_uint_t=true],
2940 [ac_cv_uint_t=false])])
2941 if test "$ac_cv_uint_t" = true ; then
2942 AC_DEFINE(HAVE_UINT_T)
2947 AC_MSG_CHECKING(for uint16_t)
2948 AC_CACHE_VAL(ac_cv_uint16_t,
2949 [AC_TRY_COMPILE([#include <stdio.h>
2950 #include <sys/types.h>],
2951 [uint16_t foo = 0;],
2952 [ac_cv_uint16_t=true],
2953 [ac_cv_uint16_t=false])])
2954 if test "$ac_cv_uint16_t" = true ; then
2955 AC_DEFINE(HAVE_UINT16_T)
2961 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2962 dnl are defined when compiling C++ but not C. Since the result of this
2963 dnl test is used only in C++, do it in C++.
2966 AC_MSG_CHECKING(for uname.domainname)
2967 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2968 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2969 [ struct utsname *res; char *domain;
2970 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2971 [ac_cv_have_uname_domainname_field=true],
2972 [ac_cv_have_uname_domainname_field=false])])
2974 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2975 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2981 AC_MSG_CHECKING(for uname.__domainname)
2982 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2983 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2984 [ struct utsname *res; char *domain;
2985 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2986 [ac_cv_have_uname_us_domainname_field=true],
2987 [ac_cv_have_uname_us_domainname_field=false])])
2989 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2990 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2996 dnl ========================================================
2998 dnl Should be smarter and check that the compiler does indeed have rtti
2999 dnl ========================================================
3001 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
3002 [ --enable-cpp-rtti Enable C++ RTTI ],
3003 [ _MOZ_USE_RTTI=1 ],
3006 if test "$_MOZ_USE_RTTI"; then
3007 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
3009 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
3012 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
3014 dnl Check whether we can use gcc's c++0x mode
3017 if test "$GNU_CXX"; then
3018 _SAVE_CXXFLAGS=$CXXFLAGS
3019 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3021 if test -z "$_MOZ_USE_RTTI"; then
3022 CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
3023 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
3024 ac_cv_cxx0x_headers_bug,
3025 [AC_TRY_COMPILE([#include <memory>], [],
3026 ac_cv_cxx0x_headers_bug="no",
3027 ac_cv_cxx0x_headers_bug="yes")])
3028 CXXFLAGS="$_SAVE_CXXFLAGS"
3029 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
3030 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3035 dnl Check for usable char16_t (2 bytes, unsigned)
3036 dnl (we might not need the unsignedness check anymore)
3037 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3038 ac_cv_have_usable_char16_t,
3039 [AC_TRY_COMPILE([$configure_static_assert_macros],
3040 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3041 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3042 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3043 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3044 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3045 ac_cv_have_usable_char16_t="yes",
3046 ac_cv_have_usable_char16_t="no")])
3047 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3048 AC_DEFINE(HAVE_CPP_CHAR16_T)
3050 elif test "$GNU_CXX"; then
3051 CXXFLAGS="$_SAVE_CXXFLAGS"
3054 dnl Check for usable wchar_t (2 bytes, unsigned)
3055 dnl (we really don't need the unsignedness check anymore)
3056 dnl ========================================================
3058 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3059 ac_cv_have_usable_wchar_v2,
3060 [AC_TRY_COMPILE([#include <stddef.h>
3061 $configure_static_assert_macros],
3062 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3063 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3064 ac_cv_have_usable_wchar_v2="yes",
3065 ac_cv_have_usable_wchar_v2="no")])
3066 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3067 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3068 HAVE_CPP_2BYTE_WCHAR_T=1
3069 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3070 dnl This is really gcc-only
3071 dnl Do this test using CXX only since some versions of gcc
3072 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3073 dnl only have short-wchar support for c++.
3074 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3076 _SAVE_CXXFLAGS=$CXXFLAGS
3077 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3079 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3080 ac_cv_have_usable_wchar_option_v2,
3081 [AC_TRY_LINK([#include <stddef.h>
3082 $configure_static_assert_macros],
3083 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3084 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3085 ac_cv_have_usable_wchar_option_v2="yes",
3086 ac_cv_have_usable_wchar_option_v2="no")])
3088 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3089 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3090 HAVE_CPP_2BYTE_WCHAR_T=1
3091 if test "$OS_TARGET" = Android; then
3092 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3093 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3094 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3095 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3097 WCHAR_CFLAGS="-fshort-wchar"
3100 CXXFLAGS=$_SAVE_CXXFLAGS
3106 dnl Check for .hidden assembler directive and visibility attribute.
3107 dnl Borrowed from glibc configure.in
3108 dnl ===============================================================
3109 if test "$GNU_CC"; then
3110 AC_CACHE_CHECK(for visibility(hidden) attribute,
3111 ac_cv_visibility_hidden,
3112 [cat > conftest.c <<EOF
3113 int foo __attribute__ ((visibility ("hidden"))) = 1;
3115 ac_cv_visibility_hidden=no
3116 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3117 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3118 ac_cv_visibility_hidden=yes
3123 if test "$ac_cv_visibility_hidden" = "yes"; then
3124 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3126 AC_CACHE_CHECK(for visibility(default) attribute,
3127 ac_cv_visibility_default,
3128 [cat > conftest.c <<EOF
3129 int foo __attribute__ ((visibility ("default"))) = 1;
3131 ac_cv_visibility_default=no
3132 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3133 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3134 ac_cv_visibility_default=yes
3139 if test "$ac_cv_visibility_default" = "yes"; then
3140 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3142 AC_CACHE_CHECK(for visibility pragma support,
3143 ac_cv_visibility_pragma,
3144 [cat > conftest.c <<EOF
3145 #pragma GCC visibility push(hidden)
3147 #pragma GCC visibility push(default)
3148 int foo_default = 1;
3150 ac_cv_visibility_pragma=no
3151 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3152 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3153 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3154 ac_cv_visibility_pragma=yes
3160 if test "$ac_cv_visibility_pragma" = "yes"; then
3161 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3162 ac_cv_have_visibility_class_bug,
3163 [cat > conftest.c <<EOF
3164 #pragma GCC visibility push(hidden)
3165 struct __attribute__ ((visibility ("default"))) TestStruct {
3168 __attribute__ ((visibility ("default"))) void TestFunc() {
3172 ac_cv_have_visibility_class_bug=no
3173 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3174 ac_cv_have_visibility_class_bug=yes
3176 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3177 ac_cv_have_visibility_class_bug=yes
3180 rm -rf conftest.{c,S}
3183 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3184 ac_cv_have_visibility_builtin_bug,
3185 [cat > conftest.c <<EOF
3186 #pragma GCC visibility push(hidden)
3187 #pragma GCC visibility push(default)
3189 #pragma GCC visibility pop
3191 __attribute__ ((visibility ("default"))) void Func() {
3193 memset(c, 0, sizeof(c));
3196 ac_cv_have_visibility_builtin_bug=no
3197 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3198 ac_cv_have_visibility_builtin_bug=yes
3200 if test `grep -c "@PLT" conftest.S` = 0; then
3201 ac_cv_visibility_builtin_bug=yes
3204 rm -f conftest.{c,S}
3206 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3207 "$ac_cv_have_visibility_class_bug" = "no"; then
3208 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3209 WRAP_SYSTEM_INCLUDES=1
3210 STL_FLAGS='-I$(DIST)/stl_wrappers'
3213 VISIBILITY_FLAGS='-fvisibility=hidden'
3214 fi # have visibility pragma bug
3215 fi # have visibility pragma
3216 fi # have visibility(default) attribute
3217 fi # have visibility(hidden) attribute
3220 # visibility hidden flag for Sun Studio on Solaris
3221 if test "$SOLARIS_SUNPRO_CC"; then
3222 VISIBILITY_FLAGS='-xldscope=hidden'
3223 fi # Sun Studio on Solaris
3225 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3226 AC_SUBST(VISIBILITY_FLAGS)
3228 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3229 dnl ========================================================
3230 if test "$GNU_CC"; then
3231 CFLAGS_save="${CFLAGS}"
3232 CFLAGS="${CFLAGS} -Werror"
3233 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3234 ac_cv_force_align_arg_pointer,
3235 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3237 ac_cv_force_align_arg_pointer="yes",
3238 ac_cv_force_align_arg_pointer="no")])
3239 CFLAGS="${CFLAGS_save}"
3240 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3241 HAVE_GCC_ALIGN_ARG_POINTER=1
3243 HAVE_GCC_ALIGN_ARG_POINTER=
3246 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3248 dnl Checks for header files.
3249 dnl ========================================================
3251 case "$target_os" in
3253 # for stuff like -lXshm
3254 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3257 MOZ_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3258 MOZ_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3259 MOZ_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3260 MOZ_CHECK_HEADERS(malloc.h)
3261 MOZ_CHECK_HEADERS(X11/XKBlib.h)
3262 MOZ_CHECK_HEADERS(io.h)
3264 dnl These are all the places some variant of statfs can be hiding.
3265 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3268 MOZ_CHECK_HEADERS(sys/quota.h)
3269 MOZ_CHECK_HEADERS(linux/quota.h)
3271 dnl Try for MMX support
3272 dnl NB - later gcc versions require -mmmx for this header to be successfully
3273 dnl included (or another option which implies it, such as -march=pentium-mmx)
3274 MOZ_CHECK_HEADERS(mmintrin.h)
3276 dnl Check whether the compiler supports the new-style C++ standard
3277 dnl library headers (i.e. <new>) or needs the old "new.h"
3280 MOZ_CHECK_HEADER(new, [NEW_H=new])
3281 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3284 AC_ARG_ENABLE(dtrace,
3285 [ --enable-dtrace build with dtrace support if available (default=no)],
3286 [enable_dtrace="yes"],)
3287 if test "x$enable_dtrace" = "xyes"; then
3288 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3289 if test -n "$HAVE_DTRACE"; then
3290 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3292 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3295 AC_SUBST(HAVE_DTRACE)
3301 MOZ_CHECK_HEADERS(sys/cdefs.h)
3305 dnl Checks for libraries.
3306 dnl ========================================================
3311 AC_CHECK_LIB(c_r, gethostbyname_r)
3315 dnl We don't want to link with libdl even if it's present on OS X, since
3316 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3318 dnl We don't want to link against libm or libpthread on Darwin since
3319 dnl they both are just symlinks to libSystem and explicitly linking
3320 dnl against libSystem causes issues when debugging (see bug 299601).
3327 AC_SEARCH_LIBS(dlopen, dl,
3328 MOZ_CHECK_HEADER(dlfcn.h,
3329 AC_DEFINE(HAVE_DLOPEN)))
3333 _SAVE_CFLAGS="$CFLAGS"
3334 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3335 AC_CHECK_FUNCS(dladdr memmem)
3336 CFLAGS="$_SAVE_CFLAGS"
3338 if test ! "$GNU_CXX"; then
3342 AC_CHECK_LIB(C_r, demangle)
3345 AC_CHECK_LIB(C, demangle)
3350 dnl OS/2 has socket in libc.
3355 AC_CHECK_LIB(socket, socket)
3359 XLIBS="$X_EXTRA_LIBS"
3361 dnl ========================================================
3362 dnl Checks for X libraries.
3363 dnl Ordering is important.
3364 dnl Xt is dependent upon SM as of X11R6
3365 dnl ========================================================
3366 if test "$no_x" = "yes"; then
3369 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3370 XLIBS="-lX11 $XLIBS"
3371 _SAVE_LDFLAGS="$LDFLAGS"
3372 LDFLAGS="$XLDFLAGS $LDFLAGS"
3373 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3374 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3375 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3376 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3378 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3379 unset ac_cv_lib_Xt_XtFree
3380 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3381 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3382 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3383 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3386 # AIX needs the motif library linked before libXt to prevent
3387 # crashes in plugins linked against Motif - Bug #98892
3388 case "${target_os}" in
3390 XT_LIBS="-lXm $XT_LIBS"
3394 dnl ========================================================
3395 dnl = Check for XShm
3396 dnl ========================================================
3397 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3400 dnl ========================================================
3402 dnl ========================================================
3403 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3404 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3405 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3406 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3408 LDFLAGS="$_SAVE_LDFLAGS"
3410 dnl ========================================================
3411 dnl = Check for freetype2 and its functionality
3412 dnl ========================================================
3413 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3415 if test "$_HAVE_FREETYPE2"; then
3417 _SAVE_CFLAGS="$CFLAGS"
3418 LIBS="$LIBS $FT2_LIBS"
3419 CFLAGS="$CFLAGS $FT2_CFLAGS"
3421 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3422 ac_cv_member_FT_Bitmap_Size_y_ppem,
3423 [AC_TRY_COMPILE([#include <ft2build.h>
3424 #include FT_FREETYPE_H],
3426 if (sizeof s.y_ppem) return 0;
3428 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3429 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3430 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3431 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3433 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3435 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3436 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3437 [FT_Bitmap_Size structure includes y_ppem field])
3439 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3442 CFLAGS="$_SAVE_CFLAGS"
3454 dnl ========================================================
3455 dnl = pthread support
3456 dnl = Start by checking whether the system support pthreads
3457 dnl ========================================================
3458 case "$target_os" in
3463 MOZ_CHECK_PTHREADS(pthreads,
3464 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3465 MOZ_CHECK_PTHREADS(pthread,
3466 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3467 MOZ_CHECK_PTHREADS(c_r,
3468 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3469 MOZ_CHECK_PTHREADS(c,
3478 dnl ========================================================
3479 dnl Check the command line for --with-pthreads
3480 dnl ========================================================
3481 MOZ_ARG_WITH_BOOL(pthreads,
3482 [ --with-pthreads Force use of system pthread library with NSPR ],
3483 [ if test "$USE_PTHREADS"x = x; then
3484 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3490 dnl ========================================================
3491 dnl Do the platform specific pthread hackery
3492 dnl ========================================================
3493 if test "$USE_PTHREADS"x != x
3496 dnl See if -pthread is supported.
3499 ac_cv_have_dash_pthread=no
3500 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3501 echo 'int main() { return 0; }' | cat > conftest.c
3502 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3503 if test $? -eq 0; then
3504 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3505 ac_cv_have_dash_pthread=yes
3506 case "$target_os" in
3508 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3511 CFLAGS="$CFLAGS -pthread"
3512 CXXFLAGS="$CXXFLAGS -pthread"
3518 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3521 dnl See if -pthreads is supported.
3523 ac_cv_have_dash_pthreads=no
3524 if test "$ac_cv_have_dash_pthread" = "no"; then
3525 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3526 echo 'int main() { return 0; }' | cat > conftest.c
3527 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3528 if test $? -eq 0; then
3529 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3530 ac_cv_have_dash_pthreads=yes
3531 CFLAGS="$CFLAGS -pthreads"
3532 CXXFLAGS="$CXXFLAGS -pthreads"
3536 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3541 AC_DEFINE(_REENTRANT)
3542 AC_DEFINE(_THREAD_SAFE)
3543 dnl -pthread links in -lc_r, so don't specify it explicitly.
3544 if test "$ac_cv_have_dash_pthread" = "yes"; then
3545 _PTHREAD_LDFLAGS="-pthread"
3547 _PTHREAD_LDFLAGS="-lc_r"
3551 *-*-openbsd*|*-*-bsdi*)
3552 AC_DEFINE(_REENTRANT)
3553 AC_DEFINE(_THREAD_SAFE)
3554 dnl -pthread links in -lc_r, so don't specify it explicitly.
3555 if test "$ac_cv_have_dash_pthread" = "yes"; then
3556 _PTHREAD_LDFLAGS="-pthread"
3560 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3561 AC_DEFINE(_REENTRANT)
3565 AC_DEFINE(_REENTRANT)
3569 AC_DEFINE(_REENTRANT)
3573 AC_DEFINE(_REENTRANT)
3577 AC_DEFINE(_REENTRANT)
3581 AC_DEFINE(_REENTRANT)
3582 if test "$SOLARIS_SUNPRO_CC"; then
3583 CFLAGS="$CFLAGS -mt"
3584 CXXFLAGS="$CXXFLAGS -mt"
3588 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3591 dnl ========================================================
3592 dnl See if mmap sees writes
3593 dnl For cross compiling, just define it as no, which is a safe default
3594 dnl ========================================================
3595 AC_MSG_CHECKING(whether mmap() sees write()s)
3601 #include <sys/mman.h>
3602 #include <sys/types.h>
3603 #include <sys/stat.h>
3606 char fname[] = "conftest.file";
3607 char zbuff[1024]; /* Fractional page is probably worst case */
3614 fd = open(fname, O_RDWR | O_CREAT, 0660);
3617 write(fd, zbuff, sizeof(zbuff));
3618 lseek(fd, 0, SEEK_SET);
3619 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3620 if(map==(char*)-1) return 2;
3621 for(i=0; fname[i]; i++) {
3622 int rc = write(fd, &fname[i], 1);
3623 if(map[i]!=fname[i]) return 4;
3630 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3632 AC_MSG_RESULT("$result")
3634 if test "$result" = "no"; then
3635 AC_DEFINE(MMAP_MISSES_WRITES)
3639 dnl Checks for library functions.
3640 dnl ========================================================
3641 AC_PROG_GCC_TRADITIONAL
3643 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3644 AC_CHECK_FUNCS(flockfile getpagesize)
3645 AC_CHECK_FUNCS(localtime_r strtok_r)
3647 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3648 _SAVE_LDFLAGS=$LDFLAGS
3649 LDFLAGS="$LDFLAGS -lrt"
3650 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3651 ac_cv_have_clock_monotonic,
3652 [AC_TRY_LINK([#include <time.h>],
3653 [ struct timespec ts;
3654 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3655 ac_cv_have_clock_monotonic=yes,
3656 ac_cv_have_clock_monotonic=no)])
3657 LDFLAGS=$_SAVE_LDFLAGS
3658 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3659 HAVE_CLOCK_MONOTONIC=1
3661 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3662 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3663 AC_SUBST(REALTIME_LIBS)
3666 dnl check for wcrtomb/mbrtowc
3667 dnl =======================================================================
3668 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3671 AC_CACHE_CHECK(for wcrtomb,
3673 [AC_TRY_LINK([#include <wchar.h>],
3674 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3675 ac_cv_have_wcrtomb="yes",
3676 ac_cv_have_wcrtomb="no")])
3677 if test "$ac_cv_have_wcrtomb" = "yes"; then
3678 AC_DEFINE(HAVE_WCRTOMB)
3680 AC_CACHE_CHECK(for mbrtowc,
3682 [AC_TRY_LINK([#include <wchar.h>],
3683 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3684 ac_cv_have_mbrtowc="yes",
3685 ac_cv_have_mbrtowc="no")])
3686 if test "$ac_cv_have_mbrtowc" = "yes"; then
3687 AC_DEFINE(HAVE_MBRTOWC)
3694 ac_cv_func_res_ninit,
3697 #define _BSD_SOURCE 1
3701 [int foo = res_ninit(&_res);],
3702 [ac_cv_func_res_ninit=yes],
3703 [ac_cv_func_res_ninit=no])
3706 if test "$ac_cv_func_res_ninit" = "yes"; then
3707 AC_DEFINE(HAVE_RES_NINIT)
3708 dnl must add the link line we do something as foolish as this... dougt
3710 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3711 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3716 [for gnu_get_libc_version()],
3717 ac_cv_func_gnu_get_libc_version,
3719 #ifdef HAVE_GNU_LIBC_VERSION_H
3720 #include <gnu/libc-version.h>
3723 [const char *glibc_version = gnu_get_libc_version();],
3724 [ac_cv_func_gnu_get_libc_version=yes],
3725 [ac_cv_func_gnu_get_libc_version=no]
3729 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3730 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3734 darwin*|mingw*|os2*)
3738 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3739 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3740 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3742 LIBS="$LIBS $_ICONV_LIBS"
3751 iconv_t h = iconv_open("", "");
3752 iconv(h, NULL, NULL, NULL, NULL);
3755 [ac_cv_func_iconv=yes],
3756 [ac_cv_func_iconv=no]
3759 if test "$ac_cv_func_iconv" = "yes"; then
3760 AC_DEFINE(HAVE_ICONV)
3761 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3762 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3763 LIBICONV="$_ICONV_LIBS"
3765 [for iconv() with const input],
3766 ac_cv_func_const_iconv,
3772 const char *input = "testing";
3773 iconv_t h = iconv_open("", "");
3774 iconv(h, &input, NULL, NULL, NULL);
3777 [ac_cv_func_const_iconv=yes],
3778 [ac_cv_func_const_iconv=no]
3781 if test "$ac_cv_func_const_iconv" = "yes"; then
3782 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3794 dnl **********************
3795 dnl *** va_copy checks ***
3796 dnl **********************
3797 dnl we currently check for all three va_copy possibilities, so we get
3798 dnl all results in config.log for bug reports.
3799 AC_MSG_CHECKING(for an implementation of va_copy())
3800 AC_CACHE_VAL(ac_cv_va_copy,[
3803 void f (int i, ...) {
3804 va_list args1, args2;
3805 va_start (args1, i);
3806 va_copy (args2, args1);
3807 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3809 va_end (args1); va_end (args2);
3811 int main() { f (0, 42); return 0; }],
3817 AC_MSG_RESULT($ac_cv_va_copy)
3818 AC_MSG_CHECKING(for an implementation of __va_copy())
3819 AC_CACHE_VAL(ac_cv___va_copy,[
3822 void f (int i, ...) {
3823 va_list args1, args2;
3824 va_start (args1, i);
3825 __va_copy (args2, args1);
3826 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3828 va_end (args1); va_end (args2);
3830 int main() { f (0, 42); return 0; }],
3831 ac_cv___va_copy=yes,
3836 AC_MSG_RESULT($ac_cv___va_copy)
3837 AC_MSG_CHECKING(whether va_lists can be copied by value)
3838 AC_CACHE_VAL(ac_cv_va_val_copy,[
3841 void f (int i, ...) {
3842 va_list args1, args2;
3843 va_start (args1, i);
3845 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3847 va_end (args1); va_end (args2);
3849 int main() { f (0, 42); return 0; }],
3850 ac_cv_va_val_copy=yes,
3851 ac_cv_va_val_copy=no,
3852 ac_cv_va_val_copy=yes
3855 if test "x$ac_cv_va_copy" = "xyes"; then
3856 AC_DEFINE(VA_COPY, va_copy)
3857 AC_DEFINE(HAVE_VA_COPY)
3858 elif test "x$ac_cv___va_copy" = "xyes"; then
3859 AC_DEFINE(VA_COPY, __va_copy)
3860 AC_DEFINE(HAVE_VA_COPY)
3863 if test "x$ac_cv_va_val_copy" = "xno"; then
3864 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3866 AC_MSG_RESULT($ac_cv_va_val_copy)
3868 dnl ===================================================================
3869 dnl ========================================================
3870 dnl Put your C++ language/feature checks below
3871 dnl ========================================================
3876 if test "$GNU_CC"; then
3877 if test "$CPU_ARCH" = "arm" ; then
3878 AC_CACHE_CHECK(for ARM EABI,
3882 #if defined(__ARM_EABI__)
3885 #error Not ARM EABI.
3888 ac_cv_gcc_arm_eabi="yes",
3889 ac_cv_gcc_arm_eabi="no")])
3890 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3892 ARM_ABI_PREFIX=eabi-
3894 ARM_ABI_PREFIX=oabi-
3898 AC_CACHE_CHECK(for gcc 3.0 ABI,
3899 ac_cv_gcc_three_abi,
3902 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3908 ac_cv_gcc_three_abi="yes",
3909 ac_cv_gcc_three_abi="no")])
3910 if test "$ac_cv_gcc_three_abi" = "yes"; then
3911 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3914 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
3917 AC_SUBST(HAVE_GCC3_ABI)
3920 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3922 [AC_TRY_COMPILE(class X {
3923 public: explicit X(int i) : i_(i) {}
3927 ac_cv_cpp_explicit=yes,
3928 ac_cv_cpp_explicit=no)])
3929 if test "$ac_cv_cpp_explicit" = yes ; then
3930 AC_DEFINE(HAVE_CPP_EXPLICIT)
3933 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3935 [AC_TRY_COMPILE(class param {
3937 typedef unsigned long num_type;
3940 template <class T> class tplt {
3942 typedef typename T::num_type t_num_type;
3943 t_num_type foo(typename T::num_type num) {
3949 ac_cv_cpp_typename=yes,
3950 ac_cv_cpp_typename=no)])
3951 if test "$ac_cv_cpp_typename" = yes ; then
3952 AC_DEFINE(HAVE_CPP_TYPENAME)
3955 dnl Check for support of modern template specialization syntax
3956 dnl Test code and requirement from scc@netscape.com.
3957 dnl Autoconf cut-and-paste job by waterson@netscape.com
3958 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3959 ac_cv_cpp_modern_specialize_template_syntax,
3960 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3962 template <> struct X<Y> { double a; };,
3965 ac_cv_cpp_modern_specialize_template_syntax=yes,
3966 ac_cv_cpp_modern_specialize_template_syntax=no)])
3967 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3968 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3972 dnl Some compilers support only full specialization, and some don't.
3973 AC_CACHE_CHECK(whether partial template specialization works,
3974 ac_cv_cpp_partial_specialization,
3975 [AC_TRY_COMPILE(template <class T> class Foo {};
3976 template <class T> class Foo<T*> {};,
3978 ac_cv_cpp_partial_specialization=yes,
3979 ac_cv_cpp_partial_specialization=no)])
3980 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3981 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3984 dnl Some compilers have limited support for operators with templates;
3985 dnl specifically, it is necessary to define derived operators when a base
3986 dnl class's operator declaration should suffice.
3987 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3988 ac_cv_need_derived_template_operators,
3989 [AC_TRY_COMPILE([template <class T> class Base { };
3991 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3992 template <class T> class Derived : public Base<T> { };],
3993 [Derived<char> a, b;
3994 Base<char> c = a + b;
3996 ac_cv_need_derived_template_operators=no,
3997 ac_cv_need_derived_template_operators=yes)])
3998 if test "$ac_cv_need_derived_template_operators" = yes ; then
3999 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4003 dnl Some compilers have trouble detecting that a template class
4004 dnl that derives from another template is actually an instance
4005 dnl of the base class. This test checks for that.
4006 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4007 ac_cv_need_cpp_template_cast_to_base,
4008 [AC_TRY_COMPILE([template <class T> class Base { };
4009 template <class T> class Derived : public Base<T> { };
4010 template <class T> int foo(const Base<T>&) { return 0; }],
4011 [Derived<char> bar; return foo(bar);],
4012 ac_cv_need_cpp_template_cast_to_base=no,
4013 ac_cv_need_cpp_template_cast_to_base=yes)])
4014 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4015 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4018 dnl Some compilers have trouble resolving the ambiguity between two
4019 dnl functions whose arguments differ only by cv-qualifications.
4020 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4021 ac_cv_can_resolve_const_ambiguity,
4023 template <class T> class ptrClass {
4027 template <class T> T* a(ptrClass<T> *arg) {
4032 const T* a(const ptrClass<T> *arg) {
4038 ac_cv_can_resolve_const_ambiguity=yes,
4039 ac_cv_can_resolve_const_ambiguity=no)])
4040 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4041 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4045 dnl We don't do exceptions on unix. The only reason this used to be here
4046 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4047 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4048 dnl So im commenting this out until someone writes some artificial
4049 dnl intelligence to detect not only if the compiler has exceptions, but if
4050 dnl they are enabled as well.
4052 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4053 dnl ac_cv_cpp_exceptions,
4054 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4055 dnl static void F() { throw X(); },
4056 dnl try { F(); } catch(X & e) { },
4057 dnl ac_cv_cpp_exceptions=yes,
4058 dnl ac_cv_cpp_exceptions=no)])
4059 dnl if test $ac_cv_cpp_exceptions = yes ; then
4060 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4063 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4064 dnl supports it well enough to allow us to use it to change access, but not
4065 dnl to resolve ambiguity. The next two tests determine how well the |using|
4066 dnl keyword is supported.
4068 dnl Check to see if we can change access with |using|. Test both a
4069 dnl legal and an illegal example.
4070 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4071 ac_cv_cpp_access_changing_using2,
4073 class A { protected: int foo() { return 0; } };
4074 class B : public A { public: using A::foo; };,
4075 B b; return b.foo();,
4077 class A { public: int foo() { return 1; } };
4078 class B : public A { private: using A::foo; };,
4079 B b; return b.foo();,
4080 ac_cv_cpp_access_changing_using2=no,
4081 ac_cv_cpp_access_changing_using2=yes)],
4082 ac_cv_cpp_access_changing_using2=no)])
4083 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4084 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4087 dnl Check to see if we can resolve ambiguity with |using|.
4088 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4089 ac_cv_cpp_ambiguity_resolving_using,
4090 [AC_TRY_COMPILE(class X {
4091 public: int go(const X&) {return 3;}
4092 int jo(const X&) {return 3;}
4094 class Y : public X {
4095 public: int go(int) {return 2;}
4096 int jo(int) {return 2;}
4098 private: using X::go;
4101 ac_cv_cpp_ambiguity_resolving_using=yes,
4102 ac_cv_cpp_ambiguity_resolving_using=no)])
4103 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4104 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4107 dnl Check to see if the |std| namespace is supported. If so, we'll want
4108 dnl to qualify any standard library calls with "std::" to ensure that
4109 dnl those functions can be resolved.
4110 AC_CACHE_CHECK(for \"std::\" namespace,
4111 ac_cv_cpp_namespace_std,
4112 [AC_TRY_COMPILE([#include <algorithm>],
4113 [return std::min(0, 1);],
4114 ac_cv_cpp_namespace_std=yes,
4115 ac_cv_cpp_namespace_std=no)])
4116 if test "$ac_cv_cpp_namespace_std" = yes ; then
4117 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4120 dnl Older compilers are overly ambitious with respect to using the standard
4121 dnl template library's |operator!=()| when |operator==()| is defined. In
4122 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4123 dnl ambiguity at compile-time. This test checks for that case.
4124 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4125 ac_cv_cpp_unambiguous_std_notequal,
4126 [AC_TRY_COMPILE([#include <algorithm>
4128 int operator==(const T1&, const T1&) { return 0; }
4129 int operator!=(const T1&, const T1&) { return 0; }],
4130 [T1 a,b; return a != b;],
4131 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4132 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4133 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4134 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4138 AC_CACHE_CHECK(for C++ reinterpret_cast,
4139 ac_cv_cpp_reinterpret_cast,
4140 [AC_TRY_COMPILE(struct X { int i; };
4141 struct Y { int i; };,
4142 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4143 ac_cv_cpp_reinterpret_cast=yes,
4144 ac_cv_cpp_reinterpret_cast=no)])
4145 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4146 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4149 dnl See if a dynamic_cast to void* gives the most derived object.
4150 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4151 ac_cv_cpp_dynamic_cast_void_ptr,
4152 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4153 class Y { int j; public: virtual ~Y() { } };
4154 class Z : public X, public Y { int k; };
4160 return !((((void*)&mdo != (void*)subx) &&
4161 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4162 (((void*)&mdo != (void*)suby) &&
4163 ((void*)&mdo == dynamic_cast<void*>(suby))));
4165 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4166 ac_cv_cpp_dynamic_cast_void_ptr=no,
4167 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4168 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4169 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4173 dnl note that this one is reversed - if the test fails, then
4174 dnl we require implementations of unused virtual methods. Which
4175 dnl really blows because it means we'll have useless vtable
4177 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4178 ac_cv_cpp_unused_required,
4179 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4181 ac_cv_cpp_unused_required=no,
4182 ac_cv_cpp_unused_required=yes)])
4183 if test "$ac_cv_cpp_unused_required" = yes ; then
4184 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4188 dnl Some compilers have trouble comparing a constant reference to a templatized
4189 dnl class to zero, and require an explicit operator==() to be defined that takes
4190 dnl an int. This test separates the strong from the weak.
4192 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4193 ac_cv_trouble_comparing_to_zero,
4194 [AC_TRY_COMPILE([#include <algorithm>
4195 template <class T> class Foo {};
4197 template <class T> int operator==(const T2*, const T&) { return 0; }
4198 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4199 [Foo<int> f; return (0 != f);],
4200 ac_cv_trouble_comparing_to_zero=no,
4201 ac_cv_trouble_comparing_to_zero=yes)])
4202 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4203 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4206 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4207 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
4208 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
4210 _SAVE_LDFLAGS=$LDFLAGS
4211 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
4212 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4213 ac_cv_thread_keyword,
4214 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4215 [return tlsIsMainThread;],
4216 ac_cv_thread_keyword=yes,
4217 ac_cv_thread_keyword=no)])
4218 LDFLAGS=$_SAVE_LDFLAGS
4219 if test "$ac_cv_thread_keyword" = yes; then
4220 # mips builds fail with TLS variables because of a binutils bug.
4226 *-android*|*-linuxandroid*)
4230 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4235 dnl Check for the existence of various allocation headers/functions
4238 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4239 if test "$MALLOC_H" = ""; then
4240 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4241 if test "$MALLOC_H" = ""; then
4242 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4245 if test "$MALLOC_H" != ""; then
4246 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4249 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4250 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4252 dnl See if compiler supports some gcc-style attributes
4254 AC_CACHE_CHECK(for __attribute__((always_inline)),
4255 ac_cv_attribute_always_inline,
4256 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
4258 ac_cv_attribute_always_inline=yes,
4259 ac_cv_attribute_always_inline=no)])
4261 AC_CACHE_CHECK(for __attribute__((malloc)),
4262 ac_cv_attribute_malloc,
4263 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
4265 ac_cv_attribute_malloc=yes,
4266 ac_cv_attribute_malloc=no)])
4268 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4269 ac_cv_attribute_warn_unused,
4270 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
4272 ac_cv_attribute_warn_unused=yes,
4273 ac_cv_attribute_warn_unused=no)])
4275 AC_CACHE_CHECK(for __attribute__((noreturn)),
4276 ac_cv_attribute_noreturn,
4277 [AC_TRY_COMPILE([void f(void) __attribute__((noreturn));],
4279 ac_cv_attribute_noreturn=yes,
4280 ac_cv_attribute_noreturn=no)])
4282 dnl End of C++ language/feature checks
4285 dnl ========================================================
4286 dnl = Internationalization checks
4287 dnl ========================================================
4289 dnl Internationalization and Locale support is different
4290 dnl on various UNIX platforms. Checks for specific i18n
4291 dnl features go here.
4293 dnl check for LC_MESSAGES
4294 AC_CACHE_CHECK(for LC_MESSAGES,
4295 ac_cv_i18n_lc_messages,
4296 [AC_TRY_COMPILE([#include <locale.h>],
4297 [int category = LC_MESSAGES;],
4298 ac_cv_i18n_lc_messages=yes,
4299 ac_cv_i18n_lc_messages=no)])
4300 if test "$ac_cv_i18n_lc_messages" = yes; then
4301 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4304 AC_HAVE_FUNCS(localeconv)
4305 fi # ! SKIP_COMPILER_CHECKS
4308 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4309 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4312 dnl Mozilla specific options
4313 dnl ========================================================
4314 dnl The macros used for command line options
4315 dnl are defined in build/autoconf/altoptions.m4.
4317 dnl If the compiler supports these attributes, define them as
4318 dnl convenience macros.
4319 if test "$ac_cv_attribute_always_inline" = yes ; then
4320 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4322 AC_DEFINE(NS_ALWAYS_INLINE,)
4325 if test "$ac_cv_attribute_malloc" = yes ; then
4326 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4328 AC_DEFINE(NS_ATTR_MALLOC,)
4331 if test "$ac_cv_attribute_warn_unused" = yes ; then
4332 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4334 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4337 if test "$ac_cv_attribute_noreturn" = yes ; then
4338 AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4340 AC_DEFINE(NS_NORETURN,)
4343 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4344 dnl features that Windows actually does support.
4346 if test -n "$SKIP_COMPILER_CHECKS"; then
4347 dnl Windows has malloc.h
4348 AC_DEFINE(MALLOC_H, [<malloc.h>])
4349 AC_DEFINE(HAVE_FORCEINLINE)
4350 AC_DEFINE(HAVE_LOCALECONV)
4351 fi # SKIP_COMPILER_CHECKS
4353 dnl ========================================================
4355 dnl = Check for external package dependencies
4357 dnl ========================================================
4358 MOZ_ARG_HEADER(External Packages)
4360 MOZ_ARG_WITH_STRING(libxul-sdk,
4361 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4362 LIBXUL_SDK_DIR=$withval)
4364 if test "$LIBXUL_SDK_DIR" = "yes"; then
4365 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4366 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4367 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4369 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4370 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4374 AC_SUBST(LIBXUL_SDK)
4376 if test -n "$LIBXUL_SDK"; then
4377 LIBXUL_DIST="$LIBXUL_SDK"
4379 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4381 AC_SUBST(LIBXUL_DIST)
4385 MOZ_ARG_WITH_BOOL(system-libxul,
4386 [ --with-system-libxul Use system installed libxul SDK],
4389 dnl ========================================================
4390 dnl = If NSPR was not detected in the system,
4391 dnl = use the one in the source tree (mozilla/nsprpub)
4392 dnl ========================================================
4393 MOZ_ARG_WITH_BOOL(system-nspr,
4394 [ --with-system-nspr Use system installed NSPR],
4395 _USE_SYSTEM_NSPR=1 )
4397 if test -n "$_USE_SYSTEM_NSPR"; then
4398 AM_PATH_NSPR(4.8.8, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
4401 if test -n "$MOZ_NATIVE_NSPR"; then
4402 _SAVE_CFLAGS=$CFLAGS
4403 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4404 AC_TRY_COMPILE([#include "prtypes.h"],
4405 [#ifndef PR_STATIC_ASSERT
4406 #error PR_STATIC_ASSERT not defined or requires including prlog.h
4408 [MOZ_NATIVE_NSPR=1],
4409 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4410 CFLAGS=$_SAVE_CFLAGS
4412 if test "$OS_ARCH" = "WINNT"; then
4413 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4414 if test -n "$GNU_CC"; then
4415 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4417 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4420 NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4421 NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4425 dnl system libevent Support
4426 dnl ========================================================
4427 MOZ_ARG_WITH_STRING(system-libevent,
4428 [ --with-system-libevent=[PFX]
4429 Use system libevent [installed at prefix PFX]],
4430 LIBEVENT_DIR=$withval)
4432 _SAVE_CFLAGS=$CFLAGS
4433 _SAVE_LDFLAGS=$LDFLAGS
4435 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4436 MOZ_NATIVE_LIBEVENT=
4438 if test "${LIBEVENT_DIR}" = "yes"; then
4441 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4442 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4443 MOZ_CHECK_HEADER(event.h,
4444 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4445 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4447 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4448 AC_CHECK_LIB(event, event_init,
4449 [MOZ_NATIVE_LIBEVENT=1
4450 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4451 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4452 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4454 CFLAGS=$_SAVE_CFLAGS
4455 LDFLAGS=$_SAVE_LDFLAGS
4458 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4459 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4460 AC_SUBST(MOZ_LIBEVENT_LIBS)
4462 dnl ========================================================
4463 dnl = If NSS was not detected in the system,
4464 dnl = use the one in the source tree (mozilla/security/nss)
4465 dnl ========================================================
4467 MOZ_ARG_WITH_BOOL(system-nss,
4468 [ --with-system-nss Use system installed NSS],
4471 if test -n "$_USE_SYSTEM_NSS"; then
4472 AM_PATH_NSS(3.12.10, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4475 if test -n "$MOZ_NATIVE_NSS"; then
4476 NSS_LIBS="$NSS_LIBS -lcrmf"
4478 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4480 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4481 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4482 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4483 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4484 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4486 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4488 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4489 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4490 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4491 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4492 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4494 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4498 dnl ======================
4500 dnl ======================
4502 AC_MSG_CHECKING([for YASM assembler])
4503 AC_CHECK_PROGS(YASM, yasm, "")
4505 if test -n "$YASM"; then
4506 dnl Pull out yasm's version string
4508 _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
4511 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4512 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4513 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4514 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4515 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4518 if test -z "$SKIP_LIBRARY_CHECKS"; then
4519 dnl system JPEG support
4520 dnl ========================================================
4521 MOZ_ARG_WITH_STRING(system-jpeg,
4522 [ --with-system-jpeg[=PFX]
4523 Use system libjpeg [installed at prefix PFX]],
4526 _SAVE_CFLAGS=$CFLAGS
4527 _SAVE_LDFLAGS=$LDFLAGS
4529 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4530 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4531 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4533 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4536 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4539 if test "$SYSTEM_JPEG" = 1; then
4540 LIBS="$JPEG_LIBS $LIBS"
4541 AC_TRY_COMPILE([ #include <stdio.h>
4542 #include <sys/types.h>
4543 #include <jpeglib.h> ],
4544 [ #if JPEG_LIB_VERSION < $MOZJPEG
4545 #error "Insufficient JPEG library version ($MOZJPEG required)."
4548 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4550 CFLAGS=$_SAVE_CFLAGS
4551 LDFLAGS=$_SAVE_LDFLAGS
4554 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4555 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4556 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4559 dnl system ZLIB support
4560 dnl ========================================================
4561 MOZ_ARG_WITH_STRING(system-zlib,
4562 [ --with-system-zlib[=PFX]
4563 Use system libz [installed at prefix PFX]],
4566 _SAVE_CFLAGS=$CFLAGS
4567 _SAVE_LDFLAGS=$LDFLAGS
4569 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4570 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4571 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4573 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4576 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4577 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4579 if test "$SYSTEM_ZLIB" = 1; then
4580 LIBS="$ZLIB_LIBS $LIBS"
4581 AC_TRY_COMPILE([ #include <stdio.h>
4583 #include <zlib.h> ],
4584 [ #if ZLIB_VERNUM < $MOZZLIB
4585 #error "Insufficient zlib version ($MOZZLIB required)."
4588 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4590 CFLAGS=$_SAVE_CFLAGS
4591 LDFLAGS=$_SAVE_LDFLAGS
4594 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4595 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4596 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4599 dnl system BZIP2 Support
4600 dnl ========================================================
4601 MOZ_ARG_WITH_STRING(system-bz2,
4602 [ --with-system-bz2[=PFX]
4603 Use system libbz2 [installed at prefix PFX]],
4606 _SAVE_CFLAGS=$CFLAGS
4607 _SAVE_LDFLAGS=$LDFLAGS
4609 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4610 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4611 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4613 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4616 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4617 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4619 CFLAGS=$_SAVE_CFLAGS
4620 LDFLAGS=$_SAVE_LDFLAGS
4623 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4624 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4625 BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4628 dnl system PNG Support
4629 dnl ========================================================
4630 MOZ_ARG_WITH_STRING(system-png,
4631 [ --with-system-png[=PFX]
4632 Use system libpng [installed at prefix PFX]],
4635 _SAVE_CFLAGS=$CFLAGS
4636 _SAVE_LDFLAGS=$LDFLAGS
4638 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4639 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4640 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4641 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4642 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4644 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4647 _SAVE_PNG_LIBS=$PNG_LIBS
4648 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4649 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4651 AC_CHECK_LIB(png, png_get_acTL, ,
4652 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4655 if test "$SYSTEM_PNG" = 1; then
4656 LIBS="$PNG_LIBS $LIBS"
4657 AC_TRY_COMPILE([ #include <stdio.h>
4658 #include <sys/types.h>
4660 [ #if PNG_LIBPNG_VER < $MOZPNG
4661 #error "Insufficient libpng version ($MOZPNG required)."
4663 #ifndef PNG_UINT_31_MAX
4664 #error "Insufficient libpng version."
4667 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4669 CFLAGS=$_SAVE_CFLAGS
4670 LDFLAGS=$_SAVE_LDFLAGS
4673 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4674 PNG_CFLAGS="-I${PNG_DIR}/include"
4675 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4678 fi # SKIP_LIBRARY_CHECKS
4680 dnl system HunSpell Support
4681 dnl ========================================================
4682 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4683 [ --enable-system-hunspell
4684 Use system hunspell (located with pkgconfig)],
4687 if test -n "$SYSTEM_HUNSPELL"; then
4688 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4691 AC_SUBST(SYSTEM_HUNSPELL)
4693 dnl ========================================================
4694 dnl system libffi Support
4695 dnl ========================================================
4696 MOZ_ARG_ENABLE_BOOL(system-ffi,
4697 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4700 if test -n "$MOZ_NATIVE_FFI"; then
4701 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4702 # for non-GCC compilers.
4703 if test -z "$GNU_CC"; then
4704 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4706 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4708 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4711 dnl ========================================================
4712 dnl Java SDK support
4713 dnl ========================================================
4716 MOZ_ARG_WITH_STRING(java-bin-path,
4717 [ --with-java-bin-path=dir
4718 Location of Java binaries (java, javac, jar)],
4719 JAVA_BIN_PATH=$withval)
4721 dnl ========================================================
4725 dnl ========================================================
4727 MOZ_ARG_HEADER(Application)
4730 MOZ_BRANDING_DIRECTORY=
4731 MOZ_OFFICIAL_BRANDING=
4735 MOZ_AUTH_EXTENSION=1
4752 LIBJPEG_TURBO_ASFLAGS=
4753 LIBJPEG_TURBO_X86_ASM=
4754 LIBJPEG_TURBO_X64_ASM=
4758 MOZ_PREF_EXTENSIONS=1
4759 MOZ_PROFILELOCKING=1
4767 MOZ_TOOLKIT_SEARCH=1
4769 MOZ_UNIVERSALCHARDET=1
4771 MOZ_XSLT_STANDALONE=
4777 MOZ_DISABLE_DOMCRYPTO=
4782 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg"
4785 MOZ_USE_NATIVE_POPUP_WINDOWS=
4797 case "$target_os" in
4800 if test -z "$GNU_CC"; then
4801 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4805 if test -n "$NS_ENABLE_TSF"; then
4806 AC_DEFINE(NS_ENABLE_TSF)
4812 *-android*|*-linuxandroid*)
4817 MOZ_THEME_FASTSTRIPE=1
4823 MOZ_ARG_ENABLE_STRING(application,
4824 [ --enable-application=APP
4828 content/xslt (Standalone Transformiix XSLT)
4829 netwerk (Standalone Necko)
4830 tools/update-packaging (AUS-related packaging tools)
4831 standalone (use this for standalone
4832 xpcom/xpconnect or to manually drive a build)],
4833 [ MOZ_BUILD_APP=$enableval ] )
4835 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4836 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4837 XULRUNNER_STUB_NAME=$withval)
4839 if test -z "$XULRUNNER_STUB_NAME"; then
4840 case "$target_os" in
4842 XULRUNNER_STUB_NAME=xulrunner
4845 XULRUNNER_STUB_NAME=xulrunner-stub
4848 AC_SUBST(XULRUNNER_STUB_NAME)
4850 AC_MSG_CHECKING([for application to build])
4851 if test -z "$MOZ_BUILD_APP"; then
4852 AC_MSG_RESULT([browser])
4853 MOZ_BUILD_APP=browser
4855 # We have a valid application only if it has a build.mk file in its top
4857 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4858 AC_MSG_RESULT([none])
4859 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4861 AC_MSG_RESULT([$MOZ_BUILD_APP])
4865 # Allow the application to influence configure with a confvars.sh script.
4867 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4868 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4869 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4870 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4875 # Allow someone to change MOZ_APP_NAME in mozconfig
4876 MOZ_ARG_WITH_STRING(app-name,
4877 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4878 WITH_APP_NAME=$withval,
4881 if test -n "$WITH_APP_NAME" ; then
4882 MOZ_APP_NAME="$WITH_APP_NAME"
4885 # Now is a good time to test for logic errors, define mismatches, etc.
4886 case "$MOZ_BUILD_APP" in
4888 if test "$LIBXUL_SDK"; then
4889 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4894 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4895 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4897 case "$MOZ_BUILD_APP" in
4899 AC_DEFINE(MOZ_PHOENIX)
4903 AC_DEFINE(MOZ_XULRUNNER)
4911 MOZ_APP_NAME=mozilla
4912 MOZ_APP_DISPLAYNAME=Mozilla
4913 MOZ_APP_VERSION=$MOZILLA_VERSION
4918 AC_SUBST(MOZ_BUILD_APP)
4919 AC_SUBST(MOZ_PHOENIX)
4920 AC_SUBST(MOZ_XULRUNNER)
4922 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4924 dnl ========================================================
4926 dnl = Toolkit Options
4928 dnl ========================================================
4929 MOZ_ARG_HEADER(Toolkit Options)
4931 dnl ========================================================
4932 dnl = Select the default toolkit
4933 dnl ========================================================
4934 MOZ_ARG_ENABLE_STRING(default-toolkit,
4935 [ --enable-default-toolkit=TK
4936 Select default toolkit
4937 Platform specific defaults:
4938 Mac OS X - cairo-cocoa
4940 Win32 - cairo-windows
4941 Gtk2 with DirectFB - cairo-gtk2-dfb
4944 [ _DEFAULT_TOOLKIT=$enableval ],
4945 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4947 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4948 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4949 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4950 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4951 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4952 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4953 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4954 -o "$_DEFAULT_TOOLKIT" = "cairo-android"
4956 dnl nglayout only supports building with one toolkit,
4957 dnl so ignore everything after the first comma (",").
4958 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4960 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4963 dnl ========================================================
4964 dnl = Enable the toolkit as needed =
4965 dnl ========================================================
4967 case "$MOZ_WIDGET_TOOLKIT" in
4970 MOZ_WIDGET_TOOLKIT=windows
4973 MOZ_INSTRUMENT_EVENT_LOOP=1
4976 cairo-gtk2|cairo-gtk2-x11)
4977 MOZ_WIDGET_TOOLKIT=gtk2
4979 MOZ_ENABLE_XREMOTE=1
4987 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4988 TK_LIBS='$(MOZ_GTK2_LIBS)'
4989 AC_DEFINE(MOZ_WIDGET_GTK2)
4991 MOZ_INSTRUMENT_EVENT_LOOP=1
4995 MOZ_WIDGET_TOOLKIT=gtk2
5002 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5003 TK_LIBS='$(MOZ_GTK2_LIBS)'
5004 AC_DEFINE(MOZ_WIDGET_GTK2)
5005 if test "$no_x" != "yes"; then
5006 AC_MSG_WARN([Disabling X when DirectFB is specified.])
5013 MOZ_WIDGET_TOOLKIT=qt
5015 MOZ_ENABLE_XREMOTE=1
5025 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5026 TK_LIBS='$(MOZ_QT_LIBS)'
5027 AC_DEFINE(MOZ_WIDGET_QT)
5032 MOZ_WIDGET_TOOLKIT=os2
5034 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5035 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5040 MOZ_WIDGET_TOOLKIT=cocoa
5041 AC_DEFINE(MOZ_WIDGET_COCOA)
5042 MOZ_USER_DIR="Mozilla"
5043 AC_DEFINE(XP_MACOSX)
5044 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5045 TK_CFLAGS="-DNO_X11"
5046 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5047 CFLAGS="$CFLAGS $TK_CFLAGS"
5048 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5049 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5050 MOZ_FS_LAYOUT=bundle
5052 MOZ_INSTRUMENT_EVENT_LOOP=1
5056 AC_DEFINE(MOZ_WIDGET_ANDROID)
5057 MOZ_WIDGET_TOOLKIT=android
5058 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5059 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5066 AC_SUBST(MOZ_PDF_PRINTING)
5067 if test "$MOZ_PDF_PRINTING"; then
5068 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5069 AC_DEFINE(MOZ_PDF_PRINTING)
5072 if test "$MOZ_ENABLE_XREMOTE"; then
5073 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5076 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
5077 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
5080 if test "$COMPILE_ENVIRONMENT"; then
5081 if test "$MOZ_ENABLE_GTK2"; then
5082 if test "$MOZ_X11"; then
5083 GDK_PACKAGES=gdk-x11-2.0
5084 elif test "$MOZ_DFB"; then
5085 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5086 GDK_PACKAGES=directfb
5089 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5092 fi # COMPILE_ENVIRONMENT
5094 AC_SUBST(MOZ_FS_LAYOUT)
5096 dnl ========================================================
5097 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5098 dnl their usage and use them in spidermonkey.
5099 dnl ========================================================
5100 MOZ_ARG_WITH_BOOL(arm-kuser,
5101 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5103 if test -n "$USE_ARM_KUSER"; then
5104 AC_DEFINE(USE_ARM_KUSER)
5107 dnl ========================================================
5108 dnl = startup-notification support module
5109 dnl ========================================================
5111 if test "$MOZ_ENABLE_GTK2"
5113 MOZ_ENABLE_STARTUP_NOTIFICATION=
5115 MOZ_ARG_ENABLE_BOOL(startup-notification,
5116 [ --enable-startup-notification
5117 Enable startup-notification support (default: disabled) ],
5118 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5119 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5120 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5122 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5123 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5124 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5125 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5127 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5129 MOZ_ENABLE_STARTUP_NOTIFICATION=
5133 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5134 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5137 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5139 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5140 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5141 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5143 dnl ========================================================
5145 dnl ========================================================
5146 if test "$MOZ_ENABLE_QT"
5148 MOZ_ARG_WITH_STRING(qtdir,
5149 [ --with-qtdir=\$dir Specify Qt directory ],
5152 if test -z "$QTDIR"; then
5153 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5154 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5156 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5158 MOZ_QT_CFLAGS="-DQT_SHARED"
5159 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5160 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5161 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5162 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5163 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5164 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5165 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5166 HOST_MOC="$QTDIR/bin/moc"
5168 if test -z "$HOST_MOC"; then
5169 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5174 MOZ_ENABLE_QMSYSTEM2=
5175 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
5176 MOZ_ENABLE_QMSYSTEM2=1,
5177 MOZ_ENABLE_QMSYSTEM2=)
5179 if test "$MOZ_ENABLE_QMSYSTEM2"; then
5180 MOZ_ENABLE_QMSYSTEM2=1
5181 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
5182 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
5183 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
5186 MOZ_ENABLE_QTNETWORK=
5187 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5188 MOZ_ENABLE_QTNETWORK=1,
5189 MOZ_ENABLE_QTNETWORK=)
5191 if test "$MOZ_ENABLE_QTNETWORK"; then
5192 MOZ_ENABLE_QTNETWORK=1
5193 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5196 MOZ_ENABLE_QTMOBILITY=
5197 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback,
5198 MOZ_ENABLE_QTMOBILITY=1,
5199 MOZ_ENABLE_QTMOBILITY=)
5200 if test "$MOZ_ENABLE_QTMOBILITY"; then
5201 MOZ_ENABLE_QTMOBILITY=1
5202 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
5203 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
5205 AC_CHECK_LIB(QtSensors QtFeedback, main, [
5206 MOZ_ENABLE_QTMOBILITY=1
5207 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtMobility"
5208 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtSensors"
5209 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtFeedback"
5210 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback"
5213 if test "$MOZ_ENABLE_QTMOBILITY"; then
5214 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
5218 AC_SUBST(GTK_CONFIG)
5222 AC_SUBST(MOZ_ENABLE_GTK2)
5223 AC_SUBST(MOZ_ENABLE_QT)
5224 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5225 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
5226 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
5227 AC_SUBST(MOZ_ENABLE_XREMOTE)
5228 AC_SUBST(MOZ_GTK2_CFLAGS)
5229 AC_SUBST(MOZ_GTK2_LIBS)
5230 AC_SUBST(MOZ_QT_CFLAGS)
5231 AC_SUBST(MOZ_QT_LIBS)
5238 dnl ========================================================
5240 dnl = Components & Features
5242 dnl ========================================================
5243 MOZ_ARG_HEADER(Components and Features)
5245 dnl ========================================================
5247 dnl ========================================================
5248 MOZ_ARG_ENABLE_STRING(ui-locale,
5249 [ --enable-ui-locale=ab-CD
5250 Select the user interface locale (default: en-US)],
5251 MOZ_UI_LOCALE=$enableval )
5252 AC_SUBST(MOZ_UI_LOCALE)
5254 dnl ========================================================
5255 dnl = Trademarked Branding
5256 dnl ========================================================
5257 MOZ_ARG_ENABLE_BOOL(official-branding,
5258 [ --enable-official-branding
5259 Enable Official mozilla.org Branding
5260 Do not distribute builds with
5261 --enable-official-branding unless you have
5262 permission to use trademarks per
5263 http://www.mozilla.org/foundation/trademarks/ .],
5265 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5266 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5268 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5269 MOZ_OFFICIAL_BRANDING=1
5271 ], MOZ_OFFICIAL_BRANDING=)
5273 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5274 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5275 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5278 MOZ_ARG_WITH_STRING(branding,
5279 [ --with-branding=dir Use branding from the specified directory.],
5280 MOZ_BRANDING_DIRECTORY=$withval)
5282 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5283 if test -z "$REAL_BRANDING_DIRECTORY"; then
5284 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5287 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5288 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5291 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5293 dnl ========================================================
5294 dnl = Distribution ID
5295 dnl ========================================================
5296 MOZ_ARG_WITH_STRING(distribution-id,
5297 [ --with-distribution-id=ID
5298 Set distribution-specific id (default=org.mozilla)],
5299 [ val=`echo $withval`
5300 MOZ_DISTRIBUTION_ID="$val"])
5302 if test -z "$MOZ_DISTRIBUTION_ID"; then
5303 MOZ_DISTRIBUTION_ID="org.mozilla"
5306 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5307 AC_SUBST(MOZ_DISTRIBUTION_ID)
5310 dnl ========================================================
5311 dnl complex text support off by default
5312 dnl ========================================================
5313 MOZ_ARG_DISABLE_BOOL(pango,
5314 [ --disable-pango Disable usage of Pango ],
5318 dnl ========================================================
5320 dnl ========================================================
5321 if test "$MOZ_ENABLE_GTK2"
5325 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5327 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5328 AC_SUBST(MOZ_PANGO_CFLAGS)
5329 AC_SUBST(MOZ_PANGO_LIBS)
5330 if test "$MOZ_PANGO"
5332 AC_DEFINE(MOZ_PANGO)
5334 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5335 AC_SUBST(FT2_CFLAGS)
5340 if test "$MOZ_ENABLE_QT"
5342 if test "$MOZ_PANGO"
5344 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5346 AC_SUBST(MOZ_PANGO_CFLAGS)
5347 AC_SUBST(MOZ_PANGO_LIBS)
5348 AC_DEFINE(MOZ_PANGO)
5351 echo "Pango library not found, will use FT2 font engine"
5358 dnl ========================================================
5359 dnl = GnomeVFS, GIO and GConf support module
5360 dnl ========================================================
5364 dnl build the gnomevfs extension by default only when the
5365 dnl GTK2 toolkit is in use.
5366 if test "$MOZ_ENABLE_GTK2"
5368 MOZ_ENABLE_GNOMEVFS=1
5372 dnl ========================================================
5373 dnl = GnomeVFS support module
5374 dnl ========================================================
5375 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5376 [ --disable-gnomevfs Disable GnomeVFS support ],
5377 MOZ_ENABLE_GNOMEVFS=,
5378 MOZ_ENABLE_GNOMEVFS=force)
5380 if test "$MOZ_ENABLE_GNOMEVFS"
5382 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5383 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5384 MOZ_ENABLE_GNOMEVFS=1
5385 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5387 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5389 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5391 MOZ_ENABLE_GNOMEVFS=
5394 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5395 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5396 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5401 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5402 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5403 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5405 dnl ========================================================
5406 dnl = GIO support module
5407 dnl ========================================================
5408 MOZ_ARG_ENABLE_BOOL(gio,
5409 [ --enable-gio Enable GIO support (default: disabled)],
5410 MOZ_ENABLE_GIO=force,
5413 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5415 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
5416 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5417 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5418 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5420 AC_DEFINE(MOZ_ENABLE_GIO)
5422 if test "$MOZ_ENABLE_GIO" = "force"
5424 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5430 AC_SUBST(MOZ_ENABLE_GIO)
5431 AC_SUBST(MOZ_GIO_CFLAGS)
5432 AC_SUBST(MOZ_GIO_LIBS)
5434 dnl ========================================================
5435 dnl = GConf support module
5436 dnl ========================================================
5437 MOZ_ARG_DISABLE_BOOL(gconf,
5438 [ --disable-gconf Disable Gconf support ],
5440 MOZ_ENABLE_GCONF=force)
5442 if test "$MOZ_ENABLE_GCONF"
5444 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5445 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5448 if test "$MOZ_ENABLE_GCONF" = "force"
5450 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5456 if test "$MOZ_ENABLE_GCONF"; then
5457 AC_DEFINE(MOZ_ENABLE_GCONF)
5460 AC_SUBST(MOZ_ENABLE_GCONF)
5461 AC_SUBST(MOZ_GCONF_CFLAGS)
5462 AC_SUBST(MOZ_GCONF_LIBS)
5465 dnl ========================================================
5466 dnl = libproxy support
5467 dnl ========================================================
5469 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5471 MOZ_ENABLE_LIBPROXY=
5473 MOZ_ARG_ENABLE_BOOL(libproxy,
5474 [ --enable-libproxy Enable libproxy support ],
5475 MOZ_ENABLE_LIBPROXY=1,
5476 MOZ_ENABLE_LIBPROXY=)
5478 if test "$MOZ_ENABLE_LIBPROXY"
5480 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5481 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5484 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5485 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5486 AC_SUBST(MOZ_LIBPROXY_LIBS)
5488 dnl ========================================================
5489 dnl = libnotify support
5490 dnl ========================================================
5492 if test "$MOZ_ENABLE_GTK2"
5494 MOZ_ENABLE_LIBNOTIFY=1
5496 MOZ_ARG_DISABLE_BOOL(libnotify,
5497 [ --disable-libnotify Disable libnotify support ],
5498 MOZ_ENABLE_LIBNOTIFY=,
5499 MOZ_ENABLE_LIBNOTIFY=1)
5501 if test "$MOZ_ENABLE_LIBNOTIFY"
5503 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5507 if test -z "$SKIP_LIBRARY_CHECKS"
5509 if test "$MOZ_ENABLE_GTK2"
5511 if test "$MOZ_ENABLE_LIBNOTIFY"
5513 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5517 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5518 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5519 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5521 dnl ========================================================
5522 dnl = GNOME component (mozgnome)
5523 dnl ========================================================
5525 # The GNOME component is built if one of
5526 # gnome-vfs, gio, gconf or libnotify is available.
5527 if test "$MOZ_ENABLE_GCONF" -o \
5528 "$MOZ_ENABLE_GNOMEVFS" -o \
5529 "$MOZ_ENABLE_GIO" -o \
5530 "$MOZ_ENABLE_LIBNOTIFY"; then
5531 MOZ_ENABLE_GNOME_COMPONENT=1
5533 MOZ_ENABLE_GNOME_COMPONENT=
5535 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5537 dnl ========================================================
5538 dnl = libgnomeui support module
5539 dnl ========================================================
5541 if test "$MOZ_ENABLE_GTK2"
5543 MOZ_ENABLE_GNOMEUI=1
5545 MOZ_ARG_DISABLE_BOOL(gnomeui,
5546 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5547 MOZ_ENABLE_GNOMEUI=,
5548 MOZ_ENABLE_GNOMEUI=force)
5550 if test "$MOZ_ENABLE_GNOMEUI"
5552 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5554 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5555 MOZ_ENABLE_GNOMEUI=1
5557 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5559 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5565 if test "$MOZ_ENABLE_GNOMEUI"; then
5566 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5570 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5571 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5572 AC_SUBST(MOZ_GNOMEUI_LIBS)
5574 dnl ========================================================
5576 dnl ========================================================
5578 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5582 MOZ_ARG_DISABLE_BOOL(dbus,
5583 [ --disable-dbus Disable dbus support ],
5587 if test "$MOZ_ENABLE_DBUS"
5589 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5590 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5591 AC_DEFINE(MOZ_ENABLE_DBUS)
5594 AC_SUBST(MOZ_ENABLE_DBUS)
5595 AC_SUBST(MOZ_DBUS_CFLAGS)
5596 AC_SUBST(MOZ_DBUS_LIBS)
5597 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5598 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5600 dnl ========================================================
5601 dnl = Build Personal Security Manager
5602 dnl ========================================================
5603 MOZ_ARG_DISABLE_BOOL(crypto,
5604 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5608 dnl ========================================================
5609 dnl = JS Debugger XPCOM component (js/jsd)
5610 dnl ========================================================
5611 MOZ_ARG_DISABLE_BOOL(jsd,
5612 [ --disable-jsd Disable JavaScript debug library],
5617 dnl ========================================================
5618 dnl = Enable IPDL's "expensive" unit tests
5619 dnl ========================================================
5622 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5623 [ --enable-ipdl-tests Enable expensive IPDL tests],
5627 if test -n "$MOZ_IPDL_TESTS"; then
5628 AC_DEFINE(MOZ_IPDL_TESTS)
5631 AC_SUBST(MOZ_IPDL_TESTS)
5633 dnl ========================================================
5634 dnl = Turns off code necessary for e10s compatibility
5635 dnl ========================================================
5636 dnl This is a temporary flag to be removed in bug 662601 when
5637 dnl it's no longer needed
5641 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5642 [ --enable-e10s-compat Turns off code for e10s compat],
5646 if test -n "$MOZ_E10S_COMPAT"; then
5647 AC_DEFINE(MOZ_E10S_COMPAT)
5650 dnl ========================================================
5651 dnl = Disable building dbm
5652 dnl ========================================================
5653 MOZ_ARG_DISABLE_BOOL(dbm,
5654 [ --disable-dbm Disable building dbm],
5658 dnl bi-directional support always on
5662 dnl ========================================================
5663 dnl accessibility support on by default on all platforms
5665 dnl ========================================================
5666 MOZ_ARG_DISABLE_BOOL(accessibility,
5667 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5670 if test "$ACCESSIBILITY"; then
5671 AC_DEFINE(ACCESSIBILITY)
5674 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5677 if test "$ac_cv_header_atlbase_h" = "no"; then
5678 AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5680 if test "$ac_cv_header_oleacc_idl" = "no"; then
5681 AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
5687 dnl ========================================================
5688 dnl Disable printing
5689 dnl ========================================================
5690 MOZ_ARG_DISABLE_BOOL(printing,
5691 [ --disable-printing Disable printing support],
5695 if test "$NS_PRINTING"; then
5696 AC_DEFINE(NS_PRINTING)
5697 AC_DEFINE(NS_PRINT_PREVIEW)
5700 dnl ========================================================
5701 dnl = Enable Raw Codecs
5702 dnl ========================================================
5703 MOZ_ARG_ENABLE_BOOL(raw,
5704 [ --enable-raw Enable support for RAW media],
5708 if test -n "$MOZ_RAW"; then
5715 dnl ========================================================
5716 dnl = Disable Ogg Codecs
5717 dnl ========================================================
5718 MOZ_ARG_DISABLE_BOOL(ogg,
5719 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5723 if test -n "$MOZ_OGG"; then
5727 case "$target_cpu" in
5736 dnl Checks for __attribute__(aligned()) directive
5737 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5738 [ac_cv_c_attribute_aligned],
5739 [ac_cv_c_attribute_aligned=0
5740 CFLAGS_save="${CFLAGS}"
5741 CFLAGS="${CFLAGS} -Werror"
5742 for ac_cv_c_attr_align_try in 64 32 16 8; do
5743 echo "trying $ac_cv_c_attr_align_try"
5745 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5746 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5747 if test "$ac_cv_c_attribute_aligned" != 0; then
5751 CFLAGS="${CFLAGS_save}"])
5752 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5753 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5754 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5758 dnl ========================================================
5759 dnl = Disable VP8 decoder support
5760 dnl ========================================================
5761 MOZ_ARG_DISABLE_BOOL(webm,
5762 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5766 dnl system libvpx Support
5767 dnl ========================================================
5768 MOZ_ARG_WITH_STRING(system-libvpx,
5769 [ --with-system-libvpx=[PFX]
5770 Use system libvpx [installed at prefix PFX]],
5771 LIBVPX_DIR=$withval)
5774 MOZ_LIBVPX_INCLUDES=
5777 if test -n "$MOZ_WEBM"; then
5780 if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
5781 _SAVE_CFLAGS=$CFLAGS
5782 _SAVE_LDFLAGS=$LDFLAGS
5784 if test "${LIBVPX_DIR}" = "yes"; then
5787 CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
5788 LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
5789 MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
5790 [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
5791 AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
5793 AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
5794 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
5795 [MOZ_NATIVE_LIBVPX=1
5796 MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
5797 MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
5798 ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
5799 CFLAGS=$_SAVE_CFLAGS
5800 LDFLAGS=$_SAVE_LDFLAGS
5805 AC_SUBST(MOZ_NATIVE_LIBVPX)
5806 AC_SUBST(MOZ_LIBVPX_INCLUDES)
5807 AC_SUBST(MOZ_LIBVPX_LIBS)
5809 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
5812 case "$target_cpu" in
5822 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5823 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5824 dnl We currently require gcc on all arm platforms.
5828 dnl See if we have assembly on this platform.
5829 case "$OS_ARCH:$CPU_ARCH" in
5831 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5835 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5839 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5843 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5847 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5851 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5855 if test -z "$GNU_CC"; then
5856 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5861 if test -z "$GNU_CC"; then
5862 dnl Check for yasm 1.1 or greater.
5863 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5864 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.])
5865 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5866 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.])
5868 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5874 if test -n "$GNU_AS" ; then
5876 dnl These flags are a lie; they're just used to enable the requisite
5877 dnl opcodes; actual arch detection is done at runtime.
5878 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5879 VPX_DASH_C_FLAG="-c"
5880 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5881 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5886 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5887 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.])
5890 if test -n "$VPX_X86_ASM"; then
5891 AC_DEFINE(VPX_X86_ASM)
5892 elif test -n "$VPX_ARM_ASM"; then
5893 AC_DEFINE(VPX_ARM_ASM)
5895 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5899 dnl ========================================================
5900 dnl = Disable Wave decoder support
5901 dnl ========================================================
5902 MOZ_ARG_DISABLE_BOOL(wave,
5903 [ --disable-wave Disable Wave decoder support],
5907 if test -n "$MOZ_WAVE"; then
5913 dnl ========================================================
5914 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5915 dnl ========================================================
5917 if test -n "$MOZ_SYDNEYAUDIO"; then
5918 AC_DEFINE(MOZ_SYDNEYAUDIO)
5921 if test -n "$MOZ_MEDIA"; then
5922 AC_DEFINE(MOZ_MEDIA)
5925 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5926 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/])
5929 if test -n "$MOZ_VORBIS"; then
5930 AC_DEFINE(MOZ_VORBIS)
5933 if test -n "$MOZ_TREMOR"; then
5934 AC_DEFINE(MOZ_TREMOR)
5937 dnl ========================================================
5938 dnl = Check alsa availability on Linux if using sydneyaudio
5939 dnl ========================================================
5941 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5942 if test -n "$MOZ_SYDNEYAUDIO"; then
5943 case "$target_os" in
5945 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5946 [echo "$MOZ_ALSA_PKG_ERRORS"
5947 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.)])])
5952 dnl ========================================================
5953 dnl Permissions System
5954 dnl ========================================================
5955 MOZ_ARG_DISABLE_BOOL(permissions,
5956 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5961 dnl ========================================================
5963 dnl ========================================================
5964 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5965 [ --disable-negotiateauth Disable GSS-API negotiation ],
5966 MOZ_AUTH_EXTENSION=,
5967 MOZ_AUTH_EXTENSION=1 )
5969 dnl ========================================================
5971 dnl ========================================================
5972 MOZ_ARG_DISABLE_BOOL(xtf,
5973 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5976 if test "$MOZ_XTF"; then
5980 dnl ========================================================
5981 dnl Pref extensions (autoconfig and system-pref)
5982 dnl ========================================================
5983 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5984 [ --disable-pref-extensions
5985 Disable pref extensions such as autoconfig and
5987 MOZ_PREF_EXTENSIONS=,
5988 MOZ_PREF_EXTENSIONS=1 )
5990 dnl ========================================================
5991 dnl = Universalchardet
5992 dnl ========================================================
5993 MOZ_ARG_DISABLE_BOOL(universalchardet,
5994 [ --disable-universalchardet
5995 Disable universal encoding detection],
5996 MOZ_UNIVERSALCHARDET=,
5997 MOZ_UNIVERSALCHARDET=1 )
5999 if test -n "${JAVA_BIN_PATH}"; then
6000 dnl Look for javac and jar in the specified path.
6001 JAVA_PATH="$JAVA_BIN_PATH"
6003 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6004 JAVA_PATH="$JAVA_HOME/bin:$PATH"
6007 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6008 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6009 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6011 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6012 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6013 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}])
6017 dnl ========================================================
6018 dnl = ANGLE OpenGL->D3D translator for WebGL
6019 dnl = * only applies to win32
6020 dnl = * enabled by default (shipping build); requires explicit --disable to disable
6021 dnl ========================================================
6023 MOZ_DIRECTX_SDK_PATH=
6024 MOZ_DIRECTX_SDK_CPU_SUFFIX=
6027 MOZ_D3DCOMPILER_CAB=
6029 MOZ_D3DCOMPILER_DLL=
6030 case "$target_os" in
6036 # The DirectX SDK libraries are split into x86 and x64 sub-directories
6037 case "${target_cpu}" in
6039 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
6042 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
6046 if test -n "$MOZ_ANGLE"; then
6047 MOZ_ARG_DISABLE_BOOL(angle,
6048 [ --disable-angle Disable building of ANGLE for WebGL->D3D translation],
6052 if test -n "$MOZ_ANGLE"; then
6053 if test -z "$_WIN32_MSVC"; then
6054 AC_MSG_ERROR([Building ANGLE requires MSVC. To build without ANGLE, reconfigure with --disable-angle.])
6057 # Get the SDK path from the registry.
6058 # First try to get the June 2010 SDK
6059 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
6060 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
6061 # Otherwise just take whatever comes first
6062 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
6065 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
6066 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.])
6068 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
6073 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6074 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
6075 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
6080 if test -z "$MOZ_ANGLE" ; then
6081 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.])
6084 if test -n "$MOZ_ANGLE" ; then
6085 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
6086 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'`
6088 if test -z "$MOZ_D3DX9_VERSION" ; then
6089 AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for ANGLE. To explicitly build without ANGLE, reconfigure with --disable-angle.])
6092 if test -n "$MOZ_ANGLE" ; then
6093 MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6094 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6096 MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
6097 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6103 dnl ========================================================
6104 dnl = Breakpad crash reporting (on by default on supported platforms)
6105 dnl ========================================================
6108 i?86-*-mingw*|x86_64-*-mingw*)
6111 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6114 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6115 if test "$MOZ_ENABLE_GTK2"; then
6119 *-android*|*-linuxandroid*)
6127 MOZ_ARG_DISABLE_BOOL(crashreporter,
6128 [ --disable-crashreporter Disable breakpad crash reporting],
6130 MOZ_CRASHREPORTER=1)
6132 if test -n "$MOZ_CRASHREPORTER"; then
6133 AC_DEFINE(MOZ_CRASHREPORTER)
6135 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6136 test -z "$SKIP_LIBRARY_CHECKS"; then
6137 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6138 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6139 AC_SUBST(MOZ_GTHREAD_LIBS)
6141 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.])])
6145 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6146 [ --with-crashreporter-enable-percent=NN
6147 Enable sending crash reports by default on NN% of users. (default=100)],
6148 [ val=`echo $withval | sed 's/[^0-9]//g'`
6149 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6151 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6152 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6154 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6156 dnl ========================================================
6157 dnl = libjpeg-turbo configuration
6158 dnl ========================================================
6160 if test -z "$SYSTEM_JPEG"; then
6164 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6165 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6167 MOZ_LIBJPEG_TURBO=1)
6169 if test "$SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6170 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6173 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6176 if test -n "$MOZ_LIBJPEG_TURBO"; then
6178 dnl Do we support libjpeg-turbo on this platform?
6179 case "$OS_ARCH:$OS_TEST" in
6180 Linux:x86|Linux:i?86)
6181 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6182 LIBJPEG_TURBO_X86_ASM=1
6185 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6186 LIBJPEG_TURBO_X64_ASM=1
6189 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6190 LIBJPEG_TURBO_X86_ASM=1
6193 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6194 LIBJPEG_TURBO_X64_ASM=1
6197 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6198 LIBJPEG_TURBO_X86_ASM=1
6201 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6202 LIBJPEG_TURBO_X64_ASM=1
6204 WINNT:x86|WINNT:i?86)
6205 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6206 LIBJPEG_TURBO_X86_ASM=1
6209 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6210 LIBJPEG_TURBO_X64_ASM=1
6216 dnl If we're on a system which supports libjpeg-turbo's asm routines and
6217 dnl --disable-libjpeg-turbo wasn't passed, check for yasm, and error out if it
6218 dnl doesn't exist or we have too old of a version.
6219 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6220 AC_MSG_CHECKING([for YASM assembler])
6221 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6223 if test -z "$LIBJPEG_TURBO_AS" ; then
6224 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.])
6227 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6228 dnl on Linux and 1.1 or newer everywhere else.
6229 if test "$OS_ARCH" = "Linux" ; then
6230 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
6231 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.])
6234 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6235 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.])
6240 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6241 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6242 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6243 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6244 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6245 dnl Warn if we're not building the optimized routines, even though the user
6246 dnl didn't specify --disable-libjpeg-turbo.
6247 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6250 dnl ========================================================
6251 dnl = Enable compilation of specific extension modules
6252 dnl ========================================================
6254 MOZ_ARG_ENABLE_STRING(extensions,
6255 [ --enable-extensions Enable extensions],
6256 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6257 if test "$option" = "yes" -o "$option" = "all"; then
6258 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6259 elif test "$option" = "no" -o "$option" = "none"; then
6261 elif test "$option" = "default"; then
6262 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6263 elif test `echo "$option" | grep -c \^-` != 0; then
6264 option=`echo $option | sed 's/^-//'`
6265 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6267 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6270 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6272 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6273 # Suppress warning on non-X11 platforms
6274 if test -n "$MOZ_X11"; then
6275 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6277 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6280 dnl Do not build gnomevfs with libxul based apps
6281 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6282 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6285 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6286 # Suppress warning on non-X11 platforms
6287 if test -n "$MOZ_X11"; then
6288 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6290 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6293 dnl Do not build gio with libxul based apps
6294 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6295 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6298 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6299 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6300 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6303 dnl xforms requires xtf
6304 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6305 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6306 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6310 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6312 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6313 dnl when trying to build a nonexistent extension.
6314 for extension in $MOZ_EXTENSIONS; do
6315 if test ! -d "${srcdir}/extensions/${extension}"; then
6316 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6320 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6321 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6324 dnl ========================================================
6325 dnl SVG Display Lists
6326 dnl ========================================================
6327 if test -n "$MOZ_SVG_DLISTS"; then
6328 AC_DEFINE(MOZ_SVG_DLISTS)
6331 dnl ========================================================
6333 dnl ========================================================
6335 MOZ_ARG_DISABLE_BOOL(smil,
6336 [ --disable-smil Disable SMIL animation support],
6339 if test -n "$MOZ_SMIL"; then
6343 dnl ========================================================
6344 dnl Build Freetype in the tree
6345 dnl ========================================================
6346 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6347 [ --enable-tree-freetype Enable Tree FreeType],
6348 MOZ_TREE_FREETYPE=1,
6349 MOZ_TREE_FREETYPE= )
6350 if test -n "$MOZ_TREE_FREETYPE"; then
6351 if test -n "$_WIN32_MSVC"; then
6352 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6354 AC_DEFINE(MOZ_TREE_FREETYPE)
6355 AC_SUBST(MOZ_TREE_FREETYPE)
6356 MOZ_ENABLE_CAIRO_FT=1
6357 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6358 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6359 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6360 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6361 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6362 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6363 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6364 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6365 AC_SUBST(CAIRO_FT_CFLAGS)
6368 dnl ========================================================
6370 dnl ========================================================
6371 case "$target_os" in
6372 aix*|solaris*|linux*|mingw*|os2*)
6377 MOZ_ARG_DISABLE_BOOL(installer,
6378 [ --disable-installer Disable building of installer],
6381 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6382 # Disable installer for Windows builds that use the new toolkit if the
6383 # required major version and minimum minor version of Unicode NSIS isn't in
6385 REQ_NSIS_MAJOR_VER=2
6386 MIN_NSIS_MINOR_VER=33
6387 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6388 if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6389 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.])
6392 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6394 if test ! "$MAKENSISU_VER" = ""; then
6395 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6396 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6398 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6399 if test "$MAKENSISU_VER" = "" ||
6400 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6401 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6403 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.])
6405 AC_MSG_RESULT([yes])
6408 AC_SUBST(MOZ_INSTALLER)
6410 AC_MSG_CHECKING([for tar archiver])
6411 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6412 if test -z "$TAR"; then
6413 AC_MSG_ERROR([no tar archiver found in \$PATH])
6415 AC_MSG_RESULT([$TAR])
6418 AC_MSG_CHECKING([for wget])
6419 AC_CHECK_PROGS(WGET, wget, "")
6420 AC_MSG_RESULT([$WGET])
6423 dnl ========================================================
6425 dnl ========================================================
6427 MOZ_ARG_DISABLE_BOOL(updater,
6428 [ --disable-updater Disable building of updater],
6432 if test -n "$MOZ_UPDATER"; then
6433 AC_DEFINE(MOZ_UPDATER)
6436 # app update channel is 'default' when not supplied.
6437 MOZ_ARG_ENABLE_STRING([update-channel],
6438 [ --enable-update-channel=CHANNEL
6439 Select application update channel (default=default)],
6440 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6442 if test -z "$MOZ_UPDATE_CHANNEL"; then
6443 MOZ_UPDATE_CHANNEL=default
6445 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6446 AC_SUBST(MOZ_UPDATE_CHANNEL)
6448 # tools/update-packaging is not checked out by default.
6449 MOZ_ARG_ENABLE_BOOL(update-packaging,
6450 [ --enable-update-packaging
6451 Enable tools/update-packaging],
6452 MOZ_UPDATE_PACKAGING=1,
6453 MOZ_UPDATE_PACKAGING= )
6454 AC_SUBST(MOZ_UPDATE_PACKAGING)
6456 dnl ========================================================
6458 dnl ========================================================
6459 MOZ_ARG_ENABLE_BOOL(leaky,
6460 [ --enable-leaky Build leaky memory tool],
6465 dnl ========================================================
6466 dnl build the tests by default
6467 dnl ========================================================
6468 MOZ_ARG_DISABLE_BOOL(tests,
6469 [ --disable-tests Do not build test libraries & programs],
6473 dnl ========================================================
6474 dnl parental controls (for Windows Vista)
6475 dnl ========================================================
6476 MOZ_ARG_DISABLE_BOOL(parental-controls,
6477 [ --disable-parental-controls
6478 Do not build parental controls],
6479 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6480 MOZ_DISABLE_PARENTAL_CONTROLS=)
6481 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6482 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6485 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6487 dnl ========================================================
6488 dnl = Disable DOMCrypto
6489 dnl ========================================================
6490 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6491 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6494 dnl ========================================================
6496 dnl = Module specific options
6498 dnl ========================================================
6499 MOZ_ARG_HEADER(Individual module options)
6501 dnl ========================================================
6502 dnl = Disable feed handling components
6503 dnl ========================================================
6504 MOZ_ARG_DISABLE_BOOL(feeds,
6505 [ --disable-feeds Disable feed handling and processing components],
6508 if test -n "$MOZ_FEEDS"; then
6509 AC_DEFINE(MOZ_FEEDS)
6511 if test "$MOZ_BUILD_APP" = "browser"; then
6512 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6516 dnl ========================================================
6517 dnl Check for sqlite
6518 dnl ========================================================
6521 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6522 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6523 MOZ_NATIVE_SQLITE=1,
6524 MOZ_NATIVE_SQLITE= )
6526 if test -z "$MOZ_NATIVE_SQLITE"
6529 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6531 dnl ============================
6532 dnl === SQLite Version check ===
6533 dnl ============================
6534 dnl Check to see if the system SQLite package is new enough.
6535 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6537 dnl ==================================
6538 dnl === SQLITE_SECURE_DELETE check ===
6539 dnl ==================================
6540 dnl Check to see if the system SQLite package is compiled with
6541 dnl SQLITE_SECURE_DELETE enabled.
6542 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6543 _SAVE_CFLAGS="$CFLAGS"
6544 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6546 LIBS="$LIBS $SQLITE_LIBS"
6547 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6549 #include "sqlite3.h"
6551 int main(int argc, char **argv){
6552 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6554 ac_cv_sqlite_secure_delete=yes,
6555 ac_cv_sqlite_secure_delete=no,
6556 ac_cv_sqlite_secure_delete=no
6559 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6560 CFLAGS="$_SAVE_CFLAGS"
6562 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6563 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6566 dnl ===============================
6567 dnl === SQLITE_THREADSAFE check ===
6568 dnl ===============================
6569 dnl Check to see if the system SQLite package is compiled with
6570 dnl SQLITE_THREADSAFE enabled.
6571 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6572 _SAVE_CFLAGS="$CFLAGS"
6573 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6575 LIBS="$LIBS $SQLITE_LIBS"
6576 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6578 #include "sqlite3.h"
6580 int main(int argc, char **argv){
6581 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6583 ac_cv_sqlite_threadsafe=yes,
6584 ac_cv_sqlite_threadsafe=no,
6585 ac_cv_sqlite_threadsafe=no
6588 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6589 CFLAGS="$_SAVE_CFLAGS"
6591 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6592 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6595 dnl ================================
6596 dnl === SQLITE_ENABLE_FTS3 check ===
6597 dnl ================================
6598 dnl check to see if the system SQLite package is compiled with
6599 dnl SQLITE_ENABLE_FTS3 enabled.
6600 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6601 _SAVE_CFLAGS="$CFLAGS"
6602 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6604 LIBS="$LIBS $SQLITE_LIBS"
6605 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6607 #include "sqlite3.h"
6609 int main(int argc, char **argv){
6610 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6612 ac_cv_sqlite_enable_fts3=yes,
6613 ac_cv_sqlite_enable_fts3=no,
6614 ac_cv_sqlite_enable_fts3=no
6617 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6618 CFLAGS="$_SAVE_CFLAGS"
6620 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6621 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6624 dnl =========================================
6625 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6626 dnl =========================================
6627 dnl check to see if the system SQLite package is compiled with
6628 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6629 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6630 _SAVE_CFLAGS="$CFLAGS"
6631 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6633 LIBS="$LIBS $SQLITE_LIBS"
6634 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6636 #include "sqlite3.h"
6638 int main(int argc, char **argv){
6639 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6641 ac_cv_sqlite_enable_unlock_notify=yes,
6642 ac_cv_sqlite_enable_unlock_notify=no,
6643 ac_cv_sqlite_enable_unlock_notify=no
6646 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6647 CFLAGS="$_SAVE_CFLAGS"
6649 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6650 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6654 if test -n "$MOZ_NATIVE_SQLITE"; then
6655 AC_DEFINE(MOZ_NATIVE_SQLITE)
6657 AC_SUBST(MOZ_NATIVE_SQLITE)
6659 dnl ========================================================
6660 dnl = Enable help viewer (off by default)
6661 dnl ========================================================
6662 if test -n "$MOZ_HELP_VIEWER"; then
6663 dnl Do this if defined in confvars.sh
6664 AC_DEFINE(MOZ_HELP_VIEWER)
6667 dnl ========================================================
6668 dnl = Enable safe browsing (anti-phishing)
6669 dnl ========================================================
6670 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6671 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6672 MOZ_SAFE_BROWSING=1,
6673 MOZ_SAFE_BROWSING= )
6674 if test -n "$MOZ_SAFE_BROWSING"; then
6675 AC_DEFINE(MOZ_SAFE_BROWSING)
6677 AC_SUBST(MOZ_SAFE_BROWSING)
6679 dnl ========================================================
6680 dnl = Enable url-classifier
6681 dnl ========================================================
6682 dnl Implicitly enabled by default if building with safe-browsing
6683 if test -n "$MOZ_SAFE_BROWSING"; then
6684 MOZ_URL_CLASSIFIER=1
6686 MOZ_ARG_ENABLE_BOOL(url-classifier,
6687 [ --enable-url-classifier Enable url classifier module],
6688 MOZ_URL_CLASSIFIER=1,
6689 MOZ_URL_CLASSIFIER= )
6690 if test -n "$MOZ_URL_CLASSIFIER"; then
6691 AC_DEFINE(MOZ_URL_CLASSIFIER)
6693 AC_SUBST(MOZ_URL_CLASSIFIER)
6695 dnl ========================================================
6696 dnl = Disable zipwriter
6697 dnl ========================================================
6698 MOZ_ARG_DISABLE_BOOL(zipwriter,
6699 [ --disable-zipwriter Disable zipwriter component],
6702 AC_SUBST(MOZ_ZIPWRITER)
6704 dnl ========================================================
6706 dnl ========================================================
6707 dnl superseded by QtNetwork starting from 4.7
6708 MOZ_ENABLE_LIBCONIC=1
6710 if test -n "$MOZ_ENABLE_QT"; then
6711 if test "$MOZ_ENABLE_QTNETWORK"; then
6712 MOZ_ENABLE_LIBCONIC=
6716 MOZ_ARG_DISABLE_BOOL(libconic,
6717 [ --disable-libconic Disable libconic],
6718 MOZ_ENABLE_LIBCONIC=,
6719 MOZ_ENABLE_LIBCONIC=1 )
6721 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6722 PKG_CHECK_MODULES(LIBCONIC, conic,
6723 MOZ_ENABLE_LIBCONIC=1,
6724 MOZ_ENABLE_LIBCONIC=)
6726 if test "$MOZ_ENABLE_LIBCONIC"; then
6727 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6730 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6731 AC_SUBST(LIBCONIC_CFLAGS)
6732 AC_SUBST(LIBCONIC_LIBS)
6734 dnl ========================================================
6736 dnl ========================================================
6738 MAEMO_SDK_TARGET_VER=-1
6740 MOZ_ARG_WITH_STRING(maemo-version,
6741 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6743 MAEMO_SDK_TARGET_VER=$withval)
6745 case "$MAEMO_SDK_TARGET_VER" in
6747 MOZ_PLATFORM_MAEMO=5
6751 MOZ_PLATFORM_MAEMO=6
6755 dnl We aren't compiling for Maemo, move on.
6758 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6762 if test $MOZ_PLATFORM_MAEMO; then
6763 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6765 if test -z "$MOZ_ENABLE_DBUS"; then
6766 AC_MSG_ERROR([DBus is required when building for Maemo])
6769 MOZ_GFX_OPTIMIZE_MOBILE=1
6771 MOZ_MAEMO_LIBLOCATION=
6773 if test $MOZ_PLATFORM_MAEMO = 5; then
6774 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6775 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6776 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6777 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6778 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6780 AC_SUBST(XCOMPOSITE_LIBS)
6782 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6783 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6784 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6785 if test -z "$_LIB_FOUND"; then
6786 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6790 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6791 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6792 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6793 if test -z "$_LIB_FOUND"; then
6794 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6797 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6798 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6799 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6800 if test -z "$_LIB_FOUND"; then
6801 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6805 if test $MOZ_PLATFORM_MAEMO = 6; then
6806 dnl ========================================================
6807 dnl = Enable meego libcontentaction
6808 dnl ========================================================
6809 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6810 [ --enable-meegocontentaction Enable meegocontentaction support],
6811 MOZ_MEEGOCONTENTACTION=1,
6812 MOZ_MEEGOCONTENTACTION=)
6814 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6816 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6817 if test "$_LIB_FOUND"; then
6818 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6819 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6820 MOZ_ENABLE_CONTENTACTION=1
6821 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6822 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6826 MOZ_ARG_ENABLE_BOOL(meegotouch,
6827 [ --enable-meegotouch Enable meegotouch support],
6828 MOZ_MEEGOTOUCHENABLED=1,
6829 MOZ_MEEGOTOUCHENABLED=)
6831 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6832 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6833 if test "$_LIB_FOUND"; then
6834 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6835 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6836 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6838 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6843 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6844 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6845 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6846 if test "$_LIB_FOUND"; then
6847 MOZ_MAEMO_LIBLOCATION=1
6848 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6850 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6852 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6854 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6855 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6856 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6857 if test "$_LIB_FOUND"; then
6858 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6859 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6861 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6863 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6865 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6866 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6869 dnl ========================================================
6870 dnl = ARM toolchain tweaks
6871 dnl ========================================================
6874 case "${CPU_ARCH}-${OS_TARGET}" in
6879 MOZ_FLOAT_ABI=softfp
6882 if test -n "$MOZ_PLATFORM_MAEMO"; then
6885 MOZ_FLOAT_ABI=softfp
6887 if test "$MOZ_PLATFORM_MAEMO" = 6; then
6893 dnl Kept for compatibility with some buildbot mozconfig
6894 MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
6896 MOZ_ARG_WITH_STRING(thumb,
6897 [ --with-thumb[[=yes|no|toolchain-default]]]
6898 [ Use Thumb instruction set (-mthumb)],
6899 if test -z "$GNU_CC"; then
6900 AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
6904 MOZ_ARG_WITH_STRING(thumb-interwork,
6905 [ --with-thumb-interwork[[=yes|no|toolchain-default]]
6906 Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
6907 if test -z "$GNU_CC"; then
6908 AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
6910 MOZ_THUMB_INTERWORK=$withval)
6912 MOZ_ARG_WITH_STRING(arch,
6913 [ --with-arch=[[type|toolchain-default]]
6914 Use specific CPU features (-march=type)],
6915 if test -z "$GNU_CC"; then
6916 AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
6920 MOZ_ARG_WITH_STRING(fpu,
6921 [ --with-fpu=[[type|toolchain-default]]
6922 Use specific FPU type (-mfpu=type)],
6923 if test -z "$GNU_CC"; then
6924 AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
6928 MOZ_ARG_WITH_STRING(float-abi,
6929 [ --with-float-abi=[[type|toolchain-default]]
6930 Use specific arm float ABI (-mfloat-abi=type)],
6931 if test -z "$GNU_CC"; then
6932 AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
6934 MOZ_FLOAT_ABI=$withval)
6936 MOZ_ARG_WITH_STRING(soft-float,
6937 [ --with-soft-float[[=yes|no|toolchain-default]]
6938 Use soft float library (-msoft-float)],
6939 if test -z "$GNU_CC"; then
6940 AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
6942 MOZ_SOFT_FLOAT=$withval)
6945 toolchain-default|"")
6949 arch_flag="-march=$MOZ_ARCH"
6953 case "$MOZ_THUMB" in
6956 thumb_flag="-mthumb"
6963 _SAVE_CFLAGS="$CFLAGS"
6965 AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
6968 CFLAGS="$_SAVE_CFLAGS"
6973 if test "$MOZ_THUMB2" = 1; then
6974 AC_DEFINE(MOZ_THUMB2)
6977 case "$MOZ_THUMB_INTERWORK" in
6979 thumb_interwork_flag="-mthumb-interwork"
6982 thumb_interwork_flag="-mno-thumb-interwork"
6984 *) # toolchain-default
6985 thumb_interwork_flag=""
6990 toolchain-default|"")
6994 fpu_flag="-mfpu=$MOZ_FPU"
6998 case "$MOZ_FLOAT_ABI" in
6999 toolchain-default|"")
7003 float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
7007 case "$MOZ_SOFT_FLOAT" in
7009 soft_float_flag="-msoft-float"
7012 soft_float_flag="-mno-soft-float"
7014 *) # toolchain-default
7019 dnl Use echo to avoid accumulating space characters
7020 all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
7021 if test -n "$all_flags"; then
7022 _SAVE_CFLAGS="$CFLAGS"
7024 AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
7025 AC_TRY_COMPILE([],[return 0;],
7026 AC_MSG_RESULT([yes]),
7029 CFLAGS="$_SAVE_CFLAGS $all_flags"
7030 CXXFLAGS="$CXXFLAGS $all_flags"
7031 ASFLAGS="$ASFLAGS $all_flags"
7032 if test -n "$thumb_flag"; then
7033 LDFLAGS="$LDFLAGS $thumb_flag"
7037 AC_SUBST(MOZ_THUMB2)
7039 if test "$CPU_ARCH" = "arm"; then
7040 AC_MSG_CHECKING(for ARM SIMD support in compiler)
7041 # We try to link so that this also fails when
7042 # building with LTO.
7044 [asm("uqadd8 r1, r1, r2");],
7045 result="yes", result="no")
7046 AC_MSG_RESULT("$result")
7047 if test "$result" = "yes"; then
7048 AC_DEFINE(HAVE_ARM_SIMD)
7052 AC_MSG_CHECKING(for ARM NEON support in compiler)
7053 # We try to link so that this also fails when
7054 # building with LTO.
7056 [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
7057 result="yes", result="no")
7058 AC_MSG_RESULT("$result")
7059 if test "$result" = "yes"; then
7060 AC_DEFINE(HAVE_ARM_NEON)
7065 AC_SUBST(HAVE_ARM_SIMD)
7066 AC_SUBST(HAVE_ARM_NEON)
7068 dnl ========================================================
7069 dnl = XRender Composite
7070 dnl ========================================================
7071 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
7072 [ --enable-egl-xrender-composite
7073 Enable EGL xrender composite optimizations],
7074 MOZ_EGL_XRENDER_COMPOSITE=1)
7076 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
7077 AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
7080 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
7082 dnl ========================================================
7083 dnl = faststripe theme
7084 dnl ========================================================
7085 MOZ_ARG_ENABLE_BOOL(faststripe,
7086 [ --enable-faststripe Use faststripe theme],
7087 MOZ_THEME_FASTSTRIPE=1,
7088 MOZ_THEME_FASTSTRIPE= )
7089 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7091 dnl ========================================================
7093 dnl = Feature options that require extra sources to be pulled
7095 dnl ========================================================
7096 dnl MOZ_ARG_HEADER(Features that require extra sources)
7098 dnl ========================================================
7100 dnl = Debugging Options
7102 dnl ========================================================
7103 MOZ_ARG_HEADER(Debugging and Optimizations)
7105 dnl ========================================================
7106 dnl = Disable building with debug info.
7107 dnl = Debugging is OFF by default
7108 dnl ========================================================
7109 if test -z "$MOZ_DEBUG_FLAGS"; then
7110 MOZ_DEBUG_FLAGS="-g"
7113 MOZ_ARG_ENABLE_STRING(debug,
7114 [ --enable-debug[=DBG] Enable building with developer debug info
7115 (using compiler flags DBG)],
7116 [ if test "$enableval" != "no"; then
7118 if test -n "$enableval" -a "$enableval" != "yes"; then
7119 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7120 _MOZ_DEBUG_FLAGS_SET=1
7127 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7128 MOZ_ARG_WITH_STRING(debug-label,
7129 [ --with-debug-label=LABELS
7130 Define DEBUG_<value> for each comma-separated
7132 [ for option in `echo $withval | sed 's/,/ /g'`; do
7133 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7136 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7138 if test -n "$MOZ_DEBUG"; then
7139 AC_MSG_CHECKING([for valid debug flags])
7140 _SAVE_CFLAGS=$CFLAGS
7141 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7142 AC_TRY_COMPILE([#include <stdio.h>],
7143 [printf("Hello World\n");],
7146 AC_MSG_RESULT([$_results])
7147 if test "$_results" = "no"; then
7148 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7150 CFLAGS=$_SAVE_CFLAGS
7153 dnl ========================================================
7154 dnl enable mobile optimizations
7155 dnl ========================================================
7156 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7157 [ --enable-mobile-optimize
7158 Enable mobile optimizations],
7159 MOZ_GFX_OPTIMIZE_MOBILE=1)
7161 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7163 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7164 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7167 dnl ========================================================
7168 dnl = Enable code optimization. ON by default.
7169 dnl ========================================================
7170 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7171 MOZ_OPTIMIZE_FLAGS="-O"
7174 MOZ_ARG_ENABLE_STRING(optimize,
7175 [ --disable-optimize Disable compiler optimization
7176 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7177 [ if test "$enableval" != "no"; then
7179 if test -n "$enableval" -a "$enableval" != "yes"; then
7180 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7185 fi ], MOZ_OPTIMIZE=1)
7187 if test "$COMPILE_ENVIRONMENT"; then
7188 if test -n "$MOZ_OPTIMIZE"; then
7189 AC_MSG_CHECKING([for valid optimization flags])
7190 _SAVE_CFLAGS=$CFLAGS
7191 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7192 AC_TRY_COMPILE([#include <stdio.h>],
7193 [printf("Hello World\n");],
7196 AC_MSG_RESULT([$_results])
7197 if test "$_results" = "no"; then
7198 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7200 CFLAGS=$_SAVE_CFLAGS
7202 fi # COMPILE_ENVIRONMENT
7204 AC_SUBST(MOZ_OPTIMIZE)
7205 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7206 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7207 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7208 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
7210 dnl ========================================================
7211 dnl = Enable generation of debug symbols
7212 dnl ========================================================
7213 MOZ_ARG_ENABLE_STRING(debug-symbols,
7214 [ --enable-debug-symbols[=DBG]
7215 Enable debugging symbols (using compiler flags DBG)],
7216 [ if test "$enableval" != "no"; then
7218 if test -n "$enableval" -a "$enableval" != "yes"; then
7219 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7220 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7222 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7228 MOZ_DEBUG_SYMBOLS=1)
7230 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7231 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7232 export MOZ_DEBUG_SYMBOLS
7235 dnl ========================================================
7236 dnl = Identical Code Folding
7237 dnl ========================================================
7239 MOZ_ARG_DISABLE_BOOL(icf,
7240 [ --disable-icf Disable Identical Code Folding],
7244 if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$MOZ_DISABLE_ICF"; then
7245 AC_CACHE_CHECK([whether the linker supports Identical Code Folding],
7247 [echo 'int foo() {return 42;}' \
7248 'int bar() {return 42;}' \
7249 'int main() {return foo() - bar();}' > conftest.${ac_ext}
7250 # If the linker supports ICF, foo and bar symbols will have
7252 if AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS -Wl,--icf=safe -ffunction-sections conftest.${ac_ext} $LIBS 1>&2]) &&
7253 test -s conftest${ac_exeext} &&
7254 objdump -t conftest${ac_exeext} | awk '{a[[$6]] = $1} END {if (a[["foo"]] && (a[["foo"]] != a[["bar"]])) { exit 1 }}'; then
7260 if test "$LD_SUPPORTS_ICF" = yes; then
7261 LDFLAGS="$LDFLAGS -Wl,--icf=safe"
7262 CFLAGS="$CFLAGS -ffunction-sections"
7263 CXXFLAGS="$CXXFLAGS -ffunction-sections"
7267 dnl ========================================================
7268 dnl = Automatically remove dead symbols
7269 dnl ========================================================
7271 if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -n "$MOZ_DEBUG_FLAGS"; then
7273 AC_CACHE_CHECK([whether removing dead symbols breaks debugging],
7274 GC_SECTIONS_BREAKS_DEBUG_RANGES,
7275 [echo 'int foo() {return 42;}' \
7276 'int bar() {return 1;}' \
7277 'int main() {return foo();}' > conftest.${ac_ext}
7278 if AC_TRY_COMMAND([${CC-cc} -o conftest.${ac_objext} $CFLAGS $MOZ_DEBUG_FLAGS -ffunction-sections -c conftest.${ac_ext} 1>&2]) &&
7279 AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS $MOZ_DEBUG_FLAGS -Wl,--gc-sections conftest.${ac_objext} $LIBS 1>&2]) &&
7280 test -s conftest${ac_exeext} -a -s conftest.${ac_objext}; then
7281 if test "`$PYTHON "$_topsrcdir"/build/unix/check_debug_ranges.py conftest.${ac_objext} conftest.${ac_ext}`" = \
7282 "`$PYTHON "$_topsrcdir"/build/unix/check_debug_ranges.py conftest${ac_exeext} conftest.${ac_ext}`"; then
7283 GC_SECTIONS_BREAKS_DEBUG_RANGES=no
7285 GC_SECTIONS_BREAKS_DEBUG_RANGES=yes
7288 dnl We really don't expect to get here, but just in case
7289 AC_ERROR([couldn't compile a simple C file])
7292 if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
7293 DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
7295 *-ffunction-sections*)
7296 CFLAGS="$CFLAGS -fdata-sections"
7297 CXXFLAGS="$CXXFLAGS -fdata-sections"
7300 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
7301 CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
7307 dnl ========================================================
7308 dnl = Disable any treating of compile warnings as errors
7309 dnl ========================================================
7310 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7311 [ --disable-warnings-as-errors
7312 Disable treating of warnings as errors],
7313 MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7314 MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7315 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7316 WARNINGS_AS_ERRORS=''
7319 dnl ========================================================
7320 dnl = Disable runtime logging checks
7321 dnl ========================================================
7322 MOZ_ARG_DISABLE_BOOL(logging,
7323 [ --disable-logging Disable logging facilities],
7324 NS_DISABLE_LOGGING=1,
7325 NS_DISABLE_LOGGING= )
7326 if test "$NS_DISABLE_LOGGING"; then
7327 AC_DEFINE(NS_DISABLE_LOGGING)
7329 AC_DEFINE(MOZ_LOGGING)
7332 dnl ========================================================
7333 dnl = This will enable logging of addref, release, ctor, dtor.
7334 dnl ========================================================
7335 _ENABLE_LOGREFCNT=42
7336 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7337 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7338 _ENABLE_LOGREFCNT=1,
7339 _ENABLE_LOGREFCNT= )
7340 if test "$_ENABLE_LOGREFCNT" = "1"; then
7341 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7342 elif test -z "$_ENABLE_LOGREFCNT"; then
7343 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7346 dnl ========================================================
7347 dnl = Enable trace malloc
7348 dnl ========================================================
7349 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7350 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7351 [ --enable-trace-malloc Enable malloc tracing],
7354 if test "$NS_TRACE_MALLOC"; then
7355 # Please, Mr. Linker Man, don't take away our symbol names
7356 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7358 AC_DEFINE(NS_TRACE_MALLOC)
7360 AC_SUBST(NS_TRACE_MALLOC)
7362 dnl ========================================================
7363 dnl = Enable jemalloc
7364 dnl ========================================================
7365 MOZ_ARG_ENABLE_BOOL(jemalloc,
7366 [ --enable-jemalloc Replace memory allocator with jemalloc],
7370 if test "$NS_TRACE_MALLOC"; then
7374 if test -z "$MOZ_MEMORY"; then
7377 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7378 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.])
7383 dnl Don't try to run compiler tests on Windows
7384 if test "$OS_ARCH" = "WINNT"; then
7385 if test -z "$HAVE_64BIT_OS"; then
7386 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7388 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7391 AC_CHECK_SIZEOF([int *], [4])
7392 case "${ac_cv_sizeof_int_p}" in
7394 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7397 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7400 AC_MSG_ERROR([Unexpected pointer size])
7405 AC_DEFINE(MOZ_MEMORY)
7406 if test "x$MOZ_DEBUG" = "x1"; then
7407 AC_DEFINE(MOZ_MEMORY_DEBUG)
7409 dnl The generic feature tests that determine how to compute ncpus are long and
7410 dnl complicated. Therefore, simply define special cpp variables for the
7411 dnl platforms we have special knowledge of.
7414 AC_DEFINE(MOZ_MEMORY_DARWIN)
7417 AC_DEFINE(MOZ_MEMORY_BSD)
7419 *-android*|*-linuxandroid*)
7420 AC_DEFINE(MOZ_MEMORY_LINUX)
7421 AC_DEFINE(MOZ_MEMORY_ANDROID)
7423 export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7424 WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7427 AC_DEFINE(MOZ_MEMORY_LINUX)
7430 AC_DEFINE(MOZ_MEMORY_BSD)
7433 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7436 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7437 AC_MSG_CHECKING([for VC2005/2008++ CRT source])
7438 if test "$CC_VERSION" == "14.00.50727.762" -o "$CC_VERSION" == "15.00.30729.01"; then
7439 if test -z "$WIN32_CRT_SRC_DIR" -a -n "$VCINSTALLDIR"; then
7440 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7442 if test -n "$WIN32_CRT_SRC_DIR" -a -d "$WIN32_CRT_SRC_DIR"; then
7443 AC_MSG_RESULT([yes])
7445 case "${target_cpu}" in
7447 MOZ_CRT_CPU_ARCH=intel
7450 MOZ_CRT_CPU_ARCH=amd64
7453 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7456 AC_SUBST(MOZ_CRT_CPU_ARCH)
7457 WIN32_OLD_STYLE_JEMALLOC=1
7458 AC_DEFINE(WIN32_OLD_STYLE_JEMALLOC)
7459 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7460 _objdir_win=`pwd -W`
7461 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7462 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7465 if test -z "$WIN32_OLD_STYLE_JEMALLOC"; then
7467 WIN32_NEW_STYLE_JEMALLOC=1
7468 AC_DEFINE(WIN32_NEW_STYLE_JEMALLOC)
7470 if test -z "$MOZ_DEBUG"; then
7471 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7473 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7475 dnl Look for a broken crtdll.obj
7476 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7477 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7478 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7479 MOZ_MEMORY_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7481 MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
7486 dnl Also pass this to NSPR/NSS
7487 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7491 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7495 if test "$OS_ARCH" != "WINNT"; then
7496 dnl NB: this must be kept in sync with jemalloc.h
7497 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7499 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7500 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7502 AC_SUBST(MOZ_MEMORY)
7503 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7504 AC_SUBST(WIN32_OLD_STYLE_JEMALLOC)
7505 AC_SUBST(WIN32_CRT_LIBS)
7506 AC_SUBST(WIN32_CRT_SRC_DIR)
7507 dnl Need to set this for make because NSS doesn't have configure
7510 dnl ========================================================
7511 dnl = Use malloc wrapper lib
7512 dnl ========================================================
7513 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7514 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7518 if test -n "$_WRAP_MALLOC"; then
7519 if test "$GNU_CC"; then
7520 WRAP_MALLOC_CFLAGS="${LDFLAGS} ${WRAP_MALLOC_CFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
7521 MKSHLIB="$MKSHLIB"' $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB)'
7522 MKCSHLIB="$MKCSHLIB"' $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB)'
7526 dnl ========================================================
7527 dnl = Location of malloc wrapper lib
7528 dnl ========================================================
7529 MOZ_ARG_WITH_STRING(wrap-malloc,
7530 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7531 WRAP_MALLOC_LIB=$withval)
7533 dnl ========================================================
7534 dnl = Use JS Call tracing
7535 dnl ========================================================
7536 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7537 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7538 MOZ_TRACE_JSCALLS=1,
7539 MOZ_TRACE_JSCALLS= )
7540 if test -n "$MOZ_TRACE_JSCALLS"; then
7541 AC_DEFINE(MOZ_TRACE_JSCALLS)
7544 dnl ========================================================
7546 dnl ========================================================
7547 MOZ_ARG_ENABLE_BOOL(tracevis,
7548 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
7551 if test -n "$MOZ_TRACEVIS"; then
7552 AC_DEFINE(MOZ_TRACEVIS)
7555 dnl ========================================================
7557 dnl ========================================================
7558 MOZ_ARG_ENABLE_BOOL(gctimer,
7559 [ --enable-gctimer Enable GC timer (default=no)],
7562 if test -n "$MOZ_GCTIMER"; then
7563 AC_DEFINE(MOZ_GCTIMER)
7566 dnl ========================================================
7567 dnl ETW - Event Tracing for Windows
7568 dnl ========================================================
7569 MOZ_ARG_ENABLE_BOOL(ETW,
7570 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting
7571 (needs Windows Vista+ SDK)],
7574 if test -n "$MOZ_ETW"; then
7578 if test -n "$MOZ_ETW"; then
7579 if test -z "$MOZ_WINSDK_TARGETVER"; then
7580 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7581 elif test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
7582 AC_MSG_ERROR([--enable-ETW requires the Windows Vista SDK or newer])
7586 dnl ========================================================
7587 dnl Zealous JavaScript GC
7588 dnl ========================================================
7589 MOZ_ARG_ENABLE_BOOL(gczeal,
7590 [ --enable-gczeal Enable zealous JavaScript GCing],
7593 if test -n "$JS_GC_ZEAL"; then
7594 AC_DEFINE(JS_GC_ZEAL)
7597 dnl ========================================================
7598 dnl JS opt-mode assertions and minidump instrumentation
7599 dnl ========================================================
7600 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7601 [ --enable-js-diagnostics
7602 Enable JS diagnostic assertions and breakpad data],
7603 JS_CRASH_DIAGNOSTICS=1,
7604 JS_CRASH_DIAGNOSTICS= )
7605 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7606 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7609 dnl ======================================================
7610 dnl = Enable compiling with ccache
7611 dnl ======================================================
7612 MOZ_ARG_WITH_STRING(ccache,
7613 [ --with-ccache[=path/to/ccache]
7614 Enable compiling with ccache],
7615 CCACHE=$withval, CCACHE="no")
7617 if test "$CCACHE" != "no"; then
7618 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7621 if test ! -e "$CCACHE"; then
7622 AC_MSG_ERROR([$CCACHE not found])
7625 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7626 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7627 AC_MSG_ERROR([ccache not found])
7628 elif test -x "$CCACHE"; then
7632 AC_MSG_ERROR([$CCACHE is not executable])
7636 dnl ========================================================
7637 dnl = Enable static checking using gcc-dehydra
7638 dnl ========================================================
7640 MOZ_ARG_WITH_STRING(static-checking,
7641 [ --with-static-checking=path/to/gcc_dehydra.so
7642 Enable static checking of code using GCC-dehydra],
7643 DEHYDRA_PATH=$withval,
7646 if test -n "$DEHYDRA_PATH"; then
7647 if test ! -f "$DEHYDRA_PATH"; then
7648 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7650 AC_DEFINE(NS_STATIC_CHECKING)
7652 AC_SUBST(DEHYDRA_PATH)
7654 dnl ========================================================
7655 dnl = Enable stripping of libs & executables
7656 dnl ========================================================
7657 MOZ_ARG_ENABLE_BOOL(strip,
7658 [ --enable-strip Enable stripping of libs & executables ],
7662 dnl ========================================================
7663 dnl = Enable stripping of libs & executables when packaging
7664 dnl ========================================================
7665 MOZ_ARG_ENABLE_BOOL(install-strip,
7666 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7670 dnl ========================================================
7671 dnl = --enable-elf-dynstr-gc
7672 dnl ========================================================
7673 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7674 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7675 USE_ELF_DYNSTR_GC=1,
7676 USE_ELF_DYNSTR_GC= )
7678 dnl ========================================================
7679 dnl = --disable-elf-hack
7680 dnl ========================================================
7683 MOZ_ARG_DISABLE_BOOL(elf-hack,
7684 [ --disable-elf-hack Disable elf hacks],
7688 # Only enable elfhack where supported
7689 if test "$USE_ELF_HACK" = 1; then
7690 case "${HOST_OS_ARCH},${OS_ARCH}" in
7692 case "${CPU_ARCH}" in
7707 if test "$USE_ELF_HACK" = 1; then
7708 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7709 dnl memory addresses it maps to. The result is that by the time elfhack
7710 dnl kicks in, it is not possible to apply relocations because of that,
7711 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7712 dnl segment. It makes elfhack mostly useless, so considering the problems
7713 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7714 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7715 dnl the linker creates PT_GNU_RELRO segments.
7716 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7717 LINK_WITH_PT_GNU_RELRO,
7718 [echo "int main() {return 0;}" > conftest.${ac_ext}
7719 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7720 test -s conftest${ac_exeext}; then
7721 if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7722 LINK_WITH_PT_GNU_RELRO=yes
7724 LINK_WITH_PT_GNU_RELRO=no
7727 dnl We really don't expect to get here, but just in case
7728 AC_ERROR([couldn't compile a simple C file])
7731 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7732 AC_MSG_WARN([Disabling elfhack])
7737 dnl ========================================================
7738 dnl = libstdc++ compatibility hacks
7739 dnl ========================================================
7742 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7743 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7744 STDCXX_COMPAT=stdc++compat.cpp)
7746 AC_SUBST(STDCXX_COMPAT)
7748 if test -n "$STDCXX_COMPAT"; then
7749 eval $(CXX="$CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7750 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7751 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7754 dnl ========================================================
7756 dnl = Profiling and Instrumenting
7758 dnl ========================================================
7759 MOZ_ARG_HEADER(Profiling and Instrumenting)
7761 dnl ========================================================
7762 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7763 dnl = timing for identifying code bottlenecks
7764 dnl = NS_FUNCTION_TIMER is off by default.
7765 dnl ========================================================
7766 MOZ_ARG_ENABLE_BOOL(functiontimer,
7767 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7768 NS_FUNCTION_TIMER=1,
7769 NS_FUNCTION_TIMER= )
7770 if test -n "$NS_FUNCTION_TIMER"; then
7771 AC_DEFINE(NS_FUNCTION_TIMER)
7774 dnl ========================================================
7775 dnl Turn on reflow counting
7776 dnl ========================================================
7777 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7778 [ --enable-reflow-perf Enable reflow performance tracing],
7781 if test -n "$MOZ_REFLOW_PERF"; then
7782 AC_DEFINE(MOZ_REFLOW_PERF)
7785 dnl ========================================================
7786 dnl Enable code size metrics.
7787 dnl ========================================================
7788 MOZ_ARG_ENABLE_BOOL(codesighs,
7789 [ --enable-codesighs Enable code size analysis tools],
7790 _ENABLE_CODESIGHS=1,
7791 _ENABLE_CODESIGHS= )
7792 if test -n "$_ENABLE_CODESIGHS"; then
7793 if test -d $srcdir/tools/codesighs; then
7796 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7800 dnl ========================================================
7801 dnl = Support for Quantify (Windows)
7802 dnl ========================================================
7803 MOZ_ARG_ENABLE_BOOL(quantify,
7804 [ --enable-quantify Enable Quantify support (Windows only) ],
7808 dnl ========================================================
7809 dnl = Support for demangling undefined symbols
7810 dnl ========================================================
7811 if test -z "$SKIP_LIBRARY_CHECKS"; then
7814 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7818 # Demangle only for debug or trace-malloc builds
7819 MOZ_DEMANGLE_SYMBOLS=
7820 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7821 MOZ_DEMANGLE_SYMBOLS=1
7822 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7824 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7826 dnl ========================================================
7827 dnl = Support for gcc stack unwinding (from gcc 3.3)
7828 dnl ========================================================
7829 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7830 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7833 dnl ========================================================
7837 dnl ========================================================
7838 MOZ_ARG_HEADER(Misc. Options)
7840 dnl ========================================================
7841 dnl update xterm title
7842 dnl ========================================================
7843 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7844 [ --enable-xterm-updates Update XTERM titles with current command.],
7848 dnl =========================================================
7850 dnl =========================================================
7851 MOZ_ARG_ENABLE_STRING([chrome-format],
7852 [ --enable-chrome-format=jar|flat|both|symlink|omni
7853 Select FORMAT of chrome files (default=jar)],
7854 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7856 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7857 MOZ_CHROME_FILE_FORMAT=jar
7860 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7861 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7862 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7863 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7864 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7865 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7868 dnl =========================================================
7869 dnl Omnijar packaging (bug 552121)
7870 dnl =========================================================
7871 dnl Omnijar packaging is compatible with flat packaging.
7872 dnl In unpackaged builds, omnijar looks for files as if
7873 dnl things were flat packaged. After packaging, all files
7874 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7875 dnl is set to flat since putting files into jars is only
7876 dnl done during packaging with omnijar.
7877 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7879 AC_DEFINE(MOZ_OMNIJAR)
7880 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7881 MOZ_CHROME_FILE_FORMAT=flat
7883 MOZ_CHROME_FILE_FORMAT=symlink
7885 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7886 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7889 AC_SUBST(MOZ_OMNIJAR)
7891 dnl ========================================================
7892 dnl = Define default location for MOZILLA_FIVE_HOME
7893 dnl ========================================================
7894 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7895 [ --with-default-mozilla-five-home
7896 Set the default value for MOZILLA_FIVE_HOME],
7897 [ val=`echo $withval`
7898 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7900 dnl ========================================================
7901 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7902 dnl ========================================================
7903 MOZ_ARG_WITH_STRING(user-appdir,
7904 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7905 [ val=`echo $withval`
7906 if echo "$val" | grep "\/" >/dev/null; then
7907 AC_MSG_ERROR("Homedir must be single relative path.")
7912 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7914 dnl ========================================================
7915 dnl = Doxygen configuration
7916 dnl ========================================================
7917 dnl Use commas to specify multiple dirs to this arg
7918 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7919 MOZ_ARG_WITH_STRING(doc-input-dirs,
7920 [ --with-doc-input-dirs=DIRS
7921 Header/idl dirs to create docs from],
7922 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7923 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7925 dnl Use commas to specify multiple dirs to this arg
7926 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7927 MOZ_ARG_WITH_STRING(doc-include-dirs,
7928 [ --with-doc-include-dirs=DIRS
7929 Include dirs to preprocess doc headers],
7930 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7931 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7933 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7934 MOZ_ARG_WITH_STRING(doc-output-dir,
7935 [ --with-doc-output-dir=DIR
7936 Dir to generate docs into],
7937 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7938 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7940 if test -z "$SKIP_COMPILER_CHECKS"; then
7941 dnl ========================================================
7943 dnl = Compiler Options
7945 dnl ========================================================
7946 MOZ_ARG_HEADER(Compiler Options)
7948 dnl ========================================================
7949 dnl Check for gcc -pipe support
7950 dnl ========================================================
7951 AC_MSG_CHECKING([for gcc -pipe support])
7952 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7953 echo '#include <stdio.h>' > dummy-hello.c
7954 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7955 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7956 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7957 if test $? = 0; then
7962 if test "$_res_as_stdin" = "yes"; then
7963 _SAVE_CFLAGS=$CFLAGS
7964 CFLAGS="$CFLAGS -pipe"
7965 AC_TRY_COMPILE( [ #include <stdio.h> ],
7966 [printf("Hello World\n");],
7967 [_res_gcc_pipe="yes"],
7968 [_res_gcc_pipe="no"] )
7969 CFLAGS=$_SAVE_CFLAGS
7971 if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7973 CFLAGS="$CFLAGS -pipe"
7974 CXXFLAGS="$CXXFLAGS -pipe"
7978 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7979 AC_MSG_RESULT([$_res])
7984 dnl ========================================================
7985 dnl Profile guided optimization (gcc checks)
7986 dnl ========================================================
7987 dnl Test for profiling options
7988 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7990 _SAVE_CFLAGS="$CFLAGS"
7991 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7993 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7994 AC_TRY_COMPILE([], [return 0;],
7995 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7996 result="yes" ], result="no")
7997 AC_MSG_RESULT([$result])
7999 if test $result = "yes"; then
8000 PROFILE_GEN_LDFLAGS="-fprofile-generate"
8001 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
8002 PROFILE_USE_LDFLAGS="-fprofile-use"
8005 CFLAGS="$_SAVE_CFLAGS"
8007 if test -n "$INTEL_CC"; then
8008 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
8009 PROFILE_GEN_LDFLAGS=
8010 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
8011 PROFILE_USE_LDFLAGS=
8014 dnl Sun Studio on Solaris
8015 if test "$SOLARIS_SUNPRO_CC"; then
8016 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
8017 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
8018 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
8019 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
8022 AC_SUBST(PROFILE_GEN_CFLAGS)
8023 AC_SUBST(PROFILE_GEN_LDFLAGS)
8024 AC_SUBST(PROFILE_USE_CFLAGS)
8025 AC_SUBST(PROFILE_USE_LDFLAGS)
8029 dnl ========================================================
8030 dnl Test for -pedantic bustage
8031 dnl ========================================================
8032 MOZ_ARG_DISABLE_BOOL(pedantic,
8033 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
8035 if test "$_PEDANTIC"; then
8036 _SAVE_CXXFLAGS=$CXXFLAGS
8037 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8038 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
8039 AC_TRY_COMPILE([$configure_static_assert_macros],
8040 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
8041 result="no", result="yes" )
8042 AC_MSG_RESULT([$result])
8043 CXXFLAGS="$_SAVE_CXXFLAGS"
8047 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8048 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8051 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
8056 dnl ========================================================
8057 dnl Test for correct temporary object destruction order
8058 dnl ========================================================
8059 dnl We want to make sure the compiler follows the C++ spec here as
8060 dnl xpcom and the string classes depend on it (bug 235381).
8061 AC_MSG_CHECKING([for correct temporary object destruction order])
8062 AC_TRY_RUN([ class A {
8063 public: A(int& x) : mValue(x) {}
8065 operator char**() { return 0; }
8066 private: int& mValue;
8068 void func(char **arg) {}
8079 result="yes", result="no", result="maybe")
8080 AC_MSG_RESULT([$result])
8082 if test "$result" = "no"; then
8083 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
8086 dnl ========================================================
8087 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
8088 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8089 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
8090 dnl ========================================================
8091 _SAVE_CXXFLAGS=$CXXFLAGS
8092 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8093 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8094 ac_nscap_nonconst_opeq_bug,
8103 template <class T, class U>
8104 int operator==(const Pointer<T>& rhs, U* lhs)
8106 return rhs.myPtr == lhs;
8109 template <class T, class U>
8110 int operator==(const Pointer<T>& rhs, const U* lhs)
8112 return rhs.myPtr == lhs;
8120 ac_nscap_nonconst_opeq_bug="no",
8121 ac_nscap_nonconst_opeq_bug="yes")])
8122 CXXFLAGS="$_SAVE_CXXFLAGS"
8124 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8125 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8127 fi # ! SKIP_COMPILER_CHECKS
8129 dnl ========================================================
8130 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8131 dnl Should be smarter and check that the compiler does indeed have exceptions
8132 dnl ========================================================
8133 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8134 [ --enable-cpp-exceptions Enable C++ exceptions ],
8135 [ _MOZ_CPP_EXCEPTIONS=1 ],
8136 [ _MOZ_CPP_EXCEPTIONS= ])
8138 if test "$_MOZ_CPP_EXCEPTIONS"; then
8139 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8140 AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8142 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8145 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8147 # Irix & OSF native compilers do not like exception declarations
8148 # when exceptions are disabled
8149 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8150 AC_DEFINE(CPP_THROW_NEW, [])
8152 AC_DEFINE(CPP_THROW_NEW, [throw()])
8156 dnl ========================================================
8158 dnl = Check what kind of list files are supported by the
8161 dnl ========================================================
8163 AC_CACHE_CHECK(what kind of list files are supported by the linker,
8164 EXPAND_LIBS_LIST_STYLE,
8165 [echo "int main() {return 0;}" > conftest.${ac_ext}
8166 if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&2) && test -s conftest.${OBJ_SUFFIX}; then
8167 echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list
8168 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
8169 EXPAND_LIBS_LIST_STYLE=linkerscript
8171 echo "conftest.${OBJ_SUFFIX}" > conftest.list
8172 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS @conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
8173 EXPAND_LIBS_LIST_STYLE=list
8175 EXPAND_LIBS_LIST_STYLE=none
8179 dnl We really don't expect to get here, but just in case
8180 AC_ERROR([couldn't compile a simple C file])
8184 LIBS_DESC_SUFFIX=desc
8185 AC_SUBST(LIBS_DESC_SUFFIX)
8186 AC_SUBST(EXPAND_LIBS_LIST_STYLE)
8188 dnl ========================================================
8190 dnl = Build depencency options
8192 dnl ========================================================
8193 MOZ_ARG_HEADER(Build dependencies)
8195 dnl ========================================================
8196 dnl = Do not auto generate dependency info
8197 dnl ========================================================
8199 MOZ_ARG_DISABLE_BOOL(auto-deps,
8200 [ --disable-auto-deps Do not automatically generate dependency info],
8204 if test -n "$MOZ_AUTO_DEPS"; then
8205 dnl ========================================================
8206 dnl = Use mkdepend instead of $CC -MD for dependency generation
8207 dnl ========================================================
8209 MOZ_ARG_DISABLE_BOOL(md,
8210 [ --disable-md Do not use compiler-based dependencies ],
8213 [dnl Default is to turn on -MD if using GNU-compatible compilers
8214 if test "$GNU_CC" -a "$GNU_CXX"; then
8217 dnl Default is to use -xM if using Sun Studio on Solaris
8218 if test "$SOLARIS_SUNPRO_CC"; then
8221 if test "$_cpp_md_flag"; then
8223 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8224 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8225 if test "$SOLARIS_SUNPRO_CC"; then
8230 dnl Don't override this for MSVC
8231 if test -z "$_WIN32_MSVC"; then
8232 _USE_CPP_INCLUDE_FLAG=
8233 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8234 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8236 echo '#include <stdio.h>' > dummy-hello.c
8238 CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8240 if test -z "$CL_INCLUDES_PREFIX"; then
8241 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8243 AC_SUBST(CL_INCLUDES_PREFIX)
8245 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8246 dnl cl.py provides dependency generation for MSVC
8247 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8248 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8254 AC_SUBST(MOZ_AUTO_DEPS)
8255 AC_SUBST(COMPILER_DEPEND)
8257 AC_SUBST(CC_WRAPPER)
8258 AC_SUBST(CXX_WRAPPER)
8261 dnl ========================================================
8263 dnl = Static Build Options
8265 dnl ========================================================
8266 MOZ_ARG_HEADER(Static build options)
8268 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8269 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
8273 MOZ_ARG_ENABLE_BOOL(shared-js,
8274 [ --enable-shared-js
8275 Create a shared JavaScript library.],
8279 if test -n "$ENABLE_SHARED_JS"; then
8281 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
8283 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
8284 AC_DEFINE(MOZ_STATIC_JS)
8286 AC_SUBST(JS_SHARED_LIBRARY)
8288 AC_SUBST(LIBXUL_LIBS)
8289 XPCOM_LIBS="$LIBXUL_LIBS"
8291 dnl ========================================================
8293 dnl = Standalone module options
8295 dnl ========================================================
8296 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8298 dnl Check for GLib and libIDL.
8299 dnl ========================================================
8302 if test -z "$COMPILE_ENVIRONMENT"; then
8303 SKIP_IDL_CHECK="yes"
8306 dnl = Allow users to disable libIDL checking for standalone modules
8307 MOZ_ARG_WITHOUT_BOOL(libIDL,
8308 [ --without-libIDL Skip check for libIDL (standalone modules only)],
8309 SKIP_IDL_CHECK="yes")
8311 if test -z "$CROSS_COMPILE"; then
8312 if test -z "$HOST_LIBIDL_CONFIG"; then
8313 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8315 if test -z "$HOST_LIBIDL_PREFIX"; then
8316 HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8320 if test "$SKIP_IDL_CHECK" = "no"
8325 if test -n "$GLIB_PREFIX"; then
8326 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8327 if test "$?" = "0"; then
8328 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8329 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8332 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8335 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8337 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8338 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8340 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8341 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8342 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8343 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8344 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8346 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8349 if test -n "$HOST_LIBIDL_PREFIX"; then
8350 _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8351 if test "$?" = "0"; then
8352 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8353 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8356 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8359 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8361 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8362 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8364 HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8365 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8366 HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8368 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8369 HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8371 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8373 HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8378 if test -z "$_LIBIDL_FOUND"; then
8379 if test "$MACOS_SDK_DIR"; then
8380 dnl xpidl, and therefore libIDL, is only needed on the build host.
8381 dnl Don't build it against the SDK, as that causes problems.
8382 _MACSAVE_CFLAGS="$CFLAGS"
8383 _MACSAVE_LIBS="$LIBS"
8384 _MACSAVE_LDFLAGS="$LDFLAGS"
8385 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8387 CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"`
8388 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8389 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8394 PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8397 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8398 dnl to either libIDL1 or libIDL2.
8399 if test -z "$_LIBIDL_FOUND"; then
8400 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8401 if test -z "$_LIBIDL_FOUND"; then
8402 PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8406 dnl If we don't have a libIDL config program & not cross-compiling,
8407 dnl look for orbit-config instead.
8409 if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8410 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8411 if test -n "$ORBIT_CONFIG"; then
8412 AC_MSG_CHECKING([for ORBit libIDL usability])
8413 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8414 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8415 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8416 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8417 HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8418 HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8420 _SAVE_CFLAGS="$CFLAGS"
8422 CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8423 LIBS="$HOST_LIBIDL_LIBS $LIBS"
8426 #include <libIDL/IDL.h>
8429 s=strdup(IDL_get_libver_string());
8437 [HOST_LIBIDL_CFLAGS=
8442 AC_MSG_RESULT($result)
8443 CFLAGS="$_SAVE_CFLAGS"
8447 if test -z "$_LIBIDL_FOUND"; then
8448 AC_MSG_ERROR([libIDL not found.
8449 libIDL $LIBIDL_VERSION or higher is required.])
8451 if test "$MACOS_SDK_DIR"; then
8452 CFLAGS="$_MACSAVE_CFLAGS"
8453 LIBS="$_MACSAVE_LIBS"
8454 LDFLAGS="$_MACSAVE_LDFLAGS"
8455 if test -n "$_MACSAVE_NEXT_ROOT" ; then
8456 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8461 if test -n "$CROSS_COMPILE"; then
8464 if test -n "$GLIB_PREFIX"; then
8465 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8466 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8467 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8468 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8469 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8471 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8475 if test -n "$LIBIDL_PREFIX"; then
8476 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8477 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8478 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8480 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8481 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8483 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8486 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8489 if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8490 LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8491 LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8496 LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8497 LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8500 if test -z "$SKIP_PATH_CHECKS"; then
8501 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8502 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8503 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8505 AM_PATH_GLIB(${GLIB_VERSION})
8510 if test -z "${GLIB_GMODULE_LIBS}" \
8511 -a -n "${GLIB_CONFIG}"\
8512 -a "${GLIB_CONFIG}" != no\
8514 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8517 AC_SUBST(LIBIDL_CFLAGS)
8518 AC_SUBST(LIBIDL_LIBS)
8519 AC_SUBST(STATIC_LIBIDL)
8520 AC_SUBST(GLIB_CFLAGS)
8522 AC_SUBST(GLIB_GMODULE_LIBS)
8523 AC_SUBST(HOST_LIBIDL_CONFIG)
8524 AC_SUBST(HOST_LIBIDL_CFLAGS)
8525 AC_SUBST(HOST_LIBIDL_LIBS)
8527 dnl ========================================================
8529 dnl ========================================================
8530 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8533 MOZ_ARG_ENABLE_BOOL(system-cairo,
8534 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8539 MOZ_ARG_ENABLE_BOOL(system-pixman,
8540 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8544 # Check for headers defining standard int types.
8545 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8547 if test "$MOZ_TREE_CAIRO"; then
8548 AC_DEFINE(MOZ_TREE_CAIRO)
8550 # For now we assume that we will have a uint64_t available through
8551 # one of the above headers or mozstdint.h.
8552 AC_DEFINE(HAVE_UINT64_T)
8554 # Define macros for cairo-features.h
8555 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8556 if test "$MOZ_X11"; then
8557 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8558 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8559 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8560 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8561 MOZ_ENABLE_CAIRO_FT=1
8562 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8564 case "$MOZ_WIDGET_TOOLKIT" in
8566 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8569 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8570 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8571 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8574 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8575 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8576 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8577 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8578 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8579 MOZ_ENABLE_D2D_SURFACE=1
8580 MOZ_ENABLE_DWRITE_FONT=1
8582 WIN32_DWRITE_FONT_FEATURE=
8583 WIN32_D2D_SURFACE_FEATURE=
8586 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8588 dnl D3D10 Layers depend on D2D Surfaces.
8589 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8590 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8594 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8595 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8596 MOZ_ENABLE_CAIRO_FT=1
8597 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8598 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8601 if test "$USE_FC_FREETYPE"; then
8602 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8604 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8605 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8606 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8607 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8608 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8609 AC_SUBST(CAIRO_FT_CFLAGS)
8611 if test "$MOZ_DEBUG"; then
8612 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8614 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8617 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8619 AC_SUBST(PS_SURFACE_FEATURE)
8620 AC_SUBST(PDF_SURFACE_FEATURE)
8621 AC_SUBST(SVG_SURFACE_FEATURE)
8622 AC_SUBST(XLIB_SURFACE_FEATURE)
8623 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8624 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8625 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8626 AC_SUBST(XCB_SURFACE_FEATURE)
8627 AC_SUBST(WIN32_SURFACE_FEATURE)
8628 AC_SUBST(OS2_SURFACE_FEATURE)
8629 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8630 AC_SUBST(FT_FONT_FEATURE)
8631 AC_SUBST(FC_FONT_FEATURE)
8632 AC_SUBST(WIN32_FONT_FEATURE)
8633 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8634 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8635 AC_SUBST(QUARTZ_FONT_FEATURE)
8636 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8637 AC_SUBST(QT_SURFACE_FEATURE)
8638 AC_SUBST(TEE_SURFACE_FEATURE)
8640 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8642 if test "$MOZ_TREE_PIXMAN"; then
8643 AC_DEFINE(MOZ_TREE_PIXMAN)
8644 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8646 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8647 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8648 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8651 if test "$MOZ_X11"; then
8652 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8655 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8656 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8659 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8660 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8661 MOZ_CAIRO_LIBS=$CAIRO_LIBS
8662 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8663 if test "$MOZ_X11"; then
8664 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8665 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8666 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8670 AC_SUBST(MOZ_TREE_CAIRO)
8671 AC_SUBST(MOZ_CAIRO_CFLAGS)
8672 AC_SUBST(MOZ_CAIRO_LIBS)
8673 AC_SUBST(MOZ_TREE_PIXMAN)
8675 dnl ========================================================
8677 dnl ========================================================
8679 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8682 dnl ========================================================
8684 dnl ========================================================
8685 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8686 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8688 dnl ========================================================
8690 dnl ========================================================
8691 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8692 AC_SUBST(MOZ_OTS_LIBS)
8694 dnl ========================================================
8696 dnl ========================================================
8697 MOZ_ARG_DISABLE_BOOL(xul,
8698 [ --disable-xul Disable XUL],
8700 if test "$MOZ_XUL"; then
8703 dnl remove extensions that require XUL
8704 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8709 dnl ========================================================
8710 dnl disable profile locking
8711 dnl do no use this in applications that can have more than
8712 dnl one process accessing the profile directory.
8713 dnl ========================================================
8714 MOZ_ARG_DISABLE_BOOL(profilelocking,
8715 [ --disable-profilelocking
8716 Disable profile locking],
8717 MOZ_PROFILELOCKING=,
8718 MOZ_PROFILELOCKING=1 )
8719 if test "$MOZ_PROFILELOCKING"; then
8720 AC_DEFINE(MOZ_PROFILELOCKING)
8723 dnl ========================================================
8724 dnl disable rdf services
8725 dnl ========================================================
8726 MOZ_ARG_DISABLE_BOOL(rdf,
8727 [ --disable-rdf Disable RDF],
8729 if test "$MOZ_RDF"; then
8735 dnl ========================================================
8736 dnl necko configuration options
8737 dnl ========================================================
8740 dnl option to disable various necko protocols
8742 MOZ_ARG_ENABLE_STRING(necko-protocols,
8743 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8744 Enable/disable specific protocol handlers],
8745 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8746 if test "$option" = "yes" -o "$option" = "all"; then
8747 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8748 elif test "$option" = "no" -o "$option" = "none"; then
8750 elif test "$option" = "default"; then
8751 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8752 elif test `echo "$option" | grep -c \^-` != 0; then
8753 option=`echo $option | sed 's/^-//'`
8754 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8756 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8759 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8761 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8762 AC_SUBST(NECKO_PROTOCOLS)
8763 for p in $NECKO_PROTOCOLS; do
8764 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8768 dnl option to disable necko's disk cache
8770 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8771 [ --disable-necko-disk-cache
8772 Disable necko disk cache],
8775 AC_SUBST(NECKO_DISK_CACHE)
8776 if test "$NECKO_DISK_CACHE"; then
8777 AC_DEFINE(NECKO_DISK_CACHE)
8781 dnl option to disable necko's wifi scanner
8783 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8784 [ --disable-necko-wifi Disable necko wifi scanner],
8788 if test "$OS_ARCH" = "OS2"; then
8789 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8792 if test "$NECKO_WIFI" -a \
8793 "$OS_ARCH" != "Linux" -a \
8794 "$OS_ARCH" != "Darwin" -a \
8795 "$OS_ARCH" != "SunOS" -a \
8796 "$OS_ARCH" != "WINNT"; then
8797 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8800 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8802 MOZ_CHECK_HEADER([iwlib.h])
8803 if test "$ac_cv_header_iwlib_h" != "yes"; then
8804 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])
8808 if test "$NECKO_WIFI"; then
8809 AC_DEFINE(NECKO_WIFI)
8811 AC_SUBST(NECKO_WIFI)
8814 dnl option to disable cookies
8816 MOZ_ARG_DISABLE_BOOL(cookies,
8817 [ --disable-cookies Disable cookie support],
8820 AC_SUBST(NECKO_COOKIES)
8821 if test "$NECKO_COOKIES"; then
8822 AC_DEFINE(NECKO_COOKIES)
8826 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8828 MOZ_ARG_DISABLE_BOOL(ctypes,
8829 [ --disable-ctypes Disable js-ctypes],
8832 AC_SUBST(BUILD_CTYPES)
8833 if test "$BUILD_CTYPES"; then
8834 AC_DEFINE(BUILD_CTYPES)
8837 dnl NECKO_ configuration options are not global
8838 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8840 dnl Build Places if required
8841 if test "$MOZ_PLACES"; then
8842 AC_DEFINE(MOZ_PLACES)
8845 dnl Build Sync Services if required
8846 AC_SUBST(MOZ_SERVICES_SYNC)
8847 if test -n "$MOZ_SERVICES_SYNC"; then
8848 AC_DEFINE(MOZ_SERVICES_SYNC)
8851 dnl ========================================================
8852 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8853 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8856 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8857 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8860 if test "$MOZ_APP_COMPONENT_MODULES"; then
8861 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8864 dnl ========================================================
8866 dnl = Maintainer debug option (no --enable equivalent)
8868 dnl ========================================================
8873 AC_SUBST(AR_EXTRACT)
8877 AC_SUBST(AS_DASH_C_FLAG)
8886 AC_SUBST(NS_USE_NATIVE)
8887 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8888 AC_SUBST(MOZ_UPDATE_XTERM)
8890 AC_SUBST(MOZ_PLATFORM_MAEMO)
8891 AC_SUBST(MOZ_AUTH_EXTENSION)
8892 AC_SUBST(MOZ_PERMISSIONS)
8894 AC_SUBST(MOZ_PREF_EXTENSIONS)
8896 AC_SUBST(MOZ_XSLT_STANDALONE)
8897 AC_SUBST(MOZ_JS_LIBS)
8900 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8901 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8902 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8903 AC_SUBST(MOZ_DEBUG_FLAGS)
8904 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8905 AC_SUBST(WARNINGS_AS_ERRORS)
8906 AC_SUBST(MOZ_EXTENSIONS)
8907 AC_SUBST(MOZ_JSDEBUGGER)
8908 AC_SUBST(MOZ_LOG_REFCNT)
8912 AC_SUBST(MOZ_CALLGRIND)
8915 AC_SUBST(MOZ_PROFILING)
8916 AC_SUBST(MOZ_QUANTIFY)
8918 AC_SUBST(MOZ_PLACES)
8919 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8921 AC_SUBST(NS_PRINTING)
8923 AC_SUBST(MOZ_HELP_VIEWER)
8929 AC_SUBST(MOZ_PROFILELOCKING)
8931 AC_SUBST(ENABLE_TESTS)
8933 AC_SUBST(MOZ_UNIVERSALCHARDET)
8934 AC_SUBST(ACCESSIBILITY)
8935 AC_SUBST(MOZ_SPELLCHECK)
8936 AC_SUBST(MOZ_USER_DIR)
8937 AC_SUBST(MOZ_CRASHREPORTER)
8938 AC_SUBST(MOZ_UPDATER)
8940 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8941 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8942 AC_SUBST(MOZ_D3DX9_VERSION)
8943 AC_SUBST(MOZ_D3DX9_CAB)
8944 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8945 AC_SUBST(MOZ_D3DX9_DLL)
8946 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8948 AC_SUBST(ENABLE_STRIP)
8949 AC_SUBST(PKG_SKIP_STRIP)
8950 AC_SUBST(USE_ELF_DYNSTR_GC)
8951 AC_SUBST(USE_ELF_HACK)
8952 AC_SUBST(INCREMENTAL_LINKER)
8953 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8954 AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
8955 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8957 AC_SUBST(MOZ_FIX_LINK_PATHS)
8958 AC_SUBST(XPCOM_LIBS)
8959 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8960 AC_SUBST(XPCOM_GLUE_LDOPTS)
8961 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8963 AC_SUBST(USE_DEPENDENT_LIBS)
8965 AC_SUBST(MOZ_BUILD_ROOT)
8966 AC_SUBST(MOZ_OS2_TOOLS)
8968 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8969 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8971 # The following variables are available to branding and application
8972 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8973 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8974 # impacts profile location and user-visible fields.
8975 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8976 # versions of a given application (e.g. Aurora and Firefox both use
8977 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8978 # for application.ini's "Name" field, which controls profile location in
8979 # the absence of a "Profile" field (see below), and various system
8980 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8981 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8982 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8983 # builds (e.g. Aurora for Firefox).
8984 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8985 # defaults to a lowercase form of MOZ_APP_BASENAME.
8986 # - MOZ_APP_PROFILE: When set, used for application.ini's
8987 # "Profile" field, which controls profile location.
8989 if test -z "$MOZ_APP_NAME"; then
8990 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8993 AC_SUBST(MOZ_APP_NAME)
8994 AC_SUBST(MOZ_APP_DISPLAYNAME)
8995 AC_SUBST(MOZ_APP_BASENAME)
8996 AC_SUBST(MOZ_APP_VENDOR)
8997 AC_SUBST(MOZ_APP_PROFILE)
8998 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8999 AC_SUBST(MOZ_APP_UA_NAME)
9000 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
9001 AC_SUBST(MOZ_APP_VERSION)
9002 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
9003 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
9004 AC_SUBST(FIREFOX_VERSION)
9005 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
9006 AC_SUBST(MOZ_UA_BUILDID)
9008 AC_SUBST(MOZ_PKG_SPECIAL)
9010 AC_SUBST(MOZILLA_OFFICIAL)
9012 if test "$MOZ_TELEMETRY_REPORTING"; then
9013 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
9017 AC_SUBST(MOZ_MAPINFO)
9018 AC_SUBST(MOZ_BROWSE_INFO)
9019 AC_SUBST(MOZ_TOOLS_DIR)
9020 AC_SUBST(WIN32_REDIST_DIR)
9024 dnl Echo the CFLAGS to remove extra whitespace.
9031 $_MOZ_EXCEPTIONS_FLAGS \
9032 $_WARNINGS_CXXFLAGS \
9035 COMPILE_CFLAGS=`echo \
9040 COMPILE_CXXFLAGS=`echo \
9041 $_DEFINES_CXXFLAGS \
9045 AC_SUBST(SYSTEM_MAKEDEPEND)
9046 AC_SUBST(SYSTEM_LIBXUL)
9047 AC_SUBST(SYSTEM_JPEG)
9048 AC_SUBST(SYSTEM_PNG)
9049 AC_SUBST(SYSTEM_ZLIB)
9050 AC_SUBST(SYSTEM_BZ2)
9052 AC_SUBST(JPEG_CFLAGS)
9054 AC_SUBST(ZLIB_CFLAGS)
9056 AC_SUBST(BZ2_CFLAGS)
9058 AC_SUBST(PNG_CFLAGS)
9061 AC_SUBST(MOZ_JPEG_CFLAGS)
9062 AC_SUBST(MOZ_JPEG_LIBS)
9063 AC_SUBST(MOZ_ZLIB_CFLAGS)
9064 AC_SUBST(MOZ_ZLIB_LIBS)
9065 AC_SUBST(MOZ_BZ2_CFLAGS)
9066 AC_SUBST(MOZ_BZ2_LIBS)
9067 AC_SUBST(MOZ_PNG_CFLAGS)
9068 AC_SUBST(MOZ_PNG_LIBS)
9070 AC_SUBST(NSPR_CFLAGS)
9072 AC_SUBST(MOZ_NATIVE_NSPR)
9074 AC_SUBST(NSS_CFLAGS)
9076 AC_SUBST(NSS_DEP_LIBS)
9077 AC_SUBST(MOZ_NATIVE_NSS)
9078 AC_SUBST(NSS_DISABLE_DBM)
9083 AC_SUBST(COMPILE_CFLAGS)
9084 AC_SUBST(COMPILE_CXXFLAGS)
9087 AC_SUBST(CROSS_COMPILE)
9088 AC_SUBST(WCHAR_CFLAGS)
9092 AC_SUBST(HOST_CFLAGS)
9093 AC_SUBST(HOST_CXXFLAGS)
9094 AC_SUBST(HOST_LDFLAGS)
9095 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9097 AC_SUBST(HOST_AR_FLAGS)
9099 AC_SUBST(HOST_RANLIB)
9100 AC_SUBST(HOST_NSPR_MDCPUCFG)
9101 AC_SUBST(HOST_BIN_SUFFIX)
9102 AC_SUBST(HOST_OS_ARCH)
9104 AC_SUBST(TARGET_CPU)
9105 AC_SUBST(TARGET_VENDOR)
9107 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9108 AC_SUBST(TARGET_MD_ARCH)
9109 AC_SUBST(TARGET_XPCOM_ABI)
9112 AC_SUBST(OS_RELEASE)
9115 AC_SUBST(INTEL_ARCHITECTURE)
9117 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9118 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9120 AC_SUBST(WRAP_MALLOC_CFLAGS)
9121 AC_SUBST(WRAP_MALLOC_LIB)
9124 AC_SUBST(MKSHLIB_FORCE_ALL)
9125 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9126 AC_SUBST(DSO_CFLAGS)
9127 AC_SUBST(DSO_PIC_CFLAGS)
9128 AC_SUBST(DSO_LDOPTS)
9129 AC_SUBST(LIB_PREFIX)
9130 AC_SUBST(DLL_PREFIX)
9131 AC_SUBST(DLL_SUFFIX)
9132 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9133 AC_SUBST(LIB_SUFFIX)
9134 AC_SUBST(OBJ_SUFFIX)
9135 AC_SUBST(BIN_SUFFIX)
9136 AC_SUBST(ASM_SUFFIX)
9137 AC_SUBST(IMPORT_LIB_SUFFIX)
9139 AC_SUBST(CC_VERSION)
9140 AC_SUBST(CXX_VERSION)
9141 AC_SUBST(MSMANIFEST_TOOL)
9142 AC_SUBST(NS_ENABLE_TSF)
9143 AC_SUBST(MOZ_NSS_PATCH)
9144 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9145 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9148 AC_SUBST(MOZ_SYDNEYAUDIO)
9150 AC_SUBST(MOZ_VORBIS)
9151 AC_SUBST(MOZ_TREMOR)
9154 AC_SUBST(MOZ_ALSA_LIBS)
9156 AC_SUBST(VPX_ASFLAGS)
9157 AC_SUBST(VPX_DASH_C_FLAG)
9158 AC_SUBST(VPX_AS_CONVERSION)
9159 AC_SUBST(VPX_ASM_SUFFIX)
9160 AC_SUBST(VPX_X86_ASM)
9161 AC_SUBST(VPX_ARM_ASM)
9162 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
9163 AC_SUBST(LIBJPEG_TURBO_AS)
9164 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
9165 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
9166 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
9168 if test "$USING_HCC"; then
9169 CC='${topsrcdir}/build/hcc'
9171 CXX='${topsrcdir}/build/hcpp'
9172 CXX="$CXX '$_OLDCXX'"
9177 AC_MSG_CHECKING([for posix_fallocate])
9178 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9179 #include <fcntl.h>],
9180 [posix_fallocate(0, 0, 0);],
9181 [ac_cv___posix_fallocate=true],
9182 [ac_cv___posix_fallocate=false])
9184 if test "$ac_cv___posix_fallocate" = true ; then
9185 AC_DEFINE(HAVE_POSIX_FALLOCATE)
9191 dnl Check for missing components
9192 if test "$COMPILE_ENVIRONMENT"; then
9193 if test "$MOZ_X11"; then
9194 dnl ====================================================
9195 dnl = Check if X headers exist
9196 dnl ====================================================
9197 _SAVE_CFLAGS=$CFLAGS
9198 CFLAGS="$CFLAGS $XCFLAGS"
9202 #include <X11/Xlib.h>
9203 #include <X11/Intrinsic.h>
9204 #include <X11/extensions/XShm.h>
9208 if ((dpy = XOpenDisplay(NULL)) == NULL) {
9209 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9213 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9214 CFLAGS="$_SAVE_CFLAGS"
9216 if test -n "$MISSING_X"; then
9217 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9222 dnl Check for headers, etc. needed by WebGL.
9223 if test -n "$MOZ_WEBGL_GLX"; then
9224 MOZ_CHECK_HEADER(GL/glx.h)
9225 if test "$ac_cv_header_GL_glx_h" != "yes"; then
9226 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))])
9229 fi # COMPILE_ENVIRONMENT
9231 if test "$USE_FC_FREETYPE"; then
9232 if test "$COMPILE_ENVIRONMENT"; then
9233 _SAVE_CPPFLAGS="$CPPFLAGS"
9234 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9235 AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
9236 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9237 CPPFLAGS="$_SAVE_CPPFLAGS"
9239 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9243 dnl Set various defines and substitutions
9244 dnl ========================================================
9246 if test "$OS_ARCH" = "Darwin"; then
9248 AC_DEFINE(UNIX_ASYNC_DNS)
9249 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
9251 AC_DEFINE(UNIX_ASYNC_DNS)
9254 if test "$MOZ_DEBUG"; then
9255 AC_DEFINE(MOZ_REFLOW_PERF)
9256 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9259 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9260 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9261 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9262 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9263 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9264 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9265 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9266 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9267 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9272 WIN_TOP_SRC=`cd $srcdir; pwd -W`
9276 AC_SUBST(WIN_TOP_SRC)
9278 AC_SUBST(MOZILLA_VERSION)
9280 AC_SUBST(ac_configure_args)
9282 dnl Spit out some output
9283 dnl ========================================================
9285 dnl The following defines are used by xpcom
9286 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9288 HAVE_CPP_2BYTE_WCHAR_T
9289 HAVE_CPP_ACCESS_CHANGING_USING
9290 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9293 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9295 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9296 HAVE_CPP_NAMESPACE_STD
9298 HAVE_CPP_PARTIAL_SPECIALIZATION
9299 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9301 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9303 NEED_CPP_UNUSED_IMPLEMENTATIONS
9307 HAVE_ICONV_WITH_CONST_INPUT
9315 netwerk/necko-config.h
9316 xpcom/xpcom-config.h
9317 xpcom/xpcom-private.h
9320 # Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
9321 # "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
9322 # binary, even on 64-bit systems. It should work on OS X 10.4.5 and up. We
9323 # (apparently) only need this hack when egrep's "pattern" is particularly
9324 # long (as in the following code). See bug 655339.
9327 FIXED_EGREP="arch -arch i386 egrep"
9334 # Save the defines header file before autoconf removes it.
9335 # (Do not add AC_DEFINE calls after this line.)
9336 _CONFIG_TMP=confdefs-tmp.h
9337 _CONFIG_DEFS_H=mozilla-config.h
9339 cat > $_CONFIG_TMP <<\EOF
9340 /* List of defines generated by configure. Included with preprocessor flag,
9341 * -include, to avoid long list of -D defines on the compile command-line.
9345 #ifndef _MOZILLA_CONFIG_H_
9346 #define _MOZILLA_CONFIG_H_
9349 _EGREP_PATTERN='^#define ('
9350 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9351 for f in $_NON_GLOBAL_ACDEFINES; do
9352 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9355 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9357 sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9359 if test "$?" != 0; then
9360 AC_MSG_ERROR([Error outputting config definitions])
9363 cat >> $_CONFIG_TMP <<\EOF
9365 /* The c99 defining the limit macros (UINT32_MAX for example), says:
9366 * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
9367 * is defined before <stdint.h> is included. */
9368 #define __STDC_LIMIT_MACROS
9370 /* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
9371 * modify it directly.
9373 * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
9374 * unless --enable-system-hunspell is defined.
9376 #if defined(HUNSPELL_STATIC)
9377 #include "hunspell_alloc_hooks.h"
9380 #endif /* _MOZILLA_CONFIG_H_ */
9384 # Only write mozilla-config.h when something changes (or it doesn't exist)
9385 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9388 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9389 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9391 echo ==== $_CONFIG_DEFS_H =================================
9395 dnl Probably shouldn't call this manually but we always want the output of DEFS
9396 rm -f confdefs.h.save
9397 mv confdefs.h confdefs.h.save
9398 $FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9399 if test "$?" != 0; then
9400 AC_MSG_ERROR([Error outputting confdefs.h])
9402 AC_OUTPUT_MAKE_DEFS()
9404 AC_SUBST(MOZ_DEFINES)
9406 mv confdefs.h.save confdefs.h
9408 dnl Load the list of Makefiles to generate.
9409 dnl To add new Makefiles, edit allmakefiles.sh.
9410 dnl allmakefiles.sh sets the variable, MAKEFILES.
9411 . ${srcdir}/allmakefiles.sh
9413 dnl Run a perl script to quickly create the makefiles.
9414 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9415 dnl for the files it cannot handle correctly. This way, config.status
9416 dnl will handle these files.
9417 dnl If it fails, nothing is set and config.status will run as usual.
9419 dnl This does not change the $MAKEFILES variable.
9421 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9425 echo $MAKEFILES > unallmakefiles
9427 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9429 AC_OUTPUT($MAKEFILES)
9431 # Generate a JSON config file for unittest harnesses etc to read
9432 # build configuration details from in a standardized way.
9433 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
9434 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
9435 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
9436 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
9437 rm ./mozinfo.json.tmp
9439 mv -f ./mozinfo.json.tmp ./mozinfo.json
9442 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9443 if test "$CAIRO_FEATURES_H"; then
9444 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9445 echo "$CAIRO_FEATURES_H is unchanged"
9446 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9448 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9452 # Run freetype configure script
9454 if test "$MOZ_TREE_FREETYPE"; then
9455 export CFLAGS="$CFLAGS -std=c99"
9456 export CPPFLAGS="$CPPFLAGS"
9457 export CXXFLAGS="$CXXFLAGS"
9458 export LDFLAGS="$LDFLAGS"
9459 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9460 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9461 AC_OUTPUT_SUBDIRS(modules/freetype2)
9464 dnl ========================================================
9465 dnl = Setup a nice relatively clean build environment for
9466 dnl = sub-configures.
9467 dnl ========================================================
9470 CFLAGS="$_SUBDIR_CFLAGS"
9471 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9472 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9473 LDFLAGS="$_SUBDIR_LDFLAGS"
9474 HOST_CC="$_SUBDIR_HOST_CC"
9475 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9476 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9482 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9483 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9485 if test -n "$_WRAP_MALLOC"; then
9486 _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9489 if test -z "$MOZ_NATIVE_NSPR"; then
9490 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9491 if test -z "$MOZ_DEBUG"; then
9492 ac_configure_args="$ac_configure_args --disable-debug"
9494 if test "$MOZ_OPTIMIZE" = "1"; then
9495 ac_configure_args="$ac_configure_args --enable-optimize"
9497 if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9498 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9500 if test -n "$HAVE_64BIT_OS"; then
9501 ac_configure_args="$ac_configure_args --enable-64bit"
9503 if test -n "$USE_ARM_KUSER"; then
9504 ac_configure_args="$ac_configure_args --with-arm-kuser"
9506 AC_OUTPUT_SUBDIRS(nsprpub)
9507 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9510 if test -z "$MOZ_NATIVE_NSPR"; then
9511 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9512 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9513 if test "$OS_ARCH" != "WINNT"; then
9514 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9515 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9516 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9517 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9519 rm -f config/autoconf.mk.bak
9522 # Run the SpiderMonkey 'configure' script.
9523 dist=$MOZ_BUILD_ROOT/dist
9524 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9525 ac_configure_args="$ac_configure_args --enable-threadsafe"
9526 if test "$BUILD_CTYPES"; then
9527 # Build js-ctypes on the platforms we can.
9528 ac_configure_args="$ac_configure_args --enable-ctypes"
9530 if test -z "$JS_SHARED_LIBRARY" ; then
9531 ac_configure_args="$ac_configure_args --disable-shared-js"
9533 if test -z "$MOZ_NATIVE_NSPR"; then
9534 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9535 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9537 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9538 ac_configure_args="$ac_configure_args --prefix=$dist"
9539 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9540 if test "$MOZ_MEMORY"; then
9541 ac_configure_args="$ac_configure_args --enable-jemalloc"
9542 if test -n "$MOZ_MEMORY_LDFLAGS"; then
9543 export MOZ_MEMORY_LDFLAGS
9547 AC_OUTPUT_SUBDIRS(js/src)
9548 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9550 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9552 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9553 dnl Needs to be at the end to respect possible changes from NSPR configure
9554 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9555 echo "config/autoconf.mk is unchanged"
9556 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9558 rm -f config/autoconf.mk.orig 2> /dev/null