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.22
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)
765 dnl Test breaks icc on OS/2 && MSVC
766 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
768 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
772 CC="${srcdir}/build/hcc '$CC'"
773 CXX="${srcdir}/build/hcpp '$CXX'"
780 if test -n "$_WIN32_MSVC"; then
782 SKIP_COMPILER_CHECKS=1
783 SKIP_LIBRARY_CHECKS=1
785 # Since we're skipping compiler and library checks, hard-code
792 AC_DEFINE(HAVE_SETBUF)
793 AC_DEFINE(HAVE_ISATTY)
798 fi # COMPILE_ENVIRONMENT
810 dnl ========================================================
811 dnl Checks for programs.
812 dnl ========================================================
816 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
817 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
818 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
820 AC_MSG_RESULT([$_perl_version])
822 if test "$_perl_res" != 0; then
823 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
827 AC_MSG_CHECKING([for full perl installation])
828 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
830 if test "$_perl_res" != 0; then
832 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
837 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.5 python2.4 python)
838 if test -z "$PYTHON"; then
839 AC_MSG_ERROR([python was not found in \$PATH])
842 if test -z "$COMPILE_ENVIRONMENT"; then
843 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
845 AC_SUBST(NSINSTALL_BIN)
847 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
848 MOZ_PATH_PROG(WHOAMI, whoami, :)
849 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
850 MOZ_PATH_PROG(UNZIP, unzip, :)
851 MOZ_PATH_PROGS(ZIP, zip)
852 if test -z "$ZIP" || test "$ZIP" = ":"; then
853 AC_MSG_ERROR([zip not found in \$PATH])
855 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
856 MOZ_PATH_PROG(XARGS, xargs)
857 if test -z "$XARGS" || test "$XARGS" = ":"; then
858 AC_MSG_ERROR([xargs not found in \$PATH .])
861 if test "$COMPILE_ENVIRONMENT"; then
863 dnl ========================================================
864 dnl = Mac OS X toolchain support
865 dnl ========================================================
869 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
870 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
871 dnl the environment and includedir purposes (when using an SDK, below),
872 dnl but remember the full version number for the libdir (SDK).
874 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
875 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
877 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
878 dnl Bug 280479, but this keeps popping up in bug 292530 too because
879 dnl 4.0.0/4061 is the default compiler in Tiger.
881 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
883 if test "$GCC_BUILD" = "4061" ; then
884 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
885 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
886 from building Mozilla. Upgrade to Xcode 2.1 or later.])
890 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
891 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
892 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
893 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
898 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
900 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
906 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
907 dnl it has moved into /usr/bin.
908 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
912 AC_SUBST(GCC_VERSION)
913 AC_SUBST(XCODEBUILD_VERSION)
914 AC_SUBST(HAS_XCODE_2_1)
916 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
917 dnl that a universal binary is being produced.
918 AC_SUBST(UNIVERSAL_BINARY)
920 dnl ========================================================
921 dnl Check for MacOS deployment target version
922 dnl ========================================================
924 MOZ_ARG_ENABLE_STRING(macos-target,
925 [ --enable-macos-target=VER (default=10.5)
926 Set the minimum MacOS version needed at runtime],
927 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
931 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
932 dnl Use the specified value
933 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
934 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
935 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
936 dnl No value specified on the command line or in the environment,
937 dnl use architecture minimum.
938 export MACOSX_DEPLOYMENT_TARGET=10.5
943 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
945 dnl ========================================================
946 dnl = Mac OS X SDK support
947 dnl ========================================================
950 MOZ_ARG_WITH_STRING(macos-sdk,
951 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
952 MACOS_SDK_DIR=$withval)
954 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
955 dnl NEXT_ROOT will be set and exported only if it's needed.
956 AC_SUBST(MACOS_SDK_DIR)
959 if test "$MACOS_SDK_DIR"; then
960 dnl Sync this section with the ones in NSPR and NSS.
961 dnl Changes to the cross environment here need to be accounted for in
962 dnl the libIDL checks (below) and xpidl build.
964 if test ! -d "$MACOS_SDK_DIR"; then
965 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
966 specify a valid SDK. SDKs are installed when the optional cross-development
967 tools are selected during the Xcode/Developer Tools installation.])
970 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
971 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
972 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
974 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
975 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
977 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
978 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
979 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
981 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
982 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
983 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
984 dnl be ignored and cause warnings when -syslibroot is specified.
985 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
986 dnl the -isysroot it receives, so this is only needed with 4.0.0.
987 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
992 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
994 AC_TRY_COMPILE([#include <new>
995 int main() { return 0; }],
999 AC_MSG_RESULT($result)
1001 if test "$result" = "no" ; then
1002 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1006 fi # COMPILE_ENVIRONMENT
1008 if test -n "$MAKE"; then
1009 if test `echo $MAKE | grep -c make.py` != 1; then
1015 cygwin*|mingw*|mks*|msvc*)
1016 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1019 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1022 if test "$GMAKE" = ":"; then
1023 AC_MSG_ERROR([GNU make not found])
1027 if test "$COMPILE_ENVIRONMENT"; then
1033 fi # COMPILE_ENVIRONMENT
1035 dnl ========================================================
1036 dnl set the defaults first
1037 dnl ========================================================
1040 AR_EXTRACT='$(AR) x'
1055 MOZ_USER_DIR=".mozilla"
1058 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1060 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1062 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1064 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1066 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1067 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1068 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1069 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1070 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1071 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1072 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1076 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1078 USE_DEPENDENT_LIBS=1
1080 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1082 MOZ_ENABLE_POSTSCRIPT=1
1084 if test -n "$CROSS_COMPILE"; then
1085 OS_TARGET="${target_os}"
1086 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1088 case "${target_os}" in
1089 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1090 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1091 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1092 mingw*) OS_ARCH=WINNT ;;
1093 wince*) OS_ARCH=WINCE ;;
1094 winmo*) OS_ARCH=WINCE ;;
1095 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1098 OS_TARGET=`uname -s`
1099 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1100 OS_RELEASE=`uname -r`
1103 # Before this used `uname -m` when not cross compiling
1104 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1105 OS_TEST="${target_cpu}"
1109 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1111 #######################################################################
1112 # Master "Core Components" macros for getting the OS target #
1113 #######################################################################
1116 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1117 # cross-compilation.
1121 # Define and override various archtecture-specific variables, including
1130 case "$HOST_OS_ARCH" in
1131 cygwin*|mingw*|mks*|msvc*)
1141 if test -z "$GNU_CC"; then
1142 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1147 if test -z "$GNU_CXX"; then
1148 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1149 SOLARIS_SUNPRO_CXX=1
1152 AC_SUBST(SOLARIS_SUNPRO_CC)
1153 AC_SUBST(SOLARIS_SUNPRO_CXX)
1165 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1168 HOST_OS_ARCH=UNIXWARE
1180 HOST_OS_ARCH=OpenVMS
1190 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1194 HOST_OS_ARCH=UNIXWARE
1200 if test -z "$CROSS_COMPILE" ; then
1206 # If uname -s returns "Windows_NT", we assume that we are using
1207 # the uname.exe in MKS toolkit.
1209 # The -r option of MKS uname only returns the major version number.
1210 # So we need to use its -v option to get the minor version number.
1211 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1215 OS_MINOR_RELEASE=`uname -v`
1216 if test "$OS_MINOR_RELEASE" = "00"; then
1219 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1221 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1223 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1224 # the uname.exe in the Cygwin tools.
1225 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1226 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1227 # the uname.exe in the GNU-Win32 tools.
1228 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1229 # the uname.exe in the MSYS tools.
1231 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1236 OS_RELEASE=`uname -v`.`uname -r`
1237 OS_TEST=${target_cpu}
1249 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1253 OS_RELEASE=`uname -v`
1277 OS_RELEASE=`uname -v`
1283 OS_RELEASE=`uname -v`
1286 if test "$OS_TARGET" != "NTO"; then
1288 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1297 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1303 OS_RELEASE=`uname -v`
1307 case "${target_os}" in
1310 WINCE_WINDOWS_MOBILE=1
1311 AC_DEFINE(WINCE_WINDOWS_MOBILE)
1319 case "${target_cpu}" in
1330 if test -z "$CROSS_COMPILE" ; then
1338 if test "$OS_ARCH" = "NCR"; then
1340 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1344 # Only set CPU_ARCH if we recognize the value of OS_TEST
1355 powerpc | ppc | rs6000)
1359 Alpha | alpha | ALPHA)
1384 if test "$OS_TARGET" = "WINCE"; then
1390 if test -z "$OS_TARGET"; then
1393 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1395 dnl ========================================================
1396 dnl GNU specific defaults
1397 dnl ========================================================
1398 if test "$GNU_CC"; then
1399 # FIXME: Let us build with strict aliasing. bug 414641.
1400 CFLAGS="$CFLAGS -fno-strict-aliasing"
1401 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1402 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1403 DSO_LDOPTS='-shared'
1404 if test "$GCC_USE_GNU_LD"; then
1405 # Don't allow undefined symbols in libraries
1406 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1408 WARNINGS_AS_ERRORS='-Werror'
1410 DSO_PIC_CFLAGS='-fPIC'
1411 ASFLAGS="$ASFLAGS -fPIC"
1412 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1413 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1414 _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1415 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1417 # Turn on GNU specific features
1418 # -Wall - turn on all warnings
1419 # -pedantic - make compiler warn about non-ANSI stuff, and
1420 # be a little bit stricter
1421 # Warnings slamm took out for now (these were giving more noise than help):
1422 # -Wbad-function-cast - warns when casting a function to a new return type
1423 # -Wshadow - removed because it generates more noise than help --pete
1424 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1425 if test -z "$INTEL_CC"; then
1426 # Don't use -Wcast-align with ICC
1428 # And don't use it on hppa, ia64, sparc, since it's noisy there
1429 hppa | ia64 | sparc)
1432 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1437 dnl Turn pedantic on but disable the warnings for long long
1440 if test -z "$INTEL_CC"; then
1441 _IGNORE_LONG_LONG_WARNINGS=1
1442 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1444 _IGNORE_LONG_LONG_WARNINGS=
1448 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1449 _USE_CPP_INCLUDE_FLAG=1
1450 elif test "$SOLARIS_SUNPRO_CC"; then
1451 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1452 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1454 DSO_LDOPTS='-shared'
1455 if test "$GNU_LD"; then
1456 # Don't allow undefined symbols in libraries
1457 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1461 if test "$CPU_ARCH" = "sparc"; then
1462 # for Sun Studio on Solaris/SPARC
1463 DSO_PIC_CFLAGS='-xcode=pic32'
1465 DSO_PIC_CFLAGS='-KPIC'
1467 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1469 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1470 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1472 DSO_LDOPTS='-shared'
1473 if test "$GNU_LD"; then
1474 # Don't allow undefined symbols in libraries
1475 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1479 DSO_PIC_CFLAGS='-KPIC'
1480 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1483 if test "$GNU_CXX"; then
1484 # FIXME: Let us build with strict aliasing. bug 414641.
1485 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1486 # Turn on GNU specific features
1487 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1488 if test -z "$INTEL_CC"; then
1489 # Don't use -Wcast-align with ICC
1491 # And don't use it on hppa, ia64, sparc, since it's noisy there
1492 hppa | ia64 | sparc)
1495 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1500 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1501 _USE_CPP_INCLUDE_FLAG=1
1503 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1504 ac_has_wno_invalid_offsetof,
1508 _SAVE_CXXFLAGS="$CXXFLAGS"
1509 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1512 ac_has_wno_invalid_offsetof="yes",
1513 ac_has_wno_invalid_offsetof="no")
1514 CXXFLAGS="$_SAVE_CXXFLAGS"
1517 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1518 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1521 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1522 ac_has_wno_variadic_macros,
1526 _SAVE_CXXFLAGS="$CXXFLAGS"
1527 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1530 ac_has_wno_variadic_macros="yes",
1531 ac_has_wno_variadic_macros="no")
1532 CXXFLAGS="$_SAVE_CXXFLAGS"
1535 if test "$ac_has_wno_variadic_macros" = "yes"; then
1536 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1539 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1540 ac_has_werror_return_type,
1544 _SAVE_CXXFLAGS="$CXXFLAGS"
1545 CXXFLAGS="$CXXFLAGS -Werror=return-type"
1548 ac_has_werror_return_type="yes",
1549 ac_has_werror_return_type="no")
1550 CXXFLAGS="$_SAVE_CXXFLAGS"
1553 if test "$ac_has_werror_return_type" = "yes"; then
1554 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1558 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1561 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1562 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1563 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1564 dnl normal behavior.
1565 dnl ========================================================
1567 MKSHLIB_UNFORCE_ALL=
1569 if test "$COMPILE_ENVIRONMENT"; then
1570 if test "$GNU_CC"; then
1571 AC_MSG_CHECKING(whether ld has archive extraction flags)
1572 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1573 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1574 ac_cv_mkshlib_force_and_unforce="no"
1575 exec 3<&0 <<LOOP_INPUT
1576 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1577 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1578 force="-Wl,-all"; unforce="-Wl,-none"
1585 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1588 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1590 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1594 eval $ac_cv_mkshlib_force_and_unforce
1595 MKSHLIB_FORCE_ALL=$force
1596 MKSHLIB_UNFORCE_ALL=$unforce
1599 fi # COMPILE_ENVIRONMENT
1601 dnl =================================================================
1602 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1603 dnl which is bad when cross compiling.
1604 dnl =================================================================
1605 if test "$COMPILE_ENVIRONMENT"; then
1606 configure_static_assert_macros='
1607 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1608 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1609 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1612 dnl test that the macros actually work:
1613 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1614 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1617 ac_cv_static_assertion_macros_work="yes"
1618 AC_TRY_COMPILE([$configure_static_assert_macros],
1619 [CONFIGURE_STATIC_ASSERT(1)],
1621 ac_cv_static_assertion_macros_work="no")
1622 AC_TRY_COMPILE([$configure_static_assert_macros],
1623 [CONFIGURE_STATIC_ASSERT(0)],
1624 ac_cv_static_assertion_macros_work="no",
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",
1637 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1638 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1639 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1641 fi # COMPILE_ENVIRONMENT
1643 dnl ========================================================
1644 dnl Checking for 64-bit OS
1645 dnl ========================================================
1646 if test "$COMPILE_ENVIRONMENT"; then
1649 AC_MSG_CHECKING(for 64-bit OS)
1650 AC_TRY_COMPILE([$configure_static_assert_macros],
1651 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1652 result="yes", result="no")
1653 AC_MSG_RESULT("$result")
1654 if test "$result" = "yes"; then
1655 AC_DEFINE(HAVE_64BIT_OS)
1658 AC_SUBST(HAVE_64BIT_OS)
1660 fi # COMPILE_ENVIRONMENT
1662 dnl ========================================================
1663 dnl Enable high-memory support on OS/2 by default.
1664 dnl ========================================================
1665 MOZ_OS2_HIGH_MEMORY=1
1666 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1667 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1668 MOZ_OS2_HIGH_MEMORY=,
1669 MOZ_OS2_HIGH_MEMORY=1 )
1670 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1672 dnl ========================================================
1673 dnl System overrides of the defaults for host
1674 dnl ========================================================
1677 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1678 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1679 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1682 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1683 # we need Python 2.5 on Windows
1685 if test -n "$_WIN32_MSVC"; then
1687 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1688 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1689 HOST_RANLIB='echo ranlib'
1691 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1693 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1694 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1695 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1696 HOST_BIN_SUFFIX=.exe
1699 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1700 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1703 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1704 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1706 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1708 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1710 PERL="${CYGWIN_WRAPPER} $PERL"
1713 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1714 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1719 case "${host_cpu}" in
1721 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1727 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1728 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1729 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1732 *-linux*|*-kfreebsd*-gnu)
1733 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1734 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1735 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1739 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1740 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1741 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1742 HOST_BIN_SUFFIX=.exe
1747 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1748 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1749 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1753 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1754 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1758 dnl We require version 2.4 or newer of Python to build,
1759 dnl and 2.5 or newer on Windows.
1760 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1762 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1765 if test "$_python_res" != 0; then
1766 AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1768 AC_MSG_RESULT([yes])
1770 dnl Get mozilla version from central milestone file
1771 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1773 dnl Get version of various core apps from the version files.
1774 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1776 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1777 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1779 dnl ========================================================
1780 dnl System overrides of the defaults for target
1781 dnl ========================================================
1786 if test ! "$GNU_CC"; then
1787 if test ! "$HAVE_64BIT_OS"; then
1788 # Compiling with Visual Age C++ object model compat is the
1789 # default. To compile with object model ibm, add
1790 # AIX_OBJMODEL=ibm to .mozconfig.
1791 if test "$AIX_OBJMODEL" = "ibm"; then
1792 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1799 AC_SUBST(AIX_OBJMODEL)
1800 DSO_LDOPTS='-qmkshrobj=1'
1801 DSO_CFLAGS='-qflag=w:w'
1803 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1804 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1806 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1807 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1808 if test "$COMPILE_ENVIRONMENT"; then
1811 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1813 [#if (__IBMCPP__ < 600)
1814 #error "Bad compiler"
1816 _BAD_COMPILER=,_BAD_COMPILER=1)
1817 if test -n "$_BAD_COMPILER"; then
1819 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1821 AC_MSG_RESULT([yes])
1824 TARGET_COMPILER_ABI="ibmc"
1825 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1826 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1829 case "${target_os}" in
1834 if test "$COMPILE_ENVIRONMENT"; then
1835 AC_CHECK_HEADERS(sys/inttypes.h)
1837 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1842 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1843 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1844 DSO_LDOPTS='-nostart'
1845 TK_LIBS='-lbe -lroot'
1847 if test "$COMPILE_ENVIRONMENT"; then
1848 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1849 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1851 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1852 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1855 MOZ_USER_DIR="Mozilla"
1859 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1861 _IGNORE_LONG_LONG_WARNINGS=
1869 _WARNINGS_CFLAGS="-Wall"
1870 _WARNINGS_CXXFLAGS="-Wall"
1871 # The test above doesn't work properly, at least on 3.1.
1872 MKSHLIB_FORCE_ALL=''
1873 MKSHLIB_UNFORCE_ALL=''
1879 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1880 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1881 MOZ_OPTIMIZE_FLAGS="-O3"
1883 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1884 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1887 STRIP="$STRIP -x -S"
1888 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1889 MOZ_ENABLE_POSTSCRIPT=
1890 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1891 # The ExceptionHandling framework is needed for Objective-C exception
1892 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1894 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1896 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1897 dnl ===================================================================
1898 if test "x$enable_dtrace" = "xyes"; then
1899 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1901 dnl check for the presence of the -dead_strip linker flag
1902 AC_MSG_CHECKING([for -dead_strip option to ld])
1903 _SAVE_LDFLAGS=$LDFLAGS
1904 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1905 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1906 if test -n "$_HAVE_DEAD_STRIP" ; then
1907 AC_MSG_RESULT([yes])
1908 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1913 LDFLAGS=$_SAVE_LDFLAGS
1915 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1919 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1920 DLL_SUFFIX=".so.1.0"
1921 DSO_LDOPTS="-shared"
1923 if test ! "$GNU_CC"; then
1924 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1926 # Can't have force w/o an unforce.
1927 # # Hack for FreeBSD 2.2
1928 # if test -z "$MKSHLIB_FORCE_ALL"; then
1929 # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1930 # MKSHLIB_UNFORCE_ALL=''
1936 if test ! "$GNU_CC"; then
1937 DSO_LDOPTS='-b -Wl,+s'
1940 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1941 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1942 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1944 DSO_LDOPTS='-b -E +s'
1945 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1946 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1948 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1949 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1954 DSO_LDOPTS='-elf -shared'
1956 if test "$GNU_CC"; then
1957 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1958 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1959 MKSHLIB_FORCE_ALL='-Wl,-all'
1960 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1961 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1963 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1964 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1965 MKSHLIB_FORCE_ALL='-all'
1966 MKSHLIB_UNFORCE_ALL='-none'
1972 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1973 dnl compile and link using -n32
1975 TARGET_COMPILER_ABI=n32
1976 DSO_LDOPTS='-elf -shared'
1977 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1978 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1979 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1980 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1981 if test "$GNU_CC"; then
1982 MKSHLIB_FORCE_ALL='-Wl,-all'
1983 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1984 _WARNINGS_CFLAGS="-Wall"
1985 _WARNINGS_CXXFLAGS="-Wall"
1986 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1988 MKSHLIB_FORCE_ALL='-all'
1989 MKSHLIB_UNFORCE_ALL='-none'
1995 CFLAGS="$CFLAGS -woff 3262 -G 4"
1996 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1997 if test -n "$USE_N32"; then
1998 ASFLAGS="$ASFLAGS -n32"
1999 CFLAGS="$CFLAGS -n32"
2000 CXXFLAGS="$CXXFLAGS -n32"
2001 LDFLAGS="$LDFLAGS -n32"
2003 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2004 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2007 if test -z "$GNU_CXX"; then
2013 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2014 # Similarly for GNU_CXX and INTEL_CXX.
2015 if test "$INTEL_CC" || test "$INTEL_CXX"; then
2016 # -Os has been broken on Intel's C/C++ compilers for quite a
2017 # while; Intel recommends against using it.
2018 MOZ_OPTIMIZE_FLAGS="-O2"
2019 MOZ_DEBUG_FLAGS="-g"
2020 elif test "$GNU_CC" || test "$GNU_CXX"; then
2021 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2022 case $GCC_VERSION in
2024 # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2025 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2027 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
2028 MOZ_DEBUG_FLAGS="-g"
2031 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2035 case "${target_cpu}" in
2037 CFLAGS="$CFLAGS -mieee"
2038 CXXFLAGS="$CXXFLAGS -mieee"
2044 MOZ_DEBUG_FLAGS="-g" # We want inlining
2050 TARGET_COMPILER_ABI=msvc
2051 _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2052 _PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
2053 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2054 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2056 AR_EXTRACT="$AR -extract"
2058 AR_FLAGS='-OUT:"$@"'
2062 ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2064 if test "$AS_BIN"; then
2071 if test -z "$RC"; then
2074 # certain versions of cygwin's makedepend barf on the
2075 # #include <string> vs -I./dist/include/string issue so don't use it
2081 HOST_AR='lib -OUT:$@'
2082 HOST_RANLIB='echo ranlib'
2083 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2086 WARNINGS_AS_ERRORS='-WX'
2087 MOZ_OPTIMIZE_FLAGS='-Ox'
2088 AR_FLAGS='-NOLOGO -OUT:"$@"'
2090 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2091 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2094 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2095 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2097 IMPORT_LIB_SUFFIX=lib
2098 dnl Need to force-link against mozalloc because it's used in the shunt
2099 LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2100 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2103 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2104 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2106 MKSHLIB_UNFORCE_ALL=
2107 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2108 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2109 MOZ_DEBUG_FLAGS='-Zi'
2110 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2112 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2114 RANLIB='echo not_ranlib'
2115 STRIP='echo not_strip'
2116 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2119 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2121 LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2122 LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2126 AC_DEFINE(HAVE_SNPRINTF)
2131 AC_DEFINE(HW_THREADS)
2132 AC_DEFINE(STDC_HEADERS)
2133 AC_DEFINE(NEW_H, <new>)
2134 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2135 AC_DEFINE(HAVE_LOCALTIME_R)
2137 TARGET_MD_ARCH=win32
2138 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2140 MOZ_ENABLE_POSTSCRIPT=
2141 MOZ_USER_DIR="Mozilla"
2143 MOZ_GFX_OPTIMIZE_MOBILE=1
2145 # Sanity check for WINCE_WINDOWS_MOBILE
2146 # XXX disabled until we can fix the mobile tinderbox
2147 ##if test "$WINCE_WINDOWS_MOBILE"; then
2148 ## AC_CHECK_HEADER(tpcshell.h, [],
2149 ## AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2154 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2159 # certain versions of cygwin's makedepend barf on the
2160 # #include <string> vs -I./dist/include/string issue so don't use it
2162 if test -n "$GNU_CC"; then
2163 CC="$CC -mno-cygwin"
2164 CXX="$CXX -mno-cygwin"
2165 CPP="$CPP -mno-cygwin"
2166 CFLAGS="$CFLAGS -mms-bitfields"
2167 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2168 DSO_LDOPTS='-shared'
2169 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2170 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2172 # Use temp file for windres (bug 213281)
2173 RCFLAGS='-O coff --use-temp-file'
2174 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2175 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2176 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2178 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2179 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2181 IMPORT_LIB_SUFFIX=dll.a
2183 TARGET_COMPILER_ABI=msvc
2187 if test "$AS_BIN"; then
2188 AS="$(basename "$AS_BIN")"
2190 AR='lib -NOLOGO -OUT:"$@"'
2192 RANLIB='echo not_ranlib'
2193 STRIP='echo not_strip'
2198 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2204 IMPORT_LIB_SUFFIX=lib
2205 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2206 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2208 MKSHLIB_UNFORCE_ALL=
2209 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2210 _USE_CPP_INCLUDE_FLAG=1
2211 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2212 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2213 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2214 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2215 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2216 MOZ_DEBUG_FLAGS='-Zi'
2217 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2218 WARNINGS_AS_ERRORS='-WX'
2219 MOZ_OPTIMIZE_FLAGS='-O1'
2220 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2222 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2223 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2224 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2225 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2226 if test $_MSC_VER -ge 1400; then
2227 LDFLAGS="$LDFLAGS -NXCOMPAT"
2228 dnl For profile-guided optimization
2229 PROFILE_GEN_CFLAGS="-GL"
2230 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2231 dnl XXX: PGO builds can fail with warnings treated as errors,
2232 dnl specifically "no profile data available" appears to be
2233 dnl treated as an error sometimes. This might be a consequence
2234 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2235 dnl with the linker doing most of the work in the whole-program
2236 dnl optimization/PGO case. I think it's probably a compiler bug,
2237 dnl but we work around it here.
2238 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2239 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2240 dnl Probably also a compiler bug, but what can you do?
2241 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2242 if test -n "$_USE_DYNAMICBASE"; then
2243 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2247 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2248 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2249 AC_DEFINE(HAVE_SNPRINTF)
2254 AC_DEFINE(HW_THREADS)
2255 AC_DEFINE(STDC_HEADERS)
2256 AC_DEFINE(NEW_H, <new>)
2257 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2258 TARGET_MD_ARCH=win32
2259 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2261 MOZ_ENABLE_POSTSCRIPT=
2262 MOZ_USER_DIR="Mozilla"
2264 dnl Hardcode to win95 for now - cls
2265 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2267 dnl set NO_X11 defines here as the general check is skipped on win32
2271 dnl MinGW/MSYS doesn't provide or need cygpath
2276 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2278 *-cygwin*|*-msvc*|*-mks*)
2279 CYGPATH_W="cygpath -a -w"
2280 CYGPATH_S="sed -e s|\\\\|/|g"
2281 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2285 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2287 if test -z "$MOZ_TOOLS"; then
2288 AC_MSG_ERROR([MOZ_TOOLS is not set])
2291 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2292 if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2293 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2295 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2296 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2297 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2299 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2301 if test -n "$GLIB_PREFIX"; then
2302 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2303 if test "$?" = "0"; then
2304 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2305 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2307 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2309 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2312 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2314 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2315 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2317 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2318 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2319 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2320 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2321 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2323 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2326 if test -n "$LIBIDL_PREFIX"; then
2327 _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2328 if test "$?" = "0"; then
2329 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2330 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2332 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2334 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2337 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2339 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2340 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2342 LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2343 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2344 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2346 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2347 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2349 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2351 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2354 *) # else cross-compiling
2355 if test -n "$GLIB_PREFIX"; then
2356 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2357 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2358 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2359 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2360 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2362 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2365 if test -n "$LIBIDL_PREFIX"; then
2366 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2367 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2368 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2370 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2371 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2373 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2376 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2383 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])
2387 AC_CHECK_HEADERS(oleacc.idl)
2391 AC_CHECK_HEADERS(atlbase.h)
2398 if test "$HAVE_64BIT_OS"; then
2399 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2402 if test $_MSC_VER -ge 1400; then
2403 LDFLAGS="$LDFLAGS -SAFESEH"
2405 AC_CHECK_HEADERS(mmintrin.h)
2418 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2422 if test "$HAVE_64BIT_OS"; then
2429 CFLAGS="$CFLAGS -Dunix"
2430 CXXFLAGS="$CXXFLAGS -Dunix"
2431 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2433 DSO_PIC_CFLAGS='-fPIC -DPIC'
2434 DSO_LDOPTS='-shared'
2435 BIN_FLAGS='-Wl,--export-dynamic'
2437 DSO_PIC_CFLAGS='-fPIC -DPIC'
2438 DLL_SUFFIX=".so.1.0"
2439 DSO_LDOPTS='-shared'
2441 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2442 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2443 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2444 if test "$LIBRUNPATH"; then
2445 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2447 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2448 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2453 AC_DEFINE(_QNX_SOURCE)
2456 WARNINGS_AS_ERRORS=''
2457 MOZ_OPTIMIZE_FLAGS="-O"
2458 MOZ_DEBUG_FLAGS="-gstabs"
2461 LIBS="$LIBS -lsocket -lstdc++"
2462 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2463 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2464 if test "$with_x" != "yes"
2466 _PLATFORM_DEFAULT_TOOLKIT="photon"
2467 TK_CFLAGS='-I/usr/include/photon'
2470 case "${target_cpu}" in
2472 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2475 case "${host_cpu}" in
2483 DLL_SUFFIX=".so.1.0"
2485 DSO_PIC_CFLAGS='-fPIC'
2486 DSO_LDOPTS='-shared -fPIC'
2487 if test "$LIBRUNPATH"; then
2488 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2493 AC_DEFINE(NO_PW_GECOS)
2494 AC_DEFINE(NO_UDSOCK)
2495 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2497 MKSHLIB_FORCE_ALL='-all'
2498 MKSHLIB_UNFORCE_ALL='-none'
2500 AS_DASH_C_FLAG='-Wc/names=as_is'
2502 DSO_LDOPTS='-shared -auto_symvec'
2504 MOZ_DEBUG_LDFLAGS='-g'
2506 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2507 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2512 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2513 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2516 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2517 AC_DEFINE(TCPV40HDRS)
2523 IMPORT_LIB_SUFFIX=lib
2527 CFLAGS="$CFLAGS -Zomf"
2528 CXXFLAGS="$CXXFLAGS -Zomf"
2530 BIN_FLAGS='-Zlinker /ST:0x100000'
2534 WARNINGS_AS_ERRORS='-Werror'
2535 MOZ_DEBUG_FLAGS="-g -fno-inline"
2536 MOZ_OPTIMIZE_FLAGS="-O2"
2537 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2538 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2539 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2541 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2542 MOZ_ENABLE_POSTSCRIPT=
2545 MOZ_USER_DIR="Mozilla"
2547 if test "$MOZTOOLS"; then
2548 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2550 AC_MSG_ERROR([MOZTOOLS is not set])
2552 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2553 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2554 LDFLAGS="$LDFLAGS -Zhigh-mem"
2555 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2556 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2559 # GCC for OS/2 currently predefines these, but we don't want them
2560 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2561 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2563 AC_CACHE_CHECK(for __declspec(dllexport),
2565 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2567 ac_os2_declspec="yes",
2568 ac_os2_declspec="no")])
2569 if test "$ac_os2_declspec" = "yes"; then
2571 MOZ_OS2_USE_DECLSPEC='1'
2576 if test "$GNU_CC"; then
2577 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2578 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2581 MOZ_DEBUG_FLAGS='-g'
2582 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2583 CFLAGS="$CFLAGS -ieee"
2584 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2585 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2588 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2589 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2590 MKSHLIB_FORCE_ALL='-all'
2591 MKSHLIB_UNFORCE_ALL='-none'
2592 dnl Might fix the libxpcom.so breakage on this platform as well....
2593 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2594 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2596 if test -z "$GNU_CXX"; then
2599 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2603 DIRENT_INO=d_stat.st_ino
2604 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2605 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2606 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2607 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2608 AC_DEFINE(STDC_HEADERS)
2609 if test "$no_x" = "yes"; then
2610 _PLATFORM_DEFAULT_TOOLKIT='photon'
2611 TK_CFLAGS='-I/usr/nto/include/photon'
2612 TK_LIBS='-lphoton -lphrender'
2617 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2618 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2619 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2620 if test ! "$GNU_CC"; then
2627 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2629 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2630 # libraries one level up (e.g. libnspr4.so)
2631 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2633 if test "$SOLARIS_SUNPRO_CC"; then
2634 LIBS="-lCrun -lCstd $LIBS"
2637 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2638 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2639 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
2640 LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2641 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2642 _SAVE_LDFLAGS=$LDFLAGS
2643 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2644 AC_TRY_LINK([#include <stdio.h>],
2645 [printf("Hello World\n");],
2647 [LDFLAGS=$_SAVE_LDFLAGS])
2649 WARNINGS_AS_ERRORS='-Werror'
2650 MOZ_OPTIMIZE_FLAGS="-xO4"
2651 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2652 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2653 MKSHLIB_FORCE_ALL='-z allextract'
2654 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2655 DSO_LDOPTS='-G -z muldefs'
2661 AS='/usr/ccs/bin/as'
2662 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2664 TARGET_COMPILER_ABI="sunc"
2665 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2666 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2667 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2671 [#if (__SUNPRO_CC < 0x590)
2674 _BAD_COMPILER=,_BAD_COMPILER=1)
2675 if test -n "$_BAD_COMPILER"; then
2677 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2681 AC_MSG_RESULT([$_res])
2684 ASFLAGS="$ASFLAGS -fPIC"
2687 _WARNINGS_CXXFLAGS=''
2688 if test "$OS_RELEASE" = "5.3"; then
2689 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2692 if test "$OS_RELEASE" = "5.5.1"; then
2693 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2698 DSO_LDOPTS='-Bdynamic'
2699 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2700 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2702 AC_DEFINE(SPRINTF_RETURNS_STRING)
2703 case "$(target_os)" in
2705 DLL_SUFFIX='.so.1.0'
2711 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2715 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2720 dnl Only one oddball right now (QNX), but this gives us flexibility
2721 dnl if any other platforms need to override this in the future.
2722 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2724 dnl ========================================================
2725 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2726 dnl by now will not have any way to link most binaries (tests
2727 dnl as well as viewer, apprunner, etc.), because some symbols
2728 dnl will be left out of the "composite" .so's by ld as unneeded.
2729 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2730 dnl they can link in the static libs that provide the missing
2732 dnl ========================================================
2733 NO_LD_ARCHIVE_FLAGS=
2734 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2735 NO_LD_ARCHIVE_FLAGS=1
2739 NO_LD_ARCHIVE_FLAGS=
2742 NO_LD_ARCHIVE_FLAGS=
2745 NO_LD_ARCHIVE_FLAGS=
2747 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2748 if test -z "$GNU_CC"; then
2749 NO_LD_ARCHIVE_FLAGS=
2753 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2755 dnl ========================================================
2756 dnl = Flags to strip unused symbols from .so components
2757 dnl ========================================================
2759 *-linux*|*-kfreebsd*-gnu)
2760 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2763 if test -z "$GNU_CC"; then
2764 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2766 if test -z "$GCC_USE_GNU_LD"; then
2767 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2769 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2774 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2777 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2779 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2780 if test -n "$GNU_CC"; then
2781 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2786 if test -z "$COMPILE_ENVIRONMENT"; then
2787 SKIP_COMPILER_CHECKS=1
2788 SKIP_LIBRARY_CHECKS=1
2791 if test -z "$SKIP_COMPILER_CHECKS"; then
2792 dnl Checks for typedefs, structures, and compiler characteristics.
2793 dnl ========================================================
2801 AC_MSG_CHECKING(for ssize_t)
2802 AC_CACHE_VAL(ac_cv_type_ssize_t,
2803 [AC_TRY_COMPILE([#include <stdio.h>
2804 #include <sys/types.h>],
2806 [ac_cv_type_ssize_t=true],
2807 [ac_cv_type_ssize_t=false])])
2808 if test "$ac_cv_type_ssize_t" = true ; then
2809 AC_DEFINE(HAVE_SSIZE_T)
2814 AC_STRUCT_ST_BLKSIZE
2815 AC_MSG_CHECKING(for siginfo_t)
2816 AC_CACHE_VAL(ac_cv_siginfo_t,
2817 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2818 #include <signal.h>],
2820 [ac_cv_siginfo_t=true],
2821 [ac_cv_siginfo_t=false])])
2822 if test "$ac_cv_siginfo_t" = true ; then
2823 AC_DEFINE(HAVE_SIGINFO_T)
2829 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2830 dnl ========================================================
2831 AC_MSG_CHECKING(for int16_t)
2832 AC_CACHE_VAL(ac_cv_int16_t,
2833 [AC_TRY_COMPILE([#include <stdio.h>
2834 #include <sys/types.h>],
2836 [ac_cv_int16_t=true],
2837 [ac_cv_int16_t=false])])
2838 if test "$ac_cv_int16_t" = true ; then
2839 AC_DEFINE(HAVE_INT16_T)
2844 AC_MSG_CHECKING(for int32_t)
2845 AC_CACHE_VAL(ac_cv_int32_t,
2846 [AC_TRY_COMPILE([#include <stdio.h>
2847 #include <sys/types.h>],
2849 [ac_cv_int32_t=true],
2850 [ac_cv_int32_t=false])])
2851 if test "$ac_cv_int32_t" = true ; then
2852 AC_DEFINE(HAVE_INT32_T)
2857 AC_MSG_CHECKING(for int64_t)
2858 AC_CACHE_VAL(ac_cv_int64_t,
2859 [AC_TRY_COMPILE([#include <stdio.h>
2860 #include <sys/types.h>],
2862 [ac_cv_int64_t=true],
2863 [ac_cv_int64_t=false])])
2864 if test "$ac_cv_int64_t" = true ; then
2865 AC_DEFINE(HAVE_INT64_T)
2870 AC_MSG_CHECKING(for int64)
2871 AC_CACHE_VAL(ac_cv_int64,
2872 [AC_TRY_COMPILE([#include <stdio.h>
2873 #include <sys/types.h>],
2876 [ac_cv_int64=false])])
2877 if test "$ac_cv_int64" = true ; then
2878 AC_DEFINE(HAVE_INT64)
2883 AC_MSG_CHECKING(for uint)
2884 AC_CACHE_VAL(ac_cv_uint,
2885 [AC_TRY_COMPILE([#include <stdio.h>
2886 #include <sys/types.h>],
2889 [ac_cv_uint=false])])
2890 if test "$ac_cv_uint" = true ; then
2891 AC_DEFINE(HAVE_UINT)
2896 AC_MSG_CHECKING(for uint_t)
2897 AC_CACHE_VAL(ac_cv_uint_t,
2898 [AC_TRY_COMPILE([#include <stdio.h>
2899 #include <sys/types.h>],
2901 [ac_cv_uint_t=true],
2902 [ac_cv_uint_t=false])])
2903 if test "$ac_cv_uint_t" = true ; then
2904 AC_DEFINE(HAVE_UINT_T)
2909 AC_MSG_CHECKING(for uint16_t)
2910 AC_CACHE_VAL(ac_cv_uint16_t,
2911 [AC_TRY_COMPILE([#include <stdio.h>
2912 #include <sys/types.h>],
2913 [uint16_t foo = 0;],
2914 [ac_cv_uint16_t=true],
2915 [ac_cv_uint16_t=false])])
2916 if test "$ac_cv_uint16_t" = true ; then
2917 AC_DEFINE(HAVE_UINT16_T)
2923 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2924 dnl are defined when compiling C++ but not C. Since the result of this
2925 dnl test is used only in C++, do it in C++.
2928 AC_MSG_CHECKING(for uname.domainname)
2929 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2930 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2931 [ struct utsname *res; char *domain;
2932 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2933 [ac_cv_have_uname_domainname_field=true],
2934 [ac_cv_have_uname_domainname_field=false])])
2936 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2937 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2943 AC_MSG_CHECKING(for uname.__domainname)
2944 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2945 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2946 [ struct utsname *res; char *domain;
2947 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2948 [ac_cv_have_uname_us_domainname_field=true],
2949 [ac_cv_have_uname_us_domainname_field=false])])
2951 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2952 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2960 dnl Check for usable char16_t (2 bytes, unsigned)
2961 dnl (we might not need the unsignedness check anymore)
2962 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2963 ac_cv_have_usable_char16_t,
2964 [AC_TRY_COMPILE([$configure_static_assert_macros],
2965 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2966 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2967 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2968 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2969 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2970 ac_cv_have_usable_char16_t="yes",
2971 ac_cv_have_usable_char16_t="no")])
2972 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2973 AC_DEFINE(HAVE_CPP_CHAR16_T)
2977 dnl Check for usable wchar_t (2 bytes, unsigned)
2978 dnl (we really don't need the unsignedness check anymore)
2979 dnl ========================================================
2981 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2982 ac_cv_have_usable_wchar_v2,
2983 [AC_TRY_COMPILE([#include <stddef.h>
2984 $configure_static_assert_macros],
2985 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2986 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2987 ac_cv_have_usable_wchar_v2="yes",
2988 ac_cv_have_usable_wchar_v2="no")])
2989 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2990 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2991 HAVE_CPP_2BYTE_WCHAR_T=1
2992 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2993 dnl This is really gcc-only
2994 dnl Do this test using CXX only since some versions of gcc
2995 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2996 dnl only have short-wchar support for c++.
2997 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2999 _SAVE_CXXFLAGS=$CXXFLAGS
3000 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3002 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3003 ac_cv_have_usable_wchar_option_v2,
3004 [AC_TRY_LINK([#include <stddef.h>
3005 $configure_static_assert_macros],
3006 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3007 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3008 ac_cv_have_usable_wchar_option_v2="yes",
3009 ac_cv_have_usable_wchar_option_v2="no")])
3011 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3012 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3013 HAVE_CPP_2BYTE_WCHAR_T=1
3014 WCHAR_CFLAGS="-fshort-wchar"
3016 CXXFLAGS=$_SAVE_CXXFLAGS
3022 dnl Check for .hidden assembler directive and visibility attribute.
3023 dnl Borrowed from glibc configure.in
3024 dnl ===============================================================
3025 if test "$GNU_CC"; then
3026 AC_CACHE_CHECK(for visibility(hidden) attribute,
3027 ac_cv_visibility_hidden,
3028 [cat > conftest.c <<EOF
3029 int foo __attribute__ ((visibility ("hidden"))) = 1;
3031 ac_cv_visibility_hidden=no
3032 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3033 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3034 ac_cv_visibility_hidden=yes
3039 if test "$ac_cv_visibility_hidden" = "yes"; then
3040 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3042 AC_CACHE_CHECK(for visibility(default) attribute,
3043 ac_cv_visibility_default,
3044 [cat > conftest.c <<EOF
3045 int foo __attribute__ ((visibility ("default"))) = 1;
3047 ac_cv_visibility_default=no
3048 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3049 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3050 ac_cv_visibility_default=yes
3055 if test "$ac_cv_visibility_default" = "yes"; then
3056 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3058 AC_CACHE_CHECK(for visibility pragma support,
3059 ac_cv_visibility_pragma,
3060 [cat > conftest.c <<EOF
3061 #pragma GCC visibility push(hidden)
3063 #pragma GCC visibility push(default)
3064 int foo_default = 1;
3066 ac_cv_visibility_pragma=no
3067 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3068 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3069 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3070 ac_cv_visibility_pragma=yes
3076 if test "$ac_cv_visibility_pragma" = "yes"; then
3077 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3078 ac_cv_have_visibility_class_bug,
3079 [cat > conftest.c <<EOF
3080 #pragma GCC visibility push(hidden)
3081 struct __attribute__ ((visibility ("default"))) TestStruct {
3084 __attribute__ ((visibility ("default"))) void TestFunc() {
3088 ac_cv_have_visibility_class_bug=no
3089 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3090 ac_cv_have_visibility_class_bug=yes
3092 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3093 ac_cv_have_visibility_class_bug=yes
3096 rm -rf conftest.{c,S}
3099 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3100 ac_cv_have_visibility_builtin_bug,
3101 [cat > conftest.c <<EOF
3102 #pragma GCC visibility push(hidden)
3103 #pragma GCC visibility push(default)
3105 #pragma GCC visibility pop
3107 __attribute__ ((visibility ("default"))) void Func() {
3109 memset(c, 0, sizeof(c));
3112 ac_cv_have_visibility_builtin_bug=no
3113 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3114 ac_cv_have_visibility_builtin_bug=yes
3116 if test `grep -c "@PLT" conftest.S` = 0; then
3117 ac_cv_visibility_builtin_bug=yes
3120 rm -f conftest.{c,S}
3122 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3123 "$ac_cv_have_visibility_class_bug" = "no"; then
3124 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3125 WRAP_SYSTEM_INCLUDES=1
3127 VISIBILITY_FLAGS='-fvisibility=hidden'
3128 fi # have visibility pragma bug
3129 fi # have visibility pragma
3130 fi # have visibility(default) attribute
3131 fi # have visibility(hidden) attribute
3134 # visibility hidden flag for Sun Studio on Solaris
3135 if test "$SOLARIS_SUNPRO_CC"; then
3136 VISIBILITY_FLAGS='-xldscope=hidden'
3137 fi # Sun Studio on Solaris
3139 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3140 AC_SUBST(VISIBILITY_FLAGS)
3142 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3143 dnl ========================================================
3144 if test "$GNU_CC"; then
3145 CFLAGS_save="${CFLAGS}"
3146 CFLAGS="${CFLAGS} -Werror"
3147 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3148 ac_cv_force_align_arg_pointer,
3149 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3151 ac_cv_force_align_arg_pointer="yes",
3152 ac_cv_force_align_arg_pointer="no")])
3153 CFLAGS="${CFLAGS_save}"
3154 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3155 HAVE_GCC_ALIGN_ARG_POINTER=1
3157 HAVE_GCC_ALIGN_ARG_POINTER=
3160 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3162 dnl Checks for header files.
3163 dnl ========================================================
3165 case "$target_os" in
3167 # for stuff like -lXshm
3168 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3171 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3172 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3173 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3174 AC_CHECK_HEADERS(malloc.h)
3175 AC_CHECK_HEADERS(X11/XKBlib.h)
3176 AC_CHECK_HEADERS(io.h)
3178 dnl These are all the places some variant of statfs can be hiding.
3179 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3182 AC_CHECK_HEADERS(sys/quota.h)
3184 dnl Try for MMX support
3185 dnl NB - later gcc versions require -mmmx for this header to be successfully
3186 dnl included (or another option which implies it, such as -march=pentium-mmx)
3187 AC_CHECK_HEADERS(mmintrin.h)
3189 dnl Check whether the compiler supports the new-style C++ standard
3190 dnl library headers (i.e. <new>) or needs the old "new.h"
3193 AC_CHECK_HEADER(new, [NEW_H=new])
3194 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3197 AC_ARG_ENABLE(dtrace,
3198 [ --enable-dtrace build with dtrace support if available (default=no)],
3199 [enable_dtrace="yes"],)
3200 if test "x$enable_dtrace" = "xyes"; then
3201 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3202 if test -n "$HAVE_DTRACE"; then
3203 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3205 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3208 AC_SUBST(HAVE_DTRACE)
3214 AC_CHECK_HEADERS(sys/cdefs.h)
3218 dnl Checks for libraries.
3219 dnl ========================================================
3224 AC_CHECK_LIB(c_r, gethostbyname_r)
3228 dnl We don't want to link with libdl even if it's present on OS X, since
3229 dnl it's not used and not part of the default installation.
3230 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3231 dnl We don't want to link against libm or libpthread on Darwin since
3232 dnl they both are just symlinks to libSystem and explicitly linking
3233 dnl against libSystem causes issues when debugging (see bug 299601).
3242 AC_CHECK_LIB(m, atan)
3243 AC_CHECK_LIB(dl, dlopen,
3244 AC_CHECK_HEADER(dlfcn.h,
3246 AC_DEFINE(HAVE_LIBDL)))
3250 _SAVE_CFLAGS="$CFLAGS"
3251 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3252 AC_CHECK_FUNCS(dladdr)
3253 CFLAGS="$_SAVE_CFLAGS"
3255 if test ! "$GNU_CXX"; then
3259 AC_CHECK_LIB(C_r, demangle)
3262 AC_CHECK_LIB(C, demangle)
3267 dnl OS/2 has socket in libc.
3272 AC_CHECK_LIB(socket, socket)
3275 dnl ========================================================
3276 dnl Check whether we can compile code for Core Text
3277 dnl (available on Mac OS X 10.5 or later)
3278 dnl ========================================================
3281 AC_MSG_CHECKING([for Core Text])
3282 AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3283 [CTLineRef lineRef;],
3284 ac_cv_have_core_text="yes",
3285 ac_cv_have_core_text="no")
3286 AC_MSG_RESULT([$ac_cv_have_core_text])
3288 if test "$ac_cv_have_core_text" = "no"; then
3289 AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3295 XLIBS="$X_EXTRA_LIBS"
3297 dnl ========================================================
3298 dnl Checks for X libraries.
3299 dnl Ordering is important.
3300 dnl Xt is dependent upon SM as of X11R6
3301 dnl ========================================================
3302 if test "$no_x" = "yes"; then
3305 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3306 XLIBS="-lX11 $XLIBS"
3307 _SAVE_LDFLAGS="$LDFLAGS"
3308 LDFLAGS="$XLDFLAGS $LDFLAGS"
3309 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3310 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3311 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3312 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3314 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3315 unset ac_cv_lib_Xt_XtFree
3316 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3317 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3318 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3319 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3322 # AIX needs the motif library linked before libXt to prevent
3323 # crashes in plugins linked against Motif - Bug #98892
3324 case "${target_os}" in
3326 XT_LIBS="-lXm $XT_LIBS"
3330 dnl ========================================================
3331 dnl = Check for XShm
3332 dnl ========================================================
3333 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3335 AC_CHECK_HEADER(X11/extensions/XShm.h)
3336 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3337 test -n "$_HAVE_XSHM_XEXT"; then
3338 AC_DEFINE(HAVE_XSHM)
3341 dnl ========================================================
3343 dnl ========================================================
3344 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3346 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3348 if test "$MOZ_XIE_LIBS"; then
3349 dnl ====================================================
3350 dnl = If XIE is present and is desired, turn it on
3351 dnl ====================================================
3361 LDFLAGS="$_SAVE_LDFLAGS"
3363 dnl ========================================================
3364 dnl = Check for freetype2 and its functionality
3365 dnl ========================================================
3366 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3368 if test "$_HAVE_FREETYPE2"; then
3370 _SAVE_CFLAGS="$CFLAGS"
3371 LIBS="$LIBS $FT2_LIBS"
3372 CFLAGS="$CFLAGS $FT2_CFLAGS"
3374 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3375 ac_cv_member_FT_Bitmap_Size_y_ppem,
3376 [AC_TRY_COMPILE([#include <ft2build.h>
3377 #include FT_FREETYPE_H],
3379 if (sizeof s.y_ppem) return 0;
3381 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3382 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3383 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3384 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3386 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3388 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3389 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3390 [FT_Bitmap_Size structure includes y_ppem field])
3392 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3395 CFLAGS="$_SAVE_CFLAGS"
3406 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3408 [asm("uqadd8 r1, r1, r2");],
3409 result="yes", result="no")
3410 AC_MSG_RESULT("$result")
3411 if test "$result" = "yes"; then
3412 AC_DEFINE(HAVE_ARM_SIMD)
3415 AC_SUBST(HAVE_ARM_SIMD)
3417 AC_MSG_CHECKING(for ARM NEON support in compiler)
3418 _SAVE_CFLAGS="$CFLAGS"
3419 if test "$GNU_CC"; then
3420 # gcc needs -mfpu=neon to recognize NEON instructions
3421 CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3424 [asm("vadd.i8 d0, d0, d0");],
3425 result="yes", result="no")
3426 AC_MSG_RESULT("$result")
3427 if test "$result" = "yes"; then
3428 AC_DEFINE(HAVE_ARM_NEON)
3431 CFLAGS="$_SAVE_CFLAGS"
3432 AC_SUBST(HAVE_ARM_NEON)
3434 dnl ========================================================
3435 dnl = pthread support
3436 dnl = Start by checking whether the system support pthreads
3437 dnl ========================================================
3438 case "$target_os" in
3443 MOZ_CHECK_PTHREADS(pthreads,
3444 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3445 MOZ_CHECK_PTHREADS(pthread,
3446 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3447 MOZ_CHECK_PTHREADS(c_r,
3448 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3449 MOZ_CHECK_PTHREADS(c,
3458 dnl ========================================================
3459 dnl Check the command line for --with-pthreads
3460 dnl ========================================================
3461 MOZ_ARG_WITH_BOOL(pthreads,
3462 [ --with-pthreads Force use of system pthread library with NSPR ],
3463 [ if test "$USE_PTHREADS"x = x; then
3464 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3470 dnl ========================================================
3471 dnl Do the platform specific pthread hackery
3472 dnl ========================================================
3473 if test "$USE_PTHREADS"x != x
3476 dnl See if -pthread is supported.
3479 ac_cv_have_dash_pthread=no
3480 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3481 echo 'int main() { return 0; }' | cat > conftest.c
3482 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3483 if test $? -eq 0; then
3484 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3485 ac_cv_have_dash_pthread=yes
3486 case "$target_os" in
3488 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3491 CFLAGS="$CFLAGS -pthread"
3492 CXXFLAGS="$CXXFLAGS -pthread"
3498 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3501 dnl See if -pthreads is supported.
3503 ac_cv_have_dash_pthreads=no
3504 if test "$ac_cv_have_dash_pthread" = "no"; then
3505 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3506 echo 'int main() { return 0; }' | cat > conftest.c
3507 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3508 if test $? -eq 0; then
3509 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3510 ac_cv_have_dash_pthreads=yes
3511 CFLAGS="$CFLAGS -pthreads"
3512 CXXFLAGS="$CXXFLAGS -pthreads"
3516 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3521 AC_DEFINE(_REENTRANT)
3522 AC_DEFINE(_THREAD_SAFE)
3523 dnl -pthread links in -lc_r, so don't specify it explicitly.
3524 if test "$ac_cv_have_dash_pthread" = "yes"; then
3525 _PTHREAD_LDFLAGS="-pthread"
3527 _PTHREAD_LDFLAGS="-lc_r"
3531 *-*-openbsd*|*-*-bsdi*)
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"
3540 *-*-linux*|*-*-kfreebsd*-gnu)
3541 AC_DEFINE(_REENTRANT)
3545 AC_DEFINE(_REENTRANT)
3549 AC_DEFINE(_REENTRANT)
3553 AC_DEFINE(_REENTRANT)
3557 AC_DEFINE(_REENTRANT)
3561 AC_DEFINE(_REENTRANT)
3562 if test "$SOLARIS_SUNPRO_CC"; then
3563 CFLAGS="$CFLAGS -mt"
3564 CXXFLAGS="$CXXFLAGS -mt"
3568 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3571 dnl ========================================================
3572 dnl See if mmap sees writes
3573 dnl For cross compiling, just define it as no, which is a safe default
3574 dnl ========================================================
3575 AC_MSG_CHECKING(whether mmap() sees write()s)
3581 #include <sys/mman.h>
3582 #include <sys/types.h>
3583 #include <sys/stat.h>
3586 char fname[] = "conftest.file";
3587 char zbuff[1024]; /* Fractional page is probably worst case */
3594 fd = open(fname, O_RDWR | O_CREAT, 0660);
3597 write(fd, zbuff, sizeof(zbuff));
3598 lseek(fd, 0, SEEK_SET);
3599 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3600 if(map==(char*)-1) return 2;
3601 for(i=0; fname[i]; i++) {
3602 int rc = write(fd, &fname[i], 1);
3603 if(map[i]!=fname[i]) return 4;
3610 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3612 AC_MSG_RESULT("$result")
3614 if test "$result" = "no"; then
3615 AC_DEFINE(MMAP_MISSES_WRITES)
3619 dnl Checks for library functions.
3620 dnl ========================================================
3621 AC_PROG_GCC_TRADITIONAL
3623 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3624 AC_CHECK_FUNCS(flockfile getpagesize)
3625 AC_CHECK_FUNCS(localtime_r strtok_r)
3627 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3628 _SAVE_LDFLAGS=$LDFLAGS
3629 LDFLAGS="$LDFLAGS -lrt"
3630 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3631 ac_cv_have_clock_monotonic,
3632 [AC_TRY_LINK([#include <time.h>],
3633 [ struct timespec ts;
3634 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3635 ac_cv_have_clock_monotonic=yes,
3636 ac_cv_have_clock_monotonic=no)])
3637 LDFLAGS=$_SAVE_LDFLAGS
3638 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3639 HAVE_CLOCK_MONOTONIC=1
3641 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3642 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3643 AC_SUBST(REALTIME_LIBS)
3646 dnl check for wcrtomb/mbrtowc
3647 dnl =======================================================================
3648 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3651 AC_CACHE_CHECK(for wcrtomb,
3653 [AC_TRY_LINK([#include <wchar.h>],
3654 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3655 ac_cv_have_wcrtomb="yes",
3656 ac_cv_have_wcrtomb="no")])
3657 if test "$ac_cv_have_wcrtomb" = "yes"; then
3658 AC_DEFINE(HAVE_WCRTOMB)
3660 AC_CACHE_CHECK(for mbrtowc,
3662 [AC_TRY_LINK([#include <wchar.h>],
3663 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3664 ac_cv_have_mbrtowc="yes",
3665 ac_cv_have_mbrtowc="no")])
3666 if test "$ac_cv_have_mbrtowc" = "yes"; then
3667 AC_DEFINE(HAVE_MBRTOWC)
3674 ac_cv_func_res_ninit,
3677 #define _BSD_SOURCE 1
3681 [int foo = res_ninit(&_res);],
3682 [ac_cv_func_res_ninit=yes],
3683 [ac_cv_func_res_ninit=no])
3686 if test "$ac_cv_func_res_ninit" = "yes"; then
3687 AC_DEFINE(HAVE_RES_NINIT)
3688 dnl must add the link line we do something as foolish as this... dougt
3690 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3691 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3696 [for gnu_get_libc_version()],
3697 ac_cv_func_gnu_get_libc_version,
3699 #ifdef HAVE_GNU_LIBC_VERSION_H
3700 #include <gnu/libc-version.h>
3703 [const char *glibc_version = gnu_get_libc_version();],
3704 [ac_cv_func_gnu_get_libc_version=yes],
3705 [ac_cv_func_gnu_get_libc_version=no]
3709 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3710 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3714 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3718 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3719 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3720 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3722 LIBS="$LIBS $_ICONV_LIBS"
3731 iconv_t h = iconv_open("", "");
3732 iconv(h, NULL, NULL, NULL, NULL);
3735 [ac_cv_func_iconv=yes],
3736 [ac_cv_func_iconv=no]
3739 if test "$ac_cv_func_iconv" = "yes"; then
3740 AC_DEFINE(HAVE_ICONV)
3741 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3742 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3743 LIBICONV="$_ICONV_LIBS"
3745 [for iconv() with const input],
3746 ac_cv_func_const_iconv,
3752 const char *input = "testing";
3753 iconv_t h = iconv_open("", "");
3754 iconv(h, &input, NULL, NULL, NULL);
3757 [ac_cv_func_const_iconv=yes],
3758 [ac_cv_func_const_iconv=no]
3761 if test "$ac_cv_func_const_iconv" = "yes"; then
3762 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3774 dnl **********************
3775 dnl *** va_copy checks ***
3776 dnl **********************
3777 dnl we currently check for all three va_copy possibilities, so we get
3778 dnl all results in config.log for bug reports.
3779 AC_MSG_CHECKING(for an implementation of va_copy())
3780 AC_CACHE_VAL(ac_cv_va_copy,[
3783 void f (int i, ...) {
3784 va_list args1, args2;
3785 va_start (args1, i);
3786 va_copy (args2, args1);
3787 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3789 va_end (args1); va_end (args2);
3791 int main() { f (0, 42); return 0; }],
3797 AC_MSG_RESULT($ac_cv_va_copy)
3798 AC_MSG_CHECKING(for an implementation of __va_copy())
3799 AC_CACHE_VAL(ac_cv___va_copy,[
3802 void f (int i, ...) {
3803 va_list args1, args2;
3804 va_start (args1, i);
3805 __va_copy (args2, args1);
3806 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3808 va_end (args1); va_end (args2);
3810 int main() { f (0, 42); return 0; }],
3811 ac_cv___va_copy=yes,
3816 AC_MSG_RESULT($ac_cv___va_copy)
3817 AC_MSG_CHECKING(whether va_lists can be copied by value)
3818 AC_CACHE_VAL(ac_cv_va_val_copy,[
3821 void f (int i, ...) {
3822 va_list args1, args2;
3823 va_start (args1, i);
3825 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3827 va_end (args1); va_end (args2);
3829 int main() { f (0, 42); return 0; }],
3830 ac_cv_va_val_copy=yes,
3831 ac_cv_va_val_copy=no,
3832 ac_cv_va_val_copy=yes
3835 if test "x$ac_cv_va_copy" = "xyes"; then
3836 AC_DEFINE(VA_COPY, va_copy)
3837 AC_DEFINE(HAVE_VA_COPY)
3838 elif test "x$ac_cv___va_copy" = "xyes"; then
3839 AC_DEFINE(VA_COPY, __va_copy)
3840 AC_DEFINE(HAVE_VA_COPY)
3843 if test "x$ac_cv_va_val_copy" = "xno"; then
3844 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3846 AC_MSG_RESULT($ac_cv_va_val_copy)
3848 dnl Check for dll-challenged libc's.
3849 dnl This check is apparently only needed for Linux.
3852 dnl ===================================================================
3855 rm -rf conftest* _conftest
3857 cat >> conftest.C <<\EOF
3862 void __dump_link_map(void) {
3863 struct link_map *map = _dl_loaded;
3864 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3867 dlopen("./conftest1.so",RTLD_LAZY);
3868 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3869 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3870 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3874 /* _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).*/
3875 int main() { printf("./conftest1.so\n"); }
3879 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3881 cat >> conftest1.C <<\EOF
3883 void foo(void) {printf("foo in dll called\n");}
3885 ${CXX-g++} -fPIC -c -g conftest1.C
3886 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3887 ${CXX-g++} -g conftest.C -o conftest -ldl
3888 cp -f conftest1.so conftest _conftest
3890 if test `./conftest | grep conftest1.so | wc -l` -gt 1
3893 echo "*** Your libc has a bug that can result in loading the same dynamic"
3894 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
3895 echo "*** or later. However, if you choose not to upgrade, the only effect"
3896 echo "*** will be excessive memory usage at runtime."
3900 rm -rf conftest* _conftest
3901 dnl ===================================================================
3905 dnl ===================================================================
3906 dnl ========================================================
3907 dnl By default, turn rtti and exceptions off on g++/egcs
3908 dnl ========================================================
3909 if test "$GNU_CXX"; then
3911 AC_MSG_CHECKING(for C++ exceptions flag)
3913 dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3914 AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3915 [echo "int main() { return 0; }" | cat > conftest.C
3917 ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3919 if egrep "warning.*renamed" conftest.out >/dev/null; then
3920 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3922 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3927 AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3928 _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3929 _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3932 dnl ========================================================
3933 dnl Put your C++ language/feature checks below
3934 dnl ========================================================
3938 if test "$GNU_CC"; then
3939 AC_CACHE_CHECK(for gcc 3.0 ABI,
3940 ac_cv_gcc_three_abi,
3943 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3949 ac_cv_gcc_three_abi="yes",
3950 ac_cv_gcc_three_abi="no")])
3951 if test "$ac_cv_gcc_three_abi" = "yes"; then
3952 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3955 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3958 AC_SUBST(HAVE_GCC3_ABI)
3961 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3963 [AC_TRY_COMPILE(class X {
3964 public: explicit X(int i) : i_(i) {}
3968 ac_cv_cpp_explicit=yes,
3969 ac_cv_cpp_explicit=no)])
3970 if test "$ac_cv_cpp_explicit" = yes ; then
3971 AC_DEFINE(HAVE_CPP_EXPLICIT)
3974 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3976 [AC_TRY_COMPILE(class param {
3978 typedef unsigned long num_type;
3981 template <class T> class tplt {
3983 typedef typename T::num_type t_num_type;
3984 t_num_type foo(typename T::num_type num) {
3990 ac_cv_cpp_typename=yes,
3991 ac_cv_cpp_typename=no)])
3992 if test "$ac_cv_cpp_typename" = yes ; then
3993 AC_DEFINE(HAVE_CPP_TYPENAME)
3996 dnl Check for support of modern template specialization syntax
3997 dnl Test code and requirement from scc@netscape.com.
3998 dnl Autoconf cut-and-paste job by waterson@netscape.com
3999 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4000 ac_cv_cpp_modern_specialize_template_syntax,
4001 [AC_TRY_COMPILE(template <class T> struct X { int a; };
4003 template <> struct X<Y> { double a; };,
4006 ac_cv_cpp_modern_specialize_template_syntax=yes,
4007 ac_cv_cpp_modern_specialize_template_syntax=no)])
4008 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4009 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4013 dnl Some compilers support only full specialization, and some don't.
4014 AC_CACHE_CHECK(whether partial template specialization works,
4015 ac_cv_cpp_partial_specialization,
4016 [AC_TRY_COMPILE(template <class T> class Foo {};
4017 template <class T> class Foo<T*> {};,
4019 ac_cv_cpp_partial_specialization=yes,
4020 ac_cv_cpp_partial_specialization=no)])
4021 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4022 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4025 dnl Some compilers have limited support for operators with templates;
4026 dnl specifically, it is necessary to define derived operators when a base
4027 dnl class's operator declaration should suffice.
4028 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4029 ac_cv_need_derived_template_operators,
4030 [AC_TRY_COMPILE([template <class T> class Base { };
4032 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4033 template <class T> class Derived : public Base<T> { };],
4034 [Derived<char> a, b;
4035 Base<char> c = a + b;
4037 ac_cv_need_derived_template_operators=no,
4038 ac_cv_need_derived_template_operators=yes)])
4039 if test "$ac_cv_need_derived_template_operators" = yes ; then
4040 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4044 dnl Some compilers have trouble detecting that a template class
4045 dnl that derives from another template is actually an instance
4046 dnl of the base class. This test checks for that.
4047 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4048 ac_cv_need_cpp_template_cast_to_base,
4049 [AC_TRY_COMPILE([template <class T> class Base { };
4050 template <class T> class Derived : public Base<T> { };
4051 template <class T> int foo(const Base<T>&) { return 0; }],
4052 [Derived<char> bar; return foo(bar);],
4053 ac_cv_need_cpp_template_cast_to_base=no,
4054 ac_cv_need_cpp_template_cast_to_base=yes)])
4055 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4056 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4059 dnl Some compilers have trouble resolving the ambiguity between two
4060 dnl functions whose arguments differ only by cv-qualifications.
4061 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4062 ac_cv_can_resolve_const_ambiguity,
4064 template <class T> class ptrClass {
4068 template <class T> T* a(ptrClass<T> *arg) {
4073 const T* a(const ptrClass<T> *arg) {
4079 ac_cv_can_resolve_const_ambiguity=yes,
4080 ac_cv_can_resolve_const_ambiguity=no)])
4081 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4082 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4086 dnl We don't do exceptions on unix. The only reason this used to be here
4087 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4088 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4089 dnl So im commenting this out until someone writes some artificial
4090 dnl intelligence to detect not only if the compiler has exceptions, but if
4091 dnl they are enabled as well.
4093 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4094 dnl ac_cv_cpp_exceptions,
4095 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4096 dnl static void F() { throw X(); },
4097 dnl try { F(); } catch(X & e) { },
4098 dnl ac_cv_cpp_exceptions=yes,
4099 dnl ac_cv_cpp_exceptions=no)])
4100 dnl if test $ac_cv_cpp_exceptions = yes ; then
4101 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4104 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4105 dnl supports it well enough to allow us to use it to change access, but not
4106 dnl to resolve ambiguity. The next two tests determine how well the |using|
4107 dnl keyword is supported.
4109 dnl Check to see if we can change access with |using|. Test both a
4110 dnl legal and an illegal example.
4111 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4112 ac_cv_cpp_access_changing_using2,
4114 class A { protected: int foo() { return 0; } };
4115 class B : public A { public: using A::foo; };,
4116 B b; return b.foo();,
4118 class A { public: int foo() { return 1; } };
4119 class B : public A { private: using A::foo; };,
4120 B b; return b.foo();,
4121 ac_cv_cpp_access_changing_using2=no,
4122 ac_cv_cpp_access_changing_using2=yes)],
4123 ac_cv_cpp_access_changing_using2=no)])
4124 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4125 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4128 dnl Check to see if we can resolve ambiguity with |using|.
4129 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4130 ac_cv_cpp_ambiguity_resolving_using,
4131 [AC_TRY_COMPILE(class X {
4132 public: int go(const X&) {return 3;}
4133 int jo(const X&) {return 3;}
4135 class Y : public X {
4136 public: int go(int) {return 2;}
4137 int jo(int) {return 2;}
4139 private: using X::go;
4142 ac_cv_cpp_ambiguity_resolving_using=yes,
4143 ac_cv_cpp_ambiguity_resolving_using=no)])
4144 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4145 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4148 dnl Check to see if the |std| namespace is supported. If so, we'll want
4149 dnl to qualify any standard library calls with "std::" to ensure that
4150 dnl those functions can be resolved.
4151 AC_CACHE_CHECK(for \"std::\" namespace,
4152 ac_cv_cpp_namespace_std,
4153 [AC_TRY_COMPILE([#include <algorithm>],
4154 [return std::min(0, 1);],
4155 ac_cv_cpp_namespace_std=yes,
4156 ac_cv_cpp_namespace_std=no)])
4157 if test "$ac_cv_cpp_namespace_std" = yes ; then
4158 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4161 dnl Older compilers are overly ambitious with respect to using the standard
4162 dnl template library's |operator!=()| when |operator==()| is defined. In
4163 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4164 dnl ambiguity at compile-time. This test checks for that case.
4165 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4166 ac_cv_cpp_unambiguous_std_notequal,
4167 [AC_TRY_COMPILE([#include <algorithm>
4169 int operator==(const T1&, const T1&) { return 0; }
4170 int operator!=(const T1&, const T1&) { return 0; }],
4171 [T1 a,b; return a != b;],
4172 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4173 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4174 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4175 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4179 AC_CACHE_CHECK(for C++ reinterpret_cast,
4180 ac_cv_cpp_reinterpret_cast,
4181 [AC_TRY_COMPILE(struct X { int i; };
4182 struct Y { int i; };,
4183 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4184 ac_cv_cpp_reinterpret_cast=yes,
4185 ac_cv_cpp_reinterpret_cast=no)])
4186 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4187 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4190 dnl See if a dynamic_cast to void* gives the most derived object.
4191 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4192 ac_cv_cpp_dynamic_cast_void_ptr,
4193 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4194 class Y { int j; public: virtual ~Y() { } };
4195 class Z : public X, public Y { int k; };
4201 return !((((void*)&mdo != (void*)subx) &&
4202 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4203 (((void*)&mdo != (void*)suby) &&
4204 ((void*)&mdo == dynamic_cast<void*>(suby))));
4206 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4207 ac_cv_cpp_dynamic_cast_void_ptr=no,
4208 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4209 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4210 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4214 dnl note that this one is reversed - if the test fails, then
4215 dnl we require implementations of unused virtual methods. Which
4216 dnl really blows because it means we'll have useless vtable
4218 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4219 ac_cv_cpp_unused_required,
4220 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4222 ac_cv_cpp_unused_required=no,
4223 ac_cv_cpp_unused_required=yes)])
4224 if test "$ac_cv_cpp_unused_required" = yes ; then
4225 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4229 dnl Some compilers have trouble comparing a constant reference to a templatized
4230 dnl class to zero, and require an explicit operator==() to be defined that takes
4231 dnl an int. This test separates the strong from the weak.
4233 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4234 ac_cv_trouble_comparing_to_zero,
4235 [AC_TRY_COMPILE([#include <algorithm>
4236 template <class T> class Foo {};
4238 template <class T> int operator==(const T2*, const T&) { return 0; }
4239 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4240 [Foo<int> f; return (0 != f);],
4241 ac_cv_trouble_comparing_to_zero=no,
4242 ac_cv_trouble_comparing_to_zero=yes)])
4243 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4244 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4247 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4248 _SAVE_LDFLAGS=$LDFLAGS
4249 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4250 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4251 ac_cv_thread_keyword,
4252 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4253 [return tlsIsMainThread;],
4254 ac_cv_thread_keyword=yes,
4255 ac_cv_thread_keyword=no)])
4256 LDFLAGS=$_SAVE_LDFLAGS
4257 if test "$ac_cv_thread_keyword" = yes; then
4258 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4261 dnl Check for the existence of various allocation headers/functions
4264 AC_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4265 if test "$MALLOC_H" = ""; then
4266 AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4267 if test "$MALLOC_H" = ""; then
4268 AC_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4271 if test "$MALLOC_H" != ""; then
4272 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4275 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4276 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4278 dnl See if compiler supports some gcc-style attributes
4280 AC_CACHE_CHECK(for __attribute__((always_inline)),
4281 ac_cv_attribute_always_inline,
4283 [inline void f(void) __attribute__((always_inline));],
4284 ac_cv_attribute_always_inline=yes,
4285 ac_cv_attribute_always_inline=no)])
4287 AC_CACHE_CHECK(for __attribute__((malloc)),
4288 ac_cv_attribute_malloc,
4290 [void* f(int) __attribute__((malloc));],
4291 ac_cv_attribute_malloc=yes,
4292 ac_cv_attribute_malloc=no)])
4294 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4295 ac_cv_attribute_warn_unused,
4297 [int f(void) __attribute__((warn_unused_result));],
4298 ac_cv_attribute_warn_unused=yes,
4299 ac_cv_attribute_warn_unused=no)])
4301 AC_CACHE_CHECK(for __attribute__((noreturn)),
4302 ac_cv_attribute_noreturn,
4304 [void f(void) __attribute__((noreturn));],
4305 ac_cv_attribute_noreturn=yes,
4306 ac_cv_attribute_noreturn=no)])
4308 dnl End of C++ language/feature checks
4311 dnl ========================================================
4312 dnl = Internationalization checks
4313 dnl ========================================================
4315 dnl Internationalization and Locale support is different
4316 dnl on various UNIX platforms. Checks for specific i18n
4317 dnl features go here.
4319 dnl check for LC_MESSAGES
4320 AC_CACHE_CHECK(for LC_MESSAGES,
4321 ac_cv_i18n_lc_messages,
4322 [AC_TRY_COMPILE([#include <locale.h>],
4323 [int category = LC_MESSAGES;],
4324 ac_cv_i18n_lc_messages=yes,
4325 ac_cv_i18n_lc_messages=no)])
4326 if test "$ac_cv_i18n_lc_messages" = yes; then
4327 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4330 fi # SKIP_COMPILER_CHECKS
4333 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4334 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4337 dnl Mozilla specific options
4338 dnl ========================================================
4339 dnl The macros used for command line options
4340 dnl are defined in build/autoconf/altoptions.m4.
4342 dnl If the compiler supports these attributes, define them as
4343 dnl convenience macros.
4344 if test "$ac_cv_attribute_always_inline" = yes ; then
4345 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4347 AC_DEFINE(NS_ALWAYS_INLINE,)
4350 if test "$ac_cv_attribute_malloc" = yes ; then
4351 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4353 AC_DEFINE(NS_ATTR_MALLOC,)
4356 if test "$ac_cv_attribute_warn_unused" = yes ; then
4357 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4359 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4362 if test "$ac_cv_attribute_noreturn" = yes ; then
4363 AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4365 AC_DEFINE(NS_NORETURN,)
4368 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4369 dnl features that Windows actually does support.
4371 if test -n "$SKIP_COMPILER_CHECKS"; then
4372 dnl Windows has malloc.h
4373 AC_DEFINE(MALLOC_H, [<malloc.h>])
4374 AC_DEFINE(HAVE_FORCEINLINE)
4375 fi # SKIP_COMPILER_CHECKS
4377 dnl ========================================================
4379 dnl = Check for external package dependencies
4381 dnl ========================================================
4382 MOZ_ARG_HEADER(External Packages)
4386 MOZ_ARG_WITH_STRING(libxul-sdk,
4387 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4388 LIBXUL_SDK_DIR=$withval)
4390 if test "$LIBXUL_SDK_DIR" = "yes"; then
4391 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4392 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4393 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4395 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4396 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4401 AC_SUBST(LIBXUL_SDK)
4403 if test -n "$LIBXUL_SDK"; then
4404 LIBXUL_DIST="$LIBXUL_SDK"
4406 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4408 AC_SUBST(LIBXUL_DIST)
4412 MOZ_ARG_WITH_BOOL(system-libxul,
4413 [ --with-system-libxul Use system installed libxul SDK],
4416 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4417 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4420 dnl ========================================================
4421 dnl = If NSPR was not detected in the system,
4422 dnl = use the one in the source tree (mozilla/nsprpub)
4423 dnl ========================================================
4424 MOZ_ARG_WITH_BOOL(system-nspr,
4425 [ --with-system-nspr Use system installed NSPR],
4426 _USE_SYSTEM_NSPR=1 )
4428 if test -n "$_USE_SYSTEM_NSPR"; then
4429 AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4432 if test -n "$MOZ_NATIVE_NSPR"; then
4433 _SAVE_CFLAGS=$CFLAGS
4434 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4435 AC_TRY_COMPILE([#include "prlog.h"],
4436 [#ifndef PR_STATIC_ASSERT
4437 #error PR_STATIC_ASSERT not defined
4439 [MOZ_NATIVE_NSPR=1],
4440 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4441 CFLAGS=$_SAVE_CFLAGS
4443 if test "$OS_ARCH" = "WINCE"; then
4444 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4445 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4446 elif test "$OS_ARCH" = "WINNT"; then
4447 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4448 if test -n "$GNU_CC"; then
4449 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4451 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4454 NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4455 NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4459 dnl ========================================================
4460 dnl = If NSS was not detected in the system,
4461 dnl = use the one in the source tree (mozilla/security/nss)
4462 dnl ========================================================
4464 MOZ_ARG_WITH_BOOL(system-nss,
4465 [ --with-system-nss Use system installed NSS],
4468 if test -n "$_USE_SYSTEM_NSS"; then
4469 AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4472 if test -n "$MOZ_NATIVE_NSS"; then
4473 NSS_LIBS="$NSS_LIBS -lcrmf"
4475 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4477 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4478 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4479 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4480 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4481 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4483 if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4485 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4486 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4487 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4488 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4489 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4491 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4495 if test -z "$SKIP_LIBRARY_CHECKS"; then
4496 dnl system JPEG support
4497 dnl ========================================================
4498 MOZ_ARG_WITH_STRING(system-jpeg,
4499 [ --with-system-jpeg[=PFX]
4500 Use system libjpeg [installed at prefix PFX]],
4503 _SAVE_CFLAGS=$CFLAGS
4504 _SAVE_LDFLAGS=$LDFLAGS
4506 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4507 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4508 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4510 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4513 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4516 if test "$SYSTEM_JPEG" = 1; then
4517 LIBS="$JPEG_LIBS $LIBS"
4518 AC_TRY_COMPILE([ #include <stdio.h>
4519 #include <sys/types.h>
4520 #include <jpeglib.h> ],
4521 [ #if JPEG_LIB_VERSION < $MOZJPEG
4522 #error "Insufficient JPEG library version ($MOZJPEG required)."
4525 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4527 CFLAGS=$_SAVE_CFLAGS
4528 LDFLAGS=$_SAVE_LDFLAGS
4531 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4532 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4533 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4536 dnl system ZLIB support
4537 dnl ========================================================
4538 MOZ_ARG_WITH_STRING(system-zlib,
4539 [ --with-system-zlib[=PFX]
4540 Use system libz [installed at prefix PFX]],
4543 _SAVE_CFLAGS=$CFLAGS
4544 _SAVE_LDFLAGS=$LDFLAGS
4546 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4547 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4548 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4550 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4553 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4554 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4556 if test "$SYSTEM_ZLIB" = 1; then
4557 LIBS="$ZLIB_LIBS $LIBS"
4558 AC_TRY_COMPILE([ #include <stdio.h>
4560 #include <zlib.h> ],
4561 [ #if ZLIB_VERNUM < $MOZZLIB
4562 #error "Insufficient zlib version ($MOZZLIB required)."
4565 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4567 CFLAGS=$_SAVE_CFLAGS
4568 LDFLAGS=$_SAVE_LDFLAGS
4571 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4572 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4573 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4576 dnl system BZIP2 Support
4577 dnl ========================================================
4578 MOZ_ARG_WITH_STRING(system-bz2,
4579 [ --with-system-bz2[=PFX]
4580 Use system libbz2 [installed at prefix PFX]],
4583 _SAVE_CFLAGS=$CFLAGS
4584 _SAVE_LDFLAGS=$LDFLAGS
4586 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4587 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4588 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4590 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4593 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4594 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4596 CFLAGS=$_SAVE_CFLAGS
4597 LDFLAGS=$_SAVE_LDFLAGS
4600 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4601 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4602 BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4605 dnl system PNG Support
4606 dnl ========================================================
4607 MOZ_ARG_WITH_STRING(system-png,
4608 [ --with-system-png[=PFX]
4609 Use system libpng [installed at prefix PFX]],
4612 _SAVE_CFLAGS=$CFLAGS
4613 _SAVE_LDFLAGS=$LDFLAGS
4615 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4616 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4617 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4618 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4619 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4621 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4624 _SAVE_PNG_LIBS=$PNG_LIBS
4625 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4626 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4628 AC_CHECK_LIB(png, png_get_acTL, ,
4629 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4632 if test "$SYSTEM_PNG" = 1; then
4633 LIBS="$PNG_LIBS $LIBS"
4634 AC_TRY_COMPILE([ #include <stdio.h>
4635 #include <sys/types.h>
4637 [ #if PNG_LIBPNG_VER < $MOZPNG
4638 #error "Insufficient libpng version ($MOZPNG required)."
4640 #ifndef PNG_UINT_31_MAX
4641 #error "Insufficient libpng version."
4644 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4646 CFLAGS=$_SAVE_CFLAGS
4647 LDFLAGS=$_SAVE_LDFLAGS
4650 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4651 PNG_CFLAGS="-I${PNG_DIR}/include"
4652 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4655 fi # SKIP_LIBRARY_CHECKS
4657 dnl system HunSpell Support
4658 dnl ========================================================
4659 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4660 [ --enable-system-hunspell Use system hunspell (located with pkgconfig)],
4663 if test -n "$SYSTEM_HUNSPELL"; then
4664 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4667 AC_SUBST(SYSTEM_HUNSPELL)
4669 dnl ========================================================
4670 dnl Java SDK support
4671 dnl ========================================================
4673 MOZ_ARG_WITH_STRING(java-include-path,
4674 [ --with-java-include-path=dir Location of Java SDK headers],
4675 JAVA_INCLUDE_PATH=$withval)
4678 MOZ_ARG_WITH_STRING(java-bin-path,
4679 [ --with-java-bin-path=dir Location of Java binaries (java, javac, jar)],
4680 JAVA_BIN_PATH=$withval)
4682 dnl ========================================================
4683 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4684 dnl their usage and use them in spidermonkey.
4685 dnl ========================================================
4686 MOZ_ARG_WITH_BOOL(arm-kuser,
4687 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4690 if test -n "$USE_ARM_KUSER"; then
4691 AC_DEFINE(USE_ARM_KUSER)
4694 dnl ========================================================
4698 dnl ========================================================
4700 MOZ_ARG_HEADER(Application)
4704 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4705 MOZ_BRANDING_DIRECTORY=
4706 MOZ_OFFICIAL_BRANDING=
4708 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4709 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4717 MOZ_AUTH_EXTENSION=1
4718 MOZ_NO_ACTIVEX_SUPPORT=1
4719 MOZ_NO_INSPECTOR_APIS=
4728 MOZ_PLAINTEXT_EDITOR_ONLY=
4730 MOZ_PREF_EXTENSIONS=1
4731 MOZ_PROFILELOCKING=1
4743 MOZ_TOOLKIT_SEARCH=1
4745 MOZ_UNIVERSALCHARDET=1
4747 MOZ_USE_NATIVE_UCONV=
4749 MOZ_XPFE_COMPONENTS=1
4751 MOZ_XSLT_STANDALONE=
4759 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4760 NECKO_SMALL_BUFFERS=
4762 XPC_IDISPATCH_SUPPORT=
4765 case "$target_os" in
4766 darwin*|*wince*|*winmo*)
4774 case "$target_os" in
4775 msvc*|mks*|cygwin*|mingw*)
4777 if test -z "$GNU_CC"; then
4778 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4781 XPC_IDISPATCH_SUPPORT=1
4782 MOZ_NO_ACTIVEX_SUPPORT=
4784 if test -n "$NS_ENABLE_TSF"; then
4785 AC_DEFINE(NS_ENABLE_TSF)
4790 MOZ_ARG_ENABLE_STRING(application,
4791 [ --enable-application=APP
4795 content/xslt (Standalone Transformiix XSLT)
4796 netwerk (Standalone Necko)
4797 tools/update-packaging (AUS-related packaging tools)
4798 standalone (use this for standalone
4799 xpcom/xpconnect or to manually drive a build)],
4800 [ MOZ_BUILD_APP=$enableval ] )
4802 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4803 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4804 XULRUNNER_STUB_NAME=$withval)
4806 if test -z "$XULRUNNER_STUB_NAME"; then
4807 case "$target_os" in
4809 XULRUNNER_STUB_NAME=xulrunner
4812 XULRUNNER_STUB_NAME=xulrunner-stub
4815 AC_SUBST(XULRUNNER_STUB_NAME)
4817 if test -z "$MOZ_BUILD_APP"; then
4818 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4820 # We have a valid application only if it has a build.mk file in its top
4822 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4823 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4827 # Allow the application to influence configure with a confvars.sh script.
4829 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4830 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4831 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4832 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4837 # Now is a good time to test for logic errors, define mismatches, etc.
4838 case "$MOZ_BUILD_APP" in
4840 if test "$LIBXUL_SDK"; then
4841 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4846 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4847 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4849 case "$MOZ_BUILD_APP" in
4851 AC_DEFINE(MOZ_PHOENIX)
4855 AC_DEFINE(MOZ_XULRUNNER)
4863 MOZ_APP_NAME=mozilla
4864 MOZ_APP_DISPLAYNAME=Mozilla
4865 MOZ_APP_VERSION=$MOZILLA_VERSION
4870 AC_SUBST(MOZ_BUILD_APP)
4871 AC_SUBST(MOZ_PHOENIX)
4872 AC_SUBST(MOZ_XULRUNNER)
4874 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4876 dnl ========================================================
4878 dnl = Toolkit Options
4880 dnl ========================================================
4881 MOZ_ARG_HEADER(Toolkit Options)
4883 dnl ========================================================
4884 dnl = Select the default toolkit
4885 dnl ========================================================
4886 MOZ_ARG_ENABLE_STRING(default-toolkit,
4887 [ --enable-default-toolkit=TK
4888 Select default toolkit
4889 Platform specific defaults:
4891 Mac OS X - cairo-cocoa
4892 Neutrino/QNX - photon
4894 Win32/WinCE - cairo-windows
4895 Gtk2 with DirectFB - cairo-gtk2-dfb
4898 [ _DEFAULT_TOOLKIT=$enableval ],
4899 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4901 if test "$_DEFAULT_TOOLKIT" = "photon" \
4902 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4903 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4904 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4905 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4906 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4907 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4908 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4909 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4911 dnl nglayout only supports building with one toolkit,
4912 dnl so ignore everything after the first comma (",").
4913 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4915 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4918 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4920 dnl ========================================================
4921 dnl = Enable the toolkit as needed =
4922 dnl ========================================================
4924 case "$MOZ_WIDGET_TOOLKIT" in
4927 AC_DEFINE(MOZ_WIDGET_PHOTON)
4931 MOZ_WIDGET_TOOLKIT=windows
4940 cairo-gtk2|cairo-gtk2-x11)
4941 MOZ_WIDGET_TOOLKIT=gtk2
4943 MOZ_ENABLE_XREMOTE=1
4951 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4952 TK_LIBS='$(MOZ_GTK2_LIBS)'
4953 AC_DEFINE(MOZ_WIDGET_GTK2)
4957 MOZ_WIDGET_TOOLKIT=gtk2
4964 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4965 TK_LIBS='$(MOZ_GTK2_LIBS)'
4966 AC_DEFINE(MOZ_WIDGET_GTK2)
4967 if test "$no_x" != "yes"; then
4968 AC_MSG_WARN([Disabling X when DirectFB is specified.])
4974 MOZ_WIDGET_TOOLKIT=qt
4976 MOZ_ENABLE_XREMOTE=1
4984 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4985 TK_LIBS='$(MOZ_QT_LIBS)'
4986 AC_DEFINE(MOZ_WIDGET_QT)
4990 MOZ_WIDGET_TOOLKIT=beos
4992 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4993 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4997 MOZ_WIDGET_TOOLKIT=os2
4999 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5000 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5004 MOZ_WIDGET_TOOLKIT=cocoa
5005 AC_DEFINE(MOZ_WIDGET_COCOA)
5006 MOZ_USER_DIR="Mozilla"
5007 AC_DEFINE(XP_MACOSX)
5008 TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
5009 TK_CFLAGS="-DNO_X11"
5010 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5011 CFLAGS="$CFLAGS $TK_CFLAGS"
5012 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5013 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5014 MOZ_FS_LAYOUT=bundle
5019 if test "$MOZ_ENABLE_XREMOTE"; then
5020 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5023 if test "$COMPILE_ENVIRONMENT"; then
5024 if test "$MOZ_ENABLE_GTK2"; then
5025 if test "$MOZ_X11"; then
5026 GDK_PACKAGES=gdk-x11-2.0
5027 elif test "$MOZ_DFB"; then
5028 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5029 GDK_PACKAGES=directfb
5032 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5035 fi # COMPILE_ENVIRONMENT
5037 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
5038 AC_SUBST(MOZ_FS_LAYOUT)
5040 dnl ========================================================
5041 dnl = startup-notification support module
5042 dnl ========================================================
5044 if test "$MOZ_ENABLE_GTK2"
5046 MOZ_ENABLE_STARTUP_NOTIFICATION=
5048 MOZ_ARG_ENABLE_BOOL(startup-notification,
5049 [ --enable-startup-notification Enable startup-notification support (default: disabled) ],
5050 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5051 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5052 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5054 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5055 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5056 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5057 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5059 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5061 MOZ_ENABLE_STARTUP_NOTIFICATION=
5065 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5066 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5069 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5071 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5072 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5073 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5075 dnl ========================================================
5077 dnl ========================================================
5078 if test "$MOZ_ENABLE_QT"
5080 MOZ_ARG_WITH_STRING(qtdir,
5081 [ --with-qtdir=\$dir Specify Qt directory ],
5084 if test -z "$QTDIR"; then
5085 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore)
5086 AC_CHECK_PROGS(HOST_MOC, moc, "")
5088 MOZ_QT_LIBS="-L$QTDIR/qt/lib/ -lQtGui -lQtNetwork -lQtCore"
5090 MOZ_QT_CFLAGS="-DQT_SHARED"
5091 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include"
5092 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/Qt"
5093 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtGui"
5094 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtCore"
5095 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtNetwork"
5097 HOST_MOC="$QTDIR/qt/bin/moc"
5099 if test -z "$HOST_MOC"; then
5100 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5106 AC_SUBST(GTK_CONFIG)
5110 AC_SUBST(MOZ_ENABLE_GTK2)
5111 AC_SUBST(MOZ_ENABLE_PHOTON)
5112 AC_SUBST(MOZ_ENABLE_QT)
5113 AC_SUBST(MOZ_ENABLE_XREMOTE)
5114 AC_SUBST(MOZ_GTK2_CFLAGS)
5115 AC_SUBST(MOZ_GTK2_LIBS)
5116 AC_SUBST(MOZ_QT_CFLAGS)
5117 AC_SUBST(MOZ_QT_LIBS)
5124 dnl ========================================================
5126 dnl = Components & Features
5128 dnl ========================================================
5129 MOZ_ARG_HEADER(Components and Features)
5131 dnl ========================================================
5133 dnl ========================================================
5134 MOZ_ARG_ENABLE_STRING(ui-locale,
5135 [ --enable-ui-locale=ab-CD
5136 Select the user interface locale (default: en-US)],
5137 MOZ_UI_LOCALE=$enableval )
5138 AC_SUBST(MOZ_UI_LOCALE)
5140 dnl ========================================================
5141 dnl = Trademarked Branding
5142 dnl ========================================================
5143 MOZ_ARG_ENABLE_BOOL(official-branding,
5144 [ --enable-official-branding Enable Official mozilla.org Branding
5145 Do not distribute builds with
5146 --enable-official-branding unless you have
5147 permission to use trademarks per
5148 http://www.mozilla.org/foundation/trademarks/ .],
5150 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5151 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5153 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5154 MOZ_OFFICIAL_BRANDING=1
5156 ], MOZ_OFFICIAL_BRANDING=)
5158 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5159 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5160 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5163 MOZ_ARG_WITH_STRING(branding,
5164 [ --with-branding=dir Use branding from the specified directory.],
5165 MOZ_BRANDING_DIRECTORY=$withval)
5167 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5168 if test -z "$REAL_BRANDING_DIRECTORY"; then
5169 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5172 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5173 . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
5176 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5178 dnl ========================================================
5179 dnl = Distribution ID
5180 dnl ========================================================
5181 MOZ_ARG_WITH_STRING(distribution-id,
5182 [ --with-distribution-id=ID Set distribution-specific id (default=org.mozilla)],
5183 [ val=`echo $withval`
5184 MOZ_DISTRIBUTION_ID="$val"])
5186 if test -z "$MOZ_DISTRIBUTION_ID"; then
5187 MOZ_DISTRIBUTION_ID="org.mozilla"
5190 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5191 AC_SUBST(MOZ_DISTRIBUTION_ID)
5194 dnl ========================================================
5195 dnl complex text support off by default
5196 dnl ========================================================
5197 MOZ_ARG_DISABLE_BOOL(pango,
5198 [ --disable-pango Disable usage of Pango ],
5202 dnl ========================================================
5204 dnl ========================================================
5205 if test "$MOZ_ENABLE_GTK2"
5209 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5211 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5212 AC_SUBST(MOZ_PANGO_CFLAGS)
5213 AC_SUBST(MOZ_PANGO_LIBS)
5214 if test "$MOZ_PANGO"
5216 AC_DEFINE(MOZ_PANGO)
5218 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5219 AC_SUBST(FT2_CFLAGS)
5224 if test "$MOZ_ENABLE_QT"
5226 if test "$MOZ_PANGO"
5228 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5230 AC_SUBST(MOZ_PANGO_CFLAGS)
5231 AC_SUBST(MOZ_PANGO_LIBS)
5232 AC_DEFINE(MOZ_PANGO)
5235 echo "Pango library not found, will use FT2 font engine"
5242 dnl ========================================================
5243 dnl = GnomeVFS, GIO and GConf support module
5244 dnl ========================================================
5248 dnl build the gnomevfs extension by default only when the
5249 dnl GTK2 toolkit is in use.
5250 if test "$MOZ_ENABLE_GTK2"
5252 MOZ_ENABLE_GNOMEVFS=1
5256 dnl ========================================================
5257 dnl = GnomeVFS support module
5258 dnl ========================================================
5259 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5260 [ --disable-gnomevfs Disable GnomeVFS support ],
5261 MOZ_ENABLE_GNOMEVFS=,
5262 MOZ_ENABLE_GNOMEVFS=force)
5264 if test "$MOZ_ENABLE_GNOMEVFS"
5266 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5267 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5268 MOZ_ENABLE_GNOMEVFS=1
5269 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5271 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5273 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5275 MOZ_ENABLE_GNOMEVFS=
5278 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
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\>//'`
5285 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5286 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5287 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5289 dnl ========================================================
5290 dnl = GIO support module
5291 dnl ========================================================
5292 MOZ_ARG_ENABLE_BOOL(gio,
5293 [ --enable-gio Enable GIO support (default: disabled)],
5294 MOZ_ENABLE_GIO=force,
5297 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5299 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5300 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5302 AC_DEFINE(MOZ_ENABLE_GIO)
5304 if test "$MOZ_ENABLE_GIO" = "force"
5306 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5312 AC_SUBST(MOZ_ENABLE_GIO)
5313 AC_SUBST(MOZ_GIO_CFLAGS)
5314 AC_SUBST(MOZ_GIO_LIBS)
5316 dnl ========================================================
5317 dnl = GConf support module
5318 dnl ========================================================
5319 if test "$MOZ_ENABLE_GCONF"
5321 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5322 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5325 if test "$MOZ_ENABLE_GCONF" = "force"
5327 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5333 if test "$MOZ_ENABLE_GCONF"; then
5334 AC_DEFINE(MOZ_ENABLE_GCONF)
5337 AC_SUBST(MOZ_ENABLE_GCONF)
5338 AC_SUBST(MOZ_GCONF_CFLAGS)
5339 AC_SUBST(MOZ_GCONF_LIBS)
5342 dnl ========================================================
5343 dnl = libnotify support
5344 dnl ========================================================
5346 if test "$MOZ_ENABLE_GTK2"
5348 MOZ_ENABLE_LIBNOTIFY=1
5350 MOZ_ARG_DISABLE_BOOL(libnotify,
5351 [ --disable-libnotify Disable libnotify support ],
5352 MOZ_ENABLE_LIBNOTIFY=,
5353 MOZ_ENABLE_LIBNOTIFY=1)
5355 if test "$MOZ_ENABLE_LIBNOTIFY"
5357 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5361 if test -z "$SKIP_LIBRARY_CHECKS"
5363 if test "$MOZ_ENABLE_GTK2"
5365 if test "$MOZ_ENABLE_LIBNOTIFY"
5367 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5371 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5372 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5373 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5375 dnl ========================================================
5376 dnl = GNOME component (mozgnome)
5377 dnl ========================================================
5379 # The GNOME component is built if one of
5380 # gnome-vfs, gio, gconf or libnotify is available.
5381 if test "$MOZ_ENABLE_GCONF" || \
5382 test "$MOZ_ENABLE_GNOMEVFS" || \
5383 test "$MOZ_ENABLE_GIO" || \
5384 test "$MOZ_ENABLE_LIBNOTIFY"; then
5385 MOZ_ENABLE_GNOME_COMPONENT=1
5387 MOZ_ENABLE_GNOME_COMPONENT=
5389 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5391 dnl ========================================================
5392 dnl = libgnomeui support module
5393 dnl ========================================================
5395 if test "$MOZ_ENABLE_GTK2"
5397 MOZ_ENABLE_GNOMEUI=1
5399 MOZ_ARG_DISABLE_BOOL(gnomeui,
5400 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5401 MOZ_ENABLE_GNOMEUI=,
5402 MOZ_ENABLE_GNOMEUI=force)
5404 if test "$MOZ_ENABLE_GNOMEUI"
5406 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5408 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5409 MOZ_ENABLE_GNOMEUI=1
5411 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5413 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5419 if test "$MOZ_ENABLE_GNOMEUI"; then
5420 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5424 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5425 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5426 AC_SUBST(MOZ_GNOMEUI_LIBS)
5428 dnl ========================================================
5430 dnl ========================================================
5432 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5436 MOZ_ARG_DISABLE_BOOL(dbus,
5437 [ --disable-dbus Disable dbus support ],
5441 if test "$MOZ_ENABLE_DBUS"
5443 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5444 AC_DEFINE(MOZ_ENABLE_DBUS)
5447 AC_SUBST(MOZ_ENABLE_DBUS)
5448 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5449 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5451 dnl ========================================================
5452 dnl = Build Personal Security Manager
5453 dnl ========================================================
5454 MOZ_ARG_DISABLE_BOOL(crypto,
5455 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5459 dnl ========================================================
5460 dnl = JS Debugger XPCOM component (js/jsd)
5461 dnl ========================================================
5462 MOZ_ARG_DISABLE_BOOL(jsd,
5463 [ --disable-jsd Disable JavaScript debug library],
5468 dnl ========================================================
5469 dnl = Disable IPC support for tabs and plugins
5470 dnl ========================================================
5472 powerpc-apple-darwin*)
5483 MOZ_ARG_DISABLE_BOOL(ipc,
5484 [ --disable-ipc Disable IPC supports for tabs and plugins],
5488 if test -n "$MOZ_IPC"; then
5494 dnl ========================================================
5495 dnl = Enable IPDL's "expensive" unit tests
5496 dnl ========================================================
5499 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5500 [ --enable-ipdl-tests Enable expensive IPDL tests],
5504 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5505 AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5508 if test -n "$MOZ_IPDL_TESTS"; then
5509 AC_DEFINE(MOZ_IPDL_TESTS)
5512 AC_SUBST(MOZ_IPDL_TESTS)
5514 dnl ========================================================
5515 dnl = Disable plugin support
5516 dnl ========================================================
5517 MOZ_ARG_DISABLE_BOOL(plugins,
5518 [ --disable-plugins Disable plugins support],
5522 dnl ========================================================
5523 dnl = Disable building dbm
5524 dnl ========================================================
5525 MOZ_ARG_DISABLE_BOOL(dbm,
5526 [ --disable-dbm Disable building dbm],
5530 dnl bi-directional support always on
5534 dnl ========================================================
5535 dnl view source support on by default
5536 dnl ========================================================
5537 if test "$MOZ_VIEW_SOURCE"; then
5538 AC_DEFINE(MOZ_VIEW_SOURCE)
5541 dnl ========================================================
5542 dnl accessibility support on by default on all platforms
5544 dnl ========================================================
5545 MOZ_ARG_DISABLE_BOOL(accessibility,
5546 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5549 if test "$ACCESSIBILITY"; then
5550 AC_DEFINE(ACCESSIBILITY)
5553 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5555 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5556 if test "$ac_cv_header_atlbase_h" = "no"; then
5557 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.])
5559 if test "$ac_cv_header_oleacc_idl" = "no"; then
5560 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.])
5566 dnl ========================================================
5567 dnl xpfe/components on by default
5568 dnl ========================================================
5569 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5570 [ --disable-xpfe-components
5571 Disable xpfe components],
5572 MOZ_XPFE_COMPONENTS=,
5573 MOZ_XPFE_COMPONENTS=1 )
5575 dnl ========================================================
5576 dnl xpinstall support on by default
5577 dnl ========================================================
5578 MOZ_ARG_DISABLE_BOOL(xpinstall,
5579 [ --disable-xpinstall Disable xpinstall support],
5582 if test "$MOZ_XPINSTALL"; then
5583 AC_DEFINE(MOZ_XPINSTALL)
5586 dnl ========================================================
5587 dnl xpcom js loader support on by default
5588 dnl ========================================================
5589 if test "$MOZ_JSLOADER"; then
5590 AC_DEFINE(MOZ_JSLOADER)
5593 dnl ========================================================
5594 dnl Disable printing
5595 dnl ========================================================
5596 MOZ_ARG_DISABLE_BOOL(printing,
5597 [ --disable-printing Disable printing support],
5601 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5602 AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5606 if test "$NS_PRINTING"; then
5607 AC_DEFINE(NS_PRINTING)
5608 AC_DEFINE(NS_PRINT_PREVIEW)
5611 dnl ========================================================
5612 dnl use native unicode converters
5613 dnl ========================================================
5614 MOZ_ARG_ENABLE_BOOL(native-uconv,
5615 [ --enable-native-uconv Enable iconv support],
5616 MOZ_USE_NATIVE_UCONV=1,
5617 MOZ_USE_NATIVE_UCONV= )
5618 if test "$MOZ_USE_NATIVE_UCONV"; then
5619 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5621 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5622 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5626 dnl ========================================================
5627 dnl Libeditor can be build as plaintext-only,
5628 dnl or as a full html and text editing component.
5629 dnl We build both by default.
5630 dnl ========================================================
5631 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5632 [ --enable-plaintext-editor-only
5633 Allow only plaintext editing],
5634 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5635 MOZ_PLAINTEXT_EDITOR_ONLY= )
5636 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5637 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5639 dnl ========================================================
5640 dnl = Disable Fast Load
5641 dnl ========================================================
5642 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5643 [ --disable-xpcom-fastload Disable XPCOM fastload support],
5647 AC_SUBST(MOZ_NO_FAST_LOAD)
5649 if test -n "$MOZ_NO_FAST_LOAD"; then
5650 AC_DEFINE(MOZ_NO_FAST_LOAD)
5653 dnl ========================================================
5654 dnl = Disable Ogg Codecs
5655 dnl ========================================================
5656 MOZ_ARG_DISABLE_BOOL(ogg,
5657 [ --disable-ogg Disable Ogg Codec support],
5663 if test -n "$MOZ_OGG"; then
5668 dnl Checks for __attribute__(aligned()) directive
5669 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5670 [ac_cv_c_attribute_aligned],
5671 [ac_cv_c_attribute_aligned=0
5672 CFLAGS_save="${CFLAGS}"
5673 CFLAGS="${CFLAGS} -Werror"
5674 for ac_cv_c_attr_align_try in 64 32 16 8; do
5675 echo "trying $ac_cv_c_attr_align_try"
5677 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5678 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5679 if test "$ac_cv_c_attribute_aligned" != 0; then
5683 CFLAGS="${CFLAGS_save}"])
5684 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5685 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5686 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5690 dnl ========================================================
5691 dnl = Disable Wave decoder support
5692 dnl ========================================================
5693 MOZ_ARG_DISABLE_BOOL(wave,
5694 [ --disable-wave Disable Wave decoder support],
5700 if test -n "$MOZ_WAVE"; then
5706 dnl ========================================================
5707 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5708 dnl ========================================================
5710 AC_SUBST(MOZ_SYDNEYAUDIO)
5712 if test -n "$MOZ_SYDNEYAUDIO"; then
5713 AC_DEFINE(MOZ_SYDNEYAUDIO)
5718 if test -n "$MOZ_MEDIA"; then
5719 AC_DEFINE(MOZ_MEDIA)
5722 dnl ========================================================
5723 dnl = Check alsa availability on Linux if using sydneyaudio
5724 dnl ========================================================
5726 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5727 if test -n "$MOZ_SYDNEYAUDIO"; then
5728 case "$target_os" in
5730 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5731 [echo "$MOZ_ALSA_PKG_ERRORS"
5732 AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux. Disable with --disable-ogg --disable-wave.])])
5736 AC_SUBST(MOZ_ALSA_LIBS)
5738 dnl ========================================================
5740 dnl ========================================================
5741 AC_ARG_ENABLE(splashscreen,
5742 [ --enable-splashscreen display splashscreen while loading (default=no)],
5743 [enable_splash="yes"],[enable_splash=""])
5744 if test "x$enable_splash" = "xyes"; then
5746 AC_DEFINE(MOZ_SPLASHSCREEN)
5748 AC_SUBST(MOZ_SPLASHSCREEN)
5750 dnl ========================================================
5751 dnl Permissions System
5752 dnl ========================================================
5753 MOZ_ARG_DISABLE_BOOL(permissions,
5754 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5759 dnl ========================================================
5761 dnl ========================================================
5762 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5763 [ --disable-negotiateauth Disable GSS-API negotiation ],
5764 MOZ_AUTH_EXTENSION=,
5765 MOZ_AUTH_EXTENSION=1 )
5767 dnl ========================================================
5769 dnl ========================================================
5770 MOZ_ARG_DISABLE_BOOL(xtf,
5771 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5774 if test "$MOZ_XTF"; then
5778 dnl ========================================================
5779 dnl Pref extensions (autoconfig and system-pref)
5780 dnl ========================================================
5781 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5782 [ --disable-pref-extensions
5783 Disable pref extensions such as autoconfig and
5785 MOZ_PREF_EXTENSIONS=,
5786 MOZ_PREF_EXTENSIONS=1 )
5788 dnl ========================================================
5789 dnl = Universalchardet
5790 dnl ========================================================
5791 MOZ_ARG_DISABLE_BOOL(universalchardet,
5792 [ --disable-universalchardet
5793 Disable universal encoding detection],
5794 MOZ_UNIVERSALCHARDET=,
5795 MOZ_UNIVERSALCHARDET=1 )
5797 dnl ========================================================
5799 dnl ========================================================
5806 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5807 [ --enable-javaxpcom
5808 Enable Java-XPCOM bridge],
5812 if test -n "${MOZ_JAVAXPCOM}"; then
5815 if test -n "$JAVA_HOME"; then
5816 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5820 if test -n "$JAVA_HOME"; then
5821 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5826 if test -n "${JAVA_INCLUDE_PATH}"; then
5827 dnl Make sure jni.h exists in the given include path.
5828 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5829 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5832 case "$target_os" in
5834 dnl Default to java system location
5835 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5839 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5842 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5843 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.])
5847 if test -n "${JAVA_BIN_PATH}"; then
5848 dnl Look for javac and jar in the specified path.
5849 JAVA_PATH="$JAVA_BIN_PATH"
5851 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5852 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5855 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5856 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5857 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5858 if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5859 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.])
5863 dnl ========================================================
5864 dnl = Breakpad crash reporting (on by default on supported platforms)
5865 dnl ========================================================
5867 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5868 || test "$OS_ARCH" = "Darwin" \
5869 || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5870 || test "$OS_ARCH" = "SunOS") \
5871 && test -z "$HAVE_64BIT_OS"; then
5875 MOZ_ARG_DISABLE_BOOL(crashreporter,
5876 [ --disable-crashreporter Disable breakpad crash reporting],
5878 MOZ_CRASHREPORTER=1)
5880 if test -n "$MOZ_CRASHREPORTER"; then
5881 AC_DEFINE(MOZ_CRASHREPORTER)
5883 if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5884 test -z "$SKIP_LIBRARY_CHECKS"; then
5885 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5886 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5887 AC_SUBST(MOZ_GTHREAD_LIBS)
5889 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.])])
5893 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5894 [ --with-crashreporter-enable-percent=NN Enable sending crash reports by default on NN% of users. (default=100)],
5895 [ val=`echo $withval | sed 's/[^0-9]//g'`
5896 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5898 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5899 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5901 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5903 dnl ========================================================
5904 dnl = Enable compilation of specific extension modules
5905 dnl ========================================================
5907 MOZ_ARG_ENABLE_STRING(extensions,
5908 [ --enable-extensions Enable extensions],
5909 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5910 if test "$option" = "yes" || test "$option" = "all"; then
5911 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5912 elif test "$option" = "no" || test "$option" = "none"; then
5914 elif test "$option" = "default"; then
5915 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5916 elif test `echo "$option" | grep -c \^-` != 0; then
5917 option=`echo $option | sed 's/^-//'`
5918 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5920 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5923 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5925 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5926 # Suppress warning on non-X11 platforms
5927 if test -n "$MOZ_X11"; then
5928 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5930 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5933 dnl Do not build gnomevfs with libxul based apps
5934 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5935 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5938 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5939 # Suppress warning on non-X11 platforms
5940 if test -n "$MOZ_X11"; then
5941 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5943 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5946 dnl Do not build gio with libxul based apps
5947 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5948 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5951 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5952 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5953 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5956 dnl This might be temporary: build tridentprofile only on Windows
5957 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5958 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5959 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5962 dnl cookie must be built before tridentprofile. put it at list's end.
5963 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5964 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5965 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5968 dnl xforms requires xtf and schema-validation
5969 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5970 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
5971 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5973 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5974 AC_MSG_WARN([Cannot build XForms without schema validation. Removing XForms from MOZ_EXTENSIONS.])
5975 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5978 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5979 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5980 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5983 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5984 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5985 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5988 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5989 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5990 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5993 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5994 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5995 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5998 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5999 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6000 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6003 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6004 AC_MSG_WARN([spellcheck is no longer an extension.])
6005 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6009 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6011 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6012 dnl when trying to build a non-existent extension.
6013 for extension in $MOZ_EXTENSIONS; do
6014 if test ! -d "${srcdir}/extensions/${extension}"; then
6015 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6020 dnl ========================================================
6022 dnl ========================================================
6023 case "$MOZ_WIDGET_TOOLKIT" in
6024 beos|windows|os2|mac|cocoa)
6027 if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6028 MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6033 MOZ_ARG_ENABLE_STRING(image-decoders,
6034 [ --enable-image-decoders[={mod1,mod2,default,all,none}]
6035 Enable specific image decoders],
6036 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6037 if test "$option" = "yes" || test "$option" = "all"; then
6038 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6039 elif test "$option" = "no" || test "$option" = "none"; then
6041 elif test "$option" = "default"; then
6042 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6043 elif test `echo "$option" | grep -c \^-` != 0; then
6044 option=`echo $option | sed 's/^-//'`
6045 MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6047 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6050 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6052 dnl Dupes are removed in the encoder section because it will also add decoders
6054 dnl ========================================================
6056 dnl ========================================================
6057 MOZ_ARG_ENABLE_STRING(image-encoders,
6058 [ --enable-image-encoders[={mod1,mod2,default,all,none}]
6059 Enable specific image encoders],
6060 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6061 if test "$option" = "yes" || test "$option" = "all"; then
6062 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6063 elif test "$option" = "no" || test "$option" = "none"; then
6066 elif test "$option" = "default"; then
6067 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6068 elif test `echo "$option" | grep -c \^-` != 0; then
6069 option=`echo $option | sed 's/^-//'`
6070 addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6072 addencoder="$option"
6074 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6076 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6079 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6080 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6082 dnl ========================================================
6083 dnl MathML on by default
6084 dnl ========================================================
6085 MOZ_ARG_DISABLE_BOOL(mathml,
6086 [ --disable-mathml Disable MathML support],
6089 if test "$MOZ_MATHML"; then
6090 AC_DEFINE(MOZ_MATHML)
6093 dnl ========================================================
6095 dnl ========================================================
6096 MOZ_ARG_DISABLE_BOOL(svg,
6097 [ --disable-svg Disable SVG support],
6100 if test -n "$MOZ_SVG"; then
6104 dnl ========================================================
6106 dnl ========================================================
6108 MOZ_ARG_DISABLE_BOOL(smil,
6109 [ --disable-smil Disable SMIL animation support],
6112 # Automatically disable SMIL if SVG is disabled
6113 if test -z "$MOZ_SVG"; then
6116 if test -n "$MOZ_SMIL"; then
6120 dnl ========================================================
6121 dnl Build Freetype in the tree
6122 dnl ========================================================
6123 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6124 [ --enable-tree-freetype Enable Tree FreeType],
6125 MOZ_TREE_FREETYPE=1,
6126 MOZ_TREE_FREETYPE= )
6127 if test -n "$MOZ_TREE_FREETYPE"; then
6128 AC_DEFINE(MOZ_TREE_FREETYPE)
6129 AC_SUBST(MOZ_TREE_FREETYPE)
6130 MOZ_ENABLE_CAIRO_FT=1
6131 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6132 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6133 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6134 FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
6135 CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
6136 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6137 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6138 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6139 AC_SUBST(CAIRO_FT_CFLAGS)
6143 dnl ========================================================
6145 dnl ========================================================
6146 case "$target_os" in
6147 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6152 MOZ_ARG_DISABLE_BOOL(installer,
6153 [ --disable-installer Disable building of installer],
6156 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6157 # Disable installer for Windows builds that use the new toolkit if NSIS
6158 # isn't in the path.
6159 MOZ_PATH_PROGS(MAKENSIS, makensis)
6160 if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6161 AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6163 # The Windows build for NSIS requires the iconv command line utility to
6164 # convert the charset of the locale files.
6165 MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6166 if test -z "$HOST_ICONV"; then
6167 AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6171 # Automatically disable installer if xpinstall isn't built
6172 if test -z "$MOZ_XPINSTALL"; then
6175 AC_SUBST(MOZ_INSTALLER)
6177 AC_MSG_CHECKING([for tar archiver])
6178 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6179 if test -z "$TAR"; then
6180 AC_MSG_ERROR([no tar archiver found in \$PATH])
6182 AC_MSG_RESULT([$TAR])
6185 AC_MSG_CHECKING([for wget])
6186 AC_CHECK_PROGS(WGET, wget, "")
6187 AC_MSG_RESULT([$WGET])
6190 dnl ========================================================
6192 dnl ========================================================
6194 MOZ_ARG_DISABLE_BOOL(updater,
6195 [ --disable-updater Disable building of updater],
6198 AC_SUBST(MOZ_UPDATER)
6200 # app update channel is 'default' when not supplied.
6201 MOZ_ARG_ENABLE_STRING([update-channel],
6202 [ --enable-update-channel=CHANNEL
6203 Select application update channel (default=default)],
6204 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6206 if test -z "$MOZ_UPDATE_CHANNEL"; then
6207 MOZ_UPDATE_CHANNEL=default
6209 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6211 # tools/update-packaging is not checked out by default.
6212 MOZ_ARG_ENABLE_BOOL(update-packaging,
6213 [ --enable-update-packaging
6214 Enable tools/update-packaging],
6215 MOZ_UPDATE_PACKAGING=1,
6216 MOZ_UPDATE_PACKAGING= )
6217 AC_SUBST(MOZ_UPDATE_PACKAGING)
6219 dnl ========================================================
6221 dnl ========================================================
6223 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6224 [ --disable-xpconnect-idispatch
6225 Disable building of xpconnect support for IDispatch
6227 XPC_IDISPATCH_SUPPORT=,
6228 XPC_IDISPATCH_SUPPORT=1)
6229 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6231 MOZ_ARG_DISABLE_BOOL(activex,
6232 [ --disable-activex Disable building of ActiveX control (win32 only)],
6233 MOZ_NO_ACTIVEX_SUPPORT=1,
6234 MOZ_NO_ACTIVEX_SUPPORT= )
6235 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6237 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6238 [ --enable-activex-scripting
6239 Enable building of ActiveX scripting support (win32)],
6240 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6241 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6242 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6244 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6246 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6249 if test "$COMPILE_ENVIRONMENT" = "1"; then
6250 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6252 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6253 if test "$ac_cv_header_atlbase_h" = "no"; then
6254 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.])
6261 dnl ========================================================
6263 dnl ========================================================
6264 MOZ_ARG_ENABLE_BOOL(leaky,
6265 [ --enable-leaky Build leaky memory tool],
6270 dnl ========================================================
6272 dnl ========================================================
6273 MOZ_ARG_ENABLE_BOOL(xpctools,
6274 [ --enable-xpctools Build JS profiling tool],
6279 dnl ========================================================
6280 dnl build the tests by default
6281 dnl ========================================================
6282 MOZ_ARG_DISABLE_BOOL(tests,
6283 [ --disable-tests Do not build test libraries & programs],
6287 dnl ========================================================
6288 dnl parental controls (for Windows Vista)
6289 dnl ========================================================
6290 MOZ_ARG_DISABLE_BOOL(parental-controls,
6291 [ --disable-parental-controls
6292 Do not build parental controls],
6293 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6294 MOZ_DISABLE_PARENTAL_CONTROLS=)
6295 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6296 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6299 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6301 dnl ========================================================
6303 dnl = Module specific options
6305 dnl ========================================================
6306 MOZ_ARG_HEADER(Individual module options)
6308 dnl ========================================================
6309 dnl = Enable places (new history/bookmarks)
6310 dnl ========================================================
6311 MOZ_ARG_ENABLE_BOOL(places,
6312 [ --enable-places Enable 'places' bookmark/history implementation],
6315 if test -n "$MOZ_PLACES"; then
6316 AC_DEFINE(MOZ_PLACES)
6317 if test -z "$MOZ_MAIL_NEWS"; then
6322 if test "$MOZ_BUILD_APP" = "browser"; then
6323 AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6327 dnl ========================================================
6328 dnl = Disable feed handling components
6329 dnl ========================================================
6330 MOZ_ARG_DISABLE_BOOL(feeds,
6331 [ --disable-feeds Disable feed handling and processing components],
6334 if test -n "$MOZ_FEEDS"; then
6335 AC_DEFINE(MOZ_FEEDS)
6337 if test "$MOZ_BUILD_APP" = "browser"; then
6338 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6342 dnl ========================================================
6343 dnl = Enable mozStorage
6344 dnl ========================================================
6345 dnl Implicitly enabled by default if building calendar or places
6346 MOZ_ARG_ENABLE_BOOL(storage,
6347 [ --enable-storage Enable mozStorage module and related components],
6350 if test -n "$MOZ_STORAGE"; then
6351 AC_DEFINE(MOZ_STORAGE)
6354 dnl ========================================================
6355 dnl Check for sqlite
6356 dnl ========================================================
6359 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6360 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6361 MOZ_NATIVE_SQLITE=1,
6362 MOZ_NATIVE_SQLITE= )
6364 if test -z "$MOZ_NATIVE_SQLITE"
6367 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6369 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6370 dnl ===================================
6371 dnl === SQLITE_SECURE_DELETE checks ===
6372 dnl ===================================
6373 dnl check to see if the system sqlite package is compiled with
6374 dnl SQLITE_SECURE_DELETE enabled.
6375 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system sqlite)
6376 _SAVE_CFLAGS="$CFLAGS"
6377 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6379 LIBS="$LIBS $SQLITE_LIBS"
6380 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6382 #include "sqlite3.h"
6386 int main(int argc, char **argv){
6394 const int bufSize = 1024*3;
6396 zBuf = malloc(bufSize*sizeof(char));
6398 rc = sqlite3_open(":memory:", &db);
6399 assert( rc==SQLITE_OK );
6401 sqlite3_randomness(sizeof(r), &r);
6402 zFilename = sqlite3_mprintf("test_db_%llu.sqlite", r);
6403 rc = sqlite3_open(zFilename, &db);
6404 assert( rc==SQLITE_OK );
6405 rc = sqlite3_exec(db,
6407 "CREATE TABLE t1(x);"
6408 "INSERT INTO t1 VALUES(zeroblob(1000)||'abcdefghijklmnopqrstuvwxyz');"
6413 assert( rc==SQLITE_OK );
6415 in = fopen(zFilename, "r");
6417 rc = fread(zBuf, 1, bufSize, in);
6418 assert( rc==bufSize );
6422 for(i=0; i<bufSize-11; i++){
6423 if( *(zBuf+i)=='h' && memcmp(zBuf+i, "hijklmnopq", 10)==0 ){
6429 ac_cv_sqlite_secure_delete=yes,
6430 ac_cv_sqlite_secure_delete=no,
6431 ac_cv_sqlite_secure_delete=no
6434 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6435 CFLAGS="$_SAVE_CFLAGS"
6437 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6438 AC_MSG_ERROR([System Sqlite library is not compiled with SQLITE_SECURE_DELETE.])
6442 AC_SUBST(MOZ_NATIVE_SQLITE)
6444 dnl ========================================================
6445 dnl = Enable help viewer (off by default)
6446 dnl ========================================================
6447 MOZ_ARG_ENABLE_BOOL(help-viewer,
6448 [ --enable-help-viewer Enable help viewer],
6451 if test -n "$MOZ_HELP_VIEWER"; then
6452 AC_DEFINE(MOZ_HELP_VIEWER)
6454 AC_SUBST(MOZ_HELP_VIEWER)
6455 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6456 AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6459 dnl ========================================================
6460 dnl = Enable safe browsing (anti-phishing)
6461 dnl ========================================================
6462 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6463 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6464 MOZ_SAFE_BROWSING=1,
6465 MOZ_SAFE_BROWSING= )
6466 if test -n "$MOZ_SAFE_BROWSING"; then
6467 AC_DEFINE(MOZ_SAFE_BROWSING)
6469 AC_SUBST(MOZ_SAFE_BROWSING)
6471 dnl ========================================================
6472 dnl = Enable faststart component
6473 dnl ========================================================
6474 MOZ_ARG_ENABLE_BOOL(faststart,
6475 [ --enable-faststart Enable the faststart component],
6478 if test -n "$MOZ_FASTSTART"; then
6479 AC_DEFINE(MOZ_FASTSTART)
6481 AC_SUBST(MOZ_FASTSTART)
6483 dnl ========================================================
6484 dnl = Enable url-classifier
6485 dnl ========================================================
6486 dnl Implicitly enabled by default if building with safe-browsing
6487 if test -n "$MOZ_SAFE_BROWSING"; then
6488 MOZ_URL_CLASSIFIER=1
6490 MOZ_ARG_ENABLE_BOOL(url-classifier,
6491 [ --enable-url-classifier Enable url classifier module],
6492 MOZ_URL_CLASSIFIER=1,
6493 MOZ_URL_CLASSIFIER= )
6494 if test -n "$MOZ_URL_CLASSIFIER"; then
6495 AC_DEFINE(MOZ_URL_CLASSIFIER)
6497 AC_SUBST(MOZ_URL_CLASSIFIER)
6499 dnl ========================================================
6500 dnl = Disable zipwriter
6501 dnl ========================================================
6502 MOZ_ARG_DISABLE_BOOL(zipwriter,
6503 [ --disable-zipwriter Disable zipwriter component],
6506 AC_SUBST(MOZ_ZIPWRITER)
6508 dnl ========================================================
6509 dnl = Disable libconic
6510 dnl ========================================================
6511 MOZ_ENABLE_LIBCONIC=1
6512 MOZ_ARG_DISABLE_BOOL(libconic,
6513 [ --disable-libconic Disable libconic],
6514 MOZ_ENABLE_LIBCONIC=,
6515 MOZ_ENABLE_LIBCONIC=1 )
6517 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6518 PKG_CHECK_MODULES(LIBCONIC, conic,
6519 MOZ_ENABLE_LIBCONIC=1,
6520 MOZ_ENABLE_LIBCONIC=)
6522 if test "$MOZ_ENABLE_LIBCONIC"; then
6523 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6526 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6527 AC_SUBST(LIBCONIC_CFLAGS)
6528 AC_SUBST(LIBCONIC_LIBS)
6530 dnl ========================================================
6532 dnl ========================================================
6534 MAEMO_SDK_TARGET_VER=-1
6536 MOZ_ARG_WITH_STRING(maemo-version,
6537 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6539 MAEMO_SDK_TARGET_VER=$withval)
6541 case "$MAEMO_SDK_TARGET_VER" in
6543 MOZ_PLATFORM_MAEMO=5
6547 MOZ_PLATFORM_MAEMO=6
6551 dnl We aren't compiling for Maemo, move on.
6554 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6558 if test $MOZ_PLATFORM_MAEMO; then
6559 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6561 if test -z "$MOZ_ENABLE_DBUS"; then
6562 AC_MSG_ERROR([DBus is required when building for Maemo])
6565 MOZ_GFX_OPTIMIZE_MOBILE=1
6568 if test $MOZ_PLATFORM_MAEMO = 5; then
6569 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6570 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6571 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6572 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6573 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6575 AC_SUBST(XCOMPOSITE_LIBS)
6577 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6578 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6579 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6580 if test -z "$_LIB_FOUND"; then
6581 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6585 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6586 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6587 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6588 if test -z "$_LIB_FOUND"; then
6589 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6592 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6593 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6594 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6595 if test -z "$_LIB_FOUND"; then
6596 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6600 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6601 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6604 dnl ========================================================
6605 dnl = faststripe theme
6606 dnl ========================================================
6607 MOZ_ARG_ENABLE_BOOL(faststripe,
6608 [ --enable-faststripe Use faststripe theme],
6609 MOZ_THEME_FASTSTRIPE=1,
6610 MOZ_THEME_FASTSTRIPE= )
6611 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6613 dnl ========================================================
6615 dnl = Feature options that require extra sources to be pulled
6617 dnl ========================================================
6618 dnl MOZ_ARG_HEADER(Features that require extra sources)
6620 dnl ========================================================
6622 dnl = Debugging Options
6624 dnl ========================================================
6625 MOZ_ARG_HEADER(Debugging and Optimizations)
6627 dnl ========================================================
6628 dnl = Disable building with debug info.
6629 dnl = Debugging is OFF by default
6630 dnl ========================================================
6631 if test -z "$MOZ_DEBUG_FLAGS"
6635 if test "$GNU_CC"; then
6636 GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6637 case "$GCC_VERSION" in
6642 MOZ_DEBUG_FLAGS="-g"
6646 MOZ_DEBUG_FLAGS="-g"
6650 MOZ_DEBUG_FLAGS="-g"
6655 MOZ_ARG_ENABLE_STRING(debug,
6656 [ --enable-debug[=DBG] Enable building with developer debug info
6657 (using compiler flags DBG)],
6658 [ if test "$enableval" != "no"; then
6660 if test -n "$enableval" -a "$enableval" != "yes"; then
6661 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6662 _MOZ_DEBUG_FLAGS_SET=1
6669 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6670 case "${target_os}" in
6672 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6674 msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6675 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6678 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6681 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6683 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6685 if test -n "$MOZ_DEBUG"; then
6686 AC_MSG_CHECKING([for valid debug flags])
6687 _SAVE_CFLAGS=$CFLAGS
6688 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6689 AC_TRY_COMPILE([#include <stdio.h>],
6690 [printf("Hello World\n");],
6693 AC_MSG_RESULT([$_results])
6694 if test "$_results" = "no"; then
6695 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6697 CFLAGS=$_SAVE_CFLAGS
6700 dnl ========================================================
6701 dnl enable mobile optimizations
6702 dnl ========================================================
6703 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6704 [ --enable-mobile-optimize Enable mobile optimizations],
6705 MOZ_GFX_OPTIMIZE_MOBILE=1)
6707 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6709 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6710 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6713 dnl ========================================================
6714 dnl = Enable code optimization. ON by default.
6715 dnl ========================================================
6716 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6717 MOZ_OPTIMIZE_FLAGS="-O"
6720 MOZ_ARG_ENABLE_STRING(optimize,
6721 [ --disable-optimize Disable compiler optimization
6722 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6723 [ if test "$enableval" != "no"; then
6725 if test -n "$enableval" && test "$enableval" != "yes"; then
6726 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6731 fi ], MOZ_OPTIMIZE=1)
6733 if test "$COMPILE_ENVIRONMENT"; then
6734 if test -n "$MOZ_OPTIMIZE"; then
6735 AC_MSG_CHECKING([for valid optimization flags])
6736 _SAVE_CFLAGS=$CFLAGS
6737 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6738 AC_TRY_COMPILE([#include <stdio.h>],
6739 [printf("Hello World\n");],
6742 AC_MSG_RESULT([$_results])
6743 if test "$_results" = "no"; then
6744 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6746 CFLAGS=$_SAVE_CFLAGS
6748 fi # COMPILE_ENVIRONMENT
6750 AC_SUBST(MOZ_OPTIMIZE)
6751 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6752 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6753 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6755 dnl ========================================================
6756 dnl = (Deprecated) generation of debugger info for specific modules
6757 dnl ========================================================
6758 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6759 [ --enable-debugger-info-modules
6760 Enable/disable debugger info for specific modules],
6761 [ if test "$enableval" != "no"; then
6762 AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
6766 dnl ========================================================
6767 dnl = Enable generation of debug symbols
6768 dnl ========================================================
6769 MOZ_ARG_ENABLE_STRING(debug-symbols,
6770 [ --enable-debug-symbols[=DBG] Enable debugging symbols
6771 (using compiler flags DBG)],
6772 [ if test "$enableval" != "no"; then
6774 if test -n "$enableval" -a "$enableval" != "yes"; then
6775 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6776 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6778 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6783 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6784 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6785 export MOZ_DEBUG_SYMBOLS
6788 dnl ========================================================
6789 dnl Disable runtime logging checks
6790 dnl ========================================================
6791 MOZ_ARG_DISABLE_BOOL(logging,
6792 [ --disable-logging Disable logging facilities],
6793 NS_DISABLE_LOGGING=1,
6794 NS_DISABLE_LOGGING= )
6795 if test "$NS_DISABLE_LOGGING"; then
6796 AC_DEFINE(NS_DISABLE_LOGGING)
6798 AC_DEFINE(MOZ_LOGGING)
6801 dnl ========================================================
6802 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6803 dnl ========================================================
6804 _ENABLE_LOGREFCNT=42
6805 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6806 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6807 _ENABLE_LOGREFCNT=1,
6808 _ENABLE_LOGREFCNT= )
6809 if test "$_ENABLE_LOGREFCNT" = "1"; then
6810 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6811 elif test -z "$_ENABLE_LOGREFCNT"; then
6812 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6815 dnl ========================================================
6816 dnl = Enable trace malloc
6817 dnl ========================================================
6818 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6819 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6820 [ --enable-trace-malloc Enable malloc tracing],
6823 if test "$NS_TRACE_MALLOC"; then
6824 # Please, Mr. Linker Man, don't take away our symbol names
6825 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6827 AC_DEFINE(NS_TRACE_MALLOC)
6829 AC_SUBST(NS_TRACE_MALLOC)
6831 dnl ========================================================
6832 dnl = Enable jemalloc
6833 dnl ========================================================
6834 MOZ_ARG_ENABLE_BOOL(jemalloc,
6835 [ --enable-jemalloc Replace memory allocator with jemalloc],
6839 if test "$NS_TRACE_MALLOC"; then
6843 if test "$MOZ_MEMORY"; then
6845 dnl Don't try to run compiler tests on Windows
6846 if test "$OS_ARCH" = "WINNT"; then
6847 if test -z "$HAVE_64BIT_OS"; then
6848 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6850 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6853 AC_CHECK_SIZEOF([int *], [4])
6854 case "${ac_cv_sizeof_int_p}" in
6856 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6859 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6862 AC_MSG_ERROR([Unexpected pointer size])
6867 AC_DEFINE(MOZ_MEMORY)
6868 if test "x$MOZ_DEBUG" = "x1"; then
6869 AC_DEFINE(MOZ_MEMORY_DEBUG)
6871 dnl The generic feature tests that determine how to compute ncpus are long and
6872 dnl complicated. Therefore, simply define special cpp variables for the
6873 dnl platforms we have special knowledge of.
6874 case "${target_os}" in
6876 AC_DEFINE(MOZ_MEMORY_DARWIN)
6879 AC_DEFINE(MOZ_MEMORY_BSD)
6882 AC_DEFINE(MOZ_MEMORY_LINUX)
6885 AC_DEFINE(MOZ_MEMORY_BSD)
6888 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6890 msvc*|mks*|cygwin*|mingw*)
6891 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6892 dnl This is sort of awful. Will revisit if we add support for more versions
6893 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6894 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6896 if test -z "$WIN32_CRT_SRC_DIR"; then
6897 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6898 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).])
6900 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6904 case "${target_cpu}" in
6906 _WIN32_CRT_CPU=intel
6909 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6913 if test ! -d "$WIN32_CRT_SRC_DIR"; then
6914 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6916 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6917 _objdir_win=`pwd -W`
6918 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
6919 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6920 dnl Also pass this to NSPR/NSS
6921 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6925 AC_DEFINE(MOZ_MEMORY_WINCE)
6926 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6927 if test -z "$WINCE_WINDOWS_MOBILE"; then
6928 AC_DEFINE(MOZ_MEMORY_WINCE6)
6932 AC_DEFINE(MOZ_MEMORY_WINCE)
6933 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6936 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6940 if test "$OS_ARCH" != "Darwin"; then
6941 dnl NB: this must be kept in sync with jemalloc.h
6942 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
6943 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
6944 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
6947 AC_SUBST(MOZ_MEMORY)
6948 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6949 AC_SUBST(WIN32_CRT_SRC_DIR)
6950 dnl Need to set this for make because NSS doesn't have configure
6953 dnl ========================================================
6954 dnl = Use malloc wrapper lib
6955 dnl ========================================================
6956 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6957 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
6961 if test -n "$_WRAP_MALLOC"; then
6962 if test "$GNU_CC"; then
6963 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"
6964 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6968 dnl ========================================================
6969 dnl = Location of malloc wrapper lib
6970 dnl ========================================================
6971 MOZ_ARG_WITH_STRING(wrap-malloc,
6972 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
6973 WRAP_MALLOC_LIB=$withval)
6975 dnl ========================================================
6977 dnl ========================================================
6978 MOZ_ARG_ENABLE_BOOL(tracevis,
6979 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
6982 if test -n "$MOZ_TRACEVIS"; then
6983 AC_DEFINE(MOZ_TRACEVIS)
6986 dnl ========================================================
6988 dnl ========================================================
6989 MOZ_ARG_ENABLE_BOOL(valgrind,
6990 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
6993 if test -n "$MOZ_VALGRIND"; then
6994 AC_CHECK_HEADER([valgrind/valgrind.h], [],
6996 [--enable-valgrind specified but Valgrind is not installed]))
6997 AC_DEFINE(MOZ_VALGRIND)
7000 dnl ========================================================
7002 dnl ========================================================
7003 MOZ_ARG_ENABLE_BOOL(jprof,
7004 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)],
7007 if test -n "$MOZ_JPROF"; then
7008 AC_DEFINE(MOZ_JPROF)
7011 dnl ========================================================
7013 dnl ========================================================
7014 MOZ_ARG_ENABLE_BOOL(shark,
7015 [ --enable-shark Enable shark remote profiling (needs CHUD framework)],
7018 if test -n "$MOZ_SHARK"; then
7019 AC_DEFINE(MOZ_SHARK)
7022 dnl ========================================================
7024 dnl ========================================================
7025 MOZ_ARG_ENABLE_BOOL(callgrind,
7026 [ --enable-callgrind Enable callgrind profiling],
7029 if test -n "$MOZ_CALLGRIND"; then
7030 AC_DEFINE(MOZ_CALLGRIND)
7033 dnl ========================================================
7035 dnl ========================================================
7036 MOZ_ARG_ENABLE_BOOL(vtune,
7037 [ --enable-vtune Enable vtune profiling],
7040 if test -n "$MOZ_VTUNE"; then
7041 AC_DEFINE(MOZ_VTUNE)
7044 dnl ========================================================
7045 dnl Zealous JavaScript GC
7046 dnl ========================================================
7047 MOZ_ARG_ENABLE_BOOL(gczeal,
7048 [ --enable-gczeal Enable zealous JavaScript GCing],
7051 if test -n "$JS_GC_ZEAL"; then
7052 AC_DEFINE(JS_GC_ZEAL)
7055 dnl ========================================================
7056 dnl = Enable static checking using gcc-dehydra
7057 dnl ========================================================
7059 MOZ_ARG_WITH_STRING(static-checking,
7060 [ --with-static-checking=path/to/gcc_dehydra.so
7061 Enable static checking of code using GCC-dehydra],
7062 DEHYDRA_PATH=$withval,
7065 if test -n "$DEHYDRA_PATH"; then
7066 if test ! -f "$DEHYDRA_PATH"; then
7067 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7069 AC_DEFINE(NS_STATIC_CHECKING)
7071 AC_SUBST(DEHYDRA_PATH)
7073 dnl ========================================================
7074 dnl = Enable stripping of libs & executables
7075 dnl ========================================================
7076 MOZ_ARG_ENABLE_BOOL(strip,
7077 [ --enable-strip Enable stripping of libs & executables ],
7081 dnl ========================================================
7082 dnl = Enable stripping of libs & executables when packaging
7083 dnl ========================================================
7084 MOZ_ARG_ENABLE_BOOL(install-strip,
7085 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7089 dnl ========================================================
7090 dnl = --enable-elf-dynstr-gc
7091 dnl ========================================================
7092 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7093 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7094 USE_ELF_DYNSTR_GC=1,
7095 USE_ELF_DYNSTR_GC= )
7097 dnl ========================================================
7099 dnl = Profiling and Instrumenting
7101 dnl ========================================================
7102 MOZ_ARG_HEADER(Profiling and Instrumenting)
7104 dnl ========================================================
7105 dnl = Enable timeline service, which provides lightweight
7106 dnl = instrumentation of mozilla for performance measurement.
7107 dnl = Timeline is off by default.
7108 dnl ========================================================
7109 MOZ_ARG_ENABLE_BOOL(timeline,
7110 [ --enable-timeline Enable timeline services ],
7113 if test -n "$MOZ_TIMELINE"; then
7114 AC_DEFINE(MOZ_TIMELINE)
7117 dnl ========================================================
7118 dnl Turn on reflow counting
7119 dnl ========================================================
7120 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7121 [ --enable-reflow-perf Enable reflow performance tracing],
7124 if test -n "$MOZ_REFLOW_PERF"; then
7125 AC_DEFINE(MOZ_REFLOW_PERF)
7128 dnl ========================================================
7129 dnl Enable code size metrics.
7130 dnl ========================================================
7131 MOZ_ARG_ENABLE_BOOL(codesighs,
7132 [ --enable-codesighs Enable code size analysis tools],
7133 _ENABLE_CODESIGHS=1,
7134 _ENABLE_CODESIGHS= )
7135 if test -n "$_ENABLE_CODESIGHS"; then
7136 if test -d $srcdir/tools/codesighs; then
7139 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7143 MOZ_ARG_ENABLE_BOOL(insure,
7144 [ --enable-insure Enable insure++ instrumentation (linux only)],
7147 if test -n "$_ENABLE_INSURE"; then
7151 MOZ_INSURE_EXCLUDE_DIRS="config"
7154 MOZ_ARG_WITH_STRING(insure-dirs,
7155 [ --with-insure-dirs=DIRS
7156 Dirs to instrument with insure ],
7157 MOZ_INSURE_DIRS=$withval )
7159 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
7160 [ --with-insure-exclude-dirs=DIRS
7161 Dirs to not instrument with insure ],
7162 MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
7164 dnl ========================================================
7165 dnl = Support for Quantify (Windows)
7166 dnl ========================================================
7167 MOZ_ARG_ENABLE_BOOL(quantify,
7168 [ --enable-quantify Enable Quantify support (Windows only) ],
7172 dnl ========================================================
7173 dnl = Support for demangling undefined symbols
7174 dnl ========================================================
7175 if test -z "$SKIP_LIBRARY_CHECKS"; then
7178 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7182 # Demangle only for debug or trace-malloc builds
7183 MOZ_DEMANGLE_SYMBOLS=
7184 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7185 MOZ_DEMANGLE_SYMBOLS=1
7186 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7188 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7190 dnl ========================================================
7191 dnl = Support for gcc stack unwinding (from gcc 3.3)
7192 dnl ========================================================
7193 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7194 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7197 dnl ========================================================
7201 dnl ========================================================
7202 MOZ_ARG_HEADER(Misc. Options)
7204 dnl ========================================================
7205 dnl update xterm title
7206 dnl ========================================================
7207 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7208 [ --enable-xterm-updates Update XTERM titles with current command.],
7212 dnl =========================================================
7214 dnl =========================================================
7215 MOZ_ARG_ENABLE_STRING([chrome-format],
7216 [ --enable-chrome-format=jar|flat|both|symlink
7217 Select FORMAT of chrome files (default=jar)],
7218 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7220 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7221 MOZ_CHROME_FILE_FORMAT=jar
7224 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7225 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7226 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7227 test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7228 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7231 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7232 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7234 dnl ========================================================
7235 dnl = Define default location for MOZILLA_FIVE_HOME
7236 dnl ========================================================
7237 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7238 [ --with-default-mozilla-five-home
7239 Set the default value for MOZILLA_FIVE_HOME],
7240 [ val=`echo $withval`
7241 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7243 dnl ========================================================
7244 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7245 dnl ========================================================
7246 MOZ_ARG_WITH_STRING(user-appdir,
7247 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7248 [ val=`echo $withval`
7249 if echo "$val" | grep "\/" >/dev/null; then
7250 AC_MSG_ERROR("Homedir must be single relative path.")
7255 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7257 dnl ========================================================
7258 dnl = Doxygen configuration
7259 dnl ========================================================
7260 dnl Use commas to specify multiple dirs to this arg
7261 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7262 MOZ_ARG_WITH_STRING(doc-input-dirs,
7263 [ --with-doc-input-dirs=DIRS
7264 Header/idl dirs to create docs from],
7265 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7266 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7268 dnl Use commas to specify multiple dirs to this arg
7269 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7270 MOZ_ARG_WITH_STRING(doc-include-dirs,
7271 [ --with-doc-include-dirs=DIRS
7272 Include dirs to preprocess doc headers],
7273 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7274 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7276 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7277 MOZ_ARG_WITH_STRING(doc-output-dir,
7278 [ --with-doc-output-dir=DIR
7279 Dir to generate docs into],
7280 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7281 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7283 if test -z "$SKIP_COMPILER_CHECKS"; then
7284 dnl ========================================================
7286 dnl = Compiler Options
7288 dnl ========================================================
7289 MOZ_ARG_HEADER(Compiler Options)
7291 dnl ========================================================
7292 dnl Check for gcc -pipe support
7293 dnl ========================================================
7294 AC_MSG_CHECKING([for gcc -pipe support])
7295 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7296 echo '#include <stdio.h>' > dummy-hello.c
7297 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7298 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7299 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7300 if test $? = 0; then
7305 if test "$_res_as_stdin" = "yes"; then
7306 _SAVE_CFLAGS=$CFLAGS
7307 CFLAGS="$CFLAGS -pipe"
7308 AC_TRY_COMPILE( [ #include <stdio.h> ],
7309 [printf("Hello World\n");],
7310 [_res_gcc_pipe="yes"],
7311 [_res_gcc_pipe="no"] )
7312 CFLAGS=$_SAVE_CFLAGS
7314 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7316 CFLAGS="$CFLAGS -pipe"
7317 CXXFLAGS="$CXXFLAGS -pipe"
7321 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7322 AC_MSG_RESULT([$_res])
7327 dnl pass -Wno-long-long to the compiler
7328 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7329 [ --enable-long-long-warning
7330 Warn about use of non-ANSI long long type],
7331 _IGNORE_LONG_LONG_WARNINGS=,
7332 _IGNORE_LONG_LONG_WARNINGS=1)
7334 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7335 _SAVE_CFLAGS="$CFLAGS"
7336 CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7337 AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7338 AC_TRY_COMPILE([], [return(0);],
7339 [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7340 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7341 result="yes" ], result="no")
7342 AC_MSG_RESULT([$result])
7343 CFLAGS="$_SAVE_CFLAGS"
7346 dnl ========================================================
7347 dnl Profile guided optimization
7348 dnl ========================================================
7349 dnl Test for profiling options
7350 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7351 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7353 dnl Provide a switch to disable PGO even when called via profiledbuild.
7354 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7355 [ --disable-profile-guided-optimization
7356 Don't build with PGO even if called via make profiledbuild],
7357 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7358 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7360 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7362 _SAVE_CFLAGS="$CFLAGS"
7363 CFLAGS="$CFLAGS -fprofile-generate"
7365 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7366 AC_TRY_COMPILE([], [return 0;],
7367 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7368 result="yes" ], result="no")
7369 AC_MSG_RESULT([$result])
7371 if test $result = "yes"; then
7372 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7373 PROFILE_USE_CFLAGS="-fprofile-use"
7374 PROFILE_USE_LDFLAGS="-fprofile-use"
7376 CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7377 AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7378 AC_TRY_COMPILE([], [return 0;],
7379 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7380 result="yes" ], result="no")
7381 AC_MSG_RESULT([$result])
7382 if test $result = "yes"; then
7383 PROFILE_USE_CFLAGS="-fbranch-probabilities"
7385 # don't really care, this is an old GCC
7386 PROFILE_GEN_LDFLAGS=
7387 PROFILE_USE_LDFLAGS=
7390 CFLAGS="$_SAVE_CFLAGS"
7392 if test -n "$INTEL_CC"; then
7393 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7394 PROFILE_GEN_LDFLAGS=
7395 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7396 PROFILE_USE_LDFLAGS=
7399 dnl Sun Studio on Solaris
7400 if test "$SOLARIS_SUNPRO_CC"; then
7401 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7402 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7403 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7404 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7407 AC_SUBST(PROFILE_GEN_CFLAGS)
7408 AC_SUBST(PROFILE_GEN_LDFLAGS)
7409 AC_SUBST(PROFILE_USE_CFLAGS)
7410 AC_SUBST(PROFILE_USE_LDFLAGS)
7414 dnl ========================================================
7415 dnl Test for -pedantic bustage
7416 dnl ========================================================
7417 MOZ_ARG_DISABLE_BOOL(pedantic,
7418 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7420 if test "$_PEDANTIC"; then
7421 _SAVE_CXXFLAGS=$CXXFLAGS
7422 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7423 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7424 AC_TRY_COMPILE([$configure_static_assert_macros],
7425 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7426 result="no", result="yes" )
7427 AC_MSG_RESULT([$result])
7428 CXXFLAGS="$_SAVE_CXXFLAGS"
7432 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7433 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7436 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7441 dnl ========================================================
7442 dnl Test for correct temporary object destruction order
7443 dnl ========================================================
7444 dnl We want to make sure the compiler follows the C++ spec here as
7445 dnl xpcom and the string classes depend on it (bug 235381).
7446 AC_MSG_CHECKING([for correct temporary object destruction order])
7447 AC_TRY_RUN([ class A {
7448 public: A(int& x) : mValue(x) {}
7450 operator char**() { return 0; }
7451 private: int& mValue;
7453 void func(char **arg) {}
7464 result="yes", result="no", result="maybe")
7465 AC_MSG_RESULT([$result])
7467 if test "$result" = "no"; then
7468 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7471 dnl ========================================================
7472 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7473 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7474 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7475 dnl ========================================================
7476 _SAVE_CXXFLAGS=$CXXFLAGS
7477 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7478 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7479 ac_nscap_nonconst_opeq_bug,
7488 template <class T, class U>
7489 int operator==(const Pointer<T>& rhs, U* lhs)
7491 return rhs.myPtr == lhs;
7494 template <class T, class U>
7495 int operator==(const Pointer<T>& rhs, const U* lhs)
7497 return rhs.myPtr == lhs;
7505 ac_nscap_nonconst_opeq_bug="no",
7506 ac_nscap_nonconst_opeq_bug="yes")])
7507 CXXFLAGS="$_SAVE_CXXFLAGS"
7509 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7510 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7512 fi # SKIP_COMPILER_CHECKS
7514 dnl ========================================================
7516 dnl Should be smarter and check that the compiler does indeed have rtti
7517 dnl ========================================================
7519 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7520 [ --enable-cpp-rtti Enable C++ RTTI ],
7521 [ _MOZ_USE_RTTI=1 ],
7524 if test "$_MOZ_USE_RTTI"; then
7525 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7527 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7530 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7532 dnl ========================================================
7533 dnl C++ exceptions (g++/egcs only - for now)
7534 dnl Should be smarter and check that the compiler does indeed have exceptions
7535 dnl ========================================================
7536 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7537 [ --enable-cpp-exceptions Enable C++ exceptions ],
7538 [ _MOZ_CPP_EXCEPTIONS=1 ],
7539 [ _MOZ_CPP_EXCEPTIONS= ])
7541 if test "$_MOZ_CPP_EXCEPTIONS"; then
7542 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7544 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7547 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7549 # Irix & OSF native compilers do not like exception declarations
7550 # when exceptions are disabled
7551 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7552 AC_DEFINE(CPP_THROW_NEW, [])
7554 AC_DEFINE(CPP_THROW_NEW, [throw()])
7558 dnl ========================================================
7560 dnl = Build depencency options
7562 dnl ========================================================
7563 MOZ_ARG_HEADER(Build dependencies)
7565 dnl ========================================================
7566 dnl = Do not auto generate dependency info
7567 dnl ========================================================
7569 MOZ_ARG_DISABLE_BOOL(auto-deps,
7570 [ --disable-auto-deps Do not automatically generate dependency info],
7574 if test -n "$MOZ_AUTO_DEPS"; then
7575 dnl ========================================================
7576 dnl = Use mkdepend instead of $CC -MD for dependency generation
7577 dnl ========================================================
7579 MOZ_ARG_DISABLE_BOOL(md,
7580 [ --disable-md Do not use compiler-based dependencies ],
7583 [dnl Default is to turn on -MD if using GNU-compatible compilers
7584 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7587 dnl Default is to use -xM if using Sun Studio on Solaris
7588 if test "$SOLARIS_SUNPRO_CC"; then
7591 if test "$_cpp_md_flag"; then
7593 if test "$OS_ARCH" = "OpenVMS"; then
7594 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7596 _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7598 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7599 if test "$SOLARIS_SUNPRO_CC"; then
7604 dnl Don't override this for MSVC
7605 if test -z "$_WIN32_MSVC"; then
7606 _USE_CPP_INCLUDE_FLAG=
7607 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7608 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7613 AC_SUBST(MOZ_AUTO_DEPS)
7614 AC_SUBST(COMPILER_DEPEND)
7618 dnl ========================================================
7620 dnl = Static Build Options
7622 dnl ========================================================
7623 MOZ_ARG_HEADER(Static build options)
7625 MOZ_ARG_ENABLE_BOOL(static,
7626 [ --enable-static Enable building of internal static libs],
7627 BUILD_STATIC_LIBS=1,
7630 MOZ_ARG_ENABLE_BOOL(libxul,
7631 [ --enable-libxul Enable building of libxul],
7632 MOZ_ENABLE_LIBXUL=1,
7635 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7636 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7639 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7640 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7643 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7644 AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7647 AC_SUBST(LIBXUL_LIBS)
7649 if test -n "$MOZ_ENABLE_LIBXUL"; then
7650 XPCOM_LIBS="$LIBXUL_LIBS"
7651 AC_DEFINE(MOZ_ENABLE_LIBXUL)
7653 if test -n "$BUILD_STATIC_LIBS"; then
7654 AC_DEFINE(MOZ_STATIC_BUILD)
7656 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7659 dnl ========================================================
7661 dnl = Standalone module options
7663 dnl ========================================================
7664 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7666 dnl Check for GLib and libIDL.
7667 dnl ========================================================
7668 case "$target_os" in
7669 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7670 SKIP_IDL_CHECK="yes"
7677 if test -z "$COMPILE_ENVIRONMENT"; then
7678 SKIP_IDL_CHECK="yes"
7681 dnl = Allow users to disable libIDL checking for standalone modules
7682 MOZ_ARG_WITHOUT_BOOL(libIDL,
7683 [ --without-libIDL Skip check for libIDL (standalone modules only)],
7684 SKIP_IDL_CHECK="yes")
7686 if test "$SKIP_IDL_CHECK" = "no"
7689 if test "$MACOS_SDK_DIR"; then
7690 dnl xpidl, and therefore libIDL, is only needed on the build host.
7691 dnl Don't build it against the SDK, as that causes problems.
7692 _MACSAVE_CFLAGS="$CFLAGS"
7693 _MACSAVE_LIBS="$LIBS"
7694 _MACSAVE_LDFLAGS="$LDFLAGS"
7695 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7697 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"`
7698 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7699 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7704 if test "$MOZ_ENABLE_GTK2"; then
7705 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7707 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7708 dnl to either libIDL1 or libIDL2.
7709 if test -z "$_LIBIDL_FOUND"; then
7710 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7711 if test -z "$_LIBIDL_FOUND"; then
7712 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7716 dnl If we don't have a libIDL config program & not cross-compiling,
7717 dnl look for orbit-config instead.
7719 if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7720 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7721 if test -n "$ORBIT_CONFIG"; then
7722 AC_MSG_CHECKING([for ORBit libIDL usability])
7723 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7724 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7725 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7726 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7727 LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7728 LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7730 _SAVE_CFLAGS="$CFLAGS"
7732 CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7733 LIBS="$LIBIDL_LIBS $LIBS"
7736 #include <libIDL/IDL.h>
7739 s=strdup(IDL_get_libver_string());
7752 AC_MSG_RESULT($result)
7753 CFLAGS="$_SAVE_CFLAGS"
7757 if test -z "$_LIBIDL_FOUND"; then
7758 AC_MSG_ERROR([libIDL not found.
7759 libIDL $LIBIDL_VERSION or higher is required.])
7761 if test "$MACOS_SDK_DIR"; then
7762 CFLAGS="$_MACSAVE_CFLAGS"
7763 LIBS="$_MACSAVE_LIBS"
7764 LDFLAGS="$_MACSAVE_LDFLAGS"
7765 if test -n "$_MACSAVE_NEXT_ROOT" ; then
7766 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7771 if test -n "$CROSS_COMPILE"; then
7772 if test -z "$HOST_LIBIDL_CONFIG"; then
7773 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7775 if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7776 HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7777 HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7779 HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7780 HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7784 if test -z "$SKIP_PATH_CHECKS"; then
7785 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7786 if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7787 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7789 AM_PATH_GLIB(${GLIB_VERSION})
7794 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7795 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7798 AC_SUBST(LIBIDL_CFLAGS)
7799 AC_SUBST(LIBIDL_LIBS)
7800 AC_SUBST(STATIC_LIBIDL)
7801 AC_SUBST(GLIB_CFLAGS)
7803 AC_SUBST(GLIB_GMODULE_LIBS)
7804 AC_SUBST(HOST_LIBIDL_CONFIG)
7805 AC_SUBST(HOST_LIBIDL_CFLAGS)
7806 AC_SUBST(HOST_LIBIDL_LIBS)
7808 dnl ========================================================
7810 dnl ========================================================
7811 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7814 MOZ_ARG_ENABLE_BOOL(system-cairo,
7815 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7819 # Check for headers defining standard int types.
7820 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7822 if test "$MOZ_TREE_CAIRO"; then
7823 AC_DEFINE(MOZ_TREE_CAIRO)
7825 # For now we assume that we will have a uint64_t available through
7826 # one of the above headers or mozstdint.h.
7827 AC_DEFINE(HAVE_UINT64_T)
7829 # Define macros for cairo-features.h
7830 if test "$MOZ_X11"; then
7831 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7832 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7833 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7834 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7835 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7836 MOZ_ENABLE_CAIRO_FT=1
7837 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7839 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7840 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7842 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7843 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7844 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7845 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7847 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7848 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7849 if test -z "$WINCE"; then
7850 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7851 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7852 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7853 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7854 MOZ_ENABLE_D2D_SURFACE=1
7855 MOZ_ENABLE_DWRITE_FONT=1
7857 WIN32_DWRITE_FONT_FEATURE=
7858 WIN32_D2D_SURFACE_FEATURE=
7862 WIN32_DWRITE_FONT_FEATURE=
7863 WIN32_D2D_SURFACE_FEATURE=
7866 AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7867 if test -z "$HAS_DDRAW"; then
7868 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.])
7869 DDRAW_SURFACE_FEATURE=
7871 DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7874 if test -z "$OGLES_SDK_DIR"; then
7875 OGLES_SURFACE_FEATURE=
7878 #include <EGL/egl.h>
7879 #include <EGL/eglext.h>
7880 #include <GLES2/gl2.h>
7881 #include <GLES2/gl2ext.h>
7882 ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7883 if test -z "$HAS_OGLES"; then
7884 AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7885 OGLES_SURFACE_FEATURE=
7887 OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7891 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7893 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7894 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7895 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7896 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7897 MOZ_ENABLE_CAIRO_FT=1
7898 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7899 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7901 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7902 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7903 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7904 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7905 MOZ_ENABLE_CAIRO_FT=1
7907 if test "$USE_FC_FREETYPE"; then
7908 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7910 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7911 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7912 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7913 AC_SUBST(CAIRO_FT_CFLAGS)
7916 if test "$MOZ_DEBUG"; then
7917 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7919 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7922 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7924 AC_SUBST(PS_SURFACE_FEATURE)
7925 AC_SUBST(PDF_SURFACE_FEATURE)
7926 AC_SUBST(SVG_SURFACE_FEATURE)
7927 AC_SUBST(XLIB_SURFACE_FEATURE)
7928 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7929 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7930 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7931 AC_SUBST(XCB_SURFACE_FEATURE)
7932 AC_SUBST(WIN32_SURFACE_FEATURE)
7933 AC_SUBST(DDRAW_SURFACE_FEATURE)
7934 AC_SUBST(OGLES_SURFACE_FEATURE)
7935 AC_SUBST(OS2_SURFACE_FEATURE)
7936 AC_SUBST(BEOS_SURFACE_FEATURE)
7937 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7938 AC_SUBST(FT_FONT_FEATURE)
7939 AC_SUBST(FC_FONT_FEATURE)
7940 AC_SUBST(WIN32_FONT_FEATURE)
7941 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7942 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7943 AC_SUBST(QUARTZ_FONT_FEATURE)
7944 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7945 AC_SUBST(QT_SURFACE_FEATURE)
7947 if test "$_WIN32_MSVC"; then
7948 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7950 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"
7952 if test "$MOZ_X11"; then
7953 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7957 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7958 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7961 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
7962 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7963 MOZ_CAIRO_LIBS=$CAIRO_LIBS
7964 if test "$MOZ_X11"; then
7965 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7966 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7967 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7971 AC_SUBST(MOZ_TREE_CAIRO)
7972 AC_SUBST(MOZ_CAIRO_CFLAGS)
7973 AC_SUBST(MOZ_CAIRO_LIBS)
7976 dnl ========================================================
7978 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7981 dnl ========================================================
7983 dnl ========================================================
7984 MOZ_ARG_DISABLE_BOOL(xul,
7985 [ --disable-xul Disable XUL],
7987 if test "$MOZ_XUL"; then
7990 dnl remove extensions that require XUL
7991 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7996 dnl ========================================================
7997 dnl disable profile locking
7998 dnl do no use this in applications that can have more than
7999 dnl one process accessing the profile directory.
8000 dnl ========================================================
8001 MOZ_ARG_DISABLE_BOOL(profilelocking,
8002 [ --disable-profilelocking Disable profile locking],
8003 MOZ_PROFILELOCKING=,
8004 MOZ_PROFILELOCKING=1 )
8005 if test "$MOZ_PROFILELOCKING"; then
8006 AC_DEFINE(MOZ_PROFILELOCKING)
8009 dnl ========================================================
8010 dnl disable rdf services
8011 dnl ========================================================
8012 MOZ_ARG_DISABLE_BOOL(rdf,
8013 [ --disable-rdf Disable RDF],
8015 if test "$MOZ_RDF"; then
8021 dnl ========================================================
8022 dnl necko configuration options
8023 dnl ========================================================
8026 dnl option to disable various necko protocols
8028 MOZ_ARG_ENABLE_STRING(necko-protocols,
8029 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8030 Enable/disable specific protocol handlers],
8031 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8032 if test "$option" = "yes" || test "$option" = "all"; then
8033 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8034 elif test "$option" = "no" || test "$option" = "none"; then
8036 elif test "$option" = "default"; then
8037 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8038 elif test `echo "$option" | grep -c \^-` != 0; then
8039 option=`echo $option | sed 's/^-//'`
8040 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8042 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8045 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8047 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8048 AC_SUBST(NECKO_PROTOCOLS)
8049 for p in $NECKO_PROTOCOLS; do
8050 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8054 dnl option to disable necko's disk cache
8056 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8057 [ --disable-necko-disk-cache
8058 Disable necko disk cache],
8061 AC_SUBST(NECKO_DISK_CACHE)
8062 if test "$NECKO_DISK_CACHE"; then
8063 AC_DEFINE(NECKO_DISK_CACHE)
8067 dnl option to disable necko's wifi scanner
8069 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8070 [ --disable-necko-wifi Disable necko wifi scanner],
8075 if test "$OS_ARCH" = "OS2"; then
8076 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8079 if test "$NECKO_WIFI" -a \
8080 "$OS_ARCH" != "Linux" -a \
8081 "$OS_ARCH" != "Darwin" -a \
8082 "$OS_ARCH" != "SunOS" -a \
8083 "$OS_ARCH" != "WINNT" -a \
8084 "$OS_ARCH" != "WINCE"; then
8085 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8088 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8090 AC_CHECK_HEADER([iwlib.h])
8091 if test "$ac_cv_header_iwlib_h" != "yes"; then
8092 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])
8096 if test "$NECKO_WIFI"; then
8097 AC_DEFINE(NECKO_WIFI)
8099 AC_SUBST(NECKO_WIFI)
8102 dnl option to minimize size of necko's i/o buffers
8104 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
8105 [ --enable-necko-small-buffers
8106 Minimize size of necko's i/o buffers],
8107 NECKO_SMALL_BUFFERS=1,
8108 NECKO_SMALL_BUFFERS=)
8109 AC_SUBST(NECKO_SMALL_BUFFERS)
8110 if test "$NECKO_SMALL_BUFFERS"; then
8111 AC_DEFINE(NECKO_SMALL_BUFFERS)
8115 dnl option to disable cookies
8117 MOZ_ARG_DISABLE_BOOL(cookies,
8118 [ --disable-cookies Disable cookie support],
8121 AC_SUBST(NECKO_COOKIES)
8122 if test "$NECKO_COOKIES"; then
8123 AC_DEFINE(NECKO_COOKIES)
8127 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8129 MOZ_ARG_DISABLE_BOOL(ctypes,
8130 [ --disable-ctypes Disable js-ctypes],
8133 AC_SUBST(BUILD_CTYPES)
8134 if test "$BUILD_CTYPES"; then
8135 if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8136 # Disable ctypes for arm/wince.
8138 elif test "$_MSC_VER" && test -z $AS; then
8139 # Disable ctypes if we're on MSVC and MASM is unavailable.
8140 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.])
8142 AC_DEFINE(BUILD_CTYPES)
8146 dnl NECKO_ configuration options are not global
8147 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8149 dnl Only build Mork if it's required
8151 if test "$MOZ_MORK"; then
8155 dnl Build the lightweight Mork reader if required
8156 AC_SUBST(MOZ_MORKREADER)
8157 if test "$MOZ_MORKREADER"; then
8158 AC_DEFINE(MOZ_MORKREADER)
8161 dnl ========================================================
8162 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8163 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8166 dnl ========================================================
8168 dnl = Maintainer debug option (no --enable equivalent)
8170 dnl ========================================================
8175 AC_SUBST(AR_EXTRACT)
8179 AC_SUBST(AS_DASH_C_FLAG)
8187 AC_SUBST(NS_USE_NATIVE)
8188 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8189 AC_SUBST(MOZ_UPDATE_XTERM)
8191 AC_SUBST(MOZ_PLATFORM_MAEMO)
8192 AC_SUBST(MOZ_AUTH_EXTENSION)
8193 AC_SUBST(MOZ_MATHML)
8194 AC_SUBST(MOZ_PERMISSIONS)
8196 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8197 AC_SUBST(MOZ_PREF_EXTENSIONS)
8200 AC_SUBST(MOZ_XSLT_STANDALONE)
8201 AC_SUBST(MOZ_JS_LIBS)
8204 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8205 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8206 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8207 AC_SUBST(MOZ_DEBUG_FLAGS)
8208 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8209 AC_SUBST(WARNINGS_AS_ERRORS)
8210 AC_SUBST(MOZ_EXTENSIONS)
8211 AC_SUBST(MOZ_IMG_DECODERS)
8212 AC_SUBST(MOZ_IMG_ENCODERS)
8213 AC_SUBST(MOZ_JSDEBUGGER)
8214 AC_SUBST(MOZ_PLUGINS)
8215 AC_SUBST(MOZ_LOG_REFCNT)
8219 AC_SUBST(MOZ_CALLGRIND)
8221 AC_SUBST(MOZ_XPCTOOLS)
8222 AC_SUBST(MOZ_JSLOADER)
8223 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8224 AC_SUBST(MOZ_INSURE)
8225 AC_SUBST(MOZ_INSURE_DIRS)
8226 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
8227 AC_SUBST(MOZ_QUANTIFY)
8228 AC_SUBST(MOZ_INSURIFYING)
8230 AC_SUBST(MOZ_PLACES)
8231 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8232 AC_SUBST(MOZ_STORAGE)
8233 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8235 AC_SUBST(NS_PRINTING)
8238 AC_SUBST(MOZ_JAVAXPCOM)
8239 AC_SUBST(JAVA_INCLUDE_PATH)
8244 AC_SUBST(MOZ_PROFILELOCKING)
8247 AC_SUBST(MOZ_XIE_LIBS)
8248 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8250 AC_SUBST(BUILD_STATIC_LIBS)
8251 AC_SUBST(MOZ_ENABLE_LIBXUL)
8252 AC_SUBST(ENABLE_TESTS)
8254 AC_SUBST(MOZ_UNIVERSALCHARDET)
8255 AC_SUBST(ACCESSIBILITY)
8256 AC_SUBST(MOZ_XPINSTALL)
8257 AC_SUBST(MOZ_VIEW_SOURCE)
8258 AC_SUBST(MOZ_SPELLCHECK)
8259 AC_SUBST(MOZ_XPFE_COMPONENTS)
8260 AC_SUBST(MOZ_USER_DIR)
8261 AC_SUBST(MOZ_CRASHREPORTER)
8263 AC_SUBST(ENABLE_STRIP)
8264 AC_SUBST(PKG_SKIP_STRIP)
8265 AC_SUBST(USE_ELF_DYNSTR_GC)
8266 AC_SUBST(INCREMENTAL_LINKER)
8267 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8268 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8270 AC_SUBST(MOZ_FIX_LINK_PATHS)
8271 AC_SUBST(XPCOM_LIBS)
8272 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8273 AC_SUBST(XPCOM_GLUE_LDOPTS)
8274 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8276 AC_SUBST(USE_DEPENDENT_LIBS)
8278 AC_SUBST(MOZ_BUILD_ROOT)
8279 AC_SUBST(MOZ_OS2_TOOLS)
8280 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8282 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8283 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8284 AC_SUBST(MOZ_TIMELINE)
8285 AC_SUBST(OGLES_SDK_DIR)
8287 AC_SUBST(MOZ_APP_NAME)
8288 AC_SUBST(MOZ_APP_DISPLAYNAME)
8289 AC_SUBST(MOZ_APP_VERSION)
8290 AC_SUBST(MOZ_APP_UA_EXTRA)
8291 AC_SUBST(FIREFOX_VERSION)
8293 AC_SUBST(MOZ_PKG_SPECIAL)
8295 AC_SUBST(MOZILLA_OFFICIAL)
8298 AC_SUBST(MOZ_MAPINFO)
8299 AC_SUBST(MOZ_BROWSE_INFO)
8300 AC_SUBST(MOZ_TOOLS_DIR)
8301 AC_SUBST(CYGWIN_WRAPPER)
8303 AC_SUBST(WIN32_REDIST_DIR)
8307 AC_SUBST(WINCE_SDK_DIR)
8308 AC_SUBST(WINCE_WINDOWS_MOBILE)
8310 dnl Echo the CFLAGS to remove extra whitespace.
8317 $_MOZ_EXCEPTIONS_FLAGS \
8318 $_WARNINGS_CXXFLAGS \
8321 COMPILE_CFLAGS=`echo \
8326 COMPILE_CXXFLAGS=`echo \
8327 $_DEFINES_CXXFLAGS \
8331 AC_SUBST(SYSTEM_MAKEDEPEND)
8332 AC_SUBST(SYSTEM_LIBXUL)
8333 AC_SUBST(SYSTEM_JPEG)
8334 AC_SUBST(SYSTEM_PNG)
8335 AC_SUBST(SYSTEM_ZLIB)
8336 AC_SUBST(SYSTEM_BZ2)
8338 AC_SUBST(JPEG_CFLAGS)
8340 AC_SUBST(ZLIB_CFLAGS)
8342 AC_SUBST(BZ2_CFLAGS)
8344 AC_SUBST(PNG_CFLAGS)
8347 AC_SUBST(MOZ_JPEG_CFLAGS)
8348 AC_SUBST(MOZ_JPEG_LIBS)
8349 AC_SUBST(MOZ_ZLIB_CFLAGS)
8350 AC_SUBST(MOZ_ZLIB_LIBS)
8351 AC_SUBST(MOZ_BZ2_CFLAGS)
8352 AC_SUBST(MOZ_BZ2_LIBS)
8353 AC_SUBST(MOZ_PNG_CFLAGS)
8354 AC_SUBST(MOZ_PNG_LIBS)
8356 AC_SUBST(NSPR_CFLAGS)
8358 AC_SUBST(MOZ_NATIVE_NSPR)
8360 AC_SUBST(NSS_CFLAGS)
8362 AC_SUBST(NSS_DEP_LIBS)
8363 AC_SUBST(MOZ_NATIVE_NSS)
8364 AC_SUBST(NSS_DISABLE_DBM)
8369 AC_SUBST(COMPILE_CFLAGS)
8370 AC_SUBST(COMPILE_CXXFLAGS)
8373 AC_SUBST(CROSS_COMPILE)
8374 AC_SUBST(WCHAR_CFLAGS)
8378 AC_SUBST(HOST_CFLAGS)
8379 AC_SUBST(HOST_CXXFLAGS)
8380 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8382 AC_SUBST(HOST_AR_FLAGS)
8384 AC_SUBST(HOST_RANLIB)
8385 AC_SUBST(HOST_NSPR_MDCPUCFG)
8386 AC_SUBST(HOST_BIN_SUFFIX)
8387 AC_SUBST(HOST_OS_ARCH)
8389 AC_SUBST(TARGET_CPU)
8390 AC_SUBST(TARGET_VENDOR)
8392 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8393 AC_SUBST(TARGET_MD_ARCH)
8394 AC_SUBST(TARGET_XPCOM_ABI)
8397 AC_SUBST(OS_RELEASE)
8400 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8401 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8403 AC_SUBST(WRAP_MALLOC_CFLAGS)
8404 AC_SUBST(WRAP_MALLOC_LIB)
8407 AC_SUBST(MKSHLIB_FORCE_ALL)
8408 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8409 AC_SUBST(DSO_CFLAGS)
8410 AC_SUBST(DSO_PIC_CFLAGS)
8411 AC_SUBST(DSO_LDOPTS)
8412 AC_SUBST(LIB_PREFIX)
8413 AC_SUBST(DLL_PREFIX)
8414 AC_SUBST(DLL_SUFFIX)
8415 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8416 AC_SUBST(LIB_SUFFIX)
8417 AC_SUBST(OBJ_SUFFIX)
8418 AC_SUBST(BIN_SUFFIX)
8419 AC_SUBST(ASM_SUFFIX)
8420 AC_SUBST(IMPORT_LIB_SUFFIX)
8422 AC_SUBST(CC_VERSION)
8423 AC_SUBST(CXX_VERSION)
8424 AC_SUBST(MSMANIFEST_TOOL)
8425 AC_SUBST(NS_ENABLE_TSF)
8426 AC_SUBST(MOZ_NSS_PATCH)
8428 if test "$USING_HCC"; then
8429 CC='${topsrcdir}/build/hcc'
8431 CXX='${topsrcdir}/build/hcpp'
8432 CXX="$CXX '$_OLDCXX'"
8437 dnl Check for missing components
8438 if test "$COMPILE_ENVIRONMENT"; then
8439 if test "$MOZ_X11"; then
8440 dnl ====================================================
8441 dnl = Check if X headers exist
8442 dnl ====================================================
8443 _SAVE_CFLAGS=$CFLAGS
8444 CFLAGS="$CFLAGS $XCFLAGS"
8448 #include <X11/Xlib.h>
8449 #include <X11/Intrinsic.h>
8453 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8454 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8458 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8459 CFLAGS="$_SAVE_CFLAGS"
8461 if test ! -z "$MISSING_X"; then
8462 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8467 dnl Check for headers, etc. needed by WebGL.
8468 if test -n "$MOZ_WEBGL_GLX"; then
8469 AC_CHECK_HEADER(GL/glx.h)
8470 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8471 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8474 fi # COMPILE_ENVIRONMENT
8476 if test "$USE_FC_FREETYPE"; then
8477 if test "$COMPILE_ENVIRONMENT"; then
8478 _SAVE_CPPFLAGS="$CPPFLAGS"
8479 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8480 AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
8481 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8482 CPPFLAGS="$_SAVE_CPPFLAGS"
8484 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8488 dnl Set various defines and substitutions
8489 dnl ========================================================
8491 if test "$OS_ARCH" = "BeOS"; then
8493 elif test "$OS_ARCH" = "Darwin"; then
8495 AC_DEFINE(UNIX_ASYNC_DNS)
8496 elif test "$OS_ARCH" = "OpenVMS"; then
8498 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8500 AC_DEFINE(UNIX_ASYNC_DNS)
8503 if test "$MOZ_DEBUG"; then
8504 AC_DEFINE(MOZ_REFLOW_PERF)
8505 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8508 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8509 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8510 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8511 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8512 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8513 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8514 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8515 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8516 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8519 dnl ========================================================
8520 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8521 dnl ========================================================
8524 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8527 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8528 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8529 CC="\$(CYGWIN_WRAPPER) $CC"
8530 CXX="\$(CYGWIN_WRAPPER) $CXX"
8531 CPP="\$(CYGWIN_WRAPPER) $CPP"
8532 LD="\$(CYGWIN_WRAPPER) $LD"
8533 AS="\$(CYGWIN_WRAPPER) $AS"
8534 RC="\$(CYGWIN_WRAPPER) $RC"
8535 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8536 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8537 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8541 AC_SUBST(CYGDRIVE_MOUNT)
8542 AC_SUBST(WIN_TOP_SRC)
8544 AC_SUBST(MOZILLA_VERSION)
8546 AC_SUBST(ac_configure_args)
8548 dnl Spit out some output
8549 dnl ========================================================
8551 dnl The following defines are used by xpcom
8552 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8554 HAVE_CPP_2BYTE_WCHAR_T
8555 HAVE_CPP_ACCESS_CHANGING_USING
8556 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8559 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8561 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8562 HAVE_CPP_NAMESPACE_STD
8564 HAVE_CPP_PARTIAL_SPECIALIZATION
8565 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8567 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8569 NEED_CPP_UNUSED_IMPLEMENTATIONS
8573 HAVE_ICONV_WITH_CONST_INPUT
8581 netwerk/necko-config.h
8582 xpcom/xpcom-config.h
8583 xpcom/xpcom-private.h
8586 # Save the defines header file before autoconf removes it.
8587 # (Do not add AC_DEFINE calls after this line.)
8588 _CONFIG_TMP=confdefs-tmp.h
8589 _CONFIG_DEFS_H=mozilla-config.h
8591 cat > $_CONFIG_TMP <<\EOF
8592 /* List of defines generated by configure. Included with preprocessor flag,
8593 * -include, to avoid long list of -D defines on the compile command-line.
8597 #ifndef _MOZILLA_CONFIG_H_
8598 #define _MOZILLA_CONFIG_H_
8601 _EGREP_PATTERN='^#define ('
8602 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8603 for f in $_NON_GLOBAL_ACDEFINES; do
8604 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8607 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8609 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8611 cat >> $_CONFIG_TMP <<\EOF
8613 #endif /* _MOZILLA_CONFIG_H_ */
8617 # Only write mozilla-config.h when something changes (or it doesn't exist)
8618 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8621 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8622 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8624 echo ==== $_CONFIG_DEFS_H =================================
8628 dnl Probably shouldn't call this manually but we always want the output of DEFS
8629 rm -f confdefs.h.save
8630 mv confdefs.h confdefs.h.save
8631 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8632 AC_OUTPUT_MAKE_DEFS()
8634 AC_SUBST(MOZ_DEFINES)
8636 mv confdefs.h.save confdefs.h
8638 dnl Load the list of Makefiles to generate.
8639 dnl To add new Makefiles, edit allmakefiles.sh.
8640 dnl allmakefiles.sh sets the variable, MAKEFILES.
8641 . ${srcdir}/allmakefiles.sh
8643 dnl Run a perl script to quickly create the makefiles.
8644 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8645 dnl for the files it cannot handle correctly. This way, config.status
8646 dnl will handle these files.
8647 dnl If it fails, nothing is set and config.status will run as usual.
8649 dnl This does not change the $MAKEFILES variable.
8651 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8653 if test -z "${AS_PERL}"; then
8654 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8656 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8661 echo $MAKEFILES > unallmakefiles
8663 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8665 AC_OUTPUT($MAKEFILES)
8667 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8668 if test "$CAIRO_FEATURES_H"; then
8669 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8670 echo "$CAIRO_FEATURES_H is unchanged"
8671 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8673 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8677 dnl ========================================================
8678 dnl = Setup a nice relatively clean build environment for
8679 dnl = sub-configures.
8680 dnl ========================================================
8683 CFLAGS="$_SUBDIR_CFLAGS"
8684 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8685 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8686 LDFLAGS="$_SUBDIR_LDFLAGS"
8687 HOST_CC="$_SUBDIR_HOST_CC"
8688 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8689 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8695 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8696 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8698 if test -z "$MOZ_NATIVE_NSPR"; then
8699 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8700 if test -z "$MOZ_DEBUG"; then
8701 ac_configure_args="$ac_configure_args --disable-debug"
8703 if test "$MOZ_OPTIMIZE" = "1"; then
8704 ac_configure_args="$ac_configure_args --enable-optimize"
8706 if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8707 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8709 if test -n "$HAVE_64BIT_OS"; then
8710 ac_configure_args="$ac_configure_args --enable-64bit"
8712 if test -n "$USE_ARM_KUSER"; then
8713 ac_configure_args="$ac_configure_args --with-arm-kuser"
8715 AC_OUTPUT_SUBDIRS(nsprpub)
8716 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8719 if test -z "$MOZ_NATIVE_NSPR"; then
8720 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8721 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8722 if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8723 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8724 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8725 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8726 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8728 rm -f config/autoconf.mk.bak
8731 # Run the SpiderMonkey 'configure' script.
8732 dist=$MOZ_BUILD_ROOT/dist
8733 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8734 ac_configure_args="$ac_configure_args --enable-threadsafe"
8735 if test -z "$MOZ_NATIVE_NSPR"; then
8736 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8737 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8739 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8740 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8741 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8742 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8743 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8744 if test "$MOZ_MEMORY"; then
8745 ac_configure_args="$ac_configure_args --enable-jemalloc"
8746 if test -n "$MOZ_MEMORY_LDFLAGS"; then
8747 export MOZ_MEMORY_LDFLAGS
8750 AC_OUTPUT_SUBDIRS(js/src)
8751 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8753 # Build jsctypes on the platforms we can.
8754 if test "$BUILD_CTYPES"; then
8755 # Run the libffi 'configure' script.
8756 ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8757 if test "$MOZ_DEBUG"; then
8758 ac_configure_args="$ac_configure_args --enable-debug"
8760 if test "$DSO_PIC_CFLAGS"; then
8761 ac_configure_args="$ac_configure_args --with-pic"
8763 if test "$CROSS_COMPILE"; then
8766 ac_configure_args="$ac_configure_args --build=$build --host=${target_cpu}-${target_os} HOST_CC=\"$HOST_CC\" CC=\"$CC\""
8769 ac_configure_args="$ac_configure_args --build=$build --host=$target HOST_CC=\"$HOST_CC\" CC=\"$CC\""
8773 if test "$_MSC_VER"; then
8774 # Use a wrapper script for cl and ml that looks more like gcc.
8775 # autotools can't quite handle an MSVC build environment yet.
8776 ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe"
8777 case "${target_cpu}" in
8779 # Need target since MSYS tools into mozilla-build may be 32bit
8780 ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/ctypes/libffi/msvcc.sh -m64\" --build=$build --host=$target"
8783 ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/ctypes/libffi/msvcc.sh"
8787 if test "$SOLARIS_SUNPRO_CC"; then
8788 # Always use gcc for libffi on Solaris
8789 ac_configure_args="$ac_configure_args CC=gcc"
8792 # Use a separate cache file for libffi, since it does things differently
8793 # from our configure.
8794 old_cache_file=$cache_file
8795 cache_file=js/ctypes/libffi/config.cache
8796 AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8797 cache_file=$old_cache_file
8798 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8801 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8803 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8804 dnl Needs to be at the end to respect possible changes from NSPR configure
8805 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8806 echo "config/autoconf.mk is unchanged"
8807 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8809 rm -f config/autoconf.mk.orig 2> /dev/null