1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
16 dnl The Original Code is this file as it was released upon August 6, 1998.
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
24 dnl Jamie Zawinski <jwz@jwz.org>
25 dnl gettimeofday args check
26 dnl Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl gnomefe update & enable-pthreads
28 dnl Ramiro Estrugo <ramiro@netscape.com>
29 dnl X11 makedepend support
31 dnl Henry Sobotka <sobotka@axess.com>
33 dnl Dan Mosedale <dmose@mozilla.org>
35 dnl Seth Spitzer <sspitzer@netscape.com>
37 dnl Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl Howard Chu <hyc@symas.com>
40 dnl Mark Mentovai <mark@moxienet.com>:
41 dnl Mac OS X 10.4 support
42 dnl Giorgio Maone <g.maone@informaction.com>
43 dnl MSVC l10n compatible version check
44 dnl Ben Turner <mozilla@songbirdnest.com>
45 dnl Windows x64 support
46 dnl Makoto Kato <m_kato@ga2.so-net.ne.jp>
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
74 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
75 AC_SUBST(MOZ_DEB_TIMESTAMP)
78 dnl ========================================================
80 dnl = Don't change the following two lines. Doing so breaks:
82 dnl = CFLAGS="-foo" ./configure
84 dnl ========================================================
86 CPPFLAGS="${CPPFLAGS=}"
87 CXXFLAGS="${CXXFLAGS=}"
89 HOST_CFLAGS="${HOST_CFLAGS=}"
90 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
91 HOST_LDFLAGS="${HOST_LDFLAGS=}"
93 dnl ========================================================
94 dnl = Preserve certain environment flags passed to configure
95 dnl = We want sub projects to receive the same flags
96 dnl = untainted by this configure script
97 dnl ========================================================
100 _SUBDIR_CFLAGS="$CFLAGS"
101 _SUBDIR_CPPFLAGS="$CPPFLAGS"
102 _SUBDIR_CXXFLAGS="$CXXFLAGS"
103 _SUBDIR_LDFLAGS="$LDFLAGS"
104 _SUBDIR_HOST_CC="$HOST_CC"
105 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
106 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
107 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
108 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
110 dnl Set the version number of the libs included with mozilla
111 dnl ========================================================
118 dnl Set the minimum version of toolkit libs used by mozilla
119 dnl ========================================================
127 WINDRES_VERSION=2.14.90
130 GNOMEUI_VERSION=2.2.0
134 STARTUP_NOTIFICATION_VERSION=0.8
136 SQLITE_VERSION=3.6.16
137 LIBNOTIFY_VERSION=0.4
141 dnl Set various checks
142 dnl ========================================================
146 dnl Initialize the Pthread test variables early so they can be
147 dnl overridden by each platform.
148 dnl ========================================================
152 dnl Do not allow a separate objdir build if a srcdir build exists.
153 dnl ==============================================================
154 _topsrcdir=`cd \`dirname $0\`; pwd`
157 if test "$_topsrcdir" != "$_objdir"
159 # Check for a couple representative files in the source tree
161 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
162 if test -f $file; then
163 _conflict_files="$_conflict_files $file"
166 if test "$_conflict_files"; then
168 echo "* Your source tree contains these files:"
169 for file in $_conflict_files; do
173 * This indicates that you previously built in the source tree.
174 * A source tree build can confuse the separate objdir build.
176 * To clean up the source tree:
187 dnl Default to MSVC for win32 and gcc-4.2 for darwin
188 dnl ==============================================================
189 if test -z "$CROSS_COMPILE"; then
191 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
192 if test -z "$CC"; then CC=cl; fi
193 if test -z "$CXX"; then CXX=cl; fi
194 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
195 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
196 if test -z "$LD"; then LD=link; fi
197 if test -z "$AS"; then
198 case "${target_cpu}" in
207 if test -z "$MIDL"; then MIDL=midl; fi
210 if test -z "$CC"; then CC=gcc-4.2; fi
211 if test -z "$CXX"; then CXX=g++-4.2; fi
216 COMPILE_ENVIRONMENT=1
217 MOZ_ARG_ENABLE_BOOL(compile-environment,
218 [ --disable-compile-environment
219 Disable compiler/library checks.],
220 COMPILE_ENVIRONMENT=1,
221 COMPILE_ENVIRONMENT= )
222 AC_SUBST(COMPILE_ENVIRONMENT)
224 MOZ_ARG_WITH_STRING(l10n-base,
225 [ --with-l10n-base=DIR path to l10n repositories],
226 L10NBASEDIR=$withval)
227 if test ! -z "$L10NBASEDIR"; then
228 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
229 AC_MSG_ERROR([--with-l10n-base must specify a path])
230 elif test -d "$L10NBASEDIR"; then
231 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
233 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
236 AC_SUBST(L10NBASEDIR)
238 dnl Check for Perl first -- needed for win32 SDK checks
239 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
240 if test -z "$PERL" || test "$PERL" = ":"; then
241 AC_MSG_ERROR([perl not found in \$PATH])
244 dnl ========================================================
245 dnl Checks for compilers.
246 dnl ========================================================
247 dnl Set CROSS_COMPILE in the environment when running configure
248 dnl to use the cross-compile setup for now
249 dnl ========================================================
251 if test "$COMPILE_ENVIRONMENT"; then
253 dnl Do some special WinCE toolchain stuff
257 MOZ_ARG_WITH_STRING(wince-sdk,
258 [ --with-wince-sdk=WINCE_SDK_DIR
259 The path to the Windows CE SDK],
260 WINCE_SDK_DIR=$withval)
262 MOZ_ARG_WITH_STRING(ogles-sdk,
263 [ --with-ogles-sdk=OGLES_SDK_DIR
264 The path to the OGLES SDK],
265 OGLES_SDK_DIR=$withval)
267 dnl Default to Windows Mobile components enabled
268 WINCE_WINDOWS_MOBILE=1
270 MOZ_ARG_DISABLE_BOOL(windows-mobile-components,
271 [ --disable-windows-mobile-components
272 Disable Windows Mobile specific components from CE build],
273 WINCE_WINDOWS_MOBILE=,
274 WINCE_WINDOWS_MOBILE=1)
276 if test "$WINCE_WINDOWS_MOBILE"; then
277 AC_DEFINE(WINCE_WINDOWS_MOBILE)
284 echo -----------------------------------------------------------------------------
285 echo Building Windows CE Shunt Library and Tool Chain
292 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
293 make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" -C $srcdir/build/wince/tools
295 CC="$_pwd/dist/sdk/bin/arm-wince-gcc.exe"
296 CXX="$_pwd/dist/sdk/bin/arm-wince-gcc.exe"
297 CPP="$_pwd/dist/sdk/bin/arm-wince-gcc.exe -E -nologo"
298 CXXCPP="$_pwd/dist/sdk/bin/arm-wince-gcc.exe -TP -E -nologo"
299 LD="$_pwd/dist/sdk/bin/arm-wince-link.exe"
300 AR="$_pwd/dist/sdk/bin/arm-wince-lib.exe"
301 AS="$_pwd/dist/sdk/bin/arm-wince-as.exe"
302 RC="$_pwd/dist/sdk/bin/arm-wince-res.exe"
305 echo -----------------------------------------------------------------------------
310 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
311 echo "cross compiling from $host to $target"
315 _SAVE_CFLAGS="$CFLAGS"
316 _SAVE_LDFLAGS="$LDFLAGS"
318 AC_MSG_CHECKING([for host c compiler])
319 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
320 if test -z "$HOST_CC"; then
321 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
323 AC_MSG_RESULT([$HOST_CC])
324 AC_MSG_CHECKING([for host c++ compiler])
325 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
326 if test -z "$HOST_CXX"; then
327 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
329 AC_MSG_RESULT([$HOST_CXX])
331 if test -z "$HOST_CFLAGS"; then
332 HOST_CFLAGS="$CFLAGS"
334 if test -z "$HOST_CXXFLAGS"; then
335 HOST_CXXFLAGS="$CXXFLAGS"
337 if test -z "$HOST_LDFLAGS"; then
338 HOST_LDFLAGS="$LDFLAGS"
340 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
341 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
343 CFLAGS="$HOST_CFLAGS"
344 LDFLAGS="$HOST_LDFLAGS"
346 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
347 AC_TRY_COMPILE([], [return(0);],
348 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
349 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
352 CFLAGS="$HOST_CXXFLAGS"
354 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
355 AC_TRY_COMPILE([], [return(0);],
356 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
357 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
361 LDFLAGS=$_SAVE_LDFLAGS
363 case "$build:$target" in
364 powerpc-apple-darwin8*:i?86-apple-darwin*)
365 dnl The Darwin cross compiler doesn't necessarily point itself at a
366 dnl root that has libraries for the proper architecture, it defaults
367 dnl to the system root. The libraries in the system root on current
368 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
369 dnl checks will fail. Fake a working SDK in that case.
371 _SAVE_CXXFLAGS=$CXXLAGS
372 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
373 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
377 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
380 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
384 case "$build:$target" in
385 powerpc-apple-darwin8*:i?86-apple-darwin*)
386 dnl Revert the changes made above. From this point on, the target
387 dnl compiler will never be used without applying the SDK to CFLAGS
388 dnl (see --with-macos-sdk below).
390 CXXFLAGS=$_SAVE_CXXFLAGS
394 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
395 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
396 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
397 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
398 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
399 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
400 AC_DEFINE(CROSS_COMPILE)
405 MOZ_PATH_PROGS(AS, $AS as, $CC)
406 AC_CHECK_PROGS(AR, ar, :)
407 AC_CHECK_PROGS(LD, ld, :)
408 AC_CHECK_PROGS(STRIP, strip, :)
409 AC_CHECK_PROGS(WINDRES, windres, :)
410 if test -z "$HOST_CC"; then
413 if test -z "$HOST_CFLAGS"; then
414 HOST_CFLAGS="$CFLAGS"
416 if test -z "$HOST_CXX"; then
419 if test -z "$HOST_CXXFLAGS"; then
420 HOST_CXXFLAGS="$CXXFLAGS"
422 if test -z "$HOST_LDFLAGS"; then
423 HOST_LDFLAGS="$LDFLAGS"
425 if test -z "$HOST_RANLIB"; then
426 HOST_RANLIB="$RANLIB"
428 if test -z "$HOST_AR"; then
439 if test "$GCC" = "yes"; then
441 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
443 if test "$GXX" = "yes"; then
445 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
447 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
450 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
453 if test "$GNU_CC"; then
454 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
461 if test "$GCC" = yes; then
462 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
467 if test "$GXX" = yes; then
468 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
473 dnl Special win32 checks
474 dnl ========================================================
480 if test -n "$GNU_CC"; then
488 dnl Target the Windows 7 SDK by default
491 MOZ_ARG_WITH_STRING(windows-version,
492 [ --with-windows-version=WINSDK_TARGETVER
493 Highest Windows version to target using this SDK
494 502: Windows Server 2003
497 WINSDK_TARGETVER=$withval)
499 case "$WINSDK_TARGETVER" in
501 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
505 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
510 dnl Vista SDK specific api (deprecated)
511 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
512 [ --disable-vista-sdk-requirements
513 Do not build Vista SDK specific code],
514 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
515 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=$_PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
516 if test -n "$COMPILE_ENVIRONMENT"; then
517 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
518 AC_MSG_WARN([--disable-vista-sdk-requirements is deprecated, use --with-windows-version=502 instead])
519 MOZ_WINSDK_TARGETVER=05020000
522 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
523 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
524 AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
525 # We can't build parental controls either
526 MOZ_DISABLE_PARENTAL_CONTROLS=1
530 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
533 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
534 if test "$GCC" != "yes"; then
535 # Check to see if we are really running in a msvc environemnt
537 AC_CHECK_PROGS(MIDL, midl)
539 # Make sure compilers are valid
540 CFLAGS="$CFLAGS -TC -nologo"
541 CXXFLAGS="$CXXFLAGS -TP -nologo"
544 AC_TRY_COMPILE([#include <stdio.h>],
545 [ printf("Hello World\n"); ],,
546 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
549 AC_TRY_COMPILE([#include <new.h>],
550 [ unsigned *test = new unsigned(42); ],,
551 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
555 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
558 # Determine compiler version
559 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
560 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
561 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
562 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
563 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
564 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
566 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
567 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
569 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
570 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
572 if test "$_CC_MAJOR_VERSION" = "13"; then
574 elif test "$_CC_MAJOR_VERSION" = "14"; then
576 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
577 dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
578 dnl so be very specific here!
579 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
580 if test $_CC_RELEASE -gt 50727; then
582 elif test $_CC_BUILD -ge 762; then
585 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
586 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
587 elif test "$_CC_MAJOR_VERSION" = "15"; then
589 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
590 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
592 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
593 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
595 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
598 _MOZ_RTTI_FLAGS_ON='-GR'
599 _MOZ_RTTI_FLAGS_OFF='-GR-'
600 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
601 _MOZ_EXCEPTIONS_FLAGS_OFF=''
603 if test -n "$WIN32_REDIST_DIR"; then
604 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
608 # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
609 if test "$_CC_SUITE" -ge "8"; then
611 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
614 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
615 if test -n "$MSMT_TOOL"; then
616 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
617 if test -z "$MSMANIFEST_TOOL_VERSION"; then
618 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
623 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
627 # Check linker version
628 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
629 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
630 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
631 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
636 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
637 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
638 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
639 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
640 # Add flags if necessary
641 AC_MSG_CHECKING([for midl flags])
644 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
645 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
646 # MIDL version 7.00.0500 or later has no problem.
647 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
648 AC_MSG_RESULT([need -env win32])
650 AC_MSG_RESULT([none needed])
654 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
657 AC_MSG_RESULT([none needed])
661 # Identify which version of the SDK we're building with
662 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
664 AC_CHECK_HEADERS([winsdkver.h])
665 if test "$ac_cv_header_winsdkver_h" = "yes"; then
666 # Get the highest _WIN32_WINNT and NTDDI versions supported
667 # Take the higher of the two
668 # This is done because the Windows 7 beta SDK reports its
669 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
670 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
672 [cat > conftest.h <<EOF
673 #include <winsdkver.h>
674 #include <sdkddkver.h>
676 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
677 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
679 #define WINSDK_MAXVER NTDDI_MAXVER
684 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
687 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
689 # The Vista SDK is the only one to have sdkddkver.h but not
691 AC_CHECK_HEADERS([sdkddkver.h])
692 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
693 MOZ_WINSDK_MAXVER=0x06000000
695 # Assume the Server 2003 Platform SDK
696 MOZ_WINSDK_MAXVER=0x05020000
700 unset _MSVC_VER_FILTER
703 # Check w32api version
704 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
705 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
706 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
707 AC_TRY_COMPILE([#include <w32api.h>],
708 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
709 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
710 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
711 #error "test failed."
713 , [ res=yes ], [ res=no ])
714 AC_MSG_RESULT([$res])
715 if test "$res" != "yes"; then
716 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
718 # Check windres version
719 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
720 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
721 AC_MSG_RESULT([$_WINDRES_VERSION])
722 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
723 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
724 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
725 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
726 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
727 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
728 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
729 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
730 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
731 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
732 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
733 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
735 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
738 # Server 2003 is the highest version supported
739 MOZ_WINSDK_MAXVER=0x05020000
742 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
743 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
744 # Require OS features provided by IE 5.0
745 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
747 # If the maximum version supported by this SDK is lower than the target
749 AC_MSG_CHECKING([for Windows SDK being recent enough])
750 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
754 AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
757 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
758 # Definitions matching sdkddkver.h
759 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
760 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
761 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
765 dnl Test breaks icc on OS/2 && MSVC
766 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
768 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
772 CC="${srcdir}/build/hcc '$CC'"
773 CXX="${srcdir}/build/hcpp '$CXX'"
780 if test -n "$_WIN32_MSVC"; then
782 SKIP_COMPILER_CHECKS=1
783 SKIP_LIBRARY_CHECKS=1
785 # Since we're skipping compiler and library checks, hard-code
792 AC_DEFINE(HAVE_SETBUF)
793 AC_DEFINE(HAVE_ISATTY)
798 fi # COMPILE_ENVIRONMENT
810 dnl ========================================================
811 dnl Checks for programs.
812 dnl ========================================================
816 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
817 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
818 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
820 AC_MSG_RESULT([$_perl_version])
822 if test "$_perl_res" != 0; then
823 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
827 AC_MSG_CHECKING([for full perl installation])
828 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
830 if test "$_perl_res" != 0; then
832 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
837 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.5 python2.4 python)
838 if test -z "$PYTHON"; then
839 AC_MSG_ERROR([python was not found in \$PATH])
842 if test -z "$COMPILE_ENVIRONMENT"; then
843 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
845 AC_SUBST(NSINSTALL_BIN)
847 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
848 MOZ_PATH_PROG(WHOAMI, whoami, :)
849 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
850 MOZ_PATH_PROG(UNZIP, unzip, :)
851 MOZ_PATH_PROGS(ZIP, zip)
852 if test -z "$ZIP" || test "$ZIP" = ":"; then
853 AC_MSG_ERROR([zip not found in \$PATH])
855 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
856 MOZ_PATH_PROG(XARGS, xargs)
857 if test -z "$XARGS" || test "$XARGS" = ":"; then
858 AC_MSG_ERROR([xargs not found in \$PATH .])
861 if test "$COMPILE_ENVIRONMENT"; then
863 dnl ========================================================
864 dnl = Mac OS X toolchain support
865 dnl ========================================================
869 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
870 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
871 dnl the environment and includedir purposes (when using an SDK, below),
872 dnl but remember the full version number for the libdir (SDK).
874 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
875 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
877 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
878 dnl Bug 280479, but this keeps popping up in bug 292530 too because
879 dnl 4.0.0/4061 is the default compiler in Tiger.
881 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
883 if test "$GCC_BUILD" = "4061" ; then
884 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
885 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
886 from building Mozilla. Upgrade to Xcode 2.1 or later.])
890 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
891 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
892 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
893 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
898 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
900 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
906 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
907 dnl it has moved into /usr/bin.
908 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
912 AC_SUBST(GCC_VERSION)
913 AC_SUBST(XCODEBUILD_VERSION)
914 AC_SUBST(HAS_XCODE_2_1)
916 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
917 dnl that a universal binary is being produced.
918 AC_SUBST(UNIVERSAL_BINARY)
920 dnl ========================================================
921 dnl Check for MacOS deployment target version
922 dnl ========================================================
924 MOZ_ARG_ENABLE_STRING(macos-target,
925 [ --enable-macos-target=VER (default=10.5)
926 Set the minimum MacOS version needed at runtime],
927 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
931 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
932 dnl Use the specified value
933 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
934 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
935 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
936 dnl No value specified on the command line or in the environment,
937 dnl use architecture minimum.
938 export MACOSX_DEPLOYMENT_TARGET=10.5
943 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
945 dnl ========================================================
946 dnl = Mac OS X SDK support
947 dnl ========================================================
950 MOZ_ARG_WITH_STRING(macos-sdk,
951 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
952 MACOS_SDK_DIR=$withval)
954 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
955 dnl NEXT_ROOT will be set and exported only if it's needed.
956 AC_SUBST(MACOS_SDK_DIR)
959 if test "$MACOS_SDK_DIR"; then
960 dnl Sync this section with the ones in NSPR and NSS.
961 dnl Changes to the cross environment here need to be accounted for in
962 dnl the libIDL checks (below) and xpidl build.
964 if test ! -d "$MACOS_SDK_DIR"; then
965 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
966 specify a valid SDK. SDKs are installed when the optional cross-development
967 tools are selected during the Xcode/Developer Tools installation.])
970 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
971 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
972 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
974 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
975 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
977 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
978 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
979 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
981 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
982 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
983 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
984 dnl be ignored and cause warnings when -syslibroot is specified.
985 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
986 dnl the -isysroot it receives, so this is only needed with 4.0.0.
987 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
992 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
994 AC_TRY_COMPILE([#include <new>
995 int main() { return 0; }],
999 AC_MSG_RESULT($result)
1001 if test "$result" = "no" ; then
1002 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1006 fi # COMPILE_ENVIRONMENT
1008 dnl Be sure the make we use is GNU make.
1009 dnl on win32, gmake.exe is the generally the wrong version
1010 if test -n "$MAKE"; then
1011 if test `echo $MAKE | grep -c make.py` != 1; then
1017 cygwin*|mingw*|mks*|msvc*)
1018 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1021 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1024 if test "$GMAKE" = ":"; then
1025 AC_MSG_ERROR([GNU make not found])
1029 if test "$COMPILE_ENVIRONMENT"; then
1035 fi # COMPILE_ENVIRONMENT
1037 dnl ========================================================
1038 dnl set the defaults first
1039 dnl ========================================================
1043 AR_EXTRACT='$(AR) x'
1058 MOZ_USER_DIR=".mozilla"
1060 HOST_AR_FLAGS='$(AR_FLAGS)'
1063 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1065 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1067 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1069 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1071 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1072 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
1073 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1074 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
1075 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1076 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1077 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1081 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1083 USE_DEPENDENT_LIBS=1
1085 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1087 MOZ_ENABLE_POSTSCRIPT=1
1089 if test -n "$CROSS_COMPILE"; then
1090 OS_TARGET="${target_os}"
1091 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1093 case "${target_os}" in
1094 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1095 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1096 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1097 mingw*) OS_ARCH=WINNT ;;
1098 wince*) OS_ARCH=WINCE ;;
1099 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1102 OS_TARGET=`uname -s`
1103 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1104 OS_RELEASE=`uname -r`
1107 # Before this used `uname -m` when not cross compiling
1108 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1109 OS_TEST="${target_cpu}"
1113 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1115 #######################################################################
1116 # Master "Core Components" macros for getting the OS target #
1117 #######################################################################
1120 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1121 # cross-compilation.
1125 # Define and override various archtecture-specific variables, including
1134 case "$HOST_OS_ARCH" in
1135 cygwin*|mingw*|mks*|msvc*)
1145 if test -z "$GNU_CC"; then
1146 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1151 if test -z "$GNU_CXX"; then
1152 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1153 SOLARIS_SUNPRO_CXX=1
1156 AC_SUBST(SOLARIS_SUNPRO_CC)
1157 AC_SUBST(SOLARIS_SUNPRO_CXX)
1169 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1172 HOST_OS_ARCH=UNIXWARE
1184 HOST_OS_ARCH=OpenVMS
1194 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1198 HOST_OS_ARCH=UNIXWARE
1208 # If uname -s returns "Windows_NT", we assume that we are using
1209 # the uname.exe in MKS toolkit.
1211 # The -r option of MKS uname only returns the major version number.
1212 # So we need to use its -v option to get the minor version number.
1213 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1217 OS_MINOR_RELEASE=`uname -v`
1218 if test "$OS_MINOR_RELEASE" = "00"; then
1221 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1223 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1225 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1226 # the uname.exe in the Cygwin tools.
1227 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1228 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1229 # the uname.exe in the GNU-Win32 tools.
1230 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1231 # the uname.exe in the MSYS tools.
1233 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1238 OS_RELEASE=`uname -v`.`uname -r`
1239 OS_TEST=${target_cpu}
1251 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1255 OS_RELEASE=`uname -v`
1279 OS_RELEASE=`uname -v`
1285 OS_RELEASE=`uname -v`
1288 if test "$OS_TARGET" != "NTO"; then
1290 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1299 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1305 OS_RELEASE=`uname -v`
1312 case "${target_cpu}" in
1323 if test -z "$CROSS_COMPILE" ; then
1331 if test "$OS_ARCH" = "NCR"; then
1333 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1337 # Only set CPU_ARCH if we recognize the value of OS_TEST
1348 powerpc | ppc | rs6000)
1352 Alpha | alpha | ALPHA)
1377 if test "$OS_TARGET" = "WINCE"; then
1383 if test -z "$OS_TARGET"; then
1386 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1388 dnl ========================================================
1389 dnl GNU specific defaults
1390 dnl ========================================================
1391 if test "$GNU_CC"; then
1392 # FIXME: Let us build with strict aliasing. bug 414641.
1393 CFLAGS="$CFLAGS -fno-strict-aliasing"
1394 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1395 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1396 DSO_LDOPTS='-shared'
1397 if test "$GCC_USE_GNU_LD"; then
1398 # Don't allow undefined symbols in libraries
1399 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1401 WARNINGS_AS_ERRORS='-Werror'
1403 DSO_PIC_CFLAGS='-fPIC'
1404 ASFLAGS="$ASFLAGS -fPIC"
1405 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1406 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1407 _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1408 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1410 # Turn on GNU specific features
1411 # -Wall - turn on all warnings
1412 # -pedantic - make compiler warn about non-ANSI stuff, and
1413 # be a little bit stricter
1414 # Warnings slamm took out for now (these were giving more noise than help):
1415 # -Wbad-function-cast - warns when casting a function to a new return type
1416 # -Wshadow - removed because it generates more noise than help --pete
1417 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1418 if test -z "$INTEL_CC"; then
1419 # Don't use -Wcast-align with ICC
1421 # And don't use it on hppa, ia64, sparc, since it's noisy there
1422 hppa | ia64 | sparc)
1425 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1430 dnl Turn pedantic on but disable the warnings for long long
1433 if test -z "$INTEL_CC"; then
1434 _IGNORE_LONG_LONG_WARNINGS=1
1435 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1437 _IGNORE_LONG_LONG_WARNINGS=
1441 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1442 _USE_CPP_INCLUDE_FLAG=1
1443 elif test "$SOLARIS_SUNPRO_CC"; then
1444 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1445 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1447 DSO_LDOPTS='-shared'
1448 if test "$GNU_LD"; then
1449 # Don't allow undefined symbols in libraries
1450 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1454 if test "$CPU_ARCH" = "sparc"; then
1455 # for Sun Studio on Solaris/SPARC
1456 DSO_PIC_CFLAGS='-xcode=pic32'
1458 DSO_PIC_CFLAGS='-KPIC'
1460 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1462 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1463 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1465 DSO_LDOPTS='-shared'
1466 if test "$GNU_LD"; then
1467 # Don't allow undefined symbols in libraries
1468 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1472 DSO_PIC_CFLAGS='-KPIC'
1473 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1476 if test "$GNU_CXX"; then
1477 # FIXME: Let us build with strict aliasing. bug 414641.
1478 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1479 # Turn on GNU specific features
1480 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1481 if test -z "$INTEL_CC"; then
1482 # Don't use -Wcast-align with ICC
1484 # And don't use it on hppa, ia64, sparc, since it's noisy there
1485 hppa | ia64 | sparc)
1488 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1493 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1494 _USE_CPP_INCLUDE_FLAG=1
1496 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1497 ac_has_wno_invalid_offsetof,
1501 _SAVE_CXXFLAGS="$CXXFLAGS"
1502 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1505 ac_has_wno_invalid_offsetof="yes",
1506 ac_has_wno_invalid_offsetof="no")
1507 CXXFLAGS="$_SAVE_CXXFLAGS"
1510 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1511 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1514 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1517 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1518 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1519 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1520 dnl normal behavior.
1521 dnl ========================================================
1523 MKSHLIB_UNFORCE_ALL=
1525 if test "$COMPILE_ENVIRONMENT"; then
1526 if test "$GNU_CC"; then
1527 AC_MSG_CHECKING(whether ld has archive extraction flags)
1528 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1529 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1530 ac_cv_mkshlib_force_and_unforce="no"
1531 exec 3<&0 <<LOOP_INPUT
1532 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1533 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1534 force="-Wl,-all"; unforce="-Wl,-none"
1541 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1544 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1546 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1550 eval $ac_cv_mkshlib_force_and_unforce
1551 MKSHLIB_FORCE_ALL=$force
1552 MKSHLIB_UNFORCE_ALL=$unforce
1555 fi # COMPILE_ENVIRONMENT
1557 dnl =================================================================
1558 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1559 dnl which is bad when cross compiling.
1560 dnl =================================================================
1561 if test "$COMPILE_ENVIRONMENT"; then
1562 configure_static_assert_macros='
1563 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1564 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1565 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1568 dnl test that the macros actually work:
1569 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1570 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1573 ac_cv_static_assertion_macros_work="yes"
1574 AC_TRY_COMPILE([$configure_static_assert_macros],
1575 [CONFIGURE_STATIC_ASSERT(1)],
1577 ac_cv_static_assertion_macros_work="no")
1578 AC_TRY_COMPILE([$configure_static_assert_macros],
1579 [CONFIGURE_STATIC_ASSERT(0)],
1580 ac_cv_static_assertion_macros_work="no",
1583 AC_TRY_COMPILE([$configure_static_assert_macros],
1584 [CONFIGURE_STATIC_ASSERT(1)],
1586 ac_cv_static_assertion_macros_work="no")
1587 AC_TRY_COMPILE([$configure_static_assert_macros],
1588 [CONFIGURE_STATIC_ASSERT(0)],
1589 ac_cv_static_assertion_macros_work="no",
1593 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1594 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1595 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1597 fi # COMPILE_ENVIRONMENT
1599 dnl ========================================================
1600 dnl Checking for 64-bit OS
1601 dnl ========================================================
1602 if test "$COMPILE_ENVIRONMENT"; then
1605 AC_MSG_CHECKING(for 64-bit OS)
1606 AC_TRY_COMPILE([$configure_static_assert_macros],
1607 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1608 result="yes", result="no")
1609 AC_MSG_RESULT("$result")
1610 if test "$result" = "yes"; then
1611 AC_DEFINE(HAVE_64BIT_OS)
1614 AC_SUBST(HAVE_64BIT_OS)
1616 fi # COMPILE_ENVIRONMENT
1618 dnl ========================================================
1619 dnl Enable high-memory support on OS/2 by default.
1620 dnl ========================================================
1621 MOZ_OS2_HIGH_MEMORY=1
1622 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1623 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1624 MOZ_OS2_HIGH_MEMORY=,
1625 MOZ_OS2_HIGH_MEMORY=1 )
1626 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1628 dnl ========================================================
1629 dnl System overrides of the defaults for host
1630 dnl ========================================================
1633 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1634 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1635 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1638 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1639 # we need Python 2.5 on Windows
1641 if test -n "$_WIN32_MSVC"; then
1643 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1644 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1645 HOST_RANLIB='echo ranlib'
1647 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1649 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1650 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1651 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1652 HOST_BIN_SUFFIX=.exe
1655 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1656 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1659 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1660 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1662 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1664 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1666 PERL="${CYGWIN_WRAPPER} $PERL"
1669 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1670 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1675 case "${host_cpu}" in
1677 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1683 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1684 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1685 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1686 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1689 *-linux*|*-kfreebsd*-gnu)
1690 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1691 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1692 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1696 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1697 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1698 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1699 HOST_BIN_SUFFIX=.exe
1704 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1705 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1706 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1710 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1711 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1715 dnl We require version 2.4 or newer of Python to build,
1716 dnl and 2.5 or newer on Windows.
1717 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1719 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1722 if test "$_python_res" != 0; then
1723 AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1725 AC_MSG_RESULT([yes])
1727 dnl Get mozilla version from central milestone file
1728 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1730 dnl Get version of various core apps from the version files.
1731 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1733 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1734 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1736 dnl ========================================================
1737 dnl System overrides of the defaults for target
1738 dnl ========================================================
1743 if test ! "$GNU_CC"; then
1744 if test ! "$HAVE_64BIT_OS"; then
1745 # Compiling with Visual Age C++ object model compat is the
1746 # default. To compile with object model ibm, add
1747 # AIX_OBJMODEL=ibm to .mozconfig.
1748 if test "$AIX_OBJMODEL" = "ibm"; then
1749 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1756 AC_SUBST(AIX_OBJMODEL)
1757 DSO_LDOPTS='-qmkshrobj=1'
1758 DSO_CFLAGS='-qflag=w:w'
1760 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1761 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1763 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1764 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1765 if test "$COMPILE_ENVIRONMENT"; then
1768 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1770 [#if (__IBMCPP__ < 600)
1771 #error "Bad compiler"
1773 _BAD_COMPILER=,_BAD_COMPILER=1)
1774 if test -n "$_BAD_COMPILER"; then
1776 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1778 AC_MSG_RESULT([yes])
1781 TARGET_COMPILER_ABI="ibmc"
1782 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1783 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1786 case "${target_os}" in
1791 if test "$COMPILE_ENVIRONMENT"; then
1792 AC_CHECK_HEADERS(sys/inttypes.h)
1794 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1799 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1800 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1801 DSO_LDOPTS='-nostart'
1802 TK_LIBS='-lbe -lroot'
1804 if test "$COMPILE_ENVIRONMENT"; then
1805 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1806 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1808 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1809 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1812 MOZ_USER_DIR="Mozilla"
1816 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1818 _IGNORE_LONG_LONG_WARNINGS=
1826 _WARNINGS_CFLAGS="-Wall"
1827 _WARNINGS_CXXFLAGS="-Wall"
1828 # The test above doesn't work properly, at least on 3.1.
1829 MKSHLIB_FORCE_ALL=''
1830 MKSHLIB_UNFORCE_ALL=''
1836 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1837 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1838 MOZ_OPTIMIZE_FLAGS="-O3"
1840 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1841 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1844 STRIP="$STRIP -x -S"
1845 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1846 MOZ_ENABLE_POSTSCRIPT=
1847 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1848 # The ExceptionHandling framework is needed for Objective-C exception
1849 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1851 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1853 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1854 dnl ===================================================================
1855 if test "x$enable_dtrace" = "xyes"; then
1856 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1858 dnl check for the presence of the -dead_strip linker flag
1859 AC_MSG_CHECKING([for -dead_strip option to ld])
1860 _SAVE_LDFLAGS=$LDFLAGS
1861 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1862 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1863 if test -n "$_HAVE_DEAD_STRIP" ; then
1864 AC_MSG_RESULT([yes])
1865 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1870 LDFLAGS=$_SAVE_LDFLAGS
1875 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1876 DLL_SUFFIX=".so.1.0"
1877 DSO_LDOPTS="-shared"
1879 if test ! "$GNU_CC"; then
1880 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1882 # Can't have force w/o an unforce.
1883 # # Hack for FreeBSD 2.2
1884 # if test -z "$MKSHLIB_FORCE_ALL"; then
1885 # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1886 # MKSHLIB_UNFORCE_ALL=''
1892 if test ! "$GNU_CC"; then
1893 DSO_LDOPTS='-b -Wl,+s'
1896 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1897 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1898 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1900 DSO_LDOPTS='-b -E +s'
1901 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1902 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1904 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1905 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1910 DSO_LDOPTS='-elf -shared'
1912 if test "$GNU_CC"; then
1913 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1914 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1915 MKSHLIB_FORCE_ALL='-Wl,-all'
1916 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1917 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1919 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1920 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1921 MKSHLIB_FORCE_ALL='-all'
1922 MKSHLIB_UNFORCE_ALL='-none'
1928 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1929 dnl compile and link using -n32
1931 TARGET_COMPILER_ABI=n32
1932 DSO_LDOPTS='-elf -shared'
1933 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1934 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1935 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1936 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1937 if test "$GNU_CC"; then
1938 MKSHLIB_FORCE_ALL='-Wl,-all'
1939 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1940 _WARNINGS_CFLAGS="-Wall"
1941 _WARNINGS_CXXFLAGS="-Wall"
1942 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1944 MKSHLIB_FORCE_ALL='-all'
1945 MKSHLIB_UNFORCE_ALL='-none'
1951 CFLAGS="$CFLAGS -woff 3262 -G 4"
1952 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1953 if test -n "$USE_N32"; then
1954 ASFLAGS="$ASFLAGS -n32"
1955 CFLAGS="$CFLAGS -n32"
1956 CXXFLAGS="$CXXFLAGS -n32"
1957 LDFLAGS="$LDFLAGS -n32"
1959 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1960 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1963 if test -z "$GNU_CXX"; then
1969 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1970 # Similarly for GNU_CXX and INTEL_CXX.
1971 if test "$INTEL_CC" || test "$INTEL_CXX"; then
1972 # -Os has been broken on Intel's C/C++ compilers for quite a
1973 # while; Intel recommends against using it.
1974 MOZ_OPTIMIZE_FLAGS="-O2"
1975 MOZ_DEBUG_FLAGS="-g -fno-inline"
1976 elif test "$GNU_CC" || test "$GNU_CXX"; then
1977 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1978 case $GCC_VERSION in
1980 # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1981 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1983 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1984 MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb,
1985 # and that combo is not yet good at
1986 # debugging inlined functions (even
1987 # when using DWARF2 as the debugging
1991 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1995 case "${target_cpu}" in
1997 CFLAGS="$CFLAGS -mieee"
1998 CXXFLAGS="$CXXFLAGS -mieee"
2004 MOZ_DEBUG_FLAGS="-g" # We want inlining
2010 TARGET_COMPILER_ABI=msvc
2011 _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2012 _PLATFORM_MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1
2013 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2014 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2016 AR_EXTRACT="$AR -extract"
2018 AR_FLAGS='-OUT:"$@"'
2020 if test "$AS_BIN"; then
2027 if test -z "$RC"; then
2030 # certain versions of cygwin's makedepend barf on the
2031 # #include <string> vs -I./dist/include/string issue so don't use it
2037 HOST_AR='lib -OUT:$@'
2038 HOST_RANLIB='echo ranlib'
2039 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2042 WARNINGS_AS_ERRORS='-WX'
2043 MOZ_OPTIMIZE_FLAGS='-Ox'
2044 AR_FLAGS='-NOLOGO -OUT:"$@"'
2046 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2047 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2050 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2051 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2053 IMPORT_LIB_SUFFIX=lib
2055 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2058 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2059 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2061 MKSHLIB_UNFORCE_ALL=
2062 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2063 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2064 MOZ_DEBUG_FLAGS='-Zi'
2065 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2067 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2069 RANLIB='echo not_ranlib'
2070 STRIP='echo not_strip'
2071 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2074 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2076 LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2077 LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2081 AC_DEFINE(HAVE_SNPRINTF)
2086 AC_DEFINE(HW_THREADS)
2087 AC_DEFINE(STDC_HEADERS)
2088 AC_DEFINE(NEW_H, <new>)
2089 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2090 AC_DEFINE(HAVE_LOCALTIME_R)
2092 TARGET_MD_ARCH=win32
2093 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2095 MOZ_ENABLE_POSTSCRIPT=
2096 MOZ_USER_DIR="Mozilla"
2098 MOZ_GFX_OPTIMIZE_MOBILE=1
2100 # Sanity check for WINCE_WINDOWS_MOBILE
2101 # XXX disabled until we can fix the mobile tinderbox
2102 ##if test "$WINCE_WINDOWS_MOBILE"; then
2103 ## AC_CHECK_HEADER(tpcshell.h, [],
2104 ## AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2109 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2114 # certain versions of cygwin's makedepend barf on the
2115 # #include <string> vs -I./dist/include/string issue so don't use it
2117 if test -n "$GNU_CC"; then
2118 CC="$CC -mno-cygwin"
2119 CXX="$CXX -mno-cygwin"
2120 CPP="$CPP -mno-cygwin"
2121 CFLAGS="$CFLAGS -mms-bitfields"
2122 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2123 DSO_LDOPTS='-shared'
2124 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2125 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2127 # Use temp file for windres (bug 213281)
2128 RCFLAGS='-O coff --use-temp-file'
2129 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2130 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2131 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2133 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2134 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2136 IMPORT_LIB_SUFFIX=dll.a
2138 TARGET_COMPILER_ABI=msvc
2142 if test "$AS_BIN"; then
2143 AS="$(basename "$AS_BIN")"
2145 AR='lib -NOLOGO -OUT:"$@"'
2147 RANLIB='echo not_ranlib'
2148 STRIP='echo not_strip'
2153 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2159 IMPORT_LIB_SUFFIX=lib
2160 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2161 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2163 MKSHLIB_UNFORCE_ALL=
2164 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2165 _USE_CPP_INCLUDE_FLAG=1
2166 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2167 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2168 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2169 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2170 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2171 MOZ_DEBUG_FLAGS='-Zi'
2172 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2173 WARNINGS_AS_ERRORS='-WX'
2174 MOZ_OPTIMIZE_FLAGS='-O1'
2175 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2177 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2178 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2179 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2180 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2181 if test $_MSC_VER -ge 1400; then
2182 LDFLAGS="$LDFLAGS -NXCOMPAT"
2183 dnl For profile-guided optimization
2184 PROFILE_GEN_CFLAGS="-GL"
2185 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2186 dnl XXX: PGO builds can fail with warnings treated as errors,
2187 dnl specifically "no profile data available" appears to be
2188 dnl treated as an error sometimes. This might be a consequence
2189 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2190 dnl with the linker doing most of the work in the whole-program
2191 dnl optimization/PGO case. I think it's probably a compiler bug,
2192 dnl but we work around it here.
2193 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2194 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2195 dnl Probably also a compiler bug, but what can you do?
2196 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2197 if test -n "$_USE_DYNAMICBASE"; then
2198 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2202 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2203 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2204 AC_DEFINE(HAVE_SNPRINTF)
2209 AC_DEFINE(HW_THREADS)
2210 AC_DEFINE(STDC_HEADERS)
2211 AC_DEFINE(NEW_H, <new>)
2212 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2213 TARGET_MD_ARCH=win32
2214 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2216 MOZ_ENABLE_POSTSCRIPT=
2217 MOZ_USER_DIR="Mozilla"
2219 dnl Hardcode to win95 for now - cls
2220 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2222 dnl set NO_X11 defines here as the general check is skipped on win32
2226 dnl MinGW/MSYS doesn't provide or need cygpath
2231 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2233 *-cygwin*|*-msvc*|*-mks*)
2234 CYGPATH_W="cygpath -a -w"
2235 CYGPATH_S="sed -e s|\\\\|/|g"
2236 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2240 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2242 if test -z "$MOZ_TOOLS"; then
2243 AC_MSG_ERROR([MOZ_TOOLS is not set])
2246 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2247 if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2248 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2250 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2251 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2252 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2254 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2256 if test -n "$GLIB_PREFIX"; then
2257 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2258 if test "$?" = "0"; then
2259 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2260 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2262 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2264 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2267 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2269 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2270 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2272 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2273 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2274 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2275 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2276 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2278 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2281 if test -n "$LIBIDL_PREFIX"; then
2282 _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2283 if test "$?" = "0"; then
2284 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2285 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2287 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2289 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2292 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2294 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2295 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2297 LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2298 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2299 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2301 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2302 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2304 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2306 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2309 *) # else cross-compiling
2310 if test -n "$GLIB_PREFIX"; then
2311 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2312 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2313 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2314 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2315 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2317 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2320 if test -n "$LIBIDL_PREFIX"; then
2321 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2322 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2323 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2325 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2326 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2328 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2331 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2338 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])
2342 AC_CHECK_HEADERS(oleacc.idl)
2346 AC_CHECK_HEADERS(atlbase.h)
2353 if test "$HAVE_64BIT_OS"; then
2354 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2357 if test $_MSC_VER -ge 1400; then
2358 LDFLAGS="$LDFLAGS -SAFESEH"
2360 AC_CHECK_HEADERS(mmintrin.h)
2373 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2377 if test "$HAVE_64BIT_OS"; then
2384 CFLAGS="$CFLAGS -Dunix"
2385 CXXFLAGS="$CXXFLAGS -Dunix"
2386 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2388 DSO_PIC_CFLAGS='-fPIC -DPIC'
2389 DSO_LDOPTS='-shared'
2390 BIN_FLAGS='-Wl,--export-dynamic'
2392 DSO_PIC_CFLAGS='-fPIC -DPIC'
2393 DLL_SUFFIX=".so.1.0"
2394 DSO_LDOPTS='-shared'
2396 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2397 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2398 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2399 if test "$LIBRUNPATH"; then
2400 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2402 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2403 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2408 AC_DEFINE(_QNX_SOURCE)
2411 WARNINGS_AS_ERRORS=''
2412 MOZ_OPTIMIZE_FLAGS="-O"
2413 MOZ_DEBUG_FLAGS="-gstabs"
2416 LIBS="$LIBS -lsocket -lstdc++"
2417 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2418 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2419 if test "$with_x" != "yes"
2421 _PLATFORM_DEFAULT_TOOLKIT="photon"
2422 TK_CFLAGS='-I/usr/include/photon'
2425 case "${target_cpu}" in
2427 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2430 case "${host_cpu}" in
2438 DLL_SUFFIX=".so.1.0"
2440 DSO_PIC_CFLAGS='-fPIC'
2441 DSO_LDOPTS='-shared -fPIC'
2442 if test "$LIBRUNPATH"; then
2443 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2448 AC_DEFINE(NO_PW_GECOS)
2449 AC_DEFINE(NO_UDSOCK)
2450 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2452 MKSHLIB_FORCE_ALL='-all'
2453 MKSHLIB_UNFORCE_ALL='-none'
2455 AS_DASH_C_FLAG='-Wc/names=as_is'
2457 DSO_LDOPTS='-shared -auto_symvec'
2459 MOZ_DEBUG_LDFLAGS='-g'
2461 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2462 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2467 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2468 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2471 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2472 AC_DEFINE(TCPV40HDRS)
2478 IMPORT_LIB_SUFFIX=lib
2482 CFLAGS="$CFLAGS -Zomf"
2483 CXXFLAGS="$CXXFLAGS -Zomf"
2485 BIN_FLAGS='-Zlinker /ST:0x100000'
2489 WARNINGS_AS_ERRORS='-Werror'
2490 MOZ_DEBUG_FLAGS="-g -fno-inline"
2491 MOZ_OPTIMIZE_FLAGS="-O2"
2492 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2493 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2494 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2496 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2497 MOZ_ENABLE_POSTSCRIPT=
2500 MOZ_USER_DIR="Mozilla"
2502 if test "$MOZTOOLS"; then
2503 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2505 AC_MSG_ERROR([MOZTOOLS is not set])
2507 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2508 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2509 LDFLAGS="$LDFLAGS -Zhigh-mem"
2510 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2511 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2514 # GCC for OS/2 currently predefines these, but we don't want them
2515 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2516 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2518 AC_CACHE_CHECK(for __declspec(dllexport),
2520 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2522 ac_os2_declspec="yes",
2523 ac_os2_declspec="no")])
2524 if test "$ac_os2_declspec" = "yes"; then
2526 MOZ_OS2_USE_DECLSPEC='1'
2531 if test "$GNU_CC"; then
2532 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2533 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2536 MOZ_DEBUG_FLAGS='-g'
2537 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2538 CFLAGS="$CFLAGS -ieee"
2539 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2540 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2543 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2544 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2545 MKSHLIB_FORCE_ALL='-all'
2546 MKSHLIB_UNFORCE_ALL='-none'
2547 dnl Might fix the libxpcom.so breakage on this platform as well....
2548 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2549 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2551 if test -z "$GNU_CXX"; then
2554 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2558 DIRENT_INO=d_stat.st_ino
2559 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2560 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2561 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2562 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2563 AC_DEFINE(STDC_HEADERS)
2564 if test "$no_x" = "yes"; then
2565 _PLATFORM_DEFAULT_TOOLKIT='photon'
2566 TK_CFLAGS='-I/usr/nto/include/photon'
2567 TK_LIBS='-lphoton -lphrender'
2572 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2573 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2574 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2575 if test ! "$GNU_CC"; then
2580 dnl the qsort routine under solaris is faulty
2583 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2585 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2586 # libraries one level up (e.g. libnspr4.so)
2587 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2589 if test "$SOLARIS_SUNPRO_CC"; then
2590 LIBS="-lCrun -lCstd $LIBS"
2593 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2594 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2595 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2596 LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2597 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2598 _SAVE_LDFLAGS=$LDFLAGS
2599 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2600 AC_TRY_LINK([#include <stdio.h>],
2601 [printf("Hello World\n");],
2603 [LDFLAGS=$_SAVE_LDFLAGS])
2605 WARNINGS_AS_ERRORS='-Werror'
2606 MOZ_OPTIMIZE_FLAGS="-xO4"
2607 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2608 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2609 MKSHLIB_FORCE_ALL='-z allextract'
2610 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2611 DSO_LDOPTS='-G -z muldefs'
2617 AS='/usr/ccs/bin/as'
2618 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2620 TARGET_COMPILER_ABI="sunc"
2621 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2622 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2623 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2627 [#if (__SUNPRO_CC < 0x590)
2630 _BAD_COMPILER=,_BAD_COMPILER=1)
2631 if test -n "$_BAD_COMPILER"; then
2633 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2637 AC_MSG_RESULT([$_res])
2640 ASFLAGS="$ASFLAGS -fPIC"
2643 _WARNINGS_CXXFLAGS=''
2644 if test "$OS_RELEASE" = "5.3"; then
2645 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2648 if test "$OS_RELEASE" = "5.5.1"; then
2649 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2654 DSO_LDOPTS='-Bdynamic'
2655 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2656 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2658 AC_DEFINE(SPRINTF_RETURNS_STRING)
2659 case "$(target_os)" in
2661 DLL_SUFFIX='.so.1.0'
2667 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2671 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2676 dnl Only one oddball right now (QNX), but this gives us flexibility
2677 dnl if any other platforms need to override this in the future.
2678 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2680 dnl ========================================================
2681 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2682 dnl by now will not have any way to link most binaries (tests
2683 dnl as well as viewer, apprunner, etc.), because some symbols
2684 dnl will be left out of the "composite" .so's by ld as unneeded.
2685 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2686 dnl they can link in the static libs that provide the missing
2688 dnl ========================================================
2689 NO_LD_ARCHIVE_FLAGS=
2690 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2691 NO_LD_ARCHIVE_FLAGS=1
2695 NO_LD_ARCHIVE_FLAGS=
2698 NO_LD_ARCHIVE_FLAGS=
2701 NO_LD_ARCHIVE_FLAGS=
2703 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2704 if test -z "$GNU_CC"; then
2705 NO_LD_ARCHIVE_FLAGS=
2709 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2711 dnl ========================================================
2712 dnl = Flags to strip unused symbols from .so components
2713 dnl ========================================================
2715 *-linux*|*-kfreebsd*-gnu)
2716 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2719 if test -z "$GNU_CC"; then
2720 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2722 if test -z "$GCC_USE_GNU_LD"; then
2723 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2725 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2730 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2733 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2735 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2736 if test -n "$GNU_CC"; then
2737 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2742 if test -z "$COMPILE_ENVIRONMENT"; then
2743 SKIP_COMPILER_CHECKS=1
2744 SKIP_LIBRARY_CHECKS=1
2747 if test -z "$SKIP_COMPILER_CHECKS"; then
2748 dnl Checks for typedefs, structures, and compiler characteristics.
2749 dnl ========================================================
2757 AC_STRUCT_ST_BLKSIZE
2758 AC_MSG_CHECKING(for siginfo_t)
2759 AC_CACHE_VAL(ac_cv_siginfo_t,
2760 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2761 #include <signal.h>],
2763 [ac_cv_siginfo_t=true],
2764 [ac_cv_siginfo_t=false])])
2765 if test "$ac_cv_siginfo_t" = true ; then
2766 AC_DEFINE(HAVE_SIGINFO_T)
2772 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2773 dnl ========================================================
2774 AC_MSG_CHECKING(for int16_t)
2775 AC_CACHE_VAL(ac_cv_int16_t,
2776 [AC_TRY_COMPILE([#include <stdio.h>
2777 #include <sys/types.h>],
2779 [ac_cv_int16_t=true],
2780 [ac_cv_int16_t=false])])
2781 if test "$ac_cv_int16_t" = true ; then
2782 AC_DEFINE(HAVE_INT16_T)
2787 AC_MSG_CHECKING(for int32_t)
2788 AC_CACHE_VAL(ac_cv_int32_t,
2789 [AC_TRY_COMPILE([#include <stdio.h>
2790 #include <sys/types.h>],
2792 [ac_cv_int32_t=true],
2793 [ac_cv_int32_t=false])])
2794 if test "$ac_cv_int32_t" = true ; then
2795 AC_DEFINE(HAVE_INT32_T)
2800 AC_MSG_CHECKING(for int64_t)
2801 AC_CACHE_VAL(ac_cv_int64_t,
2802 [AC_TRY_COMPILE([#include <stdio.h>
2803 #include <sys/types.h>],
2805 [ac_cv_int64_t=true],
2806 [ac_cv_int64_t=false])])
2807 if test "$ac_cv_int64_t" = true ; then
2808 AC_DEFINE(HAVE_INT64_T)
2813 AC_MSG_CHECKING(for int64)
2814 AC_CACHE_VAL(ac_cv_int64,
2815 [AC_TRY_COMPILE([#include <stdio.h>
2816 #include <sys/types.h>],
2819 [ac_cv_int64=false])])
2820 if test "$ac_cv_int64" = true ; then
2821 AC_DEFINE(HAVE_INT64)
2826 AC_MSG_CHECKING(for uint)
2827 AC_CACHE_VAL(ac_cv_uint,
2828 [AC_TRY_COMPILE([#include <stdio.h>
2829 #include <sys/types.h>],
2832 [ac_cv_uint=false])])
2833 if test "$ac_cv_uint" = true ; then
2834 AC_DEFINE(HAVE_UINT)
2839 AC_MSG_CHECKING(for uint_t)
2840 AC_CACHE_VAL(ac_cv_uint_t,
2841 [AC_TRY_COMPILE([#include <stdio.h>
2842 #include <sys/types.h>],
2844 [ac_cv_uint_t=true],
2845 [ac_cv_uint_t=false])])
2846 if test "$ac_cv_uint_t" = true ; then
2847 AC_DEFINE(HAVE_UINT_T)
2852 AC_MSG_CHECKING(for uint16_t)
2853 AC_CACHE_VAL(ac_cv_uint16_t,
2854 [AC_TRY_COMPILE([#include <stdio.h>
2855 #include <sys/types.h>],
2856 [uint16_t foo = 0;],
2857 [ac_cv_uint16_t=true],
2858 [ac_cv_uint16_t=false])])
2859 if test "$ac_cv_uint16_t" = true ; then
2860 AC_DEFINE(HAVE_UINT16_T)
2866 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2867 dnl are defined when compiling C++ but not C. Since the result of this
2868 dnl test is used only in C++, do it in C++.
2871 AC_MSG_CHECKING(for uname.domainname)
2872 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2873 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2874 [ struct utsname *res; char *domain;
2875 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2876 [ac_cv_have_uname_domainname_field=true],
2877 [ac_cv_have_uname_domainname_field=false])])
2879 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2880 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2886 AC_MSG_CHECKING(for uname.__domainname)
2887 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2888 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2889 [ struct utsname *res; char *domain;
2890 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2891 [ac_cv_have_uname_us_domainname_field=true],
2892 [ac_cv_have_uname_us_domainname_field=false])])
2894 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2895 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2903 dnl Check for usable char16_t (2 bytes, unsigned)
2904 dnl (we might not need the unsignedness check anymore)
2905 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
2906 ac_cv_have_usable_char16_t,
2907 [AC_TRY_COMPILE([$configure_static_assert_macros],
2908 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
2909 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
2910 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
2911 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
2912 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
2913 ac_cv_have_usable_char16_t="yes",
2914 ac_cv_have_usable_char16_t="no")])
2915 if test "$ac_cv_have_usable_char16_t" = "yes"; then
2916 AC_DEFINE(HAVE_CPP_CHAR16_T)
2920 dnl Check for usable wchar_t (2 bytes, unsigned)
2921 dnl (we really don't need the unsignedness check anymore)
2922 dnl ========================================================
2924 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2925 ac_cv_have_usable_wchar_v2,
2926 [AC_TRY_COMPILE([#include <stddef.h>
2927 $configure_static_assert_macros],
2928 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2929 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2930 ac_cv_have_usable_wchar_v2="yes",
2931 ac_cv_have_usable_wchar_v2="no")])
2932 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2933 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2934 HAVE_CPP_2BYTE_WCHAR_T=1
2935 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
2936 dnl This is really gcc-only
2937 dnl Do this test using CXX only since some versions of gcc
2938 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2939 dnl only have short-wchar support for c++.
2940 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2942 _SAVE_CXXFLAGS=$CXXFLAGS
2943 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2945 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2946 ac_cv_have_usable_wchar_option_v2,
2947 [AC_TRY_LINK([#include <stddef.h>
2948 $configure_static_assert_macros],
2949 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2950 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2951 ac_cv_have_usable_wchar_option_v2="yes",
2952 ac_cv_have_usable_wchar_option_v2="no")])
2954 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2955 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2956 HAVE_CPP_2BYTE_WCHAR_T=1
2957 WCHAR_CFLAGS="-fshort-wchar"
2959 CXXFLAGS=$_SAVE_CXXFLAGS
2965 dnl Check for .hidden assembler directive and visibility attribute.
2966 dnl Borrowed from glibc configure.in
2967 dnl ===============================================================
2968 if test "$GNU_CC"; then
2969 AC_CACHE_CHECK(for visibility(hidden) attribute,
2970 ac_cv_visibility_hidden,
2971 [cat > conftest.c <<EOF
2972 int foo __attribute__ ((visibility ("hidden"))) = 1;
2974 ac_cv_visibility_hidden=no
2975 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2976 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2977 ac_cv_visibility_hidden=yes
2982 if test "$ac_cv_visibility_hidden" = "yes"; then
2983 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2985 AC_CACHE_CHECK(for visibility(default) attribute,
2986 ac_cv_visibility_default,
2987 [cat > conftest.c <<EOF
2988 int foo __attribute__ ((visibility ("default"))) = 1;
2990 ac_cv_visibility_default=no
2991 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2992 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2993 ac_cv_visibility_default=yes
2998 if test "$ac_cv_visibility_default" = "yes"; then
2999 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3001 AC_CACHE_CHECK(for visibility pragma support,
3002 ac_cv_visibility_pragma,
3003 [cat > conftest.c <<EOF
3004 #pragma GCC visibility push(hidden)
3006 #pragma GCC visibility push(default)
3007 int foo_default = 1;
3009 ac_cv_visibility_pragma=no
3010 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3011 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3012 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3013 ac_cv_visibility_pragma=yes
3019 if test "$ac_cv_visibility_pragma" = "yes"; then
3020 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3021 ac_cv_have_visibility_class_bug,
3022 [cat > conftest.c <<EOF
3023 #pragma GCC visibility push(hidden)
3024 struct __attribute__ ((visibility ("default"))) TestStruct {
3027 __attribute__ ((visibility ("default"))) void TestFunc() {
3031 ac_cv_have_visibility_class_bug=no
3032 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3033 ac_cv_have_visibility_class_bug=yes
3035 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3036 ac_cv_have_visibility_class_bug=yes
3039 rm -rf conftest.{c,S}
3042 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3043 ac_cv_have_visibility_builtin_bug,
3044 [cat > conftest.c <<EOF
3045 #pragma GCC visibility push(hidden)
3046 #pragma GCC visibility push(default)
3048 #pragma GCC visibility pop
3050 __attribute__ ((visibility ("default"))) void Func() {
3052 memset(c, 0, sizeof(c));
3055 ac_cv_have_visibility_builtin_bug=no
3056 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3057 ac_cv_have_visibility_builtin_bug=yes
3059 if test `grep -c "@PLT" conftest.S` = 0; then
3060 ac_cv_visibility_builtin_bug=yes
3063 rm -f conftest.{c,S}
3065 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3066 "$ac_cv_have_visibility_class_bug" = "no"; then
3067 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3068 WRAP_SYSTEM_INCLUDES=1
3070 VISIBILITY_FLAGS='-fvisibility=hidden'
3071 fi # have visibility pragma bug
3072 fi # have visibility pragma
3073 fi # have visibility(default) attribute
3074 fi # have visibility(hidden) attribute
3077 # visibility hidden flag for Sun Studio on Solaris
3078 if test "$SOLARIS_SUNPRO_CC"; then
3079 VISIBILITY_FLAGS='-xldscope=hidden'
3080 fi # Sun Studio on Solaris
3082 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3083 AC_SUBST(VISIBILITY_FLAGS)
3085 dnl Checks for header files.
3086 dnl ========================================================
3088 case "$target_os" in
3090 # for stuff like -lXshm
3091 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3094 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3095 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3096 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3097 AC_CHECK_HEADERS(malloc.h)
3098 AC_CHECK_HEADERS(X11/XKBlib.h)
3099 AC_CHECK_HEADERS(io.h)
3101 dnl These are all the places some variant of statfs can be hiding.
3102 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3105 AC_CHECK_HEADERS(sys/quota.h)
3107 dnl Try for MMX support
3108 dnl NB - later gcc versions require -mmmx for this header to be successfully
3109 dnl included (or another option which implies it, such as -march=pentium-mmx)
3110 AC_CHECK_HEADERS(mmintrin.h)
3112 dnl Check whether the compiler supports the new-style C++ standard
3113 dnl library headers (i.e. <new>) or needs the old "new.h"
3116 AC_CHECK_HEADER(new, [NEW_H=new])
3117 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3120 AC_ARG_ENABLE(dtrace,
3121 [ --enable-dtrace build with dtrace support if available (default=no)],
3122 [enable_dtrace="yes"],)
3123 if test "x$enable_dtrace" = "xyes"; then
3124 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3125 if test -n "$HAVE_DTRACE"; then
3126 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3128 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3131 AC_SUBST(HAVE_DTRACE)
3137 AC_CHECK_HEADERS(sys/cdefs.h)
3141 dnl Checks for libraries.
3142 dnl ========================================================
3147 AC_CHECK_LIB(c_r, gethostbyname_r)
3151 dnl We don't want to link with libdl even if it's present on OS X, since
3152 dnl it's not used and not part of the default installation.
3153 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3154 dnl We don't want to link against libm or libpthread on Darwin since
3155 dnl they both are just symlinks to libSystem and explicitly linking
3156 dnl against libSystem causes issues when debugging (see bug 299601).
3165 AC_CHECK_LIB(m, atan)
3166 AC_CHECK_LIB(dl, dlopen,
3167 AC_CHECK_HEADER(dlfcn.h,
3169 AC_DEFINE(HAVE_LIBDL)))
3173 _SAVE_CFLAGS="$CFLAGS"
3174 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3175 AC_CHECK_FUNCS(dladdr)
3176 CFLAGS="$_SAVE_CFLAGS"
3178 if test ! "$GNU_CXX"; then
3182 AC_CHECK_LIB(C_r, demangle)
3185 AC_CHECK_LIB(C, demangle)
3190 dnl OS/2 has socket in libc.
3195 AC_CHECK_LIB(socket, socket)
3198 dnl ========================================================
3199 dnl Check whether we can compile code for Core Text
3200 dnl (Mac OS X 10.5 or later)
3201 dnl ========================================================
3204 AC_MSG_CHECKING([for Core Text])
3205 AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3206 [CTLineRef lineRef;],
3207 ac_cv_have_core_text="yes",
3208 ac_cv_have_core_text="no")
3209 AC_MSG_RESULT([$ac_cv_have_core_text])
3213 MOZ_ARG_DISABLE_BOOL(coretext,
3214 [ --disable-coretext Use ATSUI instead of Core Text for text rendering],
3218 if test -n "$MOZ_CORETEXT"; then
3219 if test "$ac_cv_have_core_text" = "no"; then
3220 AC_MSG_ERROR([--enable-coretext requires MacOS SDK 10.5 or newer])
3222 AC_DEFINE(MOZ_CORETEXT)
3227 AC_SUBST(MOZ_CORETEXT)
3230 XLIBS="$X_EXTRA_LIBS"
3232 dnl ========================================================
3233 dnl Checks for X libraries.
3234 dnl Ordering is important.
3235 dnl Xt is dependent upon SM as of X11R6
3236 dnl ========================================================
3237 if test "$no_x" = "yes"; then
3240 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3241 XLIBS="-lX11 $XLIBS"
3242 _SAVE_LDFLAGS="$LDFLAGS"
3243 LDFLAGS="$XLDFLAGS $LDFLAGS"
3244 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3245 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3246 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3247 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3249 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3250 unset ac_cv_lib_Xt_XtFree
3251 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3252 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3253 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3254 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3257 # AIX needs the motif library linked before libXt to prevent
3258 # crashes in plugins linked against Motif - Bug #98892
3259 case "${target_os}" in
3261 XT_LIBS="-lXm $XT_LIBS"
3265 dnl ========================================================
3266 dnl = Check for XShm
3267 dnl ========================================================
3268 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3270 AC_CHECK_HEADER(X11/extensions/XShm.h)
3271 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3272 test -n "$_HAVE_XSHM_XEXT"; then
3273 AC_DEFINE(HAVE_XSHM)
3276 dnl ========================================================
3278 dnl ========================================================
3279 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3281 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3283 if test "$MOZ_XIE_LIBS"; then
3284 dnl ====================================================
3285 dnl = If XIE is present and is desired, turn it on
3286 dnl ====================================================
3296 LDFLAGS="$_SAVE_LDFLAGS"
3298 dnl ========================================================
3299 dnl = Check for freetype2 and its functionality
3300 dnl ========================================================
3301 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3303 if test "$_HAVE_FREETYPE2"; then
3305 _SAVE_CFLAGS="$CFLAGS"
3306 LIBS="$LIBS $FT2_LIBS"
3307 CFLAGS="$CFLAGS $FT2_CFLAGS"
3309 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3310 ac_cv_member_FT_Bitmap_Size_y_ppem,
3311 [AC_TRY_COMPILE([#include <ft2build.h>
3312 #include FT_FREETYPE_H],
3314 if (sizeof s.y_ppem) return 0;
3316 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3317 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3318 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3319 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3321 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3323 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3324 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3325 [FT_Bitmap_Size structure includes y_ppem field])
3327 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3330 CFLAGS="$_SAVE_CFLAGS"
3341 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3343 [asm("uqadd8 r1, r1, r2");],
3344 result="yes", result="no")
3345 AC_MSG_RESULT("$result")
3346 if test "$result" = "yes"; then
3347 AC_DEFINE(HAVE_ARM_SIMD)
3350 AC_SUBST(HAVE_ARM_SIMD)
3352 AC_MSG_CHECKING(for ARM NEON support in compiler)
3353 _SAVE_CFLAGS="$CFLAGS"
3354 if test "$GNU_CC"; then
3355 # gcc needs -mfpu=neon to recognize NEON instructions
3356 CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3359 [asm("vadd.i8 d0, d0, d0");],
3360 result="yes", result="no")
3361 AC_MSG_RESULT("$result")
3362 if test "$result" = "yes"; then
3363 AC_DEFINE(HAVE_ARM_NEON)
3366 CFLAGS="$_SAVE_CFLAGS"
3367 AC_SUBST(HAVE_ARM_NEON)
3369 dnl ========================================================
3370 dnl = pthread support
3371 dnl = Start by checking whether the system support pthreads
3372 dnl ========================================================
3373 case "$target_os" in
3378 MOZ_CHECK_PTHREADS(pthreads,
3379 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3380 MOZ_CHECK_PTHREADS(pthread,
3381 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3382 MOZ_CHECK_PTHREADS(c_r,
3383 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3384 MOZ_CHECK_PTHREADS(c,
3393 dnl ========================================================
3394 dnl Check the command line for --with-pthreads
3395 dnl ========================================================
3396 MOZ_ARG_WITH_BOOL(pthreads,
3397 [ --with-pthreads Force use of system pthread library with NSPR ],
3398 [ if test "$USE_PTHREADS"x = x; then
3399 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3405 dnl ========================================================
3406 dnl Do the platform specific pthread hackery
3407 dnl ========================================================
3408 if test "$USE_PTHREADS"x != x
3411 dnl See if -pthread is supported.
3414 ac_cv_have_dash_pthread=no
3415 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3416 echo 'int main() { return 0; }' | cat > conftest.c
3417 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3418 if test $? -eq 0; then
3419 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3420 ac_cv_have_dash_pthread=yes
3421 case "$target_os" in
3423 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3426 CFLAGS="$CFLAGS -pthread"
3427 CXXFLAGS="$CXXFLAGS -pthread"
3433 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3436 dnl See if -pthreads is supported.
3438 ac_cv_have_dash_pthreads=no
3439 if test "$ac_cv_have_dash_pthread" = "no"; then
3440 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3441 echo 'int main() { return 0; }' | cat > conftest.c
3442 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3443 if test $? -eq 0; then
3444 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3445 ac_cv_have_dash_pthreads=yes
3446 CFLAGS="$CFLAGS -pthreads"
3447 CXXFLAGS="$CXXFLAGS -pthreads"
3451 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3456 AC_DEFINE(_REENTRANT)
3457 AC_DEFINE(_THREAD_SAFE)
3458 dnl -pthread links in -lc_r, so don't specify it explicitly.
3459 if test "$ac_cv_have_dash_pthread" = "yes"; then
3460 _PTHREAD_LDFLAGS="-pthread"
3462 _PTHREAD_LDFLAGS="-lc_r"
3466 *-*-openbsd*|*-*-bsdi*)
3467 AC_DEFINE(_REENTRANT)
3468 AC_DEFINE(_THREAD_SAFE)
3469 dnl -pthread links in -lc_r, so don't specify it explicitly.
3470 if test "$ac_cv_have_dash_pthread" = "yes"; then
3471 _PTHREAD_LDFLAGS="-pthread"
3475 *-*-linux*|*-*-kfreebsd*-gnu)
3476 AC_DEFINE(_REENTRANT)
3480 AC_DEFINE(_REENTRANT)
3484 AC_DEFINE(_REENTRANT)
3488 AC_DEFINE(_REENTRANT)
3492 AC_DEFINE(_REENTRANT)
3496 AC_DEFINE(_REENTRANT)
3497 if test "$SOLARIS_SUNPRO_CC"; then
3498 CFLAGS="$CFLAGS -mt"
3499 CXXFLAGS="$CXXFLAGS -mt"
3503 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3506 dnl ========================================================
3507 dnl See if mmap sees writes
3508 dnl For cross compiling, just define it as no, which is a safe default
3509 dnl ========================================================
3510 AC_MSG_CHECKING(whether mmap() sees write()s)
3516 #include <sys/mman.h>
3517 #include <sys/types.h>
3518 #include <sys/stat.h>
3521 char fname[] = "conftest.file";
3522 char zbuff[1024]; /* Fractional page is probably worst case */
3529 fd = open(fname, O_RDWR | O_CREAT, 0660);
3532 write(fd, zbuff, sizeof(zbuff));
3533 lseek(fd, 0, SEEK_SET);
3534 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3535 if(map==(char*)-1) return 2;
3536 for(i=0; fname[i]; i++) {
3537 int rc = write(fd, &fname[i], 1);
3538 if(map[i]!=fname[i]) return 4;
3545 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3547 AC_MSG_RESULT("$result")
3549 if test "$result" = "no"; then
3550 AC_DEFINE(MMAP_MISSES_WRITES)
3554 dnl Checks for library functions.
3555 dnl ========================================================
3556 AC_PROG_GCC_TRADITIONAL
3558 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3559 AC_CHECK_FUNCS(flockfile getpagesize)
3560 AC_CHECK_FUNCS(localtime_r strtok_r)
3562 dnl check for wcrtomb/mbrtowc
3563 dnl =======================================================================
3564 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3567 AC_CACHE_CHECK(for wcrtomb,
3569 [AC_TRY_LINK([#include <wchar.h>],
3570 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3571 ac_cv_have_wcrtomb="yes",
3572 ac_cv_have_wcrtomb="no")])
3573 if test "$ac_cv_have_wcrtomb" = "yes"; then
3574 AC_DEFINE(HAVE_WCRTOMB)
3576 AC_CACHE_CHECK(for mbrtowc,
3578 [AC_TRY_LINK([#include <wchar.h>],
3579 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3580 ac_cv_have_mbrtowc="yes",
3581 ac_cv_have_mbrtowc="no")])
3582 if test "$ac_cv_have_mbrtowc" = "yes"; then
3583 AC_DEFINE(HAVE_MBRTOWC)
3590 ac_cv_func_res_ninit,
3593 #define _BSD_SOURCE 1
3597 [int foo = res_ninit(&_res);],
3598 [ac_cv_func_res_ninit=yes],
3599 [ac_cv_func_res_ninit=no])
3602 if test "$ac_cv_func_res_ninit" = "yes"; then
3603 AC_DEFINE(HAVE_RES_NINIT)
3604 dnl must add the link line we do something as foolish as this... dougt
3606 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3607 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3612 [for gnu_get_libc_version()],
3613 ac_cv_func_gnu_get_libc_version,
3615 #ifdef HAVE_GNU_LIBC_VERSION_H
3616 #include <gnu/libc-version.h>
3619 [const char *glibc_version = gnu_get_libc_version();],
3620 [ac_cv_func_gnu_get_libc_version=yes],
3621 [ac_cv_func_gnu_get_libc_version=no]
3625 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3626 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3630 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3634 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3635 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3636 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3638 LIBS="$LIBS $_ICONV_LIBS"
3647 iconv_t h = iconv_open("", "");
3648 iconv(h, NULL, NULL, NULL, NULL);
3651 [ac_cv_func_iconv=yes],
3652 [ac_cv_func_iconv=no]
3655 if test "$ac_cv_func_iconv" = "yes"; then
3656 AC_DEFINE(HAVE_ICONV)
3657 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3658 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3659 LIBICONV="$_ICONV_LIBS"
3661 [for iconv() with const input],
3662 ac_cv_func_const_iconv,
3668 const char *input = "testing";
3669 iconv_t h = iconv_open("", "");
3670 iconv(h, &input, NULL, NULL, NULL);
3673 [ac_cv_func_const_iconv=yes],
3674 [ac_cv_func_const_iconv=no]
3677 if test "$ac_cv_func_const_iconv" = "yes"; then
3678 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3690 dnl **********************
3691 dnl *** va_copy checks ***
3692 dnl **********************
3693 dnl we currently check for all three va_copy possibilities, so we get
3694 dnl all results in config.log for bug reports.
3695 AC_MSG_CHECKING(for an implementation of va_copy())
3696 AC_CACHE_VAL(ac_cv_va_copy,[
3699 void f (int i, ...) {
3700 va_list args1, args2;
3701 va_start (args1, i);
3702 va_copy (args2, args1);
3703 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3705 va_end (args1); va_end (args2);
3707 int main() { f (0, 42); return 0; }],
3713 AC_MSG_RESULT($ac_cv_va_copy)
3714 AC_MSG_CHECKING(for an implementation of __va_copy())
3715 AC_CACHE_VAL(ac_cv___va_copy,[
3718 void f (int i, ...) {
3719 va_list args1, args2;
3720 va_start (args1, i);
3721 __va_copy (args2, args1);
3722 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3724 va_end (args1); va_end (args2);
3726 int main() { f (0, 42); return 0; }],
3727 ac_cv___va_copy=yes,
3732 AC_MSG_RESULT($ac_cv___va_copy)
3733 AC_MSG_CHECKING(whether va_lists can be copied by value)
3734 AC_CACHE_VAL(ac_cv_va_val_copy,[
3737 void f (int i, ...) {
3738 va_list args1, args2;
3739 va_start (args1, i);
3741 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3743 va_end (args1); va_end (args2);
3745 int main() { f (0, 42); return 0; }],
3746 ac_cv_va_val_copy=yes,
3747 ac_cv_va_val_copy=no,
3748 ac_cv_va_val_copy=yes
3751 if test "x$ac_cv_va_copy" = "xyes"; then
3752 AC_DEFINE(VA_COPY, va_copy)
3753 AC_DEFINE(HAVE_VA_COPY)
3754 elif test "x$ac_cv___va_copy" = "xyes"; then
3755 AC_DEFINE(VA_COPY, __va_copy)
3756 AC_DEFINE(HAVE_VA_COPY)
3759 if test "x$ac_cv_va_val_copy" = "xno"; then
3760 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3762 AC_MSG_RESULT($ac_cv_va_val_copy)
3764 dnl Check for dll-challenged libc's.
3765 dnl This check is apparently only needed for Linux.
3768 dnl ===================================================================
3771 rm -rf conftest* _conftest
3773 cat >> conftest.C <<\EOF
3778 void __dump_link_map(void) {
3779 struct link_map *map = _dl_loaded;
3780 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3783 dlopen("./conftest1.so",RTLD_LAZY);
3784 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3785 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3786 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3790 /* _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).*/
3791 int main() { printf("./conftest1.so\n"); }
3795 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3797 cat >> conftest1.C <<\EOF
3799 void foo(void) {printf("foo in dll called\n");}
3801 ${CXX-g++} -fPIC -c -g conftest1.C
3802 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3803 ${CXX-g++} -g conftest.C -o conftest -ldl
3804 cp -f conftest1.so conftest _conftest
3806 if test `./conftest | grep conftest1.so | wc -l` -gt 1
3809 echo "*** Your libc has a bug that can result in loading the same dynamic"
3810 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
3811 echo "*** or later. However, if you choose not to upgrade, the only effect"
3812 echo "*** will be excessive memory usage at runtime."
3816 rm -rf conftest* _conftest
3817 dnl ===================================================================
3821 dnl ===================================================================
3822 dnl ========================================================
3823 dnl By default, turn rtti and exceptions off on g++/egcs
3824 dnl ========================================================
3825 if test "$GNU_CXX"; then
3827 AC_MSG_CHECKING(for C++ exceptions flag)
3829 dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3830 AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3831 [echo "int main() { return 0; }" | cat > conftest.C
3833 ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3835 if egrep "warning.*renamed" conftest.out >/dev/null; then
3836 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3838 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3843 AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3844 _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3845 _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3848 dnl ========================================================
3849 dnl Put your C++ language/feature checks below
3850 dnl ========================================================
3854 if test "$GNU_CC"; then
3855 AC_CACHE_CHECK(for gcc 3.0 ABI,
3856 ac_cv_gcc_three_abi,
3859 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3865 ac_cv_gcc_three_abi="yes",
3866 ac_cv_gcc_three_abi="no")])
3867 if test "$ac_cv_gcc_three_abi" = "yes"; then
3868 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3871 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3874 AC_SUBST(HAVE_GCC3_ABI)
3877 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3879 [AC_TRY_COMPILE(class X {
3880 public: explicit X(int i) : i_(i) {}
3884 ac_cv_cpp_explicit=yes,
3885 ac_cv_cpp_explicit=no)])
3886 if test "$ac_cv_cpp_explicit" = yes ; then
3887 AC_DEFINE(HAVE_CPP_EXPLICIT)
3890 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3892 [AC_TRY_COMPILE(class param {
3894 typedef unsigned long num_type;
3897 template <class T> class tplt {
3899 typedef typename T::num_type t_num_type;
3900 t_num_type foo(typename T::num_type num) {
3906 ac_cv_cpp_typename=yes,
3907 ac_cv_cpp_typename=no)])
3908 if test "$ac_cv_cpp_typename" = yes ; then
3909 AC_DEFINE(HAVE_CPP_TYPENAME)
3912 dnl Check for support of modern template specialization syntax
3913 dnl Test code and requirement from scc@netscape.com.
3914 dnl Autoconf cut-and-paste job by waterson@netscape.com
3915 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3916 ac_cv_cpp_modern_specialize_template_syntax,
3917 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3919 template <> struct X<Y> { double a; };,
3922 ac_cv_cpp_modern_specialize_template_syntax=yes,
3923 ac_cv_cpp_modern_specialize_template_syntax=no)])
3924 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3925 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3929 dnl Some compilers support only full specialization, and some don't.
3930 AC_CACHE_CHECK(whether partial template specialization works,
3931 ac_cv_cpp_partial_specialization,
3932 [AC_TRY_COMPILE(template <class T> class Foo {};
3933 template <class T> class Foo<T*> {};,
3935 ac_cv_cpp_partial_specialization=yes,
3936 ac_cv_cpp_partial_specialization=no)])
3937 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3938 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3941 dnl Some compilers have limited support for operators with templates;
3942 dnl specifically, it is necessary to define derived operators when a base
3943 dnl class's operator declaration should suffice.
3944 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3945 ac_cv_need_derived_template_operators,
3946 [AC_TRY_COMPILE([template <class T> class Base { };
3948 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3949 template <class T> class Derived : public Base<T> { };],
3950 [Derived<char> a, b;
3951 Base<char> c = a + b;
3953 ac_cv_need_derived_template_operators=no,
3954 ac_cv_need_derived_template_operators=yes)])
3955 if test "$ac_cv_need_derived_template_operators" = yes ; then
3956 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3960 dnl Some compilers have trouble detecting that a template class
3961 dnl that derives from another template is actually an instance
3962 dnl of the base class. This test checks for that.
3963 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3964 ac_cv_need_cpp_template_cast_to_base,
3965 [AC_TRY_COMPILE([template <class T> class Base { };
3966 template <class T> class Derived : public Base<T> { };
3967 template <class T> int foo(const Base<T>&) { return 0; }],
3968 [Derived<char> bar; return foo(bar);],
3969 ac_cv_need_cpp_template_cast_to_base=no,
3970 ac_cv_need_cpp_template_cast_to_base=yes)])
3971 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3972 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3975 dnl Some compilers have trouble resolving the ambiguity between two
3976 dnl functions whose arguments differ only by cv-qualifications.
3977 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3978 ac_cv_can_resolve_const_ambiguity,
3980 template <class T> class ptrClass {
3984 template <class T> T* a(ptrClass<T> *arg) {
3989 const T* a(const ptrClass<T> *arg) {
3995 ac_cv_can_resolve_const_ambiguity=yes,
3996 ac_cv_can_resolve_const_ambiguity=no)])
3997 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3998 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4002 dnl We don't do exceptions on unix. The only reason this used to be here
4003 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4004 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4005 dnl So im commenting this out until someone writes some artificial
4006 dnl intelligence to detect not only if the compiler has exceptions, but if
4007 dnl they are enabled as well.
4009 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4010 dnl ac_cv_cpp_exceptions,
4011 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4012 dnl static void F() { throw X(); },
4013 dnl try { F(); } catch(X & e) { },
4014 dnl ac_cv_cpp_exceptions=yes,
4015 dnl ac_cv_cpp_exceptions=no)])
4016 dnl if test $ac_cv_cpp_exceptions = yes ; then
4017 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4020 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4021 dnl supports it well enough to allow us to use it to change access, but not
4022 dnl to resolve ambiguity. The next two tests determine how well the |using|
4023 dnl keyword is supported.
4025 dnl Check to see if we can change access with |using|. Test both a
4026 dnl legal and an illegal example.
4027 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4028 ac_cv_cpp_access_changing_using2,
4030 class A { protected: int foo() { return 0; } };
4031 class B : public A { public: using A::foo; };,
4032 B b; return b.foo();,
4034 class A { public: int foo() { return 1; } };
4035 class B : public A { private: using A::foo; };,
4036 B b; return b.foo();,
4037 ac_cv_cpp_access_changing_using2=no,
4038 ac_cv_cpp_access_changing_using2=yes)],
4039 ac_cv_cpp_access_changing_using2=no)])
4040 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4041 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4044 dnl Check to see if we can resolve ambiguity with |using|.
4045 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4046 ac_cv_cpp_ambiguity_resolving_using,
4047 [AC_TRY_COMPILE(class X {
4048 public: int go(const X&) {return 3;}
4049 int jo(const X&) {return 3;}
4051 class Y : public X {
4052 public: int go(int) {return 2;}
4053 int jo(int) {return 2;}
4055 private: using X::go;
4058 ac_cv_cpp_ambiguity_resolving_using=yes,
4059 ac_cv_cpp_ambiguity_resolving_using=no)])
4060 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4061 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4064 dnl Check to see if the |std| namespace is supported. If so, we'll want
4065 dnl to qualify any standard library calls with "std::" to ensure that
4066 dnl those functions can be resolved.
4067 AC_CACHE_CHECK(for \"std::\" namespace,
4068 ac_cv_cpp_namespace_std,
4069 [AC_TRY_COMPILE([#include <algorithm>],
4070 [return std::min(0, 1);],
4071 ac_cv_cpp_namespace_std=yes,
4072 ac_cv_cpp_namespace_std=no)])
4073 if test "$ac_cv_cpp_namespace_std" = yes ; then
4074 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4077 dnl Older compilers are overly ambitious with respect to using the standard
4078 dnl template library's |operator!=()| when |operator==()| is defined. In
4079 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4080 dnl ambiguity at compile-time. This test checks for that case.
4081 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4082 ac_cv_cpp_unambiguous_std_notequal,
4083 [AC_TRY_COMPILE([#include <algorithm>
4085 int operator==(const T1&, const T1&) { return 0; }
4086 int operator!=(const T1&, const T1&) { return 0; }],
4087 [T1 a,b; return a != b;],
4088 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4089 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4090 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4091 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4095 AC_CACHE_CHECK(for C++ reinterpret_cast,
4096 ac_cv_cpp_reinterpret_cast,
4097 [AC_TRY_COMPILE(struct X { int i; };
4098 struct Y { int i; };,
4099 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4100 ac_cv_cpp_reinterpret_cast=yes,
4101 ac_cv_cpp_reinterpret_cast=no)])
4102 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4103 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4106 dnl See if a dynamic_cast to void* gives the most derived object.
4107 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4108 ac_cv_cpp_dynamic_cast_void_ptr,
4109 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4110 class Y { int j; public: virtual ~Y() { } };
4111 class Z : public X, public Y { int k; };
4117 return !((((void*)&mdo != (void*)subx) &&
4118 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4119 (((void*)&mdo != (void*)suby) &&
4120 ((void*)&mdo == dynamic_cast<void*>(suby))));
4122 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4123 ac_cv_cpp_dynamic_cast_void_ptr=no,
4124 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4125 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4126 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4130 dnl note that this one is reversed - if the test fails, then
4131 dnl we require implementations of unused virtual methods. Which
4132 dnl really blows because it means we'll have useless vtable
4134 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4135 ac_cv_cpp_unused_required,
4136 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4138 ac_cv_cpp_unused_required=no,
4139 ac_cv_cpp_unused_required=yes)])
4140 if test "$ac_cv_cpp_unused_required" = yes ; then
4141 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4145 dnl Some compilers have trouble comparing a constant reference to a templatized
4146 dnl class to zero, and require an explicit operator==() to be defined that takes
4147 dnl an int. This test separates the strong from the weak.
4149 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4150 ac_cv_trouble_comparing_to_zero,
4151 [AC_TRY_COMPILE([#include <algorithm>
4152 template <class T> class Foo {};
4154 template <class T> int operator==(const T2*, const T&) { return 0; }
4155 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4156 [Foo<int> f; return (0 != f);],
4157 ac_cv_trouble_comparing_to_zero=no,
4158 ac_cv_trouble_comparing_to_zero=yes)])
4159 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4160 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4163 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4164 ac_cv_thread_keyword,
4165 [AC_TRY_COMPILE([__thread bool tlsIsMainThread = false;],
4166 [return tlsIsMainThread;],
4167 ac_cv_thread_keyword=yes,
4168 ac_cv_thread_keyword=no)])
4169 if test "$ac_cv_thread_keyword" = yes; then
4170 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4173 dnl End of C++ language/feature checks
4176 dnl ========================================================
4177 dnl = Internationalization checks
4178 dnl ========================================================
4180 dnl Internationalization and Locale support is different
4181 dnl on various UNIX platforms. Checks for specific i18n
4182 dnl features go here.
4184 dnl check for LC_MESSAGES
4185 AC_CACHE_CHECK(for LC_MESSAGES,
4186 ac_cv_i18n_lc_messages,
4187 [AC_TRY_COMPILE([#include <locale.h>],
4188 [int category = LC_MESSAGES;],
4189 ac_cv_i18n_lc_messages=yes,
4190 ac_cv_i18n_lc_messages=no)])
4191 if test "$ac_cv_i18n_lc_messages" = yes; then
4192 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4195 fi # SKIP_COMPILER_CHECKS
4198 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4199 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4202 dnl Mozilla specific options
4203 dnl ========================================================
4204 dnl The macros used for command line options
4205 dnl are defined in build/autoconf/altoptions.m4.
4208 dnl ========================================================
4210 dnl = Check for external package dependencies
4212 dnl ========================================================
4213 MOZ_ARG_HEADER(External Packages)
4217 MOZ_ARG_WITH_STRING(libxul-sdk,
4218 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4219 LIBXUL_SDK_DIR=$withval)
4221 if test "$LIBXUL_SDK_DIR" = "yes"; then
4222 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4223 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4224 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4226 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4227 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4232 AC_SUBST(LIBXUL_SDK)
4234 if test -n "$LIBXUL_SDK"; then
4235 LIBXUL_DIST="$LIBXUL_SDK"
4237 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4239 AC_SUBST(LIBXUL_DIST)
4243 MOZ_ARG_WITH_BOOL(system-libxul,
4244 [ --with-system-libxul Use system installed libxul SDK],
4247 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4248 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4251 dnl ========================================================
4252 dnl = If NSPR was not detected in the system,
4253 dnl = use the one in the source tree (mozilla/nsprpub)
4254 dnl ========================================================
4255 MOZ_ARG_WITH_BOOL(system-nspr,
4256 [ --with-system-nspr Use system installed NSPR],
4257 _USE_SYSTEM_NSPR=1 )
4259 if test -n "$_USE_SYSTEM_NSPR"; then
4260 AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4263 if test -n "$MOZ_NATIVE_NSPR"; then
4264 _SAVE_CFLAGS=$CFLAGS
4265 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4266 AC_TRY_COMPILE([#include "prlog.h"],
4267 [#ifndef PR_STATIC_ASSERT
4268 #error PR_STATIC_ASSERT not defined
4270 [MOZ_NATIVE_NSPR=1],
4271 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4272 CFLAGS=$_SAVE_CFLAGS
4274 if test "$OS_ARCH" = "WINCE"; then
4275 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4276 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4277 elif test "$OS_ARCH" = "WINNT"; then
4278 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4279 if test -n "$GNU_CC"; then
4280 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4282 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4285 NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4286 NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4290 dnl ========================================================
4291 dnl = If NSS was not detected in the system,
4292 dnl = use the one in the source tree (mozilla/security/nss)
4293 dnl ========================================================
4295 MOZ_ARG_WITH_BOOL(system-nss,
4296 [ --with-system-nss Use system installed NSS],
4299 if test -n "$_USE_SYSTEM_NSS"; then
4300 AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4303 if test -n "$MOZ_NATIVE_NSS"; then
4304 NSS_LIBS="$NSS_LIBS -lcrmf"
4306 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4308 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4309 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4310 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4311 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4312 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4314 if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4316 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4317 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4318 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4319 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4320 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4322 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4326 if test -z "$SKIP_LIBRARY_CHECKS"; then
4327 dnl system JPEG support
4328 dnl ========================================================
4329 MOZ_ARG_WITH_STRING(system-jpeg,
4330 [ --with-system-jpeg[=PFX]
4331 Use system libjpeg [installed at prefix PFX]],
4334 _SAVE_CFLAGS=$CFLAGS
4335 _SAVE_LDFLAGS=$LDFLAGS
4337 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4338 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4339 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4341 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4344 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4347 if test "$SYSTEM_JPEG" = 1; then
4348 LIBS="$JPEG_LIBS $LIBS"
4349 AC_TRY_COMPILE([ #include <stdio.h>
4350 #include <sys/types.h>
4351 #include <jpeglib.h> ],
4352 [ #if JPEG_LIB_VERSION < $MOZJPEG
4353 #error "Insufficient JPEG library version ($MOZJPEG required)."
4356 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4358 CFLAGS=$_SAVE_CFLAGS
4359 LDFLAGS=$_SAVE_LDFLAGS
4362 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4363 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4364 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4367 dnl system ZLIB support
4368 dnl ========================================================
4369 MOZ_ARG_WITH_STRING(system-zlib,
4370 [ --with-system-zlib[=PFX]
4371 Use system libz [installed at prefix PFX]],
4374 _SAVE_CFLAGS=$CFLAGS
4375 _SAVE_LDFLAGS=$LDFLAGS
4377 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4378 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4379 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4381 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4384 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4385 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4387 if test "$SYSTEM_ZLIB" = 1; then
4388 LIBS="$ZLIB_LIBS $LIBS"
4389 AC_TRY_COMPILE([ #include <stdio.h>
4391 #include <zlib.h> ],
4392 [ #if ZLIB_VERNUM < $MOZZLIB
4393 #error "Insufficient zlib version ($MOZZLIB required)."
4396 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4398 CFLAGS=$_SAVE_CFLAGS
4399 LDFLAGS=$_SAVE_LDFLAGS
4402 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4403 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4404 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4407 dnl system BZIP2 Support
4408 dnl ========================================================
4409 MOZ_ARG_WITH_STRING(system-bz2,
4410 [ --with-system-bz2[=PFX]
4411 Use system libbz2 [installed at prefix PFX]],
4414 _SAVE_CFLAGS=$CFLAGS
4415 _SAVE_LDFLAGS=$LDFLAGS
4417 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4418 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4419 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4421 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4424 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4425 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4427 CFLAGS=$_SAVE_CFLAGS
4428 LDFLAGS=$_SAVE_LDFLAGS
4431 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4432 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4433 BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4436 dnl system PNG Support
4437 dnl ========================================================
4438 MOZ_ARG_WITH_STRING(system-png,
4439 [ --with-system-png[=PFX]
4440 Use system libpng [installed at prefix PFX]],
4443 _SAVE_CFLAGS=$CFLAGS
4444 _SAVE_LDFLAGS=$LDFLAGS
4446 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4447 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4448 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4449 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4450 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4452 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4455 _SAVE_PNG_LIBS=$PNG_LIBS
4456 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4457 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4459 AC_CHECK_LIB(png, png_get_acTL, ,
4460 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4463 if test "$SYSTEM_PNG" = 1; then
4464 LIBS="$PNG_LIBS $LIBS"
4465 AC_TRY_COMPILE([ #include <stdio.h>
4466 #include <sys/types.h>
4468 [ #if PNG_LIBPNG_VER < $MOZPNG
4469 #error "Insufficient libpng version ($MOZPNG required)."
4471 #ifndef PNG_UINT_31_MAX
4472 #error "Insufficient libpng version."
4475 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4477 CFLAGS=$_SAVE_CFLAGS
4478 LDFLAGS=$_SAVE_LDFLAGS
4481 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4482 PNG_CFLAGS="-I${PNG_DIR}/include"
4483 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4486 fi # SKIP_LIBRARY_CHECKS
4488 dnl system HunSpell Support
4489 dnl ========================================================
4490 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4491 [ --enable-system-hunspell Use system hunspell (located with pkgconfig)],
4494 if test -n "$SYSTEM_HUNSPELL"; then
4495 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4498 AC_SUBST(SYSTEM_HUNSPELL)
4500 dnl ========================================================
4501 dnl Java SDK support
4502 dnl ========================================================
4504 MOZ_ARG_WITH_STRING(java-include-path,
4505 [ --with-java-include-path=dir Location of Java SDK headers],
4506 JAVA_INCLUDE_PATH=$withval)
4509 MOZ_ARG_WITH_STRING(java-bin-path,
4510 [ --with-java-bin-path=dir Location of Java binaries (java, javac, jar)],
4511 JAVA_BIN_PATH=$withval)
4513 dnl ========================================================
4514 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4515 dnl their usage and use them in spidermonkey.
4516 dnl ========================================================
4517 MOZ_ARG_WITH_BOOL(arm-kuser,
4518 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4521 if test -n "$USE_ARM_KUSER"; then
4522 AC_DEFINE(USE_ARM_KUSER)
4525 dnl ========================================================
4529 dnl ========================================================
4531 MOZ_ARG_HEADER(Application)
4535 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4536 MOZ_BRANDING_DIRECTORY=
4537 MOZ_OFFICIAL_BRANDING=
4538 MOZ_DBGRINFO_MODULES=
4540 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4541 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4548 MOZ_AUTH_EXTENSION=1
4549 MOZ_NO_ACTIVEX_SUPPORT=1
4550 MOZ_NO_INSPECTOR_APIS=
4558 MOZ_PLAINTEXT_EDITOR_ONLY=
4560 MOZ_PREF_EXTENSIONS=1
4561 MOZ_PROFILELOCKING=1
4570 MOZ_STATIC_MAIL_BUILD=
4575 MOZ_UNIVERSALCHARDET=1
4577 MOZ_USE_NATIVE_UCONV=
4579 MOZ_XPFE_COMPONENTS=1
4581 MOZ_XSLT_STANDALONE=
4589 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4590 NECKO_SMALL_BUFFERS=
4591 XPC_IDISPATCH_SUPPORT=
4594 case "$target_os" in
4603 case "$target_os" in
4604 msvc*|mks*|cygwin*|mingw*)
4606 if test -z "$GNU_CC"; then
4607 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4610 XPC_IDISPATCH_SUPPORT=1
4611 MOZ_NO_ACTIVEX_SUPPORT=
4613 if test -n "$NS_ENABLE_TSF"; then
4614 AC_DEFINE(NS_ENABLE_TSF)
4619 MOZ_ARG_ENABLE_STRING(application,
4620 [ --enable-application=APP
4624 content/xslt (Standalone Transformiix XSLT)
4625 netwerk (Standalone Necko)
4626 tools/update-packaging (AUS-related packaging tools)
4627 standalone (use this for standalone
4628 xpcom/xpconnect or to manually drive a build)],
4629 [ MOZ_BUILD_APP=$enableval ] )
4631 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4632 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4633 XULRUNNER_STUB_NAME=$withval)
4635 if test -z "$XULRUNNER_STUB_NAME"; then
4636 case "$target_os" in
4638 XULRUNNER_STUB_NAME=xulrunner
4641 XULRUNNER_STUB_NAME=xulrunner-stub
4644 AC_SUBST(XULRUNNER_STUB_NAME)
4646 if test -z "$MOZ_BUILD_APP"; then
4647 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4649 # We have a valid application only if it has a build.mk file in its top
4651 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4652 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4656 # Allow the application to influence configure with a confvars.sh script.
4658 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4659 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4660 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4661 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4666 # Now is a good time to test for logic errors, define mismatches, etc.
4667 case "$MOZ_BUILD_APP" in
4669 if test "$LIBXUL_SDK"; then
4670 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4675 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4676 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4678 case "$MOZ_BUILD_APP" in
4680 AC_DEFINE(MOZ_PHOENIX)
4684 AC_DEFINE(MOZ_XULRUNNER)
4692 MOZ_APP_NAME=mozilla
4693 MOZ_APP_DISPLAYNAME=Mozilla
4694 MOZ_APP_VERSION=$MOZILLA_VERSION
4699 AC_SUBST(MOZ_BUILD_APP)
4700 AC_SUBST(MOZ_PHOENIX)
4701 AC_SUBST(MOZ_XULRUNNER)
4703 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4705 dnl ========================================================
4707 dnl = Toolkit Options
4709 dnl ========================================================
4710 MOZ_ARG_HEADER(Toolkit Options)
4712 dnl ========================================================
4713 dnl = Select the default toolkit
4714 dnl ========================================================
4715 MOZ_ARG_ENABLE_STRING(default-toolkit,
4716 [ --enable-default-toolkit=TK
4717 Select default toolkit
4718 Platform specific defaults:
4720 Mac OS X - cairo-cocoa
4721 Neutrino/QNX - photon
4723 Win32/WinCE - cairo-windows
4724 Gtk2 with DirectFB - cairo-gtk2-dfb
4727 [ _DEFAULT_TOOLKIT=$enableval ],
4728 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4730 if test "$_DEFAULT_TOOLKIT" = "photon" \
4731 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4732 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4733 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4734 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4735 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4736 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4737 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4738 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4740 dnl nglayout only supports building with one toolkit,
4741 dnl so ignore everything after the first comma (",").
4742 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4744 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4747 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4749 dnl ========================================================
4750 dnl = Enable the toolkit as needed =
4751 dnl ========================================================
4753 case "$MOZ_WIDGET_TOOLKIT" in
4756 AC_DEFINE(MOZ_WIDGET_PHOTON)
4760 MOZ_WIDGET_TOOLKIT=windows
4761 if test -z "$WINCE"; then
4766 cairo-gtk2|cairo-gtk2-x11)
4767 MOZ_WIDGET_TOOLKIT=gtk2
4769 MOZ_ENABLE_XREMOTE=1
4775 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4776 TK_LIBS='$(MOZ_GTK2_LIBS)'
4777 AC_DEFINE(MOZ_WIDGET_GTK2)
4781 MOZ_WIDGET_TOOLKIT=gtk2
4788 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4789 TK_LIBS='$(MOZ_GTK2_LIBS)'
4790 AC_DEFINE(MOZ_WIDGET_GTK2)
4791 if test "$no_x" != "yes"; then
4792 AC_MSG_WARN([Disabling X when DirectFB is specified.])
4798 MOZ_WIDGET_TOOLKIT=qt
4800 MOZ_ENABLE_XREMOTE=1
4807 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4808 TK_LIBS='$(MOZ_QT_LIBS)'
4809 AC_DEFINE(MOZ_WIDGET_QT)
4813 MOZ_WIDGET_TOOLKIT=beos
4814 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4815 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4819 MOZ_WIDGET_TOOLKIT=os2
4820 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4821 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4825 MOZ_WIDGET_TOOLKIT=cocoa
4826 AC_DEFINE(MOZ_WIDGET_COCOA)
4827 MOZ_USER_DIR="Mozilla"
4828 AC_DEFINE(XP_MACOSX)
4829 TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4830 TK_CFLAGS="-DNO_X11"
4831 LDFLAGS="$LDFLAGS -framework Cocoa"
4832 CFLAGS="$CFLAGS $TK_CFLAGS"
4833 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4834 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
4835 MOZ_FS_LAYOUT=bundle
4840 if test "$MOZ_ENABLE_XREMOTE"; then
4841 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4844 if test "$COMPILE_ENVIRONMENT"; then
4845 if test "$MOZ_ENABLE_GTK2"; then
4846 if test "$MOZ_X11"; then
4847 GDK_PACKAGES=gdk-x11-2.0
4848 elif test "$MOZ_DFB"; then
4849 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4850 GDK_PACKAGES=directfb
4853 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4856 fi # COMPILE_ENVIRONMENT
4858 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4859 AC_SUBST(MOZ_FS_LAYOUT)
4861 dnl ========================================================
4862 dnl = startup-notification support module
4863 dnl ========================================================
4865 if test "$MOZ_ENABLE_GTK2"
4867 MOZ_ENABLE_STARTUP_NOTIFICATION=
4869 MOZ_ARG_ENABLE_BOOL(startup-notification,
4870 [ --enable-startup-notification Enable startup-notification support (default: disabled) ],
4871 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4872 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4873 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4875 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4876 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4877 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4878 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4880 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4882 MOZ_ENABLE_STARTUP_NOTIFICATION=
4886 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4887 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4890 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4892 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4893 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4894 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4896 dnl ========================================================
4898 dnl ========================================================
4899 if test "$MOZ_ENABLE_QT"
4901 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4902 AC_SUBST(MOZ_QT_CFLAGS)
4903 AC_SUBST(MOZ_QT_LIBS)
4905 MOZ_ARG_WITH_STRING(qtdir,
4906 [ --with-qtdir=\$dir Specify Qt directory ],
4909 if test -z "$QTDIR"; then
4912 QTINCDIR="/include/qt"
4913 if test ! -d "$QTDIR$QTINCDIR"; then
4914 QTINCDIR="/include/X11/qt"
4916 if test ! -d "$QTDIR$QTINCDIR"; then
4920 if test -x "$QTDIR/bin/moc-qt4"; then
4921 HOST_MOC="$QTDIR/bin/moc-qt4"
4923 if test -x "$QTDIR/bin/moc"; then
4924 HOST_MOC="$QTDIR/bin/moc"
4926 AC_CHECK_PROGS(HOST_MOC, moc, "")
4929 if test -z "$HOST_MOC"; then
4930 AC_MSG_ERROR([no acceptable moc preprocessor found])
4935 AC_SUBST(GTK_CONFIG)
4939 AC_SUBST(MOZ_ENABLE_GTK2)
4940 AC_SUBST(MOZ_ENABLE_PHOTON)
4941 AC_SUBST(MOZ_ENABLE_QT)
4942 AC_SUBST(MOZ_ENABLE_XREMOTE)
4943 AC_SUBST(MOZ_GTK2_CFLAGS)
4944 AC_SUBST(MOZ_GTK2_LIBS)
4945 AC_SUBST(MOZ_QT_CFLAGS)
4946 AC_SUBST(MOZ_QT_LIBS)
4953 dnl ========================================================
4955 dnl = Components & Features
4957 dnl ========================================================
4958 MOZ_ARG_HEADER(Components and Features)
4960 dnl ========================================================
4962 dnl ========================================================
4963 MOZ_ARG_ENABLE_STRING(ui-locale,
4964 [ --enable-ui-locale=ab-CD
4965 Select the user interface locale (default: en-US)],
4966 MOZ_UI_LOCALE=$enableval )
4967 AC_SUBST(MOZ_UI_LOCALE)
4969 dnl ========================================================
4970 dnl = Trademarked Branding
4971 dnl ========================================================
4972 MOZ_ARG_ENABLE_BOOL(official-branding,
4973 [ --enable-official-branding Enable Official mozilla.org Branding
4974 Do not distribute builds with
4975 --enable-official-branding unless you have
4976 permission to use trademarks per
4977 http://www.mozilla.org/foundation/trademarks/ .],
4979 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4980 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4982 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4983 MOZ_OFFICIAL_BRANDING=1
4985 ], MOZ_OFFICIAL_BRANDING=)
4987 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4988 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4989 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4992 MOZ_ARG_WITH_STRING(branding,
4993 [ --with-branding=dir Use branding from the specified directory.],
4994 MOZ_BRANDING_DIRECTORY=$withval)
4996 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4997 if test -z "$REAL_BRANDING_DIRECTORY"; then
4998 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5001 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5002 . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
5005 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5007 dnl ========================================================
5008 dnl = Distribution ID
5009 dnl ========================================================
5010 MOZ_ARG_WITH_STRING(distribution-id,
5011 [ --with-distribution-id=ID Set distribution-specific id (default=org.mozilla)],
5012 [ val=`echo $withval`
5013 MOZ_DISTRIBUTION_ID="$val"])
5015 if test -z "$MOZ_DISTRIBUTION_ID"; then
5016 MOZ_DISTRIBUTION_ID="org.mozilla"
5019 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5020 AC_SUBST(MOZ_DISTRIBUTION_ID)
5023 dnl ========================================================
5024 dnl complex text support off by default
5025 dnl ========================================================
5027 MOZ_ARG_DISABLE_BOOL(pango,
5028 [ --disable-pango Disable usage of Pango ],
5033 dnl ========================================================
5035 dnl ========================================================
5036 if test "$MOZ_ENABLE_GTK2"
5040 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5042 if test "$MOZ_PANGO"
5044 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5045 AC_SUBST(MOZ_PANGO_CFLAGS)
5046 AC_SUBST(MOZ_PANGO_LIBS)
5047 AC_DEFINE(MOZ_PANGO)
5049 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5050 AC_SUBST(MOZ_PANGO_CFLAGS)
5051 AC_SUBST(MOZ_PANGO_LIBS)
5053 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5054 AC_SUBST(FT2_CFLAGS)
5059 dnl ========================================================
5060 dnl = GnomeVFS support module
5061 dnl ========================================================
5065 dnl build the gnomevfs extension by default only when the
5066 dnl GTK2 toolkit is in use.
5067 if test "$MOZ_ENABLE_GTK2"
5069 MOZ_ENABLE_GNOMEVFS=1
5073 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5074 [ --disable-gnomevfs Disable GnomeVFS support ],
5075 MOZ_ENABLE_GNOMEVFS=,
5076 MOZ_ENABLE_GNOMEVFS=force)
5078 if test "$MOZ_ENABLE_GNOMEVFS"
5080 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5081 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5082 MOZ_ENABLE_GNOMEVFS=1
5083 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5085 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5087 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5089 MOZ_ENABLE_GNOMEVFS=
5093 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5094 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5095 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5097 if test "$MOZ_ENABLE_GCONF"
5099 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5100 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5107 if test "$MOZ_ENABLE_GCONF"; then
5108 AC_DEFINE(MOZ_ENABLE_GCONF)
5111 AC_SUBST(MOZ_ENABLE_GCONF)
5112 AC_SUBST(MOZ_GCONF_CFLAGS)
5113 AC_SUBST(MOZ_GCONF_LIBS)
5115 dnl ========================================================
5116 dnl = GIO support module
5117 dnl ========================================================
5118 MOZ_ARG_ENABLE_BOOL(gio,
5119 [ --enable-gio Enable GIO support (default: disabled)],
5120 MOZ_ENABLE_GIO=force,
5123 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5125 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5126 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5128 AC_DEFINE(MOZ_ENABLE_GIO)
5130 if test "$MOZ_ENABLE_GIO" = "force"
5132 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5138 AC_SUBST(MOZ_ENABLE_GIO)
5139 AC_SUBST(MOZ_GIO_CFLAGS)
5140 AC_SUBST(MOZ_GIO_LIBS)
5143 dnl ========================================================
5144 dnl = libgnomeui support module
5145 dnl ========================================================
5147 if test "$MOZ_ENABLE_GTK2"
5149 MOZ_ENABLE_GNOMEUI=1
5151 MOZ_ARG_DISABLE_BOOL(gnomeui,
5152 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5153 MOZ_ENABLE_GNOMEUI=,
5154 MOZ_ENABLE_GNOMEUI=force)
5156 if test "$MOZ_ENABLE_GNOMEUI"
5158 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5160 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5161 MOZ_ENABLE_GNOMEUI=1
5163 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5165 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5171 if test "$MOZ_ENABLE_GNOMEUI"; then
5172 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5175 # The GNOME component is built if gtk2, gconf and gnome-vfs
5176 # are all available.
5178 if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" && \
5179 (test "$MOZ_ENABLE_GNOMEVFS" || test "$MOZ_ENABLE_GIO"); then
5180 MOZ_ENABLE_GNOME_COMPONENT=1
5182 MOZ_ENABLE_GNOME_COMPONENT=
5185 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5187 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5188 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5189 AC_SUBST(MOZ_GNOMEUI_LIBS)
5191 dnl ========================================================
5193 dnl ========================================================
5195 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5199 MOZ_ARG_DISABLE_BOOL(dbus,
5200 [ --disable-dbus Disable dbus support ],
5204 if test "$MOZ_ENABLE_DBUS"
5206 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5207 AC_DEFINE(MOZ_ENABLE_DBUS)
5210 AC_SUBST(MOZ_ENABLE_DBUS)
5211 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5212 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5214 dnl ========================================================
5215 dnl = libnotify support
5216 dnl ========================================================
5218 if test "$MOZ_ENABLE_GTK2"
5220 MOZ_ENABLE_LIBNOTIFY=1
5222 MOZ_ARG_DISABLE_BOOL(libnotify,
5223 [ --disable-libnotify Disable libnotify support ],
5224 MOZ_ENABLE_LIBNOTIFY=,
5225 MOZ_ENABLE_LIBNOTIFY=1)
5227 if test "$MOZ_ENABLE_LIBNOTIFY"
5229 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5233 if test -z "$SKIP_LIBRARY_CHECKS"
5235 if test "$MOZ_ENABLE_GTK2"
5237 if test "$MOZ_ENABLE_LIBNOTIFY"
5239 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5243 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5244 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5245 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5247 dnl ========================================================
5248 dnl = Build Personal Security Manager
5249 dnl ========================================================
5250 MOZ_ARG_DISABLE_BOOL(crypto,
5251 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5255 dnl ========================================================
5256 dnl = JS Debugger XPCOM component (js/jsd)
5257 dnl ========================================================
5258 MOZ_ARG_DISABLE_BOOL(jsd,
5259 [ --disable-jsd Disable JavaScript debug library],
5264 dnl ========================================================
5265 dnl = Disable plugin support
5266 dnl ========================================================
5267 MOZ_ARG_DISABLE_BOOL(plugins,
5268 [ --disable-plugins Disable plugins support],
5272 dnl ========================================================
5273 dnl = Disable building dbm
5274 dnl ========================================================
5275 MOZ_ARG_DISABLE_BOOL(dbm,
5276 [ --disable-dbm Disable building dbm],
5280 dnl bi-directional support always on
5284 dnl ========================================================
5285 dnl view source support on by default
5286 dnl ========================================================
5287 if test "$MOZ_VIEW_SOURCE"; then
5288 AC_DEFINE(MOZ_VIEW_SOURCE)
5291 dnl ========================================================
5292 dnl accessibility support on by default on all platforms
5294 dnl ========================================================
5295 MOZ_ARG_DISABLE_BOOL(accessibility,
5296 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5299 if test "$ACCESSIBILITY"; then
5300 AC_DEFINE(ACCESSIBILITY)
5303 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5305 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5306 if test "$ac_cv_header_atlbase_h" = "no"; then
5307 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.])
5309 if test "$ac_cv_header_oleacc_idl" = "no"; then
5310 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.])
5316 dnl ========================================================
5317 dnl xpfe/components on by default
5318 dnl ========================================================
5319 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5320 [ --disable-xpfe-components
5321 Disable xpfe components],
5322 MOZ_XPFE_COMPONENTS=,
5323 MOZ_XPFE_COMPONENTS=1 )
5325 dnl ========================================================
5326 dnl xpinstall support on by default
5327 dnl ========================================================
5328 MOZ_ARG_DISABLE_BOOL(xpinstall,
5329 [ --disable-xpinstall Disable xpinstall support],
5332 if test "$MOZ_XPINSTALL"; then
5333 AC_DEFINE(MOZ_XPINSTALL)
5336 dnl ========================================================
5337 dnl xpcom js loader support on by default
5338 dnl ========================================================
5339 if test "$MOZ_JSLOADER"; then
5340 AC_DEFINE(MOZ_JSLOADER)
5343 dnl ========================================================
5344 dnl Disable printing
5345 dnl ========================================================
5346 MOZ_ARG_DISABLE_BOOL(printing,
5347 [ --disable-printing Disable printing support],
5351 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5352 AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5356 if test "$NS_PRINTING"; then
5357 AC_DEFINE(NS_PRINTING)
5358 AC_DEFINE(NS_PRINT_PREVIEW)
5361 dnl ========================================================
5362 dnl use native unicode converters
5363 dnl ========================================================
5364 MOZ_ARG_ENABLE_BOOL(native-uconv,
5365 [ --enable-native-uconv Enable iconv support],
5366 MOZ_USE_NATIVE_UCONV=1,
5367 MOZ_USE_NATIVE_UCONV= )
5368 if test "$MOZ_USE_NATIVE_UCONV"; then
5369 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5371 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5372 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5376 dnl ========================================================
5377 dnl Libeditor can be build as plaintext-only,
5378 dnl or as a full html and text editing component.
5379 dnl We build both by default.
5380 dnl ========================================================
5381 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5382 [ --enable-plaintext-editor-only
5383 Allow only plaintext editing],
5384 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5385 MOZ_PLAINTEXT_EDITOR_ONLY= )
5386 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5387 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5389 dnl ========================================================
5390 dnl = Disable Fast Load
5391 dnl ========================================================
5392 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5393 [ --disable-xpcom-fastload Disable XPCOM fastload support],
5397 AC_SUBST(MOZ_NO_FAST_LOAD)
5399 if test -n "$MOZ_NO_FAST_LOAD"; then
5400 AC_DEFINE(MOZ_NO_FAST_LOAD)
5403 dnl ========================================================
5404 dnl = Disable Ogg Codecs
5405 dnl ========================================================
5406 MOZ_ARG_DISABLE_BOOL(ogg,
5407 [ --disable-ogg Disable Ogg Codec support],
5413 if test -n "$MOZ_OGG"; then
5418 dnl Checks for __attribute__(aligned()) directive
5419 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5420 [ac_cv_c_attribute_aligned],
5421 [ac_cv_c_attribute_aligned=0
5422 CFLAGS_save="${CFLAGS}"
5423 CFLAGS="${CFLAGS} -Werror"
5424 for ac_cv_c_attr_align_try in 64 32 16 8; do
5425 echo "trying $ac_cv_c_attr_align_try"
5427 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5428 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5429 if test "$ac_cv_c_attribute_aligned" != 0; then
5433 CFLAGS="${CFLAGS_save}"])
5434 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5435 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5436 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5440 dnl ========================================================
5441 dnl = Disable Wave decoder support
5442 dnl ========================================================
5443 MOZ_ARG_DISABLE_BOOL(wave,
5444 [ --disable-wave Disable Wave decoder support],
5450 if test -n "$MOZ_WAVE"; then
5456 dnl ========================================================
5457 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5458 dnl ========================================================
5460 AC_SUBST(MOZ_SYDNEYAUDIO)
5462 if test -n "$MOZ_SYDNEYAUDIO"; then
5463 AC_DEFINE(MOZ_SYDNEYAUDIO)
5468 if test -n "$MOZ_MEDIA"; then
5469 AC_DEFINE(MOZ_MEDIA)
5472 dnl ========================================================
5473 dnl = Check alsa availability on Linux if using sydneyaudio
5474 dnl ========================================================
5476 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5477 if test -n "$MOZ_SYDNEYAUDIO"; then
5478 case "$target_os" in
5480 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5481 [echo "$MOZ_ALSA_PKG_ERRORS"
5482 AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux. Disable with --disable-ogg --disable-wave.])])
5486 AC_SUBST(MOZ_ALSA_LIBS)
5488 dnl ========================================================
5490 dnl ========================================================
5491 AC_ARG_ENABLE(splashscreen,
5492 [ --enable-splashscreen display splashscreen while loading (default=no)],
5493 [enable_splash="yes"],[enable_splash=""])
5494 if test "x$enable_splash" = "xyes"; then
5496 AC_DEFINE(MOZ_SPLASHSCREEN)
5498 AC_SUBST(MOZ_SPLASHSCREEN)
5500 dnl ========================================================
5501 dnl Permissions System
5502 dnl ========================================================
5503 MOZ_ARG_DISABLE_BOOL(permissions,
5504 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5509 dnl ========================================================
5511 dnl ========================================================
5512 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5513 [ --disable-negotiateauth Disable GSS-API negotiation ],
5514 MOZ_AUTH_EXTENSION=,
5515 MOZ_AUTH_EXTENSION=1 )
5517 dnl ========================================================
5519 dnl ========================================================
5520 MOZ_ARG_DISABLE_BOOL(xtf,
5521 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5524 if test "$MOZ_XTF"; then
5528 dnl ========================================================
5529 dnl Pref extensions (autoconfig and system-pref)
5530 dnl ========================================================
5531 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5532 [ --disable-pref-extensions
5533 Disable pref extensions such as autoconfig and
5535 MOZ_PREF_EXTENSIONS=,
5536 MOZ_PREF_EXTENSIONS=1 )
5538 dnl ========================================================
5539 dnl = Universalchardet
5540 dnl ========================================================
5541 MOZ_ARG_DISABLE_BOOL(universalchardet,
5542 [ --disable-universalchardet
5543 Disable universal encoding detection],
5544 MOZ_UNIVERSALCHARDET=,
5545 MOZ_UNIVERSALCHARDET=1 )
5547 dnl ========================================================
5549 dnl ========================================================
5550 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5551 [ --enable-javaxpcom
5552 Enable Java-XPCOM bridge],
5556 if test -n "${MOZ_JAVAXPCOM}"; then
5559 if test -n "$JAVA_HOME"; then
5560 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5564 if test -n "$JAVA_HOME"; then
5565 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5570 if test -n "${JAVA_INCLUDE_PATH}"; then
5571 dnl Make sure jni.h exists in the given include path.
5572 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5573 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5576 case "$target_os" in
5578 dnl Default to java system location
5579 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5583 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5586 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5587 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.])
5591 if test -n "${JAVA_BIN_PATH}"; then
5592 dnl Look for javac and jar in the specified path.
5593 JAVA_PATH="$JAVA_BIN_PATH"
5595 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5596 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5599 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5600 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5601 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5602 if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5603 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.])
5607 dnl ========================================================
5608 dnl = Breakpad crash reporting (on by default on supported platforms)
5609 dnl ========================================================
5611 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5612 || test "$OS_ARCH" = "Darwin" \
5613 || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5614 || test "$OS_ARCH" = "SunOS") \
5615 && test -z "$HAVE_64BIT_OS"; then
5619 MOZ_ARG_DISABLE_BOOL(crashreporter,
5620 [ --disable-crashreporter Disable breakpad crash reporting],
5622 MOZ_CRASHREPORTER=1)
5624 if test -n "$MOZ_CRASHREPORTER"; then
5625 AC_DEFINE(MOZ_CRASHREPORTER)
5627 if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5628 test -z "$SKIP_LIBRARY_CHECKS"; then
5629 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5630 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5631 AC_SUBST(MOZ_GTHREAD_LIBS)
5633 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.])])
5637 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5638 [ --with-crashreporter-enable-percent=NN Enable sending crash reports by default on NN% of users. (default=100)],
5639 [ val=`echo $withval | sed 's/[^0-9]//g'`
5640 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5642 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5643 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5645 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5647 dnl ========================================================
5648 dnl = Enable compilation of specific extension modules
5649 dnl ========================================================
5651 MOZ_ARG_ENABLE_STRING(extensions,
5652 [ --enable-extensions Enable extensions],
5653 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5654 if test "$option" = "yes" || test "$option" = "all"; then
5655 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5656 elif test "$option" = "no" || test "$option" = "none"; then
5658 elif test "$option" = "default"; then
5659 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5660 elif test `echo "$option" | grep -c \^-` != 0; then
5661 option=`echo $option | sed 's/^-//'`
5662 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5664 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5667 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5669 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5670 # Suppress warning on non-X11 platforms
5671 if test -n "$MOZ_X11"; then
5672 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5674 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5677 dnl Do not build gnomevfs with libxul based apps
5678 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5679 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5682 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5683 # Suppress warning on non-X11 platforms
5684 if test -n "$MOZ_X11"; then
5685 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
5687 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5690 dnl Do not build gio with libxul based apps
5691 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5692 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5695 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5696 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5697 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5700 dnl This might be temporary: build tridentprofile only on Windows
5701 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5702 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5703 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5706 dnl cookie must be built before tridentprofile. put it at list's end.
5707 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5708 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5709 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5712 dnl xforms requires xtf and schema-validation
5713 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5714 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
5715 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5717 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5718 AC_MSG_WARN([Cannot build XForms without schema validation. Removing XForms from MOZ_EXTENSIONS.])
5719 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5722 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5723 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5724 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5727 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5728 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5729 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5732 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5733 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5734 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5737 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5738 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5739 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5742 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5743 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5744 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5747 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5748 AC_MSG_WARN([spellcheck is no longer an extension.])
5749 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5753 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5755 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5756 dnl when trying to build a non-existent extension.
5757 for extension in $MOZ_EXTENSIONS; do
5758 if test ! -d "${srcdir}/extensions/${extension}"; then
5759 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5764 dnl ========================================================
5766 dnl ========================================================
5767 case "$MOZ_WIDGET_TOOLKIT" in
5768 beos|windows|os2|mac|cocoa)
5771 if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5772 MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5777 MOZ_ARG_ENABLE_STRING(image-decoders,
5778 [ --enable-image-decoders[={mod1,mod2,default,all,none}]
5779 Enable specific image decoders],
5780 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5781 if test "$option" = "yes" || test "$option" = "all"; then
5782 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5783 elif test "$option" = "no" || test "$option" = "none"; then
5785 elif test "$option" = "default"; then
5786 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5787 elif test `echo "$option" | grep -c \^-` != 0; then
5788 option=`echo $option | sed 's/^-//'`
5789 MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5791 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5794 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5796 dnl Dupes are removed in the encoder section because it will also add decoders
5798 dnl ========================================================
5800 dnl ========================================================
5801 MOZ_ARG_ENABLE_STRING(image-encoders,
5802 [ --enable-image-encoders[={mod1,mod2,default,all,none}]
5803 Enable specific image encoders],
5804 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5805 if test "$option" = "yes" || test "$option" = "all"; then
5806 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5807 elif test "$option" = "no" || test "$option" = "none"; then
5810 elif test "$option" = "default"; then
5811 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5812 elif test `echo "$option" | grep -c \^-` != 0; then
5813 option=`echo $option | sed 's/^-//'`
5814 addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5816 addencoder="$option"
5818 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5820 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5823 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5824 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5826 dnl ========================================================
5827 dnl MathML on by default
5828 dnl ========================================================
5829 MOZ_ARG_DISABLE_BOOL(mathml,
5830 [ --disable-mathml Disable MathML support],
5833 if test "$MOZ_MATHML"; then
5834 AC_DEFINE(MOZ_MATHML)
5837 dnl ========================================================
5839 dnl ========================================================
5840 MOZ_ARG_DISABLE_BOOL(svg,
5841 [ --disable-svg Disable SVG support],
5844 if test -n "$MOZ_SVG"; then
5848 dnl ========================================================
5850 dnl ========================================================
5852 MOZ_ARG_DISABLE_BOOL(smil,
5853 [ --disable-smil Disable SMIL animation support],
5856 # Automatically disable SMIL if SVG is disabled
5857 if test -z "$MOZ_SVG"; then
5860 if test -n "$MOZ_SMIL"; then
5864 dnl ========================================================
5865 dnl Build Freetype in the tree
5866 dnl ========================================================
5867 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5868 [ --enable-tree-freetype Enable Tree FreeType],
5869 MOZ_TREE_FREETYPE=1,
5870 MOZ_TREE_FREETYPE= )
5871 if test -n "$MOZ_TREE_FREETYPE"; then
5872 AC_DEFINE(MOZ_TREE_FREETYPE)
5873 AC_SUBST(MOZ_TREE_FREETYPE)
5874 MOZ_ENABLE_CAIRO_FT=1
5875 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5876 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5877 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5878 FT2_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5879 CAIRO_FT_LIBS='$(LIBXUL_DIST)/lib/freetype2.lib'
5880 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5881 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
5882 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
5883 AC_SUBST(CAIRO_FT_CFLAGS)
5887 dnl ========================================================
5889 dnl ========================================================
5890 case "$target_os" in
5891 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5896 MOZ_ARG_DISABLE_BOOL(installer,
5897 [ --disable-installer Disable building of installer],
5900 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
5901 # Disable installer for Windows builds that use the new toolkit if NSIS
5902 # isn't in the path.
5903 MOZ_PATH_PROGS(MAKENSIS, makensis)
5904 if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5905 AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5907 # The Windows build for NSIS requires the iconv command line utility to
5908 # convert the charset of the locale files.
5909 MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5910 if test -z "$HOST_ICONV"; then
5911 AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5915 # Automatically disable installer if xpinstall isn't built
5916 if test -z "$MOZ_XPINSTALL"; then
5919 AC_SUBST(MOZ_INSTALLER)
5921 AC_MSG_CHECKING([for tar archiver])
5922 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5923 if test -z "$TAR"; then
5924 AC_MSG_ERROR([no tar archiver found in \$PATH])
5926 AC_MSG_RESULT([$TAR])
5929 AC_MSG_CHECKING([for wget])
5930 AC_CHECK_PROGS(WGET, wget, "")
5931 AC_MSG_RESULT([$WGET])
5934 dnl ========================================================
5936 dnl ========================================================
5938 MOZ_ARG_DISABLE_BOOL(updater,
5939 [ --disable-updater Disable building of updater],
5942 AC_SUBST(MOZ_UPDATER)
5944 # app update channel is 'default' when not supplied.
5945 MOZ_ARG_ENABLE_STRING([update-channel],
5946 [ --enable-update-channel=CHANNEL
5947 Select application update channel (default=default)],
5948 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5950 if test -z "$MOZ_UPDATE_CHANNEL"; then
5951 MOZ_UPDATE_CHANNEL=default
5953 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5955 # tools/update-packaging is not checked out by default.
5956 MOZ_ARG_ENABLE_BOOL(update-packaging,
5957 [ --enable-update-packaging
5958 Enable tools/update-packaging],
5959 MOZ_UPDATE_PACKAGING=1,
5960 MOZ_UPDATE_PACKAGING= )
5961 AC_SUBST(MOZ_UPDATE_PACKAGING)
5963 dnl ========================================================
5965 dnl ========================================================
5967 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5968 [ --disable-xpconnect-idispatch
5969 Disable building of xpconnect support for IDispatch
5971 XPC_IDISPATCH_SUPPORT=,
5972 XPC_IDISPATCH_SUPPORT=1)
5973 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5975 MOZ_ARG_DISABLE_BOOL(activex,
5976 [ --disable-activex Disable building of ActiveX control (win32 only)],
5977 MOZ_NO_ACTIVEX_SUPPORT=1,
5978 MOZ_NO_ACTIVEX_SUPPORT= )
5979 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5981 MOZ_ARG_ENABLE_BOOL(activex-scripting,
5982 [ --enable-activex-scripting
5983 Enable building of ActiveX scripting support (win32)],
5984 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
5985 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
5986 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5988 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5990 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5993 if test "$COMPILE_ENVIRONMENT" = "1"; then
5994 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5996 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5997 if test "$ac_cv_header_atlbase_h" = "no"; then
5998 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.])
6005 dnl ========================================================
6007 dnl ========================================================
6008 MOZ_ARG_ENABLE_BOOL(leaky,
6009 [ --enable-leaky Build leaky memory tool],
6014 dnl ========================================================
6016 dnl ========================================================
6017 MOZ_ARG_ENABLE_BOOL(xpctools,
6018 [ --enable-xpctools Build JS profiling tool],
6023 dnl ========================================================
6024 dnl build the tests by default
6025 dnl ========================================================
6026 MOZ_ARG_DISABLE_BOOL(tests,
6027 [ --disable-tests Do not build test libraries & programs],
6031 dnl ========================================================
6032 dnl parental controls (for Windows Vista)
6033 dnl ========================================================
6034 MOZ_ARG_DISABLE_BOOL(parental-controls,
6035 [ --disable-parental-controls
6036 Do not build parental controls],
6037 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6038 MOZ_DISABLE_PARENTAL_CONTROLS=)
6039 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6040 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6043 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6045 dnl ========================================================
6047 dnl = Module specific options
6049 dnl ========================================================
6050 MOZ_ARG_HEADER(Individual module options)
6052 dnl ========================================================
6053 dnl = Enable places (new history/bookmarks)
6054 dnl ========================================================
6055 MOZ_ARG_ENABLE_BOOL(places,
6056 [ --enable-places Enable 'places' bookmark/history implementation],
6059 if test -n "$MOZ_PLACES"; then
6060 AC_DEFINE(MOZ_PLACES)
6061 if test -z "$MOZ_MAIL_NEWS"; then
6066 if test "$MOZ_BUILD_APP" = "browser"; then
6067 AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6071 dnl ========================================================
6072 dnl = Disable feed handling components
6073 dnl ========================================================
6074 MOZ_ARG_DISABLE_BOOL(feeds,
6075 [ --disable-feeds Disable feed handling and processing components],
6078 if test -n "$MOZ_FEEDS"; then
6079 AC_DEFINE(MOZ_FEEDS)
6081 if test "$MOZ_BUILD_APP" = "browser"; then
6082 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6086 dnl ========================================================
6087 dnl = Enable mozStorage
6088 dnl ========================================================
6089 dnl Implicitly enabled by default if building calendar or places
6090 MOZ_ARG_ENABLE_BOOL(storage,
6091 [ --enable-storage Enable mozStorage module and related components],
6094 if test -n "$MOZ_STORAGE"; then
6095 AC_DEFINE(MOZ_STORAGE)
6098 dnl ========================================================
6099 dnl Check for sqlite
6100 dnl ========================================================
6103 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6104 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6105 MOZ_NATIVE_SQLITE=1,
6106 MOZ_NATIVE_SQLITE= )
6108 if test -z "$MOZ_NATIVE_SQLITE"
6111 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6113 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6116 AC_SUBST(MOZ_NATIVE_SQLITE)
6118 dnl ========================================================
6119 dnl = Enable help viewer (off by default)
6120 dnl ========================================================
6121 MOZ_ARG_ENABLE_BOOL(help-viewer,
6122 [ --enable-help-viewer Enable help viewer],
6125 if test -n "$MOZ_HELP_VIEWER"; then
6126 AC_DEFINE(MOZ_HELP_VIEWER)
6128 AC_SUBST(MOZ_HELP_VIEWER)
6129 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6130 AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6133 dnl ========================================================
6134 dnl = Enable safe browsing (anti-phishing)
6135 dnl ========================================================
6136 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6137 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6138 MOZ_SAFE_BROWSING=1,
6139 MOZ_SAFE_BROWSING= )
6140 if test -n "$MOZ_SAFE_BROWSING"; then
6141 AC_DEFINE(MOZ_SAFE_BROWSING)
6143 AC_SUBST(MOZ_SAFE_BROWSING)
6145 dnl ========================================================
6146 dnl = Enable faststart component
6147 dnl ========================================================
6148 MOZ_ARG_ENABLE_BOOL(faststart,
6149 [ --enable-faststart Enable the faststart component],
6152 if test -n "$MOZ_FASTSTART"; then
6153 AC_DEFINE(MOZ_FASTSTART)
6155 AC_SUBST(MOZ_FASTSTART)
6157 dnl ========================================================
6158 dnl = Enable url-classifier
6159 dnl ========================================================
6160 dnl Implicitly enabled by default if building with safe-browsing
6161 if test -n "$MOZ_SAFE_BROWSING"; then
6162 MOZ_URL_CLASSIFIER=1
6164 MOZ_ARG_ENABLE_BOOL(url-classifier,
6165 [ --enable-url-classifier Enable url classifier module],
6166 MOZ_URL_CLASSIFIER=1,
6167 MOZ_URL_CLASSIFIER= )
6168 if test -n "$MOZ_URL_CLASSIFIER"; then
6169 AC_DEFINE(MOZ_URL_CLASSIFIER)
6171 AC_SUBST(MOZ_URL_CLASSIFIER)
6173 dnl ========================================================
6174 dnl = Disable zipwriter
6175 dnl ========================================================
6176 MOZ_ARG_DISABLE_BOOL(zipwriter,
6177 [ --disable-zipwriter Disable zipwriter component],
6180 AC_SUBST(MOZ_ZIPWRITER)
6182 dnl ========================================================
6183 dnl = Hildon and OSSO checks
6184 dnl ========================================================
6185 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6186 MOZ_PLATFORM_HILDON=1,
6187 MOZ_PLATFORM_HILDON=)
6188 if test $MOZ_PLATFORM_HILDON; then
6189 AC_DEFINE(MOZ_PLATFORM_HILDON)
6190 X11_COMPOSITED_PLUGINS="yes"
6192 AC_SUBST(LIBHILDONMIME_CFLAGS)
6193 AC_SUBST(LIBHILDONMIME_LIBS)
6195 if test "$X11_COMPOSITED_PLUGINS" = "yes"; then
6196 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6197 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6198 [AC_MSG_ERROR([Couldn't find X11/extentsions/Xdamage.h which is required for composited plugins.])])
6199 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6200 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6202 AC_SUBST(XCOMPOSITE_LIBS)
6204 PKG_CHECK_MODULES(LIBOSSO,libosso,
6208 if test $NS_OSSO; then
6209 if test -z "$MOZ_ENABLE_DBUS"; then
6210 AC_MSG_ERROR([DBus is required when building for OSSO])
6213 MOZ_GFX_OPTIMIZE_MOBILE=1
6216 AC_SUBST(LIBOSSO_CFLAGS)
6217 AC_SUBST(LIBOSSO_LIBS)
6219 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2,
6222 AC_SUBST(LIBHILDONFM_CFLAGS)
6223 AC_SUBST(LIBHILDONFM_LIBS)
6225 dnl ========================================================
6226 dnl = faststripe theme
6227 dnl ========================================================
6228 MOZ_ARG_ENABLE_BOOL(faststripe,
6229 [ --enable-faststripe Use faststripe theme],
6230 MOZ_THEME_FASTSTRIPE=1,
6231 MOZ_THEME_FASTSTRIPE= )
6232 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6234 dnl ========================================================
6236 dnl = Feature options that require extra sources to be pulled
6238 dnl ========================================================
6239 dnl MOZ_ARG_HEADER(Features that require extra sources)
6241 dnl ========================================================
6243 dnl = Debugging Options
6245 dnl ========================================================
6246 MOZ_ARG_HEADER(Debugging and Optimizations)
6248 dnl ========================================================
6249 dnl = Disable building with debug info.
6250 dnl = Debugging is OFF by default
6251 dnl ========================================================
6252 if test -z "$MOZ_DEBUG_FLAGS"
6256 if test "$GNU_CC"; then
6257 GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6258 case "$GCC_VERSION" in
6263 MOZ_DEBUG_FLAGS="-g"
6267 MOZ_DEBUG_FLAGS="-g"
6271 MOZ_DEBUG_FLAGS="-g"
6276 MOZ_ARG_ENABLE_STRING(debug,
6277 [ --enable-debug[=DBG] Enable building with developer debug info
6278 (Using compiler flags DBG)],
6279 [ if test "$enableval" != "no"; then
6281 if test -n "$enableval" && test "$enableval" != "yes"; then
6282 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6289 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6290 case "${target_os}" in
6292 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6294 msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6295 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6298 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6301 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6303 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6305 if test -n "$MOZ_DEBUG"; then
6306 AC_MSG_CHECKING([for valid debug flags])
6307 _SAVE_CFLAGS=$CFLAGS
6308 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6309 AC_TRY_COMPILE([#include <stdio.h>],
6310 [printf("Hello World\n");],
6313 AC_MSG_RESULT([$_results])
6314 if test "$_results" = "no"; then
6315 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6317 CFLAGS=$_SAVE_CFLAGS
6320 dnl ========================================================
6321 dnl enable mobile optimizations
6322 dnl ========================================================
6323 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6324 [ --enable-mobile-optimize Enable mobile optimizations],
6325 MOZ_GFX_OPTIMIZE_MOBILE=1)
6327 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6329 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6330 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6333 dnl ========================================================
6334 dnl = Enable code optimization. ON by default.
6335 dnl ========================================================
6336 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6337 MOZ_OPTIMIZE_FLAGS="-O"
6340 MOZ_ARG_ENABLE_STRING(optimize,
6341 [ --disable-optimize Disable compiler optimization
6342 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6343 [ if test "$enableval" != "no"; then
6345 if test -n "$enableval" && test "$enableval" != "yes"; then
6346 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6351 fi ], MOZ_OPTIMIZE=1)
6353 if test "$COMPILE_ENVIRONMENT"; then
6354 if test -n "$MOZ_OPTIMIZE"; then
6355 AC_MSG_CHECKING([for valid optimization flags])
6356 _SAVE_CFLAGS=$CFLAGS
6357 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6358 AC_TRY_COMPILE([#include <stdio.h>],
6359 [printf("Hello World\n");],
6362 AC_MSG_RESULT([$_results])
6363 if test "$_results" = "no"; then
6364 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6366 CFLAGS=$_SAVE_CFLAGS
6368 fi # COMPILE_ENVIRONMENT
6370 AC_SUBST(MOZ_OPTIMIZE)
6371 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6372 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6373 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6375 dnl ========================================================
6376 dnl = Enable/disable debug for specific modules only
6377 dnl = module names beginning with ^ will be disabled
6378 dnl ========================================================
6379 MOZ_ARG_ENABLE_STRING(debug-modules,
6380 [ --enable-debug-modules Enable/disable debug info for specific modules],
6381 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6383 dnl ========================================================
6384 dnl = Enable/disable generation of debugger info for specific modules only
6385 dnl = the special module name ALL_MODULES can be used to denote all modules
6386 dnl = module names beginning with ^ will be disabled
6387 dnl ========================================================
6388 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6389 [ --enable-debugger-info-modules
6390 Enable/disable debugger info for specific modules],
6391 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6392 dnl note that the list of module names is reversed as it is copied
6393 dnl this is important, as it will allow config.mk to interpret stuff like
6394 dnl "^ALL_MODULES xpcom" properly
6395 if test "$i" = "no"; then
6398 if test "$i" = "yes"; then
6401 MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6404 dnl ========================================================
6405 dnl Disable runtime logging checks
6406 dnl ========================================================
6407 MOZ_ARG_DISABLE_BOOL(logging,
6408 [ --disable-logging Disable logging facilities],
6409 NS_DISABLE_LOGGING=1,
6410 NS_DISABLE_LOGGING= )
6411 if test "$NS_DISABLE_LOGGING"; then
6412 AC_DEFINE(NS_DISABLE_LOGGING)
6414 AC_DEFINE(MOZ_LOGGING)
6417 dnl ========================================================
6418 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6419 dnl ========================================================
6420 _ENABLE_LOGREFCNT=42
6421 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6422 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6423 _ENABLE_LOGREFCNT=1,
6424 _ENABLE_LOGREFCNT= )
6425 if test "$_ENABLE_LOGREFCNT" = "1"; then
6426 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6427 elif test -z "$_ENABLE_LOGREFCNT"; then
6428 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6431 dnl ========================================================
6432 dnl = Enable trace malloc
6433 dnl ========================================================
6434 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6435 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6436 [ --enable-trace-malloc Enable malloc tracing],
6439 if test "$NS_TRACE_MALLOC"; then
6440 # Please, Mr. Linker Man, don't take away our symbol names
6441 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6443 AC_DEFINE(NS_TRACE_MALLOC)
6445 AC_SUBST(NS_TRACE_MALLOC)
6447 dnl ========================================================
6448 dnl = Enable jemalloc
6449 dnl ========================================================
6450 MOZ_ARG_ENABLE_BOOL(jemalloc,
6451 [ --enable-jemalloc Replace memory allocator with jemalloc],
6455 if test "$NS_TRACE_MALLOC"; then
6459 if test "$MOZ_MEMORY"; then
6461 dnl Don't try to run compiler tests on Windows
6462 if test "$OS_ARCH" = "WINNT"; then
6463 if test -z "$HAVE_64BIT_OS"; then
6464 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6466 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6469 AC_CHECK_SIZEOF([int *], [4])
6470 case "${ac_cv_sizeof_int_p}" in
6472 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6475 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6478 AC_MSG_ERROR([Unexpected pointer size])
6483 AC_DEFINE(MOZ_MEMORY)
6484 if test "x$MOZ_DEBUG" = "x1"; then
6485 AC_DEFINE(MOZ_MEMORY_DEBUG)
6487 dnl The generic feature tests that determine how to compute ncpus are long and
6488 dnl complicated. Therefore, simply define special cpp variables for the
6489 dnl platforms we have special knowledge of.
6490 case "${target_os}" in
6492 AC_DEFINE(MOZ_MEMORY_DARWIN)
6495 AC_DEFINE(MOZ_MEMORY_BSD)
6498 AC_DEFINE(MOZ_MEMORY_LINUX)
6501 AC_DEFINE(MOZ_MEMORY_BSD)
6504 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6506 msvc*|mks*|cygwin*|mingw*)
6507 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6508 dnl This is sort of awful. Will revisit if we add support for more versions
6509 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
6510 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
6512 if test -z "$WIN32_CRT_SRC_DIR"; then
6513 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6514 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).])
6516 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6520 case "${target_cpu}" in
6522 _WIN32_CRT_CPU=intel
6525 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6529 if test ! -d "$WIN32_CRT_SRC_DIR"; then
6530 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
6532 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
6533 _objdir_win=`pwd -W`
6534 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
6535 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
6536 dnl Also pass this to NSPR/NSS
6537 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
6541 AC_DEFINE(MOZ_MEMORY_WINCE)
6542 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6543 if test -z "$WINCE_WINDOWS_MOBILE"; then
6544 AC_DEFINE(MOZ_MEMORY_WINCE6)
6548 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6552 AC_SUBST(MOZ_MEMORY)
6553 AC_SUBST(MOZ_MEMORY_LDFLAGS)
6554 AC_SUBST(WIN32_CRT_SRC_DIR)
6555 dnl Need to set this for make because NSS doesn't have configure
6558 dnl ========================================================
6559 dnl = Use malloc wrapper lib
6560 dnl ========================================================
6561 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6562 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
6566 if test -n "$_WRAP_MALLOC"; then
6567 if test "$GNU_CC"; then
6568 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"
6569 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6573 dnl ========================================================
6574 dnl = Location of malloc wrapper lib
6575 dnl ========================================================
6576 MOZ_ARG_WITH_STRING(wrap-malloc,
6577 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
6578 WRAP_MALLOC_LIB=$withval)
6580 dnl ========================================================
6582 dnl ========================================================
6583 MOZ_ARG_ENABLE_BOOL(tracevis,
6584 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
6587 if test -n "$MOZ_TRACEVIS"; then
6588 AC_DEFINE(MOZ_TRACEVIS)
6591 dnl ========================================================
6593 dnl ========================================================
6594 MOZ_ARG_ENABLE_BOOL(valgrind,
6595 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
6598 if test -n "$MOZ_VALGRIND"; then
6599 AC_CHECK_HEADER([valgrind/valgrind.h], [],
6601 [--enable-valgrind specified but Valgrind is not installed]))
6602 AC_DEFINE(MOZ_VALGRIND)
6605 dnl ========================================================
6607 dnl ========================================================
6608 MOZ_ARG_ENABLE_BOOL(jprof,
6609 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)],
6612 if test -n "$MOZ_JPROF"; then
6613 AC_DEFINE(MOZ_JPROF)
6616 dnl ========================================================
6618 dnl ========================================================
6619 MOZ_ARG_ENABLE_BOOL(shark,
6620 [ --enable-shark Enable shark remote profiling (needs CHUD framework)],
6623 if test -n "$MOZ_SHARK"; then
6624 AC_DEFINE(MOZ_SHARK)
6627 dnl ========================================================
6629 dnl ========================================================
6630 MOZ_ARG_ENABLE_BOOL(callgrind,
6631 [ --enable-callgrind Enable callgrind profiling],
6634 if test -n "$MOZ_CALLGRIND"; then
6635 AC_DEFINE(MOZ_CALLGRIND)
6638 dnl ========================================================
6640 dnl ========================================================
6641 MOZ_ARG_ENABLE_BOOL(vtune,
6642 [ --enable-vtune Enable vtune profiling],
6645 if test -n "$MOZ_VTUNE"; then
6646 AC_DEFINE(MOZ_VTUNE)
6649 dnl ========================================================
6650 dnl Zealous JavaScript GC
6651 dnl ========================================================
6652 MOZ_ARG_ENABLE_BOOL(gczeal,
6653 [ --enable-gczeal Enable zealous JavaScript GCing],
6656 if test -n "$JS_GC_ZEAL"; then
6657 AC_DEFINE(JS_GC_ZEAL)
6660 dnl ========================================================
6661 dnl = Enable static checking using gcc-dehydra
6662 dnl ========================================================
6664 MOZ_ARG_WITH_STRING(static-checking,
6665 [ --with-static-checking=path/to/gcc_dehydra.so
6666 Enable static checking of code using GCC-dehydra],
6667 DEHYDRA_PATH=$withval,
6670 if test -n "$DEHYDRA_PATH"; then
6671 if test ! -f "$DEHYDRA_PATH"; then
6672 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6674 AC_DEFINE(NS_STATIC_CHECKING)
6676 AC_SUBST(DEHYDRA_PATH)
6678 dnl ========================================================
6679 dnl = Enable stripping of libs & executables
6680 dnl ========================================================
6681 MOZ_ARG_ENABLE_BOOL(strip,
6682 [ --enable-strip Enable stripping of libs & executables ],
6686 dnl ========================================================
6687 dnl = Enable stripping of libs & executables when packaging
6688 dnl ========================================================
6689 MOZ_ARG_ENABLE_BOOL(install-strip,
6690 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
6694 dnl ========================================================
6695 dnl = --enable-elf-dynstr-gc
6696 dnl ========================================================
6697 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6698 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
6699 USE_ELF_DYNSTR_GC=1,
6700 USE_ELF_DYNSTR_GC= )
6702 dnl ========================================================
6704 dnl = Profiling and Instrumenting
6706 dnl ========================================================
6707 MOZ_ARG_HEADER(Profiling and Instrumenting)
6709 dnl ========================================================
6710 dnl = Enable timeline service, which provides lightweight
6711 dnl = instrumentation of mozilla for performance measurement.
6712 dnl = Timeline is off by default.
6713 dnl ========================================================
6714 MOZ_ARG_ENABLE_BOOL(timeline,
6715 [ --enable-timeline Enable timeline services ],
6718 if test -n "$MOZ_TIMELINE"; then
6719 AC_DEFINE(MOZ_TIMELINE)
6722 dnl ========================================================
6723 dnl Turn on reflow counting
6724 dnl ========================================================
6725 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6726 [ --enable-reflow-perf Enable reflow performance tracing],
6729 if test -n "$MOZ_REFLOW_PERF"; then
6730 AC_DEFINE(MOZ_REFLOW_PERF)
6733 dnl ========================================================
6734 dnl Enable code size metrics.
6735 dnl ========================================================
6736 MOZ_ARG_ENABLE_BOOL(codesighs,
6737 [ --enable-codesighs Enable code size analysis tools],
6738 _ENABLE_CODESIGHS=1,
6739 _ENABLE_CODESIGHS= )
6740 if test -n "$_ENABLE_CODESIGHS"; then
6741 if test -d $srcdir/tools/codesighs; then
6744 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6748 MOZ_ARG_ENABLE_BOOL(insure,
6749 [ --enable-insure Enable insure++ instrumentation (linux only)],
6752 if test -n "$_ENABLE_INSURE"; then
6756 MOZ_INSURE_EXCLUDE_DIRS="config"
6759 MOZ_ARG_WITH_STRING(insure-dirs,
6760 [ --with-insure-dirs=DIRS
6761 Dirs to instrument with insure ],
6762 MOZ_INSURE_DIRS=$withval )
6764 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6765 [ --with-insure-exclude-dirs=DIRS
6766 Dirs to not instrument with insure ],
6767 MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6769 dnl ========================================================
6770 dnl = Support for Quantify (Windows)
6771 dnl ========================================================
6772 MOZ_ARG_ENABLE_BOOL(quantify,
6773 [ --enable-quantify Enable Quantify support (Windows only) ],
6777 dnl ========================================================
6778 dnl = Support for demangling undefined symbols
6779 dnl ========================================================
6780 if test -z "$SKIP_LIBRARY_CHECKS"; then
6783 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6787 # Demangle only for debug or trace-malloc builds
6788 MOZ_DEMANGLE_SYMBOLS=
6789 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6790 MOZ_DEMANGLE_SYMBOLS=1
6791 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6793 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6795 dnl ========================================================
6796 dnl = Support for gcc stack unwinding (from gcc 3.3)
6797 dnl ========================================================
6798 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6799 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6802 dnl ========================================================
6806 dnl ========================================================
6807 MOZ_ARG_HEADER(Misc. Options)
6809 dnl ========================================================
6810 dnl update xterm title
6811 dnl ========================================================
6812 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6813 [ --enable-xterm-updates Update XTERM titles with current command.],
6817 dnl =========================================================
6819 dnl =========================================================
6820 MOZ_ARG_ENABLE_STRING([chrome-format],
6821 [ --enable-chrome-format=jar|flat|both|symlink
6822 Select FORMAT of chrome files (default=jar)],
6823 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6825 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6826 MOZ_CHROME_FILE_FORMAT=jar
6829 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
6830 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6831 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6832 test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6833 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6836 if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
6837 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
6839 dnl ========================================================
6840 dnl = Define default location for MOZILLA_FIVE_HOME
6841 dnl ========================================================
6842 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6843 [ --with-default-mozilla-five-home
6844 Set the default value for MOZILLA_FIVE_HOME],
6845 [ val=`echo $withval`
6846 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6848 dnl ========================================================
6849 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6850 dnl ========================================================
6851 MOZ_ARG_WITH_STRING(user-appdir,
6852 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
6853 [ val=`echo $withval`
6854 if echo "$val" | grep "\/" >/dev/null; then
6855 AC_MSG_ERROR("Homedir must be single relative path.")
6860 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6862 dnl ========================================================
6863 dnl = Doxygen configuration
6864 dnl ========================================================
6865 dnl Use commas to specify multiple dirs to this arg
6866 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6867 MOZ_ARG_WITH_STRING(doc-input-dirs,
6868 [ --with-doc-input-dirs=DIRS
6869 Header/idl dirs to create docs from],
6870 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6871 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6873 dnl Use commas to specify multiple dirs to this arg
6874 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6875 MOZ_ARG_WITH_STRING(doc-include-dirs,
6876 [ --with-doc-include-dirs=DIRS
6877 Include dirs to preprocess doc headers],
6878 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6879 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6881 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6882 MOZ_ARG_WITH_STRING(doc-output-dir,
6883 [ --with-doc-output-dir=DIR
6884 Dir to generate docs into],
6885 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6886 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6888 if test -z "$SKIP_COMPILER_CHECKS"; then
6889 dnl ========================================================
6891 dnl = Compiler Options
6893 dnl ========================================================
6894 MOZ_ARG_HEADER(Compiler Options)
6896 dnl ========================================================
6897 dnl Check for gcc -pipe support
6898 dnl ========================================================
6899 AC_MSG_CHECKING([for gcc -pipe support])
6900 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6901 echo '#include <stdio.h>' > dummy-hello.c
6902 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6903 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6904 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
6905 if test $? = 0; then
6910 if test "$_res_as_stdin" = "yes"; then
6911 _SAVE_CFLAGS=$CFLAGS
6912 CFLAGS="$CFLAGS -pipe"
6913 AC_TRY_COMPILE( [ #include <stdio.h> ],
6914 [printf("Hello World\n");],
6915 [_res_gcc_pipe="yes"],
6916 [_res_gcc_pipe="no"] )
6917 CFLAGS=$_SAVE_CFLAGS
6919 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6921 CFLAGS="$CFLAGS -pipe"
6922 CXXFLAGS="$CXXFLAGS -pipe"
6926 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6927 AC_MSG_RESULT([$_res])
6932 dnl pass -Wno-long-long to the compiler
6933 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6934 [ --enable-long-long-warning
6935 Warn about use of non-ANSI long long type],
6936 _IGNORE_LONG_LONG_WARNINGS=,
6937 _IGNORE_LONG_LONG_WARNINGS=1)
6939 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6940 _SAVE_CFLAGS="$CFLAGS"
6941 CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6942 AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6943 AC_TRY_COMPILE([], [return(0);],
6944 [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6945 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6946 result="yes" ], result="no")
6947 AC_MSG_RESULT([$result])
6948 CFLAGS="$_SAVE_CFLAGS"
6951 dnl ========================================================
6952 dnl Profile guided optimization
6953 dnl ========================================================
6954 dnl Test for profiling options
6955 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6956 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6958 dnl Provide a switch to disable PGO even when called via profiledbuild.
6959 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6960 [ --disable-profile-guided-optimization
6961 Don't build with PGO even if called via make profiledbuild],
6962 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6963 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6965 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6967 _SAVE_CFLAGS="$CFLAGS"
6968 CFLAGS="$CFLAGS -fprofile-generate"
6970 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6971 AC_TRY_COMPILE([], [return 0;],
6972 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6973 result="yes" ], result="no")
6974 AC_MSG_RESULT([$result])
6976 if test $result = "yes"; then
6977 PROFILE_GEN_LDFLAGS="-fprofile-generate"
6978 PROFILE_USE_CFLAGS="-fprofile-use"
6979 PROFILE_USE_LDFLAGS="-fprofile-use"
6981 CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6982 AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6983 AC_TRY_COMPILE([], [return 0;],
6984 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6985 result="yes" ], result="no")
6986 AC_MSG_RESULT([$result])
6987 if test $result = "yes"; then
6988 PROFILE_USE_CFLAGS="-fbranch-probabilities"
6990 # don't really care, this is an old GCC
6991 PROFILE_GEN_LDFLAGS=
6992 PROFILE_USE_LDFLAGS=
6995 CFLAGS="$_SAVE_CFLAGS"
6997 if test -n "$INTEL_CC"; then
6998 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6999 PROFILE_GEN_LDFLAGS=
7000 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7001 PROFILE_USE_LDFLAGS=
7004 dnl Sun Studio on Solaris
7005 if test "$SOLARIS_SUNPRO_CC"; then
7006 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7007 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7008 if test "$CPU_ARCH" != "sparc"; then
7009 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7010 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7012 PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7013 PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7017 AC_SUBST(PROFILE_GEN_CFLAGS)
7018 AC_SUBST(PROFILE_GEN_LDFLAGS)
7019 AC_SUBST(PROFILE_USE_CFLAGS)
7020 AC_SUBST(PROFILE_USE_LDFLAGS)
7024 dnl ========================================================
7025 dnl Test for -pedantic bustage
7026 dnl ========================================================
7027 MOZ_ARG_DISABLE_BOOL(pedantic,
7028 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7030 if test "$_PEDANTIC"; then
7031 _SAVE_CXXFLAGS=$CXXFLAGS
7032 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7033 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7034 AC_TRY_COMPILE([$configure_static_assert_macros],
7035 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7036 result="no", result="yes" )
7037 AC_MSG_RESULT([$result])
7038 CXXFLAGS="$_SAVE_CXXFLAGS"
7042 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7043 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7046 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7051 dnl ========================================================
7052 dnl Test for correct temporary object destruction order
7053 dnl ========================================================
7054 dnl We want to make sure the compiler follows the C++ spec here as
7055 dnl xpcom and the string classes depend on it (bug 235381).
7056 AC_MSG_CHECKING([for correct temporary object destruction order])
7057 AC_TRY_RUN([ class A {
7058 public: A(int& x) : mValue(x) {}
7060 operator char**() { return 0; }
7061 private: int& mValue;
7063 void func(char **arg) {}
7074 result="yes", result="no", result="maybe")
7075 AC_MSG_RESULT([$result])
7077 if test "$result" = "no"; then
7078 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7081 dnl ========================================================
7082 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7083 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7084 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7085 dnl ========================================================
7086 _SAVE_CXXFLAGS=$CXXFLAGS
7087 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7088 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7089 ac_nscap_nonconst_opeq_bug,
7098 template <class T, class U>
7099 int operator==(const Pointer<T>& rhs, U* lhs)
7101 return rhs.myPtr == lhs;
7104 template <class T, class U>
7105 int operator==(const Pointer<T>& rhs, const U* lhs)
7107 return rhs.myPtr == lhs;
7115 ac_nscap_nonconst_opeq_bug="no",
7116 ac_nscap_nonconst_opeq_bug="yes")])
7117 CXXFLAGS="$_SAVE_CXXFLAGS"
7119 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7120 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7122 fi # SKIP_COMPILER_CHECKS
7124 dnl ========================================================
7126 dnl Should be smarter and check that the compiler does indeed have rtti
7127 dnl ========================================================
7128 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7129 [ --enable-cpp-rtti Enable C++ RTTI ],
7130 [ _MOZ_USE_RTTI=1 ],
7133 if test "$_MOZ_USE_RTTI"; then
7134 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7136 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7139 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7141 dnl ========================================================
7142 dnl C++ exceptions (g++/egcs only - for now)
7143 dnl Should be smarter and check that the compiler does indeed have exceptions
7144 dnl ========================================================
7145 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7146 [ --enable-cpp-exceptions Enable C++ exceptions ],
7147 [ _MOZ_CPP_EXCEPTIONS=1 ],
7148 [ _MOZ_CPP_EXCEPTIONS= ])
7150 if test "$_MOZ_CPP_EXCEPTIONS"; then
7151 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7153 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7156 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7158 # Irix & OSF native compilers do not like exception declarations
7159 # when exceptions are disabled
7160 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7161 AC_DEFINE(CPP_THROW_NEW, [])
7163 AC_DEFINE(CPP_THROW_NEW, [throw()])
7167 dnl ========================================================
7169 dnl = Build depencency options
7171 dnl ========================================================
7172 MOZ_ARG_HEADER(Build dependencies)
7174 dnl ========================================================
7175 dnl = Do not auto generate dependency info
7176 dnl ========================================================
7178 MOZ_ARG_DISABLE_BOOL(auto-deps,
7179 [ --disable-auto-deps Do not automatically generate dependency info],
7183 if test -n "$MOZ_AUTO_DEPS"; then
7184 dnl ========================================================
7185 dnl = Use mkdepend instead of $CC -MD for dependency generation
7186 dnl ========================================================
7188 MOZ_ARG_DISABLE_BOOL(md,
7189 [ --disable-md Do not use compiler-based dependencies ],
7192 [dnl Default is to turn on -MD if using GNU-compatible compilers
7193 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7196 dnl Default is to use -xM if using Sun Studio on Solaris
7197 if test "$SOLARIS_SUNPRO_CC"; then
7200 if test "$_cpp_md_flag"; then
7202 if test "$OS_ARCH" = "OpenVMS"; then
7203 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7205 _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7207 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7208 if test "$SOLARIS_SUNPRO_CC"; then
7213 dnl Don't override this for MSVC
7214 if test -z "$_WIN32_MSVC"; then
7215 _USE_CPP_INCLUDE_FLAG=
7216 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7217 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7222 AC_SUBST(MOZ_AUTO_DEPS)
7223 AC_SUBST(COMPILER_DEPEND)
7227 dnl ========================================================
7229 dnl = Static Build Options
7231 dnl ========================================================
7232 MOZ_ARG_HEADER(Static build options)
7234 MOZ_ARG_ENABLE_BOOL(static,
7235 [ --enable-static Enable building of internal static libs],
7236 BUILD_STATIC_LIBS=1,
7239 dnl Disable libxul in debug builds, but not for xulrunner.
7240 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7244 MOZ_ARG_ENABLE_BOOL(libxul,
7245 [ --enable-libxul Enable building of libxul],
7246 MOZ_ENABLE_LIBXUL=1,
7249 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7250 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7253 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7254 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7257 AC_SUBST(LIBXUL_LIBS)
7259 if test -n "$MOZ_ENABLE_LIBXUL"; then
7260 XPCOM_LIBS="$LIBXUL_LIBS"
7261 AC_DEFINE(MOZ_ENABLE_LIBXUL)
7263 if test -n "$BUILD_STATIC_LIBS"; then
7264 AC_DEFINE(MOZ_STATIC_BUILD)
7266 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7269 dnl ========================================================
7271 dnl = Standalone module options
7273 dnl ========================================================
7274 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7276 dnl Check for GLib and libIDL.
7277 dnl ========================================================
7278 case "$target_os" in
7279 msvc*|mks*|cygwin*|mingw*|wince*)
7280 SKIP_IDL_CHECK="yes"
7287 if test -z "$COMPILE_ENVIRONMENT"; then
7288 SKIP_IDL_CHECK="yes"
7291 dnl = Allow users to disable libIDL checking for standalone modules
7292 MOZ_ARG_WITHOUT_BOOL(libIDL,
7293 [ --without-libIDL Skip check for libIDL (standalone modules only)],
7294 SKIP_IDL_CHECK="yes")
7296 if test "$SKIP_IDL_CHECK" = "no"
7299 if test "$MACOS_SDK_DIR"; then
7300 dnl xpidl, and therefore libIDL, is only needed on the build host.
7301 dnl Don't build it against the SDK, as that causes problems.
7302 _MACSAVE_CFLAGS="$CFLAGS"
7303 _MACSAVE_LIBS="$LIBS"
7304 _MACSAVE_LDFLAGS="$LDFLAGS"
7305 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7307 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"`
7308 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7309 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7314 if test "$MOZ_ENABLE_GTK2"; then
7315 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7317 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7318 dnl to either libIDL1 or libIDL2.
7319 if test -z "$_LIBIDL_FOUND"; then
7320 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7321 if test -z "$_LIBIDL_FOUND"; then
7322 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7326 dnl If we don't have a libIDL config program & not cross-compiling,
7327 dnl look for orbit-config instead.
7329 if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7330 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7331 if test -n "$ORBIT_CONFIG"; then
7332 AC_MSG_CHECKING([for ORBit libIDL usability])
7333 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7334 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7335 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7336 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7337 LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7338 LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7340 _SAVE_CFLAGS="$CFLAGS"
7342 CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7343 LIBS="$LIBIDL_LIBS $LIBS"
7346 #include <libIDL/IDL.h>
7349 s=strdup(IDL_get_libver_string());
7362 AC_MSG_RESULT($result)
7363 CFLAGS="$_SAVE_CFLAGS"
7367 if test -z "$_LIBIDL_FOUND"; then
7368 AC_MSG_ERROR([libIDL not found.
7369 libIDL $LIBIDL_VERSION or higher is required.])
7371 if test "$MACOS_SDK_DIR"; then
7372 CFLAGS="$_MACSAVE_CFLAGS"
7373 LIBS="$_MACSAVE_LIBS"
7374 LDFLAGS="$_MACSAVE_LDFLAGS"
7375 if test -n "$_MACSAVE_NEXT_ROOT" ; then
7376 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7381 if test -n "$CROSS_COMPILE"; then
7382 if test -z "$HOST_LIBIDL_CONFIG"; then
7383 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7385 if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7386 HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7387 HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7389 HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7390 HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7394 if test -z "$SKIP_PATH_CHECKS"; then
7395 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7396 if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7397 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7399 AM_PATH_GLIB(${GLIB_VERSION})
7404 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7405 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7408 AC_SUBST(LIBIDL_CFLAGS)
7409 AC_SUBST(LIBIDL_LIBS)
7410 AC_SUBST(STATIC_LIBIDL)
7411 AC_SUBST(GLIB_CFLAGS)
7413 AC_SUBST(GLIB_GMODULE_LIBS)
7414 AC_SUBST(HOST_LIBIDL_CONFIG)
7415 AC_SUBST(HOST_LIBIDL_CFLAGS)
7416 AC_SUBST(HOST_LIBIDL_LIBS)
7418 dnl ========================================================
7420 dnl ========================================================
7421 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7424 MOZ_ARG_ENABLE_BOOL(system-cairo,
7425 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7429 # Check for headers defining standard int types.
7430 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7432 if test "$MOZ_TREE_CAIRO"; then
7433 AC_DEFINE(MOZ_TREE_CAIRO)
7435 # For now we assume that we will have a uint64_t available through
7436 # one of the above headers or mozstdint.h.
7437 AC_DEFINE(HAVE_UINT64_T)
7439 # Define macros for cairo-features.h
7440 if test "$MOZ_X11"; then
7441 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7442 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7443 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7444 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7445 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7446 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7447 MOZ_ENABLE_CAIRO_FT=1
7448 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7450 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7451 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7453 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7454 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7455 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7456 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7458 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7459 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7460 if test -z "$WINCE"; then
7461 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7466 AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
7467 if test -z "$HAS_DDRAW"; then
7468 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.])
7469 DDRAW_SURFACE_FEATURE=
7471 DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
7474 if test -z "$OGLES_SDK_DIR"; then
7475 OGLES_SURFACE_FEATURE=
7478 #include <EGL/egl.h>
7479 #include <EGL/eglext.h>
7480 #include <GLES2/gl2.h>
7481 #include <GLES2/gl2ext.h>
7482 ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
7483 if test -z "$HAS_OGLES"; then
7484 AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
7485 OGLES_SURFACE_FEATURE=
7487 OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
7491 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7493 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7494 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7495 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7496 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7497 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7498 MOZ_ENABLE_CAIRO_FT=1
7499 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7500 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7502 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7503 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7504 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7505 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7506 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7507 MOZ_ENABLE_CAIRO_FT=1
7509 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7510 AC_SUBST(CAIRO_FT_CFLAGS)
7513 if test "$MOZ_DEBUG"; then
7514 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7516 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7519 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7521 AC_SUBST(PS_SURFACE_FEATURE)
7522 AC_SUBST(PDF_SURFACE_FEATURE)
7523 AC_SUBST(SVG_SURFACE_FEATURE)
7524 AC_SUBST(XLIB_SURFACE_FEATURE)
7525 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7526 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7527 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7528 AC_SUBST(XCB_SURFACE_FEATURE)
7529 AC_SUBST(WIN32_SURFACE_FEATURE)
7530 AC_SUBST(DDRAW_SURFACE_FEATURE)
7531 AC_SUBST(OGLES_SURFACE_FEATURE)
7532 AC_SUBST(OS2_SURFACE_FEATURE)
7533 AC_SUBST(BEOS_SURFACE_FEATURE)
7534 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7535 AC_SUBST(FT_FONT_FEATURE)
7536 AC_SUBST(FC_FONT_FEATURE)
7537 AC_SUBST(WIN32_FONT_FEATURE)
7538 AC_SUBST(QUARTZ_FONT_FEATURE)
7539 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7540 AC_SUBST(QT_SURFACE_FEATURE)
7542 if test "$_WIN32_MSVC"; then
7543 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7545 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"
7547 if test "$MOZ_X11"; then
7548 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7552 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7553 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7556 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7557 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7558 MOZ_CAIRO_LIBS=$CAIRO_LIBS
7559 if test "$MOZ_X11"; then
7560 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7561 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7562 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7566 AC_SUBST(MOZ_TREE_CAIRO)
7567 AC_SUBST(MOZ_CAIRO_CFLAGS)
7568 AC_SUBST(MOZ_CAIRO_LIBS)
7571 dnl ========================================================
7573 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
7576 dnl ========================================================
7578 dnl ========================================================
7579 MOZ_ARG_DISABLE_BOOL(xul,
7580 [ --disable-xul Disable XUL],
7582 if test "$MOZ_XUL"; then
7585 dnl remove extensions that require XUL
7586 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7591 dnl ========================================================
7592 dnl disable profile locking
7593 dnl do no use this in applications that can have more than
7594 dnl one process accessing the profile directory.
7595 dnl ========================================================
7596 MOZ_ARG_DISABLE_BOOL(profilelocking,
7597 [ --disable-profilelocking Disable profile locking],
7598 MOZ_PROFILELOCKING=,
7599 MOZ_PROFILELOCKING=1 )
7600 if test "$MOZ_PROFILELOCKING"; then
7601 AC_DEFINE(MOZ_PROFILELOCKING)
7604 dnl ========================================================
7605 dnl disable rdf services
7606 dnl ========================================================
7607 MOZ_ARG_DISABLE_BOOL(rdf,
7608 [ --disable-rdf Disable RDF],
7610 if test "$MOZ_RDF"; then
7616 dnl ========================================================
7617 dnl necko configuration options
7618 dnl ========================================================
7621 dnl option to disable various necko protocols
7623 MOZ_ARG_ENABLE_STRING(necko-protocols,
7624 [ --enable-necko-protocols[={http,ftp,default,all,none}]
7625 Enable/disable specific protocol handlers],
7626 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7627 if test "$option" = "yes" || test "$option" = "all"; then
7628 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7629 elif test "$option" = "no" || test "$option" = "none"; then
7631 elif test "$option" = "default"; then
7632 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7633 elif test `echo "$option" | grep -c \^-` != 0; then
7634 option=`echo $option | sed 's/^-//'`
7635 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7637 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7640 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7642 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7643 AC_SUBST(NECKO_PROTOCOLS)
7644 for p in $NECKO_PROTOCOLS; do
7645 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7649 dnl option to disable necko's disk cache
7651 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7652 [ --disable-necko-disk-cache
7653 Disable necko disk cache],
7656 AC_SUBST(NECKO_DISK_CACHE)
7657 if test "$NECKO_DISK_CACHE"; then
7658 AC_DEFINE(NECKO_DISK_CACHE)
7662 dnl option to disable necko's wifi scanner
7664 MOZ_ARG_DISABLE_BOOL(necko-wifi,
7665 [ --disable-necko-wifi Disable necko wifi scanner],
7670 if test "$OS_ARCH" = "OS2"; then
7671 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
7674 if test "$NECKO_WIFI" -a \
7675 "$OS_ARCH" != "Linux" -a \
7676 "$OS_ARCH" != "Darwin" -a \
7677 "$OS_ARCH" != "WINNT" -a \
7678 "$OS_ARCH" != "WINCE"; then
7679 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
7682 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
7684 AC_CHECK_HEADER([iwlib.h])
7685 if test "$ac_cv_header_iwlib_h" != "yes"; then
7686 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])
7690 if test "$NECKO_WIFI"; then
7691 AC_DEFINE(NECKO_WIFI)
7693 AC_SUBST(NECKO_WIFI)
7696 dnl option to minimize size of necko's i/o buffers
7698 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7699 [ --enable-necko-small-buffers
7700 Minimize size of necko's i/o buffers],
7701 NECKO_SMALL_BUFFERS=1,
7702 NECKO_SMALL_BUFFERS=)
7703 AC_SUBST(NECKO_SMALL_BUFFERS)
7704 if test "$NECKO_SMALL_BUFFERS"; then
7705 AC_DEFINE(NECKO_SMALL_BUFFERS)
7709 dnl option to disable cookies
7711 MOZ_ARG_DISABLE_BOOL(cookies,
7712 [ --disable-cookies Disable cookie support],
7715 AC_SUBST(NECKO_COOKIES)
7716 if test "$NECKO_COOKIES"; then
7717 AC_DEFINE(NECKO_COOKIES)
7721 dnl Build jsctypes on the platforms we can.
7723 AC_SUBST(BUILD_CTYPES)
7729 AC_DEFINE(BUILD_CTYPES)
7733 dnl NECKO_ configuration options are not global
7734 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7736 dnl Only build Mork if it's required
7738 if test "$MOZ_MORK"; then
7742 dnl Build the lightweight Mork reader if required
7743 AC_SUBST(MOZ_MORKREADER)
7744 if test "$MOZ_MORKREADER"; then
7745 AC_DEFINE(MOZ_MORKREADER)
7748 dnl ========================================================
7749 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7750 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7753 dnl ========================================================
7755 dnl = Maintainer debug option (no --enable equivalent)
7757 dnl ========================================================
7762 AC_SUBST(AR_EXTRACT)
7766 AC_SUBST(AS_DASH_C_FLAG)
7774 AC_SUBST(NS_USE_NATIVE)
7775 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7776 AC_SUBST(MOZ_UPDATE_XTERM)
7778 AC_SUBST(MOZ_PLATFORM_HILDON)
7780 AC_SUBST(NS_MAEMO_LOCATION)
7781 AC_SUBST(MOZ_AUTH_EXTENSION)
7782 AC_SUBST(MOZ_MATHML)
7783 AC_SUBST(MOZ_PERMISSIONS)
7785 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7786 AC_SUBST(MOZ_PREF_EXTENSIONS)
7789 AC_SUBST(MOZ_XSLT_STANDALONE)
7790 AC_SUBST(MOZ_JS_LIBS)
7793 AC_SUBST(MOZ_DEBUG_MODULES)
7794 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7795 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7796 AC_SUBST(MOZ_DEBUG_FLAGS)
7797 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7798 AC_SUBST(WARNINGS_AS_ERRORS)
7799 AC_SUBST(MOZ_DBGRINFO_MODULES)
7800 AC_SUBST(MOZ_EXTENSIONS)
7801 AC_SUBST(MOZ_IMG_DECODERS)
7802 AC_SUBST(MOZ_IMG_ENCODERS)
7803 AC_SUBST(MOZ_JSDEBUGGER)
7804 AC_SUBST(MOZ_PLUGINS)
7805 AC_SUBST(MOZ_LOG_REFCNT)
7809 AC_SUBST(MOZ_CALLGRIND)
7811 AC_SUBST(MOZ_XPCTOOLS)
7812 AC_SUBST(MOZ_JSLOADER)
7813 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7814 AC_SUBST(MOZ_INSURE)
7815 AC_SUBST(MOZ_INSURE_DIRS)
7816 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7817 AC_SUBST(MOZ_QUANTIFY)
7818 AC_SUBST(MOZ_INSURIFYING)
7820 AC_SUBST(MOZ_PLACES)
7821 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7822 AC_SUBST(MOZ_STORAGE)
7824 AC_SUBST(NS_PRINTING)
7827 AC_SUBST(MOZ_JAVAXPCOM)
7828 AC_SUBST(JAVA_INCLUDE_PATH)
7833 AC_SUBST(MOZ_PROFILELOCKING)
7836 AC_SUBST(MOZ_XIE_LIBS)
7837 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7839 AC_SUBST(BUILD_STATIC_LIBS)
7840 AC_SUBST(MOZ_ENABLE_LIBXUL)
7841 AC_SUBST(ENABLE_TESTS)
7843 AC_SUBST(MOZ_UNIVERSALCHARDET)
7844 AC_SUBST(ACCESSIBILITY)
7845 AC_SUBST(MOZ_XPINSTALL)
7846 AC_SUBST(MOZ_VIEW_SOURCE)
7847 AC_SUBST(MOZ_SPELLCHECK)
7848 AC_SUBST(MOZ_XPFE_COMPONENTS)
7849 AC_SUBST(MOZ_USER_DIR)
7850 AC_SUBST(MOZ_CRASHREPORTER)
7852 AC_SUBST(ENABLE_STRIP)
7853 AC_SUBST(PKG_SKIP_STRIP)
7854 AC_SUBST(USE_ELF_DYNSTR_GC)
7855 AC_SUBST(INCREMENTAL_LINKER)
7856 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7857 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7859 AC_SUBST(MOZ_FIX_LINK_PATHS)
7860 AC_SUBST(XPCOM_LIBS)
7861 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7862 AC_SUBST(XPCOM_GLUE_LDOPTS)
7863 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7865 AC_SUBST(USE_DEPENDENT_LIBS)
7867 AC_SUBST(MOZ_BUILD_ROOT)
7868 AC_SUBST(MOZ_OS2_TOOLS)
7869 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7871 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7872 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7873 AC_SUBST(MOZ_TIMELINE)
7874 AC_SUBST(OGLES_SDK_DIR)
7876 AC_SUBST(MOZ_APP_NAME)
7877 AC_SUBST(MOZ_APP_DISPLAYNAME)
7878 AC_SUBST(MOZ_APP_VERSION)
7879 AC_SUBST(MOZ_APP_UA_EXTRA)
7880 AC_SUBST(FIREFOX_VERSION)
7882 AC_SUBST(MOZ_PKG_SPECIAL)
7884 AC_SUBST(MOZILLA_OFFICIAL)
7887 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7888 AC_SUBST(MOZ_MAPINFO)
7889 AC_SUBST(MOZ_BROWSE_INFO)
7890 AC_SUBST(MOZ_TOOLS_DIR)
7891 AC_SUBST(CYGWIN_WRAPPER)
7893 AC_SUBST(WIN32_REDIST_DIR)
7897 AC_SUBST(WINCE_SDK_DIR)
7898 AC_SUBST(WINCE_WINDOWS_MOBILE)
7900 dnl Echo the CFLAGS to remove extra whitespace.
7907 $_MOZ_EXCEPTIONS_FLAGS \
7908 $_WARNINGS_CXXFLAGS \
7911 COMPILE_CFLAGS=`echo \
7916 COMPILE_CXXFLAGS=`echo \
7917 $_DEFINES_CXXFLAGS \
7921 AC_SUBST(SYSTEM_MAKEDEPEND)
7922 AC_SUBST(SYSTEM_LIBXUL)
7923 AC_SUBST(SYSTEM_JPEG)
7924 AC_SUBST(SYSTEM_PNG)
7925 AC_SUBST(SYSTEM_ZLIB)
7926 AC_SUBST(SYSTEM_BZ2)
7928 AC_SUBST(JPEG_CFLAGS)
7930 AC_SUBST(ZLIB_CFLAGS)
7932 AC_SUBST(BZ2_CFLAGS)
7934 AC_SUBST(PNG_CFLAGS)
7937 AC_SUBST(MOZ_JPEG_CFLAGS)
7938 AC_SUBST(MOZ_JPEG_LIBS)
7939 AC_SUBST(MOZ_ZLIB_CFLAGS)
7940 AC_SUBST(MOZ_ZLIB_LIBS)
7941 AC_SUBST(MOZ_BZ2_CFLAGS)
7942 AC_SUBST(MOZ_BZ2_LIBS)
7943 AC_SUBST(MOZ_PNG_CFLAGS)
7944 AC_SUBST(MOZ_PNG_LIBS)
7946 AC_SUBST(NSPR_CFLAGS)
7948 AC_SUBST(MOZ_NATIVE_NSPR)
7950 AC_SUBST(NSS_CFLAGS)
7952 AC_SUBST(NSS_DEP_LIBS)
7953 AC_SUBST(MOZ_NATIVE_NSS)
7954 AC_SUBST(NSS_DISABLE_DBM)
7959 AC_SUBST(COMPILE_CFLAGS)
7960 AC_SUBST(COMPILE_CXXFLAGS)
7963 AC_SUBST(CROSS_COMPILE)
7964 AC_SUBST(WCHAR_CFLAGS)
7968 AC_SUBST(HOST_CFLAGS)
7969 AC_SUBST(HOST_CXXFLAGS)
7970 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7972 AC_SUBST(HOST_AR_FLAGS)
7974 AC_SUBST(HOST_RANLIB)
7975 AC_SUBST(HOST_NSPR_MDCPUCFG)
7976 AC_SUBST(HOST_BIN_SUFFIX)
7977 AC_SUBST(HOST_OS_ARCH)
7979 AC_SUBST(TARGET_CPU)
7980 AC_SUBST(TARGET_VENDOR)
7982 AC_SUBST(TARGET_NSPR_MDCPUCFG)
7983 AC_SUBST(TARGET_MD_ARCH)
7984 AC_SUBST(TARGET_XPCOM_ABI)
7987 AC_SUBST(OS_RELEASE)
7990 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
7991 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
7993 AC_SUBST(WRAP_MALLOC_CFLAGS)
7994 AC_SUBST(WRAP_MALLOC_LIB)
7997 AC_SUBST(MKSHLIB_FORCE_ALL)
7998 AC_SUBST(MKSHLIB_UNFORCE_ALL)
7999 AC_SUBST(DSO_CFLAGS)
8000 AC_SUBST(DSO_PIC_CFLAGS)
8001 AC_SUBST(DSO_LDOPTS)
8002 AC_SUBST(LIB_PREFIX)
8003 AC_SUBST(DLL_PREFIX)
8004 AC_SUBST(DLL_SUFFIX)
8005 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8006 AC_SUBST(LIB_SUFFIX)
8007 AC_SUBST(OBJ_SUFFIX)
8008 AC_SUBST(BIN_SUFFIX)
8009 AC_SUBST(ASM_SUFFIX)
8010 AC_SUBST(IMPORT_LIB_SUFFIX)
8012 AC_SUBST(CC_VERSION)
8013 AC_SUBST(CXX_VERSION)
8014 AC_SUBST(MSMANIFEST_TOOL)
8015 AC_SUBST(NS_ENABLE_TSF)
8016 AC_SUBST(MOZ_NSS_PATCH)
8018 if test "$USING_HCC"; then
8019 CC='${topsrcdir}/build/hcc'
8021 CXX='${topsrcdir}/build/hcpp'
8022 CXX="$CXX '$_OLDCXX'"
8027 dnl Check for missing components
8028 if test "$COMPILE_ENVIRONMENT"; then
8029 if test "$MOZ_X11"; then
8030 dnl ====================================================
8031 dnl = Check if X headers exist
8032 dnl ====================================================
8033 _SAVE_CFLAGS=$CFLAGS
8034 CFLAGS="$CFLAGS $XCFLAGS"
8038 #include <X11/Xlib.h>
8039 #include <X11/Intrinsic.h>
8043 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8044 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8048 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8049 CFLAGS="$_SAVE_CFLAGS"
8051 if test ! -z "$MISSING_X"; then
8052 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8057 dnl Check for headers, etc. needed by WebGL.
8058 if test -n "$MOZ_WEBGL"; then
8059 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
8060 AC_CHECK_HEADER(GL/glx.h)
8061 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8062 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8066 fi # COMPILE_ENVIRONMENT
8068 dnl Set various defines and substitutions
8069 dnl ========================================================
8071 if test "$OS_ARCH" = "BeOS"; then
8074 elif test "$OS_ARCH" = "Darwin"; then
8076 AC_DEFINE(UNIX_ASYNC_DNS)
8078 elif test "$OS_ARCH" = "OpenVMS"; then
8080 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8082 AC_DEFINE(UNIX_ASYNC_DNS)
8085 AC_SUBST(MOZ_MOVEMAIL)
8087 if test "$MOZ_DEBUG"; then
8088 AC_DEFINE(MOZ_REFLOW_PERF)
8089 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8092 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8093 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8094 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8095 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8096 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8097 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8098 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8099 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8100 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8103 dnl ========================================================
8104 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8105 dnl ========================================================
8108 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8111 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8112 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8113 CC="\$(CYGWIN_WRAPPER) $CC"
8114 CXX="\$(CYGWIN_WRAPPER) $CXX"
8115 CPP="\$(CYGWIN_WRAPPER) $CPP"
8116 LD="\$(CYGWIN_WRAPPER) $LD"
8117 AS="\$(CYGWIN_WRAPPER) $AS"
8118 RC="\$(CYGWIN_WRAPPER) $RC"
8119 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8120 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8121 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8125 AC_SUBST(CYGDRIVE_MOUNT)
8126 AC_SUBST(WIN_TOP_SRC)
8128 AC_SUBST(MOZILLA_VERSION)
8130 AC_SUBST(ac_configure_args)
8132 dnl Spit out some output
8133 dnl ========================================================
8135 dnl The following defines are used by xpcom
8136 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8138 HAVE_CPP_2BYTE_WCHAR_T
8139 HAVE_CPP_ACCESS_CHANGING_USING
8140 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8143 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8145 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8146 HAVE_CPP_NAMESPACE_STD
8148 HAVE_CPP_PARTIAL_SPECIALIZATION
8149 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8151 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8153 NEED_CPP_UNUSED_IMPLEMENTATIONS
8157 HAVE_ICONV_WITH_CONST_INPUT
8165 netwerk/necko-config.h
8166 xpcom/xpcom-config.h
8167 xpcom/xpcom-private.h
8170 # Save the defines header file before autoconf removes it.
8171 # (Do not add AC_DEFINE calls after this line.)
8172 _CONFIG_TMP=confdefs-tmp.h
8173 _CONFIG_DEFS_H=mozilla-config.h
8175 cat > $_CONFIG_TMP <<\EOF
8176 /* List of defines generated by configure. Included with preprocessor flag,
8177 * -include, to avoid long list of -D defines on the compile command-line.
8181 #ifndef _MOZILLA_CONFIG_H_
8182 #define _MOZILLA_CONFIG_H_
8185 _EGREP_PATTERN='^#define ('
8186 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8187 for f in $_NON_GLOBAL_ACDEFINES; do
8188 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8191 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8193 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8195 cat >> $_CONFIG_TMP <<\EOF
8197 #endif /* _MOZILLA_CONFIG_H_ */
8201 # Only write mozilla-config.h when something changes (or it doesn't exist)
8202 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8205 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8206 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8208 echo ==== $_CONFIG_DEFS_H =================================
8212 dnl Probably shouldn't call this manually but we always want the output of DEFS
8213 rm -f confdefs.h.save
8214 mv confdefs.h confdefs.h.save
8215 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8216 AC_OUTPUT_MAKE_DEFS()
8218 AC_SUBST(MOZ_DEFINES)
8220 mv confdefs.h.save confdefs.h
8222 dnl Load the list of Makefiles to generate.
8223 dnl To add new Makefiles, edit allmakefiles.sh.
8224 dnl allmakefiles.sh sets the variable, MAKEFILES.
8225 . ${srcdir}/allmakefiles.sh
8227 dnl Run a perl script to quickly create the makefiles.
8228 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8229 dnl for the files it cannot handle correctly. This way, config.status
8230 dnl will handle these files.
8231 dnl If it fails, nothing is set and config.status will run as usual.
8233 dnl This does not change the $MAKEFILES variable.
8235 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8237 if test -z "${AS_PERL}"; then
8238 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8240 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8245 echo $MAKEFILES > unallmakefiles
8247 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8249 AC_OUTPUT($MAKEFILES)
8251 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8252 if test "$CAIRO_FEATURES_H"; then
8253 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8254 echo "$CAIRO_FEATURES_H is unchanged"
8255 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8257 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8261 dnl ========================================================
8262 dnl = Setup a nice relatively clean build environment for
8263 dnl = sub-configures.
8264 dnl ========================================================
8267 CFLAGS="$_SUBDIR_CFLAGS"
8268 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8269 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8270 LDFLAGS="$_SUBDIR_LDFLAGS"
8271 HOST_CC="$_SUBDIR_HOST_CC"
8272 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8273 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8279 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8280 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8282 if test -z "$MOZ_NATIVE_NSPR"; then
8283 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8284 if test -z "$MOZ_DEBUG"; then
8285 ac_configure_args="$ac_configure_args --disable-debug"
8287 if test "$MOZ_OPTIMIZE" = "1"; then
8288 ac_configure_args="$ac_configure_args --enable-optimize"
8290 if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8291 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8293 if test -n "$HAVE_64BIT_OS"; then
8294 ac_configure_args="$ac_configure_args --enable-64bit"
8296 if test -n "$USE_ARM_KUSER"; then
8297 ac_configure_args="$ac_configure_args --with-arm-kuser"
8299 AC_OUTPUT_SUBDIRS(nsprpub)
8300 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8303 if test -z "$MOZ_NATIVE_NSPR"; then
8304 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8305 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8306 if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8307 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8308 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8309 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8310 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8312 rm -f config/autoconf.mk.bak
8315 # Run the SpiderMonkey 'configure' script.
8316 dist=$MOZ_BUILD_ROOT/dist
8317 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8318 ac_configure_args="$ac_configure_args --enable-threadsafe"
8319 if test -z "$MOZ_NATIVE_NSPR"; then
8320 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8321 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8323 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8324 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8325 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8326 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8327 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8328 if test "$MOZ_MEMORY"; then
8329 ac_configure_args="$ac_configure_args --enable-jemalloc"
8330 if test -n "$MOZ_MEMORY_LDFLAGS"; then
8331 export MOZ_MEMORY_LDFLAGS
8334 AC_OUTPUT_SUBDIRS(js/src)
8335 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8337 # Build jsctypes on the platforms we can.
8338 if test "$BUILD_CTYPES"; then
8339 # Run the libffi 'configure' script on platforms that it supports.
8340 if test -z "$_MSC_VER"; then
8341 ac_configure_args="--disable-shared --enable-static --disable-raw-api"
8342 if test "$MOZ_DEBUG"; then
8343 ac_configure_args="$ac_configure_args --enable-debug"
8345 if test -n "$DSO_PIC_CFLAGS"; then
8346 ac_configure_args="$ac_configure_args --with-pic"
8348 if test -n "$CROSS_COMPILE"; then
8349 ac_configure_args="$ac_configure_args --build=$build --host=$target"
8351 AC_OUTPUT_SUBDIRS(js/ctypes/libffi)
8352 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8356 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8358 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8359 dnl Needs to be at the end to respect possible changes from NSPR configure
8360 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
8361 echo "config/autoconf.mk is unchanged"
8362 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8364 rm -f config/autoconf.mk.orig 2> /dev/null