1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
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}"
74 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
75 AC_SUBST(MOZ_DEB_TIMESTAMP)
78 dnl ========================================================
80 dnl = Don't change the following two lines. Doing so breaks:
82 dnl = CFLAGS="-foo" ./configure
84 dnl ========================================================
86 CPPFLAGS="${CPPFLAGS=}"
87 CXXFLAGS="${CXXFLAGS=}"
89 HOST_CFLAGS="${HOST_CFLAGS=}"
90 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
91 HOST_LDFLAGS="${HOST_LDFLAGS=}"
93 dnl ========================================================
94 dnl = Preserve certain environment flags passed to configure
95 dnl = We want sub projects to receive the same flags
96 dnl = untainted by this configure script
97 dnl ========================================================
100 _SUBDIR_CFLAGS="$CFLAGS"
101 _SUBDIR_CPPFLAGS="$CPPFLAGS"
102 _SUBDIR_CXXFLAGS="$CXXFLAGS"
103 _SUBDIR_LDFLAGS="$LDFLAGS"
104 _SUBDIR_HOST_CC="$HOST_CC"
105 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
106 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
107 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
108 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
110 dnl Set the version number of the libs included with mozilla
111 dnl ========================================================
118 dnl Set the minimum version of toolkit libs used by mozilla
119 dnl ========================================================
127 WINDRES_VERSION=2.14.90
130 GNOMEUI_VERSION=2.2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
135 SQLITE_VERSION=3.6.23.1
136 LIBNOTIFY_VERSION=0.4
140 dnl Set various checks
141 dnl ========================================================
145 dnl Initialize the Pthread test variables early so they can be
146 dnl overridden by each platform.
147 dnl ========================================================
151 dnl Do not allow a separate objdir build if a srcdir build exists.
152 dnl ==============================================================
153 _topsrcdir=`cd \`dirname $0\`; pwd`
156 if test "$_topsrcdir" != "$_objdir"
158 # Check for a couple representative files in the source tree
160 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
161 if test -f $file; then
162 _conflict_files="$_conflict_files $file"
165 if test "$_conflict_files"; then
167 echo "* Your source tree contains these files:"
168 for file in $_conflict_files; do
172 * This indicates that you previously built in the source tree.
173 * A source tree build can confuse the separate objdir build.
175 * To clean up the source tree:
186 dnl Default to MSVC for win32 and gcc-4.2 for darwin
187 dnl ==============================================================
188 if test -z "$CROSS_COMPILE"; then
190 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
191 if test -z "$CC"; then CC=cl; fi
192 if test -z "$CXX"; then CXX=cl; fi
193 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195 if test -z "$LD"; then LD=link; fi
196 if test -z "$AS"; then
197 case "${target_cpu}" in
206 if test -z "$MIDL"; then MIDL=midl; fi
209 if test -z "$CC"; then CC=gcc-4.2; fi
210 if test -z "$CXX"; then CXX=g++-4.2; fi
215 COMPILE_ENVIRONMENT=1
216 MOZ_ARG_DISABLE_BOOL(compile-environment,
217 [ --disable-compile-environment
218 Disable compiler/library checks.],
219 COMPILE_ENVIRONMENT= )
220 AC_SUBST(COMPILE_ENVIRONMENT)
222 MOZ_ARG_WITH_STRING(l10n-base,
223 [ --with-l10n-base=DIR path to l10n repositories],
224 L10NBASEDIR=$withval)
225 if test ! -z "$L10NBASEDIR"; then
226 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
227 AC_MSG_ERROR([--with-l10n-base must specify a path])
228 elif test -d "$L10NBASEDIR"; then
229 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
231 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
234 AC_SUBST(L10NBASEDIR)
236 dnl Check for Perl first -- needed for win32 SDK checks
237 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
238 if test -z "$PERL" || test "$PERL" = ":"; then
239 AC_MSG_ERROR([perl not found in \$PATH])
242 dnl ========================================================
243 dnl Checks for compilers.
244 dnl ========================================================
245 dnl Set CROSS_COMPILE in the environment when running configure
246 dnl to use the cross-compile setup for now
247 dnl ========================================================
249 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
252 if test "$COMPILE_ENVIRONMENT"; then
254 dnl Do some special WinCE toolchain stuff
258 MOZ_ARG_WITH_STRING(wince-sdk,
259 [ --with-wince-sdk=WINCE_SDK_DIR
260 The path to the Windows CE SDK],
261 WINCE_SDK_DIR=$withval)
263 MOZ_ARG_WITH_STRING(ogles-sdk,
264 [ --with-ogles-sdk=OGLES_SDK_DIR
265 The path to the OGLES SDK],
266 OGLES_SDK_DIR=$withval)
272 echo -----------------------------------------------------------------------------
273 echo Building Windows CE Shunt Library and Tool Chain
280 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
281 make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
282 TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
283 -C $srcdir/build/wince/tools
285 CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
286 CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
287 CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
288 CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
289 LD="$_pwd/dist/sdk/bin/$target-link.exe"
290 AR="$_pwd/dist/sdk/bin/$target-lib.exe"
291 AS="$_pwd/dist/sdk/bin/$target-as.exe"
292 RC="$_pwd/dist/sdk/bin/$target-res.exe"
295 echo -----------------------------------------------------------------------------
300 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
301 echo "cross compiling from $host to $target"
305 _SAVE_CFLAGS="$CFLAGS"
306 _SAVE_LDFLAGS="$LDFLAGS"
308 AC_MSG_CHECKING([for host c compiler])
309 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
310 if test -z "$HOST_CC"; then
311 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
313 AC_MSG_RESULT([$HOST_CC])
314 AC_MSG_CHECKING([for host c++ compiler])
315 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
316 if test -z "$HOST_CXX"; then
317 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
319 AC_MSG_RESULT([$HOST_CXX])
321 if test -z "$HOST_CFLAGS"; then
322 HOST_CFLAGS="$CFLAGS"
324 if test -z "$HOST_CXXFLAGS"; then
325 HOST_CXXFLAGS="$CXXFLAGS"
327 if test -z "$HOST_LDFLAGS"; then
328 HOST_LDFLAGS="$LDFLAGS"
330 if test -z "$HOST_AR_FLAGS"; then
331 HOST_AR_FLAGS="$AR_FLAGS"
333 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
334 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
336 CFLAGS="$HOST_CFLAGS"
337 LDFLAGS="$HOST_LDFLAGS"
339 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
340 AC_TRY_COMPILE([], [return(0);],
341 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
342 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
345 CFLAGS="$HOST_CXXFLAGS"
347 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
348 AC_TRY_COMPILE([], [return(0);],
349 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
350 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
354 LDFLAGS=$_SAVE_LDFLAGS
356 case "$build:$target" in
357 powerpc-apple-darwin8*:i?86-apple-darwin*)
358 dnl The Darwin cross compiler doesn't necessarily point itself at a
359 dnl root that has libraries for the proper architecture, it defaults
360 dnl to the system root. The libraries in the system root on current
361 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
362 dnl checks will fail. Fake a working SDK in that case.
364 _SAVE_CXXFLAGS=$CXXLAGS
365 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
366 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
370 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
373 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
377 case "$build:$target" in
378 powerpc-apple-darwin8*:i?86-apple-darwin*)
379 dnl Revert the changes made above. From this point on, the target
380 dnl compiler will never be used without applying the SDK to CFLAGS
381 dnl (see --with-macos-sdk below).
383 CXXFLAGS=$_SAVE_CXXFLAGS
387 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
388 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
389 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
390 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
391 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
392 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
393 AC_DEFINE(CROSS_COMPILE)
398 MOZ_PATH_PROGS(AS, $AS as, $CC)
399 AC_CHECK_PROGS(AR, ar, :)
400 AC_CHECK_PROGS(LD, ld, :)
401 AC_CHECK_PROGS(STRIP, strip, :)
402 AC_CHECK_PROGS(WINDRES, windres, :)
403 if test -z "$HOST_CC"; then
406 if test -z "$HOST_CFLAGS"; then
407 HOST_CFLAGS='$(CFLAGS)'
409 if test -z "$HOST_CXX"; then
412 if test -z "$HOST_CXXFLAGS"; then
413 HOST_CXXFLAGS='$(CXXFLAGS)'
415 if test -z "$HOST_LDFLAGS"; then
416 HOST_LDFLAGS='$(LDFLAGS)'
418 if test -z "$HOST_RANLIB"; then
419 HOST_RANLIB='$(RANLIB)'
421 if test -z "$HOST_AR"; then
424 if test -z "$HOST_AR_FLAGS"; then
425 HOST_AR_FLAGS='$(AR_FLAGS)'
435 if test "$GCC" = "yes"; then
437 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
439 if test "$GXX" = "yes"; then
441 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
443 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
446 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
449 if test "$GNU_CC"; then
450 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
457 if test "$GCC" = yes; then
458 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
463 if test "$GXX" = yes; then
464 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
469 dnl Special win32 checks
470 dnl ========================================================
478 dnl Target the Windows 7 SDK by default
484 MOZ_ARG_WITH_STRING(windows-version,
485 [ --with-windows-version=WINSDK_TARGETVER
486 Highest Windows version to target using this SDK
487 502: Windows Server 2003
490 WINSDK_TARGETVER=$withval)
492 case "$WINSDK_TARGETVER" in
494 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
498 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
503 dnl Vista SDK specific api (deprecated)
504 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
505 [ --disable-vista-sdk-requirements
506 Do not build Vista SDK specific code],
507 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
508 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=$_PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
509 if test -n "$COMPILE_ENVIRONMENT"; then
510 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
511 AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
512 MOZ_WINSDK_TARGETVER=05020000
515 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
516 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
517 AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
518 # We can't build parental controls either
519 MOZ_DISABLE_PARENTAL_CONTROLS=1
523 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
526 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
527 if test "$GCC" != "yes"; then
528 # Check to see if we are really running in a msvc environemnt
530 AC_CHECK_PROGS(MIDL, midl)
532 # Make sure compilers are valid
533 CFLAGS="$CFLAGS -TC -nologo"
534 CXXFLAGS="$CXXFLAGS -TP -nologo"
537 AC_TRY_COMPILE([#include <stdio.h>],
538 [ printf("Hello World\n"); ],,
539 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
542 AC_TRY_COMPILE([#include <new.h>],
543 [ unsigned *test = new unsigned(42); ],,
544 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
548 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
551 # Determine compiler version
552 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
553 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
554 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
555 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
556 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
557 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
559 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
562 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
563 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
565 if test "$_CC_MAJOR_VERSION" = "13"; then
567 elif test "$_CC_MAJOR_VERSION" = "14"; then
569 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
570 dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
571 dnl so be very specific here!
572 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
573 if test $_CC_RELEASE -gt 50727; then
575 elif test $_CC_BUILD -ge 762; then
578 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
579 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
580 elif test "$_CC_MAJOR_VERSION" = "15"; then
582 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
583 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
585 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
586 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
587 elif test "$_CC_MAJOR_VERSION" = "16"; then
589 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
590 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
592 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
593 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
595 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
598 _MOZ_RTTI_FLAGS_ON='-GR'
599 _MOZ_RTTI_FLAGS_OFF='-GR-'
600 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
601 _MOZ_EXCEPTIONS_FLAGS_OFF=''
603 if test -n "$WIN32_REDIST_DIR"; then
604 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
608 # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
609 if test "$_CC_SUITE" -ge "8"; then
611 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
614 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
615 if test -n "$MSMT_TOOL"; then
616 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
617 if test -z "$MSMANIFEST_TOOL_VERSION"; then
618 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
623 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
627 # Check linker version
628 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
629 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
630 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
631 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
636 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
637 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
638 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
639 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
640 # Add flags if necessary
641 AC_MSG_CHECKING([for midl flags])
644 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
645 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
646 # MIDL version 7.00.0500 or later has no problem.
647 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
648 AC_MSG_RESULT([need -env win32])
650 AC_MSG_RESULT([none needed])
654 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
657 AC_MSG_RESULT([none needed])
661 # Identify which version of the SDK we're building with
662 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
664 AC_CHECK_HEADERS([winsdkver.h])
665 if test "$ac_cv_header_winsdkver_h" = "yes"; then
666 # Get the highest _WIN32_WINNT and NTDDI versions supported
667 # Take the higher of the two
668 # This is done because the Windows 7 beta SDK reports its
669 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
670 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
672 [cat > conftest.h <<EOF
673 #include <winsdkver.h>
674 #include <sdkddkver.h>
676 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
677 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
679 #define WINSDK_MAXVER NTDDI_MAXVER
684 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
687 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
689 # The Vista SDK is the only one to have sdkddkver.h but not
691 AC_CHECK_HEADERS([sdkddkver.h])
692 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
693 MOZ_WINSDK_MAXVER=0x06000000
695 # Assume the Server 2003 Platform SDK
696 MOZ_WINSDK_MAXVER=0x05020000
700 unset _MSVC_VER_FILTER
703 # Check w32api version
704 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
705 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
706 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
707 AC_TRY_COMPILE([#include <w32api.h>],
708 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
709 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
710 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
711 #error "test failed."
713 , [ res=yes ], [ res=no ])
714 AC_MSG_RESULT([$res])
715 if test "$res" != "yes"; then
716 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
718 # Check windres version
719 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
720 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
721 AC_MSG_RESULT([$_WINDRES_VERSION])
722 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
723 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
724 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
725 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
726 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
727 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
728 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
729 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
730 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
731 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
732 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
733 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
735 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
738 # Server 2003 is the highest version supported
739 MOZ_WINSDK_MAXVER=0x05020000
742 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
743 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
744 # Require OS features provided by IE 5.0
745 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
747 # If the maximum version supported by this SDK is lower than the target
749 AC_MSG_CHECKING([for Windows SDK being recent enough])
750 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
754 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. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
757 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
758 # Definitions matching sdkddkver.h
759 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
760 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
761 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
763 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
768 dnl Test breaks icc on OS/2 && MSVC
769 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
771 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
775 CC="${srcdir}/build/hcc '$CC'"
776 CXX="${srcdir}/build/hcpp '$CXX'"
783 if test -n "$_WIN32_MSVC"; then
785 SKIP_COMPILER_CHECKS=1
786 SKIP_LIBRARY_CHECKS=1
788 # Since we're skipping compiler and library checks, hard-code
795 AC_DEFINE(HAVE_SETBUF)
796 AC_DEFINE(HAVE_ISATTY)
801 fi # COMPILE_ENVIRONMENT
814 AC_SUBST(WRAP_STL_INCLUDES)
816 dnl ========================================================
817 dnl Checks for programs.
818 dnl ========================================================
822 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
823 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
824 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
826 AC_MSG_RESULT([$_perl_version])
828 if test "$_perl_res" != 0; then
829 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
833 AC_MSG_CHECKING([for full perl installation])
834 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
836 if test "$_perl_res" != 0; then
838 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
843 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
844 if test -z "$PYTHON"; then
845 AC_MSG_ERROR([python was not found in \$PATH])
848 if test -z "$COMPILE_ENVIRONMENT"; then
849 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
851 AC_SUBST(NSINSTALL_BIN)
853 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
854 MOZ_PATH_PROG(WHOAMI, whoami, :)
855 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
856 MOZ_PATH_PROG(UNZIP, unzip, :)
857 MOZ_PATH_PROGS(ZIP, zip)
858 if test -z "$ZIP" || test "$ZIP" = ":"; then
859 AC_MSG_ERROR([zip not found in \$PATH])
861 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
862 MOZ_PATH_PROG(XARGS, xargs)
863 if test -z "$XARGS" || test "$XARGS" = ":"; then
864 AC_MSG_ERROR([xargs not found in \$PATH .])
867 if test "$COMPILE_ENVIRONMENT"; then
869 dnl ========================================================
870 dnl = Mac OS X toolchain support
871 dnl ========================================================
875 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
876 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
877 dnl the environment and includedir purposes (when using an SDK, below),
878 dnl but remember the full version number for the libdir (SDK).
880 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
881 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
883 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
884 dnl Bug 280479, but this keeps popping up in bug 292530 too because
885 dnl 4.0.0/4061 is the default compiler in Tiger.
887 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
889 if test "$GCC_BUILD" = "4061" ; then
890 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
891 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
892 from building Mozilla. Upgrade to Xcode 2.1 or later.])
896 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
897 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
898 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
899 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
904 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
906 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
912 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
913 dnl it has moved into /usr/bin.
914 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
918 AC_SUBST(GCC_VERSION)
919 AC_SUBST(XCODEBUILD_VERSION)
920 AC_SUBST(HAS_XCODE_2_1)
922 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
923 dnl that a universal binary is being produced.
924 AC_SUBST(UNIVERSAL_BINARY)
926 dnl ========================================================
927 dnl Check for MacOS deployment target version
928 dnl ========================================================
930 MOZ_ARG_ENABLE_STRING(macos-target,
931 [ --enable-macos-target=VER (default=10.5)
932 Set the minimum MacOS version needed at runtime],
933 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
937 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
938 dnl Use the specified value
939 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
940 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
941 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
942 dnl No value specified on the command line or in the environment,
943 dnl use architecture minimum.
944 export MACOSX_DEPLOYMENT_TARGET=10.5
949 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
951 dnl ========================================================
952 dnl = Mac OS X SDK support
953 dnl ========================================================
956 MOZ_ARG_WITH_STRING(macos-sdk,
957 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
958 MACOS_SDK_DIR=$withval)
960 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
961 dnl NEXT_ROOT will be set and exported only if it's needed.
962 AC_SUBST(MACOS_SDK_DIR)
965 if test "$MACOS_SDK_DIR"; then
966 dnl Sync this section with the ones in NSPR and NSS.
967 dnl Changes to the cross environment here need to be accounted for in
968 dnl the libIDL checks (below) and xpidl build.
970 if test ! -d "$MACOS_SDK_DIR"; then
971 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
972 specify a valid SDK. SDKs are installed when the optional cross-development
973 tools are selected during the Xcode/Developer Tools installation.])
976 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
977 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
978 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
980 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
981 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
983 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
984 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
985 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
987 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
988 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
989 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
990 dnl be ignored and cause warnings when -syslibroot is specified.
991 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
992 dnl the -isysroot it receives, so this is only needed with 4.0.0.
993 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
998 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1000 AC_TRY_COMPILE([#include <new>
1001 int main() { return 0; }],
1005 AC_MSG_RESULT($result)
1007 if test "$result" = "no" ; then
1008 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1012 fi # COMPILE_ENVIRONMENT
1014 if test -n "$MAKE"; then
1015 if test `echo $MAKE | grep -c make.py` != 1; then
1021 cygwin*|mingw*|mks*|msvc*)
1022 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1025 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1028 if test "$GMAKE" = ":"; then
1029 AC_MSG_ERROR([GNU make not found])
1033 if test "$COMPILE_ENVIRONMENT"; then
1039 fi # COMPILE_ENVIRONMENT
1041 dnl ========================================================
1042 dnl set the defaults first
1043 dnl ========================================================
1046 AR_EXTRACT='$(AR) x'
1061 MOZ_USER_DIR=".mozilla"
1064 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1066 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1068 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1070 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1072 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1073 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1074 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1075 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1076 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1077 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1078 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1082 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1084 USE_DEPENDENT_LIBS=1
1086 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1088 MOZ_ENABLE_POSTSCRIPT=1
1090 if test -n "$CROSS_COMPILE"; then
1091 OS_TARGET="${target_os}"
1092 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1094 case "${target_os}" in
1095 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1096 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1097 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1098 mingw*) OS_ARCH=WINNT ;;
1099 wince*) OS_ARCH=WINCE ;;
1100 winmo*) OS_ARCH=WINCE ;;
1101 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1104 OS_TARGET=`uname -s`
1105 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1106 OS_RELEASE=`uname -r`
1109 # Before this used `uname -m` when not cross compiling
1110 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1111 OS_TEST="${target_cpu}"
1115 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1117 #######################################################################
1118 # Master "Core Components" macros for getting the OS target #
1119 #######################################################################
1122 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1123 # cross-compilation.
1127 # Define and override various archtecture-specific variables, including
1136 case "$HOST_OS_ARCH" in
1137 cygwin*|mingw*|mks*|msvc*)
1150 if test -z "$GNU_CC"; then
1151 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1156 if test -z "$GNU_CXX"; then
1157 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1158 SOLARIS_SUNPRO_CXX=1
1161 AC_SUBST(SOLARIS_SUNPRO_CC)
1162 AC_SUBST(SOLARIS_SUNPRO_CXX)
1174 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1177 HOST_OS_ARCH=UNIXWARE
1189 HOST_OS_ARCH=OpenVMS
1199 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1203 HOST_OS_ARCH=UNIXWARE
1209 if test -z "$CROSS_COMPILE" ; then
1215 # If uname -s returns "Windows_NT", we assume that we are using
1216 # the uname.exe in MKS toolkit.
1218 # The -r option of MKS uname only returns the major version number.
1219 # So we need to use its -v option to get the minor version number.
1220 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1224 OS_MINOR_RELEASE=`uname -v`
1225 if test "$OS_MINOR_RELEASE" = "00"; then
1228 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1230 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1232 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1233 # the uname.exe in the Cygwin tools.
1234 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1235 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1236 # the uname.exe in the GNU-Win32 tools.
1237 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1238 # the uname.exe in the MSYS tools.
1240 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1245 OS_RELEASE=`uname -v`.`uname -r`
1246 OS_TEST=${target_cpu}
1258 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1262 OS_RELEASE=`uname -v`
1286 OS_RELEASE=`uname -v`
1292 OS_RELEASE=`uname -v`
1295 if test "$OS_TARGET" != "NTO"; then
1297 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1306 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1312 OS_RELEASE=`uname -v`
1316 case "${target_os}" in
1319 WINCE_WINDOWS_MOBILE=1
1320 AC_DEFINE(WINCE_WINDOWS_MOBILE)
1328 case "${target_cpu}" in
1339 if test -z "$CROSS_COMPILE" ; then
1347 if test "$OS_ARCH" = "NCR"; then
1349 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1353 # Only set CPU_ARCH if we recognize the value of OS_TEST
1364 powerpc | ppc | rs6000)
1368 Alpha | alpha | ALPHA)
1393 if test "$OS_TARGET" = "WINCE"; then
1399 if test -z "$OS_TARGET"; then
1402 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1404 dnl ========================================================
1405 dnl GNU specific defaults
1406 dnl ========================================================
1407 if test "$GNU_CC"; then
1408 # FIXME: Let us build with strict aliasing. bug 414641.
1409 CFLAGS="$CFLAGS -fno-strict-aliasing"
1410 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1411 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1412 DSO_LDOPTS='-shared'
1413 if test "$GCC_USE_GNU_LD"; then
1414 # Don't allow undefined symbols in libraries
1415 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1417 WARNINGS_AS_ERRORS='-Werror'
1419 DSO_PIC_CFLAGS='-fPIC'
1420 ASFLAGS="$ASFLAGS -fPIC"
1421 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1422 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1423 _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1424 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1426 # Turn on GNU specific features
1427 # -Wall - turn on all warnings
1428 # -pedantic - make compiler warn about non-ANSI stuff, and
1429 # be a little bit stricter
1430 # Warnings slamm took out for now (these were giving more noise than help):
1431 # -Wbad-function-cast - warns when casting a function to a new return type
1432 # -Wshadow - removed because it generates more noise than help --pete
1433 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1434 if test -z "$INTEL_CC"; then
1435 # Don't use -Wcast-align with ICC
1437 # And don't use it on hppa, ia64, sparc, since it's noisy there
1438 hppa | ia64 | sparc)
1441 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1446 dnl Turn pedantic on but disable the warnings for long long
1449 if test -z "$INTEL_CC"; then
1450 _IGNORE_LONG_LONG_WARNINGS=1
1451 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1453 _IGNORE_LONG_LONG_WARNINGS=
1457 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1458 _USE_CPP_INCLUDE_FLAG=1
1459 elif test "$SOLARIS_SUNPRO_CC"; then
1460 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1461 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1463 DSO_LDOPTS='-shared'
1464 if test "$GNU_LD"; then
1465 # Don't allow undefined symbols in libraries
1466 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1470 if test "$CPU_ARCH" = "sparc"; then
1471 # for Sun Studio on Solaris/SPARC
1472 DSO_PIC_CFLAGS='-xcode=pic32'
1474 DSO_PIC_CFLAGS='-KPIC'
1476 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1478 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1479 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1481 DSO_LDOPTS='-shared'
1482 if test "$GNU_LD"; then
1483 # Don't allow undefined symbols in libraries
1484 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1488 DSO_PIC_CFLAGS='-KPIC'
1489 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1492 if test "$GNU_CXX"; then
1493 # FIXME: Let us build with strict aliasing. bug 414641.
1494 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1495 # Turn on GNU specific features
1496 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1497 if test -z "$INTEL_CC"; then
1498 # Don't use -Wcast-align with ICC
1500 # And don't use it on hppa, ia64, sparc, since it's noisy there
1501 hppa | ia64 | sparc)
1504 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1509 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1510 _USE_CPP_INCLUDE_FLAG=1
1512 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1513 ac_has_wno_invalid_offsetof,
1517 _SAVE_CXXFLAGS="$CXXFLAGS"
1518 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1521 ac_has_wno_invalid_offsetof="yes",
1522 ac_has_wno_invalid_offsetof="no")
1523 CXXFLAGS="$_SAVE_CXXFLAGS"
1526 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1527 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1530 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1531 ac_has_wno_variadic_macros,
1535 _SAVE_CXXFLAGS="$CXXFLAGS"
1536 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1539 ac_has_wno_variadic_macros="yes",
1540 ac_has_wno_variadic_macros="no")
1541 CXXFLAGS="$_SAVE_CXXFLAGS"
1544 if test "$ac_has_wno_variadic_macros" = "yes"; then
1545 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1548 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1549 ac_has_werror_return_type,
1553 _SAVE_CXXFLAGS="$CXXFLAGS"
1554 CXXFLAGS="$CXXFLAGS -Werror=return-type"
1557 ac_has_werror_return_type="yes",
1558 ac_has_werror_return_type="no")
1559 CXXFLAGS="$_SAVE_CXXFLAGS"
1562 if test "$ac_has_werror_return_type" = "yes"; then
1563 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1567 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1570 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1571 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1572 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1573 dnl normal behavior.
1574 dnl ========================================================
1576 MKSHLIB_UNFORCE_ALL=
1578 if test "$COMPILE_ENVIRONMENT"; then
1579 if test "$GNU_CC"; then
1580 AC_MSG_CHECKING(whether ld has archive extraction flags)
1581 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1582 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1583 ac_cv_mkshlib_force_and_unforce="no"
1584 exec 3<&0 <<LOOP_INPUT
1585 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1586 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1587 force="-Wl,-all"; unforce="-Wl,-none"
1594 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1597 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1599 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1603 eval $ac_cv_mkshlib_force_and_unforce
1604 MKSHLIB_FORCE_ALL=$force
1605 MKSHLIB_UNFORCE_ALL=$unforce
1608 fi # COMPILE_ENVIRONMENT
1610 dnl =================================================================
1611 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1612 dnl which is bad when cross compiling.
1613 dnl =================================================================
1614 if test "$COMPILE_ENVIRONMENT"; then
1615 configure_static_assert_macros='
1616 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1617 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1618 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1621 dnl test that the macros actually work:
1622 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1623 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1626 ac_cv_static_assertion_macros_work="yes"
1627 AC_TRY_COMPILE([$configure_static_assert_macros],
1628 [CONFIGURE_STATIC_ASSERT(1)],
1630 ac_cv_static_assertion_macros_work="no")
1631 AC_TRY_COMPILE([$configure_static_assert_macros],
1632 [CONFIGURE_STATIC_ASSERT(0)],
1633 ac_cv_static_assertion_macros_work="no",
1636 AC_TRY_COMPILE([$configure_static_assert_macros],
1637 [CONFIGURE_STATIC_ASSERT(1)],
1639 ac_cv_static_assertion_macros_work="no")
1640 AC_TRY_COMPILE([$configure_static_assert_macros],
1641 [CONFIGURE_STATIC_ASSERT(0)],
1642 ac_cv_static_assertion_macros_work="no",
1646 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1647 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1648 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1650 fi # COMPILE_ENVIRONMENT
1652 dnl ========================================================
1653 dnl Checking for 64-bit OS
1654 dnl ========================================================
1655 if test "$COMPILE_ENVIRONMENT"; then
1658 AC_MSG_CHECKING(for 64-bit OS)
1659 AC_TRY_COMPILE([$configure_static_assert_macros],
1660 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1661 result="yes", result="no")
1662 AC_MSG_RESULT("$result")
1663 if test "$result" = "yes"; then
1664 AC_DEFINE(HAVE_64BIT_OS)
1667 AC_SUBST(HAVE_64BIT_OS)
1669 fi # COMPILE_ENVIRONMENT
1671 dnl ========================================================
1672 dnl Enable high-memory support on OS/2 by default.
1673 dnl ========================================================
1674 MOZ_OS2_HIGH_MEMORY=1
1675 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1676 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1677 MOZ_OS2_HIGH_MEMORY=,
1678 MOZ_OS2_HIGH_MEMORY=1 )
1679 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1681 dnl ========================================================
1682 dnl System overrides of the defaults for host
1683 dnl ========================================================
1686 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1687 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1688 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1691 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1692 # we need Python 2.5 on Windows
1694 if test -n "$_WIN32_MSVC"; then
1696 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1697 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1698 HOST_RANLIB='echo ranlib'
1700 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1702 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1703 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1704 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1705 HOST_BIN_SUFFIX=.exe
1708 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1709 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1712 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1713 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1715 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1717 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1719 PERL="${CYGWIN_WRAPPER} $PERL"
1722 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1723 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1728 case "${host_cpu}" in
1730 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1736 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1737 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1738 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1741 *-linux*|*-kfreebsd*-gnu)
1742 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1743 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1744 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1748 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1749 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1750 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1751 HOST_BIN_SUFFIX=.exe
1756 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1757 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1758 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1762 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1763 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1767 dnl We require version 2.4 or newer of Python to build,
1768 dnl and 2.5 or newer on Windows.
1769 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1771 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1774 if test "$_python_res" != 0; then
1775 AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1777 AC_MSG_RESULT([yes])
1779 dnl Get mozilla version from central milestone file
1780 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1782 dnl Get version of various core apps from the version files.
1783 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1785 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1786 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1788 dnl ========================================================
1789 dnl System overrides of the defaults for target
1790 dnl ========================================================
1795 if test ! "$GNU_CC"; then
1796 if test ! "$HAVE_64BIT_OS"; then
1797 # Compiling with Visual Age C++ object model compat is the
1798 # default. To compile with object model ibm, add
1799 # AIX_OBJMODEL=ibm to .mozconfig.
1800 if test "$AIX_OBJMODEL" = "ibm"; then
1801 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1808 AC_SUBST(AIX_OBJMODEL)
1809 DSO_LDOPTS='-qmkshrobj=1'
1810 DSO_CFLAGS='-qflag=w:w'
1812 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1813 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1815 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1816 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1817 if test "$COMPILE_ENVIRONMENT"; then
1820 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1822 [#if (__IBMCPP__ < 600)
1823 #error "Bad compiler"
1825 _BAD_COMPILER=,_BAD_COMPILER=1)
1826 if test -n "$_BAD_COMPILER"; then
1828 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1830 AC_MSG_RESULT([yes])
1833 TARGET_COMPILER_ABI="ibmc"
1834 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1835 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1838 case "${target_os}" in
1843 if test "$COMPILE_ENVIRONMENT"; then
1844 AC_CHECK_HEADERS(sys/inttypes.h)
1846 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1851 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1852 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1853 DSO_LDOPTS='-nostart'
1854 TK_LIBS='-lbe -lroot'
1856 if test "$COMPILE_ENVIRONMENT"; then
1857 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1858 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1860 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1861 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1864 MOZ_USER_DIR="Mozilla"
1868 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1870 _IGNORE_LONG_LONG_WARNINGS=
1878 _WARNINGS_CFLAGS="-Wall"
1879 _WARNINGS_CXXFLAGS="-Wall"
1880 # The test above doesn't work properly, at least on 3.1.
1881 MKSHLIB_FORCE_ALL=''
1882 MKSHLIB_UNFORCE_ALL=''
1888 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1889 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1890 MOZ_OPTIMIZE_FLAGS="-O3"
1892 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1893 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1896 STRIP="$STRIP -x -S"
1897 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1898 MOZ_ENABLE_POSTSCRIPT=
1899 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1900 # The ExceptionHandling framework is needed for Objective-C exception
1901 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1903 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1905 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1906 dnl ===================================================================
1907 if test "x$enable_dtrace" = "xyes"; then
1908 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1910 dnl check for the presence of the -dead_strip linker flag
1911 AC_MSG_CHECKING([for -dead_strip option to ld])
1912 _SAVE_LDFLAGS=$LDFLAGS
1913 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1914 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1915 if test -n "$_HAVE_DEAD_STRIP" ; then
1916 AC_MSG_RESULT([yes])
1917 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1922 LDFLAGS=$_SAVE_LDFLAGS
1924 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1928 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1929 DLL_SUFFIX=".so.1.0"
1930 DSO_LDOPTS="-shared"
1932 if test ! "$GNU_CC"; then
1933 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1935 # Can't have force w/o an unforce.
1936 # # Hack for FreeBSD 2.2
1937 # if test -z "$MKSHLIB_FORCE_ALL"; then
1938 # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1939 # MKSHLIB_UNFORCE_ALL=''
1945 if test ! "$GNU_CC"; then
1946 DSO_LDOPTS='-b -Wl,+s'
1949 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1950 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1951 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1953 DSO_LDOPTS='-b -E +s'
1954 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1955 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1957 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1958 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1963 DSO_LDOPTS='-elf -shared'
1965 if test "$GNU_CC"; then
1966 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1967 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1968 MKSHLIB_FORCE_ALL='-Wl,-all'
1969 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1970 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1972 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1973 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1974 MKSHLIB_FORCE_ALL='-all'
1975 MKSHLIB_UNFORCE_ALL='-none'
1981 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1982 dnl compile and link using -n32
1984 TARGET_COMPILER_ABI=n32
1985 DSO_LDOPTS='-elf -shared'
1986 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1987 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1988 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1989 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1990 if test "$GNU_CC"; then
1991 MKSHLIB_FORCE_ALL='-Wl,-all'
1992 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1993 _WARNINGS_CFLAGS="-Wall"
1994 _WARNINGS_CXXFLAGS="-Wall"
1995 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1997 MKSHLIB_FORCE_ALL='-all'
1998 MKSHLIB_UNFORCE_ALL='-none'
2004 CFLAGS="$CFLAGS -woff 3262 -G 4"
2005 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2006 if test -n "$USE_N32"; then
2007 ASFLAGS="$ASFLAGS -n32"
2008 CFLAGS="$CFLAGS -n32"
2009 CXXFLAGS="$CXXFLAGS -n32"
2010 LDFLAGS="$LDFLAGS -n32"
2012 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2013 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2016 if test -z "$GNU_CXX"; then
2022 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2023 # Similarly for GNU_CXX and INTEL_CXX.
2024 if test "$INTEL_CC" || test "$INTEL_CXX"; then
2025 # -Os has been broken on Intel's C/C++ compilers for quite a
2026 # while; Intel recommends against using it.
2027 MOZ_OPTIMIZE_FLAGS="-O2"
2028 MOZ_DEBUG_FLAGS="-g"
2029 elif test "$GNU_CC" || test "$GNU_CXX"; then
2030 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2031 case $GCC_VERSION in
2033 # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2034 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2036 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2037 MOZ_DEBUG_FLAGS="-g"
2040 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2044 case "${target_cpu}" in
2046 CFLAGS="$CFLAGS -mieee"
2047 CXXFLAGS="$CXXFLAGS -mieee"
2053 MOZ_DEBUG_FLAGS="-g" # We want inlining
2059 TARGET_COMPILER_ABI=msvc
2060 _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2061 _PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
2062 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2063 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2065 AR_EXTRACT="$AR -extract"
2067 AR_FLAGS='-OUT:"$@"'
2071 ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2073 if test "$AS_BIN"; then
2080 if test -z "$RC"; then
2083 # certain versions of cygwin's makedepend barf on the
2084 # #include <string> vs -I./dist/include/string issue so don't use it
2090 HOST_AR='lib -OUT:$@'
2091 HOST_RANLIB='echo ranlib'
2092 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2095 WARNINGS_AS_ERRORS='-WX'
2096 MOZ_OPTIMIZE_FLAGS='-Ox'
2097 AR_FLAGS='-NOLOGO -OUT:"$@"'
2099 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2100 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2103 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2104 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2106 IMPORT_LIB_SUFFIX=lib
2107 dnl Need to force-link against mozalloc because it's used in the shunt
2108 LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2109 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2112 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2113 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2115 MKSHLIB_UNFORCE_ALL=
2116 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2117 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2118 MOZ_DEBUG_FLAGS='-Zi'
2119 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2121 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2123 RANLIB='echo not_ranlib'
2124 STRIP='echo not_strip'
2125 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2128 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2130 LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2131 LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2135 AC_DEFINE(HAVE_SNPRINTF)
2140 AC_DEFINE(HW_THREADS)
2141 AC_DEFINE(STDC_HEADERS)
2142 AC_DEFINE(NEW_H, <new>)
2143 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2144 AC_DEFINE(HAVE_LOCALTIME_R)
2146 TARGET_MD_ARCH=win32
2147 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2149 MOZ_ENABLE_POSTSCRIPT=
2150 MOZ_USER_DIR="Mozilla"
2152 MOZ_GFX_OPTIMIZE_MOBILE=1
2154 # Sanity check for WINCE_WINDOWS_MOBILE
2155 # XXX disabled until we can fix the mobile tinderbox
2156 ##if test "$WINCE_WINDOWS_MOBILE"; then
2157 ## AC_CHECK_HEADER(tpcshell.h, [],
2158 ## AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2163 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2168 # certain versions of cygwin's makedepend barf on the
2169 # #include <string> vs -I./dist/include/string issue so don't use it
2171 if test -n "$GNU_CC"; then
2172 CC="$CC -mno-cygwin"
2173 CXX="$CXX -mno-cygwin"
2174 CPP="$CPP -mno-cygwin"
2175 CFLAGS="$CFLAGS -mms-bitfields"
2176 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2177 DSO_LDOPTS='-shared'
2178 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2179 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2181 # Use temp file for windres (bug 213281)
2182 RCFLAGS='-O coff --use-temp-file'
2183 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2184 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2185 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2187 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2188 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2190 IMPORT_LIB_SUFFIX=dll.a
2192 TARGET_COMPILER_ABI=msvc
2196 if test "$AS_BIN"; then
2197 AS="$(basename "$AS_BIN")"
2199 AR='lib -NOLOGO -OUT:"$@"'
2201 RANLIB='echo not_ranlib'
2202 STRIP='echo not_strip'
2207 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2213 IMPORT_LIB_SUFFIX=lib
2214 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2215 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2217 MKSHLIB_UNFORCE_ALL=
2218 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2219 _USE_CPP_INCLUDE_FLAG=1
2220 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2221 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2222 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2223 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2224 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2225 MOZ_DEBUG_FLAGS='-Zi'
2226 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2227 WARNINGS_AS_ERRORS='-WX'
2228 MOZ_OPTIMIZE_FLAGS='-O1'
2229 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2231 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2232 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2233 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2234 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2235 if test $_MSC_VER -ge 1400; then
2236 LDFLAGS="$LDFLAGS -NXCOMPAT"
2237 dnl For profile-guided optimization
2238 PROFILE_GEN_CFLAGS="-GL"
2239 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2240 dnl XXX: PGO builds can fail with warnings treated as errors,
2241 dnl specifically "no profile data available" appears to be
2242 dnl treated as an error sometimes. This might be a consequence
2243 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2244 dnl with the linker doing most of the work in the whole-program
2245 dnl optimization/PGO case. I think it's probably a compiler bug,
2246 dnl but we work around it here.
2247 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2248 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2249 dnl Probably also a compiler bug, but what can you do?
2250 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2251 if test -n "$_USE_DYNAMICBASE"; then
2252 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2256 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2257 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2258 AC_DEFINE(HAVE_SNPRINTF)
2263 AC_DEFINE(HW_THREADS)
2264 AC_DEFINE(STDC_HEADERS)
2265 AC_DEFINE(NEW_H, <new>)
2266 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2267 TARGET_MD_ARCH=win32
2268 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2270 MOZ_ENABLE_POSTSCRIPT=
2271 MOZ_USER_DIR="Mozilla"
2273 dnl Hardcode to win95 for now - cls
2274 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2276 dnl set NO_X11 defines here as the general check is skipped on win32
2280 dnl MinGW/MSYS doesn't provide or need cygpath
2285 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2287 *-cygwin*|*-msvc*|*-mks*)
2288 CYGPATH_W="cygpath -a -w"
2289 CYGPATH_S="sed -e s|\\\\|/|g"
2290 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2294 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2296 if test -z "$MOZ_TOOLS"; then
2297 AC_MSG_ERROR([MOZ_TOOLS is not set])
2300 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2301 if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2302 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2304 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2305 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2306 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2308 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2310 if test -n "$GLIB_PREFIX"; then
2311 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2312 if test "$?" = "0"; then
2313 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2314 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2316 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2318 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2321 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2323 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2324 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2326 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2327 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2328 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2329 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2330 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2332 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2335 if test -n "$LIBIDL_PREFIX"; then
2336 _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2337 if test "$?" = "0"; then
2338 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2339 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2341 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2343 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2346 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2348 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2349 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2351 LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2352 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2353 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2355 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2356 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2358 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2360 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2363 *) # else cross-compiling
2364 if test -n "$GLIB_PREFIX"; then
2365 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2366 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2367 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2368 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2369 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2371 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2374 if test -n "$LIBIDL_PREFIX"; then
2375 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2376 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2377 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2379 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2380 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2382 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2385 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2392 AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites])
2396 AC_CHECK_HEADERS(oleacc.idl)
2400 AC_CHECK_HEADERS(atlbase.h)
2407 if test "$HAVE_64BIT_OS"; then
2408 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2411 if test $_MSC_VER -ge 1400; then
2412 LDFLAGS="$LDFLAGS -SAFESEH"
2414 AC_CHECK_HEADERS(mmintrin.h)
2427 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2431 if test "$HAVE_64BIT_OS"; then
2438 CFLAGS="$CFLAGS -Dunix"
2439 CXXFLAGS="$CXXFLAGS -Dunix"
2440 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2442 DSO_PIC_CFLAGS='-fPIC -DPIC'
2443 DSO_LDOPTS='-shared'
2444 BIN_FLAGS='-Wl,--export-dynamic'
2446 DSO_PIC_CFLAGS='-fPIC -DPIC'
2447 DLL_SUFFIX=".so.1.0"
2448 DSO_LDOPTS='-shared'
2450 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2451 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2452 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2453 if test "$LIBRUNPATH"; then
2454 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2456 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2457 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2462 AC_DEFINE(_QNX_SOURCE)
2465 WARNINGS_AS_ERRORS=''
2466 MOZ_OPTIMIZE_FLAGS="-O"
2467 MOZ_DEBUG_FLAGS="-gstabs"
2470 LIBS="$LIBS -lsocket -lstdc++"
2471 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2472 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2473 if test "$with_x" != "yes"
2475 _PLATFORM_DEFAULT_TOOLKIT="photon"
2476 TK_CFLAGS='-I/usr/include/photon'
2479 case "${target_cpu}" in
2481 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2484 case "${host_cpu}" in
2492 DLL_SUFFIX=".so.1.0"
2494 DSO_PIC_CFLAGS='-fPIC'
2495 DSO_LDOPTS='-shared -fPIC'
2496 if test "$LIBRUNPATH"; then
2497 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2502 AC_DEFINE(NO_PW_GECOS)
2503 AC_DEFINE(NO_UDSOCK)
2504 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2506 MKSHLIB_FORCE_ALL='-all'
2507 MKSHLIB_UNFORCE_ALL='-none'
2509 AS_DASH_C_FLAG='-Wc/names=as_is'
2511 DSO_LDOPTS='-shared -auto_symvec'
2513 MOZ_DEBUG_LDFLAGS='-g'
2515 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2516 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2521 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2522 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2525 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2526 AC_DEFINE(TCPV40HDRS)
2532 IMPORT_LIB_SUFFIX=lib
2536 CFLAGS="$CFLAGS -Zomf"
2537 CXXFLAGS="$CXXFLAGS -Zomf"
2539 BIN_FLAGS='-Zlinker /ST:0x100000'
2543 WARNINGS_AS_ERRORS='-Werror'
2544 MOZ_DEBUG_FLAGS="-g -fno-inline"
2545 MOZ_OPTIMIZE_FLAGS="-O2"
2546 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2547 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2548 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2550 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2551 MOZ_ENABLE_POSTSCRIPT=
2554 MOZ_USER_DIR="Mozilla"
2556 if test "$MOZTOOLS"; then
2557 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2559 AC_MSG_ERROR([MOZTOOLS is not set])
2561 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2562 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2563 LDFLAGS="$LDFLAGS -Zhigh-mem"
2564 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2565 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2568 # GCC for OS/2 currently predefines these, but we don't want them
2569 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2570 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2572 AC_CACHE_CHECK(for __declspec(dllexport),
2574 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2576 ac_os2_declspec="yes",
2577 ac_os2_declspec="no")])
2578 if test "$ac_os2_declspec" = "yes"; then
2580 MOZ_OS2_USE_DECLSPEC='1'
2585 if test "$GNU_CC"; then
2586 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2587 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2590 MOZ_DEBUG_FLAGS='-g'
2591 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2592 CFLAGS="$CFLAGS -ieee"
2593 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2594 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2597 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2598 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2599 MKSHLIB_FORCE_ALL='-all'
2600 MKSHLIB_UNFORCE_ALL='-none'
2601 dnl Might fix the libxpcom.so breakage on this platform as well....
2602 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2603 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2605 if test -z "$GNU_CXX"; then
2608 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2612 DIRENT_INO=d_stat.st_ino
2613 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2614 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2615 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2616 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2617 AC_DEFINE(STDC_HEADERS)
2618 if test "$no_x" = "yes"; then
2619 _PLATFORM_DEFAULT_TOOLKIT='photon'
2620 TK_CFLAGS='-I/usr/nto/include/photon'
2621 TK_LIBS='-lphoton -lphrender'
2626 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2627 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2628 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2629 if test ! "$GNU_CC"; then
2636 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2638 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2639 # libraries one level up (e.g. libnspr4.so)
2640 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2642 if test "$SOLARIS_SUNPRO_CC"; then
2643 LIBS="-lCrun -lCstd $LIBS"
2646 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2647 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2648 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
2649 LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2650 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2651 _SAVE_LDFLAGS=$LDFLAGS
2652 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2653 AC_TRY_LINK([#include <stdio.h>],
2654 [printf("Hello World\n");],
2656 [LDFLAGS=$_SAVE_LDFLAGS])
2658 WARNINGS_AS_ERRORS='-Werror'
2659 MOZ_OPTIMIZE_FLAGS="-xO4"
2660 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2661 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2662 MKSHLIB_FORCE_ALL='-z allextract'
2663 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2664 DSO_LDOPTS='-G -z muldefs'
2670 AS='/usr/ccs/bin/as'
2671 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2673 TARGET_COMPILER_ABI="sunc"
2674 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2675 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2676 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2680 [#if (__SUNPRO_CC < 0x590)
2683 _BAD_COMPILER=,_BAD_COMPILER=1)
2684 if test -n "$_BAD_COMPILER"; then
2686 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2690 AC_MSG_RESULT([$_res])
2693 ASFLAGS="$ASFLAGS -fPIC"
2696 _WARNINGS_CXXFLAGS=''
2697 if test "$OS_RELEASE" = "5.3"; then
2698 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2701 if test "$OS_RELEASE" = "5.5.1"; then
2702 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2707 DSO_LDOPTS='-Bdynamic'
2708 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2709 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2711 AC_DEFINE(SPRINTF_RETURNS_STRING)
2712 case "$(target_os)" in
2714 DLL_SUFFIX='.so.1.0'
2720 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2724 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2729 dnl Only one oddball right now (QNX), but this gives us flexibility
2730 dnl if any other platforms need to override this in the future.
2731 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2733 dnl ========================================================
2734 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2735 dnl by now will not have any way to link most binaries (tests
2736 dnl as well as viewer, apprunner, etc.), because some symbols
2737 dnl will be left out of the "composite" .so's by ld as unneeded.
2738 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2739 dnl they can link in the static libs that provide the missing
2741 dnl ========================================================
2742 NO_LD_ARCHIVE_FLAGS=
2743 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2744 NO_LD_ARCHIVE_FLAGS=1
2748 NO_LD_ARCHIVE_FLAGS=
2751 NO_LD_ARCHIVE_FLAGS=
2754 NO_LD_ARCHIVE_FLAGS=
2756 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2757 if test -z "$GNU_CC"; then
2758 NO_LD_ARCHIVE_FLAGS=
2762 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2764 dnl ========================================================
2765 dnl = Flags to strip unused symbols from .so components
2766 dnl ========================================================
2768 *-linux*|*-kfreebsd*-gnu)
2769 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2772 if test -z "$GNU_CC"; then
2773 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2775 if test -z "$GCC_USE_GNU_LD"; then
2776 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2778 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2783 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2786 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2788 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2789 if test -n "$GNU_CC"; then
2790 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2795 if test -z "$COMPILE_ENVIRONMENT"; then
2796 SKIP_COMPILER_CHECKS=1
2797 SKIP_LIBRARY_CHECKS=1
2800 if test -z "$SKIP_COMPILER_CHECKS"; then
2801 dnl Checks for typedefs, structures, and compiler characteristics.
2802 dnl ========================================================
2810 AC_MSG_CHECKING(for ssize_t)
2811 AC_CACHE_VAL(ac_cv_type_ssize_t,
2812 [AC_TRY_COMPILE([#include <stdio.h>
2813 #include <sys/types.h>],
2815 [ac_cv_type_ssize_t=true],
2816 [ac_cv_type_ssize_t=false])])
2817 if test "$ac_cv_type_ssize_t" = true ; then
2818 AC_DEFINE(HAVE_SSIZE_T)
2823 AC_STRUCT_ST_BLKSIZE
2824 AC_MSG_CHECKING(for siginfo_t)
2825 AC_CACHE_VAL(ac_cv_siginfo_t,
2826 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2827 #include <signal.h>],
2829 [ac_cv_siginfo_t=true],
2830 [ac_cv_siginfo_t=false])])
2831 if test "$ac_cv_siginfo_t" = true ; then
2832 AC_DEFINE(HAVE_SIGINFO_T)
2838 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2839 dnl ========================================================
2840 AC_MSG_CHECKING(for int16_t)
2841 AC_CACHE_VAL(ac_cv_int16_t,
2842 [AC_TRY_COMPILE([#include <stdio.h>
2843 #include <sys/types.h>],
2845 [ac_cv_int16_t=true],
2846 [ac_cv_int16_t=false])])
2847 if test "$ac_cv_int16_t" = true ; then
2848 AC_DEFINE(HAVE_INT16_T)
2853 AC_MSG_CHECKING(for int32_t)
2854 AC_CACHE_VAL(ac_cv_int32_t,
2855 [AC_TRY_COMPILE([#include <stdio.h>
2856 #include <sys/types.h>],
2858 [ac_cv_int32_t=true],
2859 [ac_cv_int32_t=false])])
2860 if test "$ac_cv_int32_t" = true ; then
2861 AC_DEFINE(HAVE_INT32_T)
2866 AC_MSG_CHECKING(for int64_t)
2867 AC_CACHE_VAL(ac_cv_int64_t,
2868 [AC_TRY_COMPILE([#include <stdio.h>
2869 #include <sys/types.h>],
2871 [ac_cv_int64_t=true],
2872 [ac_cv_int64_t=false])])
2873 if test "$ac_cv_int64_t" = true ; then
2874 AC_DEFINE(HAVE_INT64_T)
2879 AC_MSG_CHECKING(for int64)
2880 AC_CACHE_VAL(ac_cv_int64,
2881 [AC_TRY_COMPILE([#include <stdio.h>
2882 #include <sys/types.h>],
2885 [ac_cv_int64=false])])
2886 if test "$ac_cv_int64" = true ; then
2887 AC_DEFINE(HAVE_INT64)
2892 AC_MSG_CHECKING(for uint)
2893 AC_CACHE_VAL(ac_cv_uint,
2894 [AC_TRY_COMPILE([#include <stdio.h>
2895 #include <sys/types.h>],
2898 [ac_cv_uint=false])])
2899 if test "$ac_cv_uint" = true ; then
2900 AC_DEFINE(HAVE_UINT)
2905 AC_MSG_CHECKING(for uint_t)
2906 AC_CACHE_VAL(ac_cv_uint_t,
2907 [AC_TRY_COMPILE([#include <stdio.h>
2908 #include <sys/types.h>],
2910 [ac_cv_uint_t=true],
2911 [ac_cv_uint_t=false])])
2912 if test "$ac_cv_uint_t" = true ; then
2913 AC_DEFINE(HAVE_UINT_T)
2918 AC_MSG_CHECKING(for uint16_t)
2919 AC_CACHE_VAL(ac_cv_uint16_t,
2920 [AC_TRY_COMPILE([#include <stdio.h>
2921 #include <sys/types.h>],
2922 [uint16_t foo = 0;],
2923 [ac_cv_uint16_t=true],
2924 [ac_cv_uint16_t=false])])
2925 if test "$ac_cv_uint16_t" = true ; then
2926 AC_DEFINE(HAVE_UINT16_T)
2932 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2933 dnl are defined when compiling C++ but not C. Since the result of this
2934 dnl test is used only in C++, do it in C++.
2937 AC_MSG_CHECKING(for uname.domainname)
2938 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2939 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2940 [ struct utsname *res; char *domain;
2941 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2942 [ac_cv_have_uname_domainname_field=true],
2943 [ac_cv_have_uname_domainname_field=false])])
2945 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2946 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2952 AC_MSG_CHECKING(for uname.__domainname)
2953 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2954 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2955 [ struct utsname *res; char *domain;
2956 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2957 [ac_cv_have_uname_us_domainname_field=true],
2958 [ac_cv_have_uname_us_domainname_field=false])])
2960 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2961 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2969 dnl Check for usable char16_t (2 bytes, unsigned)
2970 dnl (we might not need the unsignedness check anymore)
2971 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2972 ac_cv_have_usable_char16_t,
2973 [AC_TRY_COMPILE([$configure_static_assert_macros],
2974 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2975 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2976 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2977 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2978 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2979 ac_cv_have_usable_char16_t="yes",
2980 ac_cv_have_usable_char16_t="no")])
2981 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2982 AC_DEFINE(HAVE_CPP_CHAR16_T)
2986 dnl Check for usable wchar_t (2 bytes, unsigned)
2987 dnl (we really don't need the unsignedness check anymore)
2988 dnl ========================================================
2990 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2991 ac_cv_have_usable_wchar_v2,
2992 [AC_TRY_COMPILE([#include <stddef.h>
2993 $configure_static_assert_macros],
2994 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2995 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2996 ac_cv_have_usable_wchar_v2="yes",
2997 ac_cv_have_usable_wchar_v2="no")])
2998 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2999 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3000 HAVE_CPP_2BYTE_WCHAR_T=1
3001 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3002 dnl This is really gcc-only
3003 dnl Do this test using CXX only since some versions of gcc
3004 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3005 dnl only have short-wchar support for c++.
3006 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3008 _SAVE_CXXFLAGS=$CXXFLAGS
3009 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3011 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3012 ac_cv_have_usable_wchar_option_v2,
3013 [AC_TRY_LINK([#include <stddef.h>
3014 $configure_static_assert_macros],
3015 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3016 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3017 ac_cv_have_usable_wchar_option_v2="yes",
3018 ac_cv_have_usable_wchar_option_v2="no")])
3020 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3021 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3022 HAVE_CPP_2BYTE_WCHAR_T=1
3023 WCHAR_CFLAGS="-fshort-wchar"
3025 CXXFLAGS=$_SAVE_CXXFLAGS
3031 dnl Check for .hidden assembler directive and visibility attribute.
3032 dnl Borrowed from glibc configure.in
3033 dnl ===============================================================
3034 if test "$GNU_CC"; then
3035 AC_CACHE_CHECK(for visibility(hidden) attribute,
3036 ac_cv_visibility_hidden,
3037 [cat > conftest.c <<EOF
3038 int foo __attribute__ ((visibility ("hidden"))) = 1;
3040 ac_cv_visibility_hidden=no
3041 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3042 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3043 ac_cv_visibility_hidden=yes
3048 if test "$ac_cv_visibility_hidden" = "yes"; then
3049 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3051 AC_CACHE_CHECK(for visibility(default) attribute,
3052 ac_cv_visibility_default,
3053 [cat > conftest.c <<EOF
3054 int foo __attribute__ ((visibility ("default"))) = 1;
3056 ac_cv_visibility_default=no
3057 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3058 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3059 ac_cv_visibility_default=yes
3064 if test "$ac_cv_visibility_default" = "yes"; then
3065 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3067 AC_CACHE_CHECK(for visibility pragma support,
3068 ac_cv_visibility_pragma,
3069 [cat > conftest.c <<EOF
3070 #pragma GCC visibility push(hidden)
3072 #pragma GCC visibility push(default)
3073 int foo_default = 1;
3075 ac_cv_visibility_pragma=no
3076 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3077 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3078 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3079 ac_cv_visibility_pragma=yes
3085 if test "$ac_cv_visibility_pragma" = "yes"; then
3086 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3087 ac_cv_have_visibility_class_bug,
3088 [cat > conftest.c <<EOF
3089 #pragma GCC visibility push(hidden)
3090 struct __attribute__ ((visibility ("default"))) TestStruct {
3093 __attribute__ ((visibility ("default"))) void TestFunc() {
3097 ac_cv_have_visibility_class_bug=no
3098 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3099 ac_cv_have_visibility_class_bug=yes
3101 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3102 ac_cv_have_visibility_class_bug=yes
3105 rm -rf conftest.{c,S}
3108 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3109 ac_cv_have_visibility_builtin_bug,
3110 [cat > conftest.c <<EOF
3111 #pragma GCC visibility push(hidden)
3112 #pragma GCC visibility push(default)
3114 #pragma GCC visibility pop
3116 __attribute__ ((visibility ("default"))) void Func() {
3118 memset(c, 0, sizeof(c));
3121 ac_cv_have_visibility_builtin_bug=no
3122 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3123 ac_cv_have_visibility_builtin_bug=yes
3125 if test `grep -c "@PLT" conftest.S` = 0; then
3126 ac_cv_visibility_builtin_bug=yes
3129 rm -f conftest.{c,S}
3131 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3132 "$ac_cv_have_visibility_class_bug" = "no"; then
3133 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3134 WRAP_SYSTEM_INCLUDES=1
3135 STL_FLAGS='-I$(DIST)/stl_wrappers'
3138 VISIBILITY_FLAGS='-fvisibility=hidden'
3139 fi # have visibility pragma bug
3140 fi # have visibility pragma
3141 fi # have visibility(default) attribute
3142 fi # have visibility(hidden) attribute
3145 # visibility hidden flag for Sun Studio on Solaris
3146 if test "$SOLARIS_SUNPRO_CC"; then
3147 VISIBILITY_FLAGS='-xldscope=hidden'
3148 fi # Sun Studio on Solaris
3150 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3151 AC_SUBST(VISIBILITY_FLAGS)
3153 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3154 dnl ========================================================
3155 if test "$GNU_CC"; then
3156 CFLAGS_save="${CFLAGS}"
3157 CFLAGS="${CFLAGS} -Werror"
3158 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3159 ac_cv_force_align_arg_pointer,
3160 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3162 ac_cv_force_align_arg_pointer="yes",
3163 ac_cv_force_align_arg_pointer="no")])
3164 CFLAGS="${CFLAGS_save}"
3165 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3166 HAVE_GCC_ALIGN_ARG_POINTER=1
3168 HAVE_GCC_ALIGN_ARG_POINTER=
3171 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3173 dnl Checks for header files.
3174 dnl ========================================================
3176 case "$target_os" in
3178 # for stuff like -lXshm
3179 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3182 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3183 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3184 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3185 AC_CHECK_HEADERS(malloc.h)
3186 AC_CHECK_HEADERS(X11/XKBlib.h)
3187 AC_CHECK_HEADERS(io.h)
3189 dnl These are all the places some variant of statfs can be hiding.
3190 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3193 AC_CHECK_HEADERS(sys/quota.h)
3195 dnl Try for MMX support
3196 dnl NB - later gcc versions require -mmmx for this header to be successfully
3197 dnl included (or another option which implies it, such as -march=pentium-mmx)
3198 AC_CHECK_HEADERS(mmintrin.h)
3200 dnl Check whether the compiler supports the new-style C++ standard
3201 dnl library headers (i.e. <new>) or needs the old "new.h"
3204 AC_CHECK_HEADER(new, [NEW_H=new])
3205 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3208 AC_ARG_ENABLE(dtrace,
3209 [ --enable-dtrace build with dtrace support if available (default=no)],
3210 [enable_dtrace="yes"],)
3211 if test "x$enable_dtrace" = "xyes"; then
3212 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3213 if test -n "$HAVE_DTRACE"; then
3214 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3216 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3219 AC_SUBST(HAVE_DTRACE)
3225 AC_CHECK_HEADERS(sys/cdefs.h)
3229 dnl Checks for libraries.
3230 dnl ========================================================
3235 AC_CHECK_LIB(c_r, gethostbyname_r)
3239 dnl We don't want to link with libdl even if it's present on OS X, since
3240 dnl it's not used and not part of the default installation.
3241 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3242 dnl We don't want to link against libm or libpthread on Darwin since
3243 dnl they both are just symlinks to libSystem and explicitly linking
3244 dnl against libSystem causes issues when debugging (see bug 299601).
3253 AC_CHECK_LIB(m, atan)
3254 AC_CHECK_LIB(dl, dlopen,
3255 AC_CHECK_HEADER(dlfcn.h,
3257 AC_DEFINE(HAVE_LIBDL)))
3261 _SAVE_CFLAGS="$CFLAGS"
3262 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3263 AC_CHECK_FUNCS(dladdr)
3264 CFLAGS="$_SAVE_CFLAGS"
3266 if test ! "$GNU_CXX"; then
3270 AC_CHECK_LIB(C_r, demangle)
3273 AC_CHECK_LIB(C, demangle)
3278 dnl OS/2 has socket in libc.
3283 AC_CHECK_LIB(socket, socket)
3286 dnl ========================================================
3287 dnl Check whether we can compile code for Core Text
3288 dnl (available on Mac OS X 10.5 or later)
3289 dnl ========================================================
3292 AC_MSG_CHECKING([for Core Text])
3293 AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3294 [CTLineRef lineRef;],
3295 ac_cv_have_core_text="yes",
3296 ac_cv_have_core_text="no")
3297 AC_MSG_RESULT([$ac_cv_have_core_text])
3299 if test "$ac_cv_have_core_text" = "no"; then
3300 AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3306 XLIBS="$X_EXTRA_LIBS"
3308 dnl ========================================================
3309 dnl Checks for X libraries.
3310 dnl Ordering is important.
3311 dnl Xt is dependent upon SM as of X11R6
3312 dnl ========================================================
3313 if test "$no_x" = "yes"; then
3316 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3317 XLIBS="-lX11 $XLIBS"
3318 _SAVE_LDFLAGS="$LDFLAGS"
3319 LDFLAGS="$XLDFLAGS $LDFLAGS"
3320 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3321 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3322 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3323 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3325 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3326 unset ac_cv_lib_Xt_XtFree
3327 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3328 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3329 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3330 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3333 # AIX needs the motif library linked before libXt to prevent
3334 # crashes in plugins linked against Motif - Bug #98892
3335 case "${target_os}" in
3337 XT_LIBS="-lXm $XT_LIBS"
3341 dnl ========================================================
3342 dnl = Check for XShm
3343 dnl ========================================================
3344 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3346 AC_CHECK_HEADER(X11/extensions/XShm.h)
3347 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3348 test -n "$_HAVE_XSHM_XEXT"; then
3349 AC_DEFINE(HAVE_XSHM)
3352 dnl ========================================================
3354 dnl ========================================================
3355 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3357 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3359 if test "$MOZ_XIE_LIBS"; then
3360 dnl ====================================================
3361 dnl = If XIE is present and is desired, turn it on
3362 dnl ====================================================
3372 LDFLAGS="$_SAVE_LDFLAGS"
3374 dnl ========================================================
3375 dnl = Check for freetype2 and its functionality
3376 dnl ========================================================
3377 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3379 if test "$_HAVE_FREETYPE2"; then
3381 _SAVE_CFLAGS="$CFLAGS"
3382 LIBS="$LIBS $FT2_LIBS"
3383 CFLAGS="$CFLAGS $FT2_CFLAGS"
3385 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3386 ac_cv_member_FT_Bitmap_Size_y_ppem,
3387 [AC_TRY_COMPILE([#include <ft2build.h>
3388 #include FT_FREETYPE_H],
3390 if (sizeof s.y_ppem) return 0;
3392 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3393 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3394 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3395 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3397 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3399 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3400 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3401 [FT_Bitmap_Size structure includes y_ppem field])
3403 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3406 CFLAGS="$_SAVE_CFLAGS"
3417 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3419 [asm("uqadd8 r1, r1, r2");],
3420 result="yes", result="no")
3421 AC_MSG_RESULT("$result")
3422 if test "$result" = "yes"; then
3423 AC_DEFINE(HAVE_ARM_SIMD)
3426 AC_SUBST(HAVE_ARM_SIMD)
3428 AC_MSG_CHECKING(for ARM NEON support in compiler)
3429 _SAVE_CFLAGS="$CFLAGS"
3430 if test "$GNU_CC"; then
3431 # gcc needs -mfpu=neon to recognize NEON instructions
3432 CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3435 [asm("vadd.i8 d0, d0, d0");],
3436 result="yes", result="no")
3437 AC_MSG_RESULT("$result")
3438 if test "$result" = "yes"; then
3439 AC_DEFINE(HAVE_ARM_NEON)
3442 CFLAGS="$_SAVE_CFLAGS"
3443 AC_SUBST(HAVE_ARM_NEON)
3445 dnl ========================================================
3446 dnl = pthread support
3447 dnl = Start by checking whether the system support pthreads
3448 dnl ========================================================
3449 case "$target_os" in
3454 MOZ_CHECK_PTHREADS(pthreads,
3455 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3456 MOZ_CHECK_PTHREADS(pthread,
3457 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3458 MOZ_CHECK_PTHREADS(c_r,
3459 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3460 MOZ_CHECK_PTHREADS(c,
3469 dnl ========================================================
3470 dnl Check the command line for --with-pthreads
3471 dnl ========================================================
3472 MOZ_ARG_WITH_BOOL(pthreads,
3473 [ --with-pthreads Force use of system pthread library with NSPR ],
3474 [ if test "$USE_PTHREADS"x = x; then
3475 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3481 dnl ========================================================
3482 dnl Do the platform specific pthread hackery
3483 dnl ========================================================
3484 if test "$USE_PTHREADS"x != x
3487 dnl See if -pthread is supported.
3490 ac_cv_have_dash_pthread=no
3491 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3492 echo 'int main() { return 0; }' | cat > conftest.c
3493 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3494 if test $? -eq 0; then
3495 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3496 ac_cv_have_dash_pthread=yes
3497 case "$target_os" in
3499 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3502 CFLAGS="$CFLAGS -pthread"
3503 CXXFLAGS="$CXXFLAGS -pthread"
3509 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3512 dnl See if -pthreads is supported.
3514 ac_cv_have_dash_pthreads=no
3515 if test "$ac_cv_have_dash_pthread" = "no"; then
3516 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3517 echo 'int main() { return 0; }' | cat > conftest.c
3518 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3519 if test $? -eq 0; then
3520 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3521 ac_cv_have_dash_pthreads=yes
3522 CFLAGS="$CFLAGS -pthreads"
3523 CXXFLAGS="$CXXFLAGS -pthreads"
3527 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3532 AC_DEFINE(_REENTRANT)
3533 AC_DEFINE(_THREAD_SAFE)
3534 dnl -pthread links in -lc_r, so don't specify it explicitly.
3535 if test "$ac_cv_have_dash_pthread" = "yes"; then
3536 _PTHREAD_LDFLAGS="-pthread"
3538 _PTHREAD_LDFLAGS="-lc_r"
3542 *-*-openbsd*|*-*-bsdi*)
3543 AC_DEFINE(_REENTRANT)
3544 AC_DEFINE(_THREAD_SAFE)
3545 dnl -pthread links in -lc_r, so don't specify it explicitly.
3546 if test "$ac_cv_have_dash_pthread" = "yes"; then
3547 _PTHREAD_LDFLAGS="-pthread"
3551 *-*-linux*|*-*-kfreebsd*-gnu)
3552 AC_DEFINE(_REENTRANT)
3556 AC_DEFINE(_REENTRANT)
3560 AC_DEFINE(_REENTRANT)
3564 AC_DEFINE(_REENTRANT)
3568 AC_DEFINE(_REENTRANT)
3572 AC_DEFINE(_REENTRANT)
3573 if test "$SOLARIS_SUNPRO_CC"; then
3574 CFLAGS="$CFLAGS -mt"
3575 CXXFLAGS="$CXXFLAGS -mt"
3579 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3582 dnl ========================================================
3583 dnl See if mmap sees writes
3584 dnl For cross compiling, just define it as no, which is a safe default
3585 dnl ========================================================
3586 AC_MSG_CHECKING(whether mmap() sees write()s)
3592 #include <sys/mman.h>
3593 #include <sys/types.h>
3594 #include <sys/stat.h>
3597 char fname[] = "conftest.file";
3598 char zbuff[1024]; /* Fractional page is probably worst case */
3605 fd = open(fname, O_RDWR | O_CREAT, 0660);
3608 write(fd, zbuff, sizeof(zbuff));
3609 lseek(fd, 0, SEEK_SET);
3610 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3611 if(map==(char*)-1) return 2;
3612 for(i=0; fname[i]; i++) {
3613 int rc = write(fd, &fname[i], 1);
3614 if(map[i]!=fname[i]) return 4;
3621 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3623 AC_MSG_RESULT("$result")
3625 if test "$result" = "no"; then
3626 AC_DEFINE(MMAP_MISSES_WRITES)
3630 dnl Checks for library functions.
3631 dnl ========================================================
3632 AC_PROG_GCC_TRADITIONAL
3634 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3635 AC_CHECK_FUNCS(flockfile getpagesize)
3636 AC_CHECK_FUNCS(localtime_r strtok_r)
3638 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3639 _SAVE_LDFLAGS=$LDFLAGS
3640 LDFLAGS="$LDFLAGS -lrt"
3641 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3642 ac_cv_have_clock_monotonic,
3643 [AC_TRY_LINK([#include <time.h>],
3644 [ struct timespec ts;
3645 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3646 ac_cv_have_clock_monotonic=yes,
3647 ac_cv_have_clock_monotonic=no)])
3648 LDFLAGS=$_SAVE_LDFLAGS
3649 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3650 HAVE_CLOCK_MONOTONIC=1
3652 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3653 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3654 AC_SUBST(REALTIME_LIBS)
3657 dnl check for wcrtomb/mbrtowc
3658 dnl =======================================================================
3659 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3662 AC_CACHE_CHECK(for wcrtomb,
3664 [AC_TRY_LINK([#include <wchar.h>],
3665 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3666 ac_cv_have_wcrtomb="yes",
3667 ac_cv_have_wcrtomb="no")])
3668 if test "$ac_cv_have_wcrtomb" = "yes"; then
3669 AC_DEFINE(HAVE_WCRTOMB)
3671 AC_CACHE_CHECK(for mbrtowc,
3673 [AC_TRY_LINK([#include <wchar.h>],
3674 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3675 ac_cv_have_mbrtowc="yes",
3676 ac_cv_have_mbrtowc="no")])
3677 if test "$ac_cv_have_mbrtowc" = "yes"; then
3678 AC_DEFINE(HAVE_MBRTOWC)
3685 ac_cv_func_res_ninit,
3688 #define _BSD_SOURCE 1
3692 [int foo = res_ninit(&_res);],
3693 [ac_cv_func_res_ninit=yes],
3694 [ac_cv_func_res_ninit=no])
3697 if test "$ac_cv_func_res_ninit" = "yes"; then
3698 AC_DEFINE(HAVE_RES_NINIT)
3699 dnl must add the link line we do something as foolish as this... dougt
3701 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3702 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3707 [for gnu_get_libc_version()],
3708 ac_cv_func_gnu_get_libc_version,
3710 #ifdef HAVE_GNU_LIBC_VERSION_H
3711 #include <gnu/libc-version.h>
3714 [const char *glibc_version = gnu_get_libc_version();],
3715 [ac_cv_func_gnu_get_libc_version=yes],
3716 [ac_cv_func_gnu_get_libc_version=no]
3720 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3721 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3725 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3729 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3730 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3731 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3733 LIBS="$LIBS $_ICONV_LIBS"
3742 iconv_t h = iconv_open("", "");
3743 iconv(h, NULL, NULL, NULL, NULL);
3746 [ac_cv_func_iconv=yes],
3747 [ac_cv_func_iconv=no]
3750 if test "$ac_cv_func_iconv" = "yes"; then
3751 AC_DEFINE(HAVE_ICONV)
3752 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3753 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3754 LIBICONV="$_ICONV_LIBS"
3756 [for iconv() with const input],
3757 ac_cv_func_const_iconv,
3763 const char *input = "testing";
3764 iconv_t h = iconv_open("", "");
3765 iconv(h, &input, NULL, NULL, NULL);
3768 [ac_cv_func_const_iconv=yes],
3769 [ac_cv_func_const_iconv=no]
3772 if test "$ac_cv_func_const_iconv" = "yes"; then
3773 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3785 dnl **********************
3786 dnl *** va_copy checks ***
3787 dnl **********************
3788 dnl we currently check for all three va_copy possibilities, so we get
3789 dnl all results in config.log for bug reports.
3790 AC_MSG_CHECKING(for an implementation of va_copy())
3791 AC_CACHE_VAL(ac_cv_va_copy,[
3794 void f (int i, ...) {
3795 va_list args1, args2;
3796 va_start (args1, i);
3797 va_copy (args2, args1);
3798 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3800 va_end (args1); va_end (args2);
3802 int main() { f (0, 42); return 0; }],
3808 AC_MSG_RESULT($ac_cv_va_copy)
3809 AC_MSG_CHECKING(for an implementation of __va_copy())
3810 AC_CACHE_VAL(ac_cv___va_copy,[
3813 void f (int i, ...) {
3814 va_list args1, args2;
3815 va_start (args1, i);
3816 __va_copy (args2, args1);
3817 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3819 va_end (args1); va_end (args2);
3821 int main() { f (0, 42); return 0; }],
3822 ac_cv___va_copy=yes,
3827 AC_MSG_RESULT($ac_cv___va_copy)
3828 AC_MSG_CHECKING(whether va_lists can be copied by value)
3829 AC_CACHE_VAL(ac_cv_va_val_copy,[
3832 void f (int i, ...) {
3833 va_list args1, args2;
3834 va_start (args1, i);
3836 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3838 va_end (args1); va_end (args2);
3840 int main() { f (0, 42); return 0; }],
3841 ac_cv_va_val_copy=yes,
3842 ac_cv_va_val_copy=no,
3843 ac_cv_va_val_copy=yes
3846 if test "x$ac_cv_va_copy" = "xyes"; then
3847 AC_DEFINE(VA_COPY, va_copy)
3848 AC_DEFINE(HAVE_VA_COPY)
3849 elif test "x$ac_cv___va_copy" = "xyes"; then
3850 AC_DEFINE(VA_COPY, __va_copy)
3851 AC_DEFINE(HAVE_VA_COPY)
3854 if test "x$ac_cv_va_val_copy" = "xno"; then
3855 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3857 AC_MSG_RESULT($ac_cv_va_val_copy)
3859 dnl Check for dll-challenged libc's.
3860 dnl This check is apparently only needed for Linux.
3863 dnl ===================================================================
3866 rm -rf conftest* _conftest
3868 cat >> conftest.C <<\EOF
3873 void __dump_link_map(void) {
3874 struct link_map *map = _dl_loaded;
3875 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3878 dlopen("./conftest1.so",RTLD_LAZY);
3879 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3880 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3881 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3885 /* _dl_loaded isn't defined, so this should be either a libc5 (glibc1) system, or a glibc2 system that doesn't have the multiple load bug (i.e., RH6.0).*/
3886 int main() { printf("./conftest1.so\n"); }
3890 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3892 cat >> conftest1.C <<\EOF
3894 void foo(void) {printf("foo in dll called\n");}
3896 ${CXX-g++} -fPIC -c -g conftest1.C
3897 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3898 ${CXX-g++} -g conftest.C -o conftest -ldl
3899 cp -f conftest1.so conftest _conftest
3901 if test `./conftest | grep conftest1.so | wc -l` -gt 1
3904 echo "*** Your libc has a bug that can result in loading the same dynamic"
3905 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
3906 echo "*** or later. However, if you choose not to upgrade, the only effect"
3907 echo "*** will be excessive memory usage at runtime."
3911 rm -rf conftest* _conftest
3912 dnl ===================================================================
3916 dnl ===================================================================
3917 dnl ========================================================
3918 dnl By default, turn rtti and exceptions off on g++/egcs
3919 dnl ========================================================
3920 if test "$GNU_CXX"; then
3922 AC_MSG_CHECKING(for C++ exceptions flag)
3924 dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3925 AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3926 [echo "int main() { return 0; }" | cat > conftest.C
3928 ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3930 if egrep "warning.*renamed" conftest.out >/dev/null; then
3931 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3933 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3938 AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3939 _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3940 _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3943 dnl ========================================================
3944 dnl Put your C++ language/feature checks below
3945 dnl ========================================================
3949 if test "$GNU_CC"; then
3950 AC_CACHE_CHECK(for gcc 3.0 ABI,
3951 ac_cv_gcc_three_abi,
3954 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3960 ac_cv_gcc_three_abi="yes",
3961 ac_cv_gcc_three_abi="no")])
3962 if test "$ac_cv_gcc_three_abi" = "yes"; then
3963 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3966 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3969 AC_SUBST(HAVE_GCC3_ABI)
3972 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3974 [AC_TRY_COMPILE(class X {
3975 public: explicit X(int i) : i_(i) {}
3979 ac_cv_cpp_explicit=yes,
3980 ac_cv_cpp_explicit=no)])
3981 if test "$ac_cv_cpp_explicit" = yes ; then
3982 AC_DEFINE(HAVE_CPP_EXPLICIT)
3985 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3987 [AC_TRY_COMPILE(class param {
3989 typedef unsigned long num_type;
3992 template <class T> class tplt {
3994 typedef typename T::num_type t_num_type;
3995 t_num_type foo(typename T::num_type num) {
4001 ac_cv_cpp_typename=yes,
4002 ac_cv_cpp_typename=no)])
4003 if test "$ac_cv_cpp_typename" = yes ; then
4004 AC_DEFINE(HAVE_CPP_TYPENAME)
4007 dnl Check for support of modern template specialization syntax
4008 dnl Test code and requirement from scc@netscape.com.
4009 dnl Autoconf cut-and-paste job by waterson@netscape.com
4010 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4011 ac_cv_cpp_modern_specialize_template_syntax,
4012 [AC_TRY_COMPILE(template <class T> struct X { int a; };
4014 template <> struct X<Y> { double a; };,
4017 ac_cv_cpp_modern_specialize_template_syntax=yes,
4018 ac_cv_cpp_modern_specialize_template_syntax=no)])
4019 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4020 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4024 dnl Some compilers support only full specialization, and some don't.
4025 AC_CACHE_CHECK(whether partial template specialization works,
4026 ac_cv_cpp_partial_specialization,
4027 [AC_TRY_COMPILE(template <class T> class Foo {};
4028 template <class T> class Foo<T*> {};,
4030 ac_cv_cpp_partial_specialization=yes,
4031 ac_cv_cpp_partial_specialization=no)])
4032 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4033 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4036 dnl Some compilers have limited support for operators with templates;
4037 dnl specifically, it is necessary to define derived operators when a base
4038 dnl class's operator declaration should suffice.
4039 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4040 ac_cv_need_derived_template_operators,
4041 [AC_TRY_COMPILE([template <class T> class Base { };
4043 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4044 template <class T> class Derived : public Base<T> { };],
4045 [Derived<char> a, b;
4046 Base<char> c = a + b;
4048 ac_cv_need_derived_template_operators=no,
4049 ac_cv_need_derived_template_operators=yes)])
4050 if test "$ac_cv_need_derived_template_operators" = yes ; then
4051 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4055 dnl Some compilers have trouble detecting that a template class
4056 dnl that derives from another template is actually an instance
4057 dnl of the base class. This test checks for that.
4058 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4059 ac_cv_need_cpp_template_cast_to_base,
4060 [AC_TRY_COMPILE([template <class T> class Base { };
4061 template <class T> class Derived : public Base<T> { };
4062 template <class T> int foo(const Base<T>&) { return 0; }],
4063 [Derived<char> bar; return foo(bar);],
4064 ac_cv_need_cpp_template_cast_to_base=no,
4065 ac_cv_need_cpp_template_cast_to_base=yes)])
4066 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4067 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4070 dnl Some compilers have trouble resolving the ambiguity between two
4071 dnl functions whose arguments differ only by cv-qualifications.
4072 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4073 ac_cv_can_resolve_const_ambiguity,
4075 template <class T> class ptrClass {
4079 template <class T> T* a(ptrClass<T> *arg) {
4084 const T* a(const ptrClass<T> *arg) {
4090 ac_cv_can_resolve_const_ambiguity=yes,
4091 ac_cv_can_resolve_const_ambiguity=no)])
4092 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4093 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4097 dnl We don't do exceptions on unix. The only reason this used to be here
4098 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4099 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4100 dnl So im commenting this out until someone writes some artificial
4101 dnl intelligence to detect not only if the compiler has exceptions, but if
4102 dnl they are enabled as well.
4104 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4105 dnl ac_cv_cpp_exceptions,
4106 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4107 dnl static void F() { throw X(); },
4108 dnl try { F(); } catch(X & e) { },
4109 dnl ac_cv_cpp_exceptions=yes,
4110 dnl ac_cv_cpp_exceptions=no)])
4111 dnl if test $ac_cv_cpp_exceptions = yes ; then
4112 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4115 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4116 dnl supports it well enough to allow us to use it to change access, but not
4117 dnl to resolve ambiguity. The next two tests determine how well the |using|
4118 dnl keyword is supported.
4120 dnl Check to see if we can change access with |using|. Test both a
4121 dnl legal and an illegal example.
4122 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4123 ac_cv_cpp_access_changing_using2,
4125 class A { protected: int foo() { return 0; } };
4126 class B : public A { public: using A::foo; };,
4127 B b; return b.foo();,
4129 class A { public: int foo() { return 1; } };
4130 class B : public A { private: using A::foo; };,
4131 B b; return b.foo();,
4132 ac_cv_cpp_access_changing_using2=no,
4133 ac_cv_cpp_access_changing_using2=yes)],
4134 ac_cv_cpp_access_changing_using2=no)])
4135 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4136 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4139 dnl Check to see if we can resolve ambiguity with |using|.
4140 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4141 ac_cv_cpp_ambiguity_resolving_using,
4142 [AC_TRY_COMPILE(class X {
4143 public: int go(const X&) {return 3;}
4144 int jo(const X&) {return 3;}
4146 class Y : public X {
4147 public: int go(int) {return 2;}
4148 int jo(int) {return 2;}
4150 private: using X::go;
4153 ac_cv_cpp_ambiguity_resolving_using=yes,
4154 ac_cv_cpp_ambiguity_resolving_using=no)])
4155 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4156 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4159 dnl Check to see if the |std| namespace is supported. If so, we'll want
4160 dnl to qualify any standard library calls with "std::" to ensure that
4161 dnl those functions can be resolved.
4162 AC_CACHE_CHECK(for \"std::\" namespace,
4163 ac_cv_cpp_namespace_std,
4164 [AC_TRY_COMPILE([#include <algorithm>],
4165 [return std::min(0, 1);],
4166 ac_cv_cpp_namespace_std=yes,
4167 ac_cv_cpp_namespace_std=no)])
4168 if test "$ac_cv_cpp_namespace_std" = yes ; then
4169 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4172 dnl Older compilers are overly ambitious with respect to using the standard
4173 dnl template library's |operator!=()| when |operator==()| is defined. In
4174 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4175 dnl ambiguity at compile-time. This test checks for that case.
4176 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4177 ac_cv_cpp_unambiguous_std_notequal,
4178 [AC_TRY_COMPILE([#include <algorithm>
4180 int operator==(const T1&, const T1&) { return 0; }
4181 int operator!=(const T1&, const T1&) { return 0; }],
4182 [T1 a,b; return a != b;],
4183 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4184 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4185 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4186 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4190 AC_CACHE_CHECK(for C++ reinterpret_cast,
4191 ac_cv_cpp_reinterpret_cast,
4192 [AC_TRY_COMPILE(struct X { int i; };
4193 struct Y { int i; };,
4194 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4195 ac_cv_cpp_reinterpret_cast=yes,
4196 ac_cv_cpp_reinterpret_cast=no)])
4197 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4198 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4201 dnl See if a dynamic_cast to void* gives the most derived object.
4202 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4203 ac_cv_cpp_dynamic_cast_void_ptr,
4204 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4205 class Y { int j; public: virtual ~Y() { } };
4206 class Z : public X, public Y { int k; };
4212 return !((((void*)&mdo != (void*)subx) &&
4213 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4214 (((void*)&mdo != (void*)suby) &&
4215 ((void*)&mdo == dynamic_cast<void*>(suby))));
4217 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4218 ac_cv_cpp_dynamic_cast_void_ptr=no,
4219 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4220 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4221 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4225 dnl note that this one is reversed - if the test fails, then
4226 dnl we require implementations of unused virtual methods. Which
4227 dnl really blows because it means we'll have useless vtable
4229 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4230 ac_cv_cpp_unused_required,
4231 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4233 ac_cv_cpp_unused_required=no,
4234 ac_cv_cpp_unused_required=yes)])
4235 if test "$ac_cv_cpp_unused_required" = yes ; then
4236 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4240 dnl Some compilers have trouble comparing a constant reference to a templatized
4241 dnl class to zero, and require an explicit operator==() to be defined that takes
4242 dnl an int. This test separates the strong from the weak.
4244 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4245 ac_cv_trouble_comparing_to_zero,
4246 [AC_TRY_COMPILE([#include <algorithm>
4247 template <class T> class Foo {};
4249 template <class T> int operator==(const T2*, const T&) { return 0; }
4250 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4251 [Foo<int> f; return (0 != f);],
4252 ac_cv_trouble_comparing_to_zero=no,
4253 ac_cv_trouble_comparing_to_zero=yes)])
4254 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4255 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4258 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4259 _SAVE_LDFLAGS=$LDFLAGS
4260 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4261 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4262 ac_cv_thread_keyword,
4263 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4264 [return tlsIsMainThread;],
4265 ac_cv_thread_keyword=yes,
4266 ac_cv_thread_keyword=no)])
4267 LDFLAGS=$_SAVE_LDFLAGS
4268 if test "$ac_cv_thread_keyword" = yes; then
4269 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4272 dnl Check for the existence of various allocation headers/functions
4275 AC_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4276 if test "$MALLOC_H" = ""; then
4277 AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4278 if test "$MALLOC_H" = ""; then
4279 AC_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4282 if test "$MALLOC_H" != ""; then
4283 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4286 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4287 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4289 dnl See if compiler supports some gcc-style attributes
4291 AC_CACHE_CHECK(for __attribute__((always_inline)),
4292 ac_cv_attribute_always_inline,
4294 [inline void f(void) __attribute__((always_inline));],
4295 ac_cv_attribute_always_inline=yes,
4296 ac_cv_attribute_always_inline=no)])
4298 AC_CACHE_CHECK(for __attribute__((malloc)),
4299 ac_cv_attribute_malloc,
4301 [void* f(int) __attribute__((malloc));],
4302 ac_cv_attribute_malloc=yes,
4303 ac_cv_attribute_malloc=no)])
4305 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4306 ac_cv_attribute_warn_unused,
4308 [int f(void) __attribute__((warn_unused_result));],
4309 ac_cv_attribute_warn_unused=yes,
4310 ac_cv_attribute_warn_unused=no)])
4312 AC_CACHE_CHECK(for __attribute__((noreturn)),
4313 ac_cv_attribute_noreturn,
4315 [void f(void) __attribute__((noreturn));],
4316 ac_cv_attribute_noreturn=yes,
4317 ac_cv_attribute_noreturn=no)])
4319 dnl End of C++ language/feature checks
4322 dnl ========================================================
4323 dnl = Internationalization checks
4324 dnl ========================================================
4326 dnl Internationalization and Locale support is different
4327 dnl on various UNIX platforms. Checks for specific i18n
4328 dnl features go here.
4330 dnl check for LC_MESSAGES
4331 AC_CACHE_CHECK(for LC_MESSAGES,
4332 ac_cv_i18n_lc_messages,
4333 [AC_TRY_COMPILE([#include <locale.h>],
4334 [int category = LC_MESSAGES;],
4335 ac_cv_i18n_lc_messages=yes,
4336 ac_cv_i18n_lc_messages=no)])
4337 if test "$ac_cv_i18n_lc_messages" = yes; then
4338 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4341 fi # SKIP_COMPILER_CHECKS
4344 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4345 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4348 dnl Mozilla specific options
4349 dnl ========================================================
4350 dnl The macros used for command line options
4351 dnl are defined in build/autoconf/altoptions.m4.
4353 dnl If the compiler supports these attributes, define them as
4354 dnl convenience macros.
4355 if test "$ac_cv_attribute_always_inline" = yes ; then
4356 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4358 AC_DEFINE(NS_ALWAYS_INLINE,)
4361 if test "$ac_cv_attribute_malloc" = yes ; then
4362 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4364 AC_DEFINE(NS_ATTR_MALLOC,)
4367 if test "$ac_cv_attribute_warn_unused" = yes ; then
4368 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4370 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4373 if test "$ac_cv_attribute_noreturn" = yes ; then
4374 AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4376 AC_DEFINE(NS_NORETURN,)
4379 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4380 dnl features that Windows actually does support.
4382 if test -n "$SKIP_COMPILER_CHECKS"; then
4383 dnl Windows has malloc.h
4384 AC_DEFINE(MALLOC_H, [<malloc.h>])
4385 AC_DEFINE(HAVE_FORCEINLINE)
4386 fi # SKIP_COMPILER_CHECKS
4388 dnl ========================================================
4390 dnl = Check for external package dependencies
4392 dnl ========================================================
4393 MOZ_ARG_HEADER(External Packages)
4397 MOZ_ARG_WITH_STRING(libxul-sdk,
4398 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4399 LIBXUL_SDK_DIR=$withval)
4401 if test "$LIBXUL_SDK_DIR" = "yes"; then
4402 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4403 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4404 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4406 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4407 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4412 AC_SUBST(LIBXUL_SDK)
4414 if test -n "$LIBXUL_SDK"; then
4415 LIBXUL_DIST="$LIBXUL_SDK"
4417 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4419 AC_SUBST(LIBXUL_DIST)
4423 MOZ_ARG_WITH_BOOL(system-libxul,
4424 [ --with-system-libxul Use system installed libxul SDK],
4427 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4428 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4431 dnl ========================================================
4432 dnl = If NSPR was not detected in the system,
4433 dnl = use the one in the source tree (mozilla/nsprpub)
4434 dnl ========================================================
4435 MOZ_ARG_WITH_BOOL(system-nspr,
4436 [ --with-system-nspr Use system installed NSPR],
4437 _USE_SYSTEM_NSPR=1 )
4439 if test -n "$_USE_SYSTEM_NSPR"; then
4440 AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4443 if test -n "$MOZ_NATIVE_NSPR"; then
4444 _SAVE_CFLAGS=$CFLAGS
4445 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4446 AC_TRY_COMPILE([#include "prlog.h"],
4447 [#ifndef PR_STATIC_ASSERT
4448 #error PR_STATIC_ASSERT not defined
4450 [MOZ_NATIVE_NSPR=1],
4451 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4452 CFLAGS=$_SAVE_CFLAGS
4454 if test "$OS_ARCH" = "WINCE"; then
4455 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4456 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4457 elif test "$OS_ARCH" = "WINNT"; then
4458 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4459 if test -n "$GNU_CC"; then
4460 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4462 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4465 NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4466 NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4470 dnl ========================================================
4471 dnl = If NSS was not detected in the system,
4472 dnl = use the one in the source tree (mozilla/security/nss)
4473 dnl ========================================================
4475 MOZ_ARG_WITH_BOOL(system-nss,
4476 [ --with-system-nss Use system installed NSS],
4479 if test -n "$_USE_SYSTEM_NSS"; then
4480 AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4483 if test -n "$MOZ_NATIVE_NSS"; then
4484 NSS_LIBS="$NSS_LIBS -lcrmf"
4486 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4488 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4489 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4490 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4491 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4492 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4494 if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4496 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4497 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4498 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4499 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4500 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4502 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4506 if test -z "$SKIP_LIBRARY_CHECKS"; then
4507 dnl system JPEG support
4508 dnl ========================================================
4509 MOZ_ARG_WITH_STRING(system-jpeg,
4510 [ --with-system-jpeg[=PFX]
4511 Use system libjpeg [installed at prefix PFX]],
4514 _SAVE_CFLAGS=$CFLAGS
4515 _SAVE_LDFLAGS=$LDFLAGS
4517 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4518 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4519 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4521 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4524 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4527 if test "$SYSTEM_JPEG" = 1; then
4528 LIBS="$JPEG_LIBS $LIBS"
4529 AC_TRY_COMPILE([ #include <stdio.h>
4530 #include <sys/types.h>
4531 #include <jpeglib.h> ],
4532 [ #if JPEG_LIB_VERSION < $MOZJPEG
4533 #error "Insufficient JPEG library version ($MOZJPEG required)."
4536 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4538 CFLAGS=$_SAVE_CFLAGS
4539 LDFLAGS=$_SAVE_LDFLAGS
4542 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4543 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4544 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4547 dnl system ZLIB support
4548 dnl ========================================================
4549 MOZ_ARG_WITH_STRING(system-zlib,
4550 [ --with-system-zlib[=PFX]
4551 Use system libz [installed at prefix PFX]],
4554 _SAVE_CFLAGS=$CFLAGS
4555 _SAVE_LDFLAGS=$LDFLAGS
4557 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4558 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4559 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4561 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4564 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4565 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4567 if test "$SYSTEM_ZLIB" = 1; then
4568 LIBS="$ZLIB_LIBS $LIBS"
4569 AC_TRY_COMPILE([ #include <stdio.h>
4571 #include <zlib.h> ],
4572 [ #if ZLIB_VERNUM < $MOZZLIB
4573 #error "Insufficient zlib version ($MOZZLIB required)."
4576 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4578 CFLAGS=$_SAVE_CFLAGS
4579 LDFLAGS=$_SAVE_LDFLAGS
4582 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4583 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4584 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4587 dnl system BZIP2 Support
4588 dnl ========================================================
4589 MOZ_ARG_WITH_STRING(system-bz2,
4590 [ --with-system-bz2[=PFX]
4591 Use system libbz2 [installed at prefix PFX]],
4594 _SAVE_CFLAGS=$CFLAGS
4595 _SAVE_LDFLAGS=$LDFLAGS
4597 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4598 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4599 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4601 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4604 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4605 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4607 CFLAGS=$_SAVE_CFLAGS
4608 LDFLAGS=$_SAVE_LDFLAGS
4611 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4612 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4613 BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4616 dnl system PNG Support
4617 dnl ========================================================
4618 MOZ_ARG_WITH_STRING(system-png,
4619 [ --with-system-png[=PFX]
4620 Use system libpng [installed at prefix PFX]],
4623 _SAVE_CFLAGS=$CFLAGS
4624 _SAVE_LDFLAGS=$LDFLAGS
4626 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4627 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4628 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4629 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4630 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4632 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4635 _SAVE_PNG_LIBS=$PNG_LIBS
4636 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4637 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4639 AC_CHECK_LIB(png, png_get_acTL, ,
4640 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4643 if test "$SYSTEM_PNG" = 1; then
4644 LIBS="$PNG_LIBS $LIBS"
4645 AC_TRY_COMPILE([ #include <stdio.h>
4646 #include <sys/types.h>
4648 [ #if PNG_LIBPNG_VER < $MOZPNG
4649 #error "Insufficient libpng version ($MOZPNG required)."
4651 #ifndef PNG_UINT_31_MAX
4652 #error "Insufficient libpng version."
4655 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4657 CFLAGS=$_SAVE_CFLAGS
4658 LDFLAGS=$_SAVE_LDFLAGS
4661 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4662 PNG_CFLAGS="-I${PNG_DIR}/include"
4663 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4666 fi # SKIP_LIBRARY_CHECKS
4668 dnl system HunSpell Support
4669 dnl ========================================================
4670 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4671 [ --enable-system-hunspell Use system hunspell (located with pkgconfig)],
4674 if test -n "$SYSTEM_HUNSPELL"; then
4675 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4678 AC_SUBST(SYSTEM_HUNSPELL)
4680 dnl ========================================================
4681 dnl Java SDK support
4682 dnl ========================================================
4684 MOZ_ARG_WITH_STRING(java-include-path,
4685 [ --with-java-include-path=dir Location of Java SDK headers],
4686 JAVA_INCLUDE_PATH=$withval)
4689 MOZ_ARG_WITH_STRING(java-bin-path,
4690 [ --with-java-bin-path=dir Location of Java binaries (java, javac, jar)],
4691 JAVA_BIN_PATH=$withval)
4693 dnl ========================================================
4694 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4695 dnl their usage and use them in spidermonkey.
4696 dnl ========================================================
4697 MOZ_ARG_WITH_BOOL(arm-kuser,
4698 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4701 if test -n "$USE_ARM_KUSER"; then
4702 AC_DEFINE(USE_ARM_KUSER)
4705 dnl ========================================================
4709 dnl ========================================================
4711 MOZ_ARG_HEADER(Application)
4715 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4716 MOZ_BRANDING_DIRECTORY=
4717 MOZ_OFFICIAL_BRANDING=
4719 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4720 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4728 MOZ_AUTH_EXTENSION=1
4729 MOZ_NO_ACTIVEX_SUPPORT=1
4730 MOZ_NO_INSPECTOR_APIS=
4739 MOZ_PLAINTEXT_EDITOR_ONLY=
4741 MOZ_PREF_EXTENSIONS=1
4742 MOZ_PROFILELOCKING=1
4754 MOZ_TOOLKIT_SEARCH=1
4756 MOZ_UNIVERSALCHARDET=1
4758 MOZ_USE_NATIVE_UCONV=
4761 MOZ_XSLT_STANDALONE=
4769 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4770 NECKO_SMALL_BUFFERS=
4772 XPC_IDISPATCH_SUPPORT=
4775 case "$target_os" in
4776 darwin*|*wince*|*winmo*)
4784 case "$target_os" in
4785 msvc*|mks*|cygwin*|mingw*)
4787 if test -z "$GNU_CC"; then
4788 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4791 XPC_IDISPATCH_SUPPORT=1
4792 MOZ_NO_ACTIVEX_SUPPORT=
4794 if test -n "$NS_ENABLE_TSF"; then
4795 AC_DEFINE(NS_ENABLE_TSF)
4800 MOZ_ARG_ENABLE_STRING(application,
4801 [ --enable-application=APP
4805 content/xslt (Standalone Transformiix XSLT)
4806 netwerk (Standalone Necko)
4807 tools/update-packaging (AUS-related packaging tools)
4808 standalone (use this for standalone
4809 xpcom/xpconnect or to manually drive a build)],
4810 [ MOZ_BUILD_APP=$enableval ] )
4812 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4813 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4814 XULRUNNER_STUB_NAME=$withval)
4816 if test -z "$XULRUNNER_STUB_NAME"; then
4817 case "$target_os" in
4819 XULRUNNER_STUB_NAME=xulrunner
4822 XULRUNNER_STUB_NAME=xulrunner-stub
4825 AC_SUBST(XULRUNNER_STUB_NAME)
4827 if test -z "$MOZ_BUILD_APP"; then
4828 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4830 # We have a valid application only if it has a build.mk file in its top
4832 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4833 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4837 # Allow the application to influence configure with a confvars.sh script.
4839 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4840 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4841 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4842 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4847 # Now is a good time to test for logic errors, define mismatches, etc.
4848 case "$MOZ_BUILD_APP" in
4850 if test "$LIBXUL_SDK"; then
4851 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4856 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4857 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4859 case "$MOZ_BUILD_APP" in
4861 AC_DEFINE(MOZ_PHOENIX)
4865 AC_DEFINE(MOZ_XULRUNNER)
4873 MOZ_APP_NAME=mozilla
4874 MOZ_APP_DISPLAYNAME=Mozilla
4875 MOZ_APP_VERSION=$MOZILLA_VERSION
4880 AC_SUBST(MOZ_BUILD_APP)
4881 AC_SUBST(MOZ_PHOENIX)
4882 AC_SUBST(MOZ_XULRUNNER)
4884 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4886 dnl ========================================================
4888 dnl = Toolkit Options
4890 dnl ========================================================
4891 MOZ_ARG_HEADER(Toolkit Options)
4893 dnl ========================================================
4894 dnl = Select the default toolkit
4895 dnl ========================================================
4896 MOZ_ARG_ENABLE_STRING(default-toolkit,
4897 [ --enable-default-toolkit=TK
4898 Select default toolkit
4899 Platform specific defaults:
4901 Mac OS X - cairo-cocoa
4902 Neutrino/QNX - photon
4904 Win32/WinCE - cairo-windows
4905 Gtk2 with DirectFB - cairo-gtk2-dfb
4908 [ _DEFAULT_TOOLKIT=$enableval ],
4909 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4911 if test "$_DEFAULT_TOOLKIT" = "photon" \
4912 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4913 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4914 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4915 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4916 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4917 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4918 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4919 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4921 dnl nglayout only supports building with one toolkit,
4922 dnl so ignore everything after the first comma (",").
4923 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4925 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4928 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4930 dnl ========================================================
4931 dnl = Enable the toolkit as needed =
4932 dnl ========================================================
4934 case "$MOZ_WIDGET_TOOLKIT" in
4937 AC_DEFINE(MOZ_WIDGET_PHOTON)
4941 MOZ_WIDGET_TOOLKIT=windows
4950 cairo-gtk2|cairo-gtk2-x11)
4951 MOZ_WIDGET_TOOLKIT=gtk2
4953 MOZ_ENABLE_XREMOTE=1
4961 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4962 TK_LIBS='$(MOZ_GTK2_LIBS)'
4963 AC_DEFINE(MOZ_WIDGET_GTK2)
4967 MOZ_WIDGET_TOOLKIT=gtk2
4974 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4975 TK_LIBS='$(MOZ_GTK2_LIBS)'
4976 AC_DEFINE(MOZ_WIDGET_GTK2)
4977 if test "$no_x" != "yes"; then
4978 AC_MSG_WARN([Disabling X when DirectFB is specified.])
4984 MOZ_WIDGET_TOOLKIT=qt
4986 MOZ_ENABLE_XREMOTE=1
4996 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4997 TK_LIBS='$(MOZ_QT_LIBS)'
4998 AC_DEFINE(MOZ_WIDGET_QT)
5002 MOZ_WIDGET_TOOLKIT=beos
5004 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5005 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5009 MOZ_WIDGET_TOOLKIT=os2
5011 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5012 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5016 MOZ_WIDGET_TOOLKIT=cocoa
5017 AC_DEFINE(MOZ_WIDGET_COCOA)
5018 MOZ_USER_DIR="Mozilla"
5019 AC_DEFINE(XP_MACOSX)
5020 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
5021 TK_CFLAGS="-DNO_X11"
5022 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5023 CFLAGS="$CFLAGS $TK_CFLAGS"
5024 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5025 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5026 MOZ_FS_LAYOUT=bundle
5031 if test "$MOZ_ENABLE_XREMOTE"; then
5032 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5035 if test "$COMPILE_ENVIRONMENT"; then
5036 if test "$MOZ_ENABLE_GTK2"; then
5037 if test "$MOZ_X11"; then
5038 GDK_PACKAGES=gdk-x11-2.0
5039 elif test "$MOZ_DFB"; then
5040 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5041 GDK_PACKAGES=directfb
5044 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5047 fi # COMPILE_ENVIRONMENT
5049 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
5050 AC_SUBST(MOZ_FS_LAYOUT)
5052 dnl ========================================================
5053 dnl = startup-notification support module
5054 dnl ========================================================
5056 if test "$MOZ_ENABLE_GTK2"
5058 MOZ_ENABLE_STARTUP_NOTIFICATION=
5060 MOZ_ARG_ENABLE_BOOL(startup-notification,
5061 [ --enable-startup-notification Enable startup-notification support (default: disabled) ],
5062 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5063 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5064 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5066 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5067 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5068 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5069 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5071 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5073 MOZ_ENABLE_STARTUP_NOTIFICATION=
5077 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5078 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5081 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5083 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5084 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5085 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5087 dnl ========================================================
5089 dnl ========================================================
5090 if test "$MOZ_ENABLE_QT"
5092 MOZ_ARG_WITH_STRING(qtdir,
5093 [ --with-qtdir=\$dir Specify Qt directory ],
5096 if test -z "$QTDIR"; then
5097 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5098 AC_CHECK_PROGS(HOST_MOC, moc, "")
5100 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5102 MOZ_QT_CFLAGS="-DQT_SHARED"
5103 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5104 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5105 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5106 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5107 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5108 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5109 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5110 HOST_MOC="$QTDIR/bin/moc"
5112 if test -z "$HOST_MOC"; then
5113 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5119 AC_SUBST(GTK_CONFIG)
5123 AC_SUBST(MOZ_ENABLE_GTK2)
5124 AC_SUBST(MOZ_ENABLE_PHOTON)
5125 AC_SUBST(MOZ_ENABLE_QT)
5126 AC_SUBST(MOZ_ENABLE_XREMOTE)
5127 AC_SUBST(MOZ_GTK2_CFLAGS)
5128 AC_SUBST(MOZ_GTK2_LIBS)
5129 AC_SUBST(MOZ_QT_CFLAGS)
5130 AC_SUBST(MOZ_QT_LIBS)
5137 dnl ========================================================
5139 dnl = Components & Features
5141 dnl ========================================================
5142 MOZ_ARG_HEADER(Components and Features)
5144 dnl ========================================================
5146 dnl ========================================================
5147 MOZ_ARG_ENABLE_STRING(ui-locale,
5148 [ --enable-ui-locale=ab-CD
5149 Select the user interface locale (default: en-US)],
5150 MOZ_UI_LOCALE=$enableval )
5151 AC_SUBST(MOZ_UI_LOCALE)
5153 dnl ========================================================
5154 dnl = Trademarked Branding
5155 dnl ========================================================
5156 MOZ_ARG_ENABLE_BOOL(official-branding,
5157 [ --enable-official-branding Enable Official mozilla.org Branding
5158 Do not distribute builds with
5159 --enable-official-branding unless you have
5160 permission to use trademarks per
5161 http://www.mozilla.org/foundation/trademarks/ .],
5163 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5164 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5166 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5167 MOZ_OFFICIAL_BRANDING=1
5169 ], MOZ_OFFICIAL_BRANDING=)
5171 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5172 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5173 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5176 MOZ_ARG_WITH_STRING(branding,
5177 [ --with-branding=dir Use branding from the specified directory.],
5178 MOZ_BRANDING_DIRECTORY=$withval)
5180 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5181 if test -z "$REAL_BRANDING_DIRECTORY"; then
5182 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5185 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5186 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5189 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5191 dnl ========================================================
5192 dnl = Distribution ID
5193 dnl ========================================================
5194 MOZ_ARG_WITH_STRING(distribution-id,
5195 [ --with-distribution-id=ID Set distribution-specific id (default=org.mozilla)],
5196 [ val=`echo $withval`
5197 MOZ_DISTRIBUTION_ID="$val"])
5199 if test -z "$MOZ_DISTRIBUTION_ID"; then
5200 MOZ_DISTRIBUTION_ID="org.mozilla"
5203 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5204 AC_SUBST(MOZ_DISTRIBUTION_ID)
5207 dnl ========================================================
5208 dnl complex text support off by default
5209 dnl ========================================================
5210 MOZ_ARG_DISABLE_BOOL(pango,
5211 [ --disable-pango Disable usage of Pango ],
5215 dnl ========================================================
5217 dnl ========================================================
5218 if test "$MOZ_ENABLE_GTK2"
5222 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5224 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5225 AC_SUBST(MOZ_PANGO_CFLAGS)
5226 AC_SUBST(MOZ_PANGO_LIBS)
5227 if test "$MOZ_PANGO"
5229 AC_DEFINE(MOZ_PANGO)
5231 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5232 AC_SUBST(FT2_CFLAGS)
5237 if test "$MOZ_ENABLE_QT"
5239 if test "$MOZ_PANGO"
5241 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5243 AC_SUBST(MOZ_PANGO_CFLAGS)
5244 AC_SUBST(MOZ_PANGO_LIBS)
5245 AC_DEFINE(MOZ_PANGO)
5248 echo "Pango library not found, will use FT2 font engine"
5255 dnl ========================================================
5256 dnl = GnomeVFS, GIO and GConf support module
5257 dnl ========================================================
5261 dnl build the gnomevfs extension by default only when the
5262 dnl GTK2 toolkit is in use.
5263 if test "$MOZ_ENABLE_GTK2"
5265 MOZ_ENABLE_GNOMEVFS=1
5269 dnl ========================================================
5270 dnl = GnomeVFS support module
5271 dnl ========================================================
5272 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5273 [ --disable-gnomevfs Disable GnomeVFS support ],
5274 MOZ_ENABLE_GNOMEVFS=,
5275 MOZ_ENABLE_GNOMEVFS=force)
5277 if test "$MOZ_ENABLE_GNOMEVFS"
5279 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5280 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5281 MOZ_ENABLE_GNOMEVFS=1
5282 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5284 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5286 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5288 MOZ_ENABLE_GNOMEVFS=
5291 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5292 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5293 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5298 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5299 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5300 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5302 dnl ========================================================
5303 dnl = GIO support module
5304 dnl ========================================================
5305 MOZ_ARG_ENABLE_BOOL(gio,
5306 [ --enable-gio Enable GIO support (default: disabled)],
5307 MOZ_ENABLE_GIO=force,
5310 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5312 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5313 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5315 AC_DEFINE(MOZ_ENABLE_GIO)
5317 if test "$MOZ_ENABLE_GIO" = "force"
5319 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5325 AC_SUBST(MOZ_ENABLE_GIO)
5326 AC_SUBST(MOZ_GIO_CFLAGS)
5327 AC_SUBST(MOZ_GIO_LIBS)
5329 dnl ========================================================
5330 dnl = GConf support module
5331 dnl ========================================================
5332 if test "$MOZ_ENABLE_GCONF"
5334 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5335 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5338 if test "$MOZ_ENABLE_GCONF" = "force"
5340 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5346 if test "$MOZ_ENABLE_GCONF"; then
5347 AC_DEFINE(MOZ_ENABLE_GCONF)
5350 AC_SUBST(MOZ_ENABLE_GCONF)
5351 AC_SUBST(MOZ_GCONF_CFLAGS)
5352 AC_SUBST(MOZ_GCONF_LIBS)
5355 dnl ========================================================
5356 dnl = libnotify support
5357 dnl ========================================================
5359 if test "$MOZ_ENABLE_GTK2"
5361 MOZ_ENABLE_LIBNOTIFY=1
5363 MOZ_ARG_DISABLE_BOOL(libnotify,
5364 [ --disable-libnotify Disable libnotify support ],
5365 MOZ_ENABLE_LIBNOTIFY=,
5366 MOZ_ENABLE_LIBNOTIFY=1)
5368 if test "$MOZ_ENABLE_LIBNOTIFY"
5370 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5374 if test -z "$SKIP_LIBRARY_CHECKS"
5376 if test "$MOZ_ENABLE_GTK2"
5378 if test "$MOZ_ENABLE_LIBNOTIFY"
5380 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5384 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5385 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5386 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5388 dnl ========================================================
5389 dnl = GNOME component (mozgnome)
5390 dnl ========================================================
5392 # The GNOME component is built if one of
5393 # gnome-vfs, gio, gconf or libnotify is available.
5394 if test "$MOZ_ENABLE_GCONF" || \
5395 test "$MOZ_ENABLE_GNOMEVFS" || \
5396 test "$MOZ_ENABLE_GIO" || \
5397 test "$MOZ_ENABLE_LIBNOTIFY"; then
5398 MOZ_ENABLE_GNOME_COMPONENT=1
5400 MOZ_ENABLE_GNOME_COMPONENT=
5402 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5404 dnl ========================================================
5405 dnl = libgnomeui support module
5406 dnl ========================================================
5408 if test "$MOZ_ENABLE_GTK2"
5410 MOZ_ENABLE_GNOMEUI=1
5412 MOZ_ARG_DISABLE_BOOL(gnomeui,
5413 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5414 MOZ_ENABLE_GNOMEUI=,
5415 MOZ_ENABLE_GNOMEUI=force)
5417 if test "$MOZ_ENABLE_GNOMEUI"
5419 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5421 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5422 MOZ_ENABLE_GNOMEUI=1
5424 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5426 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5432 if test "$MOZ_ENABLE_GNOMEUI"; then
5433 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5437 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5438 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5439 AC_SUBST(MOZ_GNOMEUI_LIBS)
5441 dnl ========================================================
5443 dnl ========================================================
5445 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5449 MOZ_ARG_DISABLE_BOOL(dbus,
5450 [ --disable-dbus Disable dbus support ],
5454 if test "$MOZ_ENABLE_DBUS"
5456 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5457 AC_DEFINE(MOZ_ENABLE_DBUS)
5460 AC_SUBST(MOZ_ENABLE_DBUS)
5461 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5462 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5464 dnl ========================================================
5465 dnl = Build Personal Security Manager
5466 dnl ========================================================
5467 MOZ_ARG_DISABLE_BOOL(crypto,
5468 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5472 dnl ========================================================
5473 dnl = JS Debugger XPCOM component (js/jsd)
5474 dnl ========================================================
5475 MOZ_ARG_DISABLE_BOOL(jsd,
5476 [ --disable-jsd Disable JavaScript debug library],
5481 dnl ========================================================
5482 dnl = Disable IPC support for tabs and plugins
5483 dnl ========================================================
5485 powerpc-apple-darwin*)
5493 MOZ_ARG_DISABLE_BOOL(ipc,
5494 [ --disable-ipc Disable IPC supports for tabs and plugins],
5498 if test -n "$MOZ_IPC"; then
5504 dnl ========================================================
5505 dnl = Enable IPDL's "expensive" unit tests
5506 dnl ========================================================
5509 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5510 [ --enable-ipdl-tests Enable expensive IPDL tests],
5514 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5515 AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5518 if test -n "$MOZ_IPDL_TESTS"; then
5519 AC_DEFINE(MOZ_IPDL_TESTS)
5522 AC_SUBST(MOZ_IPDL_TESTS)
5524 dnl ========================================================
5525 dnl = Disable plugin support
5526 dnl ========================================================
5527 MOZ_ARG_DISABLE_BOOL(plugins,
5528 [ --disable-plugins Disable plugins support],
5532 dnl ========================================================
5533 dnl = Disable building dbm
5534 dnl ========================================================
5535 MOZ_ARG_DISABLE_BOOL(dbm,
5536 [ --disable-dbm Disable building dbm],
5540 dnl bi-directional support always on
5544 dnl ========================================================
5545 dnl view source support on by default
5546 dnl ========================================================
5547 if test "$MOZ_VIEW_SOURCE"; then
5548 AC_DEFINE(MOZ_VIEW_SOURCE)
5551 dnl ========================================================
5552 dnl accessibility support on by default on all platforms
5554 dnl ========================================================
5555 MOZ_ARG_DISABLE_BOOL(accessibility,
5556 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5559 if test "$ACCESSIBILITY"; then
5560 AC_DEFINE(ACCESSIBILITY)
5563 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5565 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5566 if test "$ac_cv_header_atlbase_h" = "no"; then
5567 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.])
5569 if test "$ac_cv_header_oleacc_idl" = "no"; then
5570 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.])
5576 dnl ========================================================
5577 dnl xpinstall support on by default
5578 dnl ========================================================
5579 MOZ_ARG_DISABLE_BOOL(xpinstall,
5580 [ --disable-xpinstall Disable xpinstall support],
5583 if test "$MOZ_XPINSTALL"; then
5584 AC_DEFINE(MOZ_XPINSTALL)
5587 dnl ========================================================
5588 dnl xpcom js loader support on by default
5589 dnl ========================================================
5590 if test "$MOZ_JSLOADER"; then
5591 AC_DEFINE(MOZ_JSLOADER)
5594 dnl ========================================================
5595 dnl Disable printing
5596 dnl ========================================================
5597 MOZ_ARG_DISABLE_BOOL(printing,
5598 [ --disable-printing Disable printing support],
5602 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5603 AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5607 if test "$NS_PRINTING"; then
5608 AC_DEFINE(NS_PRINTING)
5609 AC_DEFINE(NS_PRINT_PREVIEW)
5612 dnl ========================================================
5613 dnl use native unicode converters
5614 dnl ========================================================
5615 MOZ_ARG_ENABLE_BOOL(native-uconv,
5616 [ --enable-native-uconv Enable iconv support],
5617 MOZ_USE_NATIVE_UCONV=1,
5618 MOZ_USE_NATIVE_UCONV= )
5619 if test "$MOZ_USE_NATIVE_UCONV"; then
5620 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5622 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5623 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5627 dnl ========================================================
5628 dnl Libeditor can be build as plaintext-only,
5629 dnl or as a full html and text editing component.
5630 dnl We build both by default.
5631 dnl ========================================================
5632 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5633 [ --enable-plaintext-editor-only
5634 Allow only plaintext editing],
5635 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5636 MOZ_PLAINTEXT_EDITOR_ONLY= )
5637 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5638 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5640 dnl ========================================================
5641 dnl = Disable Fast Load
5642 dnl ========================================================
5643 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5644 [ --disable-xpcom-fastload Disable XPCOM fastload support],
5648 AC_SUBST(MOZ_NO_FAST_LOAD)
5650 if test -n "$MOZ_NO_FAST_LOAD"; then
5651 AC_DEFINE(MOZ_NO_FAST_LOAD)
5654 dnl ========================================================
5655 dnl = Disable Ogg Codecs
5656 dnl ========================================================
5657 MOZ_ARG_DISABLE_BOOL(ogg,
5658 [ --disable-ogg Disable Ogg Codec support],
5664 if test -n "$MOZ_OGG"; then
5669 dnl Checks for __attribute__(aligned()) directive
5670 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5671 [ac_cv_c_attribute_aligned],
5672 [ac_cv_c_attribute_aligned=0
5673 CFLAGS_save="${CFLAGS}"
5674 CFLAGS="${CFLAGS} -Werror"
5675 for ac_cv_c_attr_align_try in 64 32 16 8; do
5676 echo "trying $ac_cv_c_attr_align_try"
5678 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5679 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5680 if test "$ac_cv_c_attribute_aligned" != 0; then
5684 CFLAGS="${CFLAGS_save}"])
5685 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5686 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5687 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5691 dnl ========================================================
5692 dnl = Disable Wave decoder support
5693 dnl ========================================================
5694 MOZ_ARG_DISABLE_BOOL(wave,
5695 [ --disable-wave Disable Wave decoder support],
5701 if test -n "$MOZ_WAVE"; then
5707 dnl ========================================================
5708 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5709 dnl ========================================================
5711 AC_SUBST(MOZ_SYDNEYAUDIO)
5713 if test -n "$MOZ_SYDNEYAUDIO"; then
5714 AC_DEFINE(MOZ_SYDNEYAUDIO)
5719 if test -n "$MOZ_MEDIA"; then
5720 AC_DEFINE(MOZ_MEDIA)
5723 dnl ========================================================
5724 dnl = Check alsa availability on Linux if using sydneyaudio
5725 dnl ========================================================
5727 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5728 if test -n "$MOZ_SYDNEYAUDIO"; then
5729 case "$target_os" in
5731 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5732 [echo "$MOZ_ALSA_PKG_ERRORS"
5733 AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux. Disable with --disable-ogg --disable-wave.])])
5737 AC_SUBST(MOZ_ALSA_LIBS)
5739 dnl ========================================================
5741 dnl ========================================================
5742 AC_ARG_ENABLE(splashscreen,
5743 [ --enable-splashscreen display splashscreen while loading (default=no)],
5744 [enable_splash="yes"],[enable_splash=""])
5745 if test "x$enable_splash" = "xyes"; then
5747 AC_DEFINE(MOZ_SPLASHSCREEN)
5749 AC_SUBST(MOZ_SPLASHSCREEN)
5751 dnl ========================================================
5752 dnl Permissions System
5753 dnl ========================================================
5754 MOZ_ARG_DISABLE_BOOL(permissions,
5755 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5760 dnl ========================================================
5762 dnl ========================================================
5763 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5764 [ --disable-negotiateauth Disable GSS-API negotiation ],
5765 MOZ_AUTH_EXTENSION=,
5766 MOZ_AUTH_EXTENSION=1 )
5768 dnl ========================================================
5770 dnl ========================================================
5771 MOZ_ARG_DISABLE_BOOL(xtf,
5772 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5775 if test "$MOZ_XTF"; then
5779 dnl ========================================================
5780 dnl Pref extensions (autoconfig and system-pref)
5781 dnl ========================================================
5782 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5783 [ --disable-pref-extensions
5784 Disable pref extensions such as autoconfig and
5786 MOZ_PREF_EXTENSIONS=,
5787 MOZ_PREF_EXTENSIONS=1 )
5789 dnl ========================================================
5790 dnl = Universalchardet
5791 dnl ========================================================
5792 MOZ_ARG_DISABLE_BOOL(universalchardet,
5793 [ --disable-universalchardet
5794 Disable universal encoding detection],
5795 MOZ_UNIVERSALCHARDET=,
5796 MOZ_UNIVERSALCHARDET=1 )
5798 dnl ========================================================
5800 dnl ========================================================
5807 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5808 [ --enable-javaxpcom
5809 Enable Java-XPCOM bridge],
5813 if test -n "${MOZ_JAVAXPCOM}"; then
5816 if test -n "$JAVA_HOME"; then
5817 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5821 if test -n "$JAVA_HOME"; then
5822 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5827 if test -n "${JAVA_INCLUDE_PATH}"; then
5828 dnl Make sure jni.h exists in the given include path.
5829 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5830 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5833 case "$target_os" in
5835 dnl Default to java system location
5836 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5840 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5843 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5844 AC_MSG_ERROR([The header jni.h was not found. Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
5848 if test -n "${JAVA_BIN_PATH}"; then
5849 dnl Look for javac and jar in the specified path.
5850 JAVA_PATH="$JAVA_BIN_PATH"
5852 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5853 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5856 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5857 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5858 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5859 if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5860 AC_MSG_ERROR([The programs java, javac and jar were not found. Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
5864 dnl ========================================================
5865 dnl = Breakpad crash reporting (on by default on supported platforms)
5866 dnl ========================================================
5872 i?86-apple-darwin*|powerpc-apple-darwin*)
5875 i?86-*-linux*|x86_64-*-linux*)
5883 MOZ_ARG_DISABLE_BOOL(crashreporter,
5884 [ --disable-crashreporter Disable breakpad crash reporting],
5886 MOZ_CRASHREPORTER=1)
5888 if test -n "$MOZ_CRASHREPORTER"; then
5889 AC_DEFINE(MOZ_CRASHREPORTER)
5891 if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5892 test -z "$SKIP_LIBRARY_CHECKS"; then
5893 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5894 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5895 AC_SUBST(MOZ_GTHREAD_LIBS)
5897 AC_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.])])
5901 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5902 [ --with-crashreporter-enable-percent=NN Enable sending crash reports by default on NN% of users. (default=100)],
5903 [ val=`echo $withval | sed 's/[^0-9]//g'`
5904 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5906 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5907 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5909 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5911 dnl ========================================================
5912 dnl = Enable compilation of specific extension modules
5913 dnl ========================================================
5915 MOZ_ARG_ENABLE_STRING(extensions,
5916 [ --enable-extensions Enable extensions],
5917 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5918 if test "$option" = "yes" || test "$option" = "all"; then
5919 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5920 elif test "$option" = "no" || test "$option" = "none"; then
5922 elif test "$option" = "default"; then
5923 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5924 elif test `echo "$option" | grep -c \^-` != 0; then
5925 option=`echo $option | sed 's/^-//'`
5926 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5928 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5931 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5933 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5934 # Suppress warning on non-X11 platforms
5935 if test -n "$MOZ_X11"; then
5936 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5938 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5941 dnl Do not build gnomevfs with libxul based apps
5942 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5943 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5946 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5947 # Suppress warning on non-X11 platforms
5948 if test -n "$MOZ_X11"; then
5949 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5951 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5954 dnl Do not build gio with libxul based apps
5955 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5956 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5959 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5960 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5961 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5964 dnl This might be temporary: build tridentprofile only on Windows
5965 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5966 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5967 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5970 dnl cookie must be built before tridentprofile. put it at list's end.
5971 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5972 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5973 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5976 dnl xforms requires xtf and schema-validation
5977 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5978 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
5979 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5981 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5982 AC_MSG_WARN([Cannot build XForms without schema validation. Removing XForms from MOZ_EXTENSIONS.])
5983 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5986 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5987 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5988 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5991 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5992 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5993 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5996 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5997 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5998 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6001 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6002 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6003 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6006 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6007 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6008 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6011 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6012 AC_MSG_WARN([spellcheck is no longer an extension.])
6013 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6017 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6019 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6020 dnl when trying to build a non-existent extension.
6021 for extension in $MOZ_EXTENSIONS; do
6022 if test ! -d "${srcdir}/extensions/${extension}"; then
6023 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6028 dnl ========================================================
6030 dnl ========================================================
6031 case "$MOZ_WIDGET_TOOLKIT" in
6032 beos|windows|os2|mac|cocoa)
6035 if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6036 MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6041 MOZ_ARG_ENABLE_STRING(image-decoders,
6042 [ --enable-image-decoders[={mod1,mod2,default,all,none}]
6043 Enable specific image decoders],
6044 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6045 if test "$option" = "yes" || test "$option" = "all"; then
6046 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6047 elif test "$option" = "no" || test "$option" = "none"; then
6049 elif test "$option" = "default"; then
6050 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6051 elif test `echo "$option" | grep -c \^-` != 0; then
6052 option=`echo $option | sed 's/^-//'`
6053 MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6055 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6058 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6060 dnl Dupes are removed in the encoder section because it will also add decoders
6062 dnl ========================================================
6064 dnl ========================================================
6065 MOZ_ARG_ENABLE_STRING(image-encoders,
6066 [ --enable-image-encoders[={mod1,mod2,default,all,none}]
6067 Enable specific image encoders],
6068 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6069 if test "$option" = "yes" || test "$option" = "all"; then
6070 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6071 elif test "$option" = "no" || test "$option" = "none"; then
6074 elif test "$option" = "default"; then
6075 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6076 elif test `echo "$option" | grep -c \^-` != 0; then
6077 option=`echo $option | sed 's/^-//'`
6078 addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6080 addencoder="$option"
6082 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6084 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6087 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6088 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6090 dnl ========================================================
6091 dnl MathML on by default
6092 dnl ========================================================
6093 MOZ_ARG_DISABLE_BOOL(mathml,
6094 [ --disable-mathml Disable MathML support],
6097 if test "$MOZ_MATHML"; then
6098 AC_DEFINE(MOZ_MATHML)
6101 dnl ========================================================
6103 dnl ========================================================
6104 MOZ_ARG_DISABLE_BOOL(svg,
6105 [ --disable-svg Disable SVG support],
6108 if test -n "$MOZ_SVG"; then
6112 dnl ========================================================
6114 dnl ========================================================
6116 MOZ_ARG_DISABLE_BOOL(smil,
6117 [ --disable-smil Disable SMIL animation support],
6120 # Automatically disable SMIL if SVG is disabled
6121 if test -z "$MOZ_SVG"; then
6124 if test -n "$MOZ_SMIL"; then
6128 dnl ========================================================
6129 dnl Build Freetype in the tree
6130 dnl ========================================================
6131 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6132 [ --enable-tree-freetype Enable Tree FreeType],
6133 MOZ_TREE_FREETYPE=1,
6134 MOZ_TREE_FREETYPE= )
6135 if test -n "$MOZ_TREE_FREETYPE"; then
6136 AC_DEFINE(MOZ_TREE_FREETYPE)
6137 AC_SUBST(MOZ_TREE_FREETYPE)
6138 MOZ_ENABLE_CAIRO_FT=1
6139 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6140 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6141 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6142 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6143 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6144 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6145 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6146 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6147 AC_SUBST(CAIRO_FT_CFLAGS)
6151 dnl ========================================================
6153 dnl ========================================================
6154 case "$target_os" in
6155 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6160 MOZ_ARG_DISABLE_BOOL(installer,
6161 [ --disable-installer Disable building of installer],
6164 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6165 # Disable installer for Windows builds that use the new toolkit if NSIS
6166 # isn't in the path.
6167 MOZ_PATH_PROGS(MAKENSIS, makensis)
6168 if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6169 AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6171 # The Windows build for NSIS requires the iconv command line utility to
6172 # convert the charset of the locale files.
6173 MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6174 if test -z "$HOST_ICONV"; then
6175 AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6179 # Automatically disable installer if xpinstall isn't built
6180 if test -z "$MOZ_XPINSTALL"; then
6183 AC_SUBST(MOZ_INSTALLER)
6185 AC_MSG_CHECKING([for tar archiver])
6186 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6187 if test -z "$TAR"; then
6188 AC_MSG_ERROR([no tar archiver found in \$PATH])
6190 AC_MSG_RESULT([$TAR])
6193 AC_MSG_CHECKING([for wget])
6194 AC_CHECK_PROGS(WGET, wget, "")
6195 AC_MSG_RESULT([$WGET])
6198 dnl ========================================================
6200 dnl ========================================================
6202 MOZ_ARG_DISABLE_BOOL(updater,
6203 [ --disable-updater Disable building of updater],
6206 AC_SUBST(MOZ_UPDATER)
6208 # app update channel is 'default' when not supplied.
6209 MOZ_ARG_ENABLE_STRING([update-channel],
6210 [ --enable-update-channel=CHANNEL
6211 Select application update channel (default=default)],
6212 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6214 if test -z "$MOZ_UPDATE_CHANNEL"; then
6215 MOZ_UPDATE_CHANNEL=default
6217 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6219 # tools/update-packaging is not checked out by default.
6220 MOZ_ARG_ENABLE_BOOL(update-packaging,
6221 [ --enable-update-packaging
6222 Enable tools/update-packaging],
6223 MOZ_UPDATE_PACKAGING=1,
6224 MOZ_UPDATE_PACKAGING= )
6225 AC_SUBST(MOZ_UPDATE_PACKAGING)
6227 dnl ========================================================
6229 dnl ========================================================
6231 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6232 [ --disable-xpconnect-idispatch
6233 Disable building of xpconnect support for IDispatch
6235 XPC_IDISPATCH_SUPPORT=,
6236 XPC_IDISPATCH_SUPPORT=1)
6237 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6239 MOZ_ARG_DISABLE_BOOL(activex,
6240 [ --disable-activex Disable building of ActiveX control (win32 only)],
6241 MOZ_NO_ACTIVEX_SUPPORT=1,
6242 MOZ_NO_ACTIVEX_SUPPORT= )
6243 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6245 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6246 [ --enable-activex-scripting
6247 Enable building of ActiveX scripting support (win32)],
6248 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6249 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6250 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6252 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6254 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6257 if test "$COMPILE_ENVIRONMENT" = "1"; then
6258 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6260 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6261 if test "$ac_cv_header_atlbase_h" = "no"; then
6262 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.])
6269 dnl ========================================================
6271 dnl ========================================================
6272 MOZ_ARG_ENABLE_BOOL(leaky,
6273 [ --enable-leaky Build leaky memory tool],
6278 dnl ========================================================
6280 dnl ========================================================
6281 MOZ_ARG_ENABLE_BOOL(xpctools,
6282 [ --enable-xpctools Build JS profiling tool],
6287 dnl ========================================================
6288 dnl build the tests by default
6289 dnl ========================================================
6290 MOZ_ARG_DISABLE_BOOL(tests,
6291 [ --disable-tests Do not build test libraries & programs],
6295 dnl ========================================================
6296 dnl parental controls (for Windows Vista)
6297 dnl ========================================================
6298 MOZ_ARG_DISABLE_BOOL(parental-controls,
6299 [ --disable-parental-controls
6300 Do not build parental controls],
6301 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6302 MOZ_DISABLE_PARENTAL_CONTROLS=)
6303 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6304 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6307 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6309 dnl ========================================================
6311 dnl = Module specific options
6313 dnl ========================================================
6314 MOZ_ARG_HEADER(Individual module options)
6316 dnl ========================================================
6317 dnl = Places, no configure argument
6318 dnl ========================================================
6319 if test -n "$MOZ_PLACES"; then
6320 AC_DEFINE(MOZ_PLACES)
6321 if test -z "$MOZ_MAIL_NEWS"; then
6328 dnl ========================================================
6329 dnl = Disable feed handling components
6330 dnl ========================================================
6331 MOZ_ARG_DISABLE_BOOL(feeds,
6332 [ --disable-feeds Disable feed handling and processing components],
6335 if test -n "$MOZ_FEEDS"; then
6336 AC_DEFINE(MOZ_FEEDS)
6338 if test "$MOZ_BUILD_APP" = "browser"; then
6339 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6343 dnl ========================================================
6344 dnl = Enable mozStorage
6345 dnl ========================================================
6346 dnl Implicitly enabled by default if building calendar or places
6347 MOZ_ARG_ENABLE_BOOL(storage,
6348 [ --enable-storage Enable mozStorage module and related components],
6351 if test -n "$MOZ_STORAGE"; then
6352 AC_DEFINE(MOZ_STORAGE)
6355 dnl ========================================================
6356 dnl Check for sqlite
6357 dnl ========================================================
6360 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6361 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6362 MOZ_NATIVE_SQLITE=1,
6363 MOZ_NATIVE_SQLITE= )
6365 if test -z "$MOZ_NATIVE_SQLITE"
6368 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6370 dnl ============================
6371 dnl === SQLite Version check ===
6372 dnl ============================
6373 dnl Check to see if the system SQLite package is new enough.
6374 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6376 dnl ==================================
6377 dnl === SQLITE_SECURE_DELETE check ===
6378 dnl ==================================
6379 dnl Check to see if the system SQLite package is compiled with
6380 dnl SQLITE_SECURE_DELETE enabled.
6381 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6382 _SAVE_CFLAGS="$CFLAGS"
6383 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6385 LIBS="$LIBS $SQLITE_LIBS"
6386 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6388 #include "sqlite3.h"
6390 int main(int argc, char **argv){
6391 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE=1");
6393 ac_cv_sqlite_secure_delete=yes,
6394 ac_cv_sqlite_secure_delete=no,
6395 ac_cv_sqlite_secure_delete=no
6398 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6399 CFLAGS="$_SAVE_CFLAGS"
6401 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6402 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6405 dnl ===============================
6406 dnl === SQLITE_THREADSAFE check ===
6407 dnl ===============================
6408 dnl Check to see if the system SQLite package is compiled with
6409 dnl SQLITE_THREADSAFE enabled.
6410 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6411 _SAVE_CFLAGS="$CFLAGS"
6412 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6414 LIBS="$LIBS $SQLITE_LIBS"
6415 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6417 #include "sqlite3.h"
6419 int main(int argc, char **argv){
6420 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6422 ac_cv_sqlite_threadsafe=yes,
6423 ac_cv_sqlite_threadsafe=no,
6424 ac_cv_sqlite_threadsafe=no
6427 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6428 CFLAGS="$_SAVE_CFLAGS"
6430 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6431 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6434 dnl ================================
6435 dnl === SQLITE_ENABLE_FTS3 check ===
6436 dnl ================================
6437 dnl check to see if the system SQLite package is compiled with
6438 dnl SQLITE_THREADSAFE enabled.
6439 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6440 _SAVE_CFLAGS="$CFLAGS"
6441 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6443 LIBS="$LIBS $SQLITE_LIBS"
6444 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6446 #include "sqlite3.h"
6448 int main(int argc, char **argv){
6449 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3=1");
6451 ac_cv_sqlite_enable_fts3=yes,
6452 ac_cv_sqlite_enable_fts3=no,
6453 ac_cv_sqlite_enable_fts3=no
6456 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6457 CFLAGS="$_SAVE_CFLAGS"
6459 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6460 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6464 AC_SUBST(MOZ_NATIVE_SQLITE)
6466 dnl ========================================================
6467 dnl = Enable safe browsing (anti-phishing)
6468 dnl ========================================================
6469 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6470 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6471 MOZ_SAFE_BROWSING=1,
6472 MOZ_SAFE_BROWSING= )
6473 if test -n "$MOZ_SAFE_BROWSING"; then
6474 AC_DEFINE(MOZ_SAFE_BROWSING)
6476 AC_SUBST(MOZ_SAFE_BROWSING)
6478 dnl ========================================================
6479 dnl = Enable faststart component
6480 dnl ========================================================
6481 MOZ_ARG_ENABLE_BOOL(faststart,
6482 [ --enable-faststart Enable the faststart component],
6485 if test -n "$MOZ_FASTSTART"; then
6486 AC_DEFINE(MOZ_FASTSTART)
6488 AC_SUBST(MOZ_FASTSTART)
6490 dnl ========================================================
6491 dnl = Enable url-classifier
6492 dnl ========================================================
6493 dnl Implicitly enabled by default if building with safe-browsing
6494 if test -n "$MOZ_SAFE_BROWSING"; then
6495 MOZ_URL_CLASSIFIER=1
6497 MOZ_ARG_ENABLE_BOOL(url-classifier,
6498 [ --enable-url-classifier Enable url classifier module],
6499 MOZ_URL_CLASSIFIER=1,
6500 MOZ_URL_CLASSIFIER= )
6501 if test -n "$MOZ_URL_CLASSIFIER"; then
6502 AC_DEFINE(MOZ_URL_CLASSIFIER)
6504 AC_SUBST(MOZ_URL_CLASSIFIER)
6506 dnl ========================================================
6507 dnl = Disable zipwriter
6508 dnl ========================================================
6509 MOZ_ARG_DISABLE_BOOL(zipwriter,
6510 [ --disable-zipwriter Disable zipwriter component],
6513 AC_SUBST(MOZ_ZIPWRITER)
6515 dnl ========================================================
6516 dnl = Disable libconic
6517 dnl ========================================================
6518 MOZ_ENABLE_LIBCONIC=1
6519 MOZ_ARG_DISABLE_BOOL(libconic,
6520 [ --disable-libconic Disable libconic],
6521 MOZ_ENABLE_LIBCONIC=,
6522 MOZ_ENABLE_LIBCONIC=1 )
6524 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6525 PKG_CHECK_MODULES(LIBCONIC, conic,
6526 MOZ_ENABLE_LIBCONIC=1,
6527 MOZ_ENABLE_LIBCONIC=)
6529 if test "$MOZ_ENABLE_LIBCONIC"; then
6530 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6533 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6534 AC_SUBST(LIBCONIC_CFLAGS)
6535 AC_SUBST(LIBCONIC_LIBS)
6537 dnl ========================================================
6539 dnl ========================================================
6541 MAEMO_SDK_TARGET_VER=-1
6543 MOZ_ARG_WITH_STRING(maemo-version,
6544 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6546 MAEMO_SDK_TARGET_VER=$withval)
6548 case "$MAEMO_SDK_TARGET_VER" in
6550 MOZ_PLATFORM_MAEMO=5
6554 MOZ_PLATFORM_MAEMO=6
6558 dnl We aren't compiling for Maemo, move on.
6561 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6565 if test $MOZ_PLATFORM_MAEMO; then
6566 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6568 if test -z "$MOZ_ENABLE_DBUS"; then
6569 AC_MSG_ERROR([DBus is required when building for Maemo])
6572 MOZ_GFX_OPTIMIZE_MOBILE=1
6575 if test $MOZ_PLATFORM_MAEMO = 5; then
6576 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6577 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6578 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6579 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6580 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6582 AC_SUBST(XCOMPOSITE_LIBS)
6584 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6585 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6586 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6587 if test -z "$_LIB_FOUND"; then
6588 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6592 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6593 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6594 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6595 if test -z "$_LIB_FOUND"; then
6596 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6599 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6600 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6601 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6602 if test -z "$_LIB_FOUND"; then
6603 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6606 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6607 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6608 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6609 if test -z "$_LIB_FOUND"; then
6610 AC_MSG_ERROR([liblocation is required when building for Maemo])
6614 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6615 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6618 dnl ========================================================
6619 dnl = faststripe theme
6620 dnl ========================================================
6621 MOZ_ARG_ENABLE_BOOL(faststripe,
6622 [ --enable-faststripe Use faststripe theme],
6623 MOZ_THEME_FASTSTRIPE=1,
6624 MOZ_THEME_FASTSTRIPE= )
6625 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6627 dnl ========================================================
6629 dnl = Feature options that require extra sources to be pulled
6631 dnl ========================================================
6632 dnl MOZ_ARG_HEADER(Features that require extra sources)
6634 dnl ========================================================
6636 dnl = Debugging Options
6638 dnl ========================================================
6639 MOZ_ARG_HEADER(Debugging and Optimizations)
6641 dnl ========================================================
6642 dnl = Disable building with debug info.
6643 dnl = Debugging is OFF by default
6644 dnl ========================================================
6645 if test -z "$MOZ_DEBUG_FLAGS"
6649 if test "$GNU_CC"; then
6650 GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6651 case "$GCC_VERSION" in
6656 MOZ_DEBUG_FLAGS="-g"
6660 MOZ_DEBUG_FLAGS="-g"
6664 MOZ_DEBUG_FLAGS="-g"
6669 MOZ_ARG_ENABLE_STRING(debug,
6670 [ --enable-debug[=DBG] Enable building with developer debug info
6671 (using compiler flags DBG)],
6672 [ if test "$enableval" != "no"; then
6674 if test -n "$enableval" -a "$enableval" != "yes"; then
6675 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6676 _MOZ_DEBUG_FLAGS_SET=1
6683 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6684 case "${target_os}" in
6686 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6688 msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6689 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6692 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6695 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6697 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6699 if test -n "$MOZ_DEBUG"; then
6700 AC_MSG_CHECKING([for valid debug flags])
6701 _SAVE_CFLAGS=$CFLAGS
6702 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6703 AC_TRY_COMPILE([#include <stdio.h>],
6704 [printf("Hello World\n");],
6707 AC_MSG_RESULT([$_results])
6708 if test "$_results" = "no"; then
6709 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6711 CFLAGS=$_SAVE_CFLAGS
6714 dnl ========================================================
6715 dnl enable mobile optimizations
6716 dnl ========================================================
6717 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6718 [ --enable-mobile-optimize Enable mobile optimizations],
6719 MOZ_GFX_OPTIMIZE_MOBILE=1)
6721 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6723 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6724 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6727 dnl ========================================================
6728 dnl = Enable code optimization. ON by default.
6729 dnl ========================================================
6730 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6731 MOZ_OPTIMIZE_FLAGS="-O"
6734 MOZ_ARG_ENABLE_STRING(optimize,
6735 [ --disable-optimize Disable compiler optimization
6736 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6737 [ if test "$enableval" != "no"; then
6739 if test -n "$enableval" && test "$enableval" != "yes"; then
6740 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6745 fi ], MOZ_OPTIMIZE=1)
6747 if test "$COMPILE_ENVIRONMENT"; then
6748 if test -n "$MOZ_OPTIMIZE"; then
6749 AC_MSG_CHECKING([for valid optimization flags])
6750 _SAVE_CFLAGS=$CFLAGS
6751 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6752 AC_TRY_COMPILE([#include <stdio.h>],
6753 [printf("Hello World\n");],
6756 AC_MSG_RESULT([$_results])
6757 if test "$_results" = "no"; then
6758 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6760 CFLAGS=$_SAVE_CFLAGS
6762 fi # COMPILE_ENVIRONMENT
6764 AC_SUBST(MOZ_OPTIMIZE)
6765 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6766 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6767 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6769 dnl ========================================================
6770 dnl = (Deprecated) generation of debugger info for specific modules
6771 dnl ========================================================
6772 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6773 [ --enable-debugger-info-modules
6774 Enable/disable debugger info for specific modules],
6775 [ if test "$enableval" != "no"; then
6776 AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
6780 dnl ========================================================
6781 dnl = Enable generation of debug symbols
6782 dnl ========================================================
6783 MOZ_ARG_ENABLE_STRING(debug-symbols,
6784 [ --enable-debug-symbols[=DBG] Enable debugging symbols
6785 (using compiler flags DBG)],
6786 [ if test "$enableval" != "no"; then
6788 if test -n "$enableval" -a "$enableval" != "yes"; then
6789 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6790 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6792 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6797 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6798 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6799 export MOZ_DEBUG_SYMBOLS
6802 dnl ========================================================
6803 dnl Disable runtime logging checks
6804 dnl ========================================================
6805 MOZ_ARG_DISABLE_BOOL(logging,
6806 [ --disable-logging Disable logging facilities],
6807 NS_DISABLE_LOGGING=1,
6808 NS_DISABLE_LOGGING= )
6809 if test "$NS_DISABLE_LOGGING"; then
6810 AC_DEFINE(NS_DISABLE_LOGGING)
6812 AC_DEFINE(MOZ_LOGGING)
6815 dnl ========================================================
6816 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6817 dnl ========================================================
6818 _ENABLE_LOGREFCNT=42
6819 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6820 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6821 _ENABLE_LOGREFCNT=1,
6822 _ENABLE_LOGREFCNT= )
6823 if test "$_ENABLE_LOGREFCNT" = "1"; then
6824 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6825 elif test -z "$_ENABLE_LOGREFCNT"; then
6826 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6829 dnl ========================================================
6830 dnl = Enable trace malloc
6831 dnl ========================================================
6832 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6833 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6834 [ --enable-trace-malloc Enable malloc tracing],
6837 if test "$NS_TRACE_MALLOC"; then
6838 # Please, Mr. Linker Man, don't take away our symbol names
6839 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6841 AC_DEFINE(NS_TRACE_MALLOC)
6843 AC_SUBST(NS_TRACE_MALLOC)
6845 dnl ========================================================
6846 dnl = Enable jemalloc
6847 dnl ========================================================
6848 MOZ_ARG_ENABLE_BOOL(jemalloc,
6849 [ --enable-jemalloc Replace memory allocator with jemalloc],
6853 if test "$NS_TRACE_MALLOC"; then
6857 if test "$MOZ_MEMORY"; then
6859 dnl Don't try to run compiler tests on Windows
6860 if test "$OS_ARCH" = "WINNT"; then
6861 if test -z "$HAVE_64BIT_OS"; then
6862 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6864 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6867 AC_CHECK_SIZEOF([int *], [4])
6868 case "${ac_cv_sizeof_int_p}" in
6870 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6873 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6876 AC_MSG_ERROR([Unexpected pointer size])
6881 AC_DEFINE(MOZ_MEMORY)
6882 if test "x$MOZ_DEBUG" = "x1"; then
6883 AC_DEFINE(MOZ_MEMORY_DEBUG)
6885 dnl The generic feature tests that determine how to compute ncpus are long and
6886 dnl complicated. Therefore, simply define special cpp variables for the
6887 dnl platforms we have special knowledge of.
6888 case "${target_os}" in
6890 AC_DEFINE(MOZ_MEMORY_DARWIN)
6893 AC_DEFINE(MOZ_MEMORY_BSD)
6896 AC_DEFINE(MOZ_MEMORY_LINUX)
6899 AC_DEFINE(MOZ_MEMORY_BSD)
6902 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6904 msvc*|mks*|cygwin*|mingw*)
6905 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6906 dnl This is sort of awful. Will revisit if we add support for more versions
6907 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6908 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6910 if test -z "$WIN32_CRT_SRC_DIR"; then
6911 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6912 AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
6914 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6918 case "${target_cpu}" in
6920 _WIN32_CRT_CPU=intel
6923 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6927 if test ! -d "$WIN32_CRT_SRC_DIR"; then
6928 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6930 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6931 _objdir_win=`pwd -W`
6932 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
6933 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6934 dnl Also pass this to NSPR/NSS
6935 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6939 AC_DEFINE(MOZ_MEMORY_WINCE)
6940 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6941 if test -z "$WINCE_WINDOWS_MOBILE"; then
6942 AC_DEFINE(MOZ_MEMORY_WINCE6)
6946 AC_DEFINE(MOZ_MEMORY_WINCE)
6947 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6950 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6954 if test "$OS_ARCH" != "Darwin"; then
6955 dnl NB: this must be kept in sync with jemalloc.h
6956 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
6957 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
6958 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
6961 AC_SUBST(MOZ_MEMORY)
6962 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6963 AC_SUBST(WIN32_CRT_SRC_DIR)
6964 dnl Need to set this for make because NSS doesn't have configure
6967 dnl ========================================================
6968 dnl = Use malloc wrapper lib
6969 dnl ========================================================
6970 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6971 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
6975 if test -n "$_WRAP_MALLOC"; then
6976 if test "$GNU_CC"; then
6977 WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -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"
6978 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6982 dnl ========================================================
6983 dnl = Location of malloc wrapper lib
6984 dnl ========================================================
6985 MOZ_ARG_WITH_STRING(wrap-malloc,
6986 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
6987 WRAP_MALLOC_LIB=$withval)
6989 dnl ========================================================
6991 dnl ========================================================
6992 MOZ_ARG_ENABLE_BOOL(tracevis,
6993 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
6996 if test -n "$MOZ_TRACEVIS"; then
6997 AC_DEFINE(MOZ_TRACEVIS)
7000 dnl ========================================================
7002 dnl ========================================================
7003 MOZ_ARG_ENABLE_BOOL(valgrind,
7004 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
7007 if test -n "$MOZ_VALGRIND"; then
7008 AC_CHECK_HEADER([valgrind/valgrind.h], [],
7010 [--enable-valgrind specified but Valgrind is not installed]))
7011 AC_DEFINE(MOZ_VALGRIND)
7014 dnl ========================================================
7016 dnl ========================================================
7017 MOZ_ARG_ENABLE_BOOL(jprof,
7018 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)],
7021 if test -n "$MOZ_JPROF"; then
7022 AC_DEFINE(MOZ_JPROF)
7025 dnl ========================================================
7027 dnl ========================================================
7028 MOZ_ARG_ENABLE_BOOL(shark,
7029 [ --enable-shark Enable shark remote profiling (needs CHUD framework)],
7032 if test -n "$MOZ_SHARK"; then
7033 AC_DEFINE(MOZ_SHARK)
7036 dnl ========================================================
7038 dnl ========================================================
7039 MOZ_ARG_ENABLE_BOOL(callgrind,
7040 [ --enable-callgrind Enable callgrind profiling],
7043 if test -n "$MOZ_CALLGRIND"; then
7044 AC_DEFINE(MOZ_CALLGRIND)
7047 dnl ========================================================
7049 dnl ========================================================
7050 MOZ_ARG_ENABLE_BOOL(vtune,
7051 [ --enable-vtune Enable vtune profiling],
7054 if test -n "$MOZ_VTUNE"; then
7055 AC_DEFINE(MOZ_VTUNE)
7058 dnl ========================================================
7059 dnl Zealous JavaScript GC
7060 dnl ========================================================
7061 MOZ_ARG_ENABLE_BOOL(gczeal,
7062 [ --enable-gczeal Enable zealous JavaScript GCing],
7065 if test -n "$JS_GC_ZEAL"; then
7066 AC_DEFINE(JS_GC_ZEAL)
7069 dnl ========================================================
7070 dnl = Enable static checking using gcc-dehydra
7071 dnl ========================================================
7073 MOZ_ARG_WITH_STRING(static-checking,
7074 [ --with-static-checking=path/to/gcc_dehydra.so
7075 Enable static checking of code using GCC-dehydra],
7076 DEHYDRA_PATH=$withval,
7079 if test -n "$DEHYDRA_PATH"; then
7080 if test ! -f "$DEHYDRA_PATH"; then
7081 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7083 AC_DEFINE(NS_STATIC_CHECKING)
7085 AC_SUBST(DEHYDRA_PATH)
7087 dnl ========================================================
7088 dnl = Enable stripping of libs & executables
7089 dnl ========================================================
7090 MOZ_ARG_ENABLE_BOOL(strip,
7091 [ --enable-strip Enable stripping of libs & executables ],
7095 dnl ========================================================
7096 dnl = Enable stripping of libs & executables when packaging
7097 dnl ========================================================
7098 MOZ_ARG_ENABLE_BOOL(install-strip,
7099 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7103 dnl ========================================================
7104 dnl = --enable-elf-dynstr-gc
7105 dnl ========================================================
7106 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7107 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7108 USE_ELF_DYNSTR_GC=1,
7109 USE_ELF_DYNSTR_GC= )
7111 dnl ========================================================
7113 dnl = Profiling and Instrumenting
7115 dnl ========================================================
7116 MOZ_ARG_HEADER(Profiling and Instrumenting)
7118 dnl ========================================================
7119 dnl = Enable timeline service, which provides lightweight
7120 dnl = instrumentation of mozilla for performance measurement.
7121 dnl = Timeline is off by default.
7122 dnl ========================================================
7123 MOZ_ARG_ENABLE_BOOL(timeline,
7124 [ --enable-timeline Enable timeline services ],
7127 if test -n "$MOZ_TIMELINE"; then
7128 AC_DEFINE(MOZ_TIMELINE)
7131 dnl ========================================================
7132 dnl Turn on reflow counting
7133 dnl ========================================================
7134 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7135 [ --enable-reflow-perf Enable reflow performance tracing],
7138 if test -n "$MOZ_REFLOW_PERF"; then
7139 AC_DEFINE(MOZ_REFLOW_PERF)
7142 dnl ========================================================
7143 dnl Enable code size metrics.
7144 dnl ========================================================
7145 MOZ_ARG_ENABLE_BOOL(codesighs,
7146 [ --enable-codesighs Enable code size analysis tools],
7147 _ENABLE_CODESIGHS=1,
7148 _ENABLE_CODESIGHS= )
7149 if test -n "$_ENABLE_CODESIGHS"; then
7150 if test -d $srcdir/tools/codesighs; then
7153 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7157 dnl ========================================================
7158 dnl = Support for Quantify (Windows)
7159 dnl ========================================================
7160 MOZ_ARG_ENABLE_BOOL(quantify,
7161 [ --enable-quantify Enable Quantify support (Windows only) ],
7165 dnl ========================================================
7166 dnl = Support for demangling undefined symbols
7167 dnl ========================================================
7168 if test -z "$SKIP_LIBRARY_CHECKS"; then
7171 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7175 # Demangle only for debug or trace-malloc builds
7176 MOZ_DEMANGLE_SYMBOLS=
7177 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7178 MOZ_DEMANGLE_SYMBOLS=1
7179 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7181 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7183 dnl ========================================================
7184 dnl = Support for gcc stack unwinding (from gcc 3.3)
7185 dnl ========================================================
7186 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7187 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7190 dnl ========================================================
7194 dnl ========================================================
7195 MOZ_ARG_HEADER(Misc. Options)
7197 dnl ========================================================
7198 dnl update xterm title
7199 dnl ========================================================
7200 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7201 [ --enable-xterm-updates Update XTERM titles with current command.],
7205 dnl =========================================================
7207 dnl =========================================================
7208 MOZ_ARG_ENABLE_STRING([chrome-format],
7209 [ --enable-chrome-format=jar|flat|both|symlink
7210 Select FORMAT of chrome files (default=jar)],
7211 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7213 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7214 MOZ_CHROME_FILE_FORMAT=jar
7217 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7218 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7219 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7220 test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7221 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7224 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7225 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7227 dnl ========================================================
7228 dnl = Define default location for MOZILLA_FIVE_HOME
7229 dnl ========================================================
7230 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7231 [ --with-default-mozilla-five-home
7232 Set the default value for MOZILLA_FIVE_HOME],
7233 [ val=`echo $withval`
7234 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7236 dnl ========================================================
7237 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7238 dnl ========================================================
7239 MOZ_ARG_WITH_STRING(user-appdir,
7240 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7241 [ val=`echo $withval`
7242 if echo "$val" | grep "\/" >/dev/null; then
7243 AC_MSG_ERROR("Homedir must be single relative path.")
7248 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7250 dnl ========================================================
7251 dnl = Doxygen configuration
7252 dnl ========================================================
7253 dnl Use commas to specify multiple dirs to this arg
7254 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7255 MOZ_ARG_WITH_STRING(doc-input-dirs,
7256 [ --with-doc-input-dirs=DIRS
7257 Header/idl dirs to create docs from],
7258 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7259 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7261 dnl Use commas to specify multiple dirs to this arg
7262 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7263 MOZ_ARG_WITH_STRING(doc-include-dirs,
7264 [ --with-doc-include-dirs=DIRS
7265 Include dirs to preprocess doc headers],
7266 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7267 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7269 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7270 MOZ_ARG_WITH_STRING(doc-output-dir,
7271 [ --with-doc-output-dir=DIR
7272 Dir to generate docs into],
7273 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7274 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7276 if test -z "$SKIP_COMPILER_CHECKS"; then
7277 dnl ========================================================
7279 dnl = Compiler Options
7281 dnl ========================================================
7282 MOZ_ARG_HEADER(Compiler Options)
7284 dnl ========================================================
7285 dnl Check for gcc -pipe support
7286 dnl ========================================================
7287 AC_MSG_CHECKING([for gcc -pipe support])
7288 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7289 echo '#include <stdio.h>' > dummy-hello.c
7290 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7291 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7292 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7293 if test $? = 0; then
7298 if test "$_res_as_stdin" = "yes"; then
7299 _SAVE_CFLAGS=$CFLAGS
7300 CFLAGS="$CFLAGS -pipe"
7301 AC_TRY_COMPILE( [ #include <stdio.h> ],
7302 [printf("Hello World\n");],
7303 [_res_gcc_pipe="yes"],
7304 [_res_gcc_pipe="no"] )
7305 CFLAGS=$_SAVE_CFLAGS
7307 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7309 CFLAGS="$CFLAGS -pipe"
7310 CXXFLAGS="$CXXFLAGS -pipe"
7314 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7315 AC_MSG_RESULT([$_res])
7320 dnl pass -Wno-long-long to the compiler
7321 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7322 [ --enable-long-long-warning
7323 Warn about use of non-ANSI long long type],
7324 _IGNORE_LONG_LONG_WARNINGS=,
7325 _IGNORE_LONG_LONG_WARNINGS=1)
7327 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7328 _SAVE_CFLAGS="$CFLAGS"
7329 CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7330 AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7331 AC_TRY_COMPILE([], [return(0);],
7332 [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7333 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7334 result="yes" ], result="no")
7335 AC_MSG_RESULT([$result])
7336 CFLAGS="$_SAVE_CFLAGS"
7339 dnl ========================================================
7340 dnl Profile guided optimization
7341 dnl ========================================================
7342 dnl Test for profiling options
7343 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7344 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7346 dnl Provide a switch to disable PGO even when called via profiledbuild.
7347 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7348 [ --disable-profile-guided-optimization
7349 Don't build with PGO even if called via make profiledbuild],
7350 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7351 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7353 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7355 _SAVE_CFLAGS="$CFLAGS"
7356 CFLAGS="$CFLAGS -fprofile-generate"
7358 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7359 AC_TRY_COMPILE([], [return 0;],
7360 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7361 result="yes" ], result="no")
7362 AC_MSG_RESULT([$result])
7364 if test $result = "yes"; then
7365 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7366 PROFILE_USE_CFLAGS="-fprofile-use"
7367 PROFILE_USE_LDFLAGS="-fprofile-use"
7369 CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7370 AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7371 AC_TRY_COMPILE([], [return 0;],
7372 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7373 result="yes" ], result="no")
7374 AC_MSG_RESULT([$result])
7375 if test $result = "yes"; then
7376 PROFILE_USE_CFLAGS="-fbranch-probabilities"
7378 # don't really care, this is an old GCC
7379 PROFILE_GEN_LDFLAGS=
7380 PROFILE_USE_LDFLAGS=
7383 CFLAGS="$_SAVE_CFLAGS"
7385 if test -n "$INTEL_CC"; then
7386 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7387 PROFILE_GEN_LDFLAGS=
7388 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7389 PROFILE_USE_LDFLAGS=
7392 dnl Sun Studio on Solaris
7393 if test "$SOLARIS_SUNPRO_CC"; then
7394 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7395 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7396 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7397 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7400 AC_SUBST(PROFILE_GEN_CFLAGS)
7401 AC_SUBST(PROFILE_GEN_LDFLAGS)
7402 AC_SUBST(PROFILE_USE_CFLAGS)
7403 AC_SUBST(PROFILE_USE_LDFLAGS)
7407 dnl ========================================================
7408 dnl Test for -pedantic bustage
7409 dnl ========================================================
7410 MOZ_ARG_DISABLE_BOOL(pedantic,
7411 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7413 if test "$_PEDANTIC"; then
7414 _SAVE_CXXFLAGS=$CXXFLAGS
7415 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7416 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7417 AC_TRY_COMPILE([$configure_static_assert_macros],
7418 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7419 result="no", result="yes" )
7420 AC_MSG_RESULT([$result])
7421 CXXFLAGS="$_SAVE_CXXFLAGS"
7425 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7426 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7429 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7434 dnl ========================================================
7435 dnl Test for correct temporary object destruction order
7436 dnl ========================================================
7437 dnl We want to make sure the compiler follows the C++ spec here as
7438 dnl xpcom and the string classes depend on it (bug 235381).
7439 AC_MSG_CHECKING([for correct temporary object destruction order])
7440 AC_TRY_RUN([ class A {
7441 public: A(int& x) : mValue(x) {}
7443 operator char**() { return 0; }
7444 private: int& mValue;
7446 void func(char **arg) {}
7457 result="yes", result="no", result="maybe")
7458 AC_MSG_RESULT([$result])
7460 if test "$result" = "no"; then
7461 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7464 dnl ========================================================
7465 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7466 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7467 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7468 dnl ========================================================
7469 _SAVE_CXXFLAGS=$CXXFLAGS
7470 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7471 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7472 ac_nscap_nonconst_opeq_bug,
7481 template <class T, class U>
7482 int operator==(const Pointer<T>& rhs, U* lhs)
7484 return rhs.myPtr == lhs;
7487 template <class T, class U>
7488 int operator==(const Pointer<T>& rhs, const U* lhs)
7490 return rhs.myPtr == lhs;
7498 ac_nscap_nonconst_opeq_bug="no",
7499 ac_nscap_nonconst_opeq_bug="yes")])
7500 CXXFLAGS="$_SAVE_CXXFLAGS"
7502 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7503 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7505 fi # SKIP_COMPILER_CHECKS
7507 dnl ========================================================
7509 dnl Should be smarter and check that the compiler does indeed have rtti
7510 dnl ========================================================
7512 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7513 [ --enable-cpp-rtti Enable C++ RTTI ],
7514 [ _MOZ_USE_RTTI=1 ],
7517 if test "$_MOZ_USE_RTTI"; then
7518 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7520 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7523 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7525 dnl ========================================================
7526 dnl C++ exceptions (g++/egcs only - for now)
7527 dnl Should be smarter and check that the compiler does indeed have exceptions
7528 dnl ========================================================
7529 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7530 [ --enable-cpp-exceptions Enable C++ exceptions ],
7531 [ _MOZ_CPP_EXCEPTIONS=1 ],
7532 [ _MOZ_CPP_EXCEPTIONS= ])
7534 if test "$_MOZ_CPP_EXCEPTIONS"; then
7535 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7537 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7540 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7542 # Irix & OSF native compilers do not like exception declarations
7543 # when exceptions are disabled
7544 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7545 AC_DEFINE(CPP_THROW_NEW, [])
7547 AC_DEFINE(CPP_THROW_NEW, [throw()])
7551 dnl ========================================================
7553 dnl = Build depencency options
7555 dnl ========================================================
7556 MOZ_ARG_HEADER(Build dependencies)
7558 dnl ========================================================
7559 dnl = Do not auto generate dependency info
7560 dnl ========================================================
7562 MOZ_ARG_DISABLE_BOOL(auto-deps,
7563 [ --disable-auto-deps Do not automatically generate dependency info],
7567 if test -n "$MOZ_AUTO_DEPS"; then
7568 dnl ========================================================
7569 dnl = Use mkdepend instead of $CC -MD for dependency generation
7570 dnl ========================================================
7572 MOZ_ARG_DISABLE_BOOL(md,
7573 [ --disable-md Do not use compiler-based dependencies ],
7576 [dnl Default is to turn on -MD if using GNU-compatible compilers
7577 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7580 dnl Default is to use -xM if using Sun Studio on Solaris
7581 if test "$SOLARIS_SUNPRO_CC"; then
7584 if test "$_cpp_md_flag"; then
7586 if test "$OS_ARCH" = "OpenVMS"; then
7587 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7589 _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7591 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7592 if test "$SOLARIS_SUNPRO_CC"; then
7597 dnl Don't override this for MSVC
7598 if test -z "$_WIN32_MSVC"; then
7599 _USE_CPP_INCLUDE_FLAG=
7600 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7601 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7606 AC_SUBST(MOZ_AUTO_DEPS)
7607 AC_SUBST(COMPILER_DEPEND)
7611 dnl ========================================================
7613 dnl = Static Build Options
7615 dnl ========================================================
7616 MOZ_ARG_HEADER(Static build options)
7618 MOZ_ARG_ENABLE_BOOL(static,
7619 [ --enable-static Enable building of internal static libs],
7620 BUILD_STATIC_LIBS=1,
7623 MOZ_ARG_ENABLE_BOOL(libxul,
7624 [ --enable-libxul Enable building of libxul],
7625 MOZ_ENABLE_LIBXUL=1,
7628 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7629 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7632 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7633 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7636 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7637 AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7640 AC_SUBST(LIBXUL_LIBS)
7642 if test -n "$MOZ_ENABLE_LIBXUL"; then
7643 XPCOM_LIBS="$LIBXUL_LIBS"
7644 AC_DEFINE(MOZ_ENABLE_LIBXUL)
7646 if test -n "$BUILD_STATIC_LIBS"; then
7647 AC_DEFINE(MOZ_STATIC_BUILD)
7649 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7652 dnl ========================================================
7654 dnl = Standalone module options
7656 dnl ========================================================
7657 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7659 dnl Check for GLib and libIDL.
7660 dnl ========================================================
7661 case "$target_os" in
7662 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7663 SKIP_IDL_CHECK="yes"
7670 if test -z "$COMPILE_ENVIRONMENT"; then
7671 SKIP_IDL_CHECK="yes"
7674 dnl = Allow users to disable libIDL checking for standalone modules
7675 MOZ_ARG_WITHOUT_BOOL(libIDL,
7676 [ --without-libIDL Skip check for libIDL (standalone modules only)],
7677 SKIP_IDL_CHECK="yes")
7679 if test "$SKIP_IDL_CHECK" = "no"
7682 if test "$MACOS_SDK_DIR"; then
7683 dnl xpidl, and therefore libIDL, is only needed on the build host.
7684 dnl Don't build it against the SDK, as that causes problems.
7685 _MACSAVE_CFLAGS="$CFLAGS"
7686 _MACSAVE_LIBS="$LIBS"
7687 _MACSAVE_LDFLAGS="$LDFLAGS"
7688 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7690 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"`
7691 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7692 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7697 if test "$MOZ_ENABLE_GTK2"; then
7698 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7700 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7701 dnl to either libIDL1 or libIDL2.
7702 if test -z "$_LIBIDL_FOUND"; then
7703 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7704 if test -z "$_LIBIDL_FOUND"; then
7705 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7709 dnl If we don't have a libIDL config program & not cross-compiling,
7710 dnl look for orbit-config instead.
7712 if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7713 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7714 if test -n "$ORBIT_CONFIG"; then
7715 AC_MSG_CHECKING([for ORBit libIDL usability])
7716 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7717 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7718 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7719 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7720 LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7721 LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7723 _SAVE_CFLAGS="$CFLAGS"
7725 CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7726 LIBS="$LIBIDL_LIBS $LIBS"
7729 #include <libIDL/IDL.h>
7732 s=strdup(IDL_get_libver_string());
7745 AC_MSG_RESULT($result)
7746 CFLAGS="$_SAVE_CFLAGS"
7750 if test -z "$_LIBIDL_FOUND"; then
7751 AC_MSG_ERROR([libIDL not found.
7752 libIDL $LIBIDL_VERSION or higher is required.])
7754 if test "$MACOS_SDK_DIR"; then
7755 CFLAGS="$_MACSAVE_CFLAGS"
7756 LIBS="$_MACSAVE_LIBS"
7757 LDFLAGS="$_MACSAVE_LDFLAGS"
7758 if test -n "$_MACSAVE_NEXT_ROOT" ; then
7759 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7764 if test -n "$CROSS_COMPILE"; then
7765 if test -z "$HOST_LIBIDL_CONFIG"; then
7766 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7768 if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7769 HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7770 HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7772 HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7773 HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7777 if test -z "$SKIP_PATH_CHECKS"; then
7778 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7779 if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7780 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7782 AM_PATH_GLIB(${GLIB_VERSION})
7787 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7788 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7791 AC_SUBST(LIBIDL_CFLAGS)
7792 AC_SUBST(LIBIDL_LIBS)
7793 AC_SUBST(STATIC_LIBIDL)
7794 AC_SUBST(GLIB_CFLAGS)
7796 AC_SUBST(GLIB_GMODULE_LIBS)
7797 AC_SUBST(HOST_LIBIDL_CONFIG)
7798 AC_SUBST(HOST_LIBIDL_CFLAGS)
7799 AC_SUBST(HOST_LIBIDL_LIBS)
7801 dnl ========================================================
7803 dnl ========================================================
7804 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7807 MOZ_ARG_ENABLE_BOOL(system-cairo,
7808 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7812 # Check for headers defining standard int types.
7813 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7815 if test "$MOZ_TREE_CAIRO"; then
7816 AC_DEFINE(MOZ_TREE_CAIRO)
7818 # For now we assume that we will have a uint64_t available through
7819 # one of the above headers or mozstdint.h.
7820 AC_DEFINE(HAVE_UINT64_T)
7822 # Define macros for cairo-features.h
7823 if test "$MOZ_X11"; then
7824 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7825 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7826 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7827 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7828 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7829 MOZ_ENABLE_CAIRO_FT=1
7830 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7832 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7833 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7835 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7836 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7837 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7838 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7840 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7841 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7842 if test -z "$WINCE"; then
7843 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7844 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7845 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7846 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7847 MOZ_ENABLE_D2D_SURFACE=1
7848 MOZ_ENABLE_DWRITE_FONT=1
7850 WIN32_DWRITE_FONT_FEATURE=
7851 WIN32_D2D_SURFACE_FEATURE=
7855 WIN32_DWRITE_FONT_FEATURE=
7856 WIN32_D2D_SURFACE_FEATURE=
7859 AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7860 if test -z "$HAS_DDRAW"; then
7861 AC_MSG_WARN([DirectDraw ddraw.h header not found or it's missing DDLOCK_WAITNOTBUSY, disabling DirectDraw surface. If you have an older SDK (such as the CE5 SDK), try copying in ddraw.lib and ddraw.h from the WM6 SDK.])
7862 DDRAW_SURFACE_FEATURE=
7864 DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7867 if test -z "$OGLES_SDK_DIR"; then
7868 OGLES_SURFACE_FEATURE=
7871 #include <EGL/egl.h>
7872 #include <EGL/eglext.h>
7873 #include <GLES2/gl2.h>
7874 #include <GLES2/gl2ext.h>
7875 ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7876 if test -z "$HAS_OGLES"; then
7877 AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7878 OGLES_SURFACE_FEATURE=
7880 OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7884 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7886 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7887 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7888 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7889 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7890 MOZ_ENABLE_CAIRO_FT=1
7891 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7892 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7894 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7895 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7896 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7897 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7898 MOZ_ENABLE_CAIRO_FT=1
7900 if test "$USE_FC_FREETYPE"; then
7901 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7903 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7904 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7905 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7906 AC_SUBST(CAIRO_FT_CFLAGS)
7909 if test "$MOZ_DEBUG"; then
7910 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7912 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7915 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7917 AC_SUBST(PS_SURFACE_FEATURE)
7918 AC_SUBST(PDF_SURFACE_FEATURE)
7919 AC_SUBST(SVG_SURFACE_FEATURE)
7920 AC_SUBST(XLIB_SURFACE_FEATURE)
7921 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7922 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7923 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7924 AC_SUBST(XCB_SURFACE_FEATURE)
7925 AC_SUBST(WIN32_SURFACE_FEATURE)
7926 AC_SUBST(DDRAW_SURFACE_FEATURE)
7927 AC_SUBST(OGLES_SURFACE_FEATURE)
7928 AC_SUBST(OS2_SURFACE_FEATURE)
7929 AC_SUBST(BEOS_SURFACE_FEATURE)
7930 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7931 AC_SUBST(FT_FONT_FEATURE)
7932 AC_SUBST(FC_FONT_FEATURE)
7933 AC_SUBST(WIN32_FONT_FEATURE)
7934 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7935 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7936 AC_SUBST(QUARTZ_FONT_FEATURE)
7937 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7938 AC_SUBST(QT_SURFACE_FEATURE)
7940 if test "$_WIN32_MSVC"; then
7941 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7943 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
7945 if test "$MOZ_X11"; then
7946 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7950 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7951 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7954 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
7955 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7956 MOZ_CAIRO_LIBS=$CAIRO_LIBS
7957 if test "$MOZ_X11"; then
7958 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7959 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7960 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7964 AC_SUBST(MOZ_TREE_CAIRO)
7965 AC_SUBST(MOZ_CAIRO_CFLAGS)
7966 AC_SUBST(MOZ_CAIRO_LIBS)
7969 dnl ========================================================
7971 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7974 dnl ========================================================
7976 dnl ========================================================
7977 MOZ_ARG_DISABLE_BOOL(xul,
7978 [ --disable-xul Disable XUL],
7980 if test "$MOZ_XUL"; then
7983 dnl remove extensions that require XUL
7984 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7989 dnl ========================================================
7990 dnl disable profile locking
7991 dnl do no use this in applications that can have more than
7992 dnl one process accessing the profile directory.
7993 dnl ========================================================
7994 MOZ_ARG_DISABLE_BOOL(profilelocking,
7995 [ --disable-profilelocking Disable profile locking],
7996 MOZ_PROFILELOCKING=,
7997 MOZ_PROFILELOCKING=1 )
7998 if test "$MOZ_PROFILELOCKING"; then
7999 AC_DEFINE(MOZ_PROFILELOCKING)
8002 dnl ========================================================
8003 dnl disable rdf services
8004 dnl ========================================================
8005 MOZ_ARG_DISABLE_BOOL(rdf,
8006 [ --disable-rdf Disable RDF],
8008 if test "$MOZ_RDF"; then
8014 dnl ========================================================
8015 dnl necko configuration options
8016 dnl ========================================================
8019 dnl option to disable various necko protocols
8021 MOZ_ARG_ENABLE_STRING(necko-protocols,
8022 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8023 Enable/disable specific protocol handlers],
8024 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8025 if test "$option" = "yes" || test "$option" = "all"; then
8026 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8027 elif test "$option" = "no" || test "$option" = "none"; then
8029 elif test "$option" = "default"; then
8030 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8031 elif test `echo "$option" | grep -c \^-` != 0; then
8032 option=`echo $option | sed 's/^-//'`
8033 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8035 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8038 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8040 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8041 AC_SUBST(NECKO_PROTOCOLS)
8042 for p in $NECKO_PROTOCOLS; do
8043 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8047 dnl option to disable necko's disk cache
8049 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8050 [ --disable-necko-disk-cache
8051 Disable necko disk cache],
8054 AC_SUBST(NECKO_DISK_CACHE)
8055 if test "$NECKO_DISK_CACHE"; then
8056 AC_DEFINE(NECKO_DISK_CACHE)
8060 dnl option to disable necko's wifi scanner
8062 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8063 [ --disable-necko-wifi Disable necko wifi scanner],
8068 if test "$OS_ARCH" = "OS2"; then
8069 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8072 if test "$NECKO_WIFI" -a \
8073 "$OS_ARCH" != "Linux" -a \
8074 "$OS_ARCH" != "Darwin" -a \
8075 "$OS_ARCH" != "SunOS" -a \
8076 "$OS_ARCH" != "WINNT" -a \
8077 "$OS_ARCH" != "WINCE"; then
8078 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8081 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8083 AC_CHECK_HEADER([iwlib.h])
8084 if test "$ac_cv_header_iwlib_h" != "yes"; then
8085 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)); use --disable-necko-wifi to disable])
8089 if test "$NECKO_WIFI"; then
8090 AC_DEFINE(NECKO_WIFI)
8092 AC_SUBST(NECKO_WIFI)
8095 dnl option to minimize size of necko's i/o buffers
8097 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
8098 [ --enable-necko-small-buffers
8099 Minimize size of necko's i/o buffers],
8100 NECKO_SMALL_BUFFERS=1,
8101 NECKO_SMALL_BUFFERS=)
8102 AC_SUBST(NECKO_SMALL_BUFFERS)
8103 if test "$NECKO_SMALL_BUFFERS"; then
8104 AC_DEFINE(NECKO_SMALL_BUFFERS)
8108 dnl option to disable cookies
8110 MOZ_ARG_DISABLE_BOOL(cookies,
8111 [ --disable-cookies Disable cookie support],
8114 AC_SUBST(NECKO_COOKIES)
8115 if test "$NECKO_COOKIES"; then
8116 AC_DEFINE(NECKO_COOKIES)
8120 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8122 MOZ_ARG_DISABLE_BOOL(ctypes,
8123 [ --disable-ctypes Disable js-ctypes],
8126 AC_SUBST(BUILD_CTYPES)
8127 if test "$BUILD_CTYPES"; then
8128 if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8129 # Disable ctypes for arm/wince.
8131 elif test "$_MSC_VER" && test -z $AS; then
8132 # Disable ctypes if we're on MSVC and MASM is unavailable.
8133 AC_MSG_ERROR([No suitable assembler found. An assembler is required to build js-ctypes. You may --disable-ctypes to avoid this. If you are building with MS Visual Studio 8 Express, you may download the MASM 8.0 package, upgrade to Visual Studio 9 Express, or install the Vista SDK.])
8135 AC_DEFINE(BUILD_CTYPES)
8139 dnl NECKO_ configuration options are not global
8140 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8142 dnl Only build Mork if it's required
8144 if test "$MOZ_MORK"; then
8148 dnl Build the lightweight Mork reader if required
8149 AC_SUBST(MOZ_MORKREADER)
8150 if test "$MOZ_MORKREADER"; then
8151 AC_DEFINE(MOZ_MORKREADER)
8154 dnl ========================================================
8155 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8156 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8159 dnl ========================================================
8161 dnl = Maintainer debug option (no --enable equivalent)
8163 dnl ========================================================
8168 AC_SUBST(AR_EXTRACT)
8172 AC_SUBST(AS_DASH_C_FLAG)
8180 AC_SUBST(NS_USE_NATIVE)
8181 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8182 AC_SUBST(MOZ_UPDATE_XTERM)
8184 AC_SUBST(MOZ_PLATFORM_MAEMO)
8185 AC_SUBST(MOZ_AUTH_EXTENSION)
8186 AC_SUBST(MOZ_MATHML)
8187 AC_SUBST(MOZ_PERMISSIONS)
8189 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8190 AC_SUBST(MOZ_PREF_EXTENSIONS)
8193 AC_SUBST(MOZ_XSLT_STANDALONE)
8194 AC_SUBST(MOZ_JS_LIBS)
8197 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8198 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8199 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8200 AC_SUBST(MOZ_DEBUG_FLAGS)
8201 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8202 AC_SUBST(WARNINGS_AS_ERRORS)
8203 AC_SUBST(MOZ_EXTENSIONS)
8204 AC_SUBST(MOZ_IMG_DECODERS)
8205 AC_SUBST(MOZ_IMG_ENCODERS)
8206 AC_SUBST(MOZ_JSDEBUGGER)
8207 AC_SUBST(MOZ_PLUGINS)
8208 AC_SUBST(MOZ_LOG_REFCNT)
8212 AC_SUBST(MOZ_CALLGRIND)
8214 AC_SUBST(MOZ_XPCTOOLS)
8215 AC_SUBST(MOZ_JSLOADER)
8216 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8217 AC_SUBST(MOZ_QUANTIFY)
8219 AC_SUBST(MOZ_PLACES)
8220 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8221 AC_SUBST(MOZ_STORAGE)
8222 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8224 AC_SUBST(NS_PRINTING)
8226 AC_SUBST(MOZ_HELP_VIEWER)
8228 AC_SUBST(MOZ_JAVAXPCOM)
8229 AC_SUBST(JAVA_INCLUDE_PATH)
8234 AC_SUBST(MOZ_PROFILELOCKING)
8237 AC_SUBST(MOZ_XIE_LIBS)
8238 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8240 AC_SUBST(BUILD_STATIC_LIBS)
8241 AC_SUBST(MOZ_ENABLE_LIBXUL)
8242 AC_SUBST(ENABLE_TESTS)
8244 AC_SUBST(MOZ_UNIVERSALCHARDET)
8245 AC_SUBST(ACCESSIBILITY)
8246 AC_SUBST(MOZ_XPINSTALL)
8247 AC_SUBST(MOZ_VIEW_SOURCE)
8248 AC_SUBST(MOZ_SPELLCHECK)
8249 AC_SUBST(MOZ_USER_DIR)
8250 AC_SUBST(MOZ_CRASHREPORTER)
8252 AC_SUBST(ENABLE_STRIP)
8253 AC_SUBST(PKG_SKIP_STRIP)
8254 AC_SUBST(USE_ELF_DYNSTR_GC)
8255 AC_SUBST(INCREMENTAL_LINKER)
8256 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8257 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8259 AC_SUBST(MOZ_FIX_LINK_PATHS)
8260 AC_SUBST(XPCOM_LIBS)
8261 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8262 AC_SUBST(XPCOM_GLUE_LDOPTS)
8263 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8265 AC_SUBST(USE_DEPENDENT_LIBS)
8267 AC_SUBST(MOZ_BUILD_ROOT)
8268 AC_SUBST(MOZ_OS2_TOOLS)
8269 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8271 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8272 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8273 AC_SUBST(MOZ_TIMELINE)
8274 AC_SUBST(OGLES_SDK_DIR)
8276 AC_SUBST(MOZ_APP_NAME)
8277 AC_SUBST(MOZ_APP_DISPLAYNAME)
8278 AC_SUBST(MOZ_APP_VERSION)
8279 AC_SUBST(MOZ_APP_UA_EXTRA)
8280 AC_SUBST(FIREFOX_VERSION)
8282 AC_SUBST(MOZ_PKG_SPECIAL)
8284 AC_SUBST(MOZILLA_OFFICIAL)
8287 AC_SUBST(MOZ_MAPINFO)
8288 AC_SUBST(MOZ_BROWSE_INFO)
8289 AC_SUBST(MOZ_TOOLS_DIR)
8290 AC_SUBST(CYGWIN_WRAPPER)
8292 AC_SUBST(WIN32_REDIST_DIR)
8296 AC_SUBST(WINCE_SDK_DIR)
8297 AC_SUBST(WINCE_WINDOWS_MOBILE)
8299 dnl Echo the CFLAGS to remove extra whitespace.
8306 $_MOZ_EXCEPTIONS_FLAGS \
8307 $_WARNINGS_CXXFLAGS \
8310 COMPILE_CFLAGS=`echo \
8315 COMPILE_CXXFLAGS=`echo \
8316 $_DEFINES_CXXFLAGS \
8320 AC_SUBST(SYSTEM_MAKEDEPEND)
8321 AC_SUBST(SYSTEM_LIBXUL)
8322 AC_SUBST(SYSTEM_JPEG)
8323 AC_SUBST(SYSTEM_PNG)
8324 AC_SUBST(SYSTEM_ZLIB)
8325 AC_SUBST(SYSTEM_BZ2)
8327 AC_SUBST(JPEG_CFLAGS)
8329 AC_SUBST(ZLIB_CFLAGS)
8331 AC_SUBST(BZ2_CFLAGS)
8333 AC_SUBST(PNG_CFLAGS)
8336 AC_SUBST(MOZ_JPEG_CFLAGS)
8337 AC_SUBST(MOZ_JPEG_LIBS)
8338 AC_SUBST(MOZ_ZLIB_CFLAGS)
8339 AC_SUBST(MOZ_ZLIB_LIBS)
8340 AC_SUBST(MOZ_BZ2_CFLAGS)
8341 AC_SUBST(MOZ_BZ2_LIBS)
8342 AC_SUBST(MOZ_PNG_CFLAGS)
8343 AC_SUBST(MOZ_PNG_LIBS)
8345 AC_SUBST(NSPR_CFLAGS)
8347 AC_SUBST(MOZ_NATIVE_NSPR)
8349 AC_SUBST(NSS_CFLAGS)
8351 AC_SUBST(NSS_DEP_LIBS)
8352 AC_SUBST(MOZ_NATIVE_NSS)
8353 AC_SUBST(NSS_DISABLE_DBM)
8358 AC_SUBST(COMPILE_CFLAGS)
8359 AC_SUBST(COMPILE_CXXFLAGS)
8362 AC_SUBST(CROSS_COMPILE)
8363 AC_SUBST(WCHAR_CFLAGS)
8367 AC_SUBST(HOST_CFLAGS)
8368 AC_SUBST(HOST_CXXFLAGS)
8369 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8371 AC_SUBST(HOST_AR_FLAGS)
8373 AC_SUBST(HOST_RANLIB)
8374 AC_SUBST(HOST_NSPR_MDCPUCFG)
8375 AC_SUBST(HOST_BIN_SUFFIX)
8376 AC_SUBST(HOST_OS_ARCH)
8378 AC_SUBST(TARGET_CPU)
8379 AC_SUBST(TARGET_VENDOR)
8381 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8382 AC_SUBST(TARGET_MD_ARCH)
8383 AC_SUBST(TARGET_XPCOM_ABI)
8386 AC_SUBST(OS_RELEASE)
8389 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8390 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8392 AC_SUBST(WRAP_MALLOC_CFLAGS)
8393 AC_SUBST(WRAP_MALLOC_LIB)
8396 AC_SUBST(MKSHLIB_FORCE_ALL)
8397 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8398 AC_SUBST(DSO_CFLAGS)
8399 AC_SUBST(DSO_PIC_CFLAGS)
8400 AC_SUBST(DSO_LDOPTS)
8401 AC_SUBST(LIB_PREFIX)
8402 AC_SUBST(DLL_PREFIX)
8403 AC_SUBST(DLL_SUFFIX)
8404 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8405 AC_SUBST(LIB_SUFFIX)
8406 AC_SUBST(OBJ_SUFFIX)
8407 AC_SUBST(BIN_SUFFIX)
8408 AC_SUBST(ASM_SUFFIX)
8409 AC_SUBST(IMPORT_LIB_SUFFIX)
8411 AC_SUBST(CC_VERSION)
8412 AC_SUBST(CXX_VERSION)
8413 AC_SUBST(MSMANIFEST_TOOL)
8414 AC_SUBST(NS_ENABLE_TSF)
8415 AC_SUBST(MOZ_NSS_PATCH)
8417 if test "$USING_HCC"; then
8418 CC='${topsrcdir}/build/hcc'
8420 CXX='${topsrcdir}/build/hcpp'
8421 CXX="$CXX '$_OLDCXX'"
8426 dnl Check for missing components
8427 if test "$COMPILE_ENVIRONMENT"; then
8428 if test "$MOZ_X11"; then
8429 dnl ====================================================
8430 dnl = Check if X headers exist
8431 dnl ====================================================
8432 _SAVE_CFLAGS=$CFLAGS
8433 CFLAGS="$CFLAGS $XCFLAGS"
8437 #include <X11/Xlib.h>
8438 #include <X11/Intrinsic.h>
8442 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8443 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8447 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8448 CFLAGS="$_SAVE_CFLAGS"
8450 if test ! -z "$MISSING_X"; then
8451 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8456 dnl Check for headers, etc. needed by WebGL.
8457 if test -n "$MOZ_WEBGL_GLX"; then
8458 AC_CHECK_HEADER(GL/glx.h)
8459 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8460 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8463 fi # COMPILE_ENVIRONMENT
8465 if test "$USE_FC_FREETYPE"; then
8466 if test "$COMPILE_ENVIRONMENT"; then
8467 _SAVE_CPPFLAGS="$CPPFLAGS"
8468 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8469 AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
8470 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8471 CPPFLAGS="$_SAVE_CPPFLAGS"
8473 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8477 dnl Set various defines and substitutions
8478 dnl ========================================================
8480 if test "$OS_ARCH" = "BeOS"; then
8482 elif test "$OS_ARCH" = "Darwin"; then
8484 AC_DEFINE(UNIX_ASYNC_DNS)
8485 elif test "$OS_ARCH" = "OpenVMS"; then
8487 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8489 AC_DEFINE(UNIX_ASYNC_DNS)
8492 if test "$MOZ_DEBUG"; then
8493 AC_DEFINE(MOZ_REFLOW_PERF)
8494 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8497 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8498 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8499 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8500 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8501 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8502 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8503 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8504 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8505 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8508 dnl ========================================================
8509 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8510 dnl ========================================================
8513 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8516 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8517 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8518 CC="\$(CYGWIN_WRAPPER) $CC"
8519 CXX="\$(CYGWIN_WRAPPER) $CXX"
8520 CPP="\$(CYGWIN_WRAPPER) $CPP"
8521 LD="\$(CYGWIN_WRAPPER) $LD"
8522 AS="\$(CYGWIN_WRAPPER) $AS"
8523 RC="\$(CYGWIN_WRAPPER) $RC"
8524 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8525 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8526 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8530 AC_SUBST(CYGDRIVE_MOUNT)
8531 AC_SUBST(WIN_TOP_SRC)
8533 AC_SUBST(MOZILLA_VERSION)
8535 AC_SUBST(ac_configure_args)
8537 dnl Spit out some output
8538 dnl ========================================================
8540 dnl The following defines are used by xpcom
8541 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8543 HAVE_CPP_2BYTE_WCHAR_T
8544 HAVE_CPP_ACCESS_CHANGING_USING
8545 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8548 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8550 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8551 HAVE_CPP_NAMESPACE_STD
8553 HAVE_CPP_PARTIAL_SPECIALIZATION
8554 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8556 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8558 NEED_CPP_UNUSED_IMPLEMENTATIONS
8562 HAVE_ICONV_WITH_CONST_INPUT
8570 netwerk/necko-config.h
8571 xpcom/xpcom-config.h
8572 xpcom/xpcom-private.h
8575 # Save the defines header file before autoconf removes it.
8576 # (Do not add AC_DEFINE calls after this line.)
8577 _CONFIG_TMP=confdefs-tmp.h
8578 _CONFIG_DEFS_H=mozilla-config.h
8580 cat > $_CONFIG_TMP <<\EOF
8581 /* List of defines generated by configure. Included with preprocessor flag,
8582 * -include, to avoid long list of -D defines on the compile command-line.
8586 #ifndef _MOZILLA_CONFIG_H_
8587 #define _MOZILLA_CONFIG_H_
8590 _EGREP_PATTERN='^#define ('
8591 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8592 for f in $_NON_GLOBAL_ACDEFINES; do
8593 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8596 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8598 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8600 cat >> $_CONFIG_TMP <<\EOF
8602 #endif /* _MOZILLA_CONFIG_H_ */
8606 # Only write mozilla-config.h when something changes (or it doesn't exist)
8607 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8610 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8611 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8613 echo ==== $_CONFIG_DEFS_H =================================
8617 dnl Probably shouldn't call this manually but we always want the output of DEFS
8618 rm -f confdefs.h.save
8619 mv confdefs.h confdefs.h.save
8620 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8621 AC_OUTPUT_MAKE_DEFS()
8623 AC_SUBST(MOZ_DEFINES)
8625 mv confdefs.h.save confdefs.h
8627 dnl Load the list of Makefiles to generate.
8628 dnl To add new Makefiles, edit allmakefiles.sh.
8629 dnl allmakefiles.sh sets the variable, MAKEFILES.
8630 . ${srcdir}/allmakefiles.sh
8632 dnl Run a perl script to quickly create the makefiles.
8633 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8634 dnl for the files it cannot handle correctly. This way, config.status
8635 dnl will handle these files.
8636 dnl If it fails, nothing is set and config.status will run as usual.
8638 dnl This does not change the $MAKEFILES variable.
8640 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8642 if test -z "${AS_PERL}"; then
8643 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8645 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8650 echo $MAKEFILES > unallmakefiles
8652 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8654 AC_OUTPUT($MAKEFILES)
8656 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8657 if test "$CAIRO_FEATURES_H"; then
8658 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8659 echo "$CAIRO_FEATURES_H is unchanged"
8660 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8662 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8666 dnl ========================================================
8667 dnl = Setup a nice relatively clean build environment for
8668 dnl = sub-configures.
8669 dnl ========================================================
8672 CFLAGS="$_SUBDIR_CFLAGS"
8673 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8674 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8675 LDFLAGS="$_SUBDIR_LDFLAGS"
8676 HOST_CC="$_SUBDIR_HOST_CC"
8677 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8678 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8684 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8685 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8687 if test -z "$MOZ_NATIVE_NSPR"; then
8688 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8689 if test -z "$MOZ_DEBUG"; then
8690 ac_configure_args="$ac_configure_args --disable-debug"
8692 if test "$MOZ_OPTIMIZE" = "1"; then
8693 ac_configure_args="$ac_configure_args --enable-optimize"
8695 if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8696 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8698 if test -n "$HAVE_64BIT_OS"; then
8699 ac_configure_args="$ac_configure_args --enable-64bit"
8701 if test -n "$USE_ARM_KUSER"; then
8702 ac_configure_args="$ac_configure_args --with-arm-kuser"
8704 AC_OUTPUT_SUBDIRS(nsprpub)
8705 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8708 if test -z "$MOZ_NATIVE_NSPR"; then
8709 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8710 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8711 if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8712 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8713 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8714 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8715 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8717 rm -f config/autoconf.mk.bak
8720 # Run the SpiderMonkey 'configure' script.
8721 dist=$MOZ_BUILD_ROOT/dist
8722 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8723 ac_configure_args="$ac_configure_args --enable-threadsafe"
8724 if test -z "$MOZ_NATIVE_NSPR"; then
8725 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8726 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8728 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8729 ac_configure_args="$ac_configure_args --prefix=$dist"
8730 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8731 if test "$MOZ_MEMORY"; then
8732 ac_configure_args="$ac_configure_args --enable-jemalloc"
8733 if test -n "$MOZ_MEMORY_LDFLAGS"; then
8734 export MOZ_MEMORY_LDFLAGS
8737 AC_OUTPUT_SUBDIRS(js/src)
8738 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8740 # Build jsctypes on the platforms we can.
8741 if test "$BUILD_CTYPES"; then
8742 # Run the libffi 'configure' script.
8743 ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8744 if test "$MOZ_DEBUG"; then
8745 ac_configure_args="$ac_configure_args --enable-debug"
8747 if test "$DSO_PIC_CFLAGS"; then
8748 ac_configure_args="$ac_configure_args --with-pic"
8750 if test "$CROSS_COMPILE"; then
8753 ac_configure_args="$ac_configure_args --build=$build --host=${target_cpu}-${target_os} HOST_CC=\"$HOST_CC\" CC=\"$CC\""
8756 ac_configure_args="$ac_configure_args --build=$build --host=$target HOST_CC=\"$HOST_CC\" CC=\"$CC\""
8760 if test "$_MSC_VER"; then
8761 # Use a wrapper script for cl and ml that looks more like gcc.
8762 # autotools can't quite handle an MSVC build environment yet.
8763 ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe"
8764 case "${target_cpu}" in
8766 # Need target since MSYS tools into mozilla-build may be 32bit
8767 ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/ctypes/libffi/msvcc.sh -m64\" --build=$build --host=$target"
8770 ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/ctypes/libffi/msvcc.sh"
8774 if test "$SOLARIS_SUNPRO_CC"; then
8775 # Always use gcc for libffi on Solaris
8776 ac_configure_args="$ac_configure_args CC=gcc"
8779 # Use a separate cache file for libffi, since it does things differently
8780 # from our configure.
8781 old_cache_file=$cache_file
8782 cache_file=js/ctypes/libffi/config.cache
8783 AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8784 cache_file=$old_cache_file
8785 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8788 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8790 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8791 dnl Needs to be at the end to respect possible changes from NSPR configure
8792 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8793 echo "config/autoconf.mk is unchanged"
8794 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8796 rm -f config/autoconf.mk.orig 2> /dev/null