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>
46 dnl Alternatively, the contents of this file may be used under the terms of
47 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
48 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
49 dnl in which case the provisions of the GPL or the LGPL are applicable instead
50 dnl of those above. If you wish to allow use of your version of this file only
51 dnl under the terms of either the GPL or the LGPL, and not to allow others to
52 dnl use your version of this file under the terms of the MPL, indicate your
53 dnl decision by deleting the provisions above and replace them with the notice
54 dnl and other provisions required by the GPL or the LGPL. If you do not delete
55 dnl the provisions above, a recipient may use your version of this file under
56 dnl the terms of any one of the MPL, the GPL or the LGPL.
58 dnl ***** END LICENSE BLOCK *****
60 dnl Process this file with autoconf to produce a configure script.
61 dnl ========================================================
64 AC_INIT(config/config.mk)
65 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
67 TARGET_CPU="${target_cpu}"
68 TARGET_VENDOR="${target_vendor}"
69 TARGET_OS="${target_os}"
72 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
73 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
78 dnl = Don't change the following two lines. Doing so breaks:
80 dnl = CFLAGS="-foo" ./configure
82 dnl ========================================================
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
125 WINDRES_VERSION=2.14.90
128 GNOMEUI_VERSION=2.2.0
132 STARTUP_NOTIFICATION_VERSION=0.8
134 SQLITE_VERSION=3.6.16
135 LIBNOTIFY_VERSION=0.4
139 dnl Set various checks
140 dnl ========================================================
144 dnl Initialize the Pthread test variables early so they can be
145 dnl overridden by each platform.
146 dnl ========================================================
150 dnl Do not allow a separate objdir build if a srcdir build exists.
151 dnl ==============================================================
152 _topsrcdir=`cd \`dirname $0\`; pwd`
155 if test "$_topsrcdir" != "$_objdir"
157 # Check for a couple representative files in the source tree
159 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
160 if test -f $file; then
161 _conflict_files="$_conflict_files $file"
164 if test "$_conflict_files"; then
166 echo "* Your source tree contains these files:"
167 for file in $_conflict_files; do
171 * This indicates that you previously built in the source tree.
172 * A source tree build can confuse the separate objdir build.
174 * To clean up the source tree:
185 dnl Default to MSVC for win32
186 dnl ==============================================================
187 if test -z "$CROSS_COMPILE"; then
189 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
190 if test -z "$CC"; then CC=cl; fi
191 if test -z "$CXX"; then CXX=cl; fi
192 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
193 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
194 if test -z "$LD"; then LD=link; fi
195 if test -z "$AS"; then AS=ml; fi
196 if test -z "$MIDL"; then MIDL=midl; fi
201 COMPILE_ENVIRONMENT=1
202 MOZ_ARG_ENABLE_BOOL(compile-environment,
203 [ --disable-compile-environment
204 Disable compiler/library checks.],
205 COMPILE_ENVIRONMENT=1,
206 COMPILE_ENVIRONMENT= )
207 AC_SUBST(COMPILE_ENVIRONMENT)
209 MOZ_ARG_WITH_STRING(l10n-base,
210 [ --with-l10n-base=DIR path to l10n repositories],
211 L10NBASEDIR=$withval)
212 if test ! -z "$L10NBASEDIR"; then
213 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
214 AC_MSG_ERROR([--with-l10n-base must specify a path])
215 elif test -d "$L10NBASEDIR"; then
216 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
218 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
221 AC_SUBST(L10NBASEDIR)
223 dnl Check for Perl first -- needed for win32 SDK checks
224 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
225 if test -z "$PERL" || test "$PERL" = ":"; then
226 AC_MSG_ERROR([perl not found in \$PATH])
229 dnl ========================================================
230 dnl Checks for compilers.
231 dnl ========================================================
232 dnl Set CROSS_COMPILE in the environment when running configure
233 dnl to use the cross-compile setup for now
234 dnl ========================================================
236 if test "$COMPILE_ENVIRONMENT"; then
238 dnl Do some special WinCE toolchain stuff
242 MOZ_ARG_WITH_STRING(wince-sdk,
243 [ --with-wince-sdk=WINCE_SDK_DIR
244 The path to the Windows CE SDK],
245 WINCE_SDK_DIR=$withval)
247 MOZ_ARG_WITH_STRING(ogles-sdk,
248 [ --with-ogles-sdk=OGLES_SDK_DIR
249 The path to the OGLES SDK],
250 OGLES_SDK_DIR=$withval)
252 dnl Default to Windows Mobile components enabled
253 WINCE_WINDOWS_MOBILE=1
255 MOZ_ARG_DISABLE_BOOL(windows-mobile-components,
256 [ --disable-windows-mobile-components
257 Disable Windows Mobile specific components from CE build],
258 WINCE_WINDOWS_MOBILE=,
259 WINCE_WINDOWS_MOBILE=1)
261 if test "$WINCE_WINDOWS_MOBILE"; then
262 AC_DEFINE(WINCE_WINDOWS_MOBILE)
269 echo -----------------------------------------------------------------------------
270 echo Building Windows CE Shunt Library and Tool Chain
278 make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" TOPSRCDIR="$_topsrcdir" OBJDIR="$_pwdw" -C $srcdir/build/wince/tools
280 CC="$_pwd/dist/sdk/bin/arm-wince-gcc"
281 CXX="$_pwd/dist/sdk/bin/arm-wince-gcc"
282 CPP="$_pwd/dist/sdk/bin/arm-wince-gcc -E -nologo"
283 CXXCPP="$_pwd/dist/sdk/bin/arm-wince-gcc -TP -E -nologo"
284 LD="$_pwd/dist/sdk/bin/arm-wince-link"
285 AR="$_pwd/dist/sdk/bin/arm-wince-lib"
286 AS="$_pwd/dist/sdk/bin/arm-wince-as"
287 RC="$_pwd/dist/sdk/bin/arm-wince-res"
290 echo -----------------------------------------------------------------------------
295 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
296 echo "cross compiling from $host to $target"
300 _SAVE_CFLAGS="$CFLAGS"
301 _SAVE_LDFLAGS="$LDFLAGS"
303 AC_MSG_CHECKING([for host c compiler])
304 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
305 if test -z "$HOST_CC"; then
306 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
308 AC_MSG_RESULT([$HOST_CC])
309 AC_MSG_CHECKING([for host c++ compiler])
310 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
311 if test -z "$HOST_CXX"; then
312 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
314 AC_MSG_RESULT([$HOST_CXX])
316 if test -z "$HOST_CFLAGS"; then
317 HOST_CFLAGS="$CFLAGS"
319 if test -z "$HOST_CXXFLAGS"; then
320 HOST_CXXFLAGS="$CXXFLAGS"
322 if test -z "$HOST_LDFLAGS"; then
323 HOST_LDFLAGS="$LDFLAGS"
325 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
326 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
328 CFLAGS="$HOST_CFLAGS"
329 LDFLAGS="$HOST_LDFLAGS"
331 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
332 AC_TRY_COMPILE([], [return(0);],
333 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
334 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
337 CFLAGS="$HOST_CXXFLAGS"
339 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
340 AC_TRY_COMPILE([], [return(0);],
341 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
342 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
346 LDFLAGS=$_SAVE_LDFLAGS
348 case "$build:$target" in
349 powerpc-apple-darwin8*:i?86-apple-darwin*)
350 dnl The Darwin cross compiler doesn't necessarily point itself at a
351 dnl root that has libraries for the proper architecture, it defaults
352 dnl to the system root. The libraries in the system root on current
353 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
354 dnl checks will fail. Fake a working SDK in that case.
356 _SAVE_CXXFLAGS=$CXXLAGS
357 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
358 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
362 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
365 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
369 case "$build:$target" in
370 powerpc-apple-darwin8*:i?86-apple-darwin*)
371 dnl Revert the changes made above. From this point on, the target
372 dnl compiler will never be used without applying the SDK to CFLAGS
373 dnl (see --with-macos-sdk below).
375 CXXFLAGS=$_SAVE_CXXFLAGS
379 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
380 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
381 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
382 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
383 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
384 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
385 AC_DEFINE(CROSS_COMPILE)
390 MOZ_PATH_PROGS(AS, $AS as, $CC)
391 AC_CHECK_PROGS(AR, ar, :)
392 AC_CHECK_PROGS(LD, ld, :)
393 AC_CHECK_PROGS(STRIP, strip, :)
394 AC_CHECK_PROGS(WINDRES, windres, :)
395 if test -z "$HOST_CC"; then
398 if test -z "$HOST_CFLAGS"; then
399 HOST_CFLAGS="$CFLAGS"
401 if test -z "$HOST_CXX"; then
404 if test -z "$HOST_CXXFLAGS"; then
405 HOST_CXXFLAGS="$CXXFLAGS"
407 if test -z "$HOST_LDFLAGS"; then
408 HOST_LDFLAGS="$LDFLAGS"
410 if test -z "$HOST_RANLIB"; then
411 HOST_RANLIB="$RANLIB"
413 if test -z "$HOST_AR"; then
424 if test "$GCC" = "yes"; then
426 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
428 if test "$GXX" = "yes"; then
430 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
432 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
435 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
438 if test "$GNU_CC"; then
439 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
446 if test "$GCC" = yes; then
447 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
452 if test "$GXX" = yes; then
453 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
458 dnl Special win32 checks
459 dnl ========================================================
465 if test -n "$GNU_CC"; then
473 dnl Target the Windows Vista SDK by default
476 MOZ_ARG_WITH_STRING(windows-version,
477 [ --with-windows-version=WINSDK_TARGETVER
478 Highest Windows version to target using this SDK
479 502: Windows Server 2003
482 WINSDK_TARGETVER=$withval)
484 case "$WINSDK_TARGETVER" in
486 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
490 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
495 dnl Vista SDK specific api (deprecated)
496 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
497 [ --disable-vista-sdk-requirements
498 Do not build Vista SDK specific code],
499 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
500 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
501 if test -n "$COMPILE_ENVIRONMENT"; then
502 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
503 AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
504 MOZ_WINSDK_TARGETVER=05020000
507 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
508 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
509 AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
510 # We can't build parental controls either
511 MOZ_DISABLE_PARENTAL_CONTROLS=1
515 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
518 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
519 if test "$GCC" != "yes"; then
520 # Check to see if we are really running in a msvc environemnt
522 AC_CHECK_PROGS(MIDL, midl)
524 # Make sure compilers are valid
525 CFLAGS="$CFLAGS -TC -nologo"
526 CXXFLAGS="$CXXFLAGS -TP -nologo"
529 AC_TRY_COMPILE([#include <stdio.h>],
530 [ printf("Hello World\n"); ],,
531 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
534 AC_TRY_COMPILE([#include <new.h>],
535 [ unsigned *test = new unsigned(42); ],,
536 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
540 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
543 # Determine compiler version
544 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
545 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
546 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
547 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
548 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
549 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
551 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
552 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
554 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
555 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
557 if test "$_CC_MAJOR_VERSION" = "13"; then
559 elif test "$_CC_MAJOR_VERSION" = "14"; then
561 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
562 dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
563 dnl so be very specific here!
564 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
565 if test $_CC_RELEASE -gt 50727; then
567 elif test $_CC_BUILD -ge 762; then
570 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
571 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
572 elif test "$_CC_MAJOR_VERSION" = "15"; then
574 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
575 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
577 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
578 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
580 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
583 _MOZ_RTTI_FLAGS_ON='-GR'
584 _MOZ_RTTI_FLAGS_OFF='-GR-'
585 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
586 _MOZ_EXCEPTIONS_FLAGS_OFF=''
588 if test -n "$WIN32_REDIST_DIR"; then
589 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
593 # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
594 if test "$_CC_SUITE" -ge "8"; then
596 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
599 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
600 if test -n "$MSMT_TOOL"; then
601 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
602 if test -z "$MSMANIFEST_TOOL_VERSION"; then
603 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
608 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
612 # Check linker version
613 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
614 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
615 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
616 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
621 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
622 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
623 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
624 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
625 # Add flags if necessary
626 AC_MSG_CHECKING([for midl flags])
629 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
630 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
631 # MIDL version 7.00.0500 or later has no problem.
632 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
633 AC_MSG_RESULT([need -env win32])
635 AC_MSG_RESULT([none needed])
639 AC_MSG_RESULT([none needed])
643 # Identify which version of the SDK we're building with
644 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
646 AC_CHECK_HEADERS([winsdkver.h])
647 if test "$ac_cv_header_winsdkver_h" = "yes"; then
648 # Get the highest _WIN32_WINNT and NTDDI versions supported
649 # Take the higher of the two
650 # This is done because the Windows 7 beta SDK reports its
651 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
652 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
654 [cat > conftest.h <<EOF
655 #include <winsdkver.h>
656 #include <sdkddkver.h>
658 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
659 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
661 #define WINSDK_MAXVER NTDDI_MAXVER
666 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
669 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
671 # The Vista SDK is the only one to have sdkddkver.h but not
673 AC_CHECK_HEADERS([sdkddkver.h])
674 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
675 MOZ_WINSDK_MAXVER=0x06000000
677 # Assume the Server 2003 Platform SDK
678 MOZ_WINSDK_MAXVER=0x05020000
682 unset _MSVC_VER_FILTER
685 # Check w32api version
686 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
687 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
688 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
689 AC_TRY_COMPILE([#include <w32api.h>],
690 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
691 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
692 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
693 #error "test failed."
695 , [ res=yes ], [ res=no ])
696 AC_MSG_RESULT([$res])
697 if test "$res" != "yes"; then
698 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
700 # Check windres version
701 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
702 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
703 AC_MSG_RESULT([$_WINDRES_VERSION])
704 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
705 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
706 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
707 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
708 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
709 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
710 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
711 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
712 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
713 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
714 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
715 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
717 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
720 # Server 2003 is the highest version supported
721 MOZ_WINSDK_MAXVER=0x05020000
724 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
725 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
726 # Require OS features provided by IE 5.0
727 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
729 # If the maximum version supported by this SDK is lower than the target
731 AC_MSG_CHECKING([for Windows SDK being recent enough])
732 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
736 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.])
739 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
740 # Definitions matching sdkddkver.h
741 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
742 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
743 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
747 dnl Test breaks icc on OS/2 && MSVC
748 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
750 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
754 CC="${srcdir}/build/hcc '$CC'"
755 CXX="${srcdir}/build/hcpp '$CXX'"
762 if test -n "$_WIN32_MSVC"; then
764 SKIP_COMPILER_CHECKS=1
765 SKIP_LIBRARY_CHECKS=1
767 # Since we're skipping compiler and library checks, hard-code
774 AC_DEFINE(HAVE_SETBUF)
775 AC_DEFINE(HAVE_ISATTY)
780 fi # COMPILE_ENVIRONMENT
792 dnl ========================================================
793 dnl Checks for programs.
794 dnl ========================================================
798 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
799 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
800 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
802 AC_MSG_RESULT([$_perl_version])
804 if test "$_perl_res" != 0; then
805 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
809 AC_MSG_CHECKING([for full perl installation])
810 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
812 if test "$_perl_res" != 0; then
814 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
819 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.5 python2.4 python)
820 if test -z "$PYTHON"; then
821 AC_MSG_ERROR([python was not found in \$PATH])
824 if test -z "$COMPILE_ENVIRONMENT"; then
825 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
827 AC_SUBST(NSINSTALL_BIN)
829 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
830 MOZ_PATH_PROG(WHOAMI, whoami, :)
831 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
832 MOZ_PATH_PROG(UNZIP, unzip, :)
833 MOZ_PATH_PROGS(ZIP, zip)
834 if test -z "$ZIP" || test "$ZIP" = ":"; then
835 AC_MSG_ERROR([zip not found in \$PATH])
837 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
838 MOZ_PATH_PROG(XARGS, xargs)
839 if test -z "$XARGS" || test "$XARGS" = ":"; then
840 AC_MSG_ERROR([xargs not found in \$PATH .])
843 if test "$COMPILE_ENVIRONMENT"; then
845 dnl ========================================================
846 dnl = Mac OS X toolchain support
847 dnl ========================================================
851 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
852 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
853 dnl the environment and includedir purposes (when using an SDK, below),
854 dnl but remember the full version number for the libdir (SDK).
856 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
857 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
859 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
860 dnl Bug 280479, but this keeps popping up in bug 292530 too because
861 dnl 4.0.0/4061 is the default compiler in Tiger.
863 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
865 if test "$GCC_BUILD" = "4061" ; then
866 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
867 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
868 from building Mozilla. Upgrade to Xcode 2.1 or later.])
872 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
873 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
874 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
875 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
880 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
882 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
888 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
889 dnl it has moved into /usr/bin.
890 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
894 AC_SUBST(GCC_VERSION)
895 AC_SUBST(XCODEBUILD_VERSION)
896 AC_SUBST(HAS_XCODE_2_1)
898 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
899 dnl that a universal binary is being produced.
900 AC_SUBST(UNIVERSAL_BINARY)
902 dnl ========================================================
903 dnl Check for MacOS deployment target version
904 dnl ========================================================
906 MOZ_ARG_ENABLE_STRING(macos-target,
907 [ --enable-macos-target=VER (default=10.5)
908 Set the minimum MacOS version needed at runtime],
909 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
913 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
914 dnl Use the specified value
915 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
916 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
917 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
918 dnl No value specified on the command line or in the environment,
919 dnl use architecture minimum.
920 export MACOSX_DEPLOYMENT_TARGET=10.5
925 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
927 dnl ========================================================
928 dnl = Mac OS X SDK support
929 dnl ========================================================
932 MOZ_ARG_WITH_STRING(macos-sdk,
933 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
934 MACOS_SDK_DIR=$withval)
936 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
937 dnl NEXT_ROOT will be set and exported only if it's needed.
938 AC_SUBST(MACOS_SDK_DIR)
941 if test "$MACOS_SDK_DIR"; then
942 dnl Sync this section with the ones in NSPR and NSS.
943 dnl Changes to the cross environment here need to be accounted for in
944 dnl the libIDL checks (below) and xpidl build.
946 if test ! -d "$MACOS_SDK_DIR"; then
947 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
948 specify a valid SDK. SDKs are installed when the optional cross-development
949 tools are selected during the Xcode/Developer Tools installation.])
952 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
953 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
954 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
956 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
957 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
959 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
960 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
961 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
963 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
964 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
965 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
966 dnl be ignored and cause warnings when -syslibroot is specified.
967 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
968 dnl the -isysroot it receives, so this is only needed with 4.0.0.
969 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
974 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
976 AC_TRY_COMPILE([#include <new>
977 int main() { return 0; }],
981 AC_MSG_RESULT($result)
983 if test "$result" = "no" ; then
984 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
988 fi # COMPILE_ENVIRONMENT
990 dnl Be sure the make we use is GNU make.
991 dnl on win32, gmake.exe is the generally the wrong version
992 if test -n "$MAKE"; then
993 if test `echo $MAKE | grep -c make.py` != 1; then
999 cygwin*|mingw*|mks*|msvc*)
1000 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1003 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1006 if test "$GMAKE" = ":"; then
1007 AC_MSG_ERROR([GNU make not found])
1011 if test "$COMPILE_ENVIRONMENT"; then
1017 fi # COMPILE_ENVIRONMENT
1019 dnl ========================================================
1020 dnl set the defaults first
1021 dnl ========================================================
1025 AR_EXTRACT='$(AR) x'
1040 MOZ_USER_DIR=".mozilla"
1042 HOST_AR_FLAGS='$(AR_FLAGS)'
1045 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1047 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1049 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1051 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1053 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1054 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
1055 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1056 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
1057 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1058 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1059 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1063 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1065 USE_DEPENDENT_LIBS=1
1067 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1069 MOZ_ENABLE_POSTSCRIPT=1
1071 if test -n "$CROSS_COMPILE"; then
1072 OS_TARGET="${target_os}"
1073 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1075 case "${target_os}" in
1076 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1077 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1078 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1079 mingw*) OS_ARCH=WINNT ;;
1080 wince*) OS_ARCH=WINCE ;;
1081 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1084 OS_TARGET=`uname -s`
1085 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1086 OS_RELEASE=`uname -r`
1089 # Before this used `uname -m` when not cross compiling
1090 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1091 OS_TEST="${target_cpu}"
1095 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1097 #######################################################################
1098 # Master "Core Components" macros for getting the OS target #
1099 #######################################################################
1102 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1103 # cross-compilation.
1107 # Define and override various archtecture-specific variables, including
1116 case "$HOST_OS_ARCH" in
1117 cygwin*|mingw*|mks*|msvc*)
1127 if test -z "$GNU_CC"; then
1128 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1133 if test -z "$GNU_CXX"; then
1134 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1135 SOLARIS_SUNPRO_CXX=1
1138 AC_SUBST(SOLARIS_SUNPRO_CC)
1139 AC_SUBST(SOLARIS_SUNPRO_CXX)
1151 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1154 HOST_OS_ARCH=UNIXWARE
1166 HOST_OS_ARCH=OpenVMS
1176 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1180 HOST_OS_ARCH=UNIXWARE
1190 # If uname -s returns "Windows_NT", we assume that we are using
1191 # the uname.exe in MKS toolkit.
1193 # The -r option of MKS uname only returns the major version number.
1194 # So we need to use its -v option to get the minor version number.
1195 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1199 OS_MINOR_RELEASE=`uname -v`
1200 if test "$OS_MINOR_RELEASE" = "00"; then
1203 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1205 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1207 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1208 # the uname.exe in the Cygwin tools.
1209 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1210 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1211 # the uname.exe in the GNU-Win32 tools.
1212 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1213 # the uname.exe in the MSYS tools.
1215 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1220 OS_RELEASE=`uname -v`.`uname -r`
1221 OS_TEST=${target_cpu}
1233 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1237 OS_RELEASE=`uname -v`
1261 OS_RELEASE=`uname -v`
1267 OS_RELEASE=`uname -v`
1270 if test "$OS_TARGET" != "NTO"; then
1272 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1281 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1287 OS_RELEASE=`uname -v`
1294 case "${target_cpu}" in
1305 if test -z "$CROSS_COMPILE" ; then
1313 if test "$OS_ARCH" = "NCR"; then
1315 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1319 # Only set CPU_ARCH if we recognize the value of OS_TEST
1326 powerpc* | ppc | rs6000)
1330 Alpha | alpha | ALPHA)
1347 if test "$OS_TARGET" = "WINCE"; then
1353 if test -z "$OS_TARGET"; then
1356 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1358 dnl ========================================================
1359 dnl GNU specific defaults
1360 dnl ========================================================
1361 if test "$GNU_CC"; then
1362 # FIXME: Let us build with strict aliasing. bug 414641.
1363 CFLAGS="$CFLAGS -fno-strict-aliasing"
1364 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1365 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1366 DSO_LDOPTS='-shared'
1367 if test "$GCC_USE_GNU_LD"; then
1368 # Don't allow undefined symbols in libraries
1369 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1371 WARNINGS_AS_ERRORS='-Werror'
1373 DSO_PIC_CFLAGS='-fPIC'
1374 ASFLAGS="$ASFLAGS -fPIC"
1375 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1376 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1377 _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1378 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1380 # Turn on GNU specific features
1381 # -Wall - turn on all warnings
1382 # -pedantic - make compiler warn about non-ANSI stuff, and
1383 # be a little bit stricter
1384 # Warnings slamm took out for now (these were giving more noise than help):
1385 # -Wbad-function-cast - warns when casting a function to a new return type
1386 # -Wshadow - removed because it generates more noise than help --pete
1387 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1388 if test -z "$INTEL_CC"; then
1389 # Don't use -Wcast-align with ICC
1391 # And don't use it on hppa, ia64, sparc, since it's noisy there
1392 hppa | ia64 | sparc)
1395 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1400 dnl Turn pedantic on but disable the warnings for long long
1403 if test -z "$INTEL_CC"; then
1404 _IGNORE_LONG_LONG_WARNINGS=1
1405 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1407 _IGNORE_LONG_LONG_WARNINGS=
1411 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1412 _USE_CPP_INCLUDE_FLAG=1
1413 elif test "$SOLARIS_SUNPRO_CC"; then
1414 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1415 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1417 DSO_LDOPTS='-shared'
1418 if test "$GNU_LD"; then
1419 # Don't allow undefined symbols in libraries
1420 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1424 if test "$CPU_ARCH" = "sparc"; then
1425 # for Sun Studio on Solaris/SPARC
1426 DSO_PIC_CFLAGS='-xcode=pic32'
1428 DSO_PIC_CFLAGS='-KPIC'
1430 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1432 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1433 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1435 DSO_LDOPTS='-shared'
1436 if test "$GNU_LD"; then
1437 # Don't allow undefined symbols in libraries
1438 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1442 DSO_PIC_CFLAGS='-KPIC'
1443 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1446 if test "$GNU_CXX"; then
1447 # FIXME: Let us build with strict aliasing. bug 414641.
1448 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1449 # Turn on GNU specific features
1450 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1451 if test -z "$INTEL_CC"; then
1452 # Don't use -Wcast-align with ICC
1454 # And don't use it on hppa, ia64, sparc, since it's noisy there
1455 hppa | ia64 | sparc)
1458 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1463 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1464 _USE_CPP_INCLUDE_FLAG=1
1466 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1467 ac_has_wno_invalid_offsetof,
1471 _SAVE_CXXFLAGS="$CXXFLAGS"
1472 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1475 ac_has_wno_invalid_offsetof="yes",
1476 ac_has_wno_invalid_offsetof="no")
1477 CXXFLAGS="$_SAVE_CXXFLAGS"
1480 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1481 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1484 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1487 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1488 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1489 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1490 dnl normal behavior.
1491 dnl ========================================================
1493 MKSHLIB_UNFORCE_ALL=
1495 if test "$COMPILE_ENVIRONMENT"; then
1496 if test "$GNU_CC"; then
1497 AC_MSG_CHECKING(whether ld has archive extraction flags)
1498 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1499 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1500 ac_cv_mkshlib_force_and_unforce="no"
1501 exec 3<&0 <<LOOP_INPUT
1502 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1503 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1504 force="-Wl,-all"; unforce="-Wl,-none"
1511 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1514 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1516 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1520 eval $ac_cv_mkshlib_force_and_unforce
1521 MKSHLIB_FORCE_ALL=$force
1522 MKSHLIB_UNFORCE_ALL=$unforce
1525 fi # COMPILE_ENVIRONMENT
1527 dnl =================================================================
1528 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1529 dnl which is bad when cross compiling.
1530 dnl =================================================================
1531 if test "$COMPILE_ENVIRONMENT"; then
1532 configure_static_assert_macros='
1533 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1534 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1535 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1538 dnl test that the macros actually work:
1539 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1540 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1543 ac_cv_static_assertion_macros_work="yes"
1544 AC_TRY_COMPILE([$configure_static_assert_macros],
1545 [CONFIGURE_STATIC_ASSERT(1)],
1547 ac_cv_static_assertion_macros_work="no")
1548 AC_TRY_COMPILE([$configure_static_assert_macros],
1549 [CONFIGURE_STATIC_ASSERT(0)],
1550 ac_cv_static_assertion_macros_work="no",
1553 AC_TRY_COMPILE([$configure_static_assert_macros],
1554 [CONFIGURE_STATIC_ASSERT(1)],
1556 ac_cv_static_assertion_macros_work="no")
1557 AC_TRY_COMPILE([$configure_static_assert_macros],
1558 [CONFIGURE_STATIC_ASSERT(0)],
1559 ac_cv_static_assertion_macros_work="no",
1563 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1564 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1565 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1567 fi # COMPILE_ENVIRONMENT
1569 dnl ========================================================
1570 dnl Checking for 64-bit OS
1571 dnl ========================================================
1572 if test "$COMPILE_ENVIRONMENT"; then
1575 AC_MSG_CHECKING(for 64-bit OS)
1576 AC_TRY_COMPILE([$configure_static_assert_macros],
1577 [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1578 result="yes", result="no")
1579 AC_MSG_RESULT("$result")
1580 if test "$result" = "yes"; then
1581 AC_DEFINE(HAVE_64BIT_OS)
1584 AC_SUBST(HAVE_64BIT_OS)
1586 fi # COMPILE_ENVIRONMENT
1588 dnl ========================================================
1589 dnl Enable high-memory support on OS/2 by default.
1590 dnl ========================================================
1591 MOZ_OS2_HIGH_MEMORY=1
1592 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1593 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1594 MOZ_OS2_HIGH_MEMORY=,
1595 MOZ_OS2_HIGH_MEMORY=1 )
1596 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1598 dnl ========================================================
1599 dnl System overrides of the defaults for host
1600 dnl ========================================================
1603 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1604 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1605 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1608 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1609 # we need Python 2.5 on Windows
1611 if test -n "$_WIN32_MSVC"; then
1613 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1614 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1615 HOST_RANLIB='echo ranlib'
1617 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1619 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1620 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1621 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1622 HOST_BIN_SUFFIX=.exe
1625 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1626 PERL="/bin/sh ${srcdir}/build/msys-perl-wrapper"
1629 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1630 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1632 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1634 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1636 PERL="${CYGWIN_WRAPPER} $PERL"
1639 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1640 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1647 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1648 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1649 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1650 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1653 *-linux*|*-kfreebsd*-gnu)
1654 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1655 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1656 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1660 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1661 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1662 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1663 HOST_BIN_SUFFIX=.exe
1668 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1669 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1670 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1674 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1675 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1679 dnl We require version 2.4 or newer of Python to build,
1680 dnl and 2.5 or newer on Windows.
1681 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1683 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1686 if test "$_python_res" != 0; then
1687 AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1689 AC_MSG_RESULT([yes])
1691 dnl Get mozilla version from central milestone file
1692 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1694 dnl Get version of various core apps from the version files.
1695 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1697 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1698 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1700 dnl ========================================================
1701 dnl System overrides of the defaults for target
1702 dnl ========================================================
1707 if test ! "$GNU_CC"; then
1708 if test ! "$HAVE_64BIT_OS"; then
1709 # Compiling with Visual Age C++ object model compat is the
1710 # default. To compile with object model ibm, add
1711 # AIX_OBJMODEL=ibm to .mozconfig.
1712 if test "$AIX_OBJMODEL" = "ibm"; then
1713 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1720 AC_SUBST(AIX_OBJMODEL)
1721 DSO_LDOPTS='-qmkshrobj=1'
1722 DSO_CFLAGS='-qflag=w:w'
1724 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1725 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1727 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1728 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1729 if test "$COMPILE_ENVIRONMENT"; then
1732 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1734 [#if (__IBMCPP__ < 600)
1735 #error "Bad compiler"
1737 _BAD_COMPILER=,_BAD_COMPILER=1)
1738 if test -n "$_BAD_COMPILER"; then
1740 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1742 AC_MSG_RESULT([yes])
1745 TARGET_COMPILER_ABI="ibmc"
1746 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1747 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1750 case "${target_os}" in
1755 if test "$COMPILE_ENVIRONMENT"; then
1756 AC_CHECK_HEADERS(sys/inttypes.h)
1758 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1763 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1764 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1765 DSO_LDOPTS='-nostart'
1766 TK_LIBS='-lbe -lroot'
1768 if test "$COMPILE_ENVIRONMENT"; then
1769 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1770 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1772 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1773 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1776 MOZ_USER_DIR="Mozilla"
1780 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1782 _IGNORE_LONG_LONG_WARNINGS=
1790 _WARNINGS_CFLAGS="-Wall"
1791 _WARNINGS_CXXFLAGS="-Wall"
1792 # The test above doesn't work properly, at least on 3.1.
1793 MKSHLIB_FORCE_ALL=''
1794 MKSHLIB_UNFORCE_ALL=''
1800 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1801 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1802 MOZ_OPTIMIZE_FLAGS="-O3"
1804 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1805 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1808 STRIP="$STRIP -x -S"
1809 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1810 MOZ_ENABLE_POSTSCRIPT=
1811 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1812 # The ExceptionHandling framework is needed for Objective-C exception
1813 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1815 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1817 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1818 dnl ===================================================================
1819 if test "x$enable_dtrace" = "xyes"; then
1820 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1822 dnl check for the presence of the -dead_strip linker flag
1823 AC_MSG_CHECKING([for -dead_strip option to ld])
1824 _SAVE_LDFLAGS=$LDFLAGS
1825 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1826 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1827 if test -n "$_HAVE_DEAD_STRIP" ; then
1828 AC_MSG_RESULT([yes])
1829 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1834 LDFLAGS=$_SAVE_LDFLAGS
1839 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1840 DLL_SUFFIX=".so.1.0"
1841 DSO_LDOPTS="-shared"
1843 if test ! "$GNU_CC"; then
1844 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1846 # Can't have force w/o an unforce.
1847 # # Hack for FreeBSD 2.2
1848 # if test -z "$MKSHLIB_FORCE_ALL"; then
1849 # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1850 # MKSHLIB_UNFORCE_ALL=''
1856 if test ! "$GNU_CC"; then
1857 DSO_LDOPTS='-b -Wl,+s'
1860 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1861 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1862 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1864 DSO_LDOPTS='-b -E +s'
1865 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1866 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1868 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1869 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1874 DSO_LDOPTS='-elf -shared'
1876 if test "$GNU_CC"; then
1877 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1878 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1879 MKSHLIB_FORCE_ALL='-Wl,-all'
1880 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1881 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1883 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1884 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1885 MKSHLIB_FORCE_ALL='-all'
1886 MKSHLIB_UNFORCE_ALL='-none'
1892 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1893 dnl compile and link using -n32
1895 TARGET_COMPILER_ABI=n32
1896 DSO_LDOPTS='-elf -shared'
1897 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1898 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1899 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1900 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1901 if test "$GNU_CC"; then
1902 MKSHLIB_FORCE_ALL='-Wl,-all'
1903 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1904 _WARNINGS_CFLAGS="-Wall"
1905 _WARNINGS_CXXFLAGS="-Wall"
1906 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1908 MKSHLIB_FORCE_ALL='-all'
1909 MKSHLIB_UNFORCE_ALL='-none'
1915 CFLAGS="$CFLAGS -woff 3262 -G 4"
1916 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1917 if test -n "$USE_N32"; then
1918 ASFLAGS="$ASFLAGS -n32"
1919 CFLAGS="$CFLAGS -n32"
1920 CXXFLAGS="$CXXFLAGS -n32"
1921 LDFLAGS="$LDFLAGS -n32"
1923 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1924 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1927 if test -z "$GNU_CXX"; then
1933 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1934 # Similarly for GNU_CXX and INTEL_CXX.
1935 if test "$INTEL_CC" || test "$INTEL_CXX"; then
1936 # -Os has been broken on Intel's C/C++ compilers for quite a
1937 # while; Intel recommends against using it.
1938 MOZ_OPTIMIZE_FLAGS="-O2"
1939 MOZ_DEBUG_FLAGS="-g -fno-inline"
1940 elif test "$GNU_CC" || test "$GNU_CXX"; then
1941 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1942 case $GCC_VERSION in
1944 # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1945 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1947 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1948 MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb,
1949 # and that combo is not yet good at
1950 # debugging inlined functions (even
1951 # when using DWARF2 as the debugging
1955 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1959 case "${target_cpu}" in
1961 CFLAGS="$CFLAGS -mieee"
1962 CXXFLAGS="$CXXFLAGS -mieee"
1968 MOZ_DEBUG_FLAGS="-g" # We want inlining
1974 TARGET_COMPILER_ABI=msvc
1975 MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1977 AR_EXTRACT="$AR -extract"
1979 AR_FLAGS='-OUT:"$@"'
1981 if test "$AS_BIN"; then
1988 if test -z "$RC"; then
1991 # certain versions of cygwin's makedepend barf on the
1992 # #include <string> vs -I./dist/include/string issue so don't use it
1998 HOST_AR='lib -OUT:$@'
1999 HOST_RANLIB='echo ranlib'
2000 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2003 WARNINGS_AS_ERRORS='-WX'
2004 MOZ_OPTIMIZE_FLAGS='-Ox'
2005 AR_FLAGS='-NOLOGO -OUT:"$@"'
2007 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2008 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2011 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2012 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2014 IMPORT_LIB_SUFFIX=lib
2016 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2019 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2020 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2022 MKSHLIB_UNFORCE_ALL=
2023 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2024 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2025 MOZ_DEBUG_FLAGS='-Zi'
2026 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2028 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2030 RANLIB='echo not_ranlib'
2031 STRIP='echo not_strip'
2032 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2035 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2037 LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2038 LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2042 AC_DEFINE(HAVE_SNPRINTF)
2047 AC_DEFINE(HW_THREADS)
2048 AC_DEFINE(STDC_HEADERS)
2049 AC_DEFINE(NEW_H, <new>)
2050 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2051 AC_DEFINE(HAVE_LOCALTIME_R)
2053 TARGET_MD_ARCH=win32
2054 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2056 MOZ_ENABLE_POSTSCRIPT=
2057 MOZ_USER_DIR="Mozilla"
2059 MOZ_GFX_OPTIMIZE_MOBILE=1
2061 # Sanity check for WINCE_WINDOWS_MOBILE
2062 # XXX disabled until we can fix the mobile tinderbox
2063 ##if test "$WINCE_WINDOWS_MOBILE"; then
2064 ## AC_CHECK_HEADER(tpcshell.h, [],
2065 ## AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2070 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2075 # certain versions of cygwin's makedepend barf on the
2076 # #include <string> vs -I./dist/include/string issue so don't use it
2078 if test -n "$GNU_CC"; then
2079 CC="$CC -mno-cygwin"
2080 CXX="$CXX -mno-cygwin"
2081 CPP="$CPP -mno-cygwin"
2082 CFLAGS="$CFLAGS -mms-bitfields"
2083 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2084 DSO_LDOPTS='-shared'
2085 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2086 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2088 # Use temp file for windres (bug 213281)
2089 RCFLAGS='-O coff --use-temp-file'
2090 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2091 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2092 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
2094 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2095 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2097 IMPORT_LIB_SUFFIX=dll.a
2099 TARGET_COMPILER_ABI=msvc
2103 AR='lib -NOLOGO -OUT:"$@"'
2105 RANLIB='echo not_ranlib'
2106 STRIP='echo not_strip'
2111 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2116 IMPORT_LIB_SUFFIX=lib
2117 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2118 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2120 MKSHLIB_UNFORCE_ALL=
2121 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2122 _USE_CPP_INCLUDE_FLAG=1
2123 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2124 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2125 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2126 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2127 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2128 MOZ_DEBUG_FLAGS='-Zi'
2129 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2130 WARNINGS_AS_ERRORS='-WX'
2131 MOZ_OPTIMIZE_FLAGS='-O1'
2132 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2134 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2135 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2136 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2137 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2138 if test $_MSC_VER -ge 1400; then
2139 LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2140 dnl For profile-guided optimization
2141 PROFILE_GEN_CFLAGS="-GL"
2142 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2143 dnl XXX: PGO builds can fail with warnings treated as errors,
2144 dnl specifically "no profile data available" appears to be
2145 dnl treated as an error sometimes. This might be a consequence
2146 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2147 dnl with the linker doing most of the work in the whole-program
2148 dnl optimization/PGO case. I think it's probably a compiler bug,
2149 dnl but we work around it here.
2150 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2151 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2152 dnl Probably also a compiler bug, but what can you do?
2153 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2154 if test -n "$_USE_DYNAMICBASE"; then
2155 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2159 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2160 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2161 AC_DEFINE(HAVE_SNPRINTF)
2166 AC_DEFINE(HW_THREADS)
2167 AC_DEFINE(STDC_HEADERS)
2168 AC_DEFINE(NEW_H, <new>)
2169 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2170 TARGET_MD_ARCH=win32
2171 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2173 MOZ_ENABLE_POSTSCRIPT=
2174 MOZ_USER_DIR="Mozilla"
2176 dnl Hardcode to win95 for now - cls
2177 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2179 dnl set NO_X11 defines here as the general check is skipped on win32
2183 dnl MinGW/MSYS doesn't provide or need cygpath
2188 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2190 *-cygwin*|*-msvc*|*-mks*)
2191 CYGPATH_W="cygpath -a -w"
2192 CYGPATH_S="sed -e s|\\\\|/|g"
2193 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2197 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2199 if test -z "$MOZ_TOOLS"; then
2200 AC_MSG_ERROR([MOZ_TOOLS is not set])
2203 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2204 if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2205 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2207 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2208 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2209 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2211 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2213 if test -n "$GLIB_PREFIX"; then
2214 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2215 if test "$?" = "0"; then
2216 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2217 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2219 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2221 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2224 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2226 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2227 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2229 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2230 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2231 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2232 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2233 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2235 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2238 if test -n "$LIBIDL_PREFIX"; then
2239 _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2240 if test "$?" = "0"; then
2241 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2242 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2244 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2246 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2249 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2251 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2252 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2254 LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2255 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2256 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2258 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2259 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2261 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2263 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2266 *) # else cross-compiling
2267 if test -n "$GLIB_PREFIX"; then
2268 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2269 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2270 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2271 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2272 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2274 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2277 if test -n "$LIBIDL_PREFIX"; then
2278 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2279 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2280 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2282 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2283 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2285 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2288 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2295 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])
2299 AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2303 AC_CHECK_HEADERS(atlbase.h)
2319 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2326 CFLAGS="$CFLAGS -Dunix"
2327 CXXFLAGS="$CXXFLAGS -Dunix"
2328 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2330 DSO_PIC_CFLAGS='-fPIC -DPIC'
2331 DSO_LDOPTS='-shared'
2332 BIN_FLAGS='-Wl,--export-dynamic'
2334 DSO_PIC_CFLAGS='-fPIC -DPIC'
2335 DLL_SUFFIX=".so.1.0"
2336 DSO_LDOPTS='-shared'
2338 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2339 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2340 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2341 if test "$LIBRUNPATH"; then
2342 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2344 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2345 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2350 AC_DEFINE(_QNX_SOURCE)
2353 WARNINGS_AS_ERRORS=''
2354 MOZ_OPTIMIZE_FLAGS="-O"
2355 MOZ_DEBUG_FLAGS="-gstabs"
2358 LIBS="$LIBS -lsocket -lstdc++"
2359 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2360 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2361 if test "$with_x" != "yes"
2363 _PLATFORM_DEFAULT_TOOLKIT="photon"
2364 TK_CFLAGS='-I/usr/include/photon'
2367 case "${target_cpu}" in
2369 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2372 case "${host_cpu}" in
2380 DLL_SUFFIX=".so.1.0"
2382 DSO_PIC_CFLAGS='-fPIC'
2383 DSO_LDOPTS='-shared -fPIC'
2384 if test "$LIBRUNPATH"; then
2385 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2390 AC_DEFINE(NO_PW_GECOS)
2391 AC_DEFINE(NO_UDSOCK)
2392 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2394 MKSHLIB_FORCE_ALL='-all'
2395 MKSHLIB_UNFORCE_ALL='-none'
2397 AS_DASH_C_FLAG='-Wc/names=as_is'
2399 DSO_LDOPTS='-shared -auto_symvec'
2401 MOZ_DEBUG_LDFLAGS='-g'
2403 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2404 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2409 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2410 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2413 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2414 AC_DEFINE(TCPV40HDRS)
2420 IMPORT_LIB_SUFFIX=lib
2424 CFLAGS="$CFLAGS -Zomf"
2425 CXXFLAGS="$CXXFLAGS -Zomf"
2427 BIN_FLAGS='-Zlinker /ST:0x100000'
2431 WARNINGS_AS_ERRORS='-Werror'
2432 MOZ_DEBUG_FLAGS="-g -fno-inline"
2433 MOZ_OPTIMIZE_FLAGS="-O2"
2434 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2435 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2436 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2438 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2439 MOZ_ENABLE_POSTSCRIPT=
2442 MOZ_USER_DIR="Mozilla"
2444 if test "$MOZTOOLS"; then
2445 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2447 AC_MSG_ERROR([MOZTOOLS is not set])
2449 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2450 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2451 LDFLAGS="$LDFLAGS -Zhigh-mem"
2452 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2453 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2456 # GCC for OS/2 currently predefines these, but we don't want them
2457 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2458 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2460 AC_CACHE_CHECK(for __declspec(dllexport),
2462 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2464 ac_os2_declspec="yes",
2465 ac_os2_declspec="no")])
2466 if test "$ac_os2_declspec" = "yes"; then
2468 MOZ_OS2_USE_DECLSPEC='1'
2473 if test "$GNU_CC"; then
2474 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2475 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2478 MOZ_DEBUG_FLAGS='-g'
2479 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2480 CFLAGS="$CFLAGS -ieee"
2481 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2482 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2485 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2486 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2487 MKSHLIB_FORCE_ALL='-all'
2488 MKSHLIB_UNFORCE_ALL='-none'
2489 dnl Might fix the libxpcom.so breakage on this platform as well....
2490 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2491 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2493 if test -z "$GNU_CXX"; then
2496 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2500 DIRENT_INO=d_stat.st_ino
2501 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2502 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2503 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2504 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2505 AC_DEFINE(STDC_HEADERS)
2506 if test "$no_x" = "yes"; then
2507 _PLATFORM_DEFAULT_TOOLKIT='photon'
2508 TK_CFLAGS='-I/usr/nto/include/photon'
2509 TK_LIBS='-lphoton -lphrender'
2514 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2515 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2516 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2517 if test ! "$GNU_CC"; then
2522 dnl the qsort routine under solaris is faulty
2525 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2527 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2528 # libraries one level up (e.g. libnspr4.so)
2529 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2531 if test "$SOLARIS_SUNPRO_CC"; then
2532 LIBS="-lCrun -lCstd $LIBS"
2535 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2536 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2537 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2538 LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2539 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2540 _SAVE_LDFLAGS=$LDFLAGS
2541 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2542 AC_TRY_LINK([#include <stdio.h>],
2543 [printf("Hello World\n");],
2545 [LDFLAGS=$_SAVE_LDFLAGS])
2547 WARNINGS_AS_ERRORS='-Werror'
2548 MOZ_OPTIMIZE_FLAGS="-xO4"
2549 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2550 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2551 MKSHLIB_FORCE_ALL='-z allextract'
2552 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2553 DSO_LDOPTS='-G -z muldefs'
2559 AS='/usr/ccs/bin/as'
2560 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2562 TARGET_COMPILER_ABI="sunc"
2563 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2564 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2565 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2569 [#if (__SUNPRO_CC < 0x590)
2572 _BAD_COMPILER=,_BAD_COMPILER=1)
2573 if test -n "$_BAD_COMPILER"; then
2575 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2579 AC_MSG_RESULT([$_res])
2582 ASFLAGS="$ASFLAGS -fPIC"
2585 _WARNINGS_CXXFLAGS=''
2586 if test "$OS_RELEASE" = "5.3"; then
2587 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2590 if test "$OS_RELEASE" = "5.5.1"; then
2591 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2596 DSO_LDOPTS='-Bdynamic'
2597 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2598 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2600 AC_DEFINE(SPRINTF_RETURNS_STRING)
2601 case "$(target_os)" in
2603 DLL_SUFFIX='.so.1.0'
2609 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2613 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2618 dnl Only one oddball right now (QNX), but this gives us flexibility
2619 dnl if any other platforms need to override this in the future.
2620 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2622 dnl ========================================================
2623 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2624 dnl by now will not have any way to link most binaries (tests
2625 dnl as well as viewer, apprunner, etc.), because some symbols
2626 dnl will be left out of the "composite" .so's by ld as unneeded.
2627 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2628 dnl they can link in the static libs that provide the missing
2630 dnl ========================================================
2631 NO_LD_ARCHIVE_FLAGS=
2632 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2633 NO_LD_ARCHIVE_FLAGS=1
2637 NO_LD_ARCHIVE_FLAGS=
2640 NO_LD_ARCHIVE_FLAGS=
2643 NO_LD_ARCHIVE_FLAGS=
2645 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2646 if test -z "$GNU_CC"; then
2647 NO_LD_ARCHIVE_FLAGS=
2651 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2653 dnl ========================================================
2654 dnl = Flags to strip unused symbols from .so components
2655 dnl ========================================================
2657 *-linux*|*-kfreebsd*-gnu)
2658 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2661 if test -z "$GNU_CC"; then
2662 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2664 if test -z "$GCC_USE_GNU_LD"; then
2665 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2667 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2672 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2675 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2677 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2678 if test -n "$GNU_CC"; then
2679 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2684 if test -z "$COMPILE_ENVIRONMENT"; then
2685 SKIP_COMPILER_CHECKS=1
2686 SKIP_LIBRARY_CHECKS=1
2689 if test -z "$SKIP_COMPILER_CHECKS"; then
2690 dnl Checks for typedefs, structures, and compiler characteristics.
2691 dnl ========================================================
2699 AC_STRUCT_ST_BLKSIZE
2700 AC_MSG_CHECKING(for siginfo_t)
2701 AC_CACHE_VAL(ac_cv_siginfo_t,
2702 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2703 #include <signal.h>],
2705 [ac_cv_siginfo_t=true],
2706 [ac_cv_siginfo_t=false])])
2707 if test "$ac_cv_siginfo_t" = true ; then
2708 AC_DEFINE(HAVE_SIGINFO_T)
2714 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2715 dnl ========================================================
2716 AC_MSG_CHECKING(for int16_t)
2717 AC_CACHE_VAL(ac_cv_int16_t,
2718 [AC_TRY_COMPILE([#include <stdio.h>
2719 #include <sys/types.h>],
2721 [ac_cv_int16_t=true],
2722 [ac_cv_int16_t=false])])
2723 if test "$ac_cv_int16_t" = true ; then
2724 AC_DEFINE(HAVE_INT16_T)
2729 AC_MSG_CHECKING(for int32_t)
2730 AC_CACHE_VAL(ac_cv_int32_t,
2731 [AC_TRY_COMPILE([#include <stdio.h>
2732 #include <sys/types.h>],
2734 [ac_cv_int32_t=true],
2735 [ac_cv_int32_t=false])])
2736 if test "$ac_cv_int32_t" = true ; then
2737 AC_DEFINE(HAVE_INT32_T)
2742 AC_MSG_CHECKING(for int64_t)
2743 AC_CACHE_VAL(ac_cv_int64_t,
2744 [AC_TRY_COMPILE([#include <stdio.h>
2745 #include <sys/types.h>],
2747 [ac_cv_int64_t=true],
2748 [ac_cv_int64_t=false])])
2749 if test "$ac_cv_int64_t" = true ; then
2750 AC_DEFINE(HAVE_INT64_T)
2755 AC_MSG_CHECKING(for int64)
2756 AC_CACHE_VAL(ac_cv_int64,
2757 [AC_TRY_COMPILE([#include <stdio.h>
2758 #include <sys/types.h>],
2761 [ac_cv_int64=false])])
2762 if test "$ac_cv_int64" = true ; then
2763 AC_DEFINE(HAVE_INT64)
2768 AC_MSG_CHECKING(for uint)
2769 AC_CACHE_VAL(ac_cv_uint,
2770 [AC_TRY_COMPILE([#include <stdio.h>
2771 #include <sys/types.h>],
2774 [ac_cv_uint=false])])
2775 if test "$ac_cv_uint" = true ; then
2776 AC_DEFINE(HAVE_UINT)
2781 AC_MSG_CHECKING(for uint_t)
2782 AC_CACHE_VAL(ac_cv_uint_t,
2783 [AC_TRY_COMPILE([#include <stdio.h>
2784 #include <sys/types.h>],
2786 [ac_cv_uint_t=true],
2787 [ac_cv_uint_t=false])])
2788 if test "$ac_cv_uint_t" = true ; then
2789 AC_DEFINE(HAVE_UINT_T)
2794 AC_MSG_CHECKING(for uint16_t)
2795 AC_CACHE_VAL(ac_cv_uint16_t,
2796 [AC_TRY_COMPILE([#include <stdio.h>
2797 #include <sys/types.h>],
2798 [uint16_t foo = 0;],
2799 [ac_cv_uint16_t=true],
2800 [ac_cv_uint16_t=false])])
2801 if test "$ac_cv_uint16_t" = true ; then
2802 AC_DEFINE(HAVE_UINT16_T)
2808 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2809 dnl are defined when compiling C++ but not C. Since the result of this
2810 dnl test is used only in C++, do it in C++.
2813 AC_MSG_CHECKING(for uname.domainname)
2814 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2815 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2816 [ struct utsname *res; char *domain;
2817 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2818 [ac_cv_have_uname_domainname_field=true],
2819 [ac_cv_have_uname_domainname_field=false])])
2821 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2822 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2828 AC_MSG_CHECKING(for uname.__domainname)
2829 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2830 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2831 [ struct utsname *res; char *domain;
2832 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2833 [ac_cv_have_uname_us_domainname_field=true],
2834 [ac_cv_have_uname_us_domainname_field=false])])
2836 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2837 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2845 dnl Check for usable char16_t (2 bytes, unsigned)
2846 dnl (we might not need the unsignedness check anymore)
2847 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2848 ac_cv_have_usable_char16_t,
2849 [AC_TRY_COMPILE([$configure_static_assert_macros],
2850 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2851 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2852 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2853 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2854 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2855 ac_cv_have_usable_char16_t="yes",
2856 ac_cv_have_usable_char16_t="no")])
2857 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2858 AC_DEFINE(HAVE_CPP_CHAR16_T)
2862 dnl Check for usable wchar_t (2 bytes, unsigned)
2863 dnl (we really don't need the unsignedness check anymore)
2864 dnl ========================================================
2866 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2867 ac_cv_have_usable_wchar_v2,
2868 [AC_TRY_COMPILE([#include <stddef.h>
2869 $configure_static_assert_macros],
2870 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2871 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2872 ac_cv_have_usable_wchar_v2="yes",
2873 ac_cv_have_usable_wchar_v2="no")])
2874 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2875 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2876 HAVE_CPP_2BYTE_WCHAR_T=1
2877 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2878 dnl This is really gcc-only
2879 dnl Do this test using CXX only since some versions of gcc
2880 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2881 dnl only have short-wchar support for c++.
2882 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2884 _SAVE_CXXFLAGS=$CXXFLAGS
2885 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2887 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2888 ac_cv_have_usable_wchar_option_v2,
2889 [AC_TRY_LINK([#include <stddef.h>
2890 $configure_static_assert_macros],
2891 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2892 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2893 ac_cv_have_usable_wchar_option_v2="yes",
2894 ac_cv_have_usable_wchar_option_v2="no")])
2896 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2897 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2898 HAVE_CPP_2BYTE_WCHAR_T=1
2899 WCHAR_CFLAGS="-fshort-wchar"
2901 CXXFLAGS=$_SAVE_CXXFLAGS
2907 dnl Check for .hidden assembler directive and visibility attribute.
2908 dnl Borrowed from glibc configure.in
2909 dnl ===============================================================
2910 if test "$GNU_CC"; then
2911 AC_CACHE_CHECK(for visibility(hidden) attribute,
2912 ac_cv_visibility_hidden,
2913 [cat > conftest.c <<EOF
2914 int foo __attribute__ ((visibility ("hidden"))) = 1;
2916 ac_cv_visibility_hidden=no
2917 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2918 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2919 ac_cv_visibility_hidden=yes
2924 if test "$ac_cv_visibility_hidden" = "yes"; then
2925 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2927 AC_CACHE_CHECK(for visibility(default) attribute,
2928 ac_cv_visibility_default,
2929 [cat > conftest.c <<EOF
2930 int foo __attribute__ ((visibility ("default"))) = 1;
2932 ac_cv_visibility_default=no
2933 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2934 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2935 ac_cv_visibility_default=yes
2940 if test "$ac_cv_visibility_default" = "yes"; then
2941 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2943 AC_CACHE_CHECK(for visibility pragma support,
2944 ac_cv_visibility_pragma,
2945 [cat > conftest.c <<EOF
2946 #pragma GCC visibility push(hidden)
2948 #pragma GCC visibility push(default)
2949 int foo_default = 1;
2951 ac_cv_visibility_pragma=no
2952 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2953 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2954 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2955 ac_cv_visibility_pragma=yes
2961 if test "$ac_cv_visibility_pragma" = "yes"; then
2962 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2963 ac_cv_have_visibility_class_bug,
2964 [cat > conftest.c <<EOF
2965 #pragma GCC visibility push(hidden)
2966 struct __attribute__ ((visibility ("default"))) TestStruct {
2969 __attribute__ ((visibility ("default"))) void TestFunc() {
2973 ac_cv_have_visibility_class_bug=no
2974 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2975 ac_cv_have_visibility_class_bug=yes
2977 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2978 ac_cv_have_visibility_class_bug=yes
2981 rm -rf conftest.{c,S}
2984 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2985 ac_cv_have_visibility_builtin_bug,
2986 [cat > conftest.c <<EOF
2987 #pragma GCC visibility push(hidden)
2988 #pragma GCC visibility push(default)
2990 #pragma GCC visibility pop
2992 __attribute__ ((visibility ("default"))) void Func() {
2994 memset(c, 0, sizeof(c));
2997 ac_cv_have_visibility_builtin_bug=no
2998 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2999 ac_cv_have_visibility_builtin_bug=yes
3001 if test `grep -c "@PLT" conftest.S` = 0; then
3002 ac_cv_visibility_builtin_bug=yes
3005 rm -f conftest.{c,S}
3007 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3008 "$ac_cv_have_visibility_class_bug" = "no"; then
3009 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3010 WRAP_SYSTEM_INCLUDES=1
3012 VISIBILITY_FLAGS='-fvisibility=hidden'
3013 fi # have visibility pragma bug
3014 fi # have visibility pragma
3015 fi # have visibility(default) attribute
3016 fi # have visibility(hidden) attribute
3019 # visibility hidden flag for Sun Studio on Solaris
3020 if test "$SOLARIS_SUNPRO_CC"; then
3021 VISIBILITY_FLAGS='-xldscope=hidden'
3022 fi # Sun Studio on Solaris
3024 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3025 AC_SUBST(VISIBILITY_FLAGS)
3027 dnl Checks for header files.
3028 dnl ========================================================
3030 case "$target_os" in
3032 # for stuff like -lXshm
3033 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3036 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3037 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3038 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3039 AC_CHECK_HEADERS(malloc.h)
3040 AC_CHECK_HEADERS(X11/XKBlib.h)
3041 AC_CHECK_HEADERS(io.h)
3043 dnl These are all the places some variant of statfs can be hiding.
3044 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3046 dnl Try for MMX support
3047 dnl NB - later gcc versions require -mmmx for this header to be successfully
3048 dnl included (or another option which implies it, such as -march=pentium-mmx)
3049 AC_CHECK_HEADERS(mmintrin.h)
3051 dnl Check whether the compiler supports the new-style C++ standard
3052 dnl library headers (i.e. <new>) or needs the old "new.h"
3055 AC_CHECK_HEADER(new, [NEW_H=new])
3056 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3059 AC_ARG_ENABLE(dtrace,
3060 [ --enable-dtrace build with dtrace support if available (default=no)],
3061 [enable_dtrace="yes"],)
3062 if test "x$enable_dtrace" = "xyes"; then
3063 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3064 if test -n "$HAVE_DTRACE"; then
3065 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3067 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3070 AC_SUBST(HAVE_DTRACE)
3076 AC_CHECK_HEADERS(sys/cdefs.h)
3080 dnl Checks for libraries.
3081 dnl ========================================================
3086 AC_CHECK_LIB(c_r, gethostbyname_r)
3090 dnl We don't want to link with libdl even if it's present on OS X, since
3091 dnl it's not used and not part of the default installation.
3092 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3093 dnl We don't want to link against libm or libpthread on Darwin since
3094 dnl they both are just symlinks to libSystem and explicitly linking
3095 dnl against libSystem causes issues when debugging (see bug 299601).
3104 AC_CHECK_LIB(m, atan)
3105 AC_CHECK_LIB(dl, dlopen,
3106 AC_CHECK_HEADER(dlfcn.h,
3108 AC_DEFINE(HAVE_LIBDL)))
3112 _SAVE_CFLAGS="$CFLAGS"
3113 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3114 AC_CHECK_FUNCS(dladdr)
3115 CFLAGS="$_SAVE_CFLAGS"
3117 if test ! "$GNU_CXX"; then
3121 AC_CHECK_LIB(C_r, demangle)
3124 AC_CHECK_LIB(C, demangle)
3129 dnl OS/2 has socket in libc.
3134 AC_CHECK_LIB(socket, socket)
3137 dnl ========================================================
3138 dnl Check whether we can compile code for Core Text
3139 dnl (Mac OS X 10.5 or later)
3140 dnl ========================================================
3143 AC_MSG_CHECKING([for Core Text])
3144 AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3145 [CTLineRef lineRef;],
3146 ac_cv_have_core_text="yes",
3147 ac_cv_have_core_text="no")
3148 AC_MSG_RESULT([$ac_cv_have_core_text])
3152 MOZ_ARG_DISABLE_BOOL(coretext,
3153 [ --disable-coretext Use ATSUI instead of Core Text for text rendering],
3157 if test -n "$MOZ_CORETEXT"; then
3158 if test "$ac_cv_have_core_text" = "no"; then
3159 AC_MSG_ERROR([--enable-coretext requires MacOS SDK 10.5 or newer])
3161 AC_DEFINE(MOZ_CORETEXT)
3166 AC_SUBST(MOZ_CORETEXT)
3169 XLIBS="$X_EXTRA_LIBS"
3171 dnl ========================================================
3172 dnl Checks for X libraries.
3173 dnl Ordering is important.
3174 dnl Xt is dependent upon SM as of X11R6
3175 dnl ========================================================
3176 if test "$no_x" = "yes"; then
3179 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3180 XLIBS="-lX11 $XLIBS"
3181 _SAVE_LDFLAGS="$LDFLAGS"
3182 LDFLAGS="$XLDFLAGS $LDFLAGS"
3183 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3184 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3185 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3186 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3188 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3189 unset ac_cv_lib_Xt_XtFree
3190 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3191 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3192 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3193 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3196 # AIX needs the motif library linked before libXt to prevent
3197 # crashes in plugins linked against Motif - Bug #98892
3198 case "${target_os}" in
3200 XT_LIBS="-lXm $XT_LIBS"
3204 dnl ========================================================
3205 dnl = Check for XShm
3206 dnl ========================================================
3207 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3209 AC_CHECK_HEADER(X11/extensions/XShm.h)
3210 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3211 test -n "$_HAVE_XSHM_XEXT"; then
3212 AC_DEFINE(HAVE_XSHM)
3215 dnl ========================================================
3217 dnl ========================================================
3218 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3220 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3222 if test "$MOZ_XIE_LIBS"; then
3223 dnl ====================================================
3224 dnl = If XIE is present and is desired, turn it on
3225 dnl ====================================================
3235 LDFLAGS="$_SAVE_LDFLAGS"
3237 dnl ========================================================
3238 dnl = Check for freetype2 and its functionality
3239 dnl ========================================================
3240 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3242 if test "$_HAVE_FREETYPE2"; then
3244 _SAVE_CFLAGS="$CFLAGS"
3245 LIBS="$LIBS $FT2_LIBS"
3246 CFLAGS="$CFLAGS $FT2_CFLAGS"
3248 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3249 ac_cv_member_FT_Bitmap_Size_y_ppem,
3250 [AC_TRY_COMPILE([#include <ft2build.h>
3251 #include FT_FREETYPE_H],
3253 if (sizeof s.y_ppem) return 0;
3255 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3256 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3257 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3258 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3260 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3262 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3263 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3264 [FT_Bitmap_Size structure includes y_ppem field])
3266 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3269 CFLAGS="$_SAVE_CFLAGS"
3280 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3282 [asm("uqadd8 r1, r1, r2");],
3283 result="yes", result="no")
3284 AC_MSG_RESULT("$result")
3285 if test "$result" = "yes"; then
3286 AC_DEFINE(HAVE_ARM_SIMD)
3289 AC_SUBST(HAVE_ARM_SIMD)
3291 AC_MSG_CHECKING(for ARM NEON support in compiler)
3292 _SAVE_CFLAGS="$CFLAGS"
3293 if test "$GNU_CC"; then
3294 # gcc needs -mfpu=neon to recognize NEON instructions
3295 CFLAGS="$CFLAGS -mfpu=neon"
3298 [asm("vadd.i8 d0, d0, d0");],
3299 result="yes", result="no")
3300 AC_MSG_RESULT("$result")
3301 if test "$result" = "yes"; then
3302 AC_DEFINE(HAVE_ARM_NEON)
3305 CFLAGS="$_SAVE_CFLAGS"
3306 AC_SUBST(HAVE_ARM_NEON)
3308 dnl ========================================================
3309 dnl = pthread support
3310 dnl = Start by checking whether the system support pthreads
3311 dnl ========================================================
3312 case "$target_os" in
3317 MOZ_CHECK_PTHREADS(pthreads,
3318 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3319 MOZ_CHECK_PTHREADS(pthread,
3320 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3321 MOZ_CHECK_PTHREADS(c_r,
3322 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3323 MOZ_CHECK_PTHREADS(c,
3332 dnl ========================================================
3333 dnl Check the command line for --with-pthreads
3334 dnl ========================================================
3335 MOZ_ARG_WITH_BOOL(pthreads,
3336 [ --with-pthreads Force use of system pthread library with NSPR ],
3337 [ if test "$USE_PTHREADS"x = x; then
3338 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3344 dnl ========================================================
3345 dnl Do the platform specific pthread hackery
3346 dnl ========================================================
3347 if test "$USE_PTHREADS"x != x
3350 dnl See if -pthread is supported.
3353 ac_cv_have_dash_pthread=no
3354 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3355 echo 'int main() { return 0; }' | cat > conftest.c
3356 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3357 if test $? -eq 0; then
3358 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3359 ac_cv_have_dash_pthread=yes
3360 case "$target_os" in
3362 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3365 CFLAGS="$CFLAGS -pthread"
3366 CXXFLAGS="$CXXFLAGS -pthread"
3372 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3375 dnl See if -pthreads is supported.
3377 ac_cv_have_dash_pthreads=no
3378 if test "$ac_cv_have_dash_pthread" = "no"; then
3379 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3380 echo 'int main() { return 0; }' | cat > conftest.c
3381 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3382 if test $? -eq 0; then
3383 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3384 ac_cv_have_dash_pthreads=yes
3385 CFLAGS="$CFLAGS -pthreads"
3386 CXXFLAGS="$CXXFLAGS -pthreads"
3390 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3395 AC_DEFINE(_REENTRANT)
3396 AC_DEFINE(_THREAD_SAFE)
3397 dnl -pthread links in -lc_r, so don't specify it explicitly.
3398 if test "$ac_cv_have_dash_pthread" = "yes"; then
3399 _PTHREAD_LDFLAGS="-pthread"
3401 _PTHREAD_LDFLAGS="-lc_r"
3405 *-*-openbsd*|*-*-bsdi*)
3406 AC_DEFINE(_REENTRANT)
3407 AC_DEFINE(_THREAD_SAFE)
3408 dnl -pthread links in -lc_r, so don't specify it explicitly.
3409 if test "$ac_cv_have_dash_pthread" = "yes"; then
3410 _PTHREAD_LDFLAGS="-pthread"
3414 *-*-linux*|*-*-kfreebsd*-gnu)
3415 AC_DEFINE(_REENTRANT)
3419 AC_DEFINE(_REENTRANT)
3423 AC_DEFINE(_REENTRANT)
3427 AC_DEFINE(_REENTRANT)
3431 AC_DEFINE(_REENTRANT)
3435 AC_DEFINE(_REENTRANT)
3436 if test "$SOLARIS_SUNPRO_CC"; then
3437 CFLAGS="$CFLAGS -mt"
3438 CXXFLAGS="$CXXFLAGS -mt"
3442 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3445 dnl ========================================================
3446 dnl See if mmap sees writes
3447 dnl For cross compiling, just define it as no, which is a safe default
3448 dnl ========================================================
3449 AC_MSG_CHECKING(whether mmap() sees write()s)
3455 #include <sys/mman.h>
3456 #include <sys/types.h>
3457 #include <sys/stat.h>
3460 char fname[] = "conftest.file";
3461 char zbuff[1024]; /* Fractional page is probably worst case */
3468 fd = open(fname, O_RDWR | O_CREAT, 0660);
3471 write(fd, zbuff, sizeof(zbuff));
3472 lseek(fd, 0, SEEK_SET);
3473 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3474 if(map==(char*)-1) return 2;
3475 for(i=0; fname[i]; i++) {
3476 int rc = write(fd, &fname[i], 1);
3477 if(map[i]!=fname[i]) return 4;
3484 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3486 AC_MSG_RESULT("$result")
3488 if test "$result" = "no"; then
3489 AC_DEFINE(MMAP_MISSES_WRITES)
3493 dnl Checks for library functions.
3494 dnl ========================================================
3495 AC_PROG_GCC_TRADITIONAL
3497 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3498 AC_CHECK_FUNCS(flockfile getpagesize)
3499 AC_CHECK_FUNCS(localtime_r strtok_r)
3501 dnl check for wcrtomb/mbrtowc
3502 dnl =======================================================================
3503 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3506 AC_CACHE_CHECK(for wcrtomb,
3508 [AC_TRY_LINK([#include <wchar.h>],
3509 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3510 ac_cv_have_wcrtomb="yes",
3511 ac_cv_have_wcrtomb="no")])
3512 if test "$ac_cv_have_wcrtomb" = "yes"; then
3513 AC_DEFINE(HAVE_WCRTOMB)
3515 AC_CACHE_CHECK(for mbrtowc,
3517 [AC_TRY_LINK([#include <wchar.h>],
3518 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3519 ac_cv_have_mbrtowc="yes",
3520 ac_cv_have_mbrtowc="no")])
3521 if test "$ac_cv_have_mbrtowc" = "yes"; then
3522 AC_DEFINE(HAVE_MBRTOWC)
3529 ac_cv_func_res_ninit,
3532 #define _BSD_SOURCE 1
3536 [int foo = res_ninit(&_res);],
3537 [ac_cv_func_res_ninit=yes],
3538 [ac_cv_func_res_ninit=no])
3541 if test "$ac_cv_func_res_ninit" = "yes"; then
3542 AC_DEFINE(HAVE_RES_NINIT)
3543 dnl must add the link line we do something as foolish as this... dougt
3545 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3546 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3551 [for gnu_get_libc_version()],
3552 ac_cv_func_gnu_get_libc_version,
3554 #ifdef HAVE_GNU_LIBC_VERSION_H
3555 #include <gnu/libc-version.h>
3558 [const char *glibc_version = gnu_get_libc_version();],
3559 [ac_cv_func_gnu_get_libc_version=yes],
3560 [ac_cv_func_gnu_get_libc_version=no]
3564 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3565 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3569 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3573 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3574 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3575 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3577 LIBS="$LIBS $_ICONV_LIBS"
3586 iconv_t h = iconv_open("", "");
3587 iconv(h, NULL, NULL, NULL, NULL);
3590 [ac_cv_func_iconv=yes],
3591 [ac_cv_func_iconv=no]
3594 if test "$ac_cv_func_iconv" = "yes"; then
3595 AC_DEFINE(HAVE_ICONV)
3596 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3597 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3598 LIBICONV="$_ICONV_LIBS"
3600 [for iconv() with const input],
3601 ac_cv_func_const_iconv,
3607 const char *input = "testing";
3608 iconv_t h = iconv_open("", "");
3609 iconv(h, &input, NULL, NULL, NULL);
3612 [ac_cv_func_const_iconv=yes],
3613 [ac_cv_func_const_iconv=no]
3616 if test "$ac_cv_func_const_iconv" = "yes"; then
3617 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3629 dnl **********************
3630 dnl *** va_copy checks ***
3631 dnl **********************
3632 dnl we currently check for all three va_copy possibilities, so we get
3633 dnl all results in config.log for bug reports.
3634 AC_MSG_CHECKING(for an implementation of va_copy())
3635 AC_CACHE_VAL(ac_cv_va_copy,[
3638 void f (int i, ...) {
3639 va_list args1, args2;
3640 va_start (args1, i);
3641 va_copy (args2, args1);
3642 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3644 va_end (args1); va_end (args2);
3646 int main() { f (0, 42); return 0; }],
3652 AC_MSG_RESULT($ac_cv_va_copy)
3653 AC_MSG_CHECKING(for an implementation of __va_copy())
3654 AC_CACHE_VAL(ac_cv___va_copy,[
3657 void f (int i, ...) {
3658 va_list args1, args2;
3659 va_start (args1, i);
3660 __va_copy (args2, args1);
3661 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3663 va_end (args1); va_end (args2);
3665 int main() { f (0, 42); return 0; }],
3666 ac_cv___va_copy=yes,
3671 AC_MSG_RESULT($ac_cv___va_copy)
3672 AC_MSG_CHECKING(whether va_lists can be copied by value)
3673 AC_CACHE_VAL(ac_cv_va_val_copy,[
3676 void f (int i, ...) {
3677 va_list args1, args2;
3678 va_start (args1, i);
3680 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3682 va_end (args1); va_end (args2);
3684 int main() { f (0, 42); return 0; }],
3685 ac_cv_va_val_copy=yes,
3686 ac_cv_va_val_copy=no,
3687 ac_cv_va_val_copy=yes
3690 if test "x$ac_cv_va_copy" = "xyes"; then
3691 AC_DEFINE(VA_COPY, va_copy)
3692 AC_DEFINE(HAVE_VA_COPY)
3693 elif test "x$ac_cv___va_copy" = "xyes"; then
3694 AC_DEFINE(VA_COPY, __va_copy)
3695 AC_DEFINE(HAVE_VA_COPY)
3698 if test "x$ac_cv_va_val_copy" = "xno"; then
3699 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3701 AC_MSG_RESULT($ac_cv_va_val_copy)
3703 dnl Check for dll-challenged libc's.
3704 dnl This check is apparently only needed for Linux.
3707 dnl ===================================================================
3710 rm -rf conftest* _conftest
3712 cat >> conftest.C <<\EOF
3717 void __dump_link_map(void) {
3718 struct link_map *map = _dl_loaded;
3719 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3722 dlopen("./conftest1.so",RTLD_LAZY);
3723 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3724 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3725 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3729 /* _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).*/
3730 int main() { printf("./conftest1.so\n"); }
3734 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3736 cat >> conftest1.C <<\EOF
3738 void foo(void) {printf("foo in dll called\n");}
3740 ${CXX-g++} -fPIC -c -g conftest1.C
3741 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3742 ${CXX-g++} -g conftest.C -o conftest -ldl
3743 cp -f conftest1.so conftest _conftest
3745 if test `./conftest | grep conftest1.so | wc -l` -gt 1
3748 echo "*** Your libc has a bug that can result in loading the same dynamic"
3749 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
3750 echo "*** or later. However, if you choose not to upgrade, the only effect"
3751 echo "*** will be excessive memory usage at runtime."
3755 rm -rf conftest* _conftest
3756 dnl ===================================================================
3760 dnl ===================================================================
3761 dnl ========================================================
3762 dnl By default, turn rtti and exceptions off on g++/egcs
3763 dnl ========================================================
3764 if test "$GNU_CXX"; then
3766 AC_MSG_CHECKING(for C++ exceptions flag)
3768 dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3769 AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3770 [echo "int main() { return 0; }" | cat > conftest.C
3772 ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3774 if egrep "warning.*renamed" conftest.out >/dev/null; then
3775 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3777 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3782 AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3783 _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3784 _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3787 dnl ========================================================
3788 dnl Put your C++ language/feature checks below
3789 dnl ========================================================
3793 if test "$GNU_CC"; then
3794 AC_CACHE_CHECK(for gcc 3.0 ABI,
3795 ac_cv_gcc_three_abi,
3798 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3804 ac_cv_gcc_three_abi="yes",
3805 ac_cv_gcc_three_abi="no")])
3806 if test "$ac_cv_gcc_three_abi" = "yes"; then
3807 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3810 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3813 AC_SUBST(HAVE_GCC3_ABI)
3816 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3818 [AC_TRY_COMPILE(class X {
3819 public: explicit X(int i) : i_(i) {}
3823 ac_cv_cpp_explicit=yes,
3824 ac_cv_cpp_explicit=no)])
3825 if test "$ac_cv_cpp_explicit" = yes ; then
3826 AC_DEFINE(HAVE_CPP_EXPLICIT)
3829 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3831 [AC_TRY_COMPILE(class param {
3833 typedef unsigned long num_type;
3836 template <class T> class tplt {
3838 typedef typename T::num_type t_num_type;
3839 t_num_type foo(typename T::num_type num) {
3845 ac_cv_cpp_typename=yes,
3846 ac_cv_cpp_typename=no)])
3847 if test "$ac_cv_cpp_typename" = yes ; then
3848 AC_DEFINE(HAVE_CPP_TYPENAME)
3851 dnl Check for support of modern template specialization syntax
3852 dnl Test code and requirement from scc@netscape.com.
3853 dnl Autoconf cut-and-paste job by waterson@netscape.com
3854 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3855 ac_cv_cpp_modern_specialize_template_syntax,
3856 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3858 template <> struct X<Y> { double a; };,
3861 ac_cv_cpp_modern_specialize_template_syntax=yes,
3862 ac_cv_cpp_modern_specialize_template_syntax=no)])
3863 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3864 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3868 dnl Some compilers support only full specialization, and some don't.
3869 AC_CACHE_CHECK(whether partial template specialization works,
3870 ac_cv_cpp_partial_specialization,
3871 [AC_TRY_COMPILE(template <class T> class Foo {};
3872 template <class T> class Foo<T*> {};,
3874 ac_cv_cpp_partial_specialization=yes,
3875 ac_cv_cpp_partial_specialization=no)])
3876 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3877 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3880 dnl Some compilers have limited support for operators with templates;
3881 dnl specifically, it is necessary to define derived operators when a base
3882 dnl class's operator declaration should suffice.
3883 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3884 ac_cv_need_derived_template_operators,
3885 [AC_TRY_COMPILE([template <class T> class Base { };
3887 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3888 template <class T> class Derived : public Base<T> { };],
3889 [Derived<char> a, b;
3890 Base<char> c = a + b;
3892 ac_cv_need_derived_template_operators=no,
3893 ac_cv_need_derived_template_operators=yes)])
3894 if test "$ac_cv_need_derived_template_operators" = yes ; then
3895 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3899 dnl Some compilers have trouble detecting that a template class
3900 dnl that derives from another template is actually an instance
3901 dnl of the base class. This test checks for that.
3902 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3903 ac_cv_need_cpp_template_cast_to_base,
3904 [AC_TRY_COMPILE([template <class T> class Base { };
3905 template <class T> class Derived : public Base<T> { };
3906 template <class T> int foo(const Base<T>&) { return 0; }],
3907 [Derived<char> bar; return foo(bar);],
3908 ac_cv_need_cpp_template_cast_to_base=no,
3909 ac_cv_need_cpp_template_cast_to_base=yes)])
3910 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3911 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3914 dnl Some compilers have trouble resolving the ambiguity between two
3915 dnl functions whose arguments differ only by cv-qualifications.
3916 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3917 ac_cv_can_resolve_const_ambiguity,
3919 template <class T> class ptrClass {
3923 template <class T> T* a(ptrClass<T> *arg) {
3928 const T* a(const ptrClass<T> *arg) {
3934 ac_cv_can_resolve_const_ambiguity=yes,
3935 ac_cv_can_resolve_const_ambiguity=no)])
3936 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3937 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3941 dnl We don't do exceptions on unix. The only reason this used to be here
3942 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
3943 dnl exceptions. But, we turn exceptions off by default and this test breaks.
3944 dnl So im commenting this out until someone writes some artificial
3945 dnl intelligence to detect not only if the compiler has exceptions, but if
3946 dnl they are enabled as well.
3948 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3949 dnl ac_cv_cpp_exceptions,
3950 dnl [AC_TRY_COMPILE(class X { public: X() {} };
3951 dnl static void F() { throw X(); },
3952 dnl try { F(); } catch(X & e) { },
3953 dnl ac_cv_cpp_exceptions=yes,
3954 dnl ac_cv_cpp_exceptions=no)])
3955 dnl if test $ac_cv_cpp_exceptions = yes ; then
3956 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3959 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3960 dnl supports it well enough to allow us to use it to change access, but not
3961 dnl to resolve ambiguity. The next two tests determine how well the |using|
3962 dnl keyword is supported.
3964 dnl Check to see if we can change access with |using|. Test both a
3965 dnl legal and an illegal example.
3966 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3967 ac_cv_cpp_access_changing_using2,
3969 class A { protected: int foo() { return 0; } };
3970 class B : public A { public: using A::foo; };,
3971 B b; return b.foo();,
3973 class A { public: int foo() { return 1; } };
3974 class B : public A { private: using A::foo; };,
3975 B b; return b.foo();,
3976 ac_cv_cpp_access_changing_using2=no,
3977 ac_cv_cpp_access_changing_using2=yes)],
3978 ac_cv_cpp_access_changing_using2=no)])
3979 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3980 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3983 dnl Check to see if we can resolve ambiguity with |using|.
3984 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3985 ac_cv_cpp_ambiguity_resolving_using,
3986 [AC_TRY_COMPILE(class X {
3987 public: int go(const X&) {return 3;}
3988 int jo(const X&) {return 3;}
3990 class Y : public X {
3991 public: int go(int) {return 2;}
3992 int jo(int) {return 2;}
3994 private: using X::go;
3997 ac_cv_cpp_ambiguity_resolving_using=yes,
3998 ac_cv_cpp_ambiguity_resolving_using=no)])
3999 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4000 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4003 dnl Check to see if the |std| namespace is supported. If so, we'll want
4004 dnl to qualify any standard library calls with "std::" to ensure that
4005 dnl those functions can be resolved.
4006 AC_CACHE_CHECK(for \"std::\" namespace,
4007 ac_cv_cpp_namespace_std,
4008 [AC_TRY_COMPILE([#include <algorithm>],
4009 [return std::min(0, 1);],
4010 ac_cv_cpp_namespace_std=yes,
4011 ac_cv_cpp_namespace_std=no)])
4012 if test "$ac_cv_cpp_namespace_std" = yes ; then
4013 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4016 dnl Older compilers are overly ambitious with respect to using the standard
4017 dnl template library's |operator!=()| when |operator==()| is defined. In
4018 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4019 dnl ambiguity at compile-time. This test checks for that case.
4020 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4021 ac_cv_cpp_unambiguous_std_notequal,
4022 [AC_TRY_COMPILE([#include <algorithm>
4024 int operator==(const T1&, const T1&) { return 0; }
4025 int operator!=(const T1&, const T1&) { return 0; }],
4026 [T1 a,b; return a != b;],
4027 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4028 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4029 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4030 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4034 AC_CACHE_CHECK(for C++ reinterpret_cast,
4035 ac_cv_cpp_reinterpret_cast,
4036 [AC_TRY_COMPILE(struct X { int i; };
4037 struct Y { int i; };,
4038 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4039 ac_cv_cpp_reinterpret_cast=yes,
4040 ac_cv_cpp_reinterpret_cast=no)])
4041 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4042 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4045 dnl See if a dynamic_cast to void* gives the most derived object.
4046 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4047 ac_cv_cpp_dynamic_cast_void_ptr,
4048 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4049 class Y { int j; public: virtual ~Y() { } };
4050 class Z : public X, public Y { int k; };
4056 return !((((void*)&mdo != (void*)subx) &&
4057 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4058 (((void*)&mdo != (void*)suby) &&
4059 ((void*)&mdo == dynamic_cast<void*>(suby))));
4061 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4062 ac_cv_cpp_dynamic_cast_void_ptr=no,
4063 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4064 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4065 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4069 dnl note that this one is reversed - if the test fails, then
4070 dnl we require implementations of unused virtual methods. Which
4071 dnl really blows because it means we'll have useless vtable
4073 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4074 ac_cv_cpp_unused_required,
4075 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4077 ac_cv_cpp_unused_required=no,
4078 ac_cv_cpp_unused_required=yes)])
4079 if test "$ac_cv_cpp_unused_required" = yes ; then
4080 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4084 dnl Some compilers have trouble comparing a constant reference to a templatized
4085 dnl class to zero, and require an explicit operator==() to be defined that takes
4086 dnl an int. This test separates the strong from the weak.
4088 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4089 ac_cv_trouble_comparing_to_zero,
4090 [AC_TRY_COMPILE([#include <algorithm>
4091 template <class T> class Foo {};
4093 template <class T> int operator==(const T2*, const T&) { return 0; }
4094 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4095 [Foo<int> f; return (0 != f);],
4096 ac_cv_trouble_comparing_to_zero=no,
4097 ac_cv_trouble_comparing_to_zero=yes)])
4098 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4099 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4104 dnl End of C++ language/feature checks
4107 dnl ========================================================
4108 dnl = Internationalization checks
4109 dnl ========================================================
4111 dnl Internationalization and Locale support is different
4112 dnl on various UNIX platforms. Checks for specific i18n
4113 dnl features go here.
4115 dnl check for LC_MESSAGES
4116 AC_CACHE_CHECK(for LC_MESSAGES,
4117 ac_cv_i18n_lc_messages,
4118 [AC_TRY_COMPILE([#include <locale.h>],
4119 [int category = LC_MESSAGES;],
4120 ac_cv_i18n_lc_messages=yes,
4121 ac_cv_i18n_lc_messages=no)])
4122 if test "$ac_cv_i18n_lc_messages" = yes; then
4123 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4126 fi # SKIP_COMPILER_CHECKS
4129 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4130 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4133 dnl Mozilla specific options
4134 dnl ========================================================
4135 dnl The macros used for command line options
4136 dnl are defined in build/autoconf/altoptions.m4.
4139 dnl ========================================================
4141 dnl = Check for external package dependencies
4143 dnl ========================================================
4144 MOZ_ARG_HEADER(External Packages)
4148 MOZ_ARG_WITH_STRING(libxul-sdk,
4149 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4150 LIBXUL_SDK_DIR=$withval)
4152 if test "$LIBXUL_SDK_DIR" = "yes"; then
4153 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4154 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4155 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4157 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4158 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4163 AC_SUBST(LIBXUL_SDK)
4165 if test -n "$LIBXUL_SDK"; then
4166 LIBXUL_DIST="$LIBXUL_SDK"
4168 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4170 AC_SUBST(LIBXUL_DIST)
4174 MOZ_ARG_WITH_BOOL(system-libxul,
4175 [ --with-system-libxul Use system installed libxul SDK],
4178 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4179 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4182 dnl ========================================================
4183 dnl = If NSPR was not detected in the system,
4184 dnl = use the one in the source tree (mozilla/nsprpub)
4185 dnl ========================================================
4186 MOZ_ARG_WITH_BOOL(system-nspr,
4187 [ --with-system-nspr Use system installed NSPR],
4188 _USE_SYSTEM_NSPR=1 )
4190 if test -n "$_USE_SYSTEM_NSPR"; then
4191 AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4194 if test -n "$MOZ_NATIVE_NSPR"; then
4195 _SAVE_CFLAGS=$CFLAGS
4196 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4197 AC_TRY_COMPILE([#include "prlog.h"],
4198 [#ifndef PR_STATIC_ASSERT
4199 #error PR_STATIC_ASSERT not defined
4201 [MOZ_NATIVE_NSPR=1],
4202 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4203 CFLAGS=$_SAVE_CFLAGS
4205 if test "$OS_ARCH" = "WINCE"; then
4206 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4207 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4208 elif test "$OS_ARCH" = "WINNT"; then
4209 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4210 if test -n "$GNU_CC"; then
4211 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4213 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4216 NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4217 NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4221 dnl ========================================================
4222 dnl = If NSS was not detected in the system,
4223 dnl = use the one in the source tree (mozilla/security/nss)
4224 dnl ========================================================
4226 MOZ_ARG_WITH_BOOL(system-nss,
4227 [ --with-system-nss Use system installed NSS],
4230 if test -n "$_USE_SYSTEM_NSS"; then
4231 AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4234 if test -n "$MOZ_NATIVE_NSS"; then
4235 NSS_LIBS="$NSS_LIBS -lcrmf"
4237 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4239 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4240 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4241 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4242 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4243 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4245 if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4247 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4248 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4249 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4250 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4251 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4253 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4257 if test -z "$SKIP_LIBRARY_CHECKS"; then
4258 dnl system JPEG support
4259 dnl ========================================================
4260 MOZ_ARG_WITH_STRING(system-jpeg,
4261 [ --with-system-jpeg[=PFX]
4262 Use system libjpeg [installed at prefix PFX]],
4265 _SAVE_CFLAGS=$CFLAGS
4266 _SAVE_LDFLAGS=$LDFLAGS
4268 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4269 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4270 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4272 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4275 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4278 if test "$SYSTEM_JPEG" = 1; then
4279 LIBS="$JPEG_LIBS $LIBS"
4280 AC_TRY_COMPILE([ #include <stdio.h>
4281 #include <sys/types.h>
4282 #include <jpeglib.h> ],
4283 [ #if JPEG_LIB_VERSION < $MOZJPEG
4284 #error "Insufficient JPEG library version ($MOZJPEG required)."
4287 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4289 CFLAGS=$_SAVE_CFLAGS
4290 LDFLAGS=$_SAVE_LDFLAGS
4293 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4294 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4295 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4298 dnl system ZLIB support
4299 dnl ========================================================
4300 MOZ_ARG_WITH_STRING(system-zlib,
4301 [ --with-system-zlib[=PFX]
4302 Use system libz [installed at prefix PFX]],
4305 _SAVE_CFLAGS=$CFLAGS
4306 _SAVE_LDFLAGS=$LDFLAGS
4308 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4309 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4310 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4312 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4315 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4316 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4318 if test "$SYSTEM_ZLIB" = 1; then
4319 LIBS="$ZLIB_LIBS $LIBS"
4320 AC_TRY_COMPILE([ #include <stdio.h>
4322 #include <zlib.h> ],
4323 [ #if ZLIB_VERNUM < $MOZZLIB
4324 #error "Insufficient zlib version ($MOZZLIB required)."
4327 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4329 CFLAGS=$_SAVE_CFLAGS
4330 LDFLAGS=$_SAVE_LDFLAGS
4333 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4334 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4335 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4338 dnl system BZIP2 Support
4339 dnl ========================================================
4340 MOZ_ARG_WITH_STRING(system-bz2,
4341 [ --with-system-bz2[=PFX]
4342 Use system libbz2 [installed at prefix PFX]],
4345 _SAVE_CFLAGS=$CFLAGS
4346 _SAVE_LDFLAGS=$LDFLAGS
4348 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4349 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4350 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4352 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4355 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4356 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4358 CFLAGS=$_SAVE_CFLAGS
4359 LDFLAGS=$_SAVE_LDFLAGS
4362 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4363 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4364 BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4367 dnl system PNG Support
4368 dnl ========================================================
4369 MOZ_ARG_WITH_STRING(system-png,
4370 [ --with-system-png[=PFX]
4371 Use system libpng [installed at prefix PFX]],
4374 _SAVE_CFLAGS=$CFLAGS
4375 _SAVE_LDFLAGS=$LDFLAGS
4377 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4378 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4379 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4380 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4381 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4383 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4386 _SAVE_PNG_LIBS=$PNG_LIBS
4387 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4388 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4390 AC_CHECK_LIB(png, png_get_acTL, ,
4391 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4394 if test "$SYSTEM_PNG" = 1; then
4395 LIBS="$PNG_LIBS $LIBS"
4396 AC_TRY_COMPILE([ #include <stdio.h>
4397 #include <sys/types.h>
4399 [ #if PNG_LIBPNG_VER < $MOZPNG
4400 #error "Insufficient libpng version ($MOZPNG required)."
4402 #ifndef PNG_UINT_31_MAX
4403 #error "Insufficient libpng version."
4406 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4408 CFLAGS=$_SAVE_CFLAGS
4409 LDFLAGS=$_SAVE_LDFLAGS
4412 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4413 PNG_CFLAGS="-I${PNG_DIR}/include"
4414 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4417 fi # SKIP_LIBRARY_CHECKS
4419 dnl system HunSpell Support
4420 dnl ========================================================
4421 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4422 [ --enable-system-hunspell Use system hunspell (located with pkgconfig)],
4425 if test -n "$SYSTEM_HUNSPELL"; then
4426 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4429 AC_SUBST(SYSTEM_HUNSPELL)
4431 dnl ========================================================
4432 dnl Java SDK support
4433 dnl ========================================================
4435 MOZ_ARG_WITH_STRING(java-include-path,
4436 [ --with-java-include-path=dir Location of Java SDK headers],
4437 JAVA_INCLUDE_PATH=$withval)
4440 MOZ_ARG_WITH_STRING(java-bin-path,
4441 [ --with-java-bin-path=dir Location of Java binaries (java, javac, jar)],
4442 JAVA_BIN_PATH=$withval)
4444 dnl ========================================================
4445 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4446 dnl their usage and use them in spidermonkey.
4447 dnl ========================================================
4448 MOZ_ARG_WITH_BOOL(arm-kuser,
4449 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4452 if test -n "$USE_ARM_KUSER"; then
4453 AC_DEFINE(USE_ARM_KUSER)
4456 dnl ========================================================
4460 dnl ========================================================
4462 MOZ_ARG_HEADER(Application)
4466 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4467 MOZ_BRANDING_DIRECTORY=
4468 MOZ_OFFICIAL_BRANDING=
4469 MOZ_DBGRINFO_MODULES=
4471 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4472 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4479 MOZ_AUTH_EXTENSION=1
4480 MOZ_NO_ACTIVEX_SUPPORT=1
4481 MOZ_NO_INSPECTOR_APIS=
4489 MOZ_PLAINTEXT_EDITOR_ONLY=
4491 MOZ_PREF_EXTENSIONS=1
4492 MOZ_PROFILELOCKING=1
4501 MOZ_STATIC_MAIL_BUILD=
4506 MOZ_UNIVERSALCHARDET=1
4508 MOZ_USE_NATIVE_UCONV=
4510 MOZ_XPFE_COMPONENTS=1
4512 MOZ_XSLT_STANDALONE=
4520 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4521 NECKO_SMALL_BUFFERS=
4522 XPC_IDISPATCH_SUPPORT=
4525 case "$target_os" in
4534 case "$target_os" in
4535 msvc*|mks*|cygwin*|mingw*)
4537 if test -z "$GNU_CC"; then
4538 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4541 XPC_IDISPATCH_SUPPORT=1
4542 MOZ_NO_ACTIVEX_SUPPORT=
4544 if test -n "$NS_ENABLE_TSF"; then
4545 AC_DEFINE(NS_ENABLE_TSF)
4550 MOZ_ARG_ENABLE_STRING(application,
4551 [ --enable-application=APP
4555 content/xslt (Standalone Transformiix XSLT)
4556 netwerk (Standalone Necko)
4557 tools/update-packaging (AUS-related packaging tools)
4558 standalone (use this for standalone
4559 xpcom/xpconnect or to manually drive a build)],
4560 [ MOZ_BUILD_APP=$enableval ] )
4562 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4563 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4564 XULRUNNER_STUB_NAME=$withval)
4566 if test -z "$XULRUNNER_STUB_NAME"; then
4567 case "$target_os" in
4569 XULRUNNER_STUB_NAME=xulrunner
4572 XULRUNNER_STUB_NAME=xulrunner-stub
4575 AC_SUBST(XULRUNNER_STUB_NAME)
4577 if test -z "$MOZ_BUILD_APP"; then
4578 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4580 # We have a valid application only if it has a build.mk file in its top
4582 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4583 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4587 # Allow the application to influence configure with a confvars.sh script.
4589 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4590 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4591 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4592 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4597 # Now is a good time to test for logic errors, define mismatches, etc.
4598 case "$MOZ_BUILD_APP" in
4600 if test "$LIBXUL_SDK"; then
4601 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4606 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4607 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4609 case "$MOZ_BUILD_APP" in
4611 AC_DEFINE(MOZ_PHOENIX)
4615 AC_DEFINE(MOZ_XULRUNNER)
4623 MOZ_APP_NAME=mozilla
4624 MOZ_APP_DISPLAYNAME=Mozilla
4625 MOZ_APP_VERSION=$MOZILLA_VERSION
4630 AC_SUBST(MOZ_BUILD_APP)
4631 AC_SUBST(MOZ_PHOENIX)
4632 AC_SUBST(MOZ_XULRUNNER)
4634 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4636 dnl ========================================================
4638 dnl = Toolkit Options
4640 dnl ========================================================
4641 MOZ_ARG_HEADER(Toolkit Options)
4643 dnl ========================================================
4644 dnl = Select the default toolkit
4645 dnl ========================================================
4646 MOZ_ARG_ENABLE_STRING(default-toolkit,
4647 [ --enable-default-toolkit=TK
4648 Select default toolkit
4649 Platform specific defaults:
4651 Mac OS X - cairo-cocoa
4652 Neutrino/QNX - photon
4654 Win32/WinCE - cairo-windows
4655 Gtk2 with DirectFB - cairo-gtk2-dfb
4658 [ _DEFAULT_TOOLKIT=$enableval ],
4659 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4661 if test "$_DEFAULT_TOOLKIT" = "photon" \
4662 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4663 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4664 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4665 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4666 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4667 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4668 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4669 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4671 dnl nglayout only supports building with one toolkit,
4672 dnl so ignore everything after the first comma (",").
4673 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4675 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4678 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4680 dnl ========================================================
4681 dnl = Enable the toolkit as needed =
4682 dnl ========================================================
4684 case "$MOZ_WIDGET_TOOLKIT" in
4687 AC_DEFINE(MOZ_WIDGET_PHOTON)
4691 MOZ_WIDGET_TOOLKIT=windows
4694 cairo-gtk2|cairo-gtk2-x11)
4695 MOZ_WIDGET_TOOLKIT=gtk2
4697 MOZ_ENABLE_XREMOTE=1
4702 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4703 TK_LIBS='$(MOZ_GTK2_LIBS)'
4704 AC_DEFINE(MOZ_WIDGET_GTK2)
4708 MOZ_WIDGET_TOOLKIT=gtk2
4714 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4715 TK_LIBS='$(MOZ_GTK2_LIBS)'
4716 AC_DEFINE(MOZ_WIDGET_GTK2)
4717 if test "$no_x" != "yes"; then
4718 AC_MSG_WARN([Disabling X when DirectFB is specified.])
4724 MOZ_WIDGET_TOOLKIT=qt
4726 MOZ_ENABLE_XREMOTE=1
4733 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4734 TK_LIBS='$(MOZ_QT_LIBS)'
4735 AC_DEFINE(MOZ_WIDGET_QT)
4739 MOZ_WIDGET_TOOLKIT=beos
4740 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4741 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4745 MOZ_WIDGET_TOOLKIT=os2
4746 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4747 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4751 MOZ_WIDGET_TOOLKIT=cocoa
4752 AC_DEFINE(MOZ_WIDGET_COCOA)
4753 MOZ_USER_DIR="Mozilla"
4754 AC_DEFINE(XP_MACOSX)
4755 TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4756 TK_CFLAGS="-DNO_X11"
4757 LDFLAGS="$LDFLAGS -framework Cocoa"
4758 CFLAGS="$CFLAGS $TK_CFLAGS"
4759 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4760 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
4761 MOZ_FS_LAYOUT=bundle
4765 if test "$MOZ_ENABLE_XREMOTE"; then
4766 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4769 if test "$COMPILE_ENVIRONMENT"; then
4770 if test "$MOZ_ENABLE_GTK2"; then
4771 if test "$MOZ_X11"; then
4772 GDK_PACKAGES=gdk-x11-2.0
4773 elif test "$MOZ_DFB"; then
4774 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4775 GDK_PACKAGES=directfb
4778 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4781 fi # COMPILE_ENVIRONMENT
4783 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4784 AC_SUBST(MOZ_FS_LAYOUT)
4786 dnl ========================================================
4787 dnl = startup-notification support module
4788 dnl ========================================================
4790 if test "$MOZ_ENABLE_GTK2"
4792 MOZ_ENABLE_STARTUP_NOTIFICATION=
4794 MOZ_ARG_ENABLE_BOOL(startup-notification,
4795 [ --enable-startup-notification Enable startup-notification support (default: disabled) ],
4796 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4797 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4798 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4800 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4801 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4802 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4803 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4805 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4807 MOZ_ENABLE_STARTUP_NOTIFICATION=
4811 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4812 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4815 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4817 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4818 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4819 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4821 dnl ========================================================
4823 dnl ========================================================
4824 if test "$MOZ_ENABLE_QT"
4826 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4827 AC_SUBST(MOZ_QT_CFLAGS)
4828 AC_SUBST(MOZ_QT_LIBS)
4830 MOZ_ARG_WITH_STRING(qtdir,
4831 [ --with-qtdir=\$dir Specify Qt directory ],
4834 if test -z "$QTDIR"; then
4837 QTINCDIR="/include/qt"
4838 if test ! -d "$QTDIR$QTINCDIR"; then
4839 QTINCDIR="/include/X11/qt"
4841 if test ! -d "$QTDIR$QTINCDIR"; then
4845 if test -x "$QTDIR/bin/moc-qt4"; then
4846 HOST_MOC="$QTDIR/bin/moc-qt4"
4848 if test -x "$QTDIR/bin/moc"; then
4849 HOST_MOC="$QTDIR/bin/moc"
4851 AC_CHECK_PROGS(HOST_MOC, moc, "")
4854 if test -z "$HOST_MOC"; then
4855 AC_MSG_ERROR([no acceptable moc preprocessor found])
4860 AC_SUBST(GTK_CONFIG)
4864 AC_SUBST(MOZ_ENABLE_GTK2)
4865 AC_SUBST(MOZ_ENABLE_PHOTON)
4866 AC_SUBST(MOZ_ENABLE_QT)
4867 AC_SUBST(MOZ_ENABLE_XREMOTE)
4868 AC_SUBST(MOZ_GTK2_CFLAGS)
4869 AC_SUBST(MOZ_GTK2_LIBS)
4870 AC_SUBST(MOZ_QT_CFLAGS)
4871 AC_SUBST(MOZ_QT_LIBS)
4878 dnl ========================================================
4880 dnl = Components & Features
4882 dnl ========================================================
4883 MOZ_ARG_HEADER(Components and Features)
4885 dnl ========================================================
4887 dnl ========================================================
4888 MOZ_ARG_ENABLE_STRING(ui-locale,
4889 [ --enable-ui-locale=ab-CD
4890 Select the user interface locale (default: en-US)],
4891 MOZ_UI_LOCALE=$enableval )
4892 AC_SUBST(MOZ_UI_LOCALE)
4894 dnl ========================================================
4895 dnl = Trademarked Branding
4896 dnl ========================================================
4897 MOZ_ARG_ENABLE_BOOL(official-branding,
4898 [ --enable-official-branding Enable Official mozilla.org Branding
4899 Do not distribute builds with
4900 --enable-official-branding unless you have
4901 permission to use trademarks per
4902 http://www.mozilla.org/foundation/trademarks/ .],
4904 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4905 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4907 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4908 MOZ_OFFICIAL_BRANDING=1
4910 ], MOZ_OFFICIAL_BRANDING=)
4912 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4913 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4914 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4917 MOZ_ARG_WITH_STRING(branding,
4918 [ --with-branding=dir Use branding from the specified directory.],
4919 MOZ_BRANDING_DIRECTORY=$withval)
4921 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4922 if test -z "$REAL_BRANDING_DIRECTORY"; then
4923 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4926 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4927 . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4930 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4932 dnl ========================================================
4933 dnl = Distribution ID
4934 dnl ========================================================
4935 MOZ_ARG_WITH_STRING(distribution-id,
4936 [ --with-distribution-id=ID Set distribution-specific id (default=org.mozilla)],
4937 [ val=`echo $withval`
4938 MOZ_DISTRIBUTION_ID="$val"])
4940 if test -z "$MOZ_DISTRIBUTION_ID"; then
4941 MOZ_DISTRIBUTION_ID="org.mozilla"
4944 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4945 AC_SUBST(MOZ_DISTRIBUTION_ID)
4948 dnl ========================================================
4949 dnl complex text support off by default
4950 dnl ========================================================
4952 MOZ_ARG_DISABLE_BOOL(pango,
4953 [ --disable-pango Disable usage of Pango ],
4958 dnl ========================================================
4960 dnl ========================================================
4961 if test "$MOZ_ENABLE_GTK2"
4965 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4967 if test "$MOZ_PANGO"
4969 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4970 AC_SUBST(MOZ_PANGO_CFLAGS)
4971 AC_SUBST(MOZ_PANGO_LIBS)
4972 AC_DEFINE(MOZ_PANGO)
4974 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4975 AC_SUBST(MOZ_PANGO_CFLAGS)
4976 AC_SUBST(MOZ_PANGO_LIBS)
4978 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
4979 AC_SUBST(FT2_CFLAGS)
4984 dnl ========================================================
4985 dnl = GnomeVFS support module
4986 dnl ========================================================
4990 dnl build the gnomevfs extension by default only when the
4991 dnl GTK2 toolkit is in use.
4992 if test "$MOZ_ENABLE_GTK2"
4994 MOZ_ENABLE_GNOMEVFS=1
4998 MOZ_ARG_DISABLE_BOOL(gnomevfs,
4999 [ --disable-gnomevfs Disable GnomeVFS support ],
5000 MOZ_ENABLE_GNOMEVFS=,
5001 MOZ_ENABLE_GNOMEVFS=force)
5003 if test "$MOZ_ENABLE_GNOMEVFS"
5005 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5006 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5007 MOZ_ENABLE_GNOMEVFS=1
5008 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5010 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5012 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5014 MOZ_ENABLE_GNOMEVFS=
5018 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5019 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5020 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5022 if test "$MOZ_ENABLE_GCONF"
5024 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5025 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5032 if test "$MOZ_ENABLE_GCONF"; then
5033 AC_DEFINE(MOZ_ENABLE_GCONF)
5036 AC_SUBST(MOZ_ENABLE_GCONF)
5037 AC_SUBST(MOZ_GCONF_CFLAGS)
5038 AC_SUBST(MOZ_GCONF_LIBS)
5040 dnl ========================================================
5041 dnl = GIO support module
5042 dnl ========================================================
5043 MOZ_ARG_ENABLE_BOOL(gio,
5044 [ --enable-gio Enable GIO support (default: disabled)],
5045 MOZ_ENABLE_GIO=force,
5048 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5050 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5051 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5053 AC_DEFINE(MOZ_ENABLE_GIO)
5055 if test "$MOZ_ENABLE_GIO" = "force"
5057 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5063 AC_SUBST(MOZ_ENABLE_GIO)
5064 AC_SUBST(MOZ_GIO_CFLAGS)
5065 AC_SUBST(MOZ_GIO_LIBS)
5068 dnl ========================================================
5069 dnl = libgnomeui support module
5070 dnl ========================================================
5072 if test "$MOZ_ENABLE_GTK2"
5074 MOZ_ENABLE_GNOMEUI=1
5076 MOZ_ARG_DISABLE_BOOL(gnomeui,
5077 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5078 MOZ_ENABLE_GNOMEUI=,
5079 MOZ_ENABLE_GNOMEUI=force)
5081 if test "$MOZ_ENABLE_GNOMEUI"
5083 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5085 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5086 MOZ_ENABLE_GNOMEUI=1
5088 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5090 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5096 if test "$MOZ_ENABLE_GNOMEUI"; then
5097 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5100 # The GNOME component is built if gtk2, gconf and gnome-vfs
5101 # are all available.
5103 if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" && \
5104 (test "$MOZ_ENABLE_GNOMEVFS" || test "$MOZ_ENABLE_GIO"); then
5105 MOZ_ENABLE_GNOME_COMPONENT=1
5107 MOZ_ENABLE_GNOME_COMPONENT=
5110 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5112 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5113 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5114 AC_SUBST(MOZ_GNOMEUI_LIBS)
5116 dnl ========================================================
5118 dnl ========================================================
5120 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5124 MOZ_ARG_DISABLE_BOOL(dbus,
5125 [ --disable-dbus Disable dbus support ],
5129 if test "$MOZ_ENABLE_DBUS"
5131 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5132 AC_DEFINE(MOZ_ENABLE_DBUS)
5135 AC_SUBST(MOZ_ENABLE_DBUS)
5136 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5137 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5139 dnl ========================================================
5140 dnl = libnotify support
5141 dnl ========================================================
5143 if test "$MOZ_ENABLE_GTK2"
5145 MOZ_ENABLE_LIBNOTIFY=1
5147 MOZ_ARG_DISABLE_BOOL(libnotify,
5148 [ --disable-libnotify Disable libnotify support ],
5149 MOZ_ENABLE_LIBNOTIFY=,
5150 MOZ_ENABLE_LIBNOTIFY=1)
5152 if test "$MOZ_ENABLE_LIBNOTIFY"
5154 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5158 if test -z "$SKIP_LIBRARY_CHECKS"
5160 if test "$MOZ_ENABLE_GTK2"
5162 if test "$MOZ_ENABLE_LIBNOTIFY"
5164 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5168 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5169 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5170 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5172 dnl ========================================================
5173 dnl = Build Personal Security Manager
5174 dnl ========================================================
5175 MOZ_ARG_DISABLE_BOOL(crypto,
5176 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5180 dnl ========================================================
5181 dnl = JS Debugger XPCOM component (js/jsd)
5182 dnl ========================================================
5183 MOZ_ARG_DISABLE_BOOL(jsd,
5184 [ --disable-jsd Disable JavaScript debug library],
5189 dnl ========================================================
5190 dnl = Disable plugin support
5191 dnl ========================================================
5192 MOZ_ARG_DISABLE_BOOL(plugins,
5193 [ --disable-plugins Disable plugins support],
5197 dnl ========================================================
5198 dnl = Disable building dbm
5199 dnl ========================================================
5200 MOZ_ARG_DISABLE_BOOL(dbm,
5201 [ --disable-dbm Disable building dbm],
5205 dnl bi-directional support always on
5209 dnl ========================================================
5210 dnl view source support on by default
5211 dnl ========================================================
5212 if test "$MOZ_VIEW_SOURCE"; then
5213 AC_DEFINE(MOZ_VIEW_SOURCE)
5216 dnl ========================================================
5217 dnl accessibility support on by default on all platforms
5219 dnl ========================================================
5220 MOZ_ARG_DISABLE_BOOL(accessibility,
5221 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5224 if test "$ACCESSIBILITY"; then
5225 AC_DEFINE(ACCESSIBILITY)
5228 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5230 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5231 if test "$ac_cv_header_atlbase_h" = "no"; then
5232 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.])
5234 if test "$ac_cv_header_oleacc_idl" = "no"; then
5235 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.])
5241 dnl ========================================================
5242 dnl xpfe/components on by default
5243 dnl ========================================================
5244 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5245 [ --disable-xpfe-components
5246 Disable xpfe components],
5247 MOZ_XPFE_COMPONENTS=,
5248 MOZ_XPFE_COMPONENTS=1 )
5250 dnl ========================================================
5251 dnl xpinstall support on by default
5252 dnl ========================================================
5253 MOZ_ARG_DISABLE_BOOL(xpinstall,
5254 [ --disable-xpinstall Disable xpinstall support],
5257 if test "$MOZ_XPINSTALL"; then
5258 AC_DEFINE(MOZ_XPINSTALL)
5261 dnl ========================================================
5262 dnl xpcom js loader support on by default
5263 dnl ========================================================
5264 if test "$MOZ_JSLOADER"; then
5265 AC_DEFINE(MOZ_JSLOADER)
5268 dnl ========================================================
5269 dnl Disable printing
5270 dnl ========================================================
5271 MOZ_ARG_DISABLE_BOOL(printing,
5272 [ --disable-printing Disable printing support],
5276 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5277 AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5281 if test "$NS_PRINTING"; then
5282 AC_DEFINE(NS_PRINTING)
5283 AC_DEFINE(NS_PRINT_PREVIEW)
5286 dnl ========================================================
5287 dnl use native unicode converters
5288 dnl ========================================================
5289 MOZ_ARG_ENABLE_BOOL(native-uconv,
5290 [ --enable-native-uconv Enable iconv support],
5291 MOZ_USE_NATIVE_UCONV=1,
5292 MOZ_USE_NATIVE_UCONV= )
5293 if test "$MOZ_USE_NATIVE_UCONV"; then
5294 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5296 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5297 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5301 dnl ========================================================
5302 dnl Libeditor can be build as plaintext-only,
5303 dnl or as a full html and text editing component.
5304 dnl We build both by default.
5305 dnl ========================================================
5306 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5307 [ --enable-plaintext-editor-only
5308 Allow only plaintext editing],
5309 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5310 MOZ_PLAINTEXT_EDITOR_ONLY= )
5311 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5312 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5314 dnl ========================================================
5315 dnl = Disable Fast Load
5316 dnl ========================================================
5317 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5318 [ --disable-xpcom-fastload Disable XPCOM fastload support],
5322 AC_SUBST(MOZ_NO_FAST_LOAD)
5324 if test -n "$MOZ_NO_FAST_LOAD"; then
5325 AC_DEFINE(MOZ_NO_FAST_LOAD)
5328 dnl ========================================================
5329 dnl = Disable Ogg Codecs
5330 dnl ========================================================
5331 MOZ_ARG_DISABLE_BOOL(ogg,
5332 [ --disable-ogg Disable Ogg Codec support],
5338 if test -n "$MOZ_OGG"; then
5343 dnl Checks for __attribute__(aligned()) directive
5344 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5345 [ac_cv_c_attribute_aligned],
5346 [ac_cv_c_attribute_aligned=0
5347 CFLAGS_save="${CFLAGS}"
5348 CFLAGS="${CFLAGS} -Werror"
5349 for ac_cv_c_attr_align_try in 64 32 16 8; do
5350 echo "trying $ac_cv_c_attr_align_try"
5352 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5353 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5354 if test "$ac_cv_c_attribute_aligned" != 0; then
5358 CFLAGS="${CFLAGS_save}"])
5359 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5360 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5361 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5365 dnl ========================================================
5366 dnl = Disable Wave decoder support
5367 dnl ========================================================
5368 MOZ_ARG_DISABLE_BOOL(wave,
5369 [ --disable-wave Disable Wave decoder support],
5375 if test -n "$MOZ_WAVE"; then
5381 dnl ========================================================
5382 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5383 dnl ========================================================
5385 AC_SUBST(MOZ_SYDNEYAUDIO)
5387 if test -n "$MOZ_SYDNEYAUDIO"; then
5388 AC_DEFINE(MOZ_SYDNEYAUDIO)
5393 if test -n "$MOZ_MEDIA"; then
5394 AC_DEFINE(MOZ_MEDIA)
5397 dnl ========================================================
5398 dnl = Check alsa availability on Linux if using sydneyaudio
5399 dnl ========================================================
5401 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5402 if test -n "$MOZ_SYDNEYAUDIO"; then
5403 case "$target_os" in
5405 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5406 [echo "$MOZ_ALSA_PKG_ERRORS"
5407 AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux. Disable with --disable-ogg --disable-wave.])])
5411 AC_SUBST(MOZ_ALSA_LIBS)
5413 dnl ========================================================
5415 dnl ========================================================
5416 AC_ARG_ENABLE(splashscreen,
5417 [ --enable-splashscreen display splashscreen while loading (default=no)],
5418 [enable_splash="yes"],[enable_splash=""])
5419 if test "x$enable_splash" = "xyes"; then
5421 AC_DEFINE(MOZ_SPLASHSCREEN)
5423 AC_SUBST(MOZ_SPLASHSCREEN)
5425 dnl ========================================================
5426 dnl Permissions System
5427 dnl ========================================================
5428 MOZ_ARG_DISABLE_BOOL(permissions,
5429 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5434 dnl ========================================================
5436 dnl ========================================================
5437 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5438 [ --disable-negotiateauth Disable GSS-API negotiation ],
5439 MOZ_AUTH_EXTENSION=,
5440 MOZ_AUTH_EXTENSION=1 )
5442 dnl ========================================================
5444 dnl ========================================================
5445 MOZ_ARG_DISABLE_BOOL(xtf,
5446 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5449 if test "$MOZ_XTF"; then
5453 dnl ========================================================
5454 dnl Pref extensions (autoconfig and system-pref)
5455 dnl ========================================================
5456 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5457 [ --disable-pref-extensions
5458 Disable pref extensions such as autoconfig and
5460 MOZ_PREF_EXTENSIONS=,
5461 MOZ_PREF_EXTENSIONS=1 )
5463 dnl ========================================================
5464 dnl = Universalchardet
5465 dnl ========================================================
5466 MOZ_ARG_DISABLE_BOOL(universalchardet,
5467 [ --disable-universalchardet
5468 Disable universal encoding detection],
5469 MOZ_UNIVERSALCHARDET=,
5470 MOZ_UNIVERSALCHARDET=1 )
5472 dnl ========================================================
5474 dnl ========================================================
5475 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5476 [ --enable-javaxpcom
5477 Enable Java-XPCOM bridge],
5481 if test -n "${MOZ_JAVAXPCOM}"; then
5484 if test -n "$JAVA_HOME"; then
5485 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5489 if test -n "$JAVA_HOME"; then
5490 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5495 if test -n "${JAVA_INCLUDE_PATH}"; then
5496 dnl Make sure jni.h exists in the given include path.
5497 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5498 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5501 case "$target_os" in
5503 dnl Default to java system location
5504 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5508 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5511 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5512 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.])
5516 if test -n "${JAVA_BIN_PATH}"; then
5517 dnl Look for javac and jar in the specified path.
5518 JAVA_PATH="$JAVA_BIN_PATH"
5520 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5521 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5524 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5525 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5526 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5527 if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5528 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.])
5532 dnl ========================================================
5533 dnl = Breakpad crash reporting (on by default on supported platforms)
5534 dnl ========================================================
5536 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5537 || test "$OS_ARCH" = "Darwin" \
5538 || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5539 || test "$OS_ARCH" = "SunOS") \
5540 && test -z "$HAVE_64BIT_OS"; then
5544 MOZ_ARG_DISABLE_BOOL(crashreporter,
5545 [ --disable-crashreporter Disable breakpad crash reporting],
5547 MOZ_CRASHREPORTER=1)
5549 if test -n "$MOZ_CRASHREPORTER"; then
5550 AC_DEFINE(MOZ_CRASHREPORTER)
5552 if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5553 test -z "$SKIP_LIBRARY_CHECKS"; then
5554 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5555 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5556 AC_SUBST(MOZ_GTHREAD_LIBS)
5558 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.])])
5562 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5563 [ --with-crashreporter-enable-percent=NN Enable sending crash reports by default on NN% of users. (default=100)],
5564 [ val=`echo $withval | sed 's/[^0-9]//g'`
5565 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5567 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5568 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5570 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5572 dnl ========================================================
5573 dnl = Enable compilation of specific extension modules
5574 dnl ========================================================
5576 MOZ_ARG_ENABLE_STRING(extensions,
5577 [ --enable-extensions Enable extensions],
5578 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5579 if test "$option" = "yes" || test "$option" = "all"; then
5580 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5581 elif test "$option" = "no" || test "$option" = "none"; then
5583 elif test "$option" = "default"; then
5584 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5585 elif test `echo "$option" | grep -c \^-` != 0; then
5586 option=`echo $option | sed 's/^-//'`
5587 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5589 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5592 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5594 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5595 # Suppress warning on non-X11 platforms
5596 if test -n "$MOZ_X11"; then
5597 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5599 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5602 dnl Do not build gnomevfs with libxul based apps
5603 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5604 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5607 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5608 # Suppress warning on non-X11 platforms
5609 if test -n "$MOZ_X11"; then
5610 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5612 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5615 dnl Do not build gio with libxul based apps
5616 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5617 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5620 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5621 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5622 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5625 dnl This might be temporary: build tridentprofile only on Windows
5626 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5627 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5628 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5631 dnl cookie must be built before tridentprofile. put it at list's end.
5632 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5633 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5634 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5637 dnl xforms requires xtf and schema-validation
5638 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5639 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
5640 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5642 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5643 AC_MSG_WARN([Cannot build XForms without schema validation. Removing XForms from MOZ_EXTENSIONS.])
5644 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5647 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5648 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5649 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5652 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5653 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5654 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5657 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5658 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5659 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5662 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5663 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5664 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5667 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5668 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5669 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5672 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5673 AC_MSG_WARN([spellcheck is no longer an extension.])
5674 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5678 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5680 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5681 dnl when trying to build a non-existent extension.
5682 for extension in $MOZ_EXTENSIONS; do
5683 if test ! -d "${srcdir}/extensions/${extension}"; then
5684 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5689 dnl ========================================================
5691 dnl ========================================================
5692 case "$MOZ_WIDGET_TOOLKIT" in
5693 beos|windows|os2|mac|cocoa)
5696 if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5697 MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5702 MOZ_ARG_ENABLE_STRING(image-decoders,
5703 [ --enable-image-decoders[={mod1,mod2,default,all,none}]
5704 Enable specific image decoders],
5705 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5706 if test "$option" = "yes" || test "$option" = "all"; then
5707 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5708 elif test "$option" = "no" || test "$option" = "none"; then
5710 elif test "$option" = "default"; then
5711 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5712 elif test `echo "$option" | grep -c \^-` != 0; then
5713 option=`echo $option | sed 's/^-//'`
5714 MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5716 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5719 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5721 dnl Dupes are removed in the encoder section because it will also add decoders
5723 dnl ========================================================
5725 dnl ========================================================
5726 MOZ_ARG_ENABLE_STRING(image-encoders,
5727 [ --enable-image-encoders[={mod1,mod2,default,all,none}]
5728 Enable specific image encoders],
5729 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5730 if test "$option" = "yes" || test "$option" = "all"; then
5731 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5732 elif test "$option" = "no" || test "$option" = "none"; then
5735 elif test "$option" = "default"; then
5736 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5737 elif test `echo "$option" | grep -c \^-` != 0; then
5738 option=`echo $option | sed 's/^-//'`
5739 addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5741 addencoder="$option"
5743 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5745 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5748 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5749 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5751 dnl ========================================================
5752 dnl MathML on by default
5753 dnl ========================================================
5754 MOZ_ARG_DISABLE_BOOL(mathml,
5755 [ --disable-mathml Disable MathML support],
5758 if test "$MOZ_MATHML"; then
5759 AC_DEFINE(MOZ_MATHML)
5762 dnl ========================================================
5764 dnl ========================================================
5765 MOZ_ARG_DISABLE_BOOL(svg,
5766 [ --disable-svg Disable SVG support],
5769 if test -n "$MOZ_SVG"; then
5773 dnl ========================================================
5775 dnl ========================================================
5777 MOZ_ARG_DISABLE_BOOL(smil,
5778 [ --disable-smil Disable SMIL animation support],
5781 # Automatically disable SMIL if SVG is disabled
5782 if test -z "$MOZ_SVG"; then
5785 if test -n "$MOZ_SMIL"; then
5789 dnl ========================================================
5790 dnl Build Freetype in the tree
5791 dnl ========================================================
5792 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5793 [ --enable-tree-freetype Enable Tree FreeType],
5794 MOZ_TREE_FREETYPE=1,
5795 MOZ_TREE_FREETYPE= )
5796 if test -n "$MOZ_TREE_FREETYPE"; then
5797 AC_DEFINE(MOZ_TREE_FREETYPE)
5798 AC_SUBST(MOZ_TREE_FREETYPE)
5799 MOZ_ENABLE_CAIRO_FT=1
5800 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5801 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5802 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5803 FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5804 CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5805 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5806 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
5807 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
5808 AC_SUBST(CAIRO_FT_CFLAGS)
5812 dnl ========================================================
5814 dnl ========================================================
5815 case "$target_os" in
5816 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5821 MOZ_ARG_DISABLE_BOOL(installer,
5822 [ --disable-installer Disable building of installer],
5825 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
5826 # Disable installer for Windows builds that use the new toolkit if NSIS
5827 # isn't in the path.
5828 MOZ_PATH_PROGS(MAKENSIS, makensis)
5829 if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5830 AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5832 # The Windows build for NSIS requires the iconv command line utility to
5833 # convert the charset of the locale files.
5834 MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5835 if test -z "$HOST_ICONV"; then
5836 AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5840 # Automatically disable installer if xpinstall isn't built
5841 if test -z "$MOZ_XPINSTALL"; then
5844 AC_SUBST(MOZ_INSTALLER)
5846 AC_MSG_CHECKING([for tar archiver])
5847 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5848 if test -z "$TAR"; then
5849 AC_MSG_ERROR([no tar archiver found in \$PATH])
5851 AC_MSG_RESULT([$TAR])
5854 AC_MSG_CHECKING([for wget])
5855 AC_CHECK_PROGS(WGET, wget, "")
5856 AC_MSG_RESULT([$WGET])
5859 dnl ========================================================
5861 dnl ========================================================
5863 MOZ_ARG_DISABLE_BOOL(updater,
5864 [ --disable-updater Disable building of updater],
5867 AC_SUBST(MOZ_UPDATER)
5869 # app update channel is 'default' when not supplied.
5870 MOZ_ARG_ENABLE_STRING([update-channel],
5871 [ --enable-update-channel=CHANNEL
5872 Select application update channel (default=default)],
5873 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5875 if test -z "$MOZ_UPDATE_CHANNEL"; then
5876 MOZ_UPDATE_CHANNEL=default
5878 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5880 # tools/update-packaging is not checked out by default.
5881 MOZ_ARG_ENABLE_BOOL(update-packaging,
5882 [ --enable-update-packaging
5883 Enable tools/update-packaging],
5884 MOZ_UPDATE_PACKAGING=1,
5885 MOZ_UPDATE_PACKAGING= )
5886 AC_SUBST(MOZ_UPDATE_PACKAGING)
5888 dnl ========================================================
5890 dnl ========================================================
5892 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5893 [ --disable-xpconnect-idispatch
5894 Disable building of xpconnect support for IDispatch
5896 XPC_IDISPATCH_SUPPORT=,
5897 XPC_IDISPATCH_SUPPORT=1)
5898 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5900 MOZ_ARG_DISABLE_BOOL(activex,
5901 [ --disable-activex Disable building of ActiveX control (win32 only)],
5902 MOZ_NO_ACTIVEX_SUPPORT=1,
5903 MOZ_NO_ACTIVEX_SUPPORT= )
5904 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5906 MOZ_ARG_ENABLE_BOOL(activex-scripting,
5907 [ --enable-activex-scripting
5908 Enable building of ActiveX scripting support (win32)],
5909 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
5910 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
5911 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5913 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5915 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5918 if test "$COMPILE_ENVIRONMENT" = "1"; then
5919 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5921 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5922 if test "$ac_cv_header_atlbase_h" = "no"; then
5923 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.])
5930 dnl ========================================================
5932 dnl ========================================================
5933 MOZ_ARG_ENABLE_BOOL(leaky,
5934 [ --enable-leaky Build leaky memory tool],
5939 dnl ========================================================
5941 dnl ========================================================
5942 MOZ_ARG_ENABLE_BOOL(xpctools,
5943 [ --enable-xpctools Build JS profiling tool],
5948 dnl ========================================================
5949 dnl build the tests by default
5950 dnl ========================================================
5951 MOZ_ARG_DISABLE_BOOL(tests,
5952 [ --disable-tests Do not build test libraries & programs],
5956 dnl ========================================================
5957 dnl parental controls (for Windows Vista)
5958 dnl ========================================================
5959 MOZ_ARG_DISABLE_BOOL(parental-controls,
5960 [ --disable-parental-controls
5961 Do not build parental controls],
5962 MOZ_DISABLE_PARENTAL_CONTROLS=1,
5963 MOZ_DISABLE_PARENTAL_CONTROLS=)
5964 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5965 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5968 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5970 dnl ========================================================
5972 dnl = Module specific options
5974 dnl ========================================================
5975 MOZ_ARG_HEADER(Individual module options)
5977 dnl ========================================================
5978 dnl = Enable places (new history/bookmarks)
5979 dnl ========================================================
5980 MOZ_ARG_ENABLE_BOOL(places,
5981 [ --enable-places Enable 'places' bookmark/history implementation],
5984 if test -n "$MOZ_PLACES"; then
5985 AC_DEFINE(MOZ_PLACES)
5986 if test -z "$MOZ_MAIL_NEWS"; then
5991 if test "$MOZ_BUILD_APP" = "browser"; then
5992 AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5996 dnl ========================================================
5997 dnl = Disable feed handling components
5998 dnl ========================================================
5999 MOZ_ARG_DISABLE_BOOL(feeds,
6000 [ --disable-feeds Disable feed handling and processing components],
6003 if test -n "$MOZ_FEEDS"; then
6004 AC_DEFINE(MOZ_FEEDS)
6006 if test "$MOZ_BUILD_APP" = "browser"; then
6007 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6011 dnl ========================================================
6012 dnl = Enable mozStorage
6013 dnl ========================================================
6014 dnl Implicitly enabled by default if building calendar or places
6015 MOZ_ARG_ENABLE_BOOL(storage,
6016 [ --enable-storage Enable mozStorage module and related components],
6019 if test -n "$MOZ_STORAGE"; then
6020 AC_DEFINE(MOZ_STORAGE)
6023 dnl ========================================================
6024 dnl Check for sqlite
6025 dnl ========================================================
6028 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6029 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6030 MOZ_NATIVE_SQLITE=1,
6031 MOZ_NATIVE_SQLITE= )
6033 if test -z "$MOZ_NATIVE_SQLITE"
6036 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6038 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6041 AC_SUBST(MOZ_NATIVE_SQLITE)
6043 dnl ========================================================
6044 dnl = Enable help viewer (off by default)
6045 dnl ========================================================
6046 MOZ_ARG_ENABLE_BOOL(help-viewer,
6047 [ --enable-help-viewer Enable help viewer],
6050 if test -n "$MOZ_HELP_VIEWER"; then
6051 AC_DEFINE(MOZ_HELP_VIEWER)
6053 AC_SUBST(MOZ_HELP_VIEWER)
6054 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6055 AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6058 dnl ========================================================
6059 dnl = Enable safe browsing (anti-phishing)
6060 dnl ========================================================
6061 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6062 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6063 MOZ_SAFE_BROWSING=1,
6064 MOZ_SAFE_BROWSING= )
6065 if test -n "$MOZ_SAFE_BROWSING"; then
6066 AC_DEFINE(MOZ_SAFE_BROWSING)
6068 AC_SUBST(MOZ_SAFE_BROWSING)
6070 dnl ========================================================
6071 dnl = Enable faststart component
6072 dnl ========================================================
6073 MOZ_ARG_ENABLE_BOOL(faststart,
6074 [ --enable-faststart Enable the faststart component],
6077 if test -n "$MOZ_FASTSTART"; then
6078 AC_DEFINE(MOZ_FASTSTART)
6080 AC_SUBST(MOZ_FASTSTART)
6082 dnl ========================================================
6083 dnl = Enable url-classifier
6084 dnl ========================================================
6085 dnl Implicitly enabled by default if building with safe-browsing
6086 if test -n "$MOZ_SAFE_BROWSING"; then
6087 MOZ_URL_CLASSIFIER=1
6089 MOZ_ARG_ENABLE_BOOL(url-classifier,
6090 [ --enable-url-classifier Enable url classifier module],
6091 MOZ_URL_CLASSIFIER=1,
6092 MOZ_URL_CLASSIFIER= )
6093 if test -n "$MOZ_URL_CLASSIFIER"; then
6094 AC_DEFINE(MOZ_URL_CLASSIFIER)
6096 AC_SUBST(MOZ_URL_CLASSIFIER)
6098 dnl ========================================================
6099 dnl = Disable zipwriter
6100 dnl ========================================================
6101 MOZ_ARG_DISABLE_BOOL(zipwriter,
6102 [ --disable-zipwriter Disable zipwriter component],
6105 AC_SUBST(MOZ_ZIPWRITER)
6107 dnl ========================================================
6108 dnl = Hildon and OSSO checks
6109 dnl ========================================================
6110 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6111 MOZ_PLATFORM_HILDON=1,
6112 MOZ_PLATFORM_HILDON=)
6113 if test $MOZ_PLATFORM_HILDON; then
6114 AC_DEFINE(MOZ_PLATFORM_HILDON)
6115 X11_COMPOSITED_PLUGINS="yes"
6117 AC_SUBST(LIBHILDONMIME_CFLAGS)
6118 AC_SUBST(LIBHILDONMIME_LIBS)
6120 if test "$X11_COMPOSITED_PLUGINS" = "yes"; then
6121 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6122 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6123 [AC_MSG_ERROR([Couldn't find X11/extentsions/Xdamage.h which is required for composited plugins.])])
6124 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6125 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6127 AC_SUBST(XCOMPOSITE_LIBS)
6129 PKG_CHECK_MODULES(LIBOSSO,libosso,
6133 if test $NS_OSSO; then
6134 if test -z "$MOZ_ENABLE_DBUS"; then
6135 AC_MSG_ERROR([DBus is required when building for OSSO])
6138 MOZ_GFX_OPTIMIZE_MOBILE=1
6140 AC_SUBST(LIBOSSO_CFLAGS)
6141 AC_SUBST(LIBOSSO_LIBS)
6143 dnl ========================================================
6144 dnl = faststripe theme
6145 dnl ========================================================
6146 MOZ_ARG_ENABLE_BOOL(faststripe,
6147 [ --enable-faststripe Use faststripe theme],
6148 MOZ_THEME_FASTSTRIPE=1,
6149 MOZ_THEME_FASTSTRIPE= )
6150 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6152 dnl ========================================================
6154 dnl = Feature options that require extra sources to be pulled
6156 dnl ========================================================
6157 dnl MOZ_ARG_HEADER(Features that require extra sources)
6159 dnl ========================================================
6161 dnl = Debugging Options
6163 dnl ========================================================
6164 MOZ_ARG_HEADER(Debugging and Optimizations)
6166 dnl ========================================================
6167 dnl = Disable building with debug info.
6168 dnl = Debugging is OFF by default
6169 dnl ========================================================
6170 if test -z "$MOZ_DEBUG_FLAGS"
6174 if test "$GNU_CC"; then
6175 GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6176 case "$GCC_VERSION" in
6181 MOZ_DEBUG_FLAGS="-g"
6185 MOZ_DEBUG_FLAGS="-g"
6189 MOZ_DEBUG_FLAGS="-g"
6194 MOZ_ARG_ENABLE_STRING(debug,
6195 [ --enable-debug[=DBG] Enable building with developer debug info
6196 (Using compiler flags DBG)],
6197 [ if test "$enableval" != "no"; then
6199 if test -n "$enableval" && test "$enableval" != "yes"; then
6200 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6207 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6208 case "${target_os}" in
6210 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6212 msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6213 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6216 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6219 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6221 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6223 if test -n "$MOZ_DEBUG"; then
6224 AC_MSG_CHECKING([for valid debug flags])
6225 _SAVE_CFLAGS=$CFLAGS
6226 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6227 AC_TRY_COMPILE([#include <stdio.h>],
6228 [printf("Hello World\n");],
6231 AC_MSG_RESULT([$_results])
6232 if test "$_results" = "no"; then
6233 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6235 CFLAGS=$_SAVE_CFLAGS
6238 dnl ========================================================
6239 dnl enable mobile optimizations
6240 dnl ========================================================
6241 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6242 [ --enable-mobile-optimize Enable mobile optimizations],
6243 MOZ_GFX_OPTIMIZE_MOBILE=1)
6245 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6247 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6248 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6251 dnl ========================================================
6252 dnl = Enable code optimization. ON by default.
6253 dnl ========================================================
6254 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6255 MOZ_OPTIMIZE_FLAGS="-O"
6258 MOZ_ARG_ENABLE_STRING(optimize,
6259 [ --disable-optimize Disable compiler optimization
6260 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6261 [ if test "$enableval" != "no"; then
6263 if test -n "$enableval" && test "$enableval" != "yes"; then
6264 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6269 fi ], MOZ_OPTIMIZE=1)
6271 if test "$COMPILE_ENVIRONMENT"; then
6272 if test -n "$MOZ_OPTIMIZE"; then
6273 AC_MSG_CHECKING([for valid optimization flags])
6274 _SAVE_CFLAGS=$CFLAGS
6275 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6276 AC_TRY_COMPILE([#include <stdio.h>],
6277 [printf("Hello World\n");],
6280 AC_MSG_RESULT([$_results])
6281 if test "$_results" = "no"; then
6282 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6284 CFLAGS=$_SAVE_CFLAGS
6286 fi # COMPILE_ENVIRONMENT
6288 AC_SUBST(MOZ_OPTIMIZE)
6289 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6290 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6291 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6293 dnl ========================================================
6294 dnl = Enable/disable debug for specific modules only
6295 dnl = module names beginning with ^ will be disabled
6296 dnl ========================================================
6297 MOZ_ARG_ENABLE_STRING(debug-modules,
6298 [ --enable-debug-modules Enable/disable debug info for specific modules],
6299 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6301 dnl ========================================================
6302 dnl = Enable/disable generation of debugger info for specific modules only
6303 dnl = the special module name ALL_MODULES can be used to denote all modules
6304 dnl = module names beginning with ^ will be disabled
6305 dnl ========================================================
6306 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6307 [ --enable-debugger-info-modules
6308 Enable/disable debugger info for specific modules],
6309 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6310 dnl note that the list of module names is reversed as it is copied
6311 dnl this is important, as it will allow config.mk to interpret stuff like
6312 dnl "^ALL_MODULES xpcom" properly
6313 if test "$i" = "no"; then
6316 if test "$i" = "yes"; then
6319 MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6322 dnl ========================================================
6323 dnl Disable runtime logging checks
6324 dnl ========================================================
6325 MOZ_ARG_DISABLE_BOOL(logging,
6326 [ --disable-logging Disable logging facilities],
6327 NS_DISABLE_LOGGING=1,
6328 NS_DISABLE_LOGGING= )
6329 if test "$NS_DISABLE_LOGGING"; then
6330 AC_DEFINE(NS_DISABLE_LOGGING)
6332 AC_DEFINE(MOZ_LOGGING)
6335 dnl ========================================================
6336 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6337 dnl ========================================================
6338 _ENABLE_LOGREFCNT=42
6339 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6340 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6341 _ENABLE_LOGREFCNT=1,
6342 _ENABLE_LOGREFCNT= )
6343 if test "$_ENABLE_LOGREFCNT" = "1"; then
6344 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6345 elif test -z "$_ENABLE_LOGREFCNT"; then
6346 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6349 dnl ========================================================
6350 dnl = Enable trace malloc
6351 dnl ========================================================
6352 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6353 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6354 [ --enable-trace-malloc Enable malloc tracing],
6357 if test "$NS_TRACE_MALLOC"; then
6358 # Please, Mr. Linker Man, don't take away our symbol names
6359 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6361 AC_DEFINE(NS_TRACE_MALLOC)
6363 AC_SUBST(NS_TRACE_MALLOC)
6365 dnl ========================================================
6366 dnl = Enable jemalloc
6367 dnl ========================================================
6368 MOZ_ARG_ENABLE_BOOL(jemalloc,
6369 [ --enable-jemalloc Replace memory allocator with jemalloc],
6373 if test "$NS_TRACE_MALLOC"; then
6377 if test "$MOZ_MEMORY"; then
6379 dnl Don't try to run compiler tests on Windows
6380 if test "$OS_ARCH" = "WINNT"; then
6381 if test -z "$HAVE_64BIT_OS"; then
6382 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6384 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6387 AC_CHECK_SIZEOF([int *], [4])
6388 case "${ac_cv_sizeof_int_p}" in
6390 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6393 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6396 AC_MSG_ERROR([Unexpected pointer size])
6401 AC_DEFINE(MOZ_MEMORY)
6402 if test "x$MOZ_DEBUG" = "x1"; then
6403 AC_DEFINE(MOZ_MEMORY_DEBUG)
6405 dnl The generic feature tests that determine how to compute ncpus are long and
6406 dnl complicated. Therefore, simply define special cpp variables for the
6407 dnl platforms we have special knowledge of.
6408 case "${target_os}" in
6410 AC_DEFINE(MOZ_MEMORY_DARWIN)
6413 AC_DEFINE(MOZ_MEMORY_BSD)
6416 AC_DEFINE(MOZ_MEMORY_LINUX)
6419 AC_DEFINE(MOZ_MEMORY_BSD)
6422 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6424 msvc*|mks*|cygwin*|mingw*)
6425 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6426 dnl This is sort of awful. Will revisit if we add support for more versions
6427 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6428 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6430 if test -z "$WIN32_CRT_SRC_DIR"; then
6431 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6432 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).])
6434 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6438 if test ! -d "$WIN32_CRT_SRC_DIR"; then
6439 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6441 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6442 _objdir_win=`pwd -W`
6443 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/intel"
6444 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6445 dnl Also pass this to NSPR/NSS
6446 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6450 AC_DEFINE(MOZ_MEMORY_WINCE)
6451 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6452 if test -z "$WINCE_WINDOWS_MOBILE"; then
6453 AC_DEFINE(MOZ_MEMORY_WINCE6)
6457 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6461 AC_SUBST(MOZ_MEMORY)
6462 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6463 AC_SUBST(WIN32_CRT_SRC_DIR)
6464 dnl Need to set this for make because NSS doesn't have configure
6467 dnl ========================================================
6468 dnl = Use malloc wrapper lib
6469 dnl ========================================================
6470 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6471 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
6475 if test -n "$_WRAP_MALLOC"; then
6476 if test "$GNU_CC"; then
6477 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"
6478 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6482 dnl ========================================================
6483 dnl = Location of malloc wrapper lib
6484 dnl ========================================================
6485 MOZ_ARG_WITH_STRING(wrap-malloc,
6486 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
6487 WRAP_MALLOC_LIB=$withval)
6489 dnl ========================================================
6491 dnl ========================================================
6492 MOZ_ARG_ENABLE_BOOL(tracevis,
6493 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
6496 if test -n "$MOZ_TRACEVIS"; then
6497 AC_DEFINE(MOZ_TRACEVIS)
6500 dnl ========================================================
6502 dnl ========================================================
6503 MOZ_ARG_ENABLE_BOOL(valgrind,
6504 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
6507 if test -n "$MOZ_VALGRIND"; then
6508 AC_CHECK_HEADER([valgrind/valgrind.h], [],
6510 [--enable-valgrind specified but Valgrind is not installed]))
6511 AC_DEFINE(MOZ_VALGRIND)
6514 dnl ========================================================
6516 dnl ========================================================
6517 MOZ_ARG_ENABLE_BOOL(jprof,
6518 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)],
6521 if test -n "$MOZ_JPROF"; then
6522 AC_DEFINE(MOZ_JPROF)
6525 dnl ========================================================
6527 dnl ========================================================
6528 MOZ_ARG_ENABLE_BOOL(shark,
6529 [ --enable-shark Enable shark remote profiling (needs CHUD framework)],
6532 if test -n "$MOZ_SHARK"; then
6533 AC_DEFINE(MOZ_SHARK)
6536 dnl ========================================================
6538 dnl ========================================================
6539 MOZ_ARG_ENABLE_BOOL(callgrind,
6540 [ --enable-callgrind Enable callgrind profiling],
6543 if test -n "$MOZ_CALLGRIND"; then
6544 AC_DEFINE(MOZ_CALLGRIND)
6547 dnl ========================================================
6549 dnl ========================================================
6550 MOZ_ARG_ENABLE_BOOL(vtune,
6551 [ --enable-vtune Enable vtune profiling],
6554 if test -n "$MOZ_VTUNE"; then
6555 AC_DEFINE(MOZ_VTUNE)
6558 dnl ========================================================
6559 dnl Zealous JavaScript GC
6560 dnl ========================================================
6561 MOZ_ARG_ENABLE_BOOL(gczeal,
6562 [ --enable-gczeal Enable zealous JavaScript GCing],
6565 if test -n "$JS_GC_ZEAL"; then
6566 AC_DEFINE(JS_GC_ZEAL)
6569 dnl ========================================================
6570 dnl = Enable static checking using gcc-dehydra
6571 dnl ========================================================
6573 MOZ_ARG_WITH_STRING(static-checking,
6574 [ --with-static-checking=path/to/gcc_dehydra.so
6575 Enable static checking of code using GCC-dehydra],
6576 DEHYDRA_PATH=$withval,
6579 if test -n "$DEHYDRA_PATH"; then
6580 if test ! -f "$DEHYDRA_PATH"; then
6581 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6583 AC_DEFINE(NS_STATIC_CHECKING)
6585 AC_SUBST(DEHYDRA_PATH)
6587 dnl ========================================================
6588 dnl = Enable stripping of libs & executables
6589 dnl ========================================================
6590 MOZ_ARG_ENABLE_BOOL(strip,
6591 [ --enable-strip Enable stripping of libs & executables ],
6595 dnl ========================================================
6596 dnl = Enable stripping of libs & executables when packaging
6597 dnl ========================================================
6598 MOZ_ARG_ENABLE_BOOL(install-strip,
6599 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
6603 dnl ========================================================
6604 dnl = --enable-elf-dynstr-gc
6605 dnl ========================================================
6606 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6607 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
6608 USE_ELF_DYNSTR_GC=1,
6609 USE_ELF_DYNSTR_GC= )
6611 dnl ========================================================
6613 dnl = Profiling and Instrumenting
6615 dnl ========================================================
6616 MOZ_ARG_HEADER(Profiling and Instrumenting)
6618 dnl ========================================================
6619 dnl = Enable timeline service, which provides lightweight
6620 dnl = instrumentation of mozilla for performance measurement.
6621 dnl = Timeline is off by default.
6622 dnl ========================================================
6623 MOZ_ARG_ENABLE_BOOL(timeline,
6624 [ --enable-timeline Enable timeline services ],
6627 if test -n "$MOZ_TIMELINE"; then
6628 AC_DEFINE(MOZ_TIMELINE)
6631 dnl ========================================================
6632 dnl Turn on reflow counting
6633 dnl ========================================================
6634 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6635 [ --enable-reflow-perf Enable reflow performance tracing],
6638 if test -n "$MOZ_REFLOW_PERF"; then
6639 AC_DEFINE(MOZ_REFLOW_PERF)
6642 dnl ========================================================
6643 dnl Enable code size metrics.
6644 dnl ========================================================
6645 MOZ_ARG_ENABLE_BOOL(codesighs,
6646 [ --enable-codesighs Enable code size analysis tools],
6647 _ENABLE_CODESIGHS=1,
6648 _ENABLE_CODESIGHS= )
6649 if test -n "$_ENABLE_CODESIGHS"; then
6650 if test -d $srcdir/tools/codesighs; then
6653 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6657 MOZ_ARG_ENABLE_BOOL(insure,
6658 [ --enable-insure Enable insure++ instrumentation (linux only)],
6661 if test -n "$_ENABLE_INSURE"; then
6665 MOZ_INSURE_EXCLUDE_DIRS="config"
6668 MOZ_ARG_WITH_STRING(insure-dirs,
6669 [ --with-insure-dirs=DIRS
6670 Dirs to instrument with insure ],
6671 MOZ_INSURE_DIRS=$withval )
6673 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6674 [ --with-insure-exclude-dirs=DIRS
6675 Dirs to not instrument with insure ],
6676 MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6678 dnl ========================================================
6679 dnl = Support for Quantify (Windows)
6680 dnl ========================================================
6681 MOZ_ARG_ENABLE_BOOL(quantify,
6682 [ --enable-quantify Enable Quantify support (Windows only) ],
6686 dnl ========================================================
6687 dnl = Support for demangling undefined symbols
6688 dnl ========================================================
6689 if test -z "$SKIP_LIBRARY_CHECKS"; then
6692 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6696 # Demangle only for debug or trace-malloc builds
6697 MOZ_DEMANGLE_SYMBOLS=
6698 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6699 MOZ_DEMANGLE_SYMBOLS=1
6700 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6702 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6704 dnl ========================================================
6705 dnl = Support for gcc stack unwinding (from gcc 3.3)
6706 dnl ========================================================
6707 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6708 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6711 dnl ========================================================
6715 dnl ========================================================
6716 MOZ_ARG_HEADER(Misc. Options)
6718 dnl ========================================================
6719 dnl update xterm title
6720 dnl ========================================================
6721 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6722 [ --enable-xterm-updates Update XTERM titles with current command.],
6726 dnl =========================================================
6728 dnl =========================================================
6729 MOZ_ARG_ENABLE_STRING([chrome-format],
6730 [ --enable-chrome-format=jar|flat|both|symlink
6731 Select FORMAT of chrome files (default=jar)],
6732 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6734 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6735 MOZ_CHROME_FILE_FORMAT=jar
6738 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
6739 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6740 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6741 test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6742 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6745 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
6746 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
6748 dnl ========================================================
6749 dnl = Define default location for MOZILLA_FIVE_HOME
6750 dnl ========================================================
6751 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6752 [ --with-default-mozilla-five-home
6753 Set the default value for MOZILLA_FIVE_HOME],
6754 [ val=`echo $withval`
6755 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6757 dnl ========================================================
6758 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6759 dnl ========================================================
6760 MOZ_ARG_WITH_STRING(user-appdir,
6761 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
6762 [ val=`echo $withval`
6763 if echo "$val" | grep "\/" >/dev/null; then
6764 AC_MSG_ERROR("Homedir must be single relative path.")
6769 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6771 dnl ========================================================
6772 dnl = Doxygen configuration
6773 dnl ========================================================
6774 dnl Use commas to specify multiple dirs to this arg
6775 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6776 MOZ_ARG_WITH_STRING(doc-input-dirs,
6777 [ --with-doc-input-dirs=DIRS
6778 Header/idl dirs to create docs from],
6779 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6780 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6782 dnl Use commas to specify multiple dirs to this arg
6783 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6784 MOZ_ARG_WITH_STRING(doc-include-dirs,
6785 [ --with-doc-include-dirs=DIRS
6786 Include dirs to preprocess doc headers],
6787 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6788 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6790 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6791 MOZ_ARG_WITH_STRING(doc-output-dir,
6792 [ --with-doc-output-dir=DIR
6793 Dir to generate docs into],
6794 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6795 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6797 if test -z "$SKIP_COMPILER_CHECKS"; then
6798 dnl ========================================================
6800 dnl = Compiler Options
6802 dnl ========================================================
6803 MOZ_ARG_HEADER(Compiler Options)
6805 dnl ========================================================
6806 dnl Check for gcc -pipe support
6807 dnl ========================================================
6808 AC_MSG_CHECKING([for gcc -pipe support])
6809 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6810 echo '#include <stdio.h>' > dummy-hello.c
6811 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6812 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6813 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
6814 if test $? = 0; then
6819 if test "$_res_as_stdin" = "yes"; then
6820 _SAVE_CFLAGS=$CFLAGS
6821 CFLAGS="$CFLAGS -pipe"
6822 AC_TRY_COMPILE( [ #include <stdio.h> ],
6823 [printf("Hello World\n");],
6824 [_res_gcc_pipe="yes"],
6825 [_res_gcc_pipe="no"] )
6826 CFLAGS=$_SAVE_CFLAGS
6828 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6830 CFLAGS="$CFLAGS -pipe"
6831 CXXFLAGS="$CXXFLAGS -pipe"
6835 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6836 AC_MSG_RESULT([$_res])
6841 dnl pass -Wno-long-long to the compiler
6842 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6843 [ --enable-long-long-warning
6844 Warn about use of non-ANSI long long type],
6845 _IGNORE_LONG_LONG_WARNINGS=,
6846 _IGNORE_LONG_LONG_WARNINGS=1)
6848 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6849 _SAVE_CFLAGS="$CFLAGS"
6850 CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6851 AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6852 AC_TRY_COMPILE([], [return(0);],
6853 [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6854 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6855 result="yes" ], result="no")
6856 AC_MSG_RESULT([$result])
6857 CFLAGS="$_SAVE_CFLAGS"
6860 dnl ========================================================
6861 dnl Profile guided optimization
6862 dnl ========================================================
6863 dnl Test for profiling options
6864 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6865 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6867 dnl Provide a switch to disable PGO even when called via profiledbuild.
6868 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6869 [ --disable-profile-guided-optimization
6870 Don't build with PGO even if called via make profiledbuild],
6871 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6872 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6874 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6876 _SAVE_CFLAGS="$CFLAGS"
6877 CFLAGS="$CFLAGS -fprofile-generate"
6879 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6880 AC_TRY_COMPILE([], [return 0;],
6881 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6882 result="yes" ], result="no")
6883 AC_MSG_RESULT([$result])
6885 if test $result = "yes"; then
6886 PROFILE_GEN_LDFLAGS="-fprofile-generate"
6887 PROFILE_USE_CFLAGS="-fprofile-use"
6888 PROFILE_USE_LDFLAGS="-fprofile-use"
6890 CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6891 AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6892 AC_TRY_COMPILE([], [return 0;],
6893 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6894 result="yes" ], result="no")
6895 AC_MSG_RESULT([$result])
6896 if test $result = "yes"; then
6897 PROFILE_USE_CFLAGS="-fbranch-probabilities"
6899 # don't really care, this is an old GCC
6900 PROFILE_GEN_LDFLAGS=
6901 PROFILE_USE_LDFLAGS=
6904 CFLAGS="$_SAVE_CFLAGS"
6906 if test -n "$INTEL_CC"; then
6907 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6908 PROFILE_GEN_LDFLAGS=
6909 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6910 PROFILE_USE_LDFLAGS=
6913 dnl Sun Studio on Solaris
6914 if test "$SOLARIS_SUNPRO_CC"; then
6915 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6916 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6917 if test "$CPU_ARCH" != "sparc"; then
6918 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6919 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6921 PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6922 PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6926 AC_SUBST(PROFILE_GEN_CFLAGS)
6927 AC_SUBST(PROFILE_GEN_LDFLAGS)
6928 AC_SUBST(PROFILE_USE_CFLAGS)
6929 AC_SUBST(PROFILE_USE_LDFLAGS)
6933 dnl ========================================================
6934 dnl Test for -pedantic bustage
6935 dnl ========================================================
6936 MOZ_ARG_DISABLE_BOOL(pedantic,
6937 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
6939 if test "$_PEDANTIC"; then
6940 _SAVE_CXXFLAGS=$CXXFLAGS
6941 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6942 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6943 AC_TRY_COMPILE([$configure_static_assert_macros],
6944 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6945 result="no", result="yes" )
6946 AC_MSG_RESULT([$result])
6947 CXXFLAGS="$_SAVE_CXXFLAGS"
6951 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6952 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6955 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
6960 dnl ========================================================
6961 dnl Test for correct temporary object destruction order
6962 dnl ========================================================
6963 dnl We want to make sure the compiler follows the C++ spec here as
6964 dnl xpcom and the string classes depend on it (bug 235381).
6965 AC_MSG_CHECKING([for correct temporary object destruction order])
6966 AC_TRY_RUN([ class A {
6967 public: A(int& x) : mValue(x) {}
6969 operator char**() { return 0; }
6970 private: int& mValue;
6972 void func(char **arg) {}
6983 result="yes", result="no", result="maybe")
6984 AC_MSG_RESULT([$result])
6986 if test "$result" = "no"; then
6987 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
6990 dnl ========================================================
6991 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
6992 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
6993 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
6994 dnl ========================================================
6995 _SAVE_CXXFLAGS=$CXXFLAGS
6996 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
6997 AC_CACHE_CHECK(for correct overload resolution with const and templates,
6998 ac_nscap_nonconst_opeq_bug,
7007 template <class T, class U>
7008 int operator==(const Pointer<T>& rhs, U* lhs)
7010 return rhs.myPtr == lhs;
7013 template <class T, class U>
7014 int operator==(const Pointer<T>& rhs, const U* lhs)
7016 return rhs.myPtr == lhs;
7024 ac_nscap_nonconst_opeq_bug="no",
7025 ac_nscap_nonconst_opeq_bug="yes")])
7026 CXXFLAGS="$_SAVE_CXXFLAGS"
7028 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7029 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7031 fi # SKIP_COMPILER_CHECKS
7033 dnl ========================================================
7035 dnl Should be smarter and check that the compiler does indeed have rtti
7036 dnl ========================================================
7037 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7038 [ --enable-cpp-rtti Enable C++ RTTI ],
7039 [ _MOZ_USE_RTTI=1 ],
7042 if test "$_MOZ_USE_RTTI"; then
7043 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7045 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7048 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7050 dnl ========================================================
7051 dnl C++ exceptions (g++/egcs only - for now)
7052 dnl Should be smarter and check that the compiler does indeed have exceptions
7053 dnl ========================================================
7054 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7055 [ --enable-cpp-exceptions Enable C++ exceptions ],
7056 [ _MOZ_CPP_EXCEPTIONS=1 ],
7057 [ _MOZ_CPP_EXCEPTIONS= ])
7059 if test "$_MOZ_CPP_EXCEPTIONS"; then
7060 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7062 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7065 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7067 # Irix & OSF native compilers do not like exception declarations
7068 # when exceptions are disabled
7069 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7070 AC_DEFINE(CPP_THROW_NEW, [])
7072 AC_DEFINE(CPP_THROW_NEW, [throw()])
7076 dnl ========================================================
7078 dnl = Build depencency options
7080 dnl ========================================================
7081 MOZ_ARG_HEADER(Build dependencies)
7083 dnl ========================================================
7084 dnl = Do not auto generate dependency info
7085 dnl ========================================================
7087 MOZ_ARG_DISABLE_BOOL(auto-deps,
7088 [ --disable-auto-deps Do not automatically generate dependency info],
7092 if test -n "$MOZ_AUTO_DEPS"; then
7093 dnl ========================================================
7094 dnl = Use mkdepend instead of $CC -MD for dependency generation
7095 dnl ========================================================
7097 MOZ_ARG_DISABLE_BOOL(md,
7098 [ --disable-md Do not use compiler-based dependencies ],
7101 [dnl Default is to turn on -MD if using GNU-compatible compilers
7102 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7105 dnl Default is to use -xM if using Sun Studio on Solaris
7106 if test "$SOLARIS_SUNPRO_CC"; then
7109 if test "$_cpp_md_flag"; then
7111 if test "$OS_ARCH" = "OpenVMS"; then
7112 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7114 _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7116 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7117 if test "$SOLARIS_SUNPRO_CC"; then
7122 dnl Don't override this for MSVC
7123 if test -z "$_WIN32_MSVC"; then
7124 _USE_CPP_INCLUDE_FLAG=
7125 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7126 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7131 AC_SUBST(MOZ_AUTO_DEPS)
7132 AC_SUBST(COMPILER_DEPEND)
7136 dnl ========================================================
7138 dnl = Static Build Options
7140 dnl ========================================================
7141 MOZ_ARG_HEADER(Static build options)
7143 MOZ_ARG_ENABLE_BOOL(static,
7144 [ --enable-static Enable building of internal static libs],
7145 BUILD_STATIC_LIBS=1,
7148 dnl Disable libxul in debug builds, but not for xulrunner.
7149 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7153 MOZ_ARG_ENABLE_BOOL(libxul,
7154 [ --enable-libxul Enable building of libxul],
7155 MOZ_ENABLE_LIBXUL=1,
7158 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7159 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7162 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7163 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7166 AC_SUBST(LIBXUL_LIBS)
7168 if test -n "$MOZ_ENABLE_LIBXUL"; then
7169 XPCOM_LIBS="$LIBXUL_LIBS"
7170 AC_DEFINE(MOZ_ENABLE_LIBXUL)
7172 if test -n "$BUILD_STATIC_LIBS"; then
7173 AC_DEFINE(MOZ_STATIC_BUILD)
7175 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7178 dnl ========================================================
7180 dnl = Standalone module options
7182 dnl ========================================================
7183 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7185 dnl Check for GLib and libIDL.
7186 dnl ========================================================
7187 case "$target_os" in
7188 msvc*|mks*|cygwin*|mingw*|wince*)
7189 SKIP_IDL_CHECK="yes"
7196 if test -z "$COMPILE_ENVIRONMENT"; then
7197 SKIP_IDL_CHECK="yes"
7200 dnl = Allow users to disable libIDL checking for standalone modules
7201 MOZ_ARG_WITHOUT_BOOL(libIDL,
7202 [ --without-libIDL Skip check for libIDL (standalone modules only)],
7203 SKIP_IDL_CHECK="yes")
7205 if test "$SKIP_IDL_CHECK" = "no"
7208 if test "$MACOS_SDK_DIR"; then
7209 dnl xpidl, and therefore libIDL, is only needed on the build host.
7210 dnl Don't build it against the SDK, as that causes problems.
7211 _MACSAVE_CFLAGS="$CFLAGS"
7212 _MACSAVE_LIBS="$LIBS"
7213 _MACSAVE_LDFLAGS="$LDFLAGS"
7214 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7216 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"`
7217 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7218 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7223 if test "$MOZ_ENABLE_GTK2"; then
7224 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7226 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7227 dnl to either libIDL1 or libIDL2.
7228 if test -z "$_LIBIDL_FOUND"; then
7229 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7230 if test -z "$_LIBIDL_FOUND"; then
7231 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7235 dnl If we don't have a libIDL config program & not cross-compiling,
7236 dnl look for orbit-config instead.
7238 if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7239 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7240 if test -n "$ORBIT_CONFIG"; then
7241 AC_MSG_CHECKING([for ORBit libIDL usability])
7242 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7243 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7244 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7245 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7246 LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7247 LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7249 _SAVE_CFLAGS="$CFLAGS"
7251 CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7252 LIBS="$LIBIDL_LIBS $LIBS"
7255 #include <libIDL/IDL.h>
7258 s=strdup(IDL_get_libver_string());
7271 AC_MSG_RESULT($result)
7272 CFLAGS="$_SAVE_CFLAGS"
7276 if test -z "$_LIBIDL_FOUND"; then
7277 AC_MSG_ERROR([libIDL not found.
7278 libIDL $LIBIDL_VERSION or higher is required.])
7280 if test "$MACOS_SDK_DIR"; then
7281 CFLAGS="$_MACSAVE_CFLAGS"
7282 LIBS="$_MACSAVE_LIBS"
7283 LDFLAGS="$_MACSAVE_LDFLAGS"
7284 if test -n "$_MACSAVE_NEXT_ROOT" ; then
7285 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7290 if test -n "$CROSS_COMPILE"; then
7291 if test -z "$HOST_LIBIDL_CONFIG"; then
7292 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7294 if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7295 HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7296 HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7298 HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7299 HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7303 if test -z "$SKIP_PATH_CHECKS"; then
7304 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7305 if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7306 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7308 AM_PATH_GLIB(${GLIB_VERSION})
7313 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7314 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7317 AC_SUBST(LIBIDL_CFLAGS)
7318 AC_SUBST(LIBIDL_LIBS)
7319 AC_SUBST(STATIC_LIBIDL)
7320 AC_SUBST(GLIB_CFLAGS)
7322 AC_SUBST(GLIB_GMODULE_LIBS)
7323 AC_SUBST(HOST_LIBIDL_CONFIG)
7324 AC_SUBST(HOST_LIBIDL_CFLAGS)
7325 AC_SUBST(HOST_LIBIDL_LIBS)
7327 dnl ========================================================
7329 dnl ========================================================
7330 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7333 MOZ_ARG_ENABLE_BOOL(system-cairo,
7334 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7338 # Check for headers defining standard int types.
7339 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7341 if test "$MOZ_TREE_CAIRO"; then
7342 AC_DEFINE(MOZ_TREE_CAIRO)
7344 # For now we assume that we will have a uint64_t available through
7345 # one of the above headers or mozstdint.h.
7346 AC_DEFINE(HAVE_UINT64_T)
7348 # Define macros for cairo-features.h
7349 if test "$MOZ_X11"; then
7350 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7351 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7352 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7353 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7354 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7355 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7356 MOZ_ENABLE_CAIRO_FT=1
7357 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7359 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7360 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7362 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7363 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7364 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7365 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7367 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7368 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7369 if test -z "$WINCE"; then
7370 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7375 AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7376 if test -z "$HAS_DDRAW"; then
7377 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.])
7378 DDRAW_SURFACE_FEATURE=
7380 DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7383 if test -z "$OGLES_SDK_DIR"; then
7384 OGLES_SURFACE_FEATURE=
7387 #include <EGL/egl.h>
7388 #include <EGL/eglext.h>
7389 #include <GLES2/gl2.h>
7390 #include <GLES2/gl2ext.h>
7391 ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7392 if test -z "$HAS_OGLES"; then
7393 AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7394 OGLES_SURFACE_FEATURE=
7396 OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7400 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7402 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7403 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7404 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7405 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7406 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7407 MOZ_ENABLE_CAIRO_FT=1
7408 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7409 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7411 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7412 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7413 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7414 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7415 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7416 MOZ_ENABLE_CAIRO_FT=1
7418 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7419 AC_SUBST(CAIRO_FT_CFLAGS)
7422 if test "$MOZ_DEBUG"; then
7423 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7425 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7428 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7430 AC_SUBST(PS_SURFACE_FEATURE)
7431 AC_SUBST(PDF_SURFACE_FEATURE)
7432 AC_SUBST(SVG_SURFACE_FEATURE)
7433 AC_SUBST(XLIB_SURFACE_FEATURE)
7434 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7435 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7436 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7437 AC_SUBST(XCB_SURFACE_FEATURE)
7438 AC_SUBST(WIN32_SURFACE_FEATURE)
7439 AC_SUBST(DDRAW_SURFACE_FEATURE)
7440 AC_SUBST(OGLES_SURFACE_FEATURE)
7441 AC_SUBST(OS2_SURFACE_FEATURE)
7442 AC_SUBST(BEOS_SURFACE_FEATURE)
7443 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7444 AC_SUBST(FT_FONT_FEATURE)
7445 AC_SUBST(FC_FONT_FEATURE)
7446 AC_SUBST(WIN32_FONT_FEATURE)
7447 AC_SUBST(QUARTZ_FONT_FEATURE)
7448 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7449 AC_SUBST(QT_SURFACE_FEATURE)
7451 if test "$_WIN32_MSVC"; then
7452 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7454 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"
7456 if test "$MOZ_X11"; then
7457 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7461 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7462 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7465 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7466 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7467 MOZ_CAIRO_LIBS=$CAIRO_LIBS
7468 if test "$MOZ_X11"; then
7469 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7470 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7471 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7475 AC_SUBST(MOZ_TREE_CAIRO)
7476 AC_SUBST(MOZ_CAIRO_CFLAGS)
7477 AC_SUBST(MOZ_CAIRO_LIBS)
7480 dnl ========================================================
7482 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7485 dnl ========================================================
7487 dnl ========================================================
7488 MOZ_ARG_DISABLE_BOOL(xul,
7489 [ --disable-xul Disable XUL],
7491 if test "$MOZ_XUL"; then
7494 dnl remove extensions that require XUL
7495 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7500 dnl ========================================================
7501 dnl disable profile locking
7502 dnl do no use this in applications that can have more than
7503 dnl one process accessing the profile directory.
7504 dnl ========================================================
7505 MOZ_ARG_DISABLE_BOOL(profilelocking,
7506 [ --disable-profilelocking Disable profile locking],
7507 MOZ_PROFILELOCKING=,
7508 MOZ_PROFILELOCKING=1 )
7509 if test "$MOZ_PROFILELOCKING"; then
7510 AC_DEFINE(MOZ_PROFILELOCKING)
7513 dnl ========================================================
7514 dnl disable rdf services
7515 dnl ========================================================
7516 MOZ_ARG_DISABLE_BOOL(rdf,
7517 [ --disable-rdf Disable RDF],
7519 if test "$MOZ_RDF"; then
7525 dnl ========================================================
7526 dnl necko configuration options
7527 dnl ========================================================
7530 dnl option to disable various necko protocols
7532 MOZ_ARG_ENABLE_STRING(necko-protocols,
7533 [ --enable-necko-protocols[={http,ftp,default,all,none}]
7534 Enable/disable specific protocol handlers],
7535 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7536 if test "$option" = "yes" || test "$option" = "all"; then
7537 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7538 elif test "$option" = "no" || test "$option" = "none"; then
7540 elif test "$option" = "default"; then
7541 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7542 elif test `echo "$option" | grep -c \^-` != 0; then
7543 option=`echo $option | sed 's/^-//'`
7544 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7546 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7549 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7551 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7552 AC_SUBST(NECKO_PROTOCOLS)
7553 for p in $NECKO_PROTOCOLS; do
7554 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7558 dnl option to disable necko's disk cache
7560 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7561 [ --disable-necko-disk-cache
7562 Disable necko disk cache],
7565 AC_SUBST(NECKO_DISK_CACHE)
7566 if test "$NECKO_DISK_CACHE"; then
7567 AC_DEFINE(NECKO_DISK_CACHE)
7571 dnl option to disable necko's wifi scanner
7573 MOZ_ARG_DISABLE_BOOL(necko-wifi,
7574 [ --disable-necko-wifi Disable necko wifi scanner],
7579 if test "$OS_ARCH" = "OS2"; then
7580 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
7583 if test "$NECKO_WIFI" -a \
7584 "$OS_ARCH" != "Linux" -a \
7585 "$OS_ARCH" != "Darwin" -a \
7586 "$OS_ARCH" != "WINNT" -a \
7587 "$OS_ARCH" != "WINCE"; then
7588 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
7591 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
7593 AC_CHECK_HEADER([iwlib.h])
7594 if test "$ac_cv_header_iwlib_h" != "yes"; then
7595 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])
7599 if test "$NECKO_WIFI"; then
7600 AC_DEFINE(NECKO_WIFI)
7602 AC_SUBST(NECKO_WIFI)
7605 dnl option to minimize size of necko's i/o buffers
7607 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7608 [ --enable-necko-small-buffers
7609 Minimize size of necko's i/o buffers],
7610 NECKO_SMALL_BUFFERS=1,
7611 NECKO_SMALL_BUFFERS=)
7612 AC_SUBST(NECKO_SMALL_BUFFERS)
7613 if test "$NECKO_SMALL_BUFFERS"; then
7614 AC_DEFINE(NECKO_SMALL_BUFFERS)
7618 dnl option to disable cookies
7620 MOZ_ARG_DISABLE_BOOL(cookies,
7621 [ --disable-cookies Disable cookie support],
7624 AC_SUBST(NECKO_COOKIES)
7625 if test "$NECKO_COOKIES"; then
7626 AC_DEFINE(NECKO_COOKIES)
7630 dnl Build jsctypes on the platforms we can.
7632 AC_SUBST(BUILD_CTYPES)
7638 AC_DEFINE(BUILD_CTYPES)
7642 dnl NECKO_ configuration options are not global
7643 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7645 dnl Only build Mork if it's required
7647 if test "$MOZ_MORK"; then
7651 dnl Build the lightweight Mork reader if required
7652 AC_SUBST(MOZ_MORKREADER)
7653 if test "$MOZ_MORKREADER"; then
7654 AC_DEFINE(MOZ_MORKREADER)
7657 dnl ========================================================
7658 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7659 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7662 dnl ========================================================
7664 dnl = Maintainer debug option (no --enable equivalent)
7666 dnl ========================================================
7671 AC_SUBST(AR_EXTRACT)
7675 AC_SUBST(AS_DASH_C_FLAG)
7683 AC_SUBST(NS_USE_NATIVE)
7684 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7685 AC_SUBST(MOZ_UPDATE_XTERM)
7687 AC_SUBST(MOZ_PLATFORM_HILDON)
7689 AC_SUBST(NS_MAEMO_LOCATION)
7690 AC_SUBST(MOZ_AUTH_EXTENSION)
7691 AC_SUBST(MOZ_MATHML)
7692 AC_SUBST(MOZ_PERMISSIONS)
7694 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7695 AC_SUBST(MOZ_PREF_EXTENSIONS)
7698 AC_SUBST(MOZ_XSLT_STANDALONE)
7699 AC_SUBST(MOZ_JS_LIBS)
7702 AC_SUBST(MOZ_DEBUG_MODULES)
7703 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7704 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7705 AC_SUBST(MOZ_DEBUG_FLAGS)
7706 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7707 AC_SUBST(WARNINGS_AS_ERRORS)
7708 AC_SUBST(MOZ_DBGRINFO_MODULES)
7709 AC_SUBST(MOZ_EXTENSIONS)
7710 AC_SUBST(MOZ_IMG_DECODERS)
7711 AC_SUBST(MOZ_IMG_ENCODERS)
7712 AC_SUBST(MOZ_JSDEBUGGER)
7713 AC_SUBST(MOZ_PLUGINS)
7714 AC_SUBST(MOZ_LOG_REFCNT)
7718 AC_SUBST(MOZ_CALLGRIND)
7720 AC_SUBST(MOZ_XPCTOOLS)
7721 AC_SUBST(MOZ_JSLOADER)
7722 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7723 AC_SUBST(MOZ_INSURE)
7724 AC_SUBST(MOZ_INSURE_DIRS)
7725 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7726 AC_SUBST(MOZ_QUANTIFY)
7727 AC_SUBST(MOZ_INSURIFYING)
7729 AC_SUBST(MOZ_PLACES)
7730 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7731 AC_SUBST(MOZ_STORAGE)
7733 AC_SUBST(NS_PRINTING)
7735 AC_SUBST(MOZ_JAVAXPCOM)
7736 AC_SUBST(JAVA_INCLUDE_PATH)
7741 AC_SUBST(MOZ_PROFILELOCKING)
7744 AC_SUBST(MOZ_XIE_LIBS)
7745 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7747 AC_SUBST(BUILD_STATIC_LIBS)
7748 AC_SUBST(MOZ_ENABLE_LIBXUL)
7749 AC_SUBST(ENABLE_TESTS)
7751 AC_SUBST(MOZ_UNIVERSALCHARDET)
7752 AC_SUBST(ACCESSIBILITY)
7753 AC_SUBST(MOZ_XPINSTALL)
7754 AC_SUBST(MOZ_VIEW_SOURCE)
7755 AC_SUBST(MOZ_SPELLCHECK)
7756 AC_SUBST(MOZ_XPFE_COMPONENTS)
7757 AC_SUBST(MOZ_USER_DIR)
7758 AC_SUBST(MOZ_CRASHREPORTER)
7760 AC_SUBST(ENABLE_STRIP)
7761 AC_SUBST(PKG_SKIP_STRIP)
7762 AC_SUBST(USE_ELF_DYNSTR_GC)
7763 AC_SUBST(INCREMENTAL_LINKER)
7764 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7765 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7767 AC_SUBST(MOZ_FIX_LINK_PATHS)
7768 AC_SUBST(XPCOM_LIBS)
7769 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7770 AC_SUBST(XPCOM_GLUE_LDOPTS)
7771 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7773 AC_SUBST(USE_DEPENDENT_LIBS)
7775 AC_SUBST(MOZ_BUILD_ROOT)
7776 AC_SUBST(MOZ_OS2_TOOLS)
7777 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7779 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7780 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7781 AC_SUBST(MOZ_TIMELINE)
7782 AC_SUBST(OGLES_SDK_DIR)
7784 AC_SUBST(MOZ_APP_NAME)
7785 AC_SUBST(MOZ_APP_DISPLAYNAME)
7786 AC_SUBST(MOZ_APP_VERSION)
7787 AC_SUBST(FIREFOX_VERSION)
7789 AC_SUBST(MOZ_PKG_SPECIAL)
7791 AC_SUBST(MOZILLA_OFFICIAL)
7794 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7795 AC_SUBST(MOZ_MAPINFO)
7796 AC_SUBST(MOZ_BROWSE_INFO)
7797 AC_SUBST(MOZ_TOOLS_DIR)
7798 AC_SUBST(CYGWIN_WRAPPER)
7800 AC_SUBST(WIN32_REDIST_DIR)
7804 AC_SUBST(WINCE_SDK_DIR)
7805 AC_SUBST(WINCE_WINDOWS_MOBILE)
7807 dnl Echo the CFLAGS to remove extra whitespace.
7814 $_MOZ_EXCEPTIONS_FLAGS \
7815 $_WARNINGS_CXXFLAGS \
7818 COMPILE_CFLAGS=`echo \
7823 COMPILE_CXXFLAGS=`echo \
7824 $_DEFINES_CXXFLAGS \
7828 AC_SUBST(SYSTEM_MAKEDEPEND)
7829 AC_SUBST(SYSTEM_LIBXUL)
7830 AC_SUBST(SYSTEM_JPEG)
7831 AC_SUBST(SYSTEM_PNG)
7832 AC_SUBST(SYSTEM_ZLIB)
7833 AC_SUBST(SYSTEM_BZ2)
7835 AC_SUBST(JPEG_CFLAGS)
7837 AC_SUBST(ZLIB_CFLAGS)
7839 AC_SUBST(BZ2_CFLAGS)
7841 AC_SUBST(PNG_CFLAGS)
7844 AC_SUBST(MOZ_JPEG_CFLAGS)
7845 AC_SUBST(MOZ_JPEG_LIBS)
7846 AC_SUBST(MOZ_ZLIB_CFLAGS)
7847 AC_SUBST(MOZ_ZLIB_LIBS)
7848 AC_SUBST(MOZ_BZ2_CFLAGS)
7849 AC_SUBST(MOZ_BZ2_LIBS)
7850 AC_SUBST(MOZ_PNG_CFLAGS)
7851 AC_SUBST(MOZ_PNG_LIBS)
7853 AC_SUBST(NSPR_CFLAGS)
7855 AC_SUBST(MOZ_NATIVE_NSPR)
7857 AC_SUBST(NSS_CFLAGS)
7859 AC_SUBST(NSS_DEP_LIBS)
7860 AC_SUBST(MOZ_NATIVE_NSS)
7861 AC_SUBST(NSS_DISABLE_DBM)
7866 AC_SUBST(COMPILE_CFLAGS)
7867 AC_SUBST(COMPILE_CXXFLAGS)
7870 AC_SUBST(CROSS_COMPILE)
7871 AC_SUBST(WCHAR_CFLAGS)
7875 AC_SUBST(HOST_CFLAGS)
7876 AC_SUBST(HOST_CXXFLAGS)
7877 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7879 AC_SUBST(HOST_AR_FLAGS)
7881 AC_SUBST(HOST_RANLIB)
7882 AC_SUBST(HOST_NSPR_MDCPUCFG)
7883 AC_SUBST(HOST_BIN_SUFFIX)
7884 AC_SUBST(HOST_OS_ARCH)
7886 AC_SUBST(TARGET_CPU)
7887 AC_SUBST(TARGET_VENDOR)
7889 AC_SUBST(TARGET_NSPR_MDCPUCFG)
7890 AC_SUBST(TARGET_MD_ARCH)
7891 AC_SUBST(TARGET_XPCOM_ABI)
7894 AC_SUBST(OS_RELEASE)
7897 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
7898 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
7900 AC_SUBST(WRAP_MALLOC_CFLAGS)
7901 AC_SUBST(WRAP_MALLOC_LIB)
7904 AC_SUBST(MKSHLIB_FORCE_ALL)
7905 AC_SUBST(MKSHLIB_UNFORCE_ALL)
7906 AC_SUBST(DSO_CFLAGS)
7907 AC_SUBST(DSO_PIC_CFLAGS)
7908 AC_SUBST(DSO_LDOPTS)
7909 AC_SUBST(LIB_PREFIX)
7910 AC_SUBST(DLL_PREFIX)
7911 AC_SUBST(DLL_SUFFIX)
7912 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
7913 AC_SUBST(LIB_SUFFIX)
7914 AC_SUBST(OBJ_SUFFIX)
7915 AC_SUBST(BIN_SUFFIX)
7916 AC_SUBST(ASM_SUFFIX)
7917 AC_SUBST(IMPORT_LIB_SUFFIX)
7919 AC_SUBST(CC_VERSION)
7920 AC_SUBST(CXX_VERSION)
7921 AC_SUBST(MSMANIFEST_TOOL)
7922 AC_SUBST(NS_ENABLE_TSF)
7923 AC_SUBST(MOZ_NSS_PATCH)
7925 if test "$USING_HCC"; then
7926 CC='${topsrcdir}/build/hcc'
7928 CXX='${topsrcdir}/build/hcpp'
7929 CXX="$CXX '$_OLDCXX'"
7934 dnl Check for missing components
7935 if test "$COMPILE_ENVIRONMENT"; then
7936 if test "$MOZ_X11"; then
7937 dnl ====================================================
7938 dnl = Check if X headers exist
7939 dnl ====================================================
7940 _SAVE_CFLAGS=$CFLAGS
7941 CFLAGS="$CFLAGS $XCFLAGS"
7945 #include <X11/Xlib.h>
7946 #include <X11/Intrinsic.h>
7950 if ((dpy = XOpenDisplay(NULL)) == NULL) {
7951 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
7955 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
7956 CFLAGS="$_SAVE_CFLAGS"
7958 if test ! -z "$MISSING_X"; then
7959 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
7963 fi # COMPILE_ENVIRONMENT
7965 dnl Set various defines and substitutions
7966 dnl ========================================================
7968 if test "$OS_ARCH" = "BeOS"; then
7971 elif test "$OS_ARCH" = "Darwin"; then
7973 AC_DEFINE(UNIX_ASYNC_DNS)
7975 elif test "$OS_ARCH" = "OpenVMS"; then
7977 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
7979 AC_DEFINE(UNIX_ASYNC_DNS)
7982 AC_SUBST(MOZ_MOVEMAIL)
7984 if test "$MOZ_DEBUG"; then
7985 AC_DEFINE(MOZ_REFLOW_PERF)
7986 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
7989 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
7990 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
7991 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
7992 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
7993 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
7994 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
7995 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
7996 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
7997 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8000 dnl ========================================================
8001 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8002 dnl ========================================================
8005 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8008 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8009 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8010 CC="\$(CYGWIN_WRAPPER) $CC"
8011 CXX="\$(CYGWIN_WRAPPER) $CXX"
8012 CPP="\$(CYGWIN_WRAPPER) $CPP"
8013 LD="\$(CYGWIN_WRAPPER) $LD"
8014 AS="\$(CYGWIN_WRAPPER) $AS"
8015 RC="\$(CYGWIN_WRAPPER) $RC"
8016 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8017 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8018 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8022 AC_SUBST(CYGDRIVE_MOUNT)
8023 AC_SUBST(WIN_TOP_SRC)
8025 AC_SUBST(MOZILLA_VERSION)
8027 AC_SUBST(ac_configure_args)
8029 dnl Spit out some output
8030 dnl ========================================================
8032 dnl The following defines are used by xpcom
8033 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8035 HAVE_CPP_2BYTE_WCHAR_T
8036 HAVE_CPP_ACCESS_CHANGING_USING
8037 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8040 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8042 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8043 HAVE_CPP_NAMESPACE_STD
8045 HAVE_CPP_PARTIAL_SPECIALIZATION
8046 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8048 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8050 NEED_CPP_UNUSED_IMPLEMENTATIONS
8054 HAVE_ICONV_WITH_CONST_INPUT
8062 netwerk/necko-config.h
8063 xpcom/xpcom-config.h
8064 xpcom/xpcom-private.h
8067 # Save the defines header file before autoconf removes it.
8068 # (Do not add AC_DEFINE calls after this line.)
8069 _CONFIG_TMP=confdefs-tmp.h
8070 _CONFIG_DEFS_H=mozilla-config.h
8072 cat > $_CONFIG_TMP <<\EOF
8073 /* List of defines generated by configure. Included with preprocessor flag,
8074 * -include, to avoid long list of -D defines on the compile command-line.
8078 #ifndef _MOZILLA_CONFIG_H_
8079 #define _MOZILLA_CONFIG_H_
8082 _EGREP_PATTERN='^#define ('
8083 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8084 for f in $_NON_GLOBAL_ACDEFINES; do
8085 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8088 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8090 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8092 cat >> $_CONFIG_TMP <<\EOF
8094 #endif /* _MOZILLA_CONFIG_H_ */
8098 # Only write mozilla-config.h when something changes (or it doesn't exist)
8099 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8102 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8103 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8105 echo ==== $_CONFIG_DEFS_H =================================
8109 dnl Probably shouldn't call this manually but we always want the output of DEFS
8110 rm -f confdefs.h.save
8111 mv confdefs.h confdefs.h.save
8112 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8113 AC_OUTPUT_MAKE_DEFS()
8115 AC_SUBST(MOZ_DEFINES)
8117 mv confdefs.h.save confdefs.h
8119 dnl Load the list of Makefiles to generate.
8120 dnl To add new Makefiles, edit allmakefiles.sh.
8121 dnl allmakefiles.sh sets the variable, MAKEFILES.
8122 . ${srcdir}/allmakefiles.sh
8124 dnl Run a perl script to quickly create the makefiles.
8125 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8126 dnl for the files it cannot handle correctly. This way, config.status
8127 dnl will handle these files.
8128 dnl If it fails, nothing is set and config.status will run as usual.
8130 dnl This does not change the $MAKEFILES variable.
8132 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8134 if test -z "${AS_PERL}"; then
8135 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8137 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8142 echo $MAKEFILES > unallmakefiles
8144 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8146 AC_OUTPUT($MAKEFILES)
8148 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8149 if test "$CAIRO_FEATURES_H"; then
8150 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8151 echo "$CAIRO_FEATURES_H is unchanged"
8152 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8154 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8158 dnl ========================================================
8159 dnl = Setup a nice relatively clean build environment for
8160 dnl = sub-configures.
8161 dnl ========================================================
8164 CFLAGS="$_SUBDIR_CFLAGS"
8165 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8166 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8167 LDFLAGS="$_SUBDIR_LDFLAGS"
8168 HOST_CC="$_SUBDIR_HOST_CC"
8169 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8170 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8176 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8177 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8179 if test -z "$MOZ_NATIVE_NSPR"; then
8180 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8181 if test -z "$MOZ_DEBUG"; then
8182 ac_configure_args="$ac_configure_args --disable-debug"
8184 if test "$MOZ_OPTIMIZE" = "1"; then
8185 ac_configure_args="$ac_configure_args --enable-optimize"
8187 if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8188 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8190 if test -n "$HAVE_64BIT_OS"; then
8191 ac_configure_args="$ac_configure_args --enable-64bit"
8193 if test -n "$USE_ARM_KUSER"; then
8194 ac_configure_args="$ac_configure_args --with-arm-kuser"
8196 AC_OUTPUT_SUBDIRS(nsprpub)
8197 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8200 if test -z "$MOZ_NATIVE_NSPR"; then
8201 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8202 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8203 if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8204 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8205 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8206 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8207 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8209 rm -f config/autoconf.mk.bak
8212 # Run the SpiderMonkey 'configure' script.
8213 dist=$MOZ_BUILD_ROOT/dist
8214 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8215 ac_configure_args="$ac_configure_args --enable-threadsafe"
8216 if test -z "$MOZ_NATIVE_NSPR"; then
8217 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8218 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8220 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8221 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8222 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8223 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8224 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8225 if test "$MOZ_MEMORY"; then
8226 ac_configure_args="$ac_configure_args --enable-jemalloc"
8227 if test -n "$MOZ_MEMORY_LDFLAGS"; then
8228 export MOZ_MEMORY_LDFLAGS
8231 AC_OUTPUT_SUBDIRS(js/src)
8232 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8234 # Build jsctypes on the platforms we can.
8235 if test "$BUILD_CTYPES"; then
8236 # Run the libffi 'configure' script on platforms that it supports.
8237 if test -z "$_MSC_VER"; then
8238 ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8239 if test "$MOZ_DEBUG"; then
8240 ac_configure_args="$ac_configure_args --enable-debug"
8242 if test -n "$DSO_PIC_CFLAGS"; then
8243 ac_configure_args="$ac_configure_args --with-pic"
8245 if test -n "$CROSS_COMPILE"; then
8246 ac_configure_args="$ac_configure_args --build=$build --host=$target"
8248 AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8249 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8253 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8255 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8256 dnl Needs to be at the end to respect possible changes from NSPR configure
8257 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8258 echo "config/autoconf.mk is unchanged"
8259 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8261 rm -f config/autoconf.mk.orig 2> /dev/null