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=
4761 XPC_IDISPATCH_SUPPORT=
4764 case "$target_os" in
4765 darwin*|*wince*|*winmo*)
4773 case "$target_os" in
4774 msvc*|mks*|cygwin*|mingw*)
4776 if test -z "$GNU_CC"; then
4777 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4780 XPC_IDISPATCH_SUPPORT=1
4781 MOZ_NO_ACTIVEX_SUPPORT=
4783 if test -n "$NS_ENABLE_TSF"; then
4784 AC_DEFINE(NS_ENABLE_TSF)
4789 MOZ_ARG_ENABLE_STRING(application,
4790 [ --enable-application=APP
4794 content/xslt (Standalone Transformiix XSLT)
4795 netwerk (Standalone Necko)
4796 tools/update-packaging (AUS-related packaging tools)
4797 standalone (use this for standalone
4798 xpcom/xpconnect or to manually drive a build)],
4799 [ MOZ_BUILD_APP=$enableval ] )
4801 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4802 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4803 XULRUNNER_STUB_NAME=$withval)
4805 if test -z "$XULRUNNER_STUB_NAME"; then
4806 case "$target_os" in
4808 XULRUNNER_STUB_NAME=xulrunner
4811 XULRUNNER_STUB_NAME=xulrunner-stub
4814 AC_SUBST(XULRUNNER_STUB_NAME)
4816 if test -z "$MOZ_BUILD_APP"; then
4817 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4819 # We have a valid application only if it has a build.mk file in its top
4821 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4822 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4826 # Allow the application to influence configure with a confvars.sh script.
4828 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4829 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4830 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4831 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4836 # Now is a good time to test for logic errors, define mismatches, etc.
4837 case "$MOZ_BUILD_APP" in
4839 if test "$LIBXUL_SDK"; then
4840 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4845 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4846 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4848 case "$MOZ_BUILD_APP" in
4850 AC_DEFINE(MOZ_PHOENIX)
4854 AC_DEFINE(MOZ_XULRUNNER)
4862 MOZ_APP_NAME=mozilla
4863 MOZ_APP_DISPLAYNAME=Mozilla
4864 MOZ_APP_VERSION=$MOZILLA_VERSION
4869 AC_SUBST(MOZ_BUILD_APP)
4870 AC_SUBST(MOZ_PHOENIX)
4871 AC_SUBST(MOZ_XULRUNNER)
4873 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4875 dnl ========================================================
4877 dnl = Toolkit Options
4879 dnl ========================================================
4880 MOZ_ARG_HEADER(Toolkit Options)
4882 dnl ========================================================
4883 dnl = Select the default toolkit
4884 dnl ========================================================
4885 MOZ_ARG_ENABLE_STRING(default-toolkit,
4886 [ --enable-default-toolkit=TK
4887 Select default toolkit
4888 Platform specific defaults:
4890 Mac OS X - cairo-cocoa
4891 Neutrino/QNX - photon
4893 Win32/WinCE - cairo-windows
4894 Gtk2 with DirectFB - cairo-gtk2-dfb
4897 [ _DEFAULT_TOOLKIT=$enableval ],
4898 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4900 if test "$_DEFAULT_TOOLKIT" = "photon" \
4901 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4902 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4903 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4904 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4905 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4906 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4907 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4908 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4910 dnl nglayout only supports building with one toolkit,
4911 dnl so ignore everything after the first comma (",").
4912 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4914 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4917 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4919 dnl ========================================================
4920 dnl = Enable the toolkit as needed =
4921 dnl ========================================================
4923 case "$MOZ_WIDGET_TOOLKIT" in
4926 AC_DEFINE(MOZ_WIDGET_PHOTON)
4930 MOZ_WIDGET_TOOLKIT=windows
4939 cairo-gtk2|cairo-gtk2-x11)
4940 MOZ_WIDGET_TOOLKIT=gtk2
4942 MOZ_ENABLE_XREMOTE=1
4950 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4951 TK_LIBS='$(MOZ_GTK2_LIBS)'
4952 AC_DEFINE(MOZ_WIDGET_GTK2)
4956 MOZ_WIDGET_TOOLKIT=gtk2
4963 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4964 TK_LIBS='$(MOZ_GTK2_LIBS)'
4965 AC_DEFINE(MOZ_WIDGET_GTK2)
4966 if test "$no_x" != "yes"; then
4967 AC_MSG_WARN([Disabling X when DirectFB is specified.])
4973 MOZ_WIDGET_TOOLKIT=qt
4975 MOZ_ENABLE_XREMOTE=1
4983 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4984 TK_LIBS='$(MOZ_QT_LIBS)'
4985 AC_DEFINE(MOZ_WIDGET_QT)
4989 MOZ_WIDGET_TOOLKIT=beos
4991 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4992 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4996 MOZ_WIDGET_TOOLKIT=os2
4998 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4999 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5003 MOZ_WIDGET_TOOLKIT=cocoa
5004 AC_DEFINE(MOZ_WIDGET_COCOA)
5005 MOZ_USER_DIR="Mozilla"
5006 AC_DEFINE(XP_MACOSX)
5007 TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
5008 TK_CFLAGS="-DNO_X11"
5009 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5010 CFLAGS="$CFLAGS $TK_CFLAGS"
5011 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5012 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5013 MOZ_FS_LAYOUT=bundle
5018 if test "$MOZ_ENABLE_XREMOTE"; then
5019 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5022 if test "$COMPILE_ENVIRONMENT"; then
5023 if test "$MOZ_ENABLE_GTK2"; then
5024 if test "$MOZ_X11"; then
5025 GDK_PACKAGES=gdk-x11-2.0
5026 elif test "$MOZ_DFB"; then
5027 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5028 GDK_PACKAGES=directfb
5031 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5034 fi # COMPILE_ENVIRONMENT
5036 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
5037 AC_SUBST(MOZ_FS_LAYOUT)
5039 dnl ========================================================
5040 dnl = startup-notification support module
5041 dnl ========================================================
5043 if test "$MOZ_ENABLE_GTK2"
5045 MOZ_ENABLE_STARTUP_NOTIFICATION=
5047 MOZ_ARG_ENABLE_BOOL(startup-notification,
5048 [ --enable-startup-notification Enable startup-notification support (default: disabled) ],
5049 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5050 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5051 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5053 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5054 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5055 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5056 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5058 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5060 MOZ_ENABLE_STARTUP_NOTIFICATION=
5064 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5065 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5068 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5070 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5071 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5072 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5074 dnl ========================================================
5076 dnl ========================================================
5077 if test "$MOZ_ENABLE_QT"
5079 MOZ_ARG_WITH_STRING(qtdir,
5080 [ --with-qtdir=\$dir Specify Qt directory ],
5083 if test -z "$QTDIR"; then
5084 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore)
5085 AC_CHECK_PROGS(HOST_MOC, moc, "")
5087 MOZ_QT_LIBS="-L$QTDIR/qt/lib/ -lQtGui -lQtNetwork -lQtCore"
5089 MOZ_QT_CFLAGS="-DQT_SHARED"
5090 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include"
5091 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/Qt"
5092 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtGui"
5093 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtCore"
5094 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtNetwork"
5096 HOST_MOC="$QTDIR/qt/bin/moc"
5098 if test -z "$HOST_MOC"; then
5099 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5105 AC_SUBST(GTK_CONFIG)
5109 AC_SUBST(MOZ_ENABLE_GTK2)
5110 AC_SUBST(MOZ_ENABLE_PHOTON)
5111 AC_SUBST(MOZ_ENABLE_QT)
5112 AC_SUBST(MOZ_ENABLE_XREMOTE)
5113 AC_SUBST(MOZ_GTK2_CFLAGS)
5114 AC_SUBST(MOZ_GTK2_LIBS)
5115 AC_SUBST(MOZ_QT_CFLAGS)
5116 AC_SUBST(MOZ_QT_LIBS)
5123 dnl ========================================================
5125 dnl = Components & Features
5127 dnl ========================================================
5128 MOZ_ARG_HEADER(Components and Features)
5130 dnl ========================================================
5132 dnl ========================================================
5133 MOZ_ARG_ENABLE_STRING(ui-locale,
5134 [ --enable-ui-locale=ab-CD
5135 Select the user interface locale (default: en-US)],
5136 MOZ_UI_LOCALE=$enableval )
5137 AC_SUBST(MOZ_UI_LOCALE)
5139 dnl ========================================================
5140 dnl = Trademarked Branding
5141 dnl ========================================================
5142 MOZ_ARG_ENABLE_BOOL(official-branding,
5143 [ --enable-official-branding Enable Official mozilla.org Branding
5144 Do not distribute builds with
5145 --enable-official-branding unless you have
5146 permission to use trademarks per
5147 http://www.mozilla.org/foundation/trademarks/ .],
5149 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5150 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5152 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5153 MOZ_OFFICIAL_BRANDING=1
5155 ], MOZ_OFFICIAL_BRANDING=)
5157 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5158 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5159 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5162 MOZ_ARG_WITH_STRING(branding,
5163 [ --with-branding=dir Use branding from the specified directory.],
5164 MOZ_BRANDING_DIRECTORY=$withval)
5166 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5167 if test -z "$REAL_BRANDING_DIRECTORY"; then
5168 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5171 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5172 . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
5175 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5177 dnl ========================================================
5178 dnl = Distribution ID
5179 dnl ========================================================
5180 MOZ_ARG_WITH_STRING(distribution-id,
5181 [ --with-distribution-id=ID Set distribution-specific id (default=org.mozilla)],
5182 [ val=`echo $withval`
5183 MOZ_DISTRIBUTION_ID="$val"])
5185 if test -z "$MOZ_DISTRIBUTION_ID"; then
5186 MOZ_DISTRIBUTION_ID="org.mozilla"
5189 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5190 AC_SUBST(MOZ_DISTRIBUTION_ID)
5193 dnl ========================================================
5194 dnl complex text support off by default
5195 dnl ========================================================
5196 MOZ_ARG_DISABLE_BOOL(pango,
5197 [ --disable-pango Disable usage of Pango ],
5201 dnl ========================================================
5203 dnl ========================================================
5204 if test "$MOZ_ENABLE_GTK2"
5208 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5210 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5211 AC_SUBST(MOZ_PANGO_CFLAGS)
5212 AC_SUBST(MOZ_PANGO_LIBS)
5213 if test "$MOZ_PANGO"
5215 AC_DEFINE(MOZ_PANGO)
5217 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5218 AC_SUBST(FT2_CFLAGS)
5223 if test "$MOZ_ENABLE_QT"
5225 if test "$MOZ_PANGO"
5227 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5229 AC_SUBST(MOZ_PANGO_CFLAGS)
5230 AC_SUBST(MOZ_PANGO_LIBS)
5231 AC_DEFINE(MOZ_PANGO)
5234 echo "Pango library not found, will use FT2 font engine"
5241 dnl ========================================================
5242 dnl = GnomeVFS, GIO and GConf support module
5243 dnl ========================================================
5247 dnl build the gnomevfs extension by default only when the
5248 dnl GTK2 toolkit is in use.
5249 if test "$MOZ_ENABLE_GTK2"
5251 MOZ_ENABLE_GNOMEVFS=1
5255 dnl ========================================================
5256 dnl = GnomeVFS support module
5257 dnl ========================================================
5258 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5259 [ --disable-gnomevfs Disable GnomeVFS support ],
5260 MOZ_ENABLE_GNOMEVFS=,
5261 MOZ_ENABLE_GNOMEVFS=force)
5263 if test "$MOZ_ENABLE_GNOMEVFS"
5265 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5266 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5267 MOZ_ENABLE_GNOMEVFS=1
5268 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5270 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5272 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5274 MOZ_ENABLE_GNOMEVFS=
5277 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5278 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5279 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5284 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5285 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5286 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5288 dnl ========================================================
5289 dnl = GIO support module
5290 dnl ========================================================
5291 MOZ_ARG_ENABLE_BOOL(gio,
5292 [ --enable-gio Enable GIO support (default: disabled)],
5293 MOZ_ENABLE_GIO=force,
5296 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5298 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5299 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5301 AC_DEFINE(MOZ_ENABLE_GIO)
5303 if test "$MOZ_ENABLE_GIO" = "force"
5305 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5311 AC_SUBST(MOZ_ENABLE_GIO)
5312 AC_SUBST(MOZ_GIO_CFLAGS)
5313 AC_SUBST(MOZ_GIO_LIBS)
5315 dnl ========================================================
5316 dnl = GConf support module
5317 dnl ========================================================
5318 if test "$MOZ_ENABLE_GCONF"
5320 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5321 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5324 if test "$MOZ_ENABLE_GCONF" = "force"
5326 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5332 if test "$MOZ_ENABLE_GCONF"; then
5333 AC_DEFINE(MOZ_ENABLE_GCONF)
5336 AC_SUBST(MOZ_ENABLE_GCONF)
5337 AC_SUBST(MOZ_GCONF_CFLAGS)
5338 AC_SUBST(MOZ_GCONF_LIBS)
5341 dnl ========================================================
5342 dnl = libnotify support
5343 dnl ========================================================
5345 if test "$MOZ_ENABLE_GTK2"
5347 MOZ_ENABLE_LIBNOTIFY=1
5349 MOZ_ARG_DISABLE_BOOL(libnotify,
5350 [ --disable-libnotify Disable libnotify support ],
5351 MOZ_ENABLE_LIBNOTIFY=,
5352 MOZ_ENABLE_LIBNOTIFY=1)
5354 if test "$MOZ_ENABLE_LIBNOTIFY"
5356 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5360 if test -z "$SKIP_LIBRARY_CHECKS"
5362 if test "$MOZ_ENABLE_GTK2"
5364 if test "$MOZ_ENABLE_LIBNOTIFY"
5366 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5370 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5371 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5372 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5374 dnl ========================================================
5375 dnl = GNOME component (mozgnome)
5376 dnl ========================================================
5378 # The GNOME component is built if one of
5379 # gnome-vfs, gio, gconf or libnotify is available.
5380 if test "$MOZ_ENABLE_GCONF" || \
5381 test "$MOZ_ENABLE_GNOMEVFS" || \
5382 test "$MOZ_ENABLE_GIO" || \
5383 test "$MOZ_ENABLE_LIBNOTIFY"; then
5384 MOZ_ENABLE_GNOME_COMPONENT=1
5386 MOZ_ENABLE_GNOME_COMPONENT=
5388 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5390 dnl ========================================================
5391 dnl = libgnomeui support module
5392 dnl ========================================================
5394 if test "$MOZ_ENABLE_GTK2"
5396 MOZ_ENABLE_GNOMEUI=1
5398 MOZ_ARG_DISABLE_BOOL(gnomeui,
5399 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5400 MOZ_ENABLE_GNOMEUI=,
5401 MOZ_ENABLE_GNOMEUI=force)
5403 if test "$MOZ_ENABLE_GNOMEUI"
5405 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5407 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5408 MOZ_ENABLE_GNOMEUI=1
5410 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5412 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5418 if test "$MOZ_ENABLE_GNOMEUI"; then
5419 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5423 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5424 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5425 AC_SUBST(MOZ_GNOMEUI_LIBS)
5427 dnl ========================================================
5429 dnl ========================================================
5431 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5435 MOZ_ARG_DISABLE_BOOL(dbus,
5436 [ --disable-dbus Disable dbus support ],
5440 if test "$MOZ_ENABLE_DBUS"
5442 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5443 AC_DEFINE(MOZ_ENABLE_DBUS)
5446 AC_SUBST(MOZ_ENABLE_DBUS)
5447 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5448 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5450 dnl ========================================================
5451 dnl = Build Personal Security Manager
5452 dnl ========================================================
5453 MOZ_ARG_DISABLE_BOOL(crypto,
5454 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5458 dnl ========================================================
5459 dnl = JS Debugger XPCOM component (js/jsd)
5460 dnl ========================================================
5461 MOZ_ARG_DISABLE_BOOL(jsd,
5462 [ --disable-jsd Disable JavaScript debug library],
5467 dnl ========================================================
5468 dnl = Disable IPC support for tabs and plugins
5469 dnl ========================================================
5479 MOZ_ARG_DISABLE_BOOL(ipc,
5480 [ --disable-ipc Disable IPC supports for tabs and plugins],
5484 if test -n "$MOZ_IPC"; then
5490 dnl ========================================================
5491 dnl = Enable IPDL's "expensive" unit tests
5492 dnl ========================================================
5495 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5496 [ --enable-ipdl-tests Enable expensive IPDL tests],
5500 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5501 AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5504 if test -n "$MOZ_IPDL_TESTS"; then
5505 AC_DEFINE(MOZ_IPDL_TESTS)
5508 AC_SUBST(MOZ_IPDL_TESTS)
5510 dnl ========================================================
5511 dnl = Disable plugin support
5512 dnl ========================================================
5513 MOZ_ARG_DISABLE_BOOL(plugins,
5514 [ --disable-plugins Disable plugins support],
5518 dnl ========================================================
5519 dnl = Disable building dbm
5520 dnl ========================================================
5521 MOZ_ARG_DISABLE_BOOL(dbm,
5522 [ --disable-dbm Disable building dbm],
5526 dnl bi-directional support always on
5530 dnl ========================================================
5531 dnl view source support on by default
5532 dnl ========================================================
5533 if test "$MOZ_VIEW_SOURCE"; then
5534 AC_DEFINE(MOZ_VIEW_SOURCE)
5537 dnl ========================================================
5538 dnl accessibility support on by default on all platforms
5540 dnl ========================================================
5541 MOZ_ARG_DISABLE_BOOL(accessibility,
5542 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5545 if test "$ACCESSIBILITY"; then
5546 AC_DEFINE(ACCESSIBILITY)
5549 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5551 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5552 if test "$ac_cv_header_atlbase_h" = "no"; then
5553 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.])
5555 if test "$ac_cv_header_oleacc_idl" = "no"; then
5556 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.])
5562 dnl ========================================================
5563 dnl xpfe/components on by default
5564 dnl ========================================================
5565 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5566 [ --disable-xpfe-components
5567 Disable xpfe components],
5568 MOZ_XPFE_COMPONENTS=,
5569 MOZ_XPFE_COMPONENTS=1 )
5571 dnl ========================================================
5572 dnl xpinstall support on by default
5573 dnl ========================================================
5574 MOZ_ARG_DISABLE_BOOL(xpinstall,
5575 [ --disable-xpinstall Disable xpinstall support],
5578 if test "$MOZ_XPINSTALL"; then
5579 AC_DEFINE(MOZ_XPINSTALL)
5582 dnl ========================================================
5583 dnl xpcom js loader support on by default
5584 dnl ========================================================
5585 if test "$MOZ_JSLOADER"; then
5586 AC_DEFINE(MOZ_JSLOADER)
5589 dnl ========================================================
5590 dnl Disable printing
5591 dnl ========================================================
5592 MOZ_ARG_DISABLE_BOOL(printing,
5593 [ --disable-printing Disable printing support],
5597 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5598 AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5602 if test "$NS_PRINTING"; then
5603 AC_DEFINE(NS_PRINTING)
5604 AC_DEFINE(NS_PRINT_PREVIEW)
5607 dnl ========================================================
5608 dnl use native unicode converters
5609 dnl ========================================================
5610 MOZ_ARG_ENABLE_BOOL(native-uconv,
5611 [ --enable-native-uconv Enable iconv support],
5612 MOZ_USE_NATIVE_UCONV=1,
5613 MOZ_USE_NATIVE_UCONV= )
5614 if test "$MOZ_USE_NATIVE_UCONV"; then
5615 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5617 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5618 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5622 dnl ========================================================
5623 dnl Libeditor can be build as plaintext-only,
5624 dnl or as a full html and text editing component.
5625 dnl We build both by default.
5626 dnl ========================================================
5627 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5628 [ --enable-plaintext-editor-only
5629 Allow only plaintext editing],
5630 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5631 MOZ_PLAINTEXT_EDITOR_ONLY= )
5632 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5633 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5635 dnl ========================================================
5636 dnl = Disable Fast Load
5637 dnl ========================================================
5638 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5639 [ --disable-xpcom-fastload Disable XPCOM fastload support],
5643 AC_SUBST(MOZ_NO_FAST_LOAD)
5645 if test -n "$MOZ_NO_FAST_LOAD"; then
5646 AC_DEFINE(MOZ_NO_FAST_LOAD)
5649 dnl ========================================================
5650 dnl = Disable Ogg Codecs
5651 dnl ========================================================
5652 MOZ_ARG_DISABLE_BOOL(ogg,
5653 [ --disable-ogg Disable Ogg Codec support],
5659 if test -n "$MOZ_OGG"; then
5664 dnl Checks for __attribute__(aligned()) directive
5665 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5666 [ac_cv_c_attribute_aligned],
5667 [ac_cv_c_attribute_aligned=0
5668 CFLAGS_save="${CFLAGS}"
5669 CFLAGS="${CFLAGS} -Werror"
5670 for ac_cv_c_attr_align_try in 64 32 16 8; do
5671 echo "trying $ac_cv_c_attr_align_try"
5673 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5674 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5675 if test "$ac_cv_c_attribute_aligned" != 0; then
5679 CFLAGS="${CFLAGS_save}"])
5680 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5681 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5682 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5686 dnl ========================================================
5687 dnl = Disable Wave decoder support
5688 dnl ========================================================
5689 MOZ_ARG_DISABLE_BOOL(wave,
5690 [ --disable-wave Disable Wave decoder support],
5696 if test -n "$MOZ_WAVE"; then
5702 dnl ========================================================
5703 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5704 dnl ========================================================
5706 AC_SUBST(MOZ_SYDNEYAUDIO)
5708 if test -n "$MOZ_SYDNEYAUDIO"; then
5709 AC_DEFINE(MOZ_SYDNEYAUDIO)
5714 if test -n "$MOZ_MEDIA"; then
5715 AC_DEFINE(MOZ_MEDIA)
5718 dnl ========================================================
5719 dnl = Check alsa availability on Linux if using sydneyaudio
5720 dnl ========================================================
5722 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5723 if test -n "$MOZ_SYDNEYAUDIO"; then
5724 case "$target_os" in
5726 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5727 [echo "$MOZ_ALSA_PKG_ERRORS"
5728 AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux. Disable with --disable-ogg --disable-wave.])])
5732 AC_SUBST(MOZ_ALSA_LIBS)
5734 dnl ========================================================
5736 dnl ========================================================
5737 AC_ARG_ENABLE(splashscreen,
5738 [ --enable-splashscreen display splashscreen while loading (default=no)],
5739 [enable_splash="yes"],[enable_splash=""])
5740 if test "x$enable_splash" = "xyes"; then
5742 AC_DEFINE(MOZ_SPLASHSCREEN)
5744 AC_SUBST(MOZ_SPLASHSCREEN)
5746 dnl ========================================================
5747 dnl Permissions System
5748 dnl ========================================================
5749 MOZ_ARG_DISABLE_BOOL(permissions,
5750 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5755 dnl ========================================================
5757 dnl ========================================================
5758 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5759 [ --disable-negotiateauth Disable GSS-API negotiation ],
5760 MOZ_AUTH_EXTENSION=,
5761 MOZ_AUTH_EXTENSION=1 )
5763 dnl ========================================================
5765 dnl ========================================================
5766 MOZ_ARG_DISABLE_BOOL(xtf,
5767 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5770 if test "$MOZ_XTF"; then
5774 dnl ========================================================
5775 dnl Pref extensions (autoconfig and system-pref)
5776 dnl ========================================================
5777 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5778 [ --disable-pref-extensions
5779 Disable pref extensions such as autoconfig and
5781 MOZ_PREF_EXTENSIONS=,
5782 MOZ_PREF_EXTENSIONS=1 )
5784 dnl ========================================================
5785 dnl = Universalchardet
5786 dnl ========================================================
5787 MOZ_ARG_DISABLE_BOOL(universalchardet,
5788 [ --disable-universalchardet
5789 Disable universal encoding detection],
5790 MOZ_UNIVERSALCHARDET=,
5791 MOZ_UNIVERSALCHARDET=1 )
5793 dnl ========================================================
5795 dnl ========================================================
5802 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5803 [ --enable-javaxpcom
5804 Enable Java-XPCOM bridge],
5808 if test -n "${MOZ_JAVAXPCOM}"; then
5811 if test -n "$JAVA_HOME"; then
5812 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5816 if test -n "$JAVA_HOME"; then
5817 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5822 if test -n "${JAVA_INCLUDE_PATH}"; then
5823 dnl Make sure jni.h exists in the given include path.
5824 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5825 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5828 case "$target_os" in
5830 dnl Default to java system location
5831 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5835 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5838 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5839 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.])
5843 if test -n "${JAVA_BIN_PATH}"; then
5844 dnl Look for javac and jar in the specified path.
5845 JAVA_PATH="$JAVA_BIN_PATH"
5847 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5848 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5851 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5852 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5853 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5854 if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5855 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.])
5859 dnl ========================================================
5860 dnl = Breakpad crash reporting (on by default on supported platforms)
5861 dnl ========================================================
5863 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5864 || test "$OS_ARCH" = "Darwin" \
5865 || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5866 || test "$OS_ARCH" = "SunOS") \
5867 && test -z "$HAVE_64BIT_OS"; then
5871 MOZ_ARG_DISABLE_BOOL(crashreporter,
5872 [ --disable-crashreporter Disable breakpad crash reporting],
5874 MOZ_CRASHREPORTER=1)
5876 if test -n "$MOZ_CRASHREPORTER"; then
5877 AC_DEFINE(MOZ_CRASHREPORTER)
5879 if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5880 test -z "$SKIP_LIBRARY_CHECKS"; then
5881 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5882 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5883 AC_SUBST(MOZ_GTHREAD_LIBS)
5885 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.])])
5889 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5890 [ --with-crashreporter-enable-percent=NN Enable sending crash reports by default on NN% of users. (default=100)],
5891 [ val=`echo $withval | sed 's/[^0-9]//g'`
5892 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5894 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5895 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5897 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5899 dnl ========================================================
5900 dnl = Enable compilation of specific extension modules
5901 dnl ========================================================
5903 MOZ_ARG_ENABLE_STRING(extensions,
5904 [ --enable-extensions Enable extensions],
5905 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5906 if test "$option" = "yes" || test "$option" = "all"; then
5907 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5908 elif test "$option" = "no" || test "$option" = "none"; then
5910 elif test "$option" = "default"; then
5911 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5912 elif test `echo "$option" | grep -c \^-` != 0; then
5913 option=`echo $option | sed 's/^-//'`
5914 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5916 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5919 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5921 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5922 # Suppress warning on non-X11 platforms
5923 if test -n "$MOZ_X11"; then
5924 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5926 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5929 dnl Do not build gnomevfs with libxul based apps
5930 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5931 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5934 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5935 # Suppress warning on non-X11 platforms
5936 if test -n "$MOZ_X11"; then
5937 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5939 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5942 dnl Do not build gio with libxul based apps
5943 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5944 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5947 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5948 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5949 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5952 dnl This might be temporary: build tridentprofile only on Windows
5953 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5954 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5955 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5958 dnl cookie must be built before tridentprofile. put it at list's end.
5959 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5960 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5961 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5964 dnl xforms requires xtf and schema-validation
5965 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5966 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
5967 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5969 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5970 AC_MSG_WARN([Cannot build XForms without schema validation. Removing XForms from MOZ_EXTENSIONS.])
5971 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5974 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5975 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5976 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5979 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5980 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5981 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5984 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5985 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5986 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5989 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5990 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5991 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5994 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5995 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5996 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5999 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6000 AC_MSG_WARN([spellcheck is no longer an extension.])
6001 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6005 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6007 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6008 dnl when trying to build a non-existent extension.
6009 for extension in $MOZ_EXTENSIONS; do
6010 if test ! -d "${srcdir}/extensions/${extension}"; then
6011 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6016 dnl ========================================================
6018 dnl ========================================================
6019 case "$MOZ_WIDGET_TOOLKIT" in
6020 beos|windows|os2|mac|cocoa)
6023 if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6024 MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6029 MOZ_ARG_ENABLE_STRING(image-decoders,
6030 [ --enable-image-decoders[={mod1,mod2,default,all,none}]
6031 Enable specific image decoders],
6032 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6033 if test "$option" = "yes" || test "$option" = "all"; then
6034 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6035 elif test "$option" = "no" || test "$option" = "none"; then
6037 elif test "$option" = "default"; then
6038 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6039 elif test `echo "$option" | grep -c \^-` != 0; then
6040 option=`echo $option | sed 's/^-//'`
6041 MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6043 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6046 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6048 dnl Dupes are removed in the encoder section because it will also add decoders
6050 dnl ========================================================
6052 dnl ========================================================
6053 MOZ_ARG_ENABLE_STRING(image-encoders,
6054 [ --enable-image-encoders[={mod1,mod2,default,all,none}]
6055 Enable specific image encoders],
6056 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6057 if test "$option" = "yes" || test "$option" = "all"; then
6058 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6059 elif test "$option" = "no" || test "$option" = "none"; then
6062 elif test "$option" = "default"; then
6063 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6064 elif test `echo "$option" | grep -c \^-` != 0; then
6065 option=`echo $option | sed 's/^-//'`
6066 addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6068 addencoder="$option"
6070 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6072 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6075 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6076 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6078 dnl ========================================================
6079 dnl MathML on by default
6080 dnl ========================================================
6081 MOZ_ARG_DISABLE_BOOL(mathml,
6082 [ --disable-mathml Disable MathML support],
6085 if test "$MOZ_MATHML"; then
6086 AC_DEFINE(MOZ_MATHML)
6089 dnl ========================================================
6091 dnl ========================================================
6092 MOZ_ARG_DISABLE_BOOL(svg,
6093 [ --disable-svg Disable SVG support],
6096 if test -n "$MOZ_SVG"; then
6100 dnl ========================================================
6102 dnl ========================================================
6104 MOZ_ARG_DISABLE_BOOL(smil,
6105 [ --disable-smil Disable SMIL animation support],
6108 # Automatically disable SMIL if SVG is disabled
6109 if test -z "$MOZ_SVG"; then
6112 if test -n "$MOZ_SMIL"; then
6116 dnl ========================================================
6117 dnl Build Freetype in the tree
6118 dnl ========================================================
6119 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6120 [ --enable-tree-freetype Enable Tree FreeType],
6121 MOZ_TREE_FREETYPE=1,
6122 MOZ_TREE_FREETYPE= )
6123 if test -n "$MOZ_TREE_FREETYPE"; then
6124 AC_DEFINE(MOZ_TREE_FREETYPE)
6125 AC_SUBST(MOZ_TREE_FREETYPE)
6126 MOZ_ENABLE_CAIRO_FT=1
6127 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6128 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6129 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6130 FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
6131 CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
6132 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6133 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6134 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6135 AC_SUBST(CAIRO_FT_CFLAGS)
6139 dnl ========================================================
6141 dnl ========================================================
6142 case "$target_os" in
6143 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6148 MOZ_ARG_DISABLE_BOOL(installer,
6149 [ --disable-installer Disable building of installer],
6152 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6153 # Disable installer for Windows builds that use the new toolkit if NSIS
6154 # isn't in the path.
6155 MOZ_PATH_PROGS(MAKENSIS, makensis)
6156 if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6157 AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6159 # The Windows build for NSIS requires the iconv command line utility to
6160 # convert the charset of the locale files.
6161 MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6162 if test -z "$HOST_ICONV"; then
6163 AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6167 # Automatically disable installer if xpinstall isn't built
6168 if test -z "$MOZ_XPINSTALL"; then
6171 AC_SUBST(MOZ_INSTALLER)
6173 AC_MSG_CHECKING([for tar archiver])
6174 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6175 if test -z "$TAR"; then
6176 AC_MSG_ERROR([no tar archiver found in \$PATH])
6178 AC_MSG_RESULT([$TAR])
6181 AC_MSG_CHECKING([for wget])
6182 AC_CHECK_PROGS(WGET, wget, "")
6183 AC_MSG_RESULT([$WGET])
6186 dnl ========================================================
6188 dnl ========================================================
6190 MOZ_ARG_DISABLE_BOOL(updater,
6191 [ --disable-updater Disable building of updater],
6194 AC_SUBST(MOZ_UPDATER)
6196 # app update channel is 'default' when not supplied.
6197 MOZ_ARG_ENABLE_STRING([update-channel],
6198 [ --enable-update-channel=CHANNEL
6199 Select application update channel (default=default)],
6200 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6202 if test -z "$MOZ_UPDATE_CHANNEL"; then
6203 MOZ_UPDATE_CHANNEL=default
6205 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6207 # tools/update-packaging is not checked out by default.
6208 MOZ_ARG_ENABLE_BOOL(update-packaging,
6209 [ --enable-update-packaging
6210 Enable tools/update-packaging],
6211 MOZ_UPDATE_PACKAGING=1,
6212 MOZ_UPDATE_PACKAGING= )
6213 AC_SUBST(MOZ_UPDATE_PACKAGING)
6215 dnl ========================================================
6217 dnl ========================================================
6219 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6220 [ --disable-xpconnect-idispatch
6221 Disable building of xpconnect support for IDispatch
6223 XPC_IDISPATCH_SUPPORT=,
6224 XPC_IDISPATCH_SUPPORT=1)
6225 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6227 MOZ_ARG_DISABLE_BOOL(activex,
6228 [ --disable-activex Disable building of ActiveX control (win32 only)],
6229 MOZ_NO_ACTIVEX_SUPPORT=1,
6230 MOZ_NO_ACTIVEX_SUPPORT= )
6231 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6233 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6234 [ --enable-activex-scripting
6235 Enable building of ActiveX scripting support (win32)],
6236 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6237 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6238 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6240 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6242 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6245 if test "$COMPILE_ENVIRONMENT" = "1"; then
6246 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6248 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6249 if test "$ac_cv_header_atlbase_h" = "no"; then
6250 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.])
6257 dnl ========================================================
6259 dnl ========================================================
6260 MOZ_ARG_ENABLE_BOOL(leaky,
6261 [ --enable-leaky Build leaky memory tool],
6266 dnl ========================================================
6268 dnl ========================================================
6269 MOZ_ARG_ENABLE_BOOL(xpctools,
6270 [ --enable-xpctools Build JS profiling tool],
6275 dnl ========================================================
6276 dnl build the tests by default
6277 dnl ========================================================
6278 MOZ_ARG_DISABLE_BOOL(tests,
6279 [ --disable-tests Do not build test libraries & programs],
6283 dnl ========================================================
6284 dnl parental controls (for Windows Vista)
6285 dnl ========================================================
6286 MOZ_ARG_DISABLE_BOOL(parental-controls,
6287 [ --disable-parental-controls
6288 Do not build parental controls],
6289 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6290 MOZ_DISABLE_PARENTAL_CONTROLS=)
6291 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6292 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6295 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6297 dnl ========================================================
6299 dnl = Module specific options
6301 dnl ========================================================
6302 MOZ_ARG_HEADER(Individual module options)
6304 dnl ========================================================
6305 dnl = Enable places (new history/bookmarks)
6306 dnl ========================================================
6307 MOZ_ARG_ENABLE_BOOL(places,
6308 [ --enable-places Enable 'places' bookmark/history implementation],
6311 if test -n "$MOZ_PLACES"; then
6312 AC_DEFINE(MOZ_PLACES)
6313 if test -z "$MOZ_MAIL_NEWS"; then
6318 if test "$MOZ_BUILD_APP" = "browser"; then
6319 AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6323 dnl ========================================================
6324 dnl = Disable feed handling components
6325 dnl ========================================================
6326 MOZ_ARG_DISABLE_BOOL(feeds,
6327 [ --disable-feeds Disable feed handling and processing components],
6330 if test -n "$MOZ_FEEDS"; then
6331 AC_DEFINE(MOZ_FEEDS)
6333 if test "$MOZ_BUILD_APP" = "browser"; then
6334 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6338 dnl ========================================================
6339 dnl = Enable mozStorage
6340 dnl ========================================================
6341 dnl Implicitly enabled by default if building calendar or places
6342 MOZ_ARG_ENABLE_BOOL(storage,
6343 [ --enable-storage Enable mozStorage module and related components],
6346 if test -n "$MOZ_STORAGE"; then
6347 AC_DEFINE(MOZ_STORAGE)
6350 dnl ========================================================
6351 dnl Check for sqlite
6352 dnl ========================================================
6355 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6356 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6357 MOZ_NATIVE_SQLITE=1,
6358 MOZ_NATIVE_SQLITE= )
6360 if test -z "$MOZ_NATIVE_SQLITE"
6363 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6365 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6366 dnl ===================================
6367 dnl === SQLITE_SECURE_DELETE checks ===
6368 dnl ===================================
6369 dnl check to see if the system sqlite package is compiled with
6370 dnl SQLITE_SECURE_DELETE enabled.
6371 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system sqlite)
6372 _SAVE_CFLAGS="$CFLAGS"
6373 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6375 LIBS="$LIBS $SQLITE_LIBS"
6376 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6378 #include "sqlite3.h"
6382 int main(int argc, char **argv){
6390 const int bufSize = 1024*3;
6392 zBuf = malloc(bufSize*sizeof(char));
6394 rc = sqlite3_open(":memory:", &db);
6395 assert( rc==SQLITE_OK );
6397 sqlite3_randomness(sizeof(r), &r);
6398 zFilename = sqlite3_mprintf("test_db_%llu.sqlite", r);
6399 rc = sqlite3_open(zFilename, &db);
6400 assert( rc==SQLITE_OK );
6401 rc = sqlite3_exec(db,
6403 "CREATE TABLE t1(x);"
6404 "INSERT INTO t1 VALUES(zeroblob(1000)||'abcdefghijklmnopqrstuvwxyz');"
6409 assert( rc==SQLITE_OK );
6411 in = fopen(zFilename, "r");
6413 rc = fread(zBuf, 1, bufSize, in);
6414 assert( rc==bufSize );
6418 for(i=0; i<bufSize-11; i++){
6419 if( *(zBuf+i)=='h' && memcmp(zBuf+i, "hijklmnopq", 10)==0 ){
6425 ac_cv_sqlite_secure_delete=yes,
6426 ac_cv_sqlite_secure_delete=no,
6427 ac_cv_sqlite_secure_delete=no
6430 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6431 CFLAGS="$_SAVE_CFLAGS"
6433 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6434 AC_MSG_ERROR([System Sqlite library is not compiled with SQLITE_SECURE_DELETE.])
6438 AC_SUBST(MOZ_NATIVE_SQLITE)
6440 dnl ========================================================
6441 dnl = Enable help viewer (off by default)
6442 dnl ========================================================
6443 MOZ_ARG_ENABLE_BOOL(help-viewer,
6444 [ --enable-help-viewer Enable help viewer],
6447 if test -n "$MOZ_HELP_VIEWER"; then
6448 AC_DEFINE(MOZ_HELP_VIEWER)
6450 AC_SUBST(MOZ_HELP_VIEWER)
6451 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6452 AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6455 dnl ========================================================
6456 dnl = Enable safe browsing (anti-phishing)
6457 dnl ========================================================
6458 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6459 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6460 MOZ_SAFE_BROWSING=1,
6461 MOZ_SAFE_BROWSING= )
6462 if test -n "$MOZ_SAFE_BROWSING"; then
6463 AC_DEFINE(MOZ_SAFE_BROWSING)
6465 AC_SUBST(MOZ_SAFE_BROWSING)
6467 dnl ========================================================
6468 dnl = Enable faststart component
6469 dnl ========================================================
6470 MOZ_ARG_ENABLE_BOOL(faststart,
6471 [ --enable-faststart Enable the faststart component],
6474 if test -n "$MOZ_FASTSTART"; then
6475 AC_DEFINE(MOZ_FASTSTART)
6477 AC_SUBST(MOZ_FASTSTART)
6479 dnl ========================================================
6480 dnl = Enable url-classifier
6481 dnl ========================================================
6482 dnl Implicitly enabled by default if building with safe-browsing
6483 if test -n "$MOZ_SAFE_BROWSING"; then
6484 MOZ_URL_CLASSIFIER=1
6486 MOZ_ARG_ENABLE_BOOL(url-classifier,
6487 [ --enable-url-classifier Enable url classifier module],
6488 MOZ_URL_CLASSIFIER=1,
6489 MOZ_URL_CLASSIFIER= )
6490 if test -n "$MOZ_URL_CLASSIFIER"; then
6491 AC_DEFINE(MOZ_URL_CLASSIFIER)
6493 AC_SUBST(MOZ_URL_CLASSIFIER)
6495 dnl ========================================================
6496 dnl = Disable zipwriter
6497 dnl ========================================================
6498 MOZ_ARG_DISABLE_BOOL(zipwriter,
6499 [ --disable-zipwriter Disable zipwriter component],
6502 AC_SUBST(MOZ_ZIPWRITER)
6504 dnl ========================================================
6505 dnl = Disable libconic
6506 dnl ========================================================
6507 MOZ_ENABLE_LIBCONIC=1
6508 MOZ_ARG_DISABLE_BOOL(libconic,
6509 [ --disable-libconic Disable libconic],
6510 MOZ_ENABLE_LIBCONIC=,
6511 MOZ_ENABLE_LIBCONIC=1 )
6513 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6514 PKG_CHECK_MODULES(LIBCONIC, conic,
6515 MOZ_ENABLE_LIBCONIC=1,
6516 MOZ_ENABLE_LIBCONIC=)
6518 if test "$MOZ_ENABLE_LIBCONIC"; then
6519 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6522 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6523 AC_SUBST(LIBCONIC_CFLAGS)
6524 AC_SUBST(LIBCONIC_LIBS)
6526 dnl ========================================================
6528 dnl ========================================================
6530 MAEMO_SDK_TARGET_VER=-1
6532 MOZ_ARG_WITH_STRING(maemo-version,
6533 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6535 MAEMO_SDK_TARGET_VER=$withval)
6537 case "$MAEMO_SDK_TARGET_VER" in
6539 MOZ_PLATFORM_MAEMO=5
6543 MOZ_PLATFORM_MAEMO=6
6547 dnl We aren't compiling for Maemo, move on.
6550 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6554 if test $MOZ_PLATFORM_MAEMO; then
6555 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6557 if test -z "$MOZ_ENABLE_DBUS"; then
6558 AC_MSG_ERROR([DBus is required when building for Maemo])
6561 MOZ_GFX_OPTIMIZE_MOBILE=1
6564 if test $MOZ_PLATFORM_MAEMO = 5; then
6565 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6566 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6567 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6568 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6569 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6571 AC_SUBST(XCOMPOSITE_LIBS)
6573 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6574 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6575 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6576 if test -z "$_LIB_FOUND"; then
6577 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6581 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6582 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6583 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6584 if test -z "$_LIB_FOUND"; then
6585 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6588 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6589 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6590 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6591 if test -z "$_LIB_FOUND"; then
6592 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6596 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6597 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6600 dnl ========================================================
6601 dnl = faststripe theme
6602 dnl ========================================================
6603 MOZ_ARG_ENABLE_BOOL(faststripe,
6604 [ --enable-faststripe Use faststripe theme],
6605 MOZ_THEME_FASTSTRIPE=1,
6606 MOZ_THEME_FASTSTRIPE= )
6607 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6609 dnl ========================================================
6611 dnl = Feature options that require extra sources to be pulled
6613 dnl ========================================================
6614 dnl MOZ_ARG_HEADER(Features that require extra sources)
6616 dnl ========================================================
6618 dnl = Debugging Options
6620 dnl ========================================================
6621 MOZ_ARG_HEADER(Debugging and Optimizations)
6623 dnl ========================================================
6624 dnl = Disable building with debug info.
6625 dnl = Debugging is OFF by default
6626 dnl ========================================================
6627 if test -z "$MOZ_DEBUG_FLAGS"
6631 if test "$GNU_CC"; then
6632 GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6633 case "$GCC_VERSION" in
6638 MOZ_DEBUG_FLAGS="-g"
6642 MOZ_DEBUG_FLAGS="-g"
6646 MOZ_DEBUG_FLAGS="-g"
6651 MOZ_ARG_ENABLE_STRING(debug,
6652 [ --enable-debug[=DBG] Enable building with developer debug info
6653 (using compiler flags DBG)],
6654 [ if test "$enableval" != "no"; then
6656 if test -n "$enableval" -a "$enableval" != "yes"; then
6657 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6658 _MOZ_DEBUG_FLAGS_SET=1
6665 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6666 case "${target_os}" in
6668 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6670 msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6671 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6674 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6677 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6679 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6681 if test -n "$MOZ_DEBUG"; then
6682 AC_MSG_CHECKING([for valid debug flags])
6683 _SAVE_CFLAGS=$CFLAGS
6684 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6685 AC_TRY_COMPILE([#include <stdio.h>],
6686 [printf("Hello World\n");],
6689 AC_MSG_RESULT([$_results])
6690 if test "$_results" = "no"; then
6691 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6693 CFLAGS=$_SAVE_CFLAGS
6696 dnl ========================================================
6697 dnl enable mobile optimizations
6698 dnl ========================================================
6699 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6700 [ --enable-mobile-optimize Enable mobile optimizations],
6701 MOZ_GFX_OPTIMIZE_MOBILE=1)
6703 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6705 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6706 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6709 dnl ========================================================
6710 dnl = Enable code optimization. ON by default.
6711 dnl ========================================================
6712 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6713 MOZ_OPTIMIZE_FLAGS="-O"
6716 MOZ_ARG_ENABLE_STRING(optimize,
6717 [ --disable-optimize Disable compiler optimization
6718 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6719 [ if test "$enableval" != "no"; then
6721 if test -n "$enableval" && test "$enableval" != "yes"; then
6722 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6727 fi ], MOZ_OPTIMIZE=1)
6729 if test "$COMPILE_ENVIRONMENT"; then
6730 if test -n "$MOZ_OPTIMIZE"; then
6731 AC_MSG_CHECKING([for valid optimization flags])
6732 _SAVE_CFLAGS=$CFLAGS
6733 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6734 AC_TRY_COMPILE([#include <stdio.h>],
6735 [printf("Hello World\n");],
6738 AC_MSG_RESULT([$_results])
6739 if test "$_results" = "no"; then
6740 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6742 CFLAGS=$_SAVE_CFLAGS
6744 fi # COMPILE_ENVIRONMENT
6746 AC_SUBST(MOZ_OPTIMIZE)
6747 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6748 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6749 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6751 dnl ========================================================
6752 dnl = (Deprecated) generation of debugger info for specific modules
6753 dnl ========================================================
6754 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6755 [ --enable-debugger-info-modules
6756 Enable/disable debugger info for specific modules],
6757 [ if test "$enableval" != "no"; then
6758 AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
6762 dnl ========================================================
6763 dnl = Enable generation of debug symbols
6764 dnl ========================================================
6765 MOZ_ARG_ENABLE_STRING(debug-symbols,
6766 [ --enable-debug-symbols[=DBG] Enable debugging symbols
6767 (using compiler flags DBG)],
6768 [ if test "$enableval" != "no"; then
6770 if test -n "$enableval" -a "$enableval" != "yes"; then
6771 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6772 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6774 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6779 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6780 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6781 export MOZ_DEBUG_SYMBOLS
6784 dnl ========================================================
6785 dnl Disable runtime logging checks
6786 dnl ========================================================
6787 MOZ_ARG_DISABLE_BOOL(logging,
6788 [ --disable-logging Disable logging facilities],
6789 NS_DISABLE_LOGGING=1,
6790 NS_DISABLE_LOGGING= )
6791 if test "$NS_DISABLE_LOGGING"; then
6792 AC_DEFINE(NS_DISABLE_LOGGING)
6794 AC_DEFINE(MOZ_LOGGING)
6797 dnl ========================================================
6798 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6799 dnl ========================================================
6800 _ENABLE_LOGREFCNT=42
6801 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6802 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6803 _ENABLE_LOGREFCNT=1,
6804 _ENABLE_LOGREFCNT= )
6805 if test "$_ENABLE_LOGREFCNT" = "1"; then
6806 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6807 elif test -z "$_ENABLE_LOGREFCNT"; then
6808 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6811 dnl ========================================================
6812 dnl = Enable trace malloc
6813 dnl ========================================================
6814 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6815 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6816 [ --enable-trace-malloc Enable malloc tracing],
6819 if test "$NS_TRACE_MALLOC"; then
6820 # Please, Mr. Linker Man, don't take away our symbol names
6821 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6823 AC_DEFINE(NS_TRACE_MALLOC)
6825 AC_SUBST(NS_TRACE_MALLOC)
6827 dnl ========================================================
6828 dnl = Enable jemalloc
6829 dnl ========================================================
6830 MOZ_ARG_ENABLE_BOOL(jemalloc,
6831 [ --enable-jemalloc Replace memory allocator with jemalloc],
6835 if test "$NS_TRACE_MALLOC"; then
6839 if test "$MOZ_MEMORY"; then
6841 dnl Don't try to run compiler tests on Windows
6842 if test "$OS_ARCH" = "WINNT"; then
6843 if test -z "$HAVE_64BIT_OS"; then
6844 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6846 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6849 AC_CHECK_SIZEOF([int *], [4])
6850 case "${ac_cv_sizeof_int_p}" in
6852 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6855 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6858 AC_MSG_ERROR([Unexpected pointer size])
6863 AC_DEFINE(MOZ_MEMORY)
6864 if test "x$MOZ_DEBUG" = "x1"; then
6865 AC_DEFINE(MOZ_MEMORY_DEBUG)
6867 dnl The generic feature tests that determine how to compute ncpus are long and
6868 dnl complicated. Therefore, simply define special cpp variables for the
6869 dnl platforms we have special knowledge of.
6870 case "${target_os}" in
6872 AC_DEFINE(MOZ_MEMORY_DARWIN)
6875 AC_DEFINE(MOZ_MEMORY_BSD)
6878 AC_DEFINE(MOZ_MEMORY_LINUX)
6881 AC_DEFINE(MOZ_MEMORY_BSD)
6884 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6886 msvc*|mks*|cygwin*|mingw*)
6887 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6888 dnl This is sort of awful. Will revisit if we add support for more versions
6889 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6890 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6892 if test -z "$WIN32_CRT_SRC_DIR"; then
6893 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6894 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).])
6896 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6900 case "${target_cpu}" in
6902 _WIN32_CRT_CPU=intel
6905 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6909 if test ! -d "$WIN32_CRT_SRC_DIR"; then
6910 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6912 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6913 _objdir_win=`pwd -W`
6914 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
6915 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6916 dnl Also pass this to NSPR/NSS
6917 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6921 AC_DEFINE(MOZ_MEMORY_WINCE)
6922 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6923 if test -z "$WINCE_WINDOWS_MOBILE"; then
6924 AC_DEFINE(MOZ_MEMORY_WINCE6)
6928 AC_DEFINE(MOZ_MEMORY_WINCE)
6929 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6932 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6936 if test "$OS_ARCH" != "Darwin"; then
6937 dnl NB: this must be kept in sync with jemalloc.h
6938 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
6939 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
6940 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
6943 AC_SUBST(MOZ_MEMORY)
6944 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6945 AC_SUBST(WIN32_CRT_SRC_DIR)
6946 dnl Need to set this for make because NSS doesn't have configure
6949 dnl ========================================================
6950 dnl = Use malloc wrapper lib
6951 dnl ========================================================
6952 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6953 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
6957 if test -n "$_WRAP_MALLOC"; then
6958 if test "$GNU_CC"; then
6959 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"
6960 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6964 dnl ========================================================
6965 dnl = Location of malloc wrapper lib
6966 dnl ========================================================
6967 MOZ_ARG_WITH_STRING(wrap-malloc,
6968 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
6969 WRAP_MALLOC_LIB=$withval)
6971 dnl ========================================================
6973 dnl ========================================================
6974 MOZ_ARG_ENABLE_BOOL(tracevis,
6975 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
6978 if test -n "$MOZ_TRACEVIS"; then
6979 AC_DEFINE(MOZ_TRACEVIS)
6982 dnl ========================================================
6984 dnl ========================================================
6985 MOZ_ARG_ENABLE_BOOL(valgrind,
6986 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
6989 if test -n "$MOZ_VALGRIND"; then
6990 AC_CHECK_HEADER([valgrind/valgrind.h], [],
6992 [--enable-valgrind specified but Valgrind is not installed]))
6993 AC_DEFINE(MOZ_VALGRIND)
6996 dnl ========================================================
6998 dnl ========================================================
6999 MOZ_ARG_ENABLE_BOOL(jprof,
7000 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)],
7003 if test -n "$MOZ_JPROF"; then
7004 AC_DEFINE(MOZ_JPROF)
7007 dnl ========================================================
7009 dnl ========================================================
7010 MOZ_ARG_ENABLE_BOOL(shark,
7011 [ --enable-shark Enable shark remote profiling (needs CHUD framework)],
7014 if test -n "$MOZ_SHARK"; then
7015 AC_DEFINE(MOZ_SHARK)
7018 dnl ========================================================
7020 dnl ========================================================
7021 MOZ_ARG_ENABLE_BOOL(callgrind,
7022 [ --enable-callgrind Enable callgrind profiling],
7025 if test -n "$MOZ_CALLGRIND"; then
7026 AC_DEFINE(MOZ_CALLGRIND)
7029 dnl ========================================================
7031 dnl ========================================================
7032 MOZ_ARG_ENABLE_BOOL(vtune,
7033 [ --enable-vtune Enable vtune profiling],
7036 if test -n "$MOZ_VTUNE"; then
7037 AC_DEFINE(MOZ_VTUNE)
7040 dnl ========================================================
7041 dnl Zealous JavaScript GC
7042 dnl ========================================================
7043 MOZ_ARG_ENABLE_BOOL(gczeal,
7044 [ --enable-gczeal Enable zealous JavaScript GCing],
7047 if test -n "$JS_GC_ZEAL"; then
7048 AC_DEFINE(JS_GC_ZEAL)
7051 dnl ========================================================
7052 dnl = Enable static checking using gcc-dehydra
7053 dnl ========================================================
7055 MOZ_ARG_WITH_STRING(static-checking,
7056 [ --with-static-checking=path/to/gcc_dehydra.so
7057 Enable static checking of code using GCC-dehydra],
7058 DEHYDRA_PATH=$withval,
7061 if test -n "$DEHYDRA_PATH"; then
7062 if test ! -f "$DEHYDRA_PATH"; then
7063 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7065 AC_DEFINE(NS_STATIC_CHECKING)
7067 AC_SUBST(DEHYDRA_PATH)
7069 dnl ========================================================
7070 dnl = Enable stripping of libs & executables
7071 dnl ========================================================
7072 MOZ_ARG_ENABLE_BOOL(strip,
7073 [ --enable-strip Enable stripping of libs & executables ],
7077 dnl ========================================================
7078 dnl = Enable stripping of libs & executables when packaging
7079 dnl ========================================================
7080 MOZ_ARG_ENABLE_BOOL(install-strip,
7081 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7085 dnl ========================================================
7086 dnl = --enable-elf-dynstr-gc
7087 dnl ========================================================
7088 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7089 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7090 USE_ELF_DYNSTR_GC=1,
7091 USE_ELF_DYNSTR_GC= )
7093 dnl ========================================================
7095 dnl = Profiling and Instrumenting
7097 dnl ========================================================
7098 MOZ_ARG_HEADER(Profiling and Instrumenting)
7100 dnl ========================================================
7101 dnl = Enable timeline service, which provides lightweight
7102 dnl = instrumentation of mozilla for performance measurement.
7103 dnl = Timeline is off by default.
7104 dnl ========================================================
7105 MOZ_ARG_ENABLE_BOOL(timeline,
7106 [ --enable-timeline Enable timeline services ],
7109 if test -n "$MOZ_TIMELINE"; then
7110 AC_DEFINE(MOZ_TIMELINE)
7113 dnl ========================================================
7114 dnl Turn on reflow counting
7115 dnl ========================================================
7116 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7117 [ --enable-reflow-perf Enable reflow performance tracing],
7120 if test -n "$MOZ_REFLOW_PERF"; then
7121 AC_DEFINE(MOZ_REFLOW_PERF)
7124 dnl ========================================================
7125 dnl Enable code size metrics.
7126 dnl ========================================================
7127 MOZ_ARG_ENABLE_BOOL(codesighs,
7128 [ --enable-codesighs Enable code size analysis tools],
7129 _ENABLE_CODESIGHS=1,
7130 _ENABLE_CODESIGHS= )
7131 if test -n "$_ENABLE_CODESIGHS"; then
7132 if test -d $srcdir/tools/codesighs; then
7135 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7139 MOZ_ARG_ENABLE_BOOL(insure,
7140 [ --enable-insure Enable insure++ instrumentation (linux only)],
7143 if test -n "$_ENABLE_INSURE"; then
7147 MOZ_INSURE_EXCLUDE_DIRS="config"
7150 MOZ_ARG_WITH_STRING(insure-dirs,
7151 [ --with-insure-dirs=DIRS
7152 Dirs to instrument with insure ],
7153 MOZ_INSURE_DIRS=$withval )
7155 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
7156 [ --with-insure-exclude-dirs=DIRS
7157 Dirs to not instrument with insure ],
7158 MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
7160 dnl ========================================================
7161 dnl = Support for Quantify (Windows)
7162 dnl ========================================================
7163 MOZ_ARG_ENABLE_BOOL(quantify,
7164 [ --enable-quantify Enable Quantify support (Windows only) ],
7168 dnl ========================================================
7169 dnl = Support for demangling undefined symbols
7170 dnl ========================================================
7171 if test -z "$SKIP_LIBRARY_CHECKS"; then
7174 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7178 # Demangle only for debug or trace-malloc builds
7179 MOZ_DEMANGLE_SYMBOLS=
7180 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7181 MOZ_DEMANGLE_SYMBOLS=1
7182 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7184 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7186 dnl ========================================================
7187 dnl = Support for gcc stack unwinding (from gcc 3.3)
7188 dnl ========================================================
7189 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7190 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7193 dnl ========================================================
7197 dnl ========================================================
7198 MOZ_ARG_HEADER(Misc. Options)
7200 dnl ========================================================
7201 dnl update xterm title
7202 dnl ========================================================
7203 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7204 [ --enable-xterm-updates Update XTERM titles with current command.],
7208 dnl =========================================================
7210 dnl =========================================================
7211 MOZ_ARG_ENABLE_STRING([chrome-format],
7212 [ --enable-chrome-format=jar|flat|both|symlink
7213 Select FORMAT of chrome files (default=jar)],
7214 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7216 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7217 MOZ_CHROME_FILE_FORMAT=jar
7220 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7221 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7222 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7223 test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
7224 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
7227 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7228 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7230 dnl ========================================================
7231 dnl = Define default location for MOZILLA_FIVE_HOME
7232 dnl ========================================================
7233 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7234 [ --with-default-mozilla-five-home
7235 Set the default value for MOZILLA_FIVE_HOME],
7236 [ val=`echo $withval`
7237 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7239 dnl ========================================================
7240 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7241 dnl ========================================================
7242 MOZ_ARG_WITH_STRING(user-appdir,
7243 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7244 [ val=`echo $withval`
7245 if echo "$val" | grep "\/" >/dev/null; then
7246 AC_MSG_ERROR("Homedir must be single relative path.")
7251 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7253 dnl ========================================================
7254 dnl = Doxygen configuration
7255 dnl ========================================================
7256 dnl Use commas to specify multiple dirs to this arg
7257 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7258 MOZ_ARG_WITH_STRING(doc-input-dirs,
7259 [ --with-doc-input-dirs=DIRS
7260 Header/idl dirs to create docs from],
7261 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7262 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7264 dnl Use commas to specify multiple dirs to this arg
7265 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7266 MOZ_ARG_WITH_STRING(doc-include-dirs,
7267 [ --with-doc-include-dirs=DIRS
7268 Include dirs to preprocess doc headers],
7269 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7270 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7272 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7273 MOZ_ARG_WITH_STRING(doc-output-dir,
7274 [ --with-doc-output-dir=DIR
7275 Dir to generate docs into],
7276 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7277 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7279 if test -z "$SKIP_COMPILER_CHECKS"; then
7280 dnl ========================================================
7282 dnl = Compiler Options
7284 dnl ========================================================
7285 MOZ_ARG_HEADER(Compiler Options)
7287 dnl ========================================================
7288 dnl Check for gcc -pipe support
7289 dnl ========================================================
7290 AC_MSG_CHECKING([for gcc -pipe support])
7291 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7292 echo '#include <stdio.h>' > dummy-hello.c
7293 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7294 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7295 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7296 if test $? = 0; then
7301 if test "$_res_as_stdin" = "yes"; then
7302 _SAVE_CFLAGS=$CFLAGS
7303 CFLAGS="$CFLAGS -pipe"
7304 AC_TRY_COMPILE( [ #include <stdio.h> ],
7305 [printf("Hello World\n");],
7306 [_res_gcc_pipe="yes"],
7307 [_res_gcc_pipe="no"] )
7308 CFLAGS=$_SAVE_CFLAGS
7310 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7312 CFLAGS="$CFLAGS -pipe"
7313 CXXFLAGS="$CXXFLAGS -pipe"
7317 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7318 AC_MSG_RESULT([$_res])
7323 dnl pass -Wno-long-long to the compiler
7324 MOZ_ARG_ENABLE_BOOL(long-long-warning,
7325 [ --enable-long-long-warning
7326 Warn about use of non-ANSI long long type],
7327 _IGNORE_LONG_LONG_WARNINGS=,
7328 _IGNORE_LONG_LONG_WARNINGS=1)
7330 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
7331 _SAVE_CFLAGS="$CFLAGS"
7332 CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
7333 AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
7334 AC_TRY_COMPILE([], [return(0);],
7335 [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7336 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
7337 result="yes" ], result="no")
7338 AC_MSG_RESULT([$result])
7339 CFLAGS="$_SAVE_CFLAGS"
7342 dnl ========================================================
7343 dnl Profile guided optimization
7344 dnl ========================================================
7345 dnl Test for profiling options
7346 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7347 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7349 dnl Provide a switch to disable PGO even when called via profiledbuild.
7350 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7351 [ --disable-profile-guided-optimization
7352 Don't build with PGO even if called via make profiledbuild],
7353 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7354 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7356 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7358 _SAVE_CFLAGS="$CFLAGS"
7359 CFLAGS="$CFLAGS -fprofile-generate"
7361 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7362 AC_TRY_COMPILE([], [return 0;],
7363 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7364 result="yes" ], result="no")
7365 AC_MSG_RESULT([$result])
7367 if test $result = "yes"; then
7368 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7369 PROFILE_USE_CFLAGS="-fprofile-use"
7370 PROFILE_USE_LDFLAGS="-fprofile-use"
7372 CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7373 AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7374 AC_TRY_COMPILE([], [return 0;],
7375 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7376 result="yes" ], result="no")
7377 AC_MSG_RESULT([$result])
7378 if test $result = "yes"; then
7379 PROFILE_USE_CFLAGS="-fbranch-probabilities"
7381 # don't really care, this is an old GCC
7382 PROFILE_GEN_LDFLAGS=
7383 PROFILE_USE_LDFLAGS=
7386 CFLAGS="$_SAVE_CFLAGS"
7388 if test -n "$INTEL_CC"; then
7389 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7390 PROFILE_GEN_LDFLAGS=
7391 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7392 PROFILE_USE_LDFLAGS=
7395 dnl Sun Studio on Solaris
7396 if test "$SOLARIS_SUNPRO_CC"; then
7397 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7398 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7399 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7400 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7403 AC_SUBST(PROFILE_GEN_CFLAGS)
7404 AC_SUBST(PROFILE_GEN_LDFLAGS)
7405 AC_SUBST(PROFILE_USE_CFLAGS)
7406 AC_SUBST(PROFILE_USE_LDFLAGS)
7410 dnl ========================================================
7411 dnl Test for -pedantic bustage
7412 dnl ========================================================
7413 MOZ_ARG_DISABLE_BOOL(pedantic,
7414 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7416 if test "$_PEDANTIC"; then
7417 _SAVE_CXXFLAGS=$CXXFLAGS
7418 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7419 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7420 AC_TRY_COMPILE([$configure_static_assert_macros],
7421 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7422 result="no", result="yes" )
7423 AC_MSG_RESULT([$result])
7424 CXXFLAGS="$_SAVE_CXXFLAGS"
7428 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7429 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7432 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7437 dnl ========================================================
7438 dnl Test for correct temporary object destruction order
7439 dnl ========================================================
7440 dnl We want to make sure the compiler follows the C++ spec here as
7441 dnl xpcom and the string classes depend on it (bug 235381).
7442 AC_MSG_CHECKING([for correct temporary object destruction order])
7443 AC_TRY_RUN([ class A {
7444 public: A(int& x) : mValue(x) {}
7446 operator char**() { return 0; }
7447 private: int& mValue;
7449 void func(char **arg) {}
7460 result="yes", result="no", result="maybe")
7461 AC_MSG_RESULT([$result])
7463 if test "$result" = "no"; then
7464 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7467 dnl ========================================================
7468 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7469 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7470 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7471 dnl ========================================================
7472 _SAVE_CXXFLAGS=$CXXFLAGS
7473 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7474 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7475 ac_nscap_nonconst_opeq_bug,
7484 template <class T, class U>
7485 int operator==(const Pointer<T>& rhs, U* lhs)
7487 return rhs.myPtr == lhs;
7490 template <class T, class U>
7491 int operator==(const Pointer<T>& rhs, const U* lhs)
7493 return rhs.myPtr == lhs;
7501 ac_nscap_nonconst_opeq_bug="no",
7502 ac_nscap_nonconst_opeq_bug="yes")])
7503 CXXFLAGS="$_SAVE_CXXFLAGS"
7505 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7506 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7508 fi # SKIP_COMPILER_CHECKS
7510 dnl ========================================================
7512 dnl Should be smarter and check that the compiler does indeed have rtti
7513 dnl ========================================================
7515 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7516 [ --enable-cpp-rtti Enable C++ RTTI ],
7517 [ _MOZ_USE_RTTI=1 ],
7520 if test "$_MOZ_USE_RTTI"; then
7521 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7523 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7526 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7528 dnl ========================================================
7529 dnl C++ exceptions (g++/egcs only - for now)
7530 dnl Should be smarter and check that the compiler does indeed have exceptions
7531 dnl ========================================================
7532 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7533 [ --enable-cpp-exceptions Enable C++ exceptions ],
7534 [ _MOZ_CPP_EXCEPTIONS=1 ],
7535 [ _MOZ_CPP_EXCEPTIONS= ])
7537 if test "$_MOZ_CPP_EXCEPTIONS"; then
7538 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7540 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7543 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7545 # Irix & OSF native compilers do not like exception declarations
7546 # when exceptions are disabled
7547 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7548 AC_DEFINE(CPP_THROW_NEW, [])
7550 AC_DEFINE(CPP_THROW_NEW, [throw()])
7554 dnl ========================================================
7556 dnl = Build depencency options
7558 dnl ========================================================
7559 MOZ_ARG_HEADER(Build dependencies)
7561 dnl ========================================================
7562 dnl = Do not auto generate dependency info
7563 dnl ========================================================
7565 MOZ_ARG_DISABLE_BOOL(auto-deps,
7566 [ --disable-auto-deps Do not automatically generate dependency info],
7570 if test -n "$MOZ_AUTO_DEPS"; then
7571 dnl ========================================================
7572 dnl = Use mkdepend instead of $CC -MD for dependency generation
7573 dnl ========================================================
7575 MOZ_ARG_DISABLE_BOOL(md,
7576 [ --disable-md Do not use compiler-based dependencies ],
7579 [dnl Default is to turn on -MD if using GNU-compatible compilers
7580 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7583 dnl Default is to use -xM if using Sun Studio on Solaris
7584 if test "$SOLARIS_SUNPRO_CC"; then
7587 if test "$_cpp_md_flag"; then
7589 if test "$OS_ARCH" = "OpenVMS"; then
7590 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7592 _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7594 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7595 if test "$SOLARIS_SUNPRO_CC"; then
7600 dnl Don't override this for MSVC
7601 if test -z "$_WIN32_MSVC"; then
7602 _USE_CPP_INCLUDE_FLAG=
7603 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7604 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7609 AC_SUBST(MOZ_AUTO_DEPS)
7610 AC_SUBST(COMPILER_DEPEND)
7614 dnl ========================================================
7616 dnl = Static Build Options
7618 dnl ========================================================
7619 MOZ_ARG_HEADER(Static build options)
7621 MOZ_ARG_ENABLE_BOOL(static,
7622 [ --enable-static Enable building of internal static libs],
7623 BUILD_STATIC_LIBS=1,
7626 MOZ_ARG_ENABLE_BOOL(libxul,
7627 [ --enable-libxul Enable building of libxul],
7628 MOZ_ENABLE_LIBXUL=1,
7631 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7632 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7635 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7636 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7639 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7640 AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7643 AC_SUBST(LIBXUL_LIBS)
7645 if test -n "$MOZ_ENABLE_LIBXUL"; then
7646 XPCOM_LIBS="$LIBXUL_LIBS"
7647 AC_DEFINE(MOZ_ENABLE_LIBXUL)
7649 if test -n "$BUILD_STATIC_LIBS"; then
7650 AC_DEFINE(MOZ_STATIC_BUILD)
7652 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7655 dnl ========================================================
7657 dnl = Standalone module options
7659 dnl ========================================================
7660 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7662 dnl Check for GLib and libIDL.
7663 dnl ========================================================
7664 case "$target_os" in
7665 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7666 SKIP_IDL_CHECK="yes"
7673 if test -z "$COMPILE_ENVIRONMENT"; then
7674 SKIP_IDL_CHECK="yes"
7677 dnl = Allow users to disable libIDL checking for standalone modules
7678 MOZ_ARG_WITHOUT_BOOL(libIDL,
7679 [ --without-libIDL Skip check for libIDL (standalone modules only)],
7680 SKIP_IDL_CHECK="yes")
7682 if test "$SKIP_IDL_CHECK" = "no"
7685 if test "$MACOS_SDK_DIR"; then
7686 dnl xpidl, and therefore libIDL, is only needed on the build host.
7687 dnl Don't build it against the SDK, as that causes problems.
7688 _MACSAVE_CFLAGS="$CFLAGS"
7689 _MACSAVE_LIBS="$LIBS"
7690 _MACSAVE_LDFLAGS="$LDFLAGS"
7691 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7693 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"`
7694 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7695 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7700 if test "$MOZ_ENABLE_GTK2"; then
7701 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7703 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7704 dnl to either libIDL1 or libIDL2.
7705 if test -z "$_LIBIDL_FOUND"; then
7706 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7707 if test -z "$_LIBIDL_FOUND"; then
7708 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7712 dnl If we don't have a libIDL config program & not cross-compiling,
7713 dnl look for orbit-config instead.
7715 if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7716 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7717 if test -n "$ORBIT_CONFIG"; then
7718 AC_MSG_CHECKING([for ORBit libIDL usability])
7719 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7720 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7721 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7722 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7723 LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7724 LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7726 _SAVE_CFLAGS="$CFLAGS"
7728 CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7729 LIBS="$LIBIDL_LIBS $LIBS"
7732 #include <libIDL/IDL.h>
7735 s=strdup(IDL_get_libver_string());
7748 AC_MSG_RESULT($result)
7749 CFLAGS="$_SAVE_CFLAGS"
7753 if test -z "$_LIBIDL_FOUND"; then
7754 AC_MSG_ERROR([libIDL not found.
7755 libIDL $LIBIDL_VERSION or higher is required.])
7757 if test "$MACOS_SDK_DIR"; then
7758 CFLAGS="$_MACSAVE_CFLAGS"
7759 LIBS="$_MACSAVE_LIBS"
7760 LDFLAGS="$_MACSAVE_LDFLAGS"
7761 if test -n "$_MACSAVE_NEXT_ROOT" ; then
7762 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7767 if test -n "$CROSS_COMPILE"; then
7768 if test -z "$HOST_LIBIDL_CONFIG"; then
7769 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7771 if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7772 HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7773 HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7775 HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7776 HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7780 if test -z "$SKIP_PATH_CHECKS"; then
7781 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7782 if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7783 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7785 AM_PATH_GLIB(${GLIB_VERSION})
7790 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7791 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7794 AC_SUBST(LIBIDL_CFLAGS)
7795 AC_SUBST(LIBIDL_LIBS)
7796 AC_SUBST(STATIC_LIBIDL)
7797 AC_SUBST(GLIB_CFLAGS)
7799 AC_SUBST(GLIB_GMODULE_LIBS)
7800 AC_SUBST(HOST_LIBIDL_CONFIG)
7801 AC_SUBST(HOST_LIBIDL_CFLAGS)
7802 AC_SUBST(HOST_LIBIDL_LIBS)
7804 dnl ========================================================
7806 dnl ========================================================
7807 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7810 MOZ_ARG_ENABLE_BOOL(system-cairo,
7811 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7815 # Check for headers defining standard int types.
7816 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7818 if test "$MOZ_TREE_CAIRO"; then
7819 AC_DEFINE(MOZ_TREE_CAIRO)
7821 # For now we assume that we will have a uint64_t available through
7822 # one of the above headers or mozstdint.h.
7823 AC_DEFINE(HAVE_UINT64_T)
7825 # Define macros for cairo-features.h
7826 if test "$MOZ_X11"; then
7827 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7828 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7829 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7830 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7831 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7832 MOZ_ENABLE_CAIRO_FT=1
7833 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7835 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7836 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7838 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7839 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7840 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7841 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7843 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7844 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7845 if test -z "$WINCE"; then
7846 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7847 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
7848 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7849 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7850 MOZ_ENABLE_D2D_SURFACE=1
7851 MOZ_ENABLE_DWRITE_FONT=1
7853 WIN32_DWRITE_FONT_FEATURE=
7854 WIN32_D2D_SURFACE_FEATURE=
7858 WIN32_DWRITE_FONT_FEATURE=
7859 WIN32_D2D_SURFACE_FEATURE=
7862 AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7863 if test -z "$HAS_DDRAW"; then
7864 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.])
7865 DDRAW_SURFACE_FEATURE=
7867 DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7870 if test -z "$OGLES_SDK_DIR"; then
7871 OGLES_SURFACE_FEATURE=
7874 #include <EGL/egl.h>
7875 #include <EGL/eglext.h>
7876 #include <GLES2/gl2.h>
7877 #include <GLES2/gl2ext.h>
7878 ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7879 if test -z "$HAS_OGLES"; then
7880 AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7881 OGLES_SURFACE_FEATURE=
7883 OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7887 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7889 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7890 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7891 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7892 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7893 MOZ_ENABLE_CAIRO_FT=1
7894 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7895 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7897 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7898 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7899 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7900 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7901 MOZ_ENABLE_CAIRO_FT=1
7903 if test "$USE_FC_FREETYPE"; then
7904 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7906 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7907 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7908 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7909 AC_SUBST(CAIRO_FT_CFLAGS)
7912 if test "$MOZ_DEBUG"; then
7913 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7915 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7918 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7920 AC_SUBST(PS_SURFACE_FEATURE)
7921 AC_SUBST(PDF_SURFACE_FEATURE)
7922 AC_SUBST(SVG_SURFACE_FEATURE)
7923 AC_SUBST(XLIB_SURFACE_FEATURE)
7924 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7925 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7926 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7927 AC_SUBST(XCB_SURFACE_FEATURE)
7928 AC_SUBST(WIN32_SURFACE_FEATURE)
7929 AC_SUBST(DDRAW_SURFACE_FEATURE)
7930 AC_SUBST(OGLES_SURFACE_FEATURE)
7931 AC_SUBST(OS2_SURFACE_FEATURE)
7932 AC_SUBST(BEOS_SURFACE_FEATURE)
7933 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7934 AC_SUBST(FT_FONT_FEATURE)
7935 AC_SUBST(FC_FONT_FEATURE)
7936 AC_SUBST(WIN32_FONT_FEATURE)
7937 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7938 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7939 AC_SUBST(QUARTZ_FONT_FEATURE)
7940 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7941 AC_SUBST(QT_SURFACE_FEATURE)
7943 if test "$_WIN32_MSVC"; then
7944 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7946 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"
7948 if test "$MOZ_X11"; then
7949 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7953 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7954 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7957 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
7958 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7959 MOZ_CAIRO_LIBS=$CAIRO_LIBS
7960 if test "$MOZ_X11"; then
7961 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7962 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7963 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7967 AC_SUBST(MOZ_TREE_CAIRO)
7968 AC_SUBST(MOZ_CAIRO_CFLAGS)
7969 AC_SUBST(MOZ_CAIRO_LIBS)
7972 dnl ========================================================
7974 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7977 dnl ========================================================
7979 dnl ========================================================
7980 MOZ_ARG_DISABLE_BOOL(xul,
7981 [ --disable-xul Disable XUL],
7983 if test "$MOZ_XUL"; then
7986 dnl remove extensions that require XUL
7987 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7992 dnl ========================================================
7993 dnl disable profile locking
7994 dnl do no use this in applications that can have more than
7995 dnl one process accessing the profile directory.
7996 dnl ========================================================
7997 MOZ_ARG_DISABLE_BOOL(profilelocking,
7998 [ --disable-profilelocking Disable profile locking],
7999 MOZ_PROFILELOCKING=,
8000 MOZ_PROFILELOCKING=1 )
8001 if test "$MOZ_PROFILELOCKING"; then
8002 AC_DEFINE(MOZ_PROFILELOCKING)
8005 dnl ========================================================
8006 dnl disable rdf services
8007 dnl ========================================================
8008 MOZ_ARG_DISABLE_BOOL(rdf,
8009 [ --disable-rdf Disable RDF],
8011 if test "$MOZ_RDF"; then
8017 dnl ========================================================
8018 dnl necko configuration options
8019 dnl ========================================================
8022 dnl option to disable various necko protocols
8024 MOZ_ARG_ENABLE_STRING(necko-protocols,
8025 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8026 Enable/disable specific protocol handlers],
8027 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8028 if test "$option" = "yes" || test "$option" = "all"; then
8029 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8030 elif test "$option" = "no" || test "$option" = "none"; then
8032 elif test "$option" = "default"; then
8033 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8034 elif test `echo "$option" | grep -c \^-` != 0; then
8035 option=`echo $option | sed 's/^-//'`
8036 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8038 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8041 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8043 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8044 AC_SUBST(NECKO_PROTOCOLS)
8045 for p in $NECKO_PROTOCOLS; do
8046 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8050 dnl option to disable necko's disk cache
8052 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8053 [ --disable-necko-disk-cache
8054 Disable necko disk cache],
8057 AC_SUBST(NECKO_DISK_CACHE)
8058 if test "$NECKO_DISK_CACHE"; then
8059 AC_DEFINE(NECKO_DISK_CACHE)
8063 dnl option to disable necko's wifi scanner
8065 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8066 [ --disable-necko-wifi Disable necko wifi scanner],
8071 if test "$OS_ARCH" = "OS2"; then
8072 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8075 if test "$NECKO_WIFI" -a \
8076 "$OS_ARCH" != "Linux" -a \
8077 "$OS_ARCH" != "Darwin" -a \
8078 "$OS_ARCH" != "SunOS" -a \
8079 "$OS_ARCH" != "WINNT" -a \
8080 "$OS_ARCH" != "WINCE"; then
8081 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8084 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8086 AC_CHECK_HEADER([iwlib.h])
8087 if test "$ac_cv_header_iwlib_h" != "yes"; then
8088 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])
8092 if test "$NECKO_WIFI"; then
8093 AC_DEFINE(NECKO_WIFI)
8095 AC_SUBST(NECKO_WIFI)
8098 dnl option to minimize size of necko's i/o buffers
8100 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
8101 [ --enable-necko-small-buffers
8102 Minimize size of necko's i/o buffers],
8103 NECKO_SMALL_BUFFERS=1,
8104 NECKO_SMALL_BUFFERS=)
8105 AC_SUBST(NECKO_SMALL_BUFFERS)
8106 if test "$NECKO_SMALL_BUFFERS"; then
8107 AC_DEFINE(NECKO_SMALL_BUFFERS)
8111 dnl option to disable cookies
8113 MOZ_ARG_DISABLE_BOOL(cookies,
8114 [ --disable-cookies Disable cookie support],
8117 AC_SUBST(NECKO_COOKIES)
8118 if test "$NECKO_COOKIES"; then
8119 AC_DEFINE(NECKO_COOKIES)
8123 dnl Build jsctypes on the platforms we can.
8125 AC_SUBST(BUILD_CTYPES)
8126 if test "$OS_ARCH" != "WINCE" -o `echo $OS_TEST | grep -ic arm` != 1; then
8128 AC_DEFINE(BUILD_CTYPES)
8131 dnl NECKO_ configuration options are not global
8132 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8134 dnl Only build Mork if it's required
8136 if test "$MOZ_MORK"; then
8140 dnl Build the lightweight Mork reader if required
8141 AC_SUBST(MOZ_MORKREADER)
8142 if test "$MOZ_MORKREADER"; then
8143 AC_DEFINE(MOZ_MORKREADER)
8146 dnl ========================================================
8147 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8148 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8151 dnl ========================================================
8153 dnl = Maintainer debug option (no --enable equivalent)
8155 dnl ========================================================
8160 AC_SUBST(AR_EXTRACT)
8164 AC_SUBST(AS_DASH_C_FLAG)
8172 AC_SUBST(NS_USE_NATIVE)
8173 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8174 AC_SUBST(MOZ_UPDATE_XTERM)
8176 AC_SUBST(MOZ_PLATFORM_MAEMO)
8177 AC_SUBST(MOZ_AUTH_EXTENSION)
8178 AC_SUBST(MOZ_MATHML)
8179 AC_SUBST(MOZ_PERMISSIONS)
8181 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8182 AC_SUBST(MOZ_PREF_EXTENSIONS)
8185 AC_SUBST(MOZ_XSLT_STANDALONE)
8186 AC_SUBST(MOZ_JS_LIBS)
8189 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8190 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8191 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8192 AC_SUBST(MOZ_DEBUG_FLAGS)
8193 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8194 AC_SUBST(WARNINGS_AS_ERRORS)
8195 AC_SUBST(MOZ_EXTENSIONS)
8196 AC_SUBST(MOZ_IMG_DECODERS)
8197 AC_SUBST(MOZ_IMG_ENCODERS)
8198 AC_SUBST(MOZ_JSDEBUGGER)
8199 AC_SUBST(MOZ_PLUGINS)
8200 AC_SUBST(MOZ_LOG_REFCNT)
8204 AC_SUBST(MOZ_CALLGRIND)
8206 AC_SUBST(MOZ_XPCTOOLS)
8207 AC_SUBST(MOZ_JSLOADER)
8208 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8209 AC_SUBST(MOZ_INSURE)
8210 AC_SUBST(MOZ_INSURE_DIRS)
8211 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
8212 AC_SUBST(MOZ_QUANTIFY)
8213 AC_SUBST(MOZ_INSURIFYING)
8215 AC_SUBST(MOZ_PLACES)
8216 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8217 AC_SUBST(MOZ_STORAGE)
8218 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8220 AC_SUBST(NS_PRINTING)
8223 AC_SUBST(MOZ_JAVAXPCOM)
8224 AC_SUBST(JAVA_INCLUDE_PATH)
8229 AC_SUBST(MOZ_PROFILELOCKING)
8232 AC_SUBST(MOZ_XIE_LIBS)
8233 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8235 AC_SUBST(BUILD_STATIC_LIBS)
8236 AC_SUBST(MOZ_ENABLE_LIBXUL)
8237 AC_SUBST(ENABLE_TESTS)
8239 AC_SUBST(MOZ_UNIVERSALCHARDET)
8240 AC_SUBST(ACCESSIBILITY)
8241 AC_SUBST(MOZ_XPINSTALL)
8242 AC_SUBST(MOZ_VIEW_SOURCE)
8243 AC_SUBST(MOZ_SPELLCHECK)
8244 AC_SUBST(MOZ_XPFE_COMPONENTS)
8245 AC_SUBST(MOZ_USER_DIR)
8246 AC_SUBST(MOZ_CRASHREPORTER)
8248 AC_SUBST(ENABLE_STRIP)
8249 AC_SUBST(PKG_SKIP_STRIP)
8250 AC_SUBST(USE_ELF_DYNSTR_GC)
8251 AC_SUBST(INCREMENTAL_LINKER)
8252 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8253 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8255 AC_SUBST(MOZ_FIX_LINK_PATHS)
8256 AC_SUBST(XPCOM_LIBS)
8257 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8258 AC_SUBST(XPCOM_GLUE_LDOPTS)
8259 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8261 AC_SUBST(USE_DEPENDENT_LIBS)
8263 AC_SUBST(MOZ_BUILD_ROOT)
8264 AC_SUBST(MOZ_OS2_TOOLS)
8265 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8267 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8268 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8269 AC_SUBST(MOZ_TIMELINE)
8270 AC_SUBST(OGLES_SDK_DIR)
8272 AC_SUBST(MOZ_APP_NAME)
8273 AC_SUBST(MOZ_APP_DISPLAYNAME)
8274 AC_SUBST(MOZ_APP_VERSION)
8275 AC_SUBST(MOZ_APP_UA_EXTRA)
8276 AC_SUBST(FIREFOX_VERSION)
8278 AC_SUBST(MOZ_PKG_SPECIAL)
8280 AC_SUBST(MOZILLA_OFFICIAL)
8283 AC_SUBST(MOZ_MAPINFO)
8284 AC_SUBST(MOZ_BROWSE_INFO)
8285 AC_SUBST(MOZ_TOOLS_DIR)
8286 AC_SUBST(CYGWIN_WRAPPER)
8288 AC_SUBST(WIN32_REDIST_DIR)
8292 AC_SUBST(WINCE_SDK_DIR)
8293 AC_SUBST(WINCE_WINDOWS_MOBILE)
8295 dnl Echo the CFLAGS to remove extra whitespace.
8302 $_MOZ_EXCEPTIONS_FLAGS \
8303 $_WARNINGS_CXXFLAGS \
8306 COMPILE_CFLAGS=`echo \
8311 COMPILE_CXXFLAGS=`echo \
8312 $_DEFINES_CXXFLAGS \
8316 AC_SUBST(SYSTEM_MAKEDEPEND)
8317 AC_SUBST(SYSTEM_LIBXUL)
8318 AC_SUBST(SYSTEM_JPEG)
8319 AC_SUBST(SYSTEM_PNG)
8320 AC_SUBST(SYSTEM_ZLIB)
8321 AC_SUBST(SYSTEM_BZ2)
8323 AC_SUBST(JPEG_CFLAGS)
8325 AC_SUBST(ZLIB_CFLAGS)
8327 AC_SUBST(BZ2_CFLAGS)
8329 AC_SUBST(PNG_CFLAGS)
8332 AC_SUBST(MOZ_JPEG_CFLAGS)
8333 AC_SUBST(MOZ_JPEG_LIBS)
8334 AC_SUBST(MOZ_ZLIB_CFLAGS)
8335 AC_SUBST(MOZ_ZLIB_LIBS)
8336 AC_SUBST(MOZ_BZ2_CFLAGS)
8337 AC_SUBST(MOZ_BZ2_LIBS)
8338 AC_SUBST(MOZ_PNG_CFLAGS)
8339 AC_SUBST(MOZ_PNG_LIBS)
8341 AC_SUBST(NSPR_CFLAGS)
8343 AC_SUBST(MOZ_NATIVE_NSPR)
8345 AC_SUBST(NSS_CFLAGS)
8347 AC_SUBST(NSS_DEP_LIBS)
8348 AC_SUBST(MOZ_NATIVE_NSS)
8349 AC_SUBST(NSS_DISABLE_DBM)
8354 AC_SUBST(COMPILE_CFLAGS)
8355 AC_SUBST(COMPILE_CXXFLAGS)
8358 AC_SUBST(CROSS_COMPILE)
8359 AC_SUBST(WCHAR_CFLAGS)
8363 AC_SUBST(HOST_CFLAGS)
8364 AC_SUBST(HOST_CXXFLAGS)
8365 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8367 AC_SUBST(HOST_AR_FLAGS)
8369 AC_SUBST(HOST_RANLIB)
8370 AC_SUBST(HOST_NSPR_MDCPUCFG)
8371 AC_SUBST(HOST_BIN_SUFFIX)
8372 AC_SUBST(HOST_OS_ARCH)
8374 AC_SUBST(TARGET_CPU)
8375 AC_SUBST(TARGET_VENDOR)
8377 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8378 AC_SUBST(TARGET_MD_ARCH)
8379 AC_SUBST(TARGET_XPCOM_ABI)
8382 AC_SUBST(OS_RELEASE)
8385 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8386 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8388 AC_SUBST(WRAP_MALLOC_CFLAGS)
8389 AC_SUBST(WRAP_MALLOC_LIB)
8392 AC_SUBST(MKSHLIB_FORCE_ALL)
8393 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8394 AC_SUBST(DSO_CFLAGS)
8395 AC_SUBST(DSO_PIC_CFLAGS)
8396 AC_SUBST(DSO_LDOPTS)
8397 AC_SUBST(LIB_PREFIX)
8398 AC_SUBST(DLL_PREFIX)
8399 AC_SUBST(DLL_SUFFIX)
8400 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8401 AC_SUBST(LIB_SUFFIX)
8402 AC_SUBST(OBJ_SUFFIX)
8403 AC_SUBST(BIN_SUFFIX)
8404 AC_SUBST(ASM_SUFFIX)
8405 AC_SUBST(IMPORT_LIB_SUFFIX)
8407 AC_SUBST(CC_VERSION)
8408 AC_SUBST(CXX_VERSION)
8409 AC_SUBST(MSMANIFEST_TOOL)
8410 AC_SUBST(NS_ENABLE_TSF)
8411 AC_SUBST(MOZ_NSS_PATCH)
8413 if test "$USING_HCC"; then
8414 CC='${topsrcdir}/build/hcc'
8416 CXX='${topsrcdir}/build/hcpp'
8417 CXX="$CXX '$_OLDCXX'"
8422 dnl Check for missing components
8423 if test "$COMPILE_ENVIRONMENT"; then
8424 if test "$MOZ_X11"; then
8425 dnl ====================================================
8426 dnl = Check if X headers exist
8427 dnl ====================================================
8428 _SAVE_CFLAGS=$CFLAGS
8429 CFLAGS="$CFLAGS $XCFLAGS"
8433 #include <X11/Xlib.h>
8434 #include <X11/Intrinsic.h>
8438 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8439 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8443 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8444 CFLAGS="$_SAVE_CFLAGS"
8446 if test ! -z "$MISSING_X"; then
8447 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8452 dnl Check for headers, etc. needed by WebGL.
8453 if test -n "$MOZ_WEBGL_GLX"; then
8454 AC_CHECK_HEADER(GL/glx.h)
8455 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8456 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8459 fi # COMPILE_ENVIRONMENT
8461 if test "$USE_FC_FREETYPE"; then
8462 if test "$COMPILE_ENVIRONMENT"; then
8463 _SAVE_CPPFLAGS="$CPPFLAGS"
8464 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8465 AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
8466 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8467 CPPFLAGS="$_SAVE_CPPFLAGS"
8469 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8473 dnl Set various defines and substitutions
8474 dnl ========================================================
8476 if test "$OS_ARCH" = "BeOS"; then
8478 elif test "$OS_ARCH" = "Darwin"; then
8480 AC_DEFINE(UNIX_ASYNC_DNS)
8481 elif test "$OS_ARCH" = "OpenVMS"; then
8483 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8485 AC_DEFINE(UNIX_ASYNC_DNS)
8488 if test "$MOZ_DEBUG"; then
8489 AC_DEFINE(MOZ_REFLOW_PERF)
8490 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8493 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8494 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8495 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8496 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8497 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8498 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8499 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8500 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8501 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8504 dnl ========================================================
8505 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8506 dnl ========================================================
8509 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8512 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8513 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8514 CC="\$(CYGWIN_WRAPPER) $CC"
8515 CXX="\$(CYGWIN_WRAPPER) $CXX"
8516 CPP="\$(CYGWIN_WRAPPER) $CPP"
8517 LD="\$(CYGWIN_WRAPPER) $LD"
8518 AS="\$(CYGWIN_WRAPPER) $AS"
8519 RC="\$(CYGWIN_WRAPPER) $RC"
8520 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8521 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8522 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8526 AC_SUBST(CYGDRIVE_MOUNT)
8527 AC_SUBST(WIN_TOP_SRC)
8529 AC_SUBST(MOZILLA_VERSION)
8531 AC_SUBST(ac_configure_args)
8533 dnl Spit out some output
8534 dnl ========================================================
8536 dnl The following defines are used by xpcom
8537 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8539 HAVE_CPP_2BYTE_WCHAR_T
8540 HAVE_CPP_ACCESS_CHANGING_USING
8541 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8544 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8546 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8547 HAVE_CPP_NAMESPACE_STD
8549 HAVE_CPP_PARTIAL_SPECIALIZATION
8550 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8552 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8554 NEED_CPP_UNUSED_IMPLEMENTATIONS
8558 HAVE_ICONV_WITH_CONST_INPUT
8566 netwerk/necko-config.h
8567 xpcom/xpcom-config.h
8568 xpcom/xpcom-private.h
8571 # Save the defines header file before autoconf removes it.
8572 # (Do not add AC_DEFINE calls after this line.)
8573 _CONFIG_TMP=confdefs-tmp.h
8574 _CONFIG_DEFS_H=mozilla-config.h
8576 cat > $_CONFIG_TMP <<\EOF
8577 /* List of defines generated by configure. Included with preprocessor flag,
8578 * -include, to avoid long list of -D defines on the compile command-line.
8582 #ifndef _MOZILLA_CONFIG_H_
8583 #define _MOZILLA_CONFIG_H_
8586 _EGREP_PATTERN='^#define ('
8587 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8588 for f in $_NON_GLOBAL_ACDEFINES; do
8589 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8592 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8594 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8596 cat >> $_CONFIG_TMP <<\EOF
8598 #endif /* _MOZILLA_CONFIG_H_ */
8602 # Only write mozilla-config.h when something changes (or it doesn't exist)
8603 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8606 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8607 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8609 echo ==== $_CONFIG_DEFS_H =================================
8613 dnl Probably shouldn't call this manually but we always want the output of DEFS
8614 rm -f confdefs.h.save
8615 mv confdefs.h confdefs.h.save
8616 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8617 AC_OUTPUT_MAKE_DEFS()
8619 AC_SUBST(MOZ_DEFINES)
8621 mv confdefs.h.save confdefs.h
8623 dnl Load the list of Makefiles to generate.
8624 dnl To add new Makefiles, edit allmakefiles.sh.
8625 dnl allmakefiles.sh sets the variable, MAKEFILES.
8626 . ${srcdir}/allmakefiles.sh
8628 dnl Run a perl script to quickly create the makefiles.
8629 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8630 dnl for the files it cannot handle correctly. This way, config.status
8631 dnl will handle these files.
8632 dnl If it fails, nothing is set and config.status will run as usual.
8634 dnl This does not change the $MAKEFILES variable.
8636 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8638 if test -z "${AS_PERL}"; then
8639 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8641 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8646 echo $MAKEFILES > unallmakefiles
8648 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8650 AC_OUTPUT($MAKEFILES)
8652 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8653 if test "$CAIRO_FEATURES_H"; then
8654 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8655 echo "$CAIRO_FEATURES_H is unchanged"
8656 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8658 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8662 dnl ========================================================
8663 dnl = Setup a nice relatively clean build environment for
8664 dnl = sub-configures.
8665 dnl ========================================================
8668 CFLAGS="$_SUBDIR_CFLAGS"
8669 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8670 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8671 LDFLAGS="$_SUBDIR_LDFLAGS"
8672 HOST_CC="$_SUBDIR_HOST_CC"
8673 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8674 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8680 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8681 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8683 if test -z "$MOZ_NATIVE_NSPR"; then
8684 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8685 if test -z "$MOZ_DEBUG"; then
8686 ac_configure_args="$ac_configure_args --disable-debug"
8688 if test "$MOZ_OPTIMIZE" = "1"; then
8689 ac_configure_args="$ac_configure_args --enable-optimize"
8691 if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8692 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8694 if test -n "$HAVE_64BIT_OS"; then
8695 ac_configure_args="$ac_configure_args --enable-64bit"
8697 if test -n "$USE_ARM_KUSER"; then
8698 ac_configure_args="$ac_configure_args --with-arm-kuser"
8700 AC_OUTPUT_SUBDIRS(nsprpub)
8701 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8704 if test -z "$MOZ_NATIVE_NSPR"; then
8705 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8706 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8707 if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8708 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8709 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8710 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8711 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8713 rm -f config/autoconf.mk.bak
8716 # Run the SpiderMonkey 'configure' script.
8717 dist=$MOZ_BUILD_ROOT/dist
8718 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8719 ac_configure_args="$ac_configure_args --enable-threadsafe"
8720 if test -z "$MOZ_NATIVE_NSPR"; then
8721 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8722 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8724 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8725 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8726 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8727 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8728 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8729 if test "$MOZ_MEMORY"; then
8730 ac_configure_args="$ac_configure_args --enable-jemalloc"
8731 if test -n "$MOZ_MEMORY_LDFLAGS"; then
8732 export MOZ_MEMORY_LDFLAGS
8735 AC_OUTPUT_SUBDIRS(js/src)
8736 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8738 # Build jsctypes on the platforms we can.
8739 if test "$BUILD_CTYPES"; then
8740 # Run the libffi 'configure' script.
8741 ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8742 if test "$MOZ_DEBUG"; then
8743 ac_configure_args="$ac_configure_args --enable-debug"
8745 if test "$DSO_PIC_CFLAGS"; then
8746 ac_configure_args="$ac_configure_args --with-pic"
8748 if test "$CROSS_COMPILE"; then
8751 ac_configure_args="$ac_configure_args --build=$build --host=${target_cpu}-${target_os} HOST_CC=\"$HOST_CC\" CC=\"$CC\""
8754 ac_configure_args="$ac_configure_args --build=$build --host=$target HOST_CC=\"$HOST_CC\" CC=\"$CC\""
8758 if test "$_MSC_VER"; then
8759 # Use a wrapper script for cl and ml that looks more like gcc.
8760 # autotools can't quite handle an MSVC build environment yet.
8761 ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe"
8762 case "${target_cpu}" in
8764 # Need target since MSYS tools into mozilla-build may be 32bit
8765 ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/ctypes/libffi/msvcc.sh -m64\" --build=$build --host=$target"
8768 ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/ctypes/libffi/msvcc.sh"
8772 if test "$SOLARIS_SUNPRO_CC"; then
8773 # Always use gcc for libffi on Solaris
8774 ac_configure_args="$ac_configure_args CC=gcc"
8777 # Use a separate cache file for libffi, since it does things differently
8778 # from our configure.
8779 old_cache_file=$cache_file
8780 cache_file=js/ctypes/libffi/config.cache
8781 AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8782 cache_file=$old_cache_file
8783 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8786 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8788 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8789 dnl Needs to be at the end to respect possible changes from NSPR configure
8790 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8791 echo "config/autoconf.mk is unchanged"
8792 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8794 rm -f config/autoconf.mk.orig 2> /dev/null