1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
16 dnl The Original Code is this file as it was released upon August 6, 1998.
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
24 dnl Jamie Zawinski <jwz@jwz.org>
25 dnl gettimeofday args check
26 dnl Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl gnomefe update & enable-pthreads
28 dnl Ramiro Estrugo <ramiro@netscape.com>
29 dnl X11 makedepend support
31 dnl Henry Sobotka <sobotka@axess.com>
33 dnl Dan Mosedale <dmose@mozilla.org>
35 dnl Seth Spitzer <sspitzer@netscape.com>
37 dnl Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl Howard Chu <hyc@symas.com>
40 dnl Mark Mentovai <mark@moxienet.com>:
41 dnl Mac OS X 10.4 support
42 dnl Giorgio Maone <g.maone@informaction.com>
43 dnl MSVC l10n compatible version check
44 dnl Ben Turner <mozilla@songbirdnest.com>
46 dnl Alternatively, the contents of this file may be used under the terms of
47 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
48 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
49 dnl in which case the provisions of the GPL or the LGPL are applicable instead
50 dnl of those above. If you wish to allow use of your version of this file only
51 dnl under the terms of either the GPL or the LGPL, and not to allow others to
52 dnl use your version of this file under the terms of the MPL, indicate your
53 dnl decision by deleting the provisions above and replace them with the notice
54 dnl and other provisions required by the GPL or the LGPL. If you do not delete
55 dnl the provisions above, a recipient may use your version of this file under
56 dnl the terms of any one of the MPL, the GPL or the LGPL.
58 dnl ***** END LICENSE BLOCK *****
60 dnl Process this file with autoconf to produce a configure script.
61 dnl ========================================================
65 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
66 AC_CONFIG_HEADER(js-config.h)
68 TARGET_CPU="${target_cpu}"
69 TARGET_VENDOR="${target_vendor}"
70 TARGET_OS="${target_os}"
72 dnl ========================================================
74 dnl = Don't change the following two lines. Doing so breaks:
76 dnl = CFLAGS="-foo" ./configure
78 dnl ========================================================
80 CPPFLAGS="${CPPFLAGS=}"
81 CXXFLAGS="${CXXFLAGS=}"
83 HOST_CFLAGS="${HOST_CFLAGS=}"
84 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
85 HOST_LDFLAGS="${HOST_LDFLAGS=}"
87 dnl ========================================================
88 dnl = Preserve certain environment flags passed to configure
89 dnl = We want sub projects to receive the same flags
90 dnl = untainted by this configure script
91 dnl ========================================================
94 _SUBDIR_CFLAGS="$CFLAGS"
95 _SUBDIR_CPPFLAGS="$CPPFLAGS"
96 _SUBDIR_CXXFLAGS="$CXXFLAGS"
97 _SUBDIR_LDFLAGS="$LDFLAGS"
98 _SUBDIR_HOST_CC="$HOST_CC"
99 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
100 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
101 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
102 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
104 dnl Set the version number of the libs included with mozilla
105 dnl ========================================================
108 dnl Set the minimum version of toolkit libs used by mozilla
109 dnl ========================================================
112 WINDRES_VERSION=2.14.90
117 dnl Set various checks
118 dnl ========================================================
122 dnl Initialize the Pthread test variables early so they can be
123 dnl overridden by each platform.
124 dnl ========================================================
128 dnl Do not allow a separate objdir build if a srcdir build exists.
129 dnl ==============================================================
130 _topsrcdir=`cd \`dirname $0\`; pwd`
133 if test "$_topsrcdir" != "$_objdir"
135 # Check for a couple representative files in the source tree
137 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
138 if test -f $file; then
139 _conflict_files="$_conflict_files $file"
142 if test "$_conflict_files"; then
144 echo "* Your source tree contains these files:"
145 for file in $_conflict_files; do
149 * This indicates that you previously built in the source tree.
150 * A source tree build can confuse the separate objdir build.
152 * To clean up the source tree:
163 dnl Default to MSVC for win32
164 dnl ==============================================================
165 if test -z "$CROSS_COMPILE"; then
167 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
169 if test -z "$CC"; then CC=cl; fi
170 if test -z "$CXX"; then CXX=cl; fi
171 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
172 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
173 if test -z "$LD"; then LD=link; fi
174 if test -z "$AS"; then AS=ml; fi
175 if test -z "$MIDL"; then MIDL=midl; fi
180 COMPILE_ENVIRONMENT=1
181 MOZ_ARG_ENABLE_BOOL(compile-environment,
182 [ --disable-compile-environment
183 Disable compiler/library checks.],
184 COMPILE_ENVIRONMENT=1,
185 COMPILE_ENVIRONMENT= )
187 dnl ========================================================
188 dnl Checks for compilers.
189 dnl ========================================================
191 if test "$COMPILE_ENVIRONMENT"; then
193 if test "$target" != "$host"; then
194 echo "cross compiling from $host to $target"
197 _SAVE_CFLAGS="$CFLAGS"
198 _SAVE_LDFLAGS="$LDFLAGS"
200 AC_MSG_CHECKING([for host c compiler])
201 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
202 if test -z "$HOST_CC"; then
203 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
205 AC_MSG_RESULT([$HOST_CC])
206 AC_MSG_CHECKING([for host c++ compiler])
207 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
208 if test -z "$HOST_CXX"; then
209 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
211 AC_MSG_RESULT([$HOST_CXX])
213 if test -z "$HOST_CFLAGS"; then
214 HOST_CFLAGS="$CFLAGS"
216 if test -z "$HOST_CXXFLAGS"; then
217 HOST_CXXFLAGS="$CXXFLAGS"
219 if test -z "$HOST_LDFLAGS"; then
220 HOST_LDFLAGS="$LDFLAGS"
222 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
223 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
225 CFLAGS="$HOST_CFLAGS"
226 LDFLAGS="$HOST_LDFLAGS"
228 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
229 AC_TRY_COMPILE([], [return(0);],
230 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
231 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
234 CFLAGS="$HOST_CXXFLAGS"
236 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
237 AC_TRY_COMPILE([], [return(0);],
238 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
239 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
243 LDFLAGS=$_SAVE_LDFLAGS
245 case "$build:$target" in
246 powerpc-apple-darwin8*:i?86-apple-darwin*)
247 dnl The Darwin cross compiler doesn't necessarily point itself at a
248 dnl root that has libraries for the proper architecture, it defaults
249 dnl to the system root. The libraries in the system root on current
250 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
251 dnl checks will fail. Fake a working SDK in that case.
253 _SAVE_CXXFLAGS=$CXXLAGS
254 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
255 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
259 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
262 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
266 case "$build:$target" in
267 powerpc-apple-darwin8*:i?86-apple-darwin*)
268 dnl Revert the changes made above. From this point on, the target
269 dnl compiler will never be used without applying the SDK to CFLAGS
270 dnl (see --with-macos-sdk below).
272 CXXFLAGS=$_SAVE_CXXFLAGS
276 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
277 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
278 AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
279 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
280 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
281 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
282 AC_DEFINE(CROSS_COMPILE)
284 dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
285 dnl have erroneously been set to "no", because the x86 build host is
286 dnl able to run ppc code in a translated environment, making a cross
287 dnl compiler appear native. So we override that here.
293 AC_PATH_PROGS(AS, $AS as, $CC)
294 AC_CHECK_PROGS(AR, ar, :)
295 AC_CHECK_PROGS(LD, ld, :)
296 AC_CHECK_PROGS(STRIP, strip, :)
297 AC_CHECK_PROGS(WINDRES, windres, :)
298 if test -z "$HOST_CC"; then
301 if test -z "$HOST_CFLAGS"; then
302 HOST_CFLAGS="$CFLAGS"
304 if test -z "$HOST_CXX"; then
307 if test -z "$HOST_CXXFLAGS"; then
308 HOST_CXXFLAGS="$CXXFLAGS"
310 if test -z "$HOST_LDFLAGS"; then
311 HOST_LDFLAGS="$LDFLAGS"
313 if test -z "$HOST_RANLIB"; then
314 HOST_RANLIB="$RANLIB"
316 if test -z "$HOST_AR"; then
327 if test "$GCC" = "yes"; then
329 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
331 if test "$GXX" = "yes"; then
333 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
335 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
338 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
341 if test "$GNU_CC"; then
342 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
349 if test "$GCC" = yes; then
350 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
355 if test "$GXX" = yes; then
356 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
361 dnl Special win32 checks
362 dnl ========================================================
368 if test -n "$GNU_CC"; then
376 MOZ_ARG_WITH_STRING(windows-version,
377 [ --with-windows-version=WINVER
378 Minimum Windows version (WINVER) to support
389 AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
395 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
396 if test "$GCC" != "yes"; then
397 # Check to see if we are really running in a msvc environemnt
399 AC_CHECK_PROGS(MIDL, midl)
401 # Make sure compilers are valid
402 CFLAGS="$CFLAGS -TC -nologo"
403 CXXFLAGS="$CXXFLAGS -TP -nologo"
406 AC_TRY_COMPILE([#include <stdio.h>],
407 [ printf("Hello World\n"); ],,
408 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
411 AC_TRY_COMPILE([#include <new.h>],
412 [ unsigned *test = new unsigned(42); ],,
413 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
417 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
420 # Determine compiler version
421 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
422 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
423 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
424 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
425 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
426 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
428 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
429 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
431 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
432 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
434 if test "$_CC_MAJOR_VERSION" = "12"; then
436 elif test "$_CC_MAJOR_VERSION" = "13"; then
438 elif test "$_CC_MAJOR_VERSION" = "14"; then
440 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
441 dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
442 dnl so be very specific here!
443 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
444 if test $_CC_RELEASE -gt 50727; then
446 elif test $_CC_BUILD -ge 762; then
449 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
450 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
451 elif test "$_CC_MAJOR_VERSION" = "15"; then
453 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
454 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
456 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
457 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
459 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
462 _MOZ_RTTI_FLAGS_ON='-GR'
463 _MOZ_RTTI_FLAGS_OFF='-GR-'
464 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
465 _MOZ_EXCEPTIONS_FLAGS_OFF=''
467 if test -n "$WIN32_REDIST_DIR"; then
468 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
472 # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
473 if test "$_CC_SUITE" -ge "8"; then
475 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
478 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
479 if test -n "$MSMT_TOOL"; then
480 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
481 if test -z "$MSMANIFEST_TOOL_VERSION"; then
482 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
487 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
491 # Check linker version
492 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
493 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
494 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
495 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
500 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
501 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
502 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
503 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
504 # Add flags if necessary
505 AC_MSG_CHECKING([for midl flags])
506 if test \( "$_MIDL_MAJOR_VERSION" -gt "6" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" -gt "0" \) -o \( "$_MIDL_MAJOR_VERSION" = "6" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" -gt "359" \); then
507 # Starting with MIDL version 6.0.359, the MIDL compiler
508 # generates /Oicf /robust stubs by default, which is not
509 # compatible with versions of Windows older than Win2k.
510 # This switches us back to the old behaviour. When we drop
511 # support for Windows older than Win2k, we should remove
513 MIDL_FLAGS="${MIDL_FLAGS} -no_robust"
514 AC_MSG_RESULT([need -no_robust])
516 MIDL_FLAGS="${MIDL_FLAGS}"
517 AC_MSG_RESULT([none needed])
520 unset _MSVC_VER_FILTER
523 # Check w32api version
524 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
525 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
526 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
527 AC_TRY_COMPILE([#include <w32api.h>],
528 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
529 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
530 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
531 #error "test failed."
533 , [ res=yes ], [ res=no ])
534 AC_MSG_RESULT([$res])
535 if test "$res" != "yes"; then
536 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
538 # Check windres version
539 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
540 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
541 AC_MSG_RESULT([$_WINDRES_VERSION])
542 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
543 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
544 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
545 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
546 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
547 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
548 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
549 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
550 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
551 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
552 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
553 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
555 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
559 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
560 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
561 # Require OS features provided by IE 5.0
562 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
566 dnl Test breaks icc on OS/2 && MSVC
567 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
569 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
573 CC="${srcdir}/build/hcc '$CC'"
574 CXX="${srcdir}/build/hcpp '$CXX'"
581 if test -n "$_WIN32_MSVC"; then
583 SKIP_COMPILER_CHECKS=1
584 SKIP_LIBRARY_CHECKS=1
587 fi # COMPILE_ENVIRONMENT
589 if test "$cross_compiling" = "yes"; then
605 dnl ========================================================
606 dnl Checks for programs.
607 dnl ========================================================
610 AC_PATH_PROGS(PERL, $PERL perl5 perl )
611 if test -z "$PERL" || test "$PERL" = ":"; then
612 AC_MSG_ERROR([perl not found in \$PATH])
615 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
616 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
617 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
619 AC_MSG_RESULT([$_perl_version])
621 if test "$_perl_res" != 0; then
622 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
626 AC_MSG_CHECKING([for full perl installation])
627 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
629 if test "$_perl_res" != 0; then
631 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
636 AC_PATH_PROGS(PYTHON, $PYTHON python)
637 if test -z "$PYTHON"; then
638 AC_MSG_ERROR([python was not found in \$PATH])
641 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
642 if test -z "$COMPILE_ENVIRONMENT"; then
643 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
644 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
647 AC_SUBST(NSINSTALL_BIN)
649 AC_PATH_PROG(DOXYGEN, doxygen, :)
650 AC_PATH_PROG(WHOAMI, whoami, :)
651 AC_PATH_PROG(AUTOCONF, autoconf, :)
652 AC_PATH_PROG(UNZIP, unzip, :)
653 AC_PATH_PROGS(ZIP, zip)
654 if test -z "$ZIP" || test "$ZIP" = ":"; then
655 AC_MSG_ERROR([zip not found in \$PATH])
657 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
658 AC_PATH_PROG(XARGS, xargs)
659 if test -z "$XARGS" || test "$XARGS" = ":"; then
660 AC_MSG_ERROR([xargs not found in \$PATH .])
663 if test "$COMPILE_ENVIRONMENT"; then
665 dnl ========================================================
666 dnl = Mac OS X toolchain support
667 dnl ========================================================
671 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
672 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
673 dnl the environment and includedir purposes (when using an SDK, below),
674 dnl but remember the full version number for the libdir (SDK).
676 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
677 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
679 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
680 dnl Bug 280479, but this keeps popping up in bug 292530 too because
681 dnl 4.0.0/4061 is the default compiler in Tiger.
683 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
685 if test "$GCC_BUILD" = "4061" ; then
686 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
687 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
688 from building Mozilla. Upgrade to Xcode 2.1 or later.])
692 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
693 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
694 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
695 AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
700 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
702 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
708 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
709 dnl it has moved into /usr/bin.
710 AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
714 AC_SUBST(GCC_VERSION)
715 AC_SUBST(XCODEBUILD_VERSION)
716 AC_SUBST(HAS_XCODE_2_1)
718 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
719 dnl that a universal binary is being produced.
720 AC_SUBST(UNIVERSAL_BINARY)
722 dnl ========================================================
723 dnl Check for MacOS deployment target version
724 dnl ========================================================
726 MOZ_ARG_ENABLE_STRING(macos-target,
727 [ --enable-macos-target=VER (default=10.4)
728 Set the minimum MacOS version needed at runtime],
729 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
733 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
734 dnl Use the specified value
735 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
736 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
737 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
738 dnl No value specified on the command line or in the environment,
739 dnl use the lesser of the application's minimum or the architecture's
741 export MACOSX_DEPLOYMENT_TARGET=10.4
746 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
748 dnl ========================================================
749 dnl = Mac OS X SDK support
750 dnl ========================================================
753 MOZ_ARG_WITH_STRING(macos-sdk,
754 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
755 MACOS_SDK_DIR=$withval)
757 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
758 dnl NEXT_ROOT will be set and exported only if it's needed.
759 AC_SUBST(MACOS_SDK_DIR)
762 if test "$MACOS_SDK_DIR"; then
763 dnl Sync this section with the ones in NSPR and NSS.
764 dnl Changes to the cross environment here need to be accounted for in
765 dnl the libIDL checks (below) and xpidl build.
767 if test ! -d "$MACOS_SDK_DIR"; then
768 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
769 specify a valid SDK. SDKs are installed when the optional cross-development
770 tools are selected during the Xcode/Developer Tools installation.])
773 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
774 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
775 SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include -F${MACOS_SDK_DIR}/System/Library/Frameworks"
776 if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
777 SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
779 SDK_CXX_INCLUDE="-I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward"
781 CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
782 CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
784 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
785 CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
786 CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
788 dnl ld support for -syslibroot is compiler-agnostic, but only available
789 dnl on Tiger. Although it's possible to switch on the build host's
790 dnl OS release to use ld -syslibroot when available, ld -syslibroot will
791 dnl cause warnings as long as NEXT_ROOT is set. NEXT_ROOT should be
792 dnl set because both the compiler and linker use it.
793 LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
794 export NEXT_ROOT=$MACOS_SDK_DIR
796 if test -n "$CROSS_COMPILE" ; then
797 dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
798 dnl the build host. HOST_CXX is presently unused.
799 HOST_CC="NEXT_ROOT= $HOST_CC"
800 HOST_CXX="NEXT_ROOT= $HOST_CXX"
803 dnl gcc >= 4.0 uses different paths than above, but knows how to find
805 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
806 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
808 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
809 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
810 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
812 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
813 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
814 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
815 dnl be ignored and cause warnings when -syslibroot is specified.
816 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
817 dnl the -isysroot it receives, so this is only needed with 4.0.0.
818 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
823 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
825 AC_TRY_COMPILE([#include <new>
826 int main() { return 0; }],
830 AC_MSG_RESULT($result)
832 if test "$result" = "no" ; then
833 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
837 fi # COMPILE_ENVIRONMENT
839 dnl Be sure the make we use is GNU make.
840 dnl on win32, gmake.exe is the generally the wrong version
842 cygwin*|mingw*|mks*|msvc*)
843 AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
846 AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
849 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
850 if test ! "$_make_try"
853 echo "*** $MAKE is not GNU Make. You will not be able to build Mozilla without GNU Make."
857 dnl Now exit if version if < MAKE_VERSION
859 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
860 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
862 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
863 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
864 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
865 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
866 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
867 test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
868 "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
869 AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
873 if test "$COMPILE_ENVIRONMENT"; then
877 dnl Check in X11 include directory too.
878 if test "$no_x" != "yes"; then
879 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
884 fi # COMPILE_ENVIRONMENT
886 dnl ========================================================
887 dnl set the defaults first
888 dnl ========================================================
907 MOZ_USER_DIR=".mozilla"
909 HOST_AR_FLAGS='$(AR_FLAGS)'
911 MOZ_JS_LIBS='-L$(libdir) -lmozjs'
912 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib'
914 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
915 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
919 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
920 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
922 MOZ_ENABLE_POSTSCRIPT=1
924 if test -n "$CROSS_COMPILE"; then
925 OS_TARGET="${target_os}"
926 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
928 case "${target_os}" in
929 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
930 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
931 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
932 mingw*) OS_ARCH=WINNT ;;
933 wince*) OS_ARCH=WINCE ;;
934 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
938 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
939 OS_RELEASE=`uname -r`
942 # Before this used `uname -m` when not cross compiling
943 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
944 OS_TEST="${target_cpu}"
948 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
950 #######################################################################
951 # Master "Core Components" macros for getting the OS target #
952 #######################################################################
955 # Note: OS_TARGET should be specified on the command line for gmake.
956 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
957 # The difference between the Win95 target and the WinNT target is that
958 # the WinNT target uses Windows NT specific features not available
959 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
960 # at lesser performance (the Win95 target uses threads; the WinNT target
963 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
968 # The following hack allows one to build on a WIN95 machine (as if
969 # s/he were cross-compiling on a WINNT host for a WIN95 target).
970 # It also accomodates for MKS's uname.exe. If you never intend
971 # to do development on a WIN95 machine, you don't need this hack.
986 CYGWIN_9*|CYGWIN_ME*)
987 OS_ARCH='CYGWIN_NT-4.0'
993 # Define and override various archtecture-specific variables, including
1002 case "$HOST_OS_ARCH" in
1003 cygwin*|mingw*|mks*|msvc*)
1022 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1025 HOST_OS_ARCH=UNIXWARE
1037 HOST_OS_ARCH=OpenVMS
1047 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1051 HOST_OS_ARCH=UNIXWARE
1061 # If uname -s returns "Windows_NT", we assume that we are using
1062 # the uname.exe in MKS toolkit.
1064 # The -r option of MKS uname only returns the major version number.
1065 # So we need to use its -v option to get the minor version number.
1066 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1070 OS_MINOR_RELEASE=`uname -v`
1071 if test "$OS_MINOR_RELEASE" = "00"; then
1074 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1076 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1078 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1079 # the uname.exe in the Cygwin tools.
1080 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1081 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1082 # the uname.exe in the GNU-Win32 tools.
1083 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1084 # the uname.exe in the MSYS tools.
1086 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1091 OS_RELEASE=`uname -v`.`uname -r`
1092 OS_TEST=${target_cpu}
1104 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1108 OS_RELEASE=`uname -v`
1132 OS_RELEASE=`uname -v`
1138 OS_RELEASE=`uname -v`
1141 if test "$OS_TARGET" != "NTO"; then
1143 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1152 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1158 OS_RELEASE=`uname -v`
1166 case "${target_cpu}" in
1177 if test -z "$CROSS_COMPILE" ; then
1185 if test "$OS_ARCH" = "NCR"; then
1187 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1191 # Only set CPU_ARCH if we recognize the value of OS_TEST
1198 powerpc* | ppc | rs6000)
1202 Alpha | alpha | ALPHA)
1219 if test -z "$OS_TARGET"; then
1222 if test "$OS_TARGET" = "WIN95"; then
1225 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1227 dnl ========================================================
1228 dnl GNU specific defaults
1229 dnl ========================================================
1230 if test "$GNU_CC"; then
1231 # FIXME: Let us build with strict aliasing. bug 414641.
1232 CFLAGS="$CFLAGS -fno-strict-aliasing"
1233 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1234 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1235 DSO_LDOPTS='-shared'
1236 if test "$GCC_USE_GNU_LD"; then
1237 # Don't allow undefined symbols in libraries
1238 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1240 WARNINGS_AS_ERRORS='-Werror'
1242 DSO_PIC_CFLAGS='-fPIC'
1243 ASFLAGS="$ASFLAGS -fPIC"
1244 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1245 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1246 _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1247 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1249 # Turn on GNU specific features
1250 # -Wall - turn on all warnings
1251 # -pedantic - make compiler warn about non-ANSI stuff, and
1252 # be a little bit stricter
1253 # Warnings slamm took out for now (these were giving more noise than help):
1254 # -Wbad-function-cast - warns when casting a function to a new return type
1255 # -Wshadow - removed because it generates more noise than help --pete
1256 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1257 if test -z "$INTEL_CC"; then
1258 # Don't use -Wcast-align with ICC
1260 # And don't use it on hppa, ia64, sparc, since it's noisy there
1261 hppa | ia64 | sparc)
1264 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1269 dnl Turn pedantic on but disable the warnings for long long
1272 if test -z "$INTEL_CC"; then
1273 _IGNORE_LONG_LONG_WARNINGS=1
1274 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1276 _IGNORE_LONG_LONG_WARNINGS=
1280 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1281 _USE_CPP_INCLUDE_FLAG=1
1283 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1284 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1286 DSO_LDOPTS='-shared'
1287 if test "$GNU_LD"; then
1288 # Don't allow undefined symbols in libraries
1289 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1293 DSO_PIC_CFLAGS='-KPIC'
1294 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1297 if test "$GNU_CXX"; then
1298 # FIXME: Let us build with strict aliasing. bug 414641.
1299 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1300 # Turn on GNU specific features
1301 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1302 if test -z "$INTEL_CC"; then
1303 # Don't use -Wcast-align with ICC
1305 # And don't use it on hppa, ia64, sparc, since it's noisy there
1306 hppa | ia64 | sparc)
1309 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1314 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1315 _USE_CPP_INCLUDE_FLAG=1
1317 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1318 ac_has_wno_invalid_offsetof,
1322 _SAVE_CXXFLAGS="$CXXFLAGS"
1323 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1326 ac_has_wno_invalid_offsetof="yes",
1327 ac_has_wno_invalid_offsetof="no")
1328 CXXFLAGS="$_SAVE_CXXFLAGS"
1331 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1332 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1335 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1338 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1339 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1340 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1341 dnl normal behavior.
1342 dnl ========================================================
1344 MKSHLIB_UNFORCE_ALL=
1346 if test "$COMPILE_ENVIRONMENT"; then
1347 if test "$GNU_CC"; then
1348 AC_MSG_CHECKING(whether ld has archive extraction flags)
1349 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1350 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1351 ac_cv_mkshlib_force_and_unforce="no"
1352 exec 3<&0 <<LOOP_INPUT
1353 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1354 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1355 force="-Wl,-all"; unforce="-Wl,-none"
1362 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1365 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1367 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1371 eval $ac_cv_mkshlib_force_and_unforce
1372 MKSHLIB_FORCE_ALL=$force
1373 MKSHLIB_UNFORCE_ALL=$unforce
1376 fi # COMPILE_ENVIRONMENT
1378 dnl =================================================================
1379 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1380 dnl which is bad when cross compiling.
1381 dnl =================================================================
1382 if test "$COMPILE_ENVIRONMENT"; then
1383 configure_static_assert_macros='
1384 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1385 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1386 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1389 dnl test that the macros actually work:
1390 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1391 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1394 ac_cv_static_assertion_macros_work="yes"
1395 AC_TRY_COMPILE([$configure_static_assert_macros],
1396 [CONFIGURE_STATIC_ASSERT(1)],
1398 ac_cv_static_assertion_macros_work="no")
1399 AC_TRY_COMPILE([$configure_static_assert_macros],
1400 [CONFIGURE_STATIC_ASSERT(0)],
1401 ac_cv_static_assertion_macros_work="no",
1404 AC_TRY_COMPILE([$configure_static_assert_macros],
1405 [CONFIGURE_STATIC_ASSERT(1)],
1407 ac_cv_static_assertion_macros_work="no")
1408 AC_TRY_COMPILE([$configure_static_assert_macros],
1409 [CONFIGURE_STATIC_ASSERT(0)],
1410 ac_cv_static_assertion_macros_work="no",
1414 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1415 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1416 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1418 fi # COMPILE_ENVIRONMENT
1420 dnl ========================================================
1421 dnl Checking for 64-bit OS
1422 dnl ========================================================
1423 if test "$COMPILE_ENVIRONMENT"; then
1426 AC_MSG_CHECKING(for 64-bit OS)
1427 AC_TRY_COMPILE([$configure_static_assert_macros],
1428 [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1429 result="yes", result="no")
1430 AC_MSG_RESULT("$result")
1431 if test "$result" = "yes"; then
1432 AC_DEFINE(HAVE_64BIT_OS)
1435 AC_SUBST(HAVE_64BIT_OS)
1437 fi # COMPILE_ENVIRONMENT
1439 dnl ========================================================
1440 dnl Enable high-memory support on OS/2 by default.
1441 dnl ========================================================
1442 MOZ_OS2_HIGH_MEMORY=1
1443 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1444 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1445 MOZ_OS2_HIGH_MEMORY=,
1446 MOZ_OS2_HIGH_MEMORY=1 )
1447 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1449 dnl ========================================================
1450 dnl System overrides of the defaults for host
1451 dnl ========================================================
1454 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1455 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1456 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1459 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1460 if test -n "$_WIN32_MSVC"; then
1462 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1463 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1464 HOST_RANLIB='echo ranlib'
1466 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1468 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1469 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1470 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1471 HOST_BIN_SUFFIX=.exe
1474 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1477 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1478 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1480 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1482 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1484 PERL="${CYGWIN_WRAPPER} $PERL"
1487 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1488 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1495 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1496 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1497 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1498 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1499 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1502 *-linux*|*-kfreebsd*-gnu)
1503 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1504 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1505 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1509 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1510 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1511 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1512 HOST_BIN_SUFFIX=.exe
1517 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1518 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1519 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1523 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1524 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1528 dnl ========================================================
1529 dnl System overrides of the defaults for target
1530 dnl ========================================================
1535 if test ! "$GNU_CC"; then
1536 if test ! "$HAVE_64BIT_OS"; then
1537 # Compiling with Visual Age C++ object model compat is the
1538 # default. To compile with object model ibm, add
1539 # AIX_OBJMODEL=ibm to .mozconfig.
1540 if test "$AIX_OBJMODEL" = "ibm"; then
1541 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1548 AC_SUBST(AIX_OBJMODEL)
1549 DSO_LDOPTS='-qmkshrobj=1'
1550 DSO_CFLAGS='-qflag=w:w'
1552 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1553 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1555 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1556 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1557 if test "$COMPILE_ENVIRONMENT"; then
1560 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1562 [#if (__IBMCPP__ < 600)
1563 #error "Bad compiler"
1565 _BAD_COMPILER=,_BAD_COMPILER=1)
1566 if test -n "$_BAD_COMPILER"; then
1568 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1570 AC_MSG_RESULT([yes])
1573 TARGET_COMPILER_ABI="ibmc"
1574 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1575 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1578 case "${target_os}" in
1583 if test "$COMPILE_ENVIRONMENT"; then
1584 AC_CHECK_HEADERS(sys/inttypes.h)
1586 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1591 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1592 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1593 DSO_LDOPTS='-nostart'
1594 TK_LIBS='-lbe -lroot'
1596 if test "$COMPILE_ENVIRONMENT"; then
1597 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1598 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1600 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1601 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1604 MOZ_USER_DIR="Mozilla"
1608 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1610 _IGNORE_LONG_LONG_WARNINGS=
1618 _WARNINGS_CFLAGS="-Wall"
1619 _WARNINGS_CXXFLAGS="-Wall"
1620 # The test above doesn't work properly, at least on 3.1.
1621 MKSHLIB_FORCE_ALL=''
1622 MKSHLIB_UNFORCE_ALL=''
1628 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1629 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1630 MOZ_OPTIMIZE_FLAGS="-O2"
1632 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1633 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1636 STRIP="$STRIP -x -S"
1637 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1638 MOZ_ENABLE_POSTSCRIPT=
1639 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1640 LDFLAGS="$LDFLAGS -framework Cocoa"
1641 # The ExceptionHandling framework is needed for Objective-C exception
1642 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1644 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1645 # set MACOSX to generate lib/mac/MoreFiles/Makefile
1648 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1649 dnl ===================================================================
1650 if test "x$enable_dtrace" = "xyes"; then
1651 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1653 dnl check for the presence of the -dead_strip linker flag
1654 AC_MSG_CHECKING([for -dead_strip option to ld])
1655 _SAVE_LDFLAGS=$LDFLAGS
1656 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1657 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1658 if test -n "$_HAVE_DEAD_STRIP" ; then
1659 AC_MSG_RESULT([yes])
1660 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1665 LDFLAGS=$_SAVE_LDFLAGS
1670 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1671 DLL_SUFFIX=".so.1.0"
1672 DSO_LDOPTS="-shared"
1674 if test ! "$GNU_CC"; then
1675 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1677 # Can't have force w/o an unforce.
1678 # # Hack for FreeBSD 2.2
1679 # if test -z "$MKSHLIB_FORCE_ALL"; then
1680 # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1681 # MKSHLIB_UNFORCE_ALL=''
1687 if test ! "$GNU_CC"; then
1688 DSO_LDOPTS='-b -Wl,+s'
1691 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1692 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1693 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1695 DSO_LDOPTS='-b -E +s'
1696 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1697 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1699 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1700 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1705 DSO_LDOPTS='-elf -shared'
1707 if test "$GNU_CC"; then
1708 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1709 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1710 MKSHLIB_FORCE_ALL='-Wl,-all'
1711 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1712 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1714 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1715 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1716 MKSHLIB_FORCE_ALL='-all'
1717 MKSHLIB_UNFORCE_ALL='-none'
1723 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1724 dnl compile and link using -n32
1726 TARGET_COMPILER_ABI=n32
1727 DSO_LDOPTS='-elf -shared'
1728 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1729 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1730 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1731 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1732 if test "$GNU_CC"; then
1733 MKSHLIB_FORCE_ALL='-Wl,-all'
1734 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1735 _WARNINGS_CFLAGS="-Wall"
1736 _WARNINGS_CXXFLAGS="-Wall"
1737 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1739 MKSHLIB_FORCE_ALL='-all'
1740 MKSHLIB_UNFORCE_ALL='-none'
1746 CFLAGS="$CFLAGS -woff 3262 -G 4"
1747 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1748 if test -n "$USE_N32"; then
1749 ASFLAGS="$ASFLAGS -n32"
1750 CFLAGS="$CFLAGS -n32"
1751 CXXFLAGS="$CXXFLAGS -n32"
1752 LDFLAGS="$LDFLAGS -n32"
1754 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1755 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1758 if test -z "$GNU_CXX"; then
1764 # Note: both GNU_CXX and INTEL_CXX are set when using Intel's C compiler.
1765 if test "$INTEL_CXX"; then
1766 # -Os has been broken on Intel's C/C++ compilers for quite a
1767 # while; Intel recommends against using it.
1768 MOZ_OPTIMIZE_FLAGS="-O2"
1769 MOZ_DEBUG_FLAGS="-g -fno-inline"
1770 elif test "$GNU_CXX"; then
1771 GCC_VERSION=`$CXX -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1772 case $GCC_VERSION in
1774 # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1775 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1777 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1778 MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb,
1779 # and that combo is not yet good at
1780 # debugging inlined functions (even
1781 # when using DWARF2 as the debugging
1785 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1787 case "${target_cpu}" in
1789 CFLAGS="$CFLAGS -mieee"
1790 CXXFLAGS="$CXXFLAGS -mieee"
1793 MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1796 MOZ_DEBUG_FLAGS="-g" # We want inlining
1803 MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1805 AR_EXTRACT="$AR -extract"
1807 AR_FLAGS='-OUT:"$@"'
1809 if test -z "$AS_BIN"; then
1816 if test -z "$RC"; then
1819 # certain versions of cygwin's makedepend barf on the
1820 # #include <string> vs -I./dist/include/string issue so don't use it
1826 HOST_AR='lib -OUT:$@'
1827 HOST_RANLIB='echo ranlib'
1828 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1831 WARNINGS_AS_ERRORS='-WX'
1832 MOZ_OPTIMIZE_FLAGS='-O1'
1833 AR_FLAGS='-NOLOGO -OUT:"$@"'
1835 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1836 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1839 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1840 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1842 IMPORT_LIB_SUFFIX=lib
1844 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1847 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1848 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1850 MKSHLIB_UNFORCE_ALL=
1851 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1852 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1853 MOZ_DEBUG_FLAGS='-Zi'
1854 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1856 MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1857 MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1859 RANLIB='echo not_ranlib'
1860 STRIP='echo not_strip'
1861 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1864 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1868 AC_DEFINE(HAVE_SNPRINTF)
1874 AC_DEFINE(HW_THREADS)
1875 AC_DEFINE(STDC_HEADERS)
1876 AC_DEFINE(NEW_H, <new>)
1877 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1879 TARGET_MD_ARCH=win32
1880 _PLATFORM_DEFAULT_TOOLKIT='windows'
1883 MOZ_ENABLE_POSTSCRIPT=
1884 MOZ_USER_DIR="Mozilla"
1888 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1893 # certain versions of cygwin's makedepend barf on the
1894 # #include <string> vs -I./dist/include/string issue so don't use it
1896 if test -n "$GNU_CC"; then
1897 CC="$CC -mno-cygwin"
1898 CXX="$CXX -mno-cygwin"
1899 CPP="$CPP -mno-cygwin"
1900 CFLAGS="$CFLAGS -mms-bitfields"
1901 CXXFLAGS="$CXXFLAGS -mms-bitfields"
1902 DSO_LDOPTS='-shared'
1903 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1904 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1906 # Use temp file for windres (bug 213281)
1907 RCFLAGS='-O coff --use-temp-file'
1908 # mingw doesn't require kernel32, user32, and advapi32 explicitly
1909 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1910 MOZ_JS_LIBS='-L$(libdir) -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1912 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1913 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1915 IMPORT_LIB_SUFFIX=dll.a
1917 TARGET_COMPILER_ABI=msvc
1921 AR='lib -NOLOGO -OUT:"$@"'
1923 RANLIB='echo not_ranlib'
1924 STRIP='echo not_strip'
1929 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1934 IMPORT_LIB_SUFFIX=lib
1935 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1936 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1938 MKSHLIB_UNFORCE_ALL=
1939 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1940 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1941 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1942 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1943 MOZ_DEBUG_FLAGS='-Zi'
1944 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1945 WARNINGS_AS_ERRORS='-WX'
1946 MOZ_OPTIMIZE_FLAGS='-O1'
1947 MOZ_JS_LIBS='$(libdir)/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1949 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1950 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1951 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1952 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1953 MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1954 if test $_MSC_VER -ge 1400; then
1955 LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
1956 dnl For profile-guided optimization
1957 PROFILE_GEN_CFLAGS="-GL"
1958 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1959 dnl XXX: PGO builds can fail with warnings treated as errors,
1960 dnl specifically "no profile data available" appears to be
1961 dnl treated as an error sometimes. This might be a consequence
1962 dnl of using WARNINGS_AS_ERRORS in some modules, combined
1963 dnl with the linker doing most of the work in the whole-program
1964 dnl optimization/PGO case. I think it's probably a compiler bug,
1965 dnl but we work around it here.
1966 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1967 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1968 dnl Probably also a compiler bug, but what can you do?
1969 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1970 if test -n "$_USE_DYNAMICBASE"; then
1971 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1975 AC_DEFINE(HAVE_SNPRINTF)
1981 AC_DEFINE(HW_THREADS)
1982 AC_DEFINE(STDC_HEADERS)
1983 AC_DEFINE(NEW_H, <new>)
1984 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1985 TARGET_MD_ARCH=win32
1986 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
1989 MOZ_ENABLE_POSTSCRIPT=
1990 MOZ_USER_DIR="Mozilla"
1992 dnl Hardcode to win95 for now - cls
1993 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
1995 dnl set NO_X11 defines here as the general check is skipped on win32
1999 dnl MinGW/MSYS doesn't provide or need cygpath
2004 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2006 *-cygwin*|*-msvc*|*-mks*)
2007 CYGPATH_W="cygpath -a -w"
2008 CYGPATH_S="sed -e s|\\\\|/|g"
2009 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2013 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2015 if test -z "$MOZ_TOOLS"; then
2016 AC_MSG_ERROR([MOZ_TOOLS is not set])
2019 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2020 if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2021 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2023 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2024 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2026 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2033 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])
2037 AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2041 AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2057 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2064 CFLAGS="$CFLAGS -Dunix"
2065 CXXFLAGS="$CXXFLAGS -Dunix"
2066 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2068 DSO_PIC_CFLAGS='-fPIC -DPIC'
2069 DSO_LDOPTS='-shared'
2070 BIN_FLAGS='-Wl,--export-dynamic'
2072 DSO_PIC_CFLAGS='-fPIC -DPIC'
2073 DLL_SUFFIX=".so.1.0"
2074 DSO_LDOPTS='-shared'
2076 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2077 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2078 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2079 if test "$LIBRUNPATH"; then
2080 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2082 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2083 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2088 AC_DEFINE(_QNX_SOURCE)
2091 WARNINGS_AS_ERRORS=''
2092 MOZ_OPTIMIZE_FLAGS="-O"
2093 MOZ_DEBUG_FLAGS="-gstabs"
2096 LIBS="$LIBS -lsocket -lstdc++"
2097 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2098 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2099 if test "$with_x" != "yes"
2101 _PLATFORM_DEFAULT_TOOLKIT="photon"
2102 TK_CFLAGS='-I/usr/include/photon'
2105 case "${target_cpu}" in
2107 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2113 DLL_SUFFIX=".so.1.0"
2115 DSO_PIC_CFLAGS='-fPIC'
2116 DSO_LDOPTS='-shared -fPIC'
2117 if test "$LIBRUNPATH"; then
2118 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2123 AC_DEFINE(NO_PW_GECOS)
2124 AC_DEFINE(NO_UDSOCK)
2125 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2127 MKSHLIB_FORCE_ALL='-all'
2128 MKSHLIB_UNFORCE_ALL='-none'
2130 AS_DASH_C_FLAG='-Wc/names=as_is'
2132 DSO_LDOPTS='-shared -auto_symvec'
2134 MOZ_DEBUG_LDFLAGS='-g'
2136 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2137 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2142 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2143 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2146 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2147 AC_DEFINE(TCPV40HDRS)
2154 IMPORT_LIB_SUFFIX=lib
2158 CFLAGS="$CFLAGS -Zomf"
2159 CXXFLAGS="$CXXFLAGS -Zomf"
2161 BIN_FLAGS='-Zlinker /ST:0x100000'
2165 WARNINGS_AS_ERRORS='-Werror'
2166 MOZ_DEBUG_FLAGS="-g -fno-inline"
2167 MOZ_OPTIMIZE_FLAGS="-O2"
2168 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2169 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2170 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2171 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2173 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2174 MOZ_ENABLE_POSTSCRIPT=
2177 MOZ_USER_DIR="Mozilla"
2179 if test "$MOZTOOLS"; then
2180 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2182 AC_MSG_ERROR([MOZTOOLS is not set])
2184 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2185 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2186 LDFLAGS="$LDFLAGS -Zhigh-mem"
2187 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2188 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2191 # GCC for OS/2 currently predefines these, but we don't want them
2192 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2193 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2195 AC_CACHE_CHECK(for __declspec(dllexport),
2197 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2199 ac_os2_declspec="yes",
2200 ac_os2_declspec="no")])
2201 if test "$ac_os2_declspec" = "yes"; then
2203 MOZ_OS2_USE_DECLSPEC='1'
2208 if test "$GNU_CC"; then
2209 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2210 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2213 MOZ_DEBUG_FLAGS='-g'
2214 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2215 CFLAGS="$CFLAGS -ieee"
2216 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2217 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2220 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2221 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2222 MKSHLIB_FORCE_ALL='-all'
2223 MKSHLIB_UNFORCE_ALL='-none'
2224 dnl Might fix the libxpcom.so breakage on this platform as well....
2225 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2226 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2228 if test -z "$GNU_CXX"; then
2231 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2235 DIRENT_INO=d_stat.st_ino
2236 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2237 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2238 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2239 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2240 AC_DEFINE(STDC_HEADERS)
2241 if test "$no_x" = "yes"; then
2242 _PLATFORM_DEFAULT_TOOLKIT='photon'
2243 TK_CFLAGS='-I/usr/nto/include/photon'
2244 TK_LIBS='-lphoton -lphrender'
2249 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2250 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2251 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2252 if test ! "$GNU_CC"; then
2257 dnl the qsort routine under solaris is faulty
2260 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2262 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2263 # libraries one level up (e.g. libnspr4.so)
2264 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2265 LIBS="-lCrun -lCstd $LIBS"
2266 if test -z "$GNU_CC"; then
2269 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2271 if test "$CPU_ARCH" != "sparc"; then
2272 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2273 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2275 # Do not use -xbuiltin on SPARC to get around a bug of compiler
2276 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2277 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2280 LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2281 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2282 _SAVE_LDFLAGS=$LDFLAGS
2283 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2284 AC_TRY_LINK([#include <stdio.h>],
2285 [printf("Hello World\n");],
2287 [LDFLAGS=$_SAVE_LDFLAGS])
2289 WARNINGS_AS_ERRORS='-Werror'
2290 MOZ_OPTIMIZE_FLAGS="-xO4"
2291 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2292 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2293 MKSHLIB_FORCE_ALL='-z allextract'
2294 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2295 DSO_LDOPTS='-G -z muldefs'
2301 AS='/usr/ccs/bin/as'
2302 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2304 TARGET_COMPILER_ABI="sunc"
2305 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2306 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2307 AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2311 [#if (__SUNPRO_CC < 0x530)
2314 _BAD_COMPILER=,_BAD_COMPILER=1)
2315 if test -n "$_BAD_COMPILER"; then
2317 AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2321 AC_MSG_RESULT([$_res])
2324 ASFLAGS="$ASFLAGS -fPIC"
2327 _WARNINGS_CXXFLAGS=''
2328 if test "$OS_RELEASE" = "5.3"; then
2329 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2332 if test "$OS_RELEASE" = "5.5.1"; then
2333 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2338 DSO_LDOPTS='-Bdynamic'
2339 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2340 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2342 AC_DEFINE(SPRINTF_RETURNS_STRING)
2343 case "$(target_os)" in
2345 DLL_SUFFIX='.so.1.0'
2351 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2355 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2360 dnl Only one oddball right now (QNX), but this gives us flexibility
2361 dnl if any other platforms need to override this in the future.
2362 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2364 dnl ========================================================
2365 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2366 dnl by now will not have any way to link most binaries (tests
2367 dnl as well as viewer, apprunner, etc.), because some symbols
2368 dnl will be left out of the "composite" .so's by ld as unneeded.
2369 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2370 dnl they can link in the static libs that provide the missing
2372 dnl ========================================================
2373 NO_LD_ARCHIVE_FLAGS=
2374 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2375 NO_LD_ARCHIVE_FLAGS=1
2379 NO_LD_ARCHIVE_FLAGS=
2382 NO_LD_ARCHIVE_FLAGS=
2385 NO_LD_ARCHIVE_FLAGS=
2387 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2388 if test -z "$GNU_CC"; then
2389 NO_LD_ARCHIVE_FLAGS=
2393 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2396 dnl Indicate that platform requires special thread safe
2397 dnl locking when starting up the OJI JVM
2398 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2399 dnl ========================================================
2402 AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2406 dnl ========================================================
2407 dnl = Flags to strip unused symbols from .so components
2408 dnl ========================================================
2410 *-linux*|*-kfreebsd*-gnu)
2411 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2414 if test -z "$GNU_CC"; then
2415 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2417 if test -z "$GCC_USE_GNU_LD"; then
2418 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2420 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2425 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2428 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2430 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2431 if test -n "$GNU_CC"; then
2432 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2437 if test -z "$COMPILE_ENVIRONMENT"; then
2438 SKIP_COMPILER_CHECKS=1
2439 SKIP_LIBRARY_CHECKS=1
2442 if test -z "$SKIP_COMPILER_CHECKS"; then
2443 dnl Checks for typedefs, structures, and compiler characteristics.
2444 dnl ========================================================
2452 AC_STRUCT_ST_BLKSIZE
2453 AC_MSG_CHECKING(for siginfo_t)
2454 AC_CACHE_VAL(ac_cv_siginfo_t,
2455 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2456 #include <signal.h>],
2458 [ac_cv_siginfo_t=true],
2459 [ac_cv_siginfo_t=false])])
2460 if test "$ac_cv_siginfo_t" = true ; then
2461 AC_DEFINE(HAVE_SIGINFO_T)
2467 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2468 dnl ========================================================
2469 AC_MSG_CHECKING(for int16_t)
2470 AC_CACHE_VAL(ac_cv_int16_t,
2471 [AC_TRY_COMPILE([#include <stdio.h>
2472 #include <sys/types.h>],
2474 [ac_cv_int16_t=true],
2475 [ac_cv_int16_t=false])])
2476 if test "$ac_cv_int16_t" = true ; then
2477 AC_DEFINE(HAVE_INT16_T)
2482 AC_MSG_CHECKING(for int32_t)
2483 AC_CACHE_VAL(ac_cv_int32_t,
2484 [AC_TRY_COMPILE([#include <stdio.h>
2485 #include <sys/types.h>],
2487 [ac_cv_int32_t=true],
2488 [ac_cv_int32_t=false])])
2489 if test "$ac_cv_int32_t" = true ; then
2490 AC_DEFINE(HAVE_INT32_T)
2495 AC_MSG_CHECKING(for int64_t)
2496 AC_CACHE_VAL(ac_cv_int64_t,
2497 [AC_TRY_COMPILE([#include <stdio.h>
2498 #include <sys/types.h>],
2500 [ac_cv_int64_t=true],
2501 [ac_cv_int64_t=false])])
2502 if test "$ac_cv_int64_t" = true ; then
2503 AC_DEFINE(HAVE_INT64_T)
2508 AC_MSG_CHECKING(for int64)
2509 AC_CACHE_VAL(ac_cv_int64,
2510 [AC_TRY_COMPILE([#include <stdio.h>
2511 #include <sys/types.h>],
2514 [ac_cv_int64=false])])
2515 if test "$ac_cv_int64" = true ; then
2516 AC_DEFINE(HAVE_INT64)
2521 AC_MSG_CHECKING(for uint)
2522 AC_CACHE_VAL(ac_cv_uint,
2523 [AC_TRY_COMPILE([#include <stdio.h>
2524 #include <sys/types.h>],
2527 [ac_cv_uint=false])])
2528 if test "$ac_cv_uint" = true ; then
2529 AC_DEFINE(HAVE_UINT)
2534 AC_MSG_CHECKING(for uint_t)
2535 AC_CACHE_VAL(ac_cv_uint_t,
2536 [AC_TRY_COMPILE([#include <stdio.h>
2537 #include <sys/types.h>],
2539 [ac_cv_uint_t=true],
2540 [ac_cv_uint_t=false])])
2541 if test "$ac_cv_uint_t" = true ; then
2542 AC_DEFINE(HAVE_UINT_T)
2547 AC_MSG_CHECKING(for uint16_t)
2548 AC_CACHE_VAL(ac_cv_uint16_t,
2549 [AC_TRY_COMPILE([#include <stdio.h>
2550 #include <sys/types.h>],
2551 [uint16_t foo = 0;],
2552 [ac_cv_uint16_t=true],
2553 [ac_cv_uint16_t=false])])
2554 if test "$ac_cv_uint16_t" = true ; then
2555 AC_DEFINE(HAVE_UINT16_T)
2561 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2562 dnl are defined when compiling C++ but not C. Since the result of this
2563 dnl test is used only in C++, do it in C++.
2566 AC_MSG_CHECKING(for uname.domainname)
2567 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2568 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2569 [ struct utsname *res; char *domain;
2570 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2571 [ac_cv_have_uname_domainname_field=true],
2572 [ac_cv_have_uname_domainname_field=false])])
2574 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2575 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2581 AC_MSG_CHECKING(for uname.__domainname)
2582 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2583 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2584 [ struct utsname *res; char *domain;
2585 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2586 [ac_cv_have_uname_us_domainname_field=true],
2587 [ac_cv_have_uname_us_domainname_field=false])])
2589 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2590 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2598 dnl Check for usable wchar_t (2 bytes, unsigned)
2599 dnl (we really don't need the unsignedness check anymore)
2600 dnl ========================================================
2602 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2603 ac_cv_have_usable_wchar_v2,
2604 [AC_TRY_COMPILE([#include <stddef.h>
2605 $configure_static_assert_macros],
2606 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2607 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2608 ac_cv_have_usable_wchar_v2="yes",
2609 ac_cv_have_usable_wchar_v2="no")])
2610 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2611 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2612 HAVE_CPP_2BYTE_WCHAR_T=1
2614 dnl This is really gcc-only
2615 dnl Do this test using CXX only since some versions of gcc
2616 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2617 dnl only have short-wchar support for c++.
2618 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2622 _SAVE_CXXFLAGS=$CXXFLAGS
2623 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2625 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2626 ac_cv_have_usable_wchar_option_v2,
2627 [AC_TRY_LINK([#include <stddef.h>
2628 $configure_static_assert_macros],
2629 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2630 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2631 ac_cv_have_usable_wchar_option_v2="yes",
2632 ac_cv_have_usable_wchar_option_v2="no")])
2634 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2635 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2636 HAVE_CPP_2BYTE_WCHAR_T=1
2637 WCHAR_CFLAGS="-fshort-wchar"
2639 CXXFLAGS=$_SAVE_CXXFLAGS
2644 dnl Check for .hidden assembler directive and visibility attribute.
2645 dnl Borrowed from glibc configure.in
2646 dnl ===============================================================
2647 if test "$GNU_CC"; then
2648 AC_CACHE_CHECK(for visibility(hidden) attribute,
2649 ac_cv_visibility_hidden,
2650 [cat > conftest.c <<EOF
2651 int foo __attribute__ ((visibility ("hidden"))) = 1;
2653 ac_cv_visibility_hidden=no
2654 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2655 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2656 ac_cv_visibility_hidden=yes
2661 if test "$ac_cv_visibility_hidden" = "yes"; then
2662 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2664 AC_CACHE_CHECK(for visibility(default) attribute,
2665 ac_cv_visibility_default,
2666 [cat > conftest.c <<EOF
2667 int foo __attribute__ ((visibility ("default"))) = 1;
2669 ac_cv_visibility_default=no
2670 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2671 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2672 ac_cv_visibility_default=yes
2677 if test "$ac_cv_visibility_default" = "yes"; then
2678 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2680 AC_CACHE_CHECK(for visibility pragma support,
2681 ac_cv_visibility_pragma,
2682 [cat > conftest.c <<EOF
2683 #pragma GCC visibility push(hidden)
2685 #pragma GCC visibility push(default)
2686 int foo_default = 1;
2688 ac_cv_visibility_pragma=no
2689 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2690 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2691 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2692 ac_cv_visibility_pragma=yes
2698 if test "$ac_cv_visibility_pragma" = "yes"; then
2699 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2700 ac_cv_have_visibility_class_bug,
2701 [cat > conftest.c <<EOF
2702 #pragma GCC visibility push(hidden)
2703 struct __attribute__ ((visibility ("default"))) TestStruct {
2706 __attribute__ ((visibility ("default"))) void TestFunc() {
2710 ac_cv_have_visibility_class_bug=no
2711 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2712 ac_cv_have_visibility_class_bug=yes
2714 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2715 ac_cv_have_visibility_class_bug=yes
2718 rm -rf conftest.{c,S}
2721 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2722 ac_cv_have_visibility_builtin_bug,
2723 [cat > conftest.c <<EOF
2724 #pragma GCC visibility push(hidden)
2725 #pragma GCC visibility push(default)
2727 #pragma GCC visibility pop
2729 __attribute__ ((visibility ("default"))) void Func() {
2731 memset(c, 0, sizeof(c));
2734 ac_cv_have_visibility_builtin_bug=no
2735 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2736 ac_cv_have_visibility_builtin_bug=yes
2738 if test `grep -c "@PLT" conftest.S` = 0; then
2739 ac_cv_visibility_builtin_bug=yes
2742 rm -f conftest.{c,S}
2744 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2745 "$ac_cv_have_visibility_class_bug" = "no"; then
2746 VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2747 WRAP_SYSTEM_INCLUDES=1
2749 VISIBILITY_FLAGS='-fvisibility=hidden'
2750 fi # have visibility pragma bug
2751 fi # have visibility pragma
2752 fi # have visibility(default) attribute
2753 fi # have visibility(hidden) attribute
2756 # visibility hidden flag for Sun Studio on Solaris
2757 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
2758 VISIBILITY_FLAGS='-xldscope=hidden'
2759 fi # Sun Studio on Solaris
2761 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2762 AC_SUBST(VISIBILITY_FLAGS)
2764 dnl Checks for header files.
2765 dnl ========================================================
2767 case "$target_os" in
2769 # for stuff like -lXshm
2770 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2773 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2774 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2775 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2776 AC_CHECK_HEADERS(malloc.h)
2777 AC_CHECK_HEADERS(X11/XKBlib.h)
2779 dnl These are all the places some variant of statfs can be hiding.
2780 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2782 dnl Try for MMX support
2783 dnl NB - later gcc versions require -mmmx for this header to be successfully
2784 dnl included (or another option which implies it, such as -march=pentium-mmx)
2785 AC_CHECK_HEADERS(mmintrin.h)
2787 AC_MSG_CHECKING(for ARM SIMD support)
2789 [asm("uqadd8 r1, r1, r2");],
2790 result="yes", result="no")
2791 AC_MSG_RESULT("$result")
2792 if test "$result" = "yes"; then
2793 AC_DEFINE(HAVE_ARM_SIMD)
2796 AC_SUBST(HAVE_ARM_SIMD)
2798 dnl Check whether the compiler supports the new-style C++ standard
2799 dnl library headers (i.e. <new>) or needs the old "new.h"
2802 AC_CHECK_HEADER(new, [NEW_H=new])
2803 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2806 AC_ARG_ENABLE(dtrace,
2807 [ --enable-dtrace build with dtrace support if available (default=no)],
2808 [enable_dtrace="yes"],)
2809 if test "x$enable_dtrace" = "xyes"; then
2810 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2811 if test -n "$HAVE_DTRACE"; then
2812 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2814 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2817 AC_SUBST(HAVE_DTRACE)
2823 AC_CHECK_HEADERS(sys/cdefs.h)
2827 dnl Checks for libraries.
2828 dnl ========================================================
2833 AC_CHECK_LIB(c_r, gethostbyname_r)
2837 dnl We don't want to link with libdl even if it's present on OS X, since
2838 dnl it's not used and not part of the default installation.
2839 dnl The same goes for BeOS.
2840 dnl We don't want to link against libm or libpthread on Darwin since
2841 dnl they both are just symlinks to libSystem and explicitly linking
2842 dnl against libSystem causes issues when debugging (see bug 299601).
2849 AC_CHECK_LIB(m, atan)
2850 AC_CHECK_LIB(dl, dlopen,
2851 AC_CHECK_HEADER(dlfcn.h,
2853 AC_DEFINE(HAVE_LIBDL)))
2857 _SAVE_CFLAGS="$CFLAGS"
2858 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2859 AC_CHECK_FUNCS(dladdr)
2860 CFLAGS="$_SAVE_CFLAGS"
2862 if test ! "$GNU_CXX"; then
2866 AC_CHECK_LIB(C_r, demangle)
2869 AC_CHECK_LIB(C, demangle)
2873 AC_CHECK_LIB(socket, socket)
2875 dnl Enable VFP support on ARM
2876 MOZ_ARG_DISABLE_BOOL(arm-vfp,
2877 [ --disable-arm-vfp Disable ARM VFP instructions in JavaScript JIT],
2878 MOZ_ARM_VFP=, MOZ_ARM_VFP=1, MOZ_ARM_VFP=1)
2879 if test "$MOZ_ARM_VFP"; then
2880 AC_DEFINE(NJ_ARM_VFP)
2883 dnl ========================================================
2884 dnl = pthread support
2885 dnl = Start by checking whether the system support pthreads
2886 dnl ========================================================
2887 case "$target_os" in
2892 MOZ_CHECK_PTHREADS(pthreads,
2893 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2894 MOZ_CHECK_PTHREADS(pthread,
2895 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2896 MOZ_CHECK_PTHREADS(c_r,
2897 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2898 MOZ_CHECK_PTHREADS(c,
2907 dnl ========================================================
2908 dnl Check the command line for --with-pthreads
2909 dnl ========================================================
2910 MOZ_ARG_WITH_BOOL(pthreads,
2911 [ --with-pthreads Force use of system pthread library with NSPR ],
2912 [ if test "$USE_PTHREADS"x = x; then
2913 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2919 dnl ========================================================
2920 dnl Do the platform specific pthread hackery
2921 dnl ========================================================
2922 if test "$USE_PTHREADS"x != x
2925 dnl See if -pthread is supported.
2928 ac_cv_have_dash_pthread=no
2929 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2930 echo 'int main() { return 0; }' | cat > conftest.c
2931 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2932 if test $? -eq 0; then
2933 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2934 ac_cv_have_dash_pthread=yes
2935 case "$target_os" in
2937 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2940 CFLAGS="$CFLAGS -pthread"
2941 CXXFLAGS="$CXXFLAGS -pthread"
2947 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2950 dnl See if -pthreads is supported.
2952 ac_cv_have_dash_pthreads=no
2953 if test "$ac_cv_have_dash_pthread" = "no"; then
2954 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2955 echo 'int main() { return 0; }' | cat > conftest.c
2956 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2957 if test $? -eq 0; then
2958 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2959 ac_cv_have_dash_pthreads=yes
2960 CFLAGS="$CFLAGS -pthreads"
2961 CXXFLAGS="$CXXFLAGS -pthreads"
2965 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2970 AC_DEFINE(_REENTRANT)
2971 AC_DEFINE(_THREAD_SAFE)
2972 dnl -pthread links in -lc_r, so don't specify it explicitly.
2973 if test "$ac_cv_have_dash_pthread" = "yes"; then
2974 _PTHREAD_LDFLAGS="-pthread"
2976 _PTHREAD_LDFLAGS="-lc_r"
2980 *-*-openbsd*|*-*-bsdi*)
2981 AC_DEFINE(_REENTRANT)
2982 AC_DEFINE(_THREAD_SAFE)
2983 dnl -pthread links in -lc_r, so don't specify it explicitly.
2984 if test "$ac_cv_have_dash_pthread" = "yes"; then
2985 _PTHREAD_LDFLAGS="-pthread"
2989 *-*-linux*|*-*-kfreebsd*-gnu)
2990 AC_DEFINE(_REENTRANT)
2994 AC_DEFINE(_REENTRANT)
2998 AC_DEFINE(_REENTRANT)
3002 AC_DEFINE(_REENTRANT)
3006 AC_DEFINE(_REENTRANT)
3010 AC_DEFINE(_REENTRANT)
3011 if test ! "$GNU_CC"; then
3012 CFLAGS="$CFLAGS -mt"
3013 CXXFLAGS="$CXXFLAGS -mt"
3017 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3020 dnl ========================================================
3021 dnl See if mmap sees writes
3022 dnl For cross compiling, just define it as no, which is a safe default
3023 dnl ========================================================
3024 AC_MSG_CHECKING(whether mmap() sees write()s)
3030 #include <sys/mman.h>
3031 #include <sys/types.h>
3032 #include <sys/stat.h>
3035 char fname[] = "conftest.file";
3036 char zbuff[1024]; /* Fractional page is probably worst case */
3043 fd = open(fname, O_RDWR | O_CREAT, 0660);
3046 write(fd, zbuff, sizeof(zbuff));
3047 lseek(fd, 0, SEEK_SET);
3048 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3049 if(map==(char*)-1) return 2;
3050 for(i=0; fname[i]; i++) {
3051 int rc = write(fd, &fname[i], 1);
3052 if(map[i]!=fname[i]) return 4;
3059 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3061 AC_MSG_RESULT("$result")
3063 if test "$result" = "no"; then
3064 AC_DEFINE(MMAP_MISSES_WRITES)
3068 dnl Checks for library functions.
3069 dnl ========================================================
3070 AC_PROG_GCC_TRADITIONAL
3072 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3073 AC_CHECK_FUNCS(flockfile getpagesize)
3075 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3076 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3077 AC_CHECK_FUNCS(localtime_r strtok_r)
3080 dnl check for wcrtomb/mbrtowc
3081 dnl =======================================================================
3082 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3085 AC_CACHE_CHECK(for wcrtomb,
3087 [AC_TRY_LINK([#include <wchar.h>],
3088 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3089 ac_cv_have_wcrtomb="yes",
3090 ac_cv_have_wcrtomb="no")])
3091 if test "$ac_cv_have_wcrtomb" = "yes"; then
3092 AC_DEFINE(HAVE_WCRTOMB)
3094 AC_CACHE_CHECK(for mbrtowc,
3096 [AC_TRY_LINK([#include <wchar.h>],
3097 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3098 ac_cv_have_mbrtowc="yes",
3099 ac_cv_have_mbrtowc="no")])
3100 if test "$ac_cv_have_mbrtowc" = "yes"; then
3101 AC_DEFINE(HAVE_MBRTOWC)
3108 ac_cv_func_res_ninit,
3111 #define _BSD_SOURCE 1
3115 [int foo = res_ninit(&_res);],
3116 [ac_cv_func_res_ninit=yes],
3117 [ac_cv_func_res_ninit=no])
3120 if test "$ac_cv_func_res_ninit" = "yes"; then
3121 AC_DEFINE(HAVE_RES_NINIT)
3122 dnl must add the link line we do something as foolish as this... dougt
3124 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3125 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3130 [for gnu_get_libc_version()],
3131 ac_cv_func_gnu_get_libc_version,
3133 #ifdef HAVE_GNU_LIBC_VERSION_H
3134 #include <gnu/libc-version.h>
3137 [const char *glibc_version = gnu_get_libc_version();],
3138 [ac_cv_func_gnu_get_libc_version=yes],
3139 [ac_cv_func_gnu_get_libc_version=no]
3143 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3144 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3148 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3152 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3153 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3154 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3156 LIBS="$LIBS $_ICONV_LIBS"
3165 iconv_t h = iconv_open("", "");
3166 iconv(h, NULL, NULL, NULL, NULL);
3169 [ac_cv_func_iconv=yes],
3170 [ac_cv_func_iconv=no]
3173 if test "$ac_cv_func_iconv" = "yes"; then
3174 AC_DEFINE(HAVE_ICONV)
3175 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3176 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3177 LIBICONV="$_ICONV_LIBS"
3179 [for iconv() with const input],
3180 ac_cv_func_const_iconv,
3186 const char *input = "testing";
3187 iconv_t h = iconv_open("", "");
3188 iconv(h, &input, NULL, NULL, NULL);
3191 [ac_cv_func_const_iconv=yes],
3192 [ac_cv_func_const_iconv=no]
3195 if test "$ac_cv_func_const_iconv" = "yes"; then
3196 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3206 dnl **********************
3207 dnl *** va_copy checks ***
3208 dnl **********************
3209 dnl we currently check for all three va_copy possibilities, so we get
3210 dnl all results in config.log for bug reports.
3211 AC_MSG_CHECKING(for an implementation of va_copy())
3212 AC_CACHE_VAL(ac_cv_va_copy,[
3215 void f (int i, ...) {
3216 va_list args1, args2;
3217 va_start (args1, i);
3218 va_copy (args2, args1);
3219 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3221 va_end (args1); va_end (args2);
3223 int main() { f (0, 42); return 0; }],
3229 AC_MSG_RESULT($ac_cv_va_copy)
3230 AC_MSG_CHECKING(for an implementation of __va_copy())
3231 AC_CACHE_VAL(ac_cv___va_copy,[
3234 void f (int i, ...) {
3235 va_list args1, args2;
3236 va_start (args1, i);
3237 __va_copy (args2, args1);
3238 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3240 va_end (args1); va_end (args2);
3242 int main() { f (0, 42); return 0; }],
3243 ac_cv___va_copy=yes,
3248 AC_MSG_RESULT($ac_cv___va_copy)
3249 AC_MSG_CHECKING(whether va_lists can be copied by value)
3250 AC_CACHE_VAL(ac_cv_va_val_copy,[
3253 void f (int i, ...) {
3254 va_list args1, args2;
3255 va_start (args1, i);
3257 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3259 va_end (args1); va_end (args2);
3261 int main() { f (0, 42); return 0; }],
3262 ac_cv_va_val_copy=yes,
3263 ac_cv_va_val_copy=no,
3264 ac_cv_va_val_copy=yes
3267 if test "x$ac_cv_va_copy" = "xyes"; then
3268 AC_DEFINE(VA_COPY, va_copy)
3269 AC_DEFINE(HAVE_VA_COPY)
3270 elif test "x$ac_cv___va_copy" = "xyes"; then
3271 AC_DEFINE(VA_COPY, __va_copy)
3272 AC_DEFINE(HAVE_VA_COPY)
3275 if test "x$ac_cv_va_val_copy" = "xno"; then
3276 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3278 AC_MSG_RESULT($ac_cv_va_val_copy)
3280 dnl Check for dll-challenged libc's.
3281 dnl This check is apparently only needed for Linux.
3284 dnl ===================================================================
3287 rm -rf conftest* _conftest
3289 cat >> conftest.C <<\EOF
3294 void __dump_link_map(void) {
3295 struct link_map *map = _dl_loaded;
3296 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3299 dlopen("./conftest1.so",RTLD_LAZY);
3300 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3301 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3302 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3306 /* _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).*/
3307 int main() { printf("./conftest1.so\n"); }
3311 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3313 cat >> conftest1.C <<\EOF
3315 void foo(void) {printf("foo in dll called\n");}
3317 ${CXX-g++} -fPIC -c -g conftest1.C
3318 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3319 ${CXX-g++} -g conftest.C -o conftest -ldl
3320 cp -f conftest1.so conftest _conftest
3322 if test `./conftest | grep conftest1.so | wc -l` -gt 1
3325 echo "*** Your libc has a bug that can result in loading the same dynamic"
3326 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
3327 echo "*** or later. However, if you choose not to upgrade, the only effect"
3328 echo "*** will be excessive memory usage at runtime."
3332 rm -rf conftest* _conftest
3333 dnl ===================================================================
3337 dnl ===================================================================
3338 dnl ========================================================
3339 dnl By default, turn rtti and exceptions off on g++/egcs
3340 dnl ========================================================
3341 if test "$GNU_CXX"; then
3343 AC_MSG_CHECKING(for C++ exceptions flag)
3345 dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3346 AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3347 [echo "int main() { return 0; }" | cat > conftest.C
3349 ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3351 if egrep "warning.*renamed" conftest.out >/dev/null; then
3352 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3354 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3359 AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3360 _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3361 _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3364 dnl ========================================================
3365 dnl Put your C++ language/feature checks below
3366 dnl ========================================================
3370 if test "$GNU_CC"; then
3371 AC_CACHE_CHECK(for gcc 3.0 ABI,
3372 ac_cv_gcc_three_abi,
3375 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3381 ac_cv_gcc_three_abi="yes",
3382 ac_cv_gcc_three_abi="no")])
3383 if test "$ac_cv_gcc_three_abi" = "yes"; then
3384 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3387 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3390 AC_SUBST(HAVE_GCC3_ABI)
3393 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3395 [AC_TRY_COMPILE(class X {
3396 public: explicit X(int i) : i_(i) {}
3400 ac_cv_cpp_explicit=yes,
3401 ac_cv_cpp_explicit=no)])
3402 if test "$ac_cv_cpp_explicit" = yes ; then
3403 AC_DEFINE(HAVE_CPP_EXPLICIT)
3406 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3408 [AC_TRY_COMPILE(class param {
3410 typedef unsigned long num_type;
3413 template <class T> class tplt {
3415 typedef typename T::num_type t_num_type;
3416 t_num_type foo(typename T::num_type num) {
3422 ac_cv_cpp_typename=yes,
3423 ac_cv_cpp_typename=no)])
3424 if test "$ac_cv_cpp_typename" = yes ; then
3425 AC_DEFINE(HAVE_CPP_TYPENAME)
3428 dnl Check for support of modern template specialization syntax
3429 dnl Test code and requirement from scc@netscape.com.
3430 dnl Autoconf cut-and-paste job by waterson@netscape.com
3431 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3432 ac_cv_cpp_modern_specialize_template_syntax,
3433 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3435 template <> struct X<Y> { double a; };,
3438 ac_cv_cpp_modern_specialize_template_syntax=yes,
3439 ac_cv_cpp_modern_specialize_template_syntax=no)])
3440 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3441 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3445 dnl Some compilers support only full specialization, and some don't.
3446 AC_CACHE_CHECK(whether partial template specialization works,
3447 ac_cv_cpp_partial_specialization,
3448 [AC_TRY_COMPILE(template <class T> class Foo {};
3449 template <class T> class Foo<T*> {};,
3451 ac_cv_cpp_partial_specialization=yes,
3452 ac_cv_cpp_partial_specialization=no)])
3453 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3454 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3457 dnl Some compilers have limited support for operators with templates;
3458 dnl specifically, it is necessary to define derived operators when a base
3459 dnl class's operator declaration should suffice.
3460 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3461 ac_cv_need_derived_template_operators,
3462 [AC_TRY_COMPILE([template <class T> class Base { };
3464 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3465 template <class T> class Derived : public Base<T> { };],
3466 [Derived<char> a, b;
3467 Base<char> c = a + b;
3469 ac_cv_need_derived_template_operators=no,
3470 ac_cv_need_derived_template_operators=yes)])
3471 if test "$ac_cv_need_derived_template_operators" = yes ; then
3472 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3476 dnl Some compilers have trouble detecting that a template class
3477 dnl that derives from another template is actually an instance
3478 dnl of the base class. This test checks for that.
3479 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3480 ac_cv_need_cpp_template_cast_to_base,
3481 [AC_TRY_COMPILE([template <class T> class Base { };
3482 template <class T> class Derived : public Base<T> { };
3483 template <class T> int foo(const Base<T>&) { return 0; }],
3484 [Derived<char> bar; return foo(bar);],
3485 ac_cv_need_cpp_template_cast_to_base=no,
3486 ac_cv_need_cpp_template_cast_to_base=yes)])
3487 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3488 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3491 dnl Some compilers have trouble resolving the ambiguity between two
3492 dnl functions whose arguments differ only by cv-qualifications.
3493 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3494 ac_cv_can_resolve_const_ambiguity,
3496 template <class T> class ptrClass {
3500 template <class T> T* a(ptrClass<T> *arg) {
3505 const T* a(const ptrClass<T> *arg) {
3511 ac_cv_can_resolve_const_ambiguity=yes,
3512 ac_cv_can_resolve_const_ambiguity=no)])
3513 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3514 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3518 dnl We don't do exceptions on unix. The only reason this used to be here
3519 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
3520 dnl exceptions. But, we turn exceptions off by default and this test breaks.
3521 dnl So im commenting this out until someone writes some artificial
3522 dnl intelligence to detect not only if the compiler has exceptions, but if
3523 dnl they are enabled as well.
3525 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3526 dnl ac_cv_cpp_exceptions,
3527 dnl [AC_TRY_COMPILE(class X { public: X() {} };
3528 dnl static void F() { throw X(); },
3529 dnl try { F(); } catch(X & e) { },
3530 dnl ac_cv_cpp_exceptions=yes,
3531 dnl ac_cv_cpp_exceptions=no)])
3532 dnl if test $ac_cv_cpp_exceptions = yes ; then
3533 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3536 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3537 dnl supports it well enough to allow us to use it to change access, but not
3538 dnl to resolve ambiguity. The next two tests determine how well the |using|
3539 dnl keyword is supported.
3541 dnl Check to see if we can change access with |using|. Test both a
3542 dnl legal and an illegal example.
3543 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3544 ac_cv_cpp_access_changing_using2,
3546 class A { protected: int foo() { return 0; } };
3547 class B : public A { public: using A::foo; };,
3548 B b; return b.foo();,
3550 class A { public: int foo() { return 1; } };
3551 class B : public A { private: using A::foo; };,
3552 B b; return b.foo();,
3553 ac_cv_cpp_access_changing_using2=no,
3554 ac_cv_cpp_access_changing_using2=yes)],
3555 ac_cv_cpp_access_changing_using2=no)])
3556 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3557 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3560 dnl Check to see if we can resolve ambiguity with |using|.
3561 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3562 ac_cv_cpp_ambiguity_resolving_using,
3563 [AC_TRY_COMPILE(class X {
3564 public: int go(const X&) {return 3;}
3565 int jo(const X&) {return 3;}
3567 class Y : public X {
3568 public: int go(int) {return 2;}
3569 int jo(int) {return 2;}
3571 private: using X::go;
3574 ac_cv_cpp_ambiguity_resolving_using=yes,
3575 ac_cv_cpp_ambiguity_resolving_using=no)])
3576 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3577 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3580 dnl Check to see if the |std| namespace is supported. If so, we'll want
3581 dnl to qualify any standard library calls with "std::" to ensure that
3582 dnl those functions can be resolved.
3583 AC_CACHE_CHECK(for \"std::\" namespace,
3584 ac_cv_cpp_namespace_std,
3585 [AC_TRY_COMPILE([#include <algorithm>],
3586 [return std::min(0, 1);],
3587 ac_cv_cpp_namespace_std=yes,
3588 ac_cv_cpp_namespace_std=no)])
3589 if test "$ac_cv_cpp_namespace_std" = yes ; then
3590 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3593 dnl Older compilers are overly ambitious with respect to using the standard
3594 dnl template library's |operator!=()| when |operator==()| is defined. In
3595 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3596 dnl ambiguity at compile-time. This test checks for that case.
3597 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3598 ac_cv_cpp_unambiguous_std_notequal,
3599 [AC_TRY_COMPILE([#include <algorithm>
3601 int operator==(const T1&, const T1&) { return 0; }
3602 int operator!=(const T1&, const T1&) { return 0; }],
3603 [T1 a,b; return a != b;],
3604 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3605 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3606 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3607 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3611 AC_CACHE_CHECK(for C++ reinterpret_cast,
3612 ac_cv_cpp_reinterpret_cast,
3613 [AC_TRY_COMPILE(struct X { int i; };
3614 struct Y { int i; };,
3615 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3616 ac_cv_cpp_reinterpret_cast=yes,
3617 ac_cv_cpp_reinterpret_cast=no)])
3618 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3619 AC_DEFINE(HAVE_CPP_NEW_CASTS)
3622 dnl See if a dynamic_cast to void* gives the most derived object.
3623 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3624 ac_cv_cpp_dynamic_cast_void_ptr,
3625 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3626 class Y { int j; public: virtual ~Y() { } };
3627 class Z : public X, public Y { int k; };
3633 return !((((void*)&mdo != (void*)subx) &&
3634 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3635 (((void*)&mdo != (void*)suby) &&
3636 ((void*)&mdo == dynamic_cast<void*>(suby))));
3638 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3639 ac_cv_cpp_dynamic_cast_void_ptr=no,
3640 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3641 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3642 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3646 dnl note that this one is reversed - if the test fails, then
3647 dnl we require implementations of unused virtual methods. Which
3648 dnl really blows because it means we'll have useless vtable
3650 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3651 ac_cv_cpp_unused_required,
3652 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3654 ac_cv_cpp_unused_required=no,
3655 ac_cv_cpp_unused_required=yes)])
3656 if test "$ac_cv_cpp_unused_required" = yes ; then
3657 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3661 dnl Some compilers have trouble comparing a constant reference to a templatized
3662 dnl class to zero, and require an explicit operator==() to be defined that takes
3663 dnl an int. This test separates the strong from the weak.
3665 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3666 ac_cv_trouble_comparing_to_zero,
3667 [AC_TRY_COMPILE([#include <algorithm>
3668 template <class T> class Foo {};
3670 template <class T> int operator==(const T2*, const T&) { return 0; }
3671 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3672 [Foo<int> f; return (0 != f);],
3673 ac_cv_trouble_comparing_to_zero=no,
3674 ac_cv_trouble_comparing_to_zero=yes)])
3675 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3676 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3681 dnl End of C++ language/feature checks
3684 dnl ========================================================
3685 dnl = Internationalization checks
3686 dnl ========================================================
3688 dnl Internationalization and Locale support is different
3689 dnl on various UNIX platforms. Checks for specific i18n
3690 dnl features go here.
3692 dnl check for LC_MESSAGES
3693 AC_CACHE_CHECK(for LC_MESSAGES,
3694 ac_cv_i18n_lc_messages,
3695 [AC_TRY_COMPILE([#include <locale.h>],
3696 [int category = LC_MESSAGES;],
3697 ac_cv_i18n_lc_messages=yes,
3698 ac_cv_i18n_lc_messages=no)])
3699 if test "$ac_cv_i18n_lc_messages" = yes; then
3700 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3703 fi # SKIP_COMPILER_CHECKS
3706 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3707 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3710 dnl Mozilla specific options
3711 dnl ========================================================
3712 dnl The macros used for command line options
3713 dnl are defined in build/autoconf/altoptions.m4.
3716 dnl ========================================================
3718 dnl = Check for external package dependencies
3720 dnl ========================================================
3721 MOZ_ARG_HEADER(External Packages)
3723 dnl ========================================================
3724 dnl = Find the right NSPR to use.
3725 dnl ========================================================
3726 MOZ_ARG_WITH_BOOL(system-nspr,
3727 [ --with-system-nspr Use an NSPR that is already built and installed.
3728 Use the 'nspr-config' script in the current path,
3729 or look for the script in the directories given with
3730 --with-nspr-exec-prefix or --with-nspr-prefix.],
3731 _USE_SYSTEM_NSPR=1 )
3733 MOZ_ARG_WITH_STRING(nspr-cflags,
3734 [ --with-nspr-cflags=FLAGS Pass FLAGS to CC when building code that uses NSPR.
3735 Use this when there's no accurate nspr-config
3736 script available. This is the case when building
3737 SpiderMonkey as part of the Mozilla tree: the
3738 top-level configure script computes NSPR flags
3739 that accomodate the quirks of that environment.],
3740 NSPR_CFLAGS=$withval)
3741 MOZ_ARG_WITH_STRING(nspr-libs,
3742 [ --with-nspr-libs=LIBS Pass LIBS to LD when linking code that uses NSPR.
3743 See --with-nspr-cflags for more details.],
3745 AC_SUBST(NSPR_CFLAGS)
3748 dnl Pass either --with-system-nspr or (--with-nspr-cflags and
3749 dnl --with-nspr-libs), but not both.
3750 if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" || test "$NSPR_LIBS"); then
3751 AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
3752 See 'configure --help'.])
3755 if test -n "$_USE_SYSTEM_NSPR"; then
3757 AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1])
3758 if test -z "$MOZ_NATIVE_NSPR"; then
3759 AC_MSG_ERROR([--with-system-nspr given, but configure could not find a suitable NSPR.
3760 Pass --with-nspr-exec-prefix, --with-nspr-prefix, or --with-nspr-cflags/libs.
3761 See 'configure --help'.])
3765 if test -n "$MOZ_NATIVE_NSPR"; then
3766 _SAVE_CFLAGS=$CFLAGS
3767 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3768 AC_TRY_COMPILE([#include "prlog.h"],
3769 [#ifndef PR_STATIC_ASSERT
3770 #error PR_STATIC_ASSERT not defined
3772 [MOZ_NATIVE_NSPR=1],
3773 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
3774 CFLAGS=$_SAVE_CFLAGS
3777 dnl ========================================================
3778 dnl Use ARM userspace kernel helpers; tell NSPR to enable
3779 dnl their usage and use them in spidermonkey.
3780 dnl ========================================================
3781 MOZ_ARG_WITH_BOOL(arm-kuser,
3782 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
3785 if test -n "$USE_ARM_KUSER"; then
3786 AC_DEFINE(USE_ARM_KUSER)
3789 dnl ========================================================
3793 dnl ========================================================
3795 MOZ_ARG_HEADER(Application)
3799 MOZ_DBGRINFO_MODULES=
3802 dnl ========================================================
3804 dnl = Components & Features
3806 dnl ========================================================
3807 MOZ_ARG_HEADER(Components and Features)
3809 dnl ========================================================
3811 dnl ========================================================
3812 MOZ_ARG_ENABLE_STRING(ui-locale,
3813 [ --enable-ui-locale=ab-CD
3814 Select the user interface locale (default: en-US)],
3815 MOZ_UI_LOCALE=$enableval )
3816 AC_SUBST(MOZ_UI_LOCALE)
3818 dnl ========================================================
3819 dnl build the tests by default
3820 dnl ========================================================
3821 MOZ_ARG_DISABLE_BOOL(tests,
3822 [ --disable-tests Do not build test libraries & programs],
3826 dnl ========================================================
3828 dnl = Module specific options
3830 dnl ========================================================
3831 MOZ_ARG_HEADER(Individual module options)
3833 dnl ========================================================
3834 dnl = Enable Ultrasparc specific optimizations for JS
3835 dnl ========================================================
3836 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
3837 [ --enable-js-ultrasparc Use UltraSPARC optimizations in JS],
3838 JS_ULTRASPARC_OPTS=1,
3839 JS_ULTRASPARC_OPTS= )
3841 dnl only enable option for ultrasparcs
3842 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
3843 "$OS_TEST" != "sun4u"; then
3846 AC_SUBST(JS_ULTRASPARC_OPTS)
3848 dnl ========================================================
3850 dnl = Debugging Options
3852 dnl ========================================================
3853 MOZ_ARG_HEADER(Debugging and Optimizations)
3855 dnl ========================================================
3856 dnl = Disable building with debug info.
3857 dnl = Debugging is OFF by default
3858 dnl ========================================================
3859 if test -z "$MOZ_DEBUG_FLAGS"
3863 if test "$GNU_CC"; then
3864 GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
3865 case "$GCC_VERSION" in
3870 MOZ_DEBUG_FLAGS="-g"
3874 MOZ_DEBUG_FLAGS="-g"
3878 MOZ_DEBUG_FLAGS="-g"
3883 MOZ_ARG_ENABLE_STRING(debug,
3884 [ --enable-debug[=DBG] Enable building with developer debug info
3885 (Using compiler flags DBG)],
3886 [ if test "$enableval" != "no"; then
3888 if test -n "$enableval" && test "$enableval" != "yes"; then
3889 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
3896 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
3897 case "${target_os}" in
3899 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
3901 msvc*|mks*|cygwin*|mingw*|os2*|wince*)
3902 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
3905 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
3908 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
3910 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
3912 if test -n "$MOZ_DEBUG"; then
3913 AC_MSG_CHECKING([for valid debug flags])
3914 _SAVE_CFLAGS=$CFLAGS
3915 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
3916 AC_TRY_COMPILE([#include <stdio.h>],
3917 [printf("Hello World\n");],
3920 AC_MSG_RESULT([$_results])
3921 if test "$_results" = "no"; then
3922 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
3924 CFLAGS=$_SAVE_CFLAGS
3927 dnl ========================================================
3928 dnl = Enable code optimization. ON by default.
3929 dnl ========================================================
3930 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
3931 MOZ_OPTIMIZE_FLAGS="-O"
3934 MOZ_ARG_ENABLE_STRING(optimize,
3935 [ --disable-optimize Disable compiler optimization
3936 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
3937 [ if test "$enableval" != "no"; then
3939 if test -n "$enableval" && test "$enableval" != "yes"; then
3940 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
3945 fi ], MOZ_OPTIMIZE=1)
3947 if test "$COMPILE_ENVIRONMENT"; then
3948 if test -n "$MOZ_OPTIMIZE"; then
3949 AC_MSG_CHECKING([for valid optimization flags])
3950 _SAVE_CFLAGS=$CFLAGS
3951 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3952 AC_TRY_COMPILE([#include <stdio.h>],
3953 [printf("Hello World\n");],
3956 AC_MSG_RESULT([$_results])
3957 if test "$_results" = "no"; then
3958 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
3960 CFLAGS=$_SAVE_CFLAGS
3962 fi # COMPILE_ENVIRONMENT
3964 AC_SUBST(MOZ_OPTIMIZE)
3965 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
3966 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
3967 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
3969 dnl ========================================================
3970 dnl = Enable/disable debug for specific modules only
3971 dnl = module names beginning with ^ will be disabled
3972 dnl ========================================================
3973 MOZ_ARG_ENABLE_STRING(debug-modules,
3974 [ --enable-debug-modules Enable/disable debug info for specific modules],
3975 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
3977 dnl ========================================================
3978 dnl = Enable/disable generation of debugger info for specific modules only
3979 dnl = the special module name ALL_MODULES can be used to denote all modules
3980 dnl = module names beginning with ^ will be disabled
3981 dnl ========================================================
3982 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
3983 [ --enable-debugger-info-modules
3984 Enable/disable debugger info for specific modules],
3985 [ for i in `echo $enableval | sed 's/,/ /g'`; do
3986 dnl note that the list of module names is reversed as it is copied
3987 dnl this is important, as it will allow config.mk to interpret stuff like
3988 dnl "^ALL_MODULES xpcom" properly
3989 if test "$i" = "no"; then
3992 if test "$i" = "yes"; then
3995 MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
3998 dnl ========================================================
3999 dnl Enable garbage collector
4000 dnl ========================================================
4001 MOZ_ARG_ENABLE_BOOL(boehm,
4002 [ --enable-boehm Enable the Boehm Garbage Collector],
4005 if test -n "$GC_LEAK_DETECTOR"; then
4006 AC_DEFINE(GC_LEAK_DETECTOR)
4009 dnl ========================================================
4010 dnl = Enable trace malloc
4011 dnl ========================================================
4012 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
4013 MOZ_ARG_ENABLE_BOOL(trace-malloc,
4014 [ --enable-trace-malloc Enable malloc tracing],
4017 if test "$NS_TRACE_MALLOC"; then
4018 # Please, Mr. Linker Man, don't take away our symbol names
4019 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4020 AC_DEFINE(NS_TRACE_MALLOC)
4022 AC_SUBST(NS_TRACE_MALLOC)
4024 dnl ========================================================
4025 dnl = Enable jemalloc
4026 dnl ========================================================
4027 MOZ_ARG_ENABLE_BOOL(jemalloc,
4028 [ --enable-jemalloc Replace memory allocator with jemalloc],
4032 if test "$NS_TRACE_MALLOC"; then
4036 if test "$MOZ_MEMORY"; then
4038 dnl Don't try to run compiler tests on Windows
4039 if test "$OS_ARCH" = "WINNT"; then
4040 if test -z "$HAVE_64BIT_OS"; then
4041 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4043 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4046 AC_CHECK_SIZEOF([int *], [4])
4047 case "${ac_cv_sizeof_int_p}" in
4049 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4052 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4055 AC_MSG_ERROR([Unexpected pointer size])
4060 AC_DEFINE(MOZ_MEMORY)
4061 if test "x$MOZ_DEBUG" = "x1"; then
4062 AC_DEFINE(MOZ_MEMORY_DEBUG)
4064 dnl The generic feature tests that determine how to compute ncpus are long and
4065 dnl complicated. Therefore, simply define special cpp variables for the
4066 dnl platforms we have special knowledge of.
4067 case "${target_os}" in
4069 AC_DEFINE(MOZ_MEMORY_DARWIN)
4072 AC_DEFINE(MOZ_MEMORY_BSD)
4075 AC_DEFINE(MOZ_MEMORY_LINUX)
4078 AC_DEFINE(MOZ_MEMORY_BSD)
4081 AC_DEFINE(MOZ_MEMORY_SOLARIS)
4083 msvc*|mks*|cygwin*|mingw*)
4084 AC_DEFINE(MOZ_MEMORY_WINDOWS)
4085 dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
4086 dnl will fail miserably
4087 if test "$_CC_SUITE" -lt "8"; then
4088 AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
4090 if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
4091 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
4092 AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.])
4094 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
4097 if test -z "$WIN32_CRT_SRC_DIR"; then
4099 WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
4100 _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
4102 # CRT source directory
4103 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
4104 _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
4105 _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
4107 dnl need win32 paths in LIB, hence this python abuse. extra brackets
4109 _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
4110 MOZ_LIB="$_WIN_CRT_PATH;$LIB"
4111 dnl Needs to be in PATH too, since our tools will wind up linked against it.
4112 dnl This needs to be unix style.
4113 MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
4114 dnl Statically link the C++ stdlib. We only use this for Breakpad anyway.
4115 AC_DEFINE(_STATIC_CPPLIB)
4116 dnl Don't generate a manifest, since we're linking to a custom CRT.
4117 LDFLAGS="$LDFLAGS -MANIFEST:NO"
4118 dnl Also pass this to NSPR/NSS
4119 DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
4123 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
4127 AC_ARG_WITH([valgrind],
4128 [ --with-valgrind Enable valgrind integration hooks],
4129 [enable_valgrind="yes"], [enable_valgrind="no"])
4130 AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
4131 if test "x$enable_valgrind" = "xyes" ; then
4132 AC_DEFINE(MOZ_VALGRIND)
4135 AC_SUBST(MOZ_MEMORY)
4136 AC_SUBST(WIN32_CRT_SRC_DIR)
4137 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
4140 dnl Need to set this for make because NSS doesn't have configure
4143 dnl ========================================================
4144 dnl = Use malloc wrapper lib
4145 dnl ========================================================
4146 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
4147 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
4151 if test -n "$_WRAP_MALLOC"; then
4152 if test "$GNU_CC"; then
4153 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"
4154 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
4158 dnl ========================================================
4159 dnl = Location of malloc wrapper lib
4160 dnl ========================================================
4161 MOZ_ARG_WITH_STRING(wrap-malloc,
4162 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
4163 WRAP_MALLOC_LIB=$withval)
4165 dnl ========================================================
4166 dnl = Use Electric Fence
4167 dnl ========================================================
4168 MOZ_ARG_ENABLE_BOOL(efence,
4169 [ --enable-efence Link with Electric Fence],
4172 if test -n "$_ENABLE_EFENCE"; then
4173 AC_CHECK_LIB(efence,malloc)
4176 dnl ========================================================
4178 dnl ========================================================
4179 MOZ_ARG_ENABLE_BOOL(jprof,
4180 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)],
4183 if test -n "$MOZ_JPROF"; then
4184 AC_DEFINE(MOZ_JPROF)
4187 dnl ========================================================
4189 dnl ========================================================
4190 MOZ_ARG_ENABLE_BOOL(shark,
4191 [ --enable-shark Enable shark remote profiling (needs CHUD framework)],
4194 if test -n "$MOZ_SHARK"; then
4195 AC_DEFINE(MOZ_SHARK)
4198 dnl ========================================================
4200 dnl ========================================================
4201 MOZ_ARG_ENABLE_BOOL(callgrind,
4202 [ --enable-callgrind Enable callgrind profiling],
4205 if test -n "$MOZ_CALLGRIND"; then
4206 AC_DEFINE(MOZ_CALLGRIND)
4209 dnl ========================================================
4211 dnl ========================================================
4212 MOZ_ARG_ENABLE_BOOL(vtune,
4213 [ --enable-vtune Enable vtune profiling],
4216 if test -n "$MOZ_VTUNE"; then
4217 AC_DEFINE(MOZ_VTUNE)
4220 dnl ========================================================
4221 dnl = Enable static checking using gcc-dehydra
4222 dnl ========================================================
4224 MOZ_ARG_WITH_STRING(static-checking,
4225 [ --with-static-checking=path/to/gcc_dehydra.so
4226 Enable static checking of code using GCC-dehydra],
4227 DEHYDRA_PATH=$withval,
4230 if test -n "$DEHYDRA_PATH"; then
4231 if ! test -f "$DEHYDRA_PATH"; then
4232 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
4234 AC_DEFINE(NS_STATIC_CHECKING)
4236 AC_SUBST(DEHYDRA_PATH)
4238 dnl ========================================================
4239 dnl = Enable stripping of libs & executables
4240 dnl ========================================================
4241 MOZ_ARG_ENABLE_BOOL(strip,
4242 [ --enable-strip Enable stripping of libs & executables ],
4246 dnl ========================================================
4247 dnl = Enable stripping of libs & executables when packaging
4248 dnl ========================================================
4249 MOZ_ARG_ENABLE_BOOL(install-strip,
4250 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
4254 dnl ========================================================
4255 dnl = --enable-old-abi-compat-wrappers
4256 dnl ========================================================
4257 dnl on x86 linux, the current builds of some popular plugins (notably
4258 dnl flashplayer and real) expect a few builtin symbols from libgcc
4259 dnl which were available in some older versions of gcc. However,
4260 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
4261 dnl we want those plugin to work with a gcc-3.1 built binary, we need
4262 dnl to provide these symbols. MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
4263 dnl to true on x86 linux, and false everywhere else.
4266 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
4267 [ --enable-old-abi-compat-wrappers
4268 Support old GCC ABI symbols to ease the pain
4269 of the linux compiler change],
4270 MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
4271 MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
4272 if test "$COMPILE_ENVIRONMENT"; then
4273 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
4276 AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
4278 AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
4280 fi # COMPILE_ENVIRONMENT
4282 dnl ========================================================
4284 dnl = Profiling and Instrumenting
4286 dnl ========================================================
4287 MOZ_ARG_HEADER(Profiling and Instrumenting)
4289 dnl ========================================================
4290 dnl = Enable timeline service, which provides lightweight
4291 dnl = instrumentation of mozilla for performance measurement.
4292 dnl = Timeline is off by default.
4293 dnl ========================================================
4294 MOZ_ARG_ENABLE_BOOL(timeline,
4295 [ --enable-timeline Enable timeline services ],
4298 if test -n "$MOZ_TIMELINE"; then
4299 AC_DEFINE(MOZ_TIMELINE)
4302 dnl ========================================================
4303 dnl = Add support for Eazel profiler
4304 dnl ========================================================
4305 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
4306 [ --enable-eazel-profiler-support
4307 Enable Corel/Eazel profiler support],
4308 ENABLE_EAZEL_PROFILER=1,
4309 ENABLE_EAZEL_PROFILER= )
4310 if test -n "$ENABLE_EAZEL_PROFILER"; then
4311 AC_DEFINE(ENABLE_EAZEL_PROFILER)
4312 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4313 EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
4314 EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
4317 MOZ_ARG_ENABLE_STRING(profile-modules,
4318 [ --enable-profile-modules
4319 Enable/disable profiling for specific modules],
4320 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
4322 MOZ_ARG_ENABLE_BOOL(insure,
4323 [ --enable-insure Enable insure++ instrumentation (linux only)],
4326 if test -n "$_ENABLE_INSURE"; then
4330 MOZ_INSURE_EXCLUDE_DIRS="config"
4333 MOZ_ARG_WITH_STRING(insure-dirs,
4334 [ --with-insure-dirs=DIRS
4335 Dirs to instrument with insure ],
4336 MOZ_INSURE_DIRS=$withval )
4338 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
4339 [ --with-insure-exclude-dirs=DIRS
4340 Dirs to not instrument with insure ],
4341 MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
4343 dnl ========================================================
4344 dnl = Support for Quantify (Windows)
4345 dnl ========================================================
4346 MOZ_ARG_ENABLE_BOOL(quantify,
4347 [ --enable-quantify Enable Quantify support (Windows only) ],
4351 dnl ========================================================
4352 dnl = Support for demangling undefined symbols
4353 dnl ========================================================
4354 if test -z "$SKIP_LIBRARY_CHECKS"; then
4357 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4361 # Demangle only for debug or trace-malloc builds
4362 MOZ_DEMANGLE_SYMBOLS=
4363 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
4364 MOZ_DEMANGLE_SYMBOLS=1
4365 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4367 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4369 dnl ========================================================
4370 dnl = Support for gcc stack unwinding (from gcc 3.3)
4371 dnl ========================================================
4372 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
4373 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4376 dnl ========================================================
4380 dnl ========================================================
4381 MOZ_ARG_HEADER(Misc. Options)
4383 dnl ========================================================
4384 dnl update xterm title
4385 dnl ========================================================
4386 MOZ_ARG_ENABLE_BOOL(xterm-updates,
4387 [ --enable-xterm-updates Update XTERM titles with current command.],
4391 if test -z "$SKIP_COMPILER_CHECKS"; then
4392 dnl ========================================================
4394 dnl = Compiler Options
4396 dnl ========================================================
4397 MOZ_ARG_HEADER(Compiler Options)
4399 dnl ========================================================
4400 dnl Check for gcc -pipe support
4401 dnl ========================================================
4402 AC_MSG_CHECKING([for gcc -pipe support])
4403 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
4404 echo '#include <stdio.h>' > dummy-hello.c
4405 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
4406 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
4407 cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
4408 if test $? = 0; then
4413 if test "$_res_as_stdin" = "yes"; then
4414 _SAVE_CFLAGS=$CFLAGS
4415 CFLAGS="$CFLAGS -pipe"
4416 AC_TRY_COMPILE( [ #include <stdio.h> ],
4417 [printf("Hello World\n");],
4418 [_res_gcc_pipe="yes"],
4419 [_res_gcc_pipe="no"] )
4420 CFLAGS=$_SAVE_CFLAGS
4422 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
4424 CFLAGS="$CFLAGS -pipe"
4425 CXXFLAGS="$CXXFLAGS -pipe"
4429 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
4430 AC_MSG_RESULT([$_res])
4435 dnl pass -Wno-long-long to the compiler
4436 MOZ_ARG_ENABLE_BOOL(long-long-warning,
4437 [ --enable-long-long-warning
4438 Warn about use of non-ANSI long long type],
4439 _IGNORE_LONG_LONG_WARNINGS=,
4440 _IGNORE_LONG_LONG_WARNINGS=1)
4442 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
4443 _SAVE_CFLAGS="$CFLAGS"
4444 CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
4445 AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
4446 AC_TRY_COMPILE([], [return(0);],
4447 [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
4448 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
4449 result="yes" ], result="no")
4450 AC_MSG_RESULT([$result])
4451 CFLAGS="$_SAVE_CFLAGS"
4454 dnl ========================================================
4455 dnl Profile guided optimization
4456 dnl ========================================================
4457 dnl Test for profiling options
4458 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
4459 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
4461 dnl Provide a switch to disable PGO even when called via profiledbuild.
4462 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
4463 [ --disable-profile-guided-optimization
4464 Don't build with PGO even if called via make profiledbuild],
4465 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
4466 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
4468 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
4470 _SAVE_CFLAGS="$CFLAGS"
4471 CFLAGS="$CFLAGS -fprofile-generate"
4473 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
4474 AC_TRY_COMPILE([], [return 0;],
4475 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
4476 result="yes" ], result="no")
4477 AC_MSG_RESULT([$result])
4479 if test $result = "yes"; then
4480 PROFILE_GEN_LDFLAGS="-fprofile-generate"
4481 PROFILE_USE_CFLAGS="-fprofile-use"
4482 PROFILE_USE_LDFLAGS="-fprofile-use"
4484 CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
4485 AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
4486 AC_TRY_COMPILE([], [return 0;],
4487 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
4488 result="yes" ], result="no")
4489 AC_MSG_RESULT([$result])
4490 if test $result = "yes"; then
4491 PROFILE_USE_CFLAGS="-fbranch-probabilities"
4493 # don't really care, this is an old GCC
4494 PROFILE_GEN_LDFLAGS=
4495 PROFILE_USE_LDFLAGS=
4498 CFLAGS="$_SAVE_CFLAGS"
4500 if test -n "$INTEL_CC"; then
4501 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
4502 PROFILE_GEN_LDFLAGS=
4503 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
4504 PROFILE_USE_LDFLAGS=
4507 dnl Sun Studio on Solaris
4508 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
4509 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
4510 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
4511 if test "$CPU_ARCH" != "sparc"; then
4512 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
4513 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
4515 PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
4516 PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
4520 AC_SUBST(PROFILE_GEN_CFLAGS)
4521 AC_SUBST(PROFILE_GEN_LDFLAGS)
4522 AC_SUBST(PROFILE_USE_CFLAGS)
4523 AC_SUBST(PROFILE_USE_LDFLAGS)
4527 dnl ========================================================
4528 dnl Test for -pedantic bustage
4529 dnl ========================================================
4530 MOZ_ARG_DISABLE_BOOL(pedantic,
4531 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
4533 if test "$_PEDANTIC"; then
4534 _SAVE_CXXFLAGS=$CXXFLAGS
4535 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
4536 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
4537 AC_TRY_COMPILE([$configure_static_assert_macros],
4538 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
4539 result="no", result="yes" )
4540 AC_MSG_RESULT([$result])
4541 CXXFLAGS="$_SAVE_CXXFLAGS"
4545 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
4546 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
4549 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
4554 dnl ========================================================
4555 dnl Test for correct temporary object destruction order
4556 dnl ========================================================
4557 dnl We want to make sure the compiler follows the C++ spec here as
4558 dnl xpcom and the string classes depend on it (bug 235381).
4559 AC_MSG_CHECKING([for correct temporary object destruction order])
4560 AC_TRY_RUN([ class A {
4561 public: A(int& x) : mValue(x) {}
4563 operator char**() { return 0; }
4564 private: int& mValue;
4566 void func(char **arg) {}
4577 result="yes", result="no", result="maybe")
4578 AC_MSG_RESULT([$result])
4580 if test "$result" = "no"; then
4581 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
4584 dnl ========================================================
4585 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
4586 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
4587 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
4588 dnl ========================================================
4589 _SAVE_CXXFLAGS=$CXXFLAGS
4590 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
4591 AC_CACHE_CHECK(for correct overload resolution with const and templates,
4592 ac_nscap_nonconst_opeq_bug,
4601 template <class T, class U>
4602 int operator==(const Pointer<T>& rhs, U* lhs)
4604 return rhs.myPtr == lhs;
4607 template <class T, class U>
4608 int operator==(const Pointer<T>& rhs, const U* lhs)
4610 return rhs.myPtr == lhs;
4618 ac_nscap_nonconst_opeq_bug="no",
4619 ac_nscap_nonconst_opeq_bug="yes")])
4620 CXXFLAGS="$_SAVE_CXXFLAGS"
4622 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
4623 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
4625 fi # SKIP_COMPILER_CHECKS
4627 dnl ========================================================
4629 dnl Should be smarter and check that the compiler does indeed have rtti
4630 dnl ========================================================
4631 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
4632 [ --enable-cpp-rtti Enable C++ RTTI ],
4633 [ _MOZ_USE_RTTI=1 ],
4636 if test "$_MOZ_USE_RTTI"; then
4637 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
4639 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
4642 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
4644 dnl ========================================================
4645 dnl C++ exceptions (g++/egcs only - for now)
4646 dnl Should be smarter and check that the compiler does indeed have exceptions
4647 dnl ========================================================
4648 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
4649 [ --enable-cpp-exceptions Enable C++ exceptions ],
4650 [ _MOZ_CPP_EXCEPTIONS=1 ],
4651 [ _MOZ_CPP_EXCEPTIONS= ])
4653 if test "$_MOZ_CPP_EXCEPTIONS"; then
4654 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
4656 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
4659 # Irix & OSF native compilers do not like exception declarations
4660 # when exceptions are disabled
4661 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
4662 AC_DEFINE(CPP_THROW_NEW, [])
4664 AC_DEFINE(CPP_THROW_NEW, [throw()])
4668 dnl ========================================================
4670 dnl = Build depencency options
4672 dnl ========================================================
4673 MOZ_ARG_HEADER(Build dependencies)
4675 dnl ========================================================
4676 dnl = Do not auto generate dependency info
4677 dnl ========================================================
4679 MOZ_ARG_DISABLE_BOOL(auto-deps,
4680 [ --disable-auto-deps Do not automatically generate dependency info],
4684 if test -n "$MOZ_AUTO_DEPS"; then
4685 dnl ========================================================
4686 dnl = Use mkdepend instead of $CC -MD for dependency generation
4687 dnl ========================================================
4689 MOZ_ARG_DISABLE_BOOL(md,
4690 [ --disable-md Do not use compiler-based dependencies ],
4693 [dnl Default is to turn on -MD if using GNU-compatible compilers
4694 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
4697 dnl Default is to use -xM if using Sun Studio on Solaris
4698 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
4701 if test "$_cpp_md_flag"; then
4703 if test "$OS_ARCH" = "OpenVMS"; then
4704 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
4706 _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
4708 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
4709 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
4714 _USE_CPP_INCLUDE_FLAG=
4715 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4716 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4720 AC_SUBST(MOZ_AUTO_DEPS)
4721 AC_SUBST(COMPILER_DEPEND)
4725 dnl ========================================================
4727 dnl = Static Build Options
4729 dnl ========================================================
4730 MOZ_ARG_HEADER(Static build options)
4732 MOZ_ARG_ENABLE_BOOL(static,
4733 [ --enable-static Enable building of internal static libs],
4734 BUILD_STATIC_LIBS=1,
4737 dnl ========================================================
4738 dnl = Force JS to be a static lib
4739 dnl ========================================================
4740 MOZ_ARG_ENABLE_BOOL(js-static-build,
4741 [ --enable-js-static-build Force js to be a static lib],
4745 AC_SUBST(JS_STATIC_BUILD)
4747 if test -n "$JS_STATIC_BUILD"; then
4748 AC_DEFINE(EXPORT_JS_API)
4750 if test -z "$BUILD_STATIC_LIBS"; then
4751 AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
4756 dnl ========================================================
4758 dnl = Standalone module options
4760 dnl ========================================================
4761 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4763 dnl ========================================================
4764 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
4765 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4768 MOZ_ARG_WITH_STRING(sync-build-files,
4769 [ --with-sync-build-files=DIR
4770 Check that files in 'config' and 'build' match
4771 their originals in 'DIR/config' and 'DIR/build'.
4772 This helps keep the SpiderMonkey build machinery
4773 in sync with Mozilla's, on which it is based.],
4774 [MOZ_SYNC_BUILD_FILES=$withval ] )
4775 AC_SUBST(MOZ_SYNC_BUILD_FILES)
4777 dnl ========================================================
4779 dnl = Maintainer debug option (no --enable equivalent)
4781 dnl ========================================================
4786 AC_SUBST(AR_EXTRACT)
4790 AC_SUBST(AS_DASH_C_FLAG)
4795 AC_SUBST(USE_SHORT_LIBNAME)
4799 AC_SUBST(NS_USE_NATIVE)
4800 AC_SUBST(MOZ_JS_LIBS)
4803 AC_SUBST(MOZ_DEBUG_MODULES)
4804 AC_SUBST(MOZ_PROFILE_MODULES)
4805 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
4806 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
4807 AC_SUBST(MOZ_DEBUG_FLAGS)
4808 AC_SUBST(MOZ_DEBUG_LDFLAGS)
4809 AC_SUBST(WARNINGS_AS_ERRORS)
4810 AC_SUBST(MOZ_DBGRINFO_MODULES)
4811 AC_SUBST(ENABLE_EAZEL_PROFILER)
4812 AC_SUBST(EAZEL_PROFILER_CFLAGS)
4813 AC_SUBST(EAZEL_PROFILER_LIBS)
4814 AC_SUBST(MOZ_PERF_METRICS)
4815 AC_SUBST(GC_LEAK_DETECTOR)
4819 AC_SUBST(MOZ_CALLGRIND)
4821 AC_SUBST(MOZ_XPCTOOLS)
4822 AC_SUBST(MOZ_JSLOADER)
4823 AC_SUBST(MOZ_INSURE)
4824 AC_SUBST(MOZ_INSURE_DIRS)
4825 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
4826 AC_SUBST(MOZ_QUANTIFY)
4827 AC_SUBST(MOZ_INSURIFYING)
4830 AC_SUBST(BUILD_STATIC_LIBS)
4831 AC_SUBST(ENABLE_TESTS)
4833 AC_SUBST(ENABLE_STRIP)
4834 AC_SUBST(PKG_SKIP_STRIP)
4835 AC_SUBST(INCREMENTAL_LINKER)
4836 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
4837 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
4839 AC_SUBST(MOZ_FIX_LINK_PATHS)
4841 AC_SUBST(USE_DEPENDENT_LIBS)
4843 AC_SUBST(MOZ_BUILD_ROOT)
4844 AC_SUBST(MOZ_OS2_TOOLS)
4845 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
4847 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
4848 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4849 AC_SUBST(MOZ_TIMELINE)
4851 AC_SUBST(TARGET_DEVICE)
4853 AC_SUBST(MOZ_APP_NAME)
4854 AC_SUBST(MOZ_APP_DISPLAYNAME)
4855 AC_SUBST(MOZ_APP_VERSION)
4857 AC_SUBST(MOZ_PKG_SPECIAL)
4859 AC_SUBST(MOZILLA_OFFICIAL)
4860 AC_SUBST(BUILD_OFFICIAL)
4861 AC_SUBST(MOZ_MILESTONE_RELEASE)
4864 AC_SUBST(MOZ_PROFILE)
4865 AC_SUBST(MOZ_DEBUG_SYMBOLS)
4866 AC_SUBST(MOZ_MAPINFO)
4867 AC_SUBST(MOZ_BROWSE_INFO)
4868 AC_SUBST(MOZ_TOOLS_DIR)
4869 AC_SUBST(CYGWIN_WRAPPER)
4871 AC_SUBST(WIN32_REDIST_DIR)
4874 dnl Echo the CFLAGS to remove extra whitespace.
4881 $_MOZ_EXCEPTIONS_FLAGS \
4882 $_WARNINGS_CXXFLAGS \
4885 COMPILE_CFLAGS=`echo \
4890 COMPILE_CXXFLAGS=`echo \
4891 $_DEFINES_CXXFLAGS \
4895 AC_SUBST(SYSTEM_MAKEDEPEND)
4897 AC_SUBST(NSPR_CFLAGS)
4899 AC_SUBST(MOZ_NATIVE_NSPR)
4904 AC_SUBST(COMPILE_CFLAGS)
4905 AC_SUBST(COMPILE_CXXFLAGS)
4908 AC_SUBST(CROSS_COMPILE)
4909 AC_SUBST(WCHAR_CFLAGS)
4913 AC_SUBST(HOST_CFLAGS)
4914 AC_SUBST(HOST_CXXFLAGS)
4915 AC_SUBST(HOST_OPTIMIZE_FLAGS)
4917 AC_SUBST(HOST_AR_FLAGS)
4919 AC_SUBST(HOST_RANLIB)
4920 AC_SUBST(HOST_NSPR_MDCPUCFG)
4921 AC_SUBST(HOST_BIN_SUFFIX)
4922 AC_SUBST(HOST_OS_ARCH)
4924 AC_SUBST(TARGET_CPU)
4925 AC_SUBST(TARGET_VENDOR)
4927 AC_SUBST(TARGET_NSPR_MDCPUCFG)
4928 AC_SUBST(TARGET_MD_ARCH)
4929 AC_SUBST(TARGET_XPCOM_ABI)
4932 AC_SUBST(OS_RELEASE)
4935 AC_SUBST(WRAP_MALLOC_CFLAGS)
4936 AC_SUBST(WRAP_MALLOC_LIB)
4939 AC_SUBST(MKSHLIB_FORCE_ALL)
4940 AC_SUBST(MKSHLIB_UNFORCE_ALL)
4941 AC_SUBST(DSO_CFLAGS)
4942 AC_SUBST(DSO_PIC_CFLAGS)
4943 AC_SUBST(DSO_LDOPTS)
4944 AC_SUBST(LIB_PREFIX)
4945 AC_SUBST(DLL_PREFIX)
4946 AC_SUBST(DLL_SUFFIX)
4947 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
4948 AC_SUBST(LIB_SUFFIX)
4949 AC_SUBST(OBJ_SUFFIX)
4950 AC_SUBST(BIN_SUFFIX)
4951 AC_SUBST(ASM_SUFFIX)
4952 AC_SUBST(IMPORT_LIB_SUFFIX)
4954 AC_SUBST(CC_VERSION)
4955 AC_SUBST(CXX_VERSION)
4956 AC_SUBST(MSMANIFEST_TOOL)
4958 if test "$USING_HCC"; then
4959 CC='${topsrcdir}/build/hcc'
4961 CXX='${topsrcdir}/build/hcpp'
4962 CXX="$CXX '$_OLDCXX'"
4967 dnl Check for missing components
4968 if test "$COMPILE_ENVIRONMENT"; then
4969 if test "$MOZ_X11"; then
4970 dnl ====================================================
4971 dnl = Check if X headers exist
4972 dnl ====================================================
4973 _SAVE_CFLAGS=$CFLAGS
4974 CFLAGS="$CFLAGS $XCFLAGS"
4978 #include <X11/Xlib.h>
4979 #include <X11/Intrinsic.h>
4983 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4984 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4988 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
4989 CFLAGS="$_SAVE_CFLAGS"
4991 if test ! -z "$MISSING_X"; then
4992 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4996 fi # COMPILE_ENVIRONMENT
4998 dnl Set various defines and substitutions
4999 dnl ========================================================
5001 if test "$OS_ARCH" = "BeOS"; then
5004 elif test "$OS_ARCH" = "Darwin"; then
5006 AC_DEFINE(UNIX_ASYNC_DNS)
5008 elif test "$OS_ARCH" = "OpenVMS"; then
5010 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
5012 AC_DEFINE(UNIX_ASYNC_DNS)
5015 AC_SUBST(MOZ_MOVEMAIL)
5017 AC_ARG_ENABLE(threadsafe,
5018 [ --enable-threadsafe Enable support for multiple threads.],
5019 [AC_DEFINE(JS_THREADSAFE)],)
5021 if test "$MOZ_DEBUG"; then
5022 AC_DEFINE(MOZ_REFLOW_PERF)
5023 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
5026 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
5027 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
5028 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
5029 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
5030 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
5031 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
5032 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
5033 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
5034 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
5037 # Used for LD_LIBRARY_PATH of run_viewer target
5039 for lib_arg in $NSPR_LIBS $TK_LIBS; do
5041 -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
5047 dnl ========================================================
5048 dnl JavaScript shell
5049 dnl ========================================================
5051 AC_HAVE_FUNCS(setlocale)
5053 dnl ========================================================
5054 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
5055 dnl ========================================================
5058 WIN_TOP_SRC=`cd $srcdir; pwd -W`
5061 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
5062 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
5063 CC="\$(CYGWIN_WRAPPER) $CC"
5064 CXX="\$(CYGWIN_WRAPPER) $CXX"
5065 CPP="\$(CYGWIN_WRAPPER) $CPP"
5066 LD="\$(CYGWIN_WRAPPER) $LD"
5067 AS="\$(CYGWIN_WRAPPER) $AS"
5068 RC="\$(CYGWIN_WRAPPER) $RC"
5069 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
5070 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
5071 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
5075 AC_SUBST(CYGDRIVE_MOUNT)
5076 AC_SUBST(WIN_TOP_SRC)
5078 AC_SUBST(MOZILLA_VERSION)
5080 AC_SUBST(ac_configure_args)
5082 dnl Spit out some output
5083 dnl ========================================================
5085 # Save the defines header file before autoconf removes it.
5086 # (Do not add AC_DEFINE calls after this line.)
5087 _CONFIG_TMP=confdefs-tmp.h
5088 _CONFIG_DEFS_H=mozilla-config.h
5090 cat > $_CONFIG_TMP <<\EOF
5091 /* List of defines generated by configure. Included with preprocessor flag,
5092 * -include, to avoid long list of -D defines on the compile command-line.
5096 #ifndef _MOZILLA_CONFIG_H_
5097 #define _MOZILLA_CONFIG_H_
5100 _EGREP_PATTERN='^#define ('
5101 if test -n "$_NON_GLOBAL_ACDEFINES"; then
5102 for f in $_NON_GLOBAL_ACDEFINES; do
5103 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
5106 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
5108 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
5110 cat >> $_CONFIG_TMP <<\EOF
5112 #endif /* _MOZILLA_CONFIG_H_ */
5116 # Only write mozilla-config.h when something changes (or it doesn't exist)
5117 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
5120 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
5121 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
5123 echo ==== $_CONFIG_DEFS_H =================================
5127 dnl Probably shouldn't call this manually but we always want the output of DEFS
5128 rm -f confdefs.h.save
5129 mv confdefs.h confdefs.h.save
5130 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
5131 AC_OUTPUT_MAKE_DEFS()
5133 AC_SUBST(MOZ_DEFINES)
5135 mv confdefs.h.save confdefs.h
5141 config/mkdepend/Makefile
5145 dnl Run a perl script to quickly create the makefiles.
5146 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
5147 dnl for the files it cannot handle correctly. This way, config.status
5148 dnl will handle these files.
5149 dnl If it fails, nothing is set and config.status will run as usual.
5151 dnl This does not change the $MAKEFILES variable.
5153 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
5155 if test -z "${AS_PERL}"; then
5156 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
5158 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
5163 echo $MAKEFILES > unallmakefiles
5165 AC_OUTPUT($MAKEFILES)
5167 # Produce the js-config script at configure time; see the comments for
5168 # 'js-config' in Makefile.in.
5169 AC_MSG_RESULT(invoking make to create js-config script)