js/src/configure.in

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:68c41b33953c
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
9
10 AC_PREREQ(2.13)
11 AC_INIT(js/src/jsapi.h)
12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
13 AC_CANONICAL_SYSTEM
14 TARGET_CPU="${target_cpu}"
15 TARGET_VENDOR="${target_vendor}"
16 TARGET_OS="${target_os}"
17
18 dnl ========================================================
19 dnl =
20 dnl = Don't change the following two lines. Doing so breaks:
21 dnl =
22 dnl = CFLAGS="-foo" ./configure
23 dnl =
24 dnl ========================================================
25 CFLAGS="${CFLAGS=}"
26 CPPFLAGS="${CPPFLAGS=}"
27 CXXFLAGS="${CXXFLAGS=}"
28 LDFLAGS="${LDFLAGS=}"
29 HOST_CFLAGS="${HOST_CFLAGS=}"
30 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
31 HOST_LDFLAGS="${HOST_LDFLAGS=}"
32
33 dnl ========================================================
34 dnl = Preserve certain environment flags passed to configure
35 dnl = We want sub projects to receive the same flags
36 dnl = untainted by this configure script
37 dnl ========================================================
38 _SUBDIR_CC="$CC"
39 _SUBDIR_CXX="$CXX"
40 _SUBDIR_CFLAGS="$CFLAGS"
41 _SUBDIR_CPPFLAGS="$CPPFLAGS"
42 _SUBDIR_CXXFLAGS="$CXXFLAGS"
43 _SUBDIR_LDFLAGS="$LDFLAGS"
44 _SUBDIR_HOST_CC="$HOST_CC"
45 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
46 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
47 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
48 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
49
50 dnl Set the version number of the libs included with mozilla
51 dnl ========================================================
52 NSPR_VERSION=4
53 NSPR_MINVER=4.9.2
54
55 dnl Set the minimum version of toolkit libs used by mozilla
56 dnl ========================================================
57 PERL_VERSION=5.006
58 WINDRES_VERSION=2.14.90
59 W32API_VERSION=3.14
60
61 MSMANIFEST_TOOL=
62
63 dnl Set various checks
64 dnl ========================================================
65 MISSING_X=
66 AC_PROG_AWK
67
68 dnl Initialize the Pthread test variables early so they can be
69 dnl overridden by each platform.
70 dnl ========================================================
71 USE_PTHREADS=
72 _PTHREAD_LDFLAGS=""
73
74 dnl Do not allow a separate objdir build if a srcdir build exists.
75 dnl ==============================================================
76 _topsrcdir=`cd $srcdir; pwd`
77 _objdir=`pwd`
78
79 if test "$_topsrcdir" != "$_objdir"
80 then
81 # Check for a couple representative files in the source tree
82 _conflict_files=
83 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
84 if test -f $file; then
85 _conflict_files="$_conflict_files $file"
86 fi
87 done
88 if test "$_conflict_files"; then
89 echo "***"
90 echo "* Your source tree contains these files:"
91 for file in $_conflict_files; do
92 echo "* $file"
93 done
94 cat 1>&2 <<-EOF
95 * This indicates that you previously built in the source tree.
96 * A source tree build can confuse the separate objdir build.
97 *
98 * To clean up the source tree:
99 * 1. cd $_topsrcdir
100 * 2. gmake distclean
101 ***
102 EOF
103 exit 1
104 break
105 fi
106 fi
107 MOZ_BUILD_ROOT=`pwd`
108
109 dnl Choose where to put the 'dist' directory.
110 dnl ==============================================================
111
112 MOZ_ARG_WITH_STRING(dist-dir,
113 [ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be
114 relative to the top of SpiderMonkey build tree,
115 or absolute.],
116 TOP_DIST=$withval,
117 TOP_DIST=dist)
118 AC_SUBST(TOP_DIST)
119
120 MOZ_DEFAULT_COMPILER
121
122 COMPILE_ENVIRONMENT=1
123 MOZ_ARG_DISABLE_BOOL(compile-environment,
124 [ --disable-compile-environment
125 Disable compiler/library checks.],
126 COMPILE_ENVIRONMENT= )
127 AC_SUBST(COMPILE_ENVIRONMENT)
128
129 dnl Check for Perl first -- needed for win32 SDK checks
130 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
131 if test -z "$PERL" -o "$PERL" = ":"; then
132 AC_MSG_ERROR([perl not found in \$PATH])
133 fi
134
135 MOZ_ARG_ENABLE_BOOL(shared-js,
136 [ --disable-shared-js
137 Do not create a shared library.],
138 DISABLE_SHARED_JS=0,
139 DISABLE_SHARED_JS=1)
140
141 MOZ_ARG_DISABLE_BOOL(export-js,
142 [ --disable-export-js
143 Do not mark JS symbols as DLL exported/visible.],
144 DISABLE_EXPORT_JS=1,
145 DISABLE_SHARED_JS=)
146
147 if test "$DISABLE_SHARED_JS" = "1" ; then
148 if test "$DISABLE_EXPORT_JS" = "1"; then
149 AC_DEFINE(STATIC_JS_API)
150 else
151 AC_DEFINE(STATIC_EXPORTABLE_JS_API)
152 fi
153 else
154 if test "$DISABLE_EXPORT_JS" = "1"; then
155 AC_MSG_ERROR([Must export JS symbols when building a shared library.])
156 fi
157 JS_SHARED_LIBRARY=1
158 fi
159 AC_SUBST(JS_SHARED_LIBRARY)
160
161 if test "$JS_STANDALONE" = no; then
162 autoconfmk=autoconf-js.mk
163 JS_STANDALONE=
164 else
165 JS_STANDALONE=1
166 AC_DEFINE(JS_STANDALONE)
167 fi
168 AC_SUBST(JS_STANDALONE)
169 BUILDING_JS=1
170 AC_SUBST(autoconfmk)
171
172 MOZ_ARG_WITH_STRING(gonk,
173 [ --with-gonk=DIR
174 location of gonk dir],
175 gonkdir=$withval)
176
177 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
178 [ --with-gonk-toolchain-prefix=DIR
179 prefix to gonk toolchain commands],
180 gonk_toolchain_prefix=$withval)
181
182 if test -n "$gonkdir" ; then
183 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
184
185 dnl set up compilers
186 AS="$gonk_toolchain_prefix"as
187 CC="$gonk_toolchain_prefix"gcc
188 CXX="$gonk_toolchain_prefix"g++
189 CPP="$gonk_toolchain_prefix"cpp
190 LD="$gonk_toolchain_prefix"ld
191 AR="$gonk_toolchain_prefix"ar
192 RANLIB="$gonk_toolchain_prefix"ranlib
193 STRIP="$gonk_toolchain_prefix"strip
194 OBJCOPY="$gonk_toolchain_prefix"objcopy
195
196 STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport"
197 STLPORT_LIBS="-lstlport"
198
199 case "$target_cpu" in
200 arm)
201 ARCH_DIR=arch-arm
202 ;;
203 i?86)
204 ARCH_DIR=arch-x86
205 ;;
206 esac
207
208 CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/system/core/include -isystem $gonkdir/bionic $CPPFLAGS -I$gonkdir/external/valgrind/fxos-include"
209 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
210 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
211 LIBS="$LIBS $STLPORT_LIBS"
212
213 dnl Add -llog by default, since we use it all over the place.
214 LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
215
216 dnl prevent cross compile section from using these flags as host flags
217 if test -z "$HOST_CPPFLAGS" ; then
218 HOST_CPPFLAGS=" "
219 fi
220 if test -z "$HOST_CFLAGS" ; then
221 HOST_CFLAGS=" "
222 fi
223 if test -z "$HOST_CXXFLAGS" ; then
224 HOST_CXXFLAGS=" "
225 fi
226 if test -z "$HOST_LDFLAGS" ; then
227 HOST_LDFLAGS=" "
228 fi
229
230 AC_DEFINE(ANDROID)
231 AC_DEFINE(GONK)
232 else
233 MOZ_ANDROID_NDK
234 fi
235
236 dnl ==============================================================
237 dnl Get mozilla version from central milestone file
238 dnl ==============================================================
239 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
240 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
241 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
242
243 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
244 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
245 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
246 AC_SUBST(MOZILLA_SYMBOLVERSION)
247
248 # Separate version into components for use in shared object naming etc
249 changequote(,)
250 MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
251 MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
252 MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
253 IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
254
255 dnl XXX in a temporary bid to avoid developer anger at renaming files
256 dnl XXX before "js" symlinks exist, don't change names.
257 dnl
258 dnl if test -n "$JS_STANDALONE"; then
259 dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
260 dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
261 dnl else
262 JS_SHELL_NAME=js
263 JS_CONFIG_NAME=js-config
264 dnl fi
265
266 changequote([,])
267 if test -n "$IS_ALPHA"; then
268 changequote(,)
269 MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
270 changequote([,])
271 fi
272 AC_DEFINE_UNQUOTED(MOZJS_MAJOR_VERSION,$MOZJS_MAJOR_VERSION)
273 AC_DEFINE_UNQUOTED(MOZJS_MINOR_VERSION,$MOZJS_MINOR_VERSION)
274 AC_SUBST(JS_SHELL_NAME)
275 AC_SUBST(JS_CONFIG_NAME)
276 AC_SUBST(MOZJS_MAJOR_VERSION)
277 AC_SUBST(MOZJS_MINOR_VERSION)
278 AC_SUBST(MOZJS_PATCH_VERSION)
279 AC_SUBST(MOZJS_ALPHA)
280
281 dnl ========================================================
282 dnl Checks for compilers.
283 dnl ========================================================
284
285 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
286 AR_FLAGS='crs $@'
287
288 if test "$COMPILE_ENVIRONMENT"; then
289
290 # Note:
291 # In Mozilla, we use the names $target, $host and $build incorrectly, but are
292 # too far gone to back out now. See Bug 475488:
293 # - When we say $target, we mean $host, that is, the system on which
294 # Mozilla will be run.
295 # - When we say $host, we mean $build, that is, the system on which Mozilla
296 # is built.
297 # - $target (in its correct usage) is for compilers who generate code for a
298 # different platform than $host, so it would not be used by Mozilla.
299 if test "$target" != "$host"; then
300 MOZ_CROSS_COMPILER
301 else
302 AC_PROG_CC
303 AC_PROG_CXX
304 AC_PROG_RANLIB
305 MOZ_PATH_PROGS(AS, $AS as, $CC)
306 AC_CHECK_PROGS(AR, ar, :)
307 AC_CHECK_PROGS(LD, ld, :)
308 AC_CHECK_PROGS(STRIP, strip, :)
309 AC_CHECK_PROGS(WINDRES, windres, :)
310 if test -z "$HOST_CC"; then
311 HOST_CC='$(CC)'
312 fi
313 if test -z "$HOST_CFLAGS"; then
314 HOST_CFLAGS='$(CFLAGS)'
315 fi
316 if test -z "$HOST_CXX"; then
317 HOST_CXX='$(CXX)'
318 fi
319 if test -z "$HOST_CXXFLAGS"; then
320 HOST_CXXFLAGS='$(CXXFLAGS)'
321 fi
322 if test -z "$HOST_LDFLAGS"; then
323 HOST_LDFLAGS='$(LDFLAGS)'
324 fi
325 if test -z "$HOST_RANLIB"; then
326 HOST_RANLIB='$(RANLIB)'
327 fi
328 if test -z "$HOST_AR"; then
329 HOST_AR='$(AR)'
330 fi
331 if test -z "$HOST_AR_FLAGS"; then
332 HOST_AR_FLAGS='$(AR_FLAGS)'
333 fi
334 fi
335
336 MOZ_TOOL_VARIABLES
337
338 MOZ_CHECK_COMPILER_WRAPPER
339
340 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
341 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
342 test "$GCC_MAJOR_VERSION" -lt 4; then
343 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
344 fi
345 fi
346
347 dnl Special win32 checks
348 dnl ========================================================
349
350 MOZ_ARG_ENABLE_BOOL(metro,
351 [ --enable-metro Enable Windows Metro build targets],
352 MOZ_METRO=1,
353 MOZ_METRO=)
354 if test -n "$MOZ_METRO"; then
355 AC_DEFINE(MOZ_METRO)
356 # Target the Windows 8 Kit
357 WINSDK_TARGETVER=602
358 WINVER=502
359 else
360 # Target the Windows 7 SDK by default
361 WINSDK_TARGETVER=601
362 WINVER=502
363 fi
364
365 MOZ_ARG_WITH_STRING(windows-version,
366 [ --with-windows-version=WINSDK_TARGETVER
367 Windows SDK version to target. Lowest version
368 currently allowed is 601, highest is 602],
369 WINSDK_TARGETVER=$withval)
370
371 # Currently only two sdk versions allowed, 601 and 602
372 case "$WINSDK_TARGETVER" in
373 601|602)
374 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
375 ;;
376
377 *)
378 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
379 ;;
380 esac
381
382 case "$target" in
383 *-mingw*)
384 if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
385 # Check to see if we are really running in a msvc environemnt
386 _WIN32_MSVC=1
387
388 # Make sure compilers are valid
389 CFLAGS="$CFLAGS -TC -nologo"
390 CXXFLAGS="$CXXFLAGS -TP -nologo"
391 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
392 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
393 # MSVC warning C4800 warns when a value is implicitly cast to bool,
394 # because this also forces narrowing to a single byte, which can be a
395 # perf hit. But this matters so little in practice (and often we want
396 # that behavior) that it's better to turn it off.
397 # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
398 # secure CRT functions.
399 CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800 -D_CRT_SECURE_NO_WARNINGS"
400 AC_LANG_SAVE
401 AC_LANG_C
402 AC_TRY_COMPILE([#include <stdio.h>],
403 [ printf("Hello World\n"); ],,
404 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
405
406 AC_LANG_CPLUSPLUS
407 AC_TRY_COMPILE([#include <new.h>],
408 [ unsigned *test = new unsigned(42); ],,
409 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
410 AC_LANG_RESTORE
411
412 changequote(,)
413 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
414 changequote([,])
415
416 # Determine compiler version
417 CC_VERSION=`${CC} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
418 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
419 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
420 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
421 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
422 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
423
424 CXX_VERSION=`${CXX} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
425 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
426
427 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
428 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
429 fi
430
431 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
432 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
433
434 if test "$_CC_MAJOR_VERSION" = "16"; then
435 _CC_SUITE=10
436 elif test "$_CC_MAJOR_VERSION" = "17"; then
437 _CC_SUITE=11
438 elif test "$_CC_MAJOR_VERSION" = "18"; then
439 _CC_SUITE=12
440 else
441 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
442 fi
443
444 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
445 dnl not something else like "magnetic tape manipulation utility".
446 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
447 if test -z "$MSMT_TOOL"; then
448 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
449 fi
450
451 changequote(,)
452 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
453 changequote([,])
454 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
455 if test -z "$MSMANIFEST_TOOL_VERSION"; then
456 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
457 fi
458
459 MSMANIFEST_TOOL=1
460 unset MSMT_TOOL
461
462 # Check linker version
463 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
464 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
465 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
466 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
467 fi
468
469 INCREMENTAL_LINKER=1
470
471 unset _MSVC_VER_FILTER
472 elif test -z "$CLANG_CC"; then
473 # Check w32api version
474 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
475 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
476 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
477 AC_TRY_COMPILE([#include <w32api.h>],
478 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
479 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
480 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
481 #error "test failed."
482 #endif
483 , [ res=yes ], [ res=no ])
484 AC_MSG_RESULT([$res])
485 if test "$res" != "yes"; then
486 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
487 fi
488 # Check windres version
489 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
490 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
491 AC_MSG_RESULT([$_WINDRES_VERSION])
492 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
493 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
494 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
495 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
496 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
497 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
498 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
499 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
500 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
501 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
502 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
503 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
504 then
505 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
506 fi
507
508 MOZ_WINSDK_MAXVER=0x06010000
509 fi # !GNU_CC
510
511 # If MSVC or clang
512 if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
513 MOZ_FIND_WINSDK_VERSION
514 fi
515
516 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
517 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
518 # Require OS features provided by IE 6.0 SP2 (XP SP2)
519 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
520
521 # If the maximum version supported by this SDK is lower than the target
522 # version, error out
523 AC_MSG_CHECKING([for Windows SDK being recent enough])
524 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
525 AC_MSG_RESULT("yes")
526 else
527 AC_MSG_RESULT("no")
528 AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
529 fi
530
531 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
532 # Definitions matching sdkddkver.h
533 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
534 ;;
535 esac
536
537 AC_PROG_CPP
538 AC_PROG_CXXCPP
539
540 if test -n "$_WIN32_MSVC"; then
541 SKIP_PATH_CHECKS=1
542 SKIP_COMPILER_CHECKS=1
543 SKIP_LIBRARY_CHECKS=1
544
545 # Since we're skipping compiler and library checks, hard-code
546 # some facts here.
547
548 # Common to all MSVC environments:
549
550 AC_DEFINE(HAVE_LOCALECONV)
551 AC_DEFINE(HAVE_HYPOT)
552 fi
553
554 fi # COMPILE_ENVIRONMENT
555
556 # Check to see if we are running in a broken QEMU scratchbox.
557 # We know that anything below 1.0.16 is broken.
558 AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
559 if test -n "$SBCONF"; then
560 _sb_version=`$SBCONF ve`
561 _sb_version_major=`echo $_sb_version | cut -f1 -d.`
562 _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
563 _sb_version_point=`echo $_sb_version | cut -f3 -d.`
564 if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
565 QEMU_CANT_RUN_JS_SHELL=1
566 fi
567 fi
568 AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
569
570 AC_SUBST(_MSC_VER)
571
572 AC_SUBST(GNU_AS)
573 AC_SUBST(GNU_LD)
574 AC_SUBST(GNU_CC)
575 AC_SUBST(GNU_CXX)
576 AC_SUBST(INTEL_CC)
577 AC_SUBST(INTEL_CXX)
578
579 dnl ========================================================
580 dnl Checks for programs.
581 dnl ========================================================
582 AC_PROG_INSTALL
583 AC_PROG_LN_S
584
585 AC_MSG_CHECKING([for tar archiver])
586 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
587 if test -z "$TAR"; then
588 AC_MSG_WARN([no tar archiver found in \$PATH])
589 fi
590 AC_MSG_RESULT([$TAR])
591 AC_SUBST(TAR)
592
593 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
594 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
595 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
596 _perl_res=$?
597 AC_MSG_RESULT([$_perl_version])
598
599 if test "$_perl_res" != 0; then
600 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
601 fi
602 fi
603
604 AC_MSG_CHECKING([for full perl installation])
605 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
606 _perl_res=$?
607 if test "$_perl_res" != 0; then
608 AC_MSG_RESULT([no])
609 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
610 else
611 AC_MSG_RESULT([yes])
612 fi
613
614 MOZ_PYTHON
615
616 if test -z "$COMPILE_ENVIRONMENT"; then
617 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
618 fi
619 AC_SUBST(NSINSTALL_BIN)
620
621 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
622 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
623 MOZ_PATH_PROG(XARGS, xargs)
624 if test -z "$XARGS" -o "$XARGS" = ":"; then
625 AC_MSG_ERROR([xargs not found in \$PATH .])
626 fi
627
628 if test "$COMPILE_ENVIRONMENT"; then
629
630 dnl ========================================================
631 dnl = Mac OS X toolchain support
632 dnl ========================================================
633
634 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
635 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
636 dnl when we can run target binaries.
637 AC_SUBST(UNIVERSAL_BINARY)
638 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
639
640 dnl ========================================================
641 dnl Check for MacOS deployment target version
642 dnl ========================================================
643
644 MOZ_ARG_ENABLE_STRING(macos-target,
645 [ --enable-macos-target=VER (default=10.6)
646 Set the minimum MacOS version needed at runtime],
647 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
648
649 if test "$target_cpu" != "arm"; then
650 case "$target" in
651 *-darwin*)
652 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
653 dnl Use the specified value
654 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
655 else
656 dnl No value specified on the command line or in the environment,
657 dnl use architecture minimum.
658 export MACOSX_DEPLOYMENT_TARGET=10.6
659 fi
660 ;;
661 esac
662 fi
663
664 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
665
666 dnl ========================================================
667 dnl = Mac OS X SDK support
668 dnl ========================================================
669 MACOS_SDK_DIR=
670 MOZ_ARG_WITH_STRING(macos-sdk,
671 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
672 MACOS_SDK_DIR=$withval)
673
674 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
675 AC_SUBST(MACOS_SDK_DIR)
676
677 if test "$MACOS_SDK_DIR"; then
678 dnl Sync this section with the ones in NSPR and NSS.
679 dnl Changes to the cross environment here need to be accounted for in
680 dnl the libIDL checks (below) and xpidl build.
681
682 if test ! -d "$MACOS_SDK_DIR"; then
683 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
684 specify a valid SDK. SDKs are installed when the optional cross-development
685 tools are selected during the Xcode/Developer Tools installation.])
686 fi
687
688 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
689 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
690
691 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
692 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
693 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
694
695 AC_LANG_SAVE
696 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
697 AC_LANG_CPLUSPLUS
698 AC_TRY_COMPILE([#include <new>
699 int main() { return 0; }],
700 result=yes,
701 result=no)
702 AC_LANG_RESTORE
703 AC_MSG_RESULT($result)
704
705 if test "$result" = "no" ; then
706 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
707 fi
708 fi
709
710 fi # COMPILE_ENVIRONMENT
711
712 if test -n "$MAKE"; then
713 if test `echo $MAKE | grep -c make.py` != 1; then
714 NOT_PYMAKE=$MAKE
715 fi
716 fi
717
718 case "$host_os" in
719 mingw*)
720 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
721 ;;
722 *)
723 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
724 ;;
725 esac
726 if test "$GMAKE" = ":"; then
727 AC_MSG_ERROR([GNU make not found])
728 fi
729
730 # MAKE will be set by client.mk, but still need this for standalone js builds
731 if test -z "$MAKE"; then
732 MAKE=$GMAKE
733 fi
734
735 if test "$COMPILE_ENVIRONMENT"; then
736
737 AC_PATH_XTRA
738
739 XCFLAGS="$X_CFLAGS"
740
741 fi # COMPILE_ENVIRONMENT
742
743 dnl ========================================================
744 dnl set the defaults first
745 dnl ========================================================
746 AS_BIN=$AS
747 AR_LIST='$(AR) t'
748 AR_EXTRACT='$(AR) x'
749 AR_DELETE='$(AR) d'
750 AS='$(CC)'
751 AS_DASH_C_FLAG='-c'
752 DLL_PREFIX=lib
753 LIB_PREFIX=lib
754 DLL_SUFFIX=.so
755 OBJ_SUFFIX=o
756 LIB_SUFFIX=a
757 ASM_SUFFIX=s
758 IMPORT_LIB_SUFFIX=
759 TARGET_MD_ARCH=unix
760 DIRENT_INO=d_ino
761 MOZ_USER_DIR=".mozilla"
762
763 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
764
765 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
766
767 USE_DEPENDENT_LIBS=1
768
769 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
770
771 if test -n "$CROSS_COMPILE"; then
772 OS_TARGET="${target_os}"
773 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
774 OS_RELEASE=
775 case "${target_os}" in
776 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
777 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
778 gnu*) OS_ARCH=GNU ;;
779 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
780 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
781 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
782 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
783 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
784 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
785 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
786 esac
787 case "${target}" in
788 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
789 esac
790 else
791 OS_TARGET=`uname -s`
792 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
793 OS_RELEASE=`uname -r`
794 fi
795
796 # Before this used `uname -m` when not cross compiling
797 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
798 OS_TEST="${target_cpu}"
799
800 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
801
802 #######################################################################
803 # Master "Core Components" macros for getting the OS target #
804 #######################################################################
805
806 #
807 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
808 # cross-compilation.
809 #
810
811 #
812 # Define and override various archtecture-specific variables, including
813 # HOST_OS_ARCH
814 # OS_ARCH
815 # OS_TEST
816 # OS_TARGET
817 # OS_RELEASE
818 # OS_MINOR_RELEASE
819 #
820
821 case "$HOST_OS_ARCH" in
822 mingw*)
823 HOST_OS_ARCH=WINNT
824 ;;
825 darwin*)
826 HOST_OS_ARCH=Darwin
827 ;;
828 linux*)
829 HOST_OS_ARCH=Linux
830 ;;
831 kfreebsd*-gnu)
832 HOST_OS_ARCH=GNU_kFreeBSD
833 ;;
834 gnu*)
835 HOST_OS_ARCH=GNU
836 ;;
837 dragonfly*)
838 HOST_OS_ARCH=DragonFly
839 ;;
840 freebsd*)
841 HOST_OS_ARCH=FreeBSD
842 ;;
843 netbsd*)
844 HOST_OS_ARCH=NetBSD
845 ;;
846 openbsd*)
847 HOST_OS_ARCH=OpenBSD
848 ;;
849 solaris*)
850 HOST_OS_ARCH=SunOS
851 SOLARIS_SUNPRO_CC=
852 SOLARIS_SUNPRO_CXX=
853 if test -z "$GNU_CC"; then
854 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
855 SOLARIS_SUNPRO_CC=1
856 fi
857 fi
858
859 if test -z "$GNU_CXX"; then
860 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
861 SOLARIS_SUNPRO_CXX=1
862 fi
863 fi
864 AC_SUBST(SOLARIS_SUNPRO_CC)
865 AC_SUBST(SOLARIS_SUNPRO_CXX)
866 ;;
867 esac
868
869 case "$OS_ARCH" in
870 WINNT)
871 if test -z "$CROSS_COMPILE" ; then
872 OS_TEST=`uname -p`
873 fi
874 ;;
875 Windows_NT)
876 #
877 # If uname -s returns "Windows_NT", we assume that we are using
878 # the uname.exe in MKS toolkit.
879 #
880 # The -r option of MKS uname only returns the major version number.
881 # So we need to use its -v option to get the minor version number.
882 # Moreover, it doesn't have the -p option, so we need to use uname -m.
883 #
884 OS_ARCH=WINNT
885 OS_TARGET=WINNT
886 OS_MINOR_RELEASE=`uname -v`
887 if test "$OS_MINOR_RELEASE" = "00"; then
888 OS_MINOR_RELEASE=0
889 fi
890 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
891 ;;
892 MINGW*_NT*)
893 #
894 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
895 # the uname.exe in the MSYS tools.
896 #
897 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
898 OS_ARCH=WINNT
899 OS_TARGET=WINNT
900 ;;
901 AIX)
902 OS_RELEASE=`uname -v`.`uname -r`
903 OS_TEST=${target_cpu}
904 if test -z "$GNU_CC"; then
905 if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then
906 AIX_IBM_XLC=1
907 fi
908 fi
909 ;;
910 Darwin)
911 case "${target_cpu}" in
912 powerpc*)
913 OS_TEST=ppc
914 ;;
915 i*86*)
916 OS_TEST=i386
917 ;;
918 x86_64)
919 OS_TEST=x86_64
920 ;;
921 *)
922 if test -z "$CROSS_COMPILE" ; then
923 OS_TEST=`uname -p`
924 fi
925 ;;
926 esac
927 ;;
928 esac
929
930 # Only set CPU_ARCH if we recognize the value of OS_TEST
931
932 case "$OS_TEST" in
933 *86 | i86pc)
934 CPU_ARCH=x86
935 ;;
936
937 powerpc64 | ppc64 | powerpc64le | ppc64le)
938 CPU_ARCH=ppc64
939 ;;
940
941 powerpc | ppc | rs6000)
942 CPU_ARCH=ppc
943 ;;
944
945 Alpha | alpha | ALPHA)
946 CPU_ARCH=Alpha
947 ;;
948
949 s390)
950 CPU_ARCH=s390
951 ;;
952
953 s390x)
954 CPU_ARCH=s390x
955 ;;
956
957 hppa* | parisc)
958 CPU_ARCH=hppa
959 ;;
960
961 sun4u | sparc*)
962 CPU_ARCH=sparc
963 ;;
964
965 x86_64 | ia64)
966 CPU_ARCH="$OS_TEST"
967 ;;
968
969 arm*)
970 CPU_ARCH=arm
971 ;;
972
973 mips|mipsel)
974 CPU_ARCH="mips"
975 ;;
976
977 aarch64*)
978 CPU_ARCH=aarch64
979 ;;
980
981 esac
982
983 if test -z "$OS_TARGET"; then
984 OS_TARGET=$OS_ARCH
985 fi
986 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
987
988 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
989 dnl ===============================================================
990 INTEL_ARCHITECTURE=
991 case "$OS_TEST" in
992 x86_64|i?86)
993 INTEL_ARCHITECTURE=1
994 esac
995
996 dnl Configure platform-specific CPU architecture compiler options.
997 dnl ==============================================================
998 MOZ_ARCH_OPTS
999
1000 dnl =================================================================
1001 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1002 dnl which is bad when cross compiling.
1003 dnl =================================================================
1004 if test "$COMPILE_ENVIRONMENT"; then
1005 configure_static_assert_macros='
1006 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1007 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1008 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1009 '
1010
1011 dnl test that the macros actually work:
1012 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1013 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1014 [AC_LANG_SAVE
1015 AC_LANG_C
1016 ac_cv_static_assertion_macros_work="yes"
1017 AC_TRY_COMPILE([$configure_static_assert_macros],
1018 [CONFIGURE_STATIC_ASSERT(1)],
1019 ,
1020 ac_cv_static_assertion_macros_work="no")
1021 AC_TRY_COMPILE([$configure_static_assert_macros],
1022 [CONFIGURE_STATIC_ASSERT(0)],
1023 ac_cv_static_assertion_macros_work="no",
1024 )
1025 AC_LANG_CPLUSPLUS
1026 AC_TRY_COMPILE([$configure_static_assert_macros],
1027 [CONFIGURE_STATIC_ASSERT(1)],
1028 ,
1029 ac_cv_static_assertion_macros_work="no")
1030 AC_TRY_COMPILE([$configure_static_assert_macros],
1031 [CONFIGURE_STATIC_ASSERT(0)],
1032 ac_cv_static_assertion_macros_work="no",
1033 )
1034 AC_LANG_RESTORE
1035 ])
1036 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1037 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1038 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1039 fi
1040 fi # COMPILE_ENVIRONMENT
1041
1042 dnl ========================================================
1043 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1044 dnl computed above.
1045 dnl ========================================================
1046
1047 MOZ_ANDROID_STLPORT
1048
1049 dnl ========================================================
1050 dnl Suppress Clang Argument Warnings
1051 dnl ========================================================
1052 if test -n "$CLANG_CC"; then
1053 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1054 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1055 fi
1056 if test -n "$CLANG_CXX"; then
1057 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1058 fi
1059
1060 dnl ========================================================
1061 dnl = Use Address Sanitizer
1062 dnl ========================================================
1063 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1064 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1065 MOZ_ASAN=1,
1066 MOZ_ASAN= )
1067 if test -n "$MOZ_ASAN"; then
1068 MOZ_LLVM_HACKS=1
1069 AC_DEFINE(MOZ_ASAN)
1070 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1071 fi
1072 AC_SUBST(MOZ_ASAN)
1073 AC_SUBST(LLVM_SYMBOLIZER)
1074
1075 dnl ========================================================
1076 dnl = Enable hacks required for LLVM instrumentations
1077 dnl ========================================================
1078 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1079 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1080 MOZ_LLVM_HACKS=1,
1081 MOZ_LLVM_HACKS= )
1082 if test -n "$MOZ_LLVM_HACKS"; then
1083 MOZ_NO_WLZDEFS=1
1084 fi
1085
1086 dnl ========================================================
1087 dnl GNU specific defaults
1088 dnl ========================================================
1089 if test "$GNU_CC"; then
1090 # Per bug 719659 comment 2, some of the headers on ancient build machines
1091 # may require gnu89 inline semantics. But otherwise, we use C99.
1092 # But on OS X we just use C99 plus GNU extensions, in order to fix
1093 # bug 917526.
1094 CFLAGS="$CFLAGS -std=gnu99"
1095 if test "${OS_ARCH}" != Darwin; then
1096 CFLAGS="$CFLAGS -fgnu89-inline"
1097 fi
1098 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1099 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
1100 DSO_LDOPTS='-shared'
1101 if test "$GCC_USE_GNU_LD"; then
1102 # Some tools like ASan use a runtime library that is only
1103 # linked against executables, so we must allow undefined
1104 # symbols for shared objects in some cases.
1105 if test -z "$MOZ_NO_WLZDEFS"; then
1106 # Don't allow undefined symbols in libraries
1107 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1108 fi
1109 fi
1110 WARNINGS_AS_ERRORS='-Werror'
1111 DSO_CFLAGS=''
1112 DSO_PIC_CFLAGS='-fPIC'
1113 ASFLAGS="$ASFLAGS -fPIC"
1114 AC_MSG_CHECKING([for --noexecstack option to as])
1115 _SAVE_CFLAGS=$CFLAGS
1116 CFLAGS="$CFLAGS -Wa,--noexecstack"
1117 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1118 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1119 AC_MSG_RESULT([no]))
1120 CFLAGS=$_SAVE_CFLAGS
1121 AC_MSG_CHECKING([for -z noexecstack option to ld])
1122 _SAVE_LDFLAGS=$LDFLAGS
1123 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1124 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1125 AC_MSG_RESULT([no])
1126 LDFLAGS=$_SAVE_LDFLAGS)
1127
1128 AC_MSG_CHECKING([for -z text option to ld])
1129 _SAVE_LDFLAGS=$LDFLAGS
1130 LDFLAGS="$LDFLAGS -Wl,-z,text"
1131 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1132 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1133 AC_MSG_RESULT([no])
1134 LDFLAGS=$_SAVE_LDFLAGS)
1135
1136 AC_MSG_CHECKING([for --build-id option to ld])
1137 _SAVE_LDFLAGS=$LDFLAGS
1138 LDFLAGS="$LDFLAGS -Wl,--build-id"
1139 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1140 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1141 AC_MSG_RESULT([no])
1142 LDFLAGS=$_SAVE_LDFLAGS)
1143
1144 # Turn on GNU-specific warnings:
1145 # -Wall - turn on a lot of warnings
1146 # -Wpointer-arith - good to have
1147 # -Wdeclaration-after-statement - MSVC doesn't like these
1148 # -Werror=return-type - catches missing returns, zero false positives
1149 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1150 # -Wtype-limits - catches overflow bugs, few false positives
1151 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1152 # -Wsign-compare - catches comparison of signed and unsigned types
1153 #
1154 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1155 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1156 MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
1157 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1158 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1159
1160 # Turn off the following warnings that -Wall turns on:
1161 # -Wno-unused - lots of violations in third-party code
1162 #
1163 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1164
1165 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1166 # Don't use -Wcast-align with ICC or clang
1167 case "$CPU_ARCH" in
1168 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1169 hppa | ia64 | sparc | arm)
1170 ;;
1171 *)
1172 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1173 ;;
1174 esac
1175 fi
1176
1177 _DEFINES_CFLAGS='-include $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
1178 _USE_CPP_INCLUDE_FLAG=1
1179
1180 elif test "$SOLARIS_SUNPRO_CC"; then
1181 DSO_CFLAGS=''
1182 if test "$CPU_ARCH" = "sparc"; then
1183 # for Sun Studio on Solaris/SPARC
1184 DSO_PIC_CFLAGS='-xcode=pic32'
1185 else
1186 DSO_PIC_CFLAGS='-KPIC'
1187 fi
1188 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1189 else
1190 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1191 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1192
1193 DSO_LDOPTS='-shared'
1194 if test "$GNU_LD"; then
1195 # Don't allow undefined symbols in libraries
1196 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1197 fi
1198
1199 DSO_CFLAGS=''
1200 DSO_PIC_CFLAGS='-KPIC'
1201 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1202 fi
1203
1204 if test "$GNU_CXX"; then
1205 # Turn on GNU-specific warnings:
1206 # -Wall - turn on a lot of warnings
1207 # -Wpointer-arith - good to have
1208 # -Woverloaded-virtual - ???
1209 # -Werror=return-type - catches missing returns, zero false positives
1210 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1211 # -Wtype-limits - catches overflow bugs, few false positives
1212 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1213 # -Werror=conversion-null - catches conversions between NULL and non-pointer types
1214 # -Wsign-compare - catches comparison of signed and unsigned types
1215 #
1216 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1217 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1218 MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
1219 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1220 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1221 MOZ_CXX_SUPPORTS_WARNING(-W, error=conversion-null, ac_cxx_has_werror_conversion_null)
1222 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1223
1224 # Turn off the following warnings that -Wall turns on:
1225 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1226 #
1227 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1228
1229 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1230 # Don't use -Wcast-align with ICC or clang
1231 case "$CPU_ARCH" in
1232 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1233 hppa | ia64 | sparc | arm)
1234 ;;
1235 *)
1236 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1237 ;;
1238 esac
1239 fi
1240
1241 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js/src/js-confdefs.h'
1242 _USE_CPP_INCLUDE_FLAG=1
1243
1244 # Recent clang and gcc support C++11 deleted functions without warnings if
1245 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1246 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1247 # unused. But clang's warning can be disabled, so when compiling with clang
1248 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1249 # deleted function syntax.
1250 if test "$CLANG_CXX"; then
1251 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1252 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1253 fi
1254
1255 else
1256 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)'
1257 fi
1258
1259 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1260 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1261 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1262 dnl normal behavior.
1263 dnl ========================================================
1264 MKSHLIB_FORCE_ALL=
1265 MKSHLIB_UNFORCE_ALL=
1266
1267 if test "$COMPILE_ENVIRONMENT"; then
1268 if test "$GNU_CC"; then
1269 AC_MSG_CHECKING(whether ld has archive extraction flags)
1270 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1271 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1272 ac_cv_mkshlib_force_and_unforce="no"
1273 exec 3<&0 <<LOOP_INPUT
1274 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1275 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1276 force="-Wl,-all"; unforce="-Wl,-none"
1277 LOOP_INPUT
1278 while read line
1279 do
1280 eval $line
1281 LDFLAGS=$force
1282 LIBS=$unforce
1283 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1284 done
1285 exec 0<&3 3<&-
1286 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1287 ])
1288 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1289 AC_MSG_RESULT(no)
1290 else
1291 AC_MSG_RESULT(yes)
1292 eval $ac_cv_mkshlib_force_and_unforce
1293 MKSHLIB_FORCE_ALL=$force
1294 MKSHLIB_UNFORCE_ALL=$unforce
1295 fi
1296 fi # GNU_CC
1297 fi # COMPILE_ENVIRONMENT
1298
1299 dnl ========================================================
1300 dnl Checking for 64-bit OS
1301 dnl ========================================================
1302 if test "$COMPILE_ENVIRONMENT"; then
1303 AC_LANG_SAVE
1304 AC_LANG_C
1305 AC_MSG_CHECKING(for 64-bit OS)
1306 AC_TRY_COMPILE([$configure_static_assert_macros],
1307 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1308 result="yes", result="no")
1309 AC_MSG_RESULT("$result")
1310 if test "$result" = "yes"; then
1311 AC_DEFINE(HAVE_64BIT_OS)
1312 HAVE_64BIT_OS=1
1313 fi
1314 AC_SUBST(HAVE_64BIT_OS)
1315 AC_LANG_RESTORE
1316 fi # COMPILE_ENVIRONMENT
1317
1318 dnl ========================================================
1319 dnl = Use profiling compile flags
1320 dnl ========================================================
1321 MOZ_ARG_ENABLE_BOOL(profiling,
1322 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1323 MOZ_PROFILING=1,
1324 MOZ_PROFILING= )
1325
1326 dnl ========================================================
1327 dnl System overrides of the defaults for host
1328 dnl ========================================================
1329 case "$host" in
1330 *mingw*)
1331 if test -n "$_WIN32_MSVC"; then
1332 HOST_AR=lib
1333 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1334 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1335 HOST_RANLIB='echo ranlib'
1336 else
1337 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1338 fi
1339 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1340 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1341 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1342 HOST_BIN_SUFFIX=.exe
1343 case "$host" in
1344 *mingw*)
1345 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1346 ;;
1347 esac
1348
1349 case "${host_cpu}" in
1350 i*86)
1351 if test -n "$_WIN32_MSVC"; then
1352 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1353 fi
1354 ;;
1355 x86_64)
1356 if test -n "$_WIN32_MSVC"; then
1357 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1358 fi
1359 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1360 ;;
1361 esac
1362 ;;
1363
1364 *-darwin*)
1365 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1366 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1367 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1368 ;;
1369
1370 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1371 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1372 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1373 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1374 ;;
1375
1376 *)
1377 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1378 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1379 ;;
1380 esac
1381
1382 dnl Check for using a custom <inttypes.h> implementation
1383 dnl ========================================================
1384 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1385 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1386 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1387 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1388 else
1389 AC_MSG_RESULT(none specified)
1390 fi
1391
1392 MOZ_DOING_LTO(lto_is_enabled)
1393
1394 dnl ========================================================
1395 dnl System overrides of the defaults for target
1396 dnl ========================================================
1397
1398 case "$target" in
1399 *-aix*)
1400 AC_DEFINE(AIX)
1401 if test ! "$GNU_CC"; then
1402 if test ! "$HAVE_64BIT_OS"; then
1403 # Compiling with Visual Age C++ object model compat is the
1404 # default. To compile with object model ibm, add
1405 # AIX_OBJMODEL=ibm to .mozconfig.
1406 if test "$AIX_OBJMODEL" = "ibm"; then
1407 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1408 else
1409 AIX_OBJMODEL=compat
1410 fi
1411 else
1412 AIX_OBJMODEL=compat
1413 fi
1414 AC_SUBST(AIX_OBJMODEL)
1415 DSO_LDOPTS='-qmkshrobj=1'
1416 DSO_CFLAGS='-qflag=w:w'
1417 DSO_PIC_CFLAGS=
1418 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1419 MOZ_FIX_LINK_PATHS=
1420 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1421 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1422 if test "$COMPILE_ENVIRONMENT"; then
1423 AC_LANG_SAVE
1424 AC_LANG_CPLUSPLUS
1425 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1426 AC_TRY_COMPILE([],
1427 [#if (__IBMCPP__ < 900)
1428 #error "Bad compiler"
1429 #endif],
1430 _BAD_COMPILER=,_BAD_COMPILER=1)
1431 if test -n "$_BAD_COMPILER"; then
1432 AC_MSG_RESULT([no])
1433 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1434 else
1435 AC_MSG_RESULT([yes])
1436 fi
1437 AC_LANG_RESTORE
1438 TARGET_COMPILER_ABI="ibmc"
1439 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1440 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1441 fi
1442 fi
1443 case "${target_os}" in
1444 aix4.1*)
1445 DLL_SUFFIX='_shr.a'
1446 ;;
1447 esac
1448 if test "$COMPILE_ENVIRONMENT"; then
1449 MOZ_CHECK_HEADERS(sys/inttypes.h)
1450 fi
1451 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1452 ;;
1453
1454 *-darwin*)
1455 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1456 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1457 MOZ_OPTIMIZE_FLAGS="-O3 -fno-stack-protector"
1458 CFLAGS="$CFLAGS -fno-common"
1459 CXXFLAGS="$CXXFLAGS -fno-common"
1460 DLL_SUFFIX=".dylib"
1461 DSO_LDOPTS=''
1462 STRIP="$STRIP -x -S"
1463 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1464 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1465 LDFLAGS="$LDFLAGS -lobjc"
1466 # The ExceptionHandling framework is needed for Objective-C exception
1467 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1468 # builds.
1469 _SAVE_LDFLAGS=$LDFLAGS
1470 AC_MSG_CHECKING([for -framework ExceptionHandling])
1471 LDFLAGS="$LDFLAGS -framework ExceptionHandling"
1472 AC_TRY_LINK(,[return 0;],
1473 ac_cv_have_framework_exceptionhandling="yes",
1474 ac_cv_have_framework_exceptionhandling="no")
1475 AC_MSG_RESULT([$ac_cv_have_framework_exceptionhandling])
1476 if test "$ac_cv_have_framework_exceptionhandling" = "yes"; then
1477 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1478 fi
1479 LDFLAGS=$_SAVE_LDFLAGS
1480
1481 if test "x$lto_is_enabled" = "xyes"; then
1482 echo "Skipping -dead_strip because lto is enabled."
1483 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1484 dnl ===================================================================
1485 elif test "x$enable_dtrace" = "xyes"; then
1486 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1487 else
1488 dnl check for the presence of the -dead_strip linker flag
1489 AC_MSG_CHECKING([for -dead_strip option to ld])
1490 _SAVE_LDFLAGS=$LDFLAGS
1491 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1492 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1493 if test -n "$_HAVE_DEAD_STRIP" ; then
1494 AC_MSG_RESULT([yes])
1495 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1496 else
1497 AC_MSG_RESULT([no])
1498 fi
1499
1500 LDFLAGS=$_SAVE_LDFLAGS
1501 fi
1502 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1503 ;;
1504
1505 ia64*-hpux*)
1506 DLL_SUFFIX=".so"
1507 if test ! "$GNU_CC"; then
1508 DSO_LDOPTS='-b'
1509 DSO_CFLAGS=""
1510 DSO_PIC_CFLAGS=
1511 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1512 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1513 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1514 else
1515 DSO_LDOPTS='-b -E'
1516 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1517 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1518 fi
1519 MOZ_FIX_LINK_PATHS=
1520 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1521 AC_DEFINE(_LARGEFILE64_SOURCE)
1522 ;;
1523
1524 *-hpux*)
1525 DLL_SUFFIX=".sl"
1526 if test ! "$GNU_CC"; then
1527 DSO_LDOPTS='-b -Wl,+s'
1528 DSO_CFLAGS=""
1529 DSO_PIC_CFLAGS="+Z"
1530 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1531 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1532 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1533 else
1534 DSO_LDOPTS='-b -E +s'
1535 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1536 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1537 fi
1538 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1539 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1540 ;;
1541
1542 *-android*|*-linuxandroid*)
1543 AC_DEFINE(NO_PW_GECOS)
1544 no_x=yes
1545 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1546 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1547
1548 MOZ_GFX_OPTIMIZE_MOBILE=1
1549 MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks -fno-reorder-functions"
1550 # The Maemo builders don't know about this flag
1551 MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
1552 ;;
1553
1554 *-*linux*)
1555 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1556 # Similarly for GNU_CXX and INTEL_CXX.
1557 if test "$INTEL_CC" -o "$INTEL_CXX"; then
1558 # -Os has been broken on Intel's C/C++ compilers for quite a
1559 # while; Intel recommends against using it.
1560 MOZ_OPTIMIZE_FLAGS="-O2"
1561 elif test "$GNU_CC" -o "$GNU_CXX"; then
1562 case $GCC_VERSION in
1563 4.5.*)
1564 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
1565 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1566 esac
1567 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
1568 MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
1569 fi
1570
1571 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1572
1573 case "${target_cpu}" in
1574 alpha*)
1575 CFLAGS="$CFLAGS -mieee"
1576 CXXFLAGS="$CXXFLAGS -mieee"
1577 ;;
1578 esac
1579
1580 if test -z "$MC"; then
1581 MC=mc.exe
1582 fi
1583 ;;
1584
1585 *-mingw*)
1586 DSO_CFLAGS=
1587 DSO_PIC_CFLAGS=
1588 DLL_SUFFIX=.dll
1589 RC=rc.exe
1590 MC=mc.exe
1591 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
1592 CC="$CC -mwindows"
1593 CXX="$CXX -mwindows"
1594 CPP="$CPP -mwindows"
1595 CFLAGS="$CFLAGS -mms-bitfields"
1596 CXXFLAGS="$CXXFLAGS -mms-bitfields"
1597 DSO_LDOPTS='-shared'
1598 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1599 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1600 RC='$(WINDRES)'
1601 # Use static libgcc and libstdc++
1602 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
1603 # Use temp file for windres (bug 213281)
1604 RCFLAGS='-O coff --use-temp-file'
1605 # mingw doesn't require kernel32, user32, and advapi32 explicitly
1606 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32 -lpsapi"
1607 MOZ_FIX_LINK_PATHS=
1608 DLL_PREFIX=
1609 IMPORT_LIB_SUFFIX=dll.a
1610
1611 # We use mix of both POSIX and Win32 printf format across the tree, so format
1612 # warnings are useless on mingw.
1613 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
1614 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
1615 else
1616 TARGET_COMPILER_ABI=msvc
1617 HOST_CC='$(CC)'
1618 HOST_CXX='$(CXX)'
1619 HOST_LD='$(LD)'
1620 if test "$AS_BIN"; then
1621 AS="$(basename "$AS_BIN")"
1622 fi
1623 AR='lib'
1624 AR_FLAGS='-NOLOGO -OUT:$@'
1625 AR_EXTRACT=
1626 RANLIB='echo not_ranlib'
1627 STRIP='echo not_strip'
1628 PKG_SKIP_STRIP=1
1629 XARGS=xargs
1630 DOXYGEN=:
1631 ASM_SUFFIX=asm
1632 OBJ_SUFFIX=obj
1633 LIB_SUFFIX=lib
1634 DLL_PREFIX=
1635 LIB_PREFIX=
1636 IMPORT_LIB_SUFFIX=lib
1637 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1638 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1639 MKSHLIB_FORCE_ALL=
1640 MKSHLIB_UNFORCE_ALL=
1641 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1642 _USE_CPP_INCLUDE_FLAG=1
1643 _DEFINES_CFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
1644 _DEFINES_CXXFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
1645 CFLAGS="$CFLAGS -W3 -Gy"
1646 CXXFLAGS="$CXXFLAGS -W3 -Gy"
1647 if test "$_CC_SUITE" -ge "12"; then
1648 dnl VS2013+ requires -FS when parallel building by make -jN.
1649 dnl If nothing, compiler sometimes causes C1041 error.
1650 dnl
1651 dnl Visual Studio 2013 supports -Gw flags
1652 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
1653 CFLAGS="$CFLAGS -FS -Gw"
1654 CXXFLAGS="$CXXFLAGS -FS -Gw"
1655 fi
1656 # khuey says we can safely ignore MSVC warning C4251
1657 # MSVC warning C4244 (implicit type conversion may lose data) warns
1658 # and requires workarounds for perfectly valid code. Also, GCC/clang
1659 # don't warn about it by default. So for consistency/sanity, we turn
1660 # it off on MSVC, too.
1661 CFLAGS="$CFLAGS -wd4244"
1662 CXXFLAGS="$CXXFLAGS -wd4244 -wd4251"
1663 # make 'foo == bar;' error out
1664 CFLAGS="$CFLAGS -we4553"
1665 CXXFLAGS="$CXXFLAGS -we4553"
1666 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib"
1667 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1668 WARNINGS_AS_ERRORS='-WX'
1669 MOZ_OPTIMIZE_FLAGS="-O2"
1670 MOZ_FIX_LINK_PATHS=
1671 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1672 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1673 if test -z "$DEVELOPER_OPTIONS"; then
1674 LDFLAGS="$LDFLAGS -RELEASE"
1675 fi
1676 dnl For profile-guided optimization
1677 PROFILE_GEN_CFLAGS="-GL"
1678 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1679 dnl XXX: PGO builds can fail with warnings treated as errors,
1680 dnl specifically "no profile data available" appears to be
1681 dnl treated as an error sometimes. This might be a consequence
1682 dnl of using WARNINGS_AS_ERRORS in some modules, combined
1683 dnl with the linker doing most of the work in the whole-program
1684 dnl optimization/PGO case. I think it's probably a compiler bug,
1685 dnl but we work around it here.
1686 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1687 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1688 dnl Probably also a compiler bug, but what can you do?
1689 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1690 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1691 fi
1692 AC_DEFINE(HAVE_SNPRINTF)
1693 AC_DEFINE(_WINDOWS)
1694 AC_DEFINE(WIN32)
1695 AC_DEFINE(XP_WIN)
1696 AC_DEFINE(XP_WIN32)
1697 AC_DEFINE(HW_THREADS)
1698 AC_DEFINE(STDC_HEADERS)
1699 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1700 TARGET_MD_ARCH=win32
1701 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
1702 BIN_SUFFIX='.exe'
1703 MOZ_USER_DIR="Mozilla"
1704
1705 dnl Hardcode to win95 for now - cls
1706 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
1707
1708 dnl set NO_X11 defines here as the general check is skipped on win32
1709 no_x=yes
1710 AC_DEFINE(NO_X11)
1711
1712 case "$host" in
1713 *-mingw*)
1714 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
1715 ;;
1716 esac
1717
1718 case "$host" in
1719 *-mingw*)
1720 if test -z "$MOZ_TOOLS"; then
1721 AC_MSG_ERROR([MOZ_TOOLS is not set])
1722 fi
1723 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
1724 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
1725 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
1726 fi
1727 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
1728 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
1729 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
1730 fi
1731 ;;
1732 esac
1733
1734 case "$host_os" in
1735 cygwin*|msvc*|mks*)
1736 AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
1737 ;;
1738 esac
1739
1740 case "$target" in
1741 i*86-*)
1742 if test "$HAVE_64BIT_OS"; then
1743 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
1744 fi
1745
1746 if test -n "$GNU_CC"; then
1747 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1748 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1749 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
1750 else
1751 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1752 LDFLAGS="$LDFLAGS -SAFESEH"
1753 fi
1754
1755 AC_DEFINE(_X86_)
1756 ;;
1757 x86_64-*)
1758 if test -n "$_WIN32_MSVC"; then
1759 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1760 fi
1761 AC_DEFINE(_AMD64_)
1762 ;;
1763 *)
1764 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1765 ;;
1766 esac
1767 ;;
1768
1769 *-netbsd*)
1770 DSO_CFLAGS=''
1771 CFLAGS="$CFLAGS -Dunix"
1772 CXXFLAGS="$CXXFLAGS -Dunix"
1773 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1774 DLL_SUFFIX=".so"
1775 DSO_PIC_CFLAGS='-fPIC -DPIC'
1776 DSO_LDOPTS='-shared'
1777 BIN_FLAGS='-Wl,--export-dynamic'
1778 else
1779 DSO_PIC_CFLAGS='-fPIC -DPIC'
1780 DLL_SUFFIX=".so.1.0"
1781 DSO_LDOPTS='-shared'
1782 fi
1783 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1784 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
1785 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
1786 if test "$LIBRUNPATH"; then
1787 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1788 fi
1789 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
1790 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
1791 ;;
1792
1793 *-openbsd*)
1794 DLL_SUFFIX=".so.1.0"
1795 DSO_CFLAGS=''
1796 DSO_PIC_CFLAGS='-fPIC'
1797 DSO_LDOPTS='-shared -fPIC'
1798 if test "$LIBRUNPATH"; then
1799 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1800 fi
1801 ;;
1802
1803 *-solaris*)
1804 AC_DEFINE(SOLARIS)
1805 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
1806 if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
1807 NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
1808 NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
1809 NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
1810 fi
1811 MOZ_FIX_LINK_PATHS=
1812 # $ORIGIN/.. is for shared libraries under components/ to locate shared
1813 # libraries one level up (e.g. libnspr4.so)
1814 if test "$SOLARIS_SUNPRO_CC"; then
1815 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
1816 LIBS="-lCrun -lCstd -lc $LIBS"
1817 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1818 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
1819 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
1820 LDFLAGS="-xildoff $LDFLAGS"
1821 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
1822 _SAVE_LDFLAGS=$LDFLAGS
1823 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
1824 AC_TRY_LINK([#include <stdio.h>],
1825 [printf("Hello World\n");],
1826 ,
1827 [LDFLAGS=$_SAVE_LDFLAGS])
1828 fi
1829 MOZ_OPTIMIZE_FLAGS="-xO4"
1830 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1831 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
1832 MKSHLIB_FORCE_ALL='-z allextract'
1833 MKSHLIB_UNFORCE_ALL='-z defaultextract'
1834 DSO_LDOPTS='-G'
1835 AR_LIST="$AR t"
1836 AR_EXTRACT="$AR x"
1837 AR_DELETE="$AR d"
1838 AR='$(CXX) -xar'
1839 AR_FLAGS='-o $@'
1840 AS='/usr/ccs/bin/as'
1841 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
1842 AS_DASH_C_FLAG=''
1843 TARGET_COMPILER_ABI="sunc"
1844 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
1845 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
1846 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
1847 AC_LANG_SAVE
1848 AC_LANG_CPLUSPLUS
1849 AC_TRY_COMPILE([],
1850 [#if (__SUNPRO_CC < 0x590)
1851 #error "Denied"
1852 #endif],
1853 _BAD_COMPILER=,_BAD_COMPILER=1)
1854 if test -n "$_BAD_COMPILER"; then
1855 _res="no"
1856 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
1857 else
1858 _res="yes"
1859 fi
1860 AC_TRY_COMPILE([],
1861 [#if (__SUNPRO_CC >= 0x5100)
1862 #error "Sun C++ 5.10 or above"
1863 #endif],
1864 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
1865 if test "$_ABOVE_SS12U1"; then
1866 # disable xannotate
1867 CXXFLAGS="$CXXFLAGS -xannotate=no"
1868 fi
1869 AC_MSG_RESULT([$_res])
1870 AC_LANG_RESTORE
1871 else
1872 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
1873 LIBS="-lc $LIBS"
1874 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
1875 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
1876 ASFLAGS="$ASFLAGS -fPIC"
1877 DSO_LDOPTS='-shared'
1878 WARNINGS_AS_ERRORS='-Werror'
1879 _WARNINGS_CFLAGS=''
1880 _WARNINGS_CXXFLAGS=''
1881 if test "$OS_RELEASE" = "5.3"; then
1882 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
1883 fi
1884 fi
1885 if test "$OS_RELEASE" = "5.5.1"; then
1886 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
1887 fi
1888 ;;
1889
1890 *-sunos*)
1891 DSO_LDOPTS='-Bdynamic'
1892 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
1893 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
1894 AC_DEFINE(SUNOS4)
1895 AC_DEFINE(SPRINTF_RETURNS_STRING)
1896 case "$(target_os)" in
1897 sunos4.1*)
1898 DLL_SUFFIX='.so.1.0'
1899 ;;
1900 esac
1901 ;;
1902
1903 esac
1904
1905 dnl Only one oddball right now (QNX), but this gives us flexibility
1906 dnl if any other platforms need to override this in the future.
1907 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1908
1909 dnl ========================================================
1910 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
1911 dnl by now will not have any way to link most binaries (tests
1912 dnl as well as viewer, apprunner, etc.), because some symbols
1913 dnl will be left out of the "composite" .so's by ld as unneeded.
1914 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
1915 dnl they can link in the static libs that provide the missing
1916 dnl symbols.
1917 dnl ========================================================
1918 NO_LD_ARCHIVE_FLAGS=
1919 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
1920 NO_LD_ARCHIVE_FLAGS=1
1921 fi
1922 case "$target" in
1923 *-aix4.3*|*-aix5*)
1924 NO_LD_ARCHIVE_FLAGS=
1925 ;;
1926 *-mingw*)
1927 if test -z "$GNU_CC"; then
1928 NO_LD_ARCHIVE_FLAGS=
1929 fi
1930 ;;
1931 esac
1932 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
1933
1934 dnl ========================================================
1935 dnl = Flags to strip unused symbols from .so components
1936 dnl ========================================================
1937 case "$target" in
1938 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1939 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1940 ;;
1941 *-solaris*)
1942 if test -z "$GNU_CC"; then
1943 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
1944 else
1945 if test -z "$GCC_USE_GNU_LD"; then
1946 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
1947 else
1948 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1949 fi
1950 fi
1951 ;;
1952 *-darwin*)
1953 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
1954 ;;
1955 *-mingw*)
1956 if test -n "$GNU_CC"; then
1957 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1958 fi
1959 ;;
1960 esac
1961
1962 if test -z "$COMPILE_ENVIRONMENT"; then
1963 SKIP_COMPILER_CHECKS=1
1964 SKIP_LIBRARY_CHECKS=1
1965 fi
1966
1967 dnl Configure JIT support
1968
1969 case "$target" in
1970 i?86-*)
1971 ENABLE_ION=1
1972 ENABLE_YARR_JIT=1
1973 AC_DEFINE(JS_CPU_X86)
1974 AC_DEFINE(JS_NUNBOX32)
1975 ;;
1976 x86_64*-*)
1977 ENABLE_ION=1
1978 ENABLE_YARR_JIT=1
1979 AC_DEFINE(JS_CPU_X64)
1980 AC_DEFINE(JS_PUNBOX64)
1981 ;;
1982 arm*-*)
1983 ENABLE_ION=1
1984 ENABLE_YARR_JIT=1
1985 AC_DEFINE(JS_CPU_ARM)
1986 AC_DEFINE(JS_NUNBOX32)
1987 ;;
1988 sparc*-*)
1989 if test ! "$HAVE_64BIT_OS" ; then
1990 dnl ENABLE_ION=0
1991 AC_DEFINE(JS_CPU_SPARC)
1992 AC_DEFINE(JS_NUNBOX32)
1993 fi
1994 ;;
1995 mips*-*)
1996 AC_DEFINE(JS_CPU_MIPS)
1997 AC_DEFINE(JS_NUNBOX32)
1998 ;;
1999 esac
2000
2001 MOZ_ARG_DISABLE_BOOL(ion,
2002 [ --disable-ion Disable use of the IonMonkey JIT],
2003 ENABLE_ION= )
2004
2005 MOZ_ARG_DISABLE_BOOL(yarr-jit,
2006 [ --disable-yarr-jit Disable YARR JIT support],
2007 ENABLE_YARR_JIT= )
2008
2009 AC_SUBST(ENABLE_METHODJIT_SPEW)
2010
2011 AC_SUBST(ENABLE_ION)
2012
2013 if test "$ENABLE_ION"; then
2014 AC_DEFINE(JS_ION)
2015 fi
2016
2017 AC_SUBST(ENABLE_YARR_JIT)
2018
2019 if test "$ENABLE_YARR_JIT"; then
2020 AC_DEFINE(ENABLE_YARR_JIT)
2021 fi
2022
2023 if test -n "$COMPILE_ENVIRONMENT"; then
2024 MOZ_COMPILER_OPTS
2025 fi
2026
2027 if test -z "$SKIP_COMPILER_CHECKS"; then
2028 dnl Checks for typedefs, structures, and compiler characteristics.
2029 dnl ========================================================
2030 AC_HEADER_STDC
2031 AC_C_CONST
2032 AC_TYPE_MODE_T
2033 AC_TYPE_OFF_T
2034 AC_TYPE_PID_T
2035 AC_TYPE_SIZE_T
2036 AC_LANG_CPLUSPLUS
2037 AC_LANG_C
2038 AC_MSG_CHECKING(for ssize_t)
2039 AC_CACHE_VAL(ac_cv_type_ssize_t,
2040 [AC_TRY_COMPILE([#include <stdio.h>
2041 #include <sys/types.h>],
2042 [ssize_t foo = 0;],
2043 [ac_cv_type_ssize_t=true],
2044 [ac_cv_type_ssize_t=false])])
2045 if test "$ac_cv_type_ssize_t" = true ; then
2046 AC_DEFINE(HAVE_SSIZE_T)
2047 AC_MSG_RESULT(yes)
2048 else
2049 AC_MSG_RESULT(no)
2050 fi
2051 AC_STRUCT_ST_BLKSIZE
2052 AC_MSG_CHECKING(for siginfo_t)
2053 AC_CACHE_VAL(ac_cv_siginfo_t,
2054 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2055 #include <signal.h>],
2056 [siginfo_t* info;],
2057 [ac_cv_siginfo_t=true],
2058 [ac_cv_siginfo_t=false])])
2059 if test "$ac_cv_siginfo_t" = true ; then
2060 AC_DEFINE(HAVE_SIGINFO_T)
2061 AC_MSG_RESULT(yes)
2062 else
2063 AC_MSG_RESULT(no)
2064 fi
2065
2066 MOZ_CHECK_HEADERS(endian.h)
2067 if test "$ac_cv_header_endian_h" = yes; then
2068 AC_DEFINE(JS_HAVE_ENDIAN_H)
2069 fi
2070
2071 MOZ_CHECK_HEADERS([machine/endian.h],[],[],[#include <sys/types.h>])
2072 if test "$ac_cv_header_machine_endian_h" = yes; then
2073 AC_DEFINE(JS_HAVE_MACHINE_ENDIAN_H)
2074 fi
2075
2076 MOZ_CHECK_HEADERS(sys/isa_defs.h)
2077 if test "$ac_cv_header_sys_isa_defs_h" = yes; then
2078 AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H)
2079 fi
2080
2081 AC_LANG_CPLUSPLUS
2082
2083 MOZ_CXX11
2084
2085 dnl Check for .hidden assembler directive and visibility attribute.
2086 dnl Borrowed from glibc configure.in
2087 dnl ===============================================================
2088 if test "$GNU_CC"; then
2089 AC_CACHE_CHECK(for visibility(hidden) attribute,
2090 ac_cv_visibility_hidden,
2091 [cat > conftest.c <<EOF
2092 int foo __attribute__ ((visibility ("hidden"))) = 1;
2093 EOF
2094 ac_cv_visibility_hidden=no
2095 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2096 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2097 ac_cv_visibility_hidden=yes
2098 fi
2099 fi
2100 rm -f conftest.[cs]
2101 ])
2102 if test "$ac_cv_visibility_hidden" = "yes"; then
2103 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2104
2105 AC_CACHE_CHECK(for visibility(default) attribute,
2106 ac_cv_visibility_default,
2107 [cat > conftest.c <<EOF
2108 int foo __attribute__ ((visibility ("default"))) = 1;
2109 EOF
2110 ac_cv_visibility_default=no
2111 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2112 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2113 ac_cv_visibility_default=yes
2114 fi
2115 fi
2116 rm -f conftest.[cs]
2117 ])
2118 if test "$ac_cv_visibility_default" = "yes"; then
2119 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2120
2121 AC_CACHE_CHECK(for visibility pragma support,
2122 ac_cv_visibility_pragma,
2123 [cat > conftest.c <<EOF
2124 #pragma GCC visibility push(hidden)
2125 int foo_hidden = 1;
2126 #pragma GCC visibility push(default)
2127 int foo_default = 1;
2128 EOF
2129 ac_cv_visibility_pragma=no
2130 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2131 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2132 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2133 ac_cv_visibility_pragma=yes
2134 fi
2135 fi
2136 fi
2137 rm -f conftest.[cs]
2138 ])
2139 if test "$ac_cv_visibility_pragma" = "yes"; then
2140 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2141 ac_cv_have_visibility_class_bug,
2142 [cat > conftest.c <<EOF
2143 #pragma GCC visibility push(hidden)
2144 struct __attribute__ ((visibility ("default"))) TestStruct {
2145 static void Init();
2146 };
2147 __attribute__ ((visibility ("default"))) void TestFunc() {
2148 TestStruct::Init();
2149 }
2150 EOF
2151 ac_cv_have_visibility_class_bug=no
2152 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2153 ac_cv_have_visibility_class_bug=yes
2154 else
2155 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2156 ac_cv_have_visibility_class_bug=yes
2157 fi
2158 fi
2159 rm -rf conftest.{c,S}
2160 ])
2161
2162 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2163 ac_cv_have_visibility_builtin_bug,
2164 [cat > conftest.c <<EOF
2165 #pragma GCC visibility push(hidden)
2166 #pragma GCC visibility push(default)
2167 #include <string.h>
2168 #pragma GCC visibility pop
2169
2170 __attribute__ ((visibility ("default"))) void Func() {
2171 char c[[100]];
2172 memset(c, 0, sizeof(c));
2173 }
2174 EOF
2175 ac_cv_have_visibility_builtin_bug=no
2176 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2177 ac_cv_have_visibility_builtin_bug=yes
2178 else
2179 if test `grep -c "@PLT" conftest.S` = 0; then
2180 ac_cv_visibility_builtin_bug=yes
2181 fi
2182 fi
2183 rm -f conftest.{c,S}
2184 ])
2185 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2186 "$ac_cv_have_visibility_class_bug" = "no"; then
2187 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2188 WRAP_SYSTEM_INCLUDES=1
2189 else
2190 VISIBILITY_FLAGS='-fvisibility=hidden'
2191 fi # have visibility pragma bug
2192 fi # have visibility pragma
2193 fi # have visibility(default) attribute
2194 fi # have visibility(hidden) attribute
2195 fi # GNU_CC
2196
2197 # visibility hidden flag for Sun Studio on Solaris
2198 if test "$SOLARIS_SUNPRO_CC"; then
2199 VISIBILITY_FLAGS='-xldscope=hidden'
2200 fi # Sun Studio on Solaris
2201
2202 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2203 AC_SUBST(VISIBILITY_FLAGS)
2204
2205 MOZ_GCC_PR49911
2206 MOZ_GCC_PR39608
2207 if test "$OS_TARGET" != WINNT; then
2208 # Only run this test with clang on non-Windows platforms, because clang
2209 # cannot do enough code gen for now to make this test work correctly.
2210 MOZ_LLVM_PR8927
2211 fi
2212
2213 dnl Checks for header files.
2214 dnl ========================================================
2215 AC_HEADER_DIRENT
2216 case "$target_os" in
2217 freebsd*)
2218 # for stuff like -lXshm
2219 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2220 ;;
2221 esac
2222 MOZ_CHECK_COMMON_HEADERS
2223
2224 dnl These are all the places some variant of statfs can be hiding.
2225 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2226
2227 dnl Quota support
2228 MOZ_CHECK_HEADERS(sys/quota.h)
2229 MOZ_CHECK_HEADERS(linux/quota.h)
2230
2231 AC_ARG_ENABLE(dtrace,
2232 [ --enable-dtrace build with dtrace support if available (default=no)],
2233 [enable_dtrace="yes"],)
2234 if test "x$enable_dtrace" = "xyes"; then
2235 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2236 if test -n "$HAVE_DTRACE"; then
2237 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2238 else
2239 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2240 fi
2241 fi
2242 AC_SUBST(HAVE_DTRACE)
2243
2244 case $target in
2245 *-aix4.3*|*-aix5*)
2246 ;;
2247 *)
2248 MOZ_CHECK_HEADERS(sys/cdefs.h)
2249 ;;
2250 esac
2251
2252 MOZ_LINUX_PERF_EVENT
2253
2254 dnl Checks for libraries.
2255 dnl ========================================================
2256 case $target in
2257 *-hpux11.*)
2258 ;;
2259 *)
2260 AC_CHECK_LIB(c_r, gethostbyname_r)
2261 ;;
2262 esac
2263
2264 dnl We don't want to link with libdl even if it's present on OS X, since
2265 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2266 dnl in libc.
2267 dnl We don't want to link against libm or libpthread on Darwin since
2268 dnl they both are just symlinks to libSystem and explicitly linking
2269 dnl against libSystem causes issues when debugging (see bug 299601).
2270 case $target in
2271 *-darwin*)
2272 ;;
2273 *)
2274 AC_SEARCH_LIBS(dlopen, dl,
2275 MOZ_CHECK_HEADER(dlfcn.h,
2276 AC_DEFINE(HAVE_DLOPEN)))
2277 ;;
2278 esac
2279
2280 if test ! "$GNU_CXX"; then
2281
2282 case $target in
2283 *-aix*)
2284 AC_CHECK_LIB(C_r, demangle)
2285 ;;
2286 *)
2287 AC_CHECK_LIB(C, demangle)
2288 ;;
2289 esac
2290 fi
2291
2292 AC_CHECK_LIB(socket, socket)
2293
2294 dnl ========================================================
2295 dnl = pthread support
2296 dnl = Start by checking whether the system support pthreads
2297 dnl ========================================================
2298 case "$target_os" in
2299 darwin*)
2300 USE_PTHREADS=1
2301 ;;
2302 *)
2303 MOZ_CHECK_PTHREADS(pthreads,
2304 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2305 MOZ_CHECK_PTHREADS(pthread,
2306 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2307 MOZ_CHECK_PTHREADS(c_r,
2308 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2309 MOZ_CHECK_PTHREADS(c,
2310 USE_PTHREADS=1
2311 )
2312 )
2313 )
2314 )
2315 ;;
2316 esac
2317
2318 dnl ========================================================
2319 dnl Check the command line for --with-pthreads
2320 dnl ========================================================
2321 MOZ_ARG_WITH_BOOL(pthreads,
2322 [ --with-pthreads Force use of system pthread library with NSPR ],
2323 [ if test "$USE_PTHREADS"x = x; then
2324 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2325 fi],
2326 USE_PTHREADS=
2327 _PTHREAD_LDFLAGS=
2328 )
2329
2330 dnl ========================================================
2331 dnl Do the platform specific pthread hackery
2332 dnl ========================================================
2333 if test "$USE_PTHREADS"x != x
2334 then
2335 dnl
2336 dnl See if -pthread is supported.
2337 dnl
2338 rm -f conftest*
2339 ac_cv_have_dash_pthread=no
2340 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2341 echo 'int main() { return 0; }' | cat > conftest.c
2342 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2343 if test $? -eq 0; then
2344 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2345 ac_cv_have_dash_pthread=yes
2346 case "$target_os" in
2347 freebsd*)
2348 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2349 ;;
2350 *)
2351 CFLAGS="$CFLAGS -pthread"
2352 CXXFLAGS="$CXXFLAGS -pthread"
2353 ;;
2354 esac
2355 fi
2356 fi
2357 rm -f conftest*
2358 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2359
2360 dnl
2361 dnl See if -pthreads is supported.
2362 dnl
2363 ac_cv_have_dash_pthreads=no
2364 if test "$ac_cv_have_dash_pthread" = "no"; then
2365 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2366 echo 'int main() { return 0; }' | cat > conftest.c
2367 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2368 if test $? -eq 0; then
2369 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2370 ac_cv_have_dash_pthreads=yes
2371 CFLAGS="$CFLAGS -pthreads"
2372 CXXFLAGS="$CXXFLAGS -pthreads"
2373 fi
2374 fi
2375 rm -f conftest*
2376 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2377 fi
2378
2379 case "$target" in
2380 *-*-freebsd*)
2381 AC_DEFINE(_REENTRANT)
2382 AC_DEFINE(_THREAD_SAFE)
2383 dnl -pthread links in -lpthread, so don't specify it explicitly.
2384 if test "$ac_cv_have_dash_pthread" = "yes"; then
2385 _PTHREAD_LDFLAGS="-pthread"
2386 fi
2387 ;;
2388
2389 *-*-openbsd*|*-*-bsdi*)
2390 AC_DEFINE(_REENTRANT)
2391 AC_DEFINE(_THREAD_SAFE)
2392 dnl -pthread links in -lc_r, so don't specify it explicitly.
2393 if test "$ac_cv_have_dash_pthread" = "yes"; then
2394 _PTHREAD_LDFLAGS="-pthread"
2395 fi
2396 ;;
2397
2398 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2399 AC_DEFINE(_REENTRANT)
2400 ;;
2401
2402 *-aix4.3*|*-aix5*)
2403 AC_DEFINE(_REENTRANT)
2404 ;;
2405
2406 *-hpux11.*)
2407 AC_DEFINE(_REENTRANT)
2408 ;;
2409
2410 *-*-solaris*)
2411 AC_DEFINE(_REENTRANT)
2412 if test "$SOLARIS_SUNPRO_CC"; then
2413 CFLAGS="$CFLAGS -mt"
2414 CXXFLAGS="$CXXFLAGS -mt"
2415 fi
2416 ;;
2417 esac
2418 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2419 fi
2420
2421
2422 dnl Checks for library functions.
2423 dnl ========================================================
2424 AC_PROG_GCC_TRADITIONAL
2425 AC_FUNC_MEMCMP
2426 AC_CHECK_FUNCS([getc_unlocked _getc_nolock localtime_r])
2427
2428
2429 dnl Checks for math functions.
2430 dnl ========================================================
2431 AC_CHECK_LIB(m, sin)
2432 AC_CHECK_FUNCS([log2 log1p expm1 sqrt1pm1 acosh asinh atanh trunc cbrt])
2433
2434
2435 dnl check for wcrtomb/mbrtowc
2436 dnl =======================================================================
2437 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
2438 AC_LANG_SAVE
2439 AC_LANG_CPLUSPLUS
2440 AC_CACHE_CHECK(for wcrtomb,
2441 ac_cv_have_wcrtomb,
2442 [AC_TRY_LINK([#include <wchar.h>],
2443 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
2444 ac_cv_have_wcrtomb="yes",
2445 ac_cv_have_wcrtomb="no")])
2446 if test "$ac_cv_have_wcrtomb" = "yes"; then
2447 AC_DEFINE(HAVE_WCRTOMB)
2448 fi
2449 AC_CACHE_CHECK(for mbrtowc,
2450 ac_cv_have_mbrtowc,
2451 [AC_TRY_LINK([#include <wchar.h>],
2452 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
2453 ac_cv_have_mbrtowc="yes",
2454 ac_cv_have_mbrtowc="no")])
2455 if test "$ac_cv_have_mbrtowc" = "yes"; then
2456 AC_DEFINE(HAVE_MBRTOWC)
2457 fi
2458 AC_LANG_RESTORE
2459 fi
2460
2461 AC_CACHE_CHECK(
2462 [for res_ninit()],
2463 ac_cv_func_res_ninit,
2464 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
2465 dnl no need for res_ninit() on NetBSD and OpenBSD
2466 ac_cv_func_res_ninit=no
2467 else
2468 AC_TRY_LINK([
2469 #ifdef linux
2470 #define _BSD_SOURCE 1
2471 #endif
2472 #include <sys/types.h>
2473 #include <netinet/in.h>
2474 #include <arpa/nameser.h>
2475 #include <resolv.h>
2476 ],
2477 [int foo = res_ninit(&_res);],
2478 [ac_cv_func_res_ninit=yes],
2479 [ac_cv_func_res_ninit=no])
2480 fi
2481 ])
2482
2483 if test "$ac_cv_func_res_ninit" = "yes"; then
2484 AC_DEFINE(HAVE_RES_NINIT)
2485 dnl must add the link line we do something as foolish as this... dougt
2486 dnl else
2487 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
2488 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
2489 fi
2490
2491 AM_LANGINFO_CODESET
2492
2493 AC_LANG_C
2494
2495 dnl **********************
2496 dnl *** va_copy checks ***
2497 dnl **********************
2498 AC_CACHE_CHECK([for an implementation of va_copy()],
2499 ac_cv_va_copy,
2500 [AC_TRY_COMPILE([#include <stdarg.h>
2501 #include <stdlib.h>
2502 void f (int i, ...) {
2503 va_list args1, args2;
2504 va_start (args1, i);
2505 va_copy (args2, args1);
2506 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2507 exit (1);
2508 va_end (args1); va_end (args2);
2509 }],
2510 [f(0, 42); return 0],
2511 [ac_cv_va_copy=yes],
2512 [ac_cv_va_copy=no]
2513 )]
2514 )
2515 AC_CACHE_CHECK([whether va_list can be copied by value],
2516 ac_cv_va_val_copy,
2517 [AC_TRY_COMPILE([#include <stdarg.h>
2518 #include <stdlib.h>
2519 void f (int i, ...) {
2520 va_list args1, args2;
2521 va_start (args1, i);
2522 args2 = args1;
2523 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2524 exit (1);
2525 va_end (args1); va_end (args2);
2526 }],
2527 [f(0, 42); return 0],
2528 [ac_cv_va_val_copy=yes],
2529 [ac_cv_va_val_copy=no],
2530 )]
2531 )
2532 if test "x$ac_cv_va_copy" = "xyes"; then
2533 AC_DEFINE(VA_COPY, va_copy)
2534 AC_DEFINE(HAVE_VA_COPY)
2535 fi
2536
2537 if test "x$ac_cv_va_val_copy" = "xno"; then
2538 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2539 fi
2540
2541 dnl ===================================================================
2542 dnl ========================================================
2543 dnl Put your C++ language/feature checks below
2544 dnl ========================================================
2545 AC_LANG_CPLUSPLUS
2546
2547 ARM_ABI_PREFIX=
2548 if test "$GNU_CC"; then
2549 if test "$CPU_ARCH" = "arm" ; then
2550 AC_CACHE_CHECK(for ARM EABI,
2551 ac_cv_gcc_arm_eabi,
2552 [AC_TRY_COMPILE([],
2553 [
2554 #if defined(__ARM_EABI__)
2555 return 0;
2556 #else
2557 #error Not ARM EABI.
2558 #endif
2559 ],
2560 ac_cv_gcc_arm_eabi="yes",
2561 ac_cv_gcc_arm_eabi="no")])
2562 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
2563 HAVE_ARM_EABI=1
2564 ARM_ABI_PREFIX=eabi-
2565 else
2566 ARM_ABI_PREFIX=oabi-
2567 fi
2568 fi
2569
2570 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
2571 fi
2572
2573 dnl Check to see if we can resolve ambiguity with |using|.
2574 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
2575 ac_cv_cpp_ambiguity_resolving_using,
2576 [AC_TRY_COMPILE(class X {
2577 public: int go(const X&) {return 3;}
2578 int jo(const X&) {return 3;}
2579 };
2580 class Y : public X {
2581 public: int go(int) {return 2;}
2582 int jo(int) {return 2;}
2583 using X::jo;
2584 private: using X::go;
2585 };,
2586 X x; Y y; y.jo(x);,
2587 ac_cv_cpp_ambiguity_resolving_using=yes,
2588 ac_cv_cpp_ambiguity_resolving_using=no)])
2589 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
2590 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
2591 fi
2592
2593 dnl See if a dynamic_cast to void* gives the most derived object.
2594 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
2595 ac_cv_cpp_dynamic_cast_void_ptr,
2596 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
2597 class Y { int j; public: virtual ~Y() { } };
2598 class Z : public X, public Y { int k; };
2599
2600 int main() {
2601 Z mdo;
2602 X *subx = (X*)&mdo;
2603 Y *suby = (Y*)&mdo;
2604 return !((((void*)&mdo != (void*)subx) &&
2605 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
2606 (((void*)&mdo != (void*)suby) &&
2607 ((void*)&mdo == dynamic_cast<void*>(suby))));
2608 }],
2609 ac_cv_cpp_dynamic_cast_void_ptr=yes,
2610 ac_cv_cpp_dynamic_cast_void_ptr=no,
2611 ac_cv_cpp_dynamic_cast_void_ptr=no)])
2612 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
2613 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
2614 fi
2615
2616
2617 dnl note that this one is reversed - if the test fails, then
2618 dnl we require implementations of unused virtual methods. Which
2619 dnl really blows because it means we'll have useless vtable
2620 dnl bloat.
2621 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
2622 ac_cv_cpp_unused_required,
2623 [AC_TRY_LINK(class X {private: virtual void never_called();};,
2624 X x;,
2625 ac_cv_cpp_unused_required=no,
2626 ac_cv_cpp_unused_required=yes)])
2627 if test "$ac_cv_cpp_unused_required" = yes ; then
2628 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
2629 fi
2630
2631
2632 dnl Some compilers have trouble comparing a constant reference to a templatized
2633 dnl class to zero, and require an explicit operator==() to be defined that takes
2634 dnl an int. This test separates the strong from the weak.
2635
2636 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
2637 ac_cv_trouble_comparing_to_zero,
2638 [AC_TRY_COMPILE([#include <algorithm>
2639 template <class T> class Foo {};
2640 class T2;
2641 template <class T> int operator==(const T2*, const T&) { return 0; }
2642 template <class T> int operator!=(const T2*, const T&) { return 0; }],
2643 [Foo<int> f; return (0 != f);],
2644 ac_cv_trouble_comparing_to_zero=no,
2645 ac_cv_trouble_comparing_to_zero=yes)])
2646 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
2647 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
2648 fi
2649
2650 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
2651 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
2652 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
2653 # linking XUL.
2654 _SAVE_LDFLAGS=$LDFLAGS
2655 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
2656 AC_CACHE_CHECK(for __thread keyword for TLS variables,
2657 ac_cv_thread_keyword,
2658 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
2659 [return tlsIsMainThread;],
2660 ac_cv_thread_keyword=yes,
2661 ac_cv_thread_keyword=no)])
2662 LDFLAGS=$_SAVE_LDFLAGS
2663 if test "$ac_cv_thread_keyword" = yes; then
2664 # mips builds fail with TLS variables because of a binutils bug.
2665 # See bug 528687
2666 case "${target}" in
2667 mips*-*)
2668 :
2669 ;;
2670 *-android*|*-linuxandroid*)
2671 :
2672 ;;
2673 *)
2674 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
2675 ;;
2676 esac
2677 fi
2678
2679 dnl See if compiler supports some gcc-style attributes
2680
2681 AC_CACHE_CHECK(for __attribute__((always_inline)),
2682 ac_cv_attribute_always_inline,
2683 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
2684 [],
2685 ac_cv_attribute_always_inline=yes,
2686 ac_cv_attribute_always_inline=no)])
2687
2688 AC_CACHE_CHECK(for __attribute__((malloc)),
2689 ac_cv_attribute_malloc,
2690 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
2691 [],
2692 ac_cv_attribute_malloc=yes,
2693 ac_cv_attribute_malloc=no)])
2694
2695 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
2696 ac_cv_attribute_warn_unused,
2697 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
2698 [],
2699 ac_cv_attribute_warn_unused=yes,
2700 ac_cv_attribute_warn_unused=no)])
2701
2702 dnl End of C++ language/feature checks
2703 AC_LANG_C
2704
2705 dnl ========================================================
2706 dnl = Internationalization checks
2707 dnl ========================================================
2708 dnl
2709 dnl Internationalization and Locale support is different
2710 dnl on various UNIX platforms. Checks for specific i18n
2711 dnl features go here.
2712
2713 dnl check for LC_MESSAGES
2714 AC_CACHE_CHECK(for LC_MESSAGES,
2715 ac_cv_i18n_lc_messages,
2716 [AC_TRY_COMPILE([#include <locale.h>],
2717 [int category = LC_MESSAGES;],
2718 ac_cv_i18n_lc_messages=yes,
2719 ac_cv_i18n_lc_messages=no)])
2720 if test "$ac_cv_i18n_lc_messages" = yes; then
2721 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
2722 fi
2723
2724 AC_HAVE_FUNCS(localeconv)
2725 fi # ! SKIP_COMPILER_CHECKS
2726
2727 TARGET_XPCOM_ABI=
2728 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
2729 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
2730 fi
2731
2732 dnl Mozilla specific options
2733 dnl ========================================================
2734 dnl The macros used for command line options
2735 dnl are defined in build/autoconf/altoptions.m4.
2736
2737 dnl If the compiler supports these attributes, define them as
2738 dnl convenience macros.
2739 if test "$ac_cv_attribute_malloc" = yes ; then
2740 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
2741 else
2742 AC_DEFINE(NS_ATTR_MALLOC,)
2743 fi
2744
2745 if test "$ac_cv_attribute_warn_unused" = yes ; then
2746 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
2747 else
2748 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
2749 fi
2750
2751 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
2752 dnl features that Windows actually does support.
2753
2754 if test -n "$SKIP_COMPILER_CHECKS"; then
2755 dnl Windows has malloc.h
2756 AC_DEFINE(MALLOC_H, [<malloc.h>])
2757 AC_DEFINE(HAVE_FORCEINLINE)
2758 AC_DEFINE(HAVE_LOCALECONV)
2759 fi # SKIP_COMPILER_CHECKS
2760
2761 dnl ========================================================
2762 dnl = Mozilla update channel, used for disabling features
2763 dnl = not wanted for release.
2764 dnl ========================================================
2765
2766 # app update channel is 'default' when not supplied.
2767 MOZ_ARG_ENABLE_STRING([update-channel],
2768 [ --enable-update-channel=CHANNEL
2769 Select application update channel (default=default)],
2770 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
2771
2772 if test -z "$MOZ_UPDATE_CHANNEL"; then
2773 MOZ_UPDATE_CHANNEL=default
2774 fi
2775 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
2776 AC_SUBST(MOZ_UPDATE_CHANNEL)
2777
2778
2779 dnl set GRE_MILESTONE
2780 dnl ========================================================
2781 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
2782 AC_SUBST(GRE_MILESTONE)
2783
2784 dnl set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
2785 dnl The logic works like this:
2786 dnl - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
2787 dnl - otherwise, we're building Release/Beta (define RELEASE_BUILD)
2788 case "$GRE_MILESTONE" in
2789 *a1*)
2790 NIGHTLY_BUILD=1
2791 AC_DEFINE(NIGHTLY_BUILD)
2792 ;;
2793 *)
2794 RELEASE_BUILD=1
2795 AC_DEFINE(RELEASE_BUILD)
2796 ;;
2797 esac
2798 AC_SUBST(NIGHTLY_BUILD)
2799 AC_SUBST(RELEASE_BUILD)
2800
2801 dnl ========================================================
2802 dnl Disable compiling sources in unified mode.
2803 dnl ========================================================
2804
2805 if test -z "$NIGHTLY_BUILD"; then
2806 MOZ_DISABLE_UNIFIED_COMPILATION=1
2807 fi
2808
2809 MOZ_ARG_DISABLE_BOOL(unified-compilation,
2810 [ --disable-unified-compilation
2811 Disable unified compilation of some C/C++ sources],
2812 MOZ_DISABLE_UNIFIED_COMPILATION=1,
2813 MOZ_DISABLE_UNIFIED_COMPILATION=)
2814 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
2815
2816 dnl ========================================================
2817 dnl =
2818 dnl = Check for external package dependencies
2819 dnl =
2820 dnl ========================================================
2821 MOZ_ARG_HEADER(External Packages)
2822
2823 dnl ========================================================
2824 dnl = Find the right NSPR to use.
2825 dnl ========================================================
2826 MOZ_ARG_WITH_BOOL(system-nspr,
2827 [ --with-system-nspr Use an NSPR that is already built and installed.
2828 Use the 'nspr-config' script in the current path,
2829 or look for the script in the directories given with
2830 --with-nspr-exec-prefix or --with-nspr-prefix.
2831 (Those flags are only checked if you specify
2832 --with-system-nspr.)],
2833 _USE_SYSTEM_NSPR=1 )
2834
2835 MOZ_ARG_WITH_STRING(nspr-cflags,
2836 [ --with-nspr-cflags=FLAGS
2837 Pass FLAGS to CC when building code that uses NSPR.
2838 Use this when there's no accurate nspr-config
2839 script available. This is the case when building
2840 SpiderMonkey as part of the Mozilla tree: the
2841 top-level configure script computes NSPR flags
2842 that accomodate the quirks of that environment.],
2843 NSPR_CFLAGS=$withval)
2844 MOZ_ARG_WITH_STRING(nspr-libs,
2845 [ --with-nspr-libs=LIBS Pass LIBS to LD when linking code that uses NSPR.
2846 See --with-nspr-cflags for more details.],
2847 NSPR_LIBS=$withval)
2848 AC_SUBST(NSPR_CFLAGS)
2849 AC_SUBST(NSPR_LIBS)
2850
2851 JS_THREADSAFE=1
2852 MOZ_ARG_DISABLE_BOOL(threadsafe,
2853 [ --disable-threadsafe Disable support for multiple threads.],
2854 JS_THREADSAFE= ,
2855 JS_THREADSAFE=1 )
2856 if test -n "$JS_THREADSAFE"; then
2857 AC_DEFINE(JS_THREADSAFE)
2858 fi
2859
2860 if test "$_USE_SYSTEM_NSPR" || (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
2861 _HAS_NSPR=1
2862 fi
2863
2864 case "$target" in
2865 *linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*)
2866 if test -z "$_HAS_NSPR" && test "$JS_THREADSAFE"; then
2867 JS_POSIX_NSPR_DEFAULT=1
2868 fi
2869 ;;
2870 esac
2871
2872 MOZ_ARG_ENABLE_BOOL(posix-nspr-emulation,
2873 [ --enable-posix-nspr-emulation
2874 Enable emulation of NSPR for POSIX systems],
2875 JS_POSIX_NSPR=1,
2876 JS_POSIX_NSPR=,
2877 JS_POSIX_NSPR="$JS_POSIX_NSPR_DEFAULT" )
2878 if test -n "$JS_POSIX_NSPR"; then
2879 AC_DEFINE(JS_POSIX_NSPR)
2880 fi
2881
2882 AC_SUBST(JS_POSIX_NSPR)
2883
2884 dnl Pass either --with-system-nspr or (--with-nspr-cflags and
2885 dnl --with-nspr-libs), but not both.
2886 if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
2887 AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
2888 See 'configure --help'.])
2889 fi
2890
2891 dnl Can't use --enable-posix-nspr-emulation if compiling with NSPR.
2892 if test "$_HAS_NSPR" && test "$JS_POSIX_NSPR"; then
2893 AC_MSG_ERROR([--enable-posix-nspr-emulation is mututally exclusive with --with-system-nspr
2894 and --with-nspr-libs/cflags. See 'configure --help'.])
2895 fi
2896
2897 if test -n "$_USE_SYSTEM_NSPR"; then
2898 MOZ_NATIVE_NSPR=
2899 AM_PATH_NSPR($NSPR_MINVER, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
2900 fi
2901
2902 NSPR_PKGCONF_CHECK="nspr"
2903 if test -n "$MOZ_NATIVE_NSPR"; then
2904 # piggy back on $MOZ_NATIVE_NSPR to set a variable for the nspr check for js.pc
2905 NSPR_PKGCONF_CHECK="nspr >= $NSPR_MINVER"
2906
2907 _SAVE_CFLAGS=$CFLAGS
2908 CFLAGS="$CFLAGS $NSPR_CFLAGS"
2909 AC_TRY_COMPILE([#include "prlog.h"],
2910 [#ifndef PR_STATIC_ASSERT
2911 #error PR_STATIC_ASSERT not defined
2912 #endif],
2913 [MOZ_NATIVE_NSPR=1],
2914 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
2915 CFLAGS=$_SAVE_CFLAGS
2916 fi
2917 AC_SUBST(NSPR_PKGCONF_CHECK)
2918
2919 dnl ========================================================
2920 dnl system zlib Support
2921 dnl ========================================================
2922 dnl Standalone js defaults to system zlib
2923 ZLIB_DIR=yes
2924
2925 MOZ_ZLIB_CHECK([1.2.3])
2926
2927 if test -n "$ZLIB_IN_MOZGLUE"; then
2928 AC_DEFINE(ZLIB_IN_MOZGLUE)
2929 fi
2930
2931 dnl ========================================================
2932 dnl system libffi Support
2933 dnl ========================================================
2934 MOZ_CONFIG_FFI()
2935
2936 dnl ========================================================
2937 dnl =
2938 dnl = Application
2939 dnl =
2940 dnl ========================================================
2941
2942 MOZ_ARG_HEADER(Application)
2943
2944 ENABLE_TESTS=1
2945
2946 USE_ARM_KUSER=
2947
2948 case "${target}" in
2949 arm*-android*|arm*-linuxandroid*)
2950 USE_ARM_KUSER=1
2951 ;;
2952 esac
2953
2954 dnl ========================================================
2955 dnl Use ARM userspace kernel helpers; tell NSPR to enable
2956 dnl their usage and use them in spidermonkey.
2957 dnl ========================================================
2958 MOZ_ARG_WITH_BOOL(arm-kuser,
2959 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
2960 USE_ARM_KUSER=1,)
2961 if test -n "$USE_ARM_KUSER"; then
2962 AC_DEFINE(USE_ARM_KUSER)
2963 fi
2964
2965 dnl ========================================================
2966 dnl =
2967 dnl = Components & Features
2968 dnl =
2969 dnl ========================================================
2970 MOZ_ARG_HEADER(Components and Features)
2971
2972 dnl ========================================================
2973 dnl = Localization
2974 dnl ========================================================
2975 MOZ_ARG_ENABLE_STRING(ui-locale,
2976 [ --enable-ui-locale=ab-CD
2977 Select the user interface locale (default: en-US)],
2978 MOZ_UI_LOCALE=$enableval )
2979 AC_SUBST(MOZ_UI_LOCALE)
2980
2981 dnl ========================================================
2982 dnl build the tests by default
2983 dnl ========================================================
2984 MOZ_ARG_DISABLE_BOOL(tests,
2985 [ --disable-tests Do not build test libraries & programs],
2986 ENABLE_TESTS=,
2987 ENABLE_TESTS=1 )
2988
2989 dnl ========================================================
2990 dnl =
2991 dnl = Module specific options
2992 dnl =
2993 dnl ========================================================
2994 MOZ_ARG_HEADER(Individual module options)
2995
2996 dnl ========================================================
2997 dnl =
2998 dnl = Debugging Options
2999 dnl =
3000 dnl ========================================================
3001 MOZ_ARG_HEADER(Debugging and Optimizations)
3002
3003 if test "$ENABLE_METHODJIT_SPEW"; then
3004 AC_DEFINE(JS_METHODJIT_SPEW)
3005 fi
3006
3007 dnl ========================================================
3008 dnl = Enable code optimization. ON by default.
3009 dnl ========================================================
3010 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
3011 MOZ_OPTIMIZE_FLAGS="-O"
3012 fi
3013
3014 MOZ_ARG_ENABLE_STRING(optimize,
3015 [ --disable-optimize Disable compiler optimization
3016 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
3017 [ if test "$enableval" != "no"; then
3018 MOZ_OPTIMIZE=1
3019 if test -n "$enableval" -a "$enableval" != "yes"; then
3020 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
3021 MOZ_OPTIMIZE=2
3022 fi
3023 else
3024 MOZ_OPTIMIZE=
3025 fi ], MOZ_OPTIMIZE=1)
3026
3027 MOZ_SET_FRAMEPTR_FLAGS
3028
3029 if test "$COMPILE_ENVIRONMENT"; then
3030 if test -n "$MOZ_OPTIMIZE"; then
3031 AC_MSG_CHECKING([for valid optimization flags])
3032 _SAVE_CFLAGS=$CFLAGS
3033 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3034 AC_TRY_COMPILE([#include <stdio.h>],
3035 [printf("Hello World\n");],
3036 _results=yes,
3037 _results=no)
3038 AC_MSG_RESULT([$_results])
3039 if test "$_results" = "no"; then
3040 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
3041 fi
3042 CFLAGS=$_SAVE_CFLAGS
3043 fi
3044 fi # COMPILE_ENVIRONMENT
3045
3046 AC_SUBST(MOZ_OPTIMIZE)
3047 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
3048 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
3049 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
3050 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
3051 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
3052
3053 dnl ========================================================
3054 dnl = Enable trace logging
3055 dnl ========================================================
3056 MOZ_ARG_ENABLE_BOOL(trace-logging,
3057 [ --enable-trace-logging Enable trace logging],
3058 ENABLE_TRACE_LOGGING=1,
3059 ENABLE_TRACE_LOGGING= )
3060
3061 AC_SUBST(ENABLE_TRACE_LOGGING)
3062
3063 if test "$ENABLE_TRACE_LOGGING"; then
3064 AC_DEFINE(JS_TRACE_LOGGING)
3065 fi
3066
3067 dnl ========================================================
3068 dnl = Enable any treating of compile warnings as errors
3069 dnl ========================================================
3070 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
3071 [ --enable-warnings-as-errors
3072 Enable treating of warnings as errors],
3073 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
3074 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
3075 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3076 WARNINGS_AS_ERRORS=''
3077 elif test "$GNU_CC"; then
3078 # Prevent the following GCC warnings from being treated as errors:
3079 # -Wuninitialized - too many false positives
3080 # -Wmaybe-uninitialized - too many false positives
3081 # -Wdeprecated-declarations - we don't want our builds held hostage when a
3082 # platform-specific API becomes deprecated.
3083 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
3084 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
3085 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
3086 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
3087 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
3088 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
3089 fi
3090
3091 dnl ========================================================
3092 dnl = Enable treating compile warnings as errors
3093 dnl ========================================================
3094 MOZ_ARG_ENABLE_BOOL(sm-fail-on-warnings,
3095 [ --enable-sm-fail-on-warnings
3096 Enable warnings as errors],
3097 FAIL_ON_WARNINGS=1,
3098 FAIL_ON_WARNINGS= )
3099
3100 AC_SUBST(FAIL_ON_WARNINGS)
3101
3102 dnl ========================================================
3103 dnl = Enable trace malloc
3104 dnl ========================================================
3105 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
3106 MOZ_ARG_ENABLE_BOOL(trace-malloc,
3107 [ --enable-trace-malloc Enable malloc tracing],
3108 NS_TRACE_MALLOC=1,
3109 NS_TRACE_MALLOC= )
3110 if test "$NS_TRACE_MALLOC"; then
3111 # Please, Mr. Linker Man, don't take away our symbol names
3112 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
3113 AC_DEFINE(NS_TRACE_MALLOC)
3114 fi
3115 AC_SUBST(NS_TRACE_MALLOC)
3116
3117 dnl ========================================================
3118 dnl = Enable DMD
3119 dnl ========================================================
3120
3121 MOZ_ARG_ENABLE_BOOL(dmd,
3122 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
3123 MOZ_DMD=1,
3124 MOZ_DMD= )
3125
3126 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
3127 MOZ_DMD=
3128 fi
3129 if test "$MOZ_DMD"; then
3130 AC_DEFINE(MOZ_DMD)
3131
3132 if test "${CPU_ARCH}" = "arm"; then
3133 CFLAGS="$CFLAGS -funwind-tables"
3134 CXXFLAGS="$CXXFLAGS -funwind-tables"
3135 fi
3136 fi
3137
3138 dnl ========================================================
3139 dnl = Enable jemalloc
3140 dnl ========================================================
3141 MOZ_ARG_ENABLE_BOOL(jemalloc,
3142 [ --enable-jemalloc Replace memory allocator with jemalloc],
3143 MOZ_MEMORY=1,
3144 MOZ_MEMORY=)
3145
3146 if test "$NS_TRACE_MALLOC"; then
3147 MOZ_MEMORY=
3148 fi
3149
3150 if test "$MOZ_MEMORY"; then
3151 AC_DEFINE(MOZ_MEMORY)
3152 if test "x$MOZ_DEBUG" = "x1"; then
3153 AC_DEFINE(MOZ_MEMORY_DEBUG)
3154 fi
3155 dnl The generic feature tests that determine how to compute ncpus are long and
3156 dnl complicated. Therefore, simply define special cpp variables for the
3157 dnl platforms we have special knowledge of.
3158 case "${target}" in
3159 *-darwin*)
3160 AC_DEFINE(MOZ_MEMORY_DARWIN)
3161 ;;
3162 *-*freebsd*)
3163 AC_DEFINE(MOZ_MEMORY_BSD)
3164 ;;
3165 *-android*|*-linuxandroid*)
3166 AC_DEFINE(MOZ_MEMORY_LINUX)
3167 AC_DEFINE(MOZ_MEMORY_ANDROID)
3168 ;;
3169 *-*linux*)
3170 AC_DEFINE(MOZ_MEMORY_LINUX)
3171 ;;
3172 *-netbsd*)
3173 AC_DEFINE(MOZ_MEMORY_BSD)
3174 ;;
3175 *-solaris*)
3176 AC_DEFINE(MOZ_MEMORY_SOLARIS)
3177 ;;
3178 *-mingw*)
3179 AC_DEFINE(MOZ_MEMORY_WINDOWS)
3180 # the interesting bits will get passed down in MOZ_GLUE_LDFLAGS
3181 ;;
3182 *)
3183 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
3184 ;;
3185 esac
3186 fi
3187 AC_SUBST(MOZ_MEMORY)
3188 AC_SUBST(MOZ_GLUE_LDFLAGS)
3189 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
3190
3191 dnl ========================================================
3192 dnl = Use malloc wrapper lib
3193 dnl ========================================================
3194 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
3195 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
3196 _WRAP_MALLOC=1,
3197 _WRAP_MALLOC= )
3198
3199 if test -n "$_WRAP_MALLOC"; then
3200 if test "$GNU_CC"; then
3201 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
3202 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
3203 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
3204 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
3205 dnl Wrap operator new and operator delete on Android.
3206 if test "$OS_TARGET" = "Android"; then
3207 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
3208 fi
3209 else
3210 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
3211 fi
3212 fi
3213
3214 dnl ========================================================
3215 dnl = Location of malloc wrapper lib
3216 dnl ========================================================
3217 MOZ_ARG_WITH_STRING(wrap-malloc,
3218 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
3219 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
3220
3221 dnl ========================================================
3222 dnl = Use JS Call tracing
3223 dnl ========================================================
3224 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
3225 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
3226 MOZ_TRACE_JSCALLS=1,
3227 MOZ_TRACE_JSCALLS= )
3228 if test -n "$MOZ_TRACE_JSCALLS"; then
3229 AC_DEFINE(MOZ_TRACE_JSCALLS)
3230 fi
3231
3232 dnl ========================================================
3233 dnl = Use incremental GC
3234 dnl ========================================================
3235 JSGC_INCREMENTAL=1
3236 MOZ_ARG_DISABLE_BOOL(gcincremental,
3237 [ --disable-gcincremental Disable incremental GC],
3238 JSGC_INCREMENTAL= )
3239 if test -n "$JSGC_INCREMENTAL"; then
3240 AC_DEFINE(JSGC_INCREMENTAL)
3241 fi
3242
3243 dnl ========================================================
3244 dnl = Use generational GC
3245 dnl ========================================================
3246 MOZ_ARG_ENABLE_BOOL(gcgenerational,
3247 [ --enable-gcgenerational Enable generational GC],
3248 JSGC_GENERATIONAL=1,
3249 JSGC_GENERATIONAL= )
3250 if test -n "$JSGC_GENERATIONAL"; then
3251 AC_DEFINE(JSGC_GENERATIONAL)
3252 fi
3253
3254 dnl ========================================================
3255 dnl = Use exact stack rooting for GC
3256 dnl ========================================================
3257 MOZ_ARG_DISABLE_BOOL(exact-rooting,
3258 [ --enable-exact-rooting Enable use of conservative stack scanning for GC],
3259 JSGC_USE_EXACT_ROOTING=1 ,
3260 JSGC_USE_EXACT_ROOTING= )
3261 if test -n "$JSGC_USE_EXACT_ROOTING"; then
3262 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
3263 fi
3264
3265 dnl ========================================================
3266 dnl = Use Valgrind
3267 dnl ========================================================
3268 MOZ_ARG_ENABLE_BOOL(valgrind,
3269 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
3270 MOZ_VALGRIND=1,
3271 MOZ_VALGRIND= )
3272 if test -n "$MOZ_VALGRIND"; then
3273 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
3274 AC_MSG_ERROR(
3275 [--enable-valgrind specified but Valgrind is not installed]))
3276 AC_DEFINE(MOZ_VALGRIND)
3277 MOZ_VALGRIND=1
3278 fi
3279 AC_SUBST(MOZ_VALGRIND)
3280
3281 dnl ========================================================
3282 dnl = Use ARM JIT code simulator. Requires an x86 build.
3283 dnl ========================================================
3284 dnl Also define JS_CODEGEN_ARM in this case. If the simulator is not used,
3285 dnl JS_CODEGEN_foo is defined if JS_CPU_foo is defined.
3286 MOZ_ARG_ENABLE_BOOL(arm-simulator,
3287 [ --enable-arm-simulator Enable ARM simulator for JIT code],
3288 JS_ARM_SIMULATOR=1,
3289 JS_ARM_SIMULATOR= )
3290 if test -n "$JS_ARM_SIMULATOR"; then
3291 if test "$CPU_ARCH" != "x86"; then
3292 AC_MSG_ERROR([The ARM simulator only works on x86.])
3293 fi
3294 AC_DEFINE(JS_ARM_SIMULATOR)
3295 AC_DEFINE(JS_CODEGEN_ARM)
3296 JS_CODEGEN_ARM=1
3297 elif test "$CPU_ARCH" = "x86"; then
3298 AC_DEFINE(JS_CODEGEN_X86)
3299 JS_CODEGEN_X86=1
3300 elif test "$CPU_ARCH" = "x86_64"; then
3301 AC_DEFINE(JS_CODEGEN_X64)
3302 JS_CODEGEN_X64=1
3303 elif test "$CPU_ARCH" = "arm"; then
3304 AC_DEFINE(JS_CODEGEN_ARM)
3305 JS_CODEGEN_ARM=1
3306 fi
3307
3308 AC_SUBST(JS_ARM_SIMULATOR)
3309 AC_SUBST(JS_CODEGEN_ARM)
3310 AC_SUBST(JS_CODEGEN_X86)
3311 AC_SUBST(JS_CODEGEN_X64)
3312
3313 dnl ========================================================
3314 dnl jprof
3315 dnl ========================================================
3316 MOZ_ARG_ENABLE_BOOL(jprof,
3317 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
3318 MOZ_JPROF=1,
3319 MOZ_JPROF= )
3320 if test -n "$MOZ_JPROF"; then
3321 MOZ_PROFILING=1
3322 AC_DEFINE(MOZ_JPROF)
3323 fi
3324
3325 dnl ========================================================
3326 dnl shark
3327 dnl ========================================================
3328 MOZ_ARG_ENABLE_BOOL(shark,
3329 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
3330 MOZ_SHARK=1,
3331 MOZ_SHARK= )
3332 if test -n "$MOZ_SHARK"; then
3333 MOZ_PROFILING=1
3334 AC_DEFINE(MOZ_SHARK)
3335 fi
3336
3337 dnl ========================================================
3338 dnl instruments
3339 dnl ========================================================
3340 MOZ_ARG_ENABLE_BOOL(instruments,
3341 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
3342 MOZ_INSTRUMENTS=1,
3343 MOZ_INSTRUMENTS= )
3344 if test -n "$MOZ_INSTRUMENTS"; then
3345 MOZ_PROFILING=1
3346 AC_DEFINE(MOZ_INSTRUMENTS)
3347 LIBS="$LIBS -framework CoreFoundation"
3348 fi
3349
3350 dnl ========================================================
3351 dnl callgrind
3352 dnl ========================================================
3353 MOZ_ARG_ENABLE_BOOL(callgrind,
3354 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
3355 MOZ_CALLGRIND=1,
3356 MOZ_CALLGRIND= )
3357 if test -n "$MOZ_CALLGRIND"; then
3358 MOZ_PROFILING=1
3359 AC_DEFINE(MOZ_CALLGRIND)
3360 fi
3361
3362 dnl ========================================================
3363 dnl vtune
3364 dnl ========================================================
3365 MOZ_ARG_ENABLE_BOOL(vtune,
3366 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
3367 MOZ_VTUNE=1,
3368 MOZ_VTUNE= )
3369
3370 dnl ========================================================
3371 dnl Debug (see Bug 939505)
3372 dnl ========================================================
3373 if test -n "$MOZ_DEBUG"; then
3374 AC_DEFINE(JS_DEBUG)
3375 fi
3376
3377 dnl ========================================================
3378 dnl Profiling
3379 dnl ========================================================
3380 if test -n "$MOZ_PROFILING"; then
3381 AC_DEFINE(MOZ_PROFILING)
3382
3383 case "$OS_TARGET" in
3384 Linux) MOZ_VTUNE=1 ;;
3385 WINNT) MOZ_VTUNE=1 ;;
3386 esac
3387 fi
3388
3389 if test -n "$MOZ_VTUNE"; then
3390 AC_DEFINE(MOZ_VTUNE)
3391 fi
3392
3393 dnl ========================================================
3394 dnl Zealous JavaScript GC
3395 dnl ========================================================
3396 MOZ_ARG_ENABLE_BOOL(gczeal,
3397 [ --enable-gczeal Enable zealous GCing],
3398 JS_GC_ZEAL=1,
3399 JS_GC_ZEAL= )
3400 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
3401 AC_DEFINE(JS_GC_ZEAL)
3402 fi
3403
3404 dnl ========================================================
3405 dnl = Enable perf logging for ion.
3406 dnl = Perf logging is OFF by default
3407 dnl ========================================================
3408 MOZ_ARG_ENABLE_BOOL(perf,
3409 [ --enable-perf Enable Linux perf integration],
3410 JS_ION_PERF=1,
3411 JS_ION_PERF= )
3412 if test -n "$JS_ION_PERF"; then
3413 AC_DEFINE(JS_ION_PERF)
3414 fi
3415
3416 dnl ========================================================
3417 dnl JS opt-mode assertions and minidump instrumentation
3418 dnl ========================================================
3419 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
3420 [ --enable-js-diagnostics
3421 Enable JS diagnostic assertions and breakpad data],
3422 JS_CRASH_DIAGNOSTICS=1,
3423 JS_CRASH_DIAGNOSTICS= )
3424 if test -n "$JS_CRASH_DIAGNOSTICS"; then
3425 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
3426 fi
3427
3428 dnl ========================================================
3429 dnl Enable changes that make the shell more deterministic
3430 dnl ========================================================
3431 MOZ_ARG_ENABLE_BOOL(more-deterministic,
3432 [ --enable-more-deterministic
3433 Enable changes that make the shell more deterministic],
3434 JS_MORE_DETERMINISTIC=1,
3435 JS_MORE_DETERMINISTIC= )
3436 if test -n "$JS_MORE_DETERMINISTIC"; then
3437 AC_DEFINE(JS_MORE_DETERMINISTIC)
3438 fi
3439
3440 dnl ========================================================
3441 dnl Enable breakpoint for artificial OOMs
3442 dnl ========================================================
3443 MOZ_ARG_ENABLE_BOOL(oom-breakpoint,
3444 [ --enable-oom-breakpoint
3445 Enable a breakpoint function for artificial OOMs],
3446 JS_OOM_BREAKPOINT=1,
3447 JS_OOM_BREAKPOINT= )
3448 if test -n "$JS_OOM_BREAKPOINT"; then
3449 AC_DEFINE(JS_OOM_BREAKPOINT)
3450 fi
3451
3452 MOZ_CHECK_CCACHE
3453
3454 dnl ========================================================
3455 dnl = Enable static checking using gcc-dehydra
3456 dnl ========================================================
3457
3458 MOZ_ARG_WITH_STRING(static-checking,
3459 [ --with-static-checking=path/to/gcc_dehydra.so
3460 Enable static checking of code using GCC-dehydra],
3461 DEHYDRA_PATH=$withval,
3462 DEHYDRA_PATH= )
3463
3464 if test -n "$DEHYDRA_PATH"; then
3465 if test ! -f "$DEHYDRA_PATH"; then
3466 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
3467 fi
3468 AC_DEFINE(NS_STATIC_CHECKING)
3469 fi
3470 AC_SUBST(DEHYDRA_PATH)
3471
3472 dnl ========================================================
3473 dnl = Enable using the clang plugin to build
3474 dnl ========================================================
3475
3476 MOZ_ARG_ENABLE_BOOL(clang-plugin,
3477 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
3478 ENABLE_CLANG_PLUGIN=1,
3479 ENABLE_CLANG_PLUGIN= )
3480 if test -n "$ENABLE_CLANG_PLUGIN"; then
3481 if test -z "$CLANG_CC"; then
3482 AC_MSG_ERROR([Can't use clang plugin without clang.])
3483 fi
3484 AC_DEFINE(MOZ_CLANG_PLUGIN)
3485 fi
3486
3487 AC_SUBST(ENABLE_CLANG_PLUGIN)
3488
3489 dnl ========================================================
3490 dnl = Enable static checking using sixgill
3491 dnl ========================================================
3492
3493 MOZ_ARG_WITH_STRING(sixgill,
3494 [ --with-sixgill=path/to/sixgill
3495 Enable static checking of code using sixgill],
3496 SIXGILL_PATH=$withval,
3497 SIXGILL_PATH= )
3498
3499 if test -n "$SIXGILL_PATH"; then
3500 if test ! -x "$SIXGILL_PATH/bin/xdbfind" || test ! -f "$SIXGILL_PATH/gcc/xgill.so" || test ! -x "$SIXGILL_PATH/scripts/wrap_gcc/g++"; then
3501 AC_MSG_ERROR([The sixgill plugin and binaries are not at the specified path.])
3502 fi
3503 fi
3504 AC_SUBST(SIXGILL_PATH)
3505
3506 dnl ========================================================
3507 dnl = Enable stripping of libs & executables
3508 dnl ========================================================
3509 MOZ_ARG_ENABLE_BOOL(strip,
3510 [ --enable-strip Enable stripping of libs & executables ],
3511 ENABLE_STRIP=1,
3512 ENABLE_STRIP= )
3513
3514 dnl ========================================================
3515 dnl = Enable stripping of libs & executables when packaging
3516 dnl ========================================================
3517 MOZ_ARG_ENABLE_BOOL(install-strip,
3518 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3519 PKG_SKIP_STRIP= ,
3520 PKG_SKIP_STRIP=1)
3521
3522 dnl ========================================================
3523 dnl =
3524 dnl = Profiling and Instrumenting
3525 dnl =
3526 dnl ========================================================
3527 MOZ_ARG_HEADER(Profiling and Instrumenting)
3528
3529 dnl ========================================================
3530 dnl = Support for demangling undefined symbols
3531 dnl ========================================================
3532 if test -z "$SKIP_LIBRARY_CHECKS"; then
3533 AC_LANG_SAVE
3534 AC_LANG_CPLUSPLUS
3535 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3536 AC_LANG_RESTORE
3537 fi
3538
3539 # Demangle only for debug or trace-malloc or DMD builds
3540 MOZ_DEMANGLE_SYMBOLS=
3541 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
3542 MOZ_DEMANGLE_SYMBOLS=1
3543 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3544 fi
3545 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3546
3547 dnl ========================================================
3548 dnl JIT observers
3549 dnl ========================================================
3550
3551 MOZ_ARG_WITH_STRING(jitreport-granularity,
3552 [ --jitreport-granularity=N
3553 Default granularity at which to report JIT code
3554 to external tools
3555 0 - no info
3556 1 - code ranges for whole functions only
3557 2 - per-line information
3558 3 - per-op information],
3559 JITREPORT_GRANULARITY=$withval,
3560 JITREPORT_GRANULARITY=3)
3561
3562 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3563
3564 dnl ========================================================
3565 dnl =
3566 dnl = Misc. Options
3567 dnl =
3568 dnl ========================================================
3569 MOZ_ARG_HEADER(Misc. Options)
3570
3571 dnl ========================================================
3572 dnl update xterm title
3573 dnl ========================================================
3574 MOZ_ARG_ENABLE_BOOL(xterm-updates,
3575 [ --enable-xterm-updates Update XTERM titles with current command.],
3576 MOZ_UPDATE_XTERM=1,
3577 MOZ_UPDATE_XTERM= )
3578
3579 if test -z "$SKIP_COMPILER_CHECKS"; then
3580 dnl ========================================================
3581 dnl =
3582 dnl = Compiler Options
3583 dnl =
3584 dnl ========================================================
3585 MOZ_ARG_HEADER(Compiler Options)
3586
3587 dnl ========================================================
3588 dnl Check for gcc -pipe support
3589 dnl ========================================================
3590 AC_MSG_CHECKING([for -pipe support])
3591 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3592 dnl Any gcc that supports firefox supports -pipe.
3593 CFLAGS="$CFLAGS -pipe"
3594 CXXFLAGS="$CXXFLAGS -pipe"
3595 AC_MSG_RESULT([yes])
3596 else
3597 AC_MSG_RESULT([no])
3598 fi
3599
3600 dnl ========================================================
3601 dnl Profile guided optimization (gcc checks)
3602 dnl ========================================================
3603 dnl Test for profiling options
3604 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
3605
3606 _SAVE_CFLAGS="$CFLAGS"
3607 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
3608
3609 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
3610 AC_TRY_COMPILE([], [return 0;],
3611 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
3612 result="yes" ], result="no")
3613 AC_MSG_RESULT([$result])
3614
3615 if test $result = "yes"; then
3616 PROFILE_GEN_LDFLAGS="-fprofile-generate"
3617 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
3618 PROFILE_USE_LDFLAGS="-fprofile-use"
3619 fi
3620
3621 CFLAGS="$_SAVE_CFLAGS"
3622
3623 if test -n "$INTEL_CC"; then
3624 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
3625 PROFILE_GEN_LDFLAGS=
3626 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
3627 PROFILE_USE_LDFLAGS=
3628 fi
3629
3630 dnl Sun Studio on Solaris
3631 if test "$SOLARIS_SUNPRO_CC"; then
3632 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
3633 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
3634 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
3635 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
3636 fi
3637
3638 AC_SUBST(PROFILE_GEN_CFLAGS)
3639 AC_SUBST(PROFILE_GEN_LDFLAGS)
3640 AC_SUBST(PROFILE_USE_CFLAGS)
3641 AC_SUBST(PROFILE_USE_LDFLAGS)
3642
3643 AC_LANG_CPLUSPLUS
3644
3645 dnl ========================================================
3646 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
3647 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
3648 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
3649 dnl ========================================================
3650 _SAVE_CXXFLAGS=$CXXFLAGS
3651 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
3652 AC_CACHE_CHECK(for correct overload resolution with const and templates,
3653 ac_nscap_nonconst_opeq_bug,
3654 [AC_TRY_COMPILE([
3655 template <class T>
3656 class Pointer
3657 {
3658 public:
3659 T* myPtr;
3660 };
3661
3662 template <class T, class U>
3663 int operator==(const Pointer<T>& rhs, U* lhs)
3664 {
3665 return rhs.myPtr == lhs;
3666 }
3667
3668 template <class T, class U>
3669 int operator==(const Pointer<T>& rhs, const U* lhs)
3670 {
3671 return rhs.myPtr == lhs;
3672 }
3673 ],
3674 [
3675 Pointer<int> foo;
3676 const int* bar;
3677 return foo == bar;
3678 ],
3679 ac_nscap_nonconst_opeq_bug="no",
3680 ac_nscap_nonconst_opeq_bug="yes")])
3681 CXXFLAGS="$_SAVE_CXXFLAGS"
3682
3683 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
3684 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
3685 fi
3686
3687 dnl ========================================================
3688 dnl Check for tm_zone, tm_gmtoff in struct tm
3689 dnl ========================================================
3690 AC_CACHE_CHECK(for tm_zone tm_gmtoff in struct tm,
3691 ac_cv_struct_tm_zone_tm_gmtoff,
3692 [AC_TRY_COMPILE([#include <time.h>],
3693 [struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;],
3694 [ac_cv_struct_tm_zone_tm_gmtoff="yes"],
3695 [ac_cv_struct_tm_zone_tm_gmtoff="no"])])
3696 if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
3697 AC_DEFINE(HAVE_TM_ZONE_TM_GMTOFF)
3698 fi
3699 fi # ! SKIP_COMPILER_CHECKS
3700
3701 AC_DEFINE(CPP_THROW_NEW, [throw()])
3702 AC_LANG_C
3703
3704 MOZ_EXPAND_LIBS
3705
3706 dnl ========================================================
3707 dnl =
3708 dnl = Build depencency options
3709 dnl =
3710 dnl ========================================================
3711 MOZ_ARG_HEADER(Build dependencies)
3712
3713 if test "$GNU_CC" -a "$GNU_CXX"; then
3714 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3715 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
3716 elif test "$SOLARIS_SUNPRO_CC"; then
3717 _DEPEND_CFLAGS=
3718 else
3719 dnl Don't override this for MSVC
3720 if test -z "$_WIN32_MSVC"; then
3721 _USE_CPP_INCLUDE_FLAG=
3722 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
3723 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
3724 else
3725 echo '#include <stdio.h>' > dummy-hello.c
3726 changequote(,)
3727 dnl This output is localized, split at the first double space or colon and space.
3728 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*stdio.h\)$"
3729 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3730 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3731 changequote([,])
3732 if ! test -e "$_CL_STDIO_PATH"; then
3733 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3734 fi
3735 if test -z "$CL_INCLUDES_PREFIX"; then
3736 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3737 fi
3738 AC_SUBST(CL_INCLUDES_PREFIX)
3739 rm -f dummy-hello.c
3740
3741 dnl Make sure that the build system can handle non-ASCII characters
3742 dnl in environment variables to prevent it from breaking silently on
3743 dnl non-English systems.
3744 NONASCII=$'\241\241'
3745 AC_SUBST(NONASCII)
3746 fi
3747 fi
3748
3749 dnl ========================================================
3750 dnl = Disable -fstrict-aliasing with GCC 4.4 and earlier.
3751 dnl = See bugs 821502 and 832623.
3752 dnl ========================================================
3753 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
3754 dnl GCC 3.x isn't supported, so we don't need to check for that.
3755 if test "$GCC_MAJOR_VERSION" -eq "4" -a "$GCC_MINOR_VERSION" -lt "5" ; then
3756 CFLAGS="$CFLAGS -fno-strict-aliasing"
3757 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
3758 fi
3759 fi
3760
3761 dnl ========================================================
3762 dnl = Link js shell to system readline
3763 dnl ========================================================
3764 MOZ_ARG_ENABLE_BOOL(readline,
3765 [ --enable-readline Link js shell to system readline library],
3766 JS_WANT_READLINE=1,
3767 JS_WANT_READLINE= )
3768
3769 JS_NATIVE_EDITLINE=
3770 EDITLINE_LIBS=
3771 JS_DISABLE_SHELL=
3772
3773 case "$target" in
3774 *-mingw*)
3775 NO_EDITLINE=1
3776 ;;
3777 *)
3778 ;;
3779 esac
3780
3781 if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then
3782 if test -n "$JS_WANT_READLINE"; then
3783 AC_CHECK_LIB(readline, readline,
3784 EDITLINE_LIBS="-lreadline",
3785 AC_MSG_ERROR([No system readline library found.]))
3786 else
3787 dnl By default, we use editline
3788 JS_NATIVE_EDITLINE=1
3789 EDITLINE_LIBS='$(DEPTH)/js/src/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
3790 fi
3791
3792 dnl Either way, we want to build with line editing support.
3793 AC_DEFINE(EDITLINE)
3794 fi
3795 AC_SUBST(JS_NATIVE_EDITLINE)
3796 AC_SUBST(JS_DISABLE_SHELL)
3797 AC_SUBST(EDITLINE_LIBS)
3798
3799 dnl ========================================================
3800 dnl =
3801 dnl = Standalone module options
3802 dnl =
3803 dnl ========================================================
3804 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3805
3806 dnl ========================================================
3807 dnl = Build jsctypes if it's enabled
3808 dnl ========================================================
3809 MOZ_ARG_ENABLE_BOOL(ctypes,
3810 [ --enable-ctypes Enable js-ctypes (default=no)],
3811 BUILD_CTYPES=1,
3812 BUILD_CTYPES= )
3813 JS_HAS_CTYPES=$BUILD_CTYPES
3814 AC_SUBST(JS_HAS_CTYPES)
3815 AC_SUBST(BUILD_CTYPES)
3816 if test "$JS_HAS_CTYPES"; then
3817 dnl Error out if we're on MSVC and MASM is unavailable.
3818 if test -n "$_MSC_VER" -a \( "$AS" != "ml.exe" -a "$AS" != "ml64.exe" \); then
3819 AC_MSG_ERROR([\"$AS\" is not a suitable assembler to build js-ctypes. If you are building with MS Visual Studio 8 Express, you may download the MASM 8.0 package, upgrade to Visual Studio 9 Express, or install the Vista SDK. Or do not use --enable-ctypes.])
3820 fi
3821 AC_DEFINE(JS_HAS_CTYPES)
3822 fi
3823
3824 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
3825 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
3826 fi
3827
3828 dnl ========================================================
3829 dnl =
3830 dnl = Options for generating the shell as a script
3831 dnl =
3832 dnl ========================================================
3833
3834 MOZ_ARG_WITH_STRING(qemu-exe,
3835 [ --with-qemu-exe=path Use path as an arm emulator on host platforms],
3836 QEMU_EXE=$withval)
3837 AC_SUBST(QEMU_EXE)
3838 MOZ_ARG_WITH_STRING(cross-lib,
3839 [ --with-cross-lib=dir Use dir as the location for arm libraries],
3840 CROSS_LIB=$withval,
3841 CROSS_LIB=/usr/$target)
3842 AC_SUBST(CROSS_LIB)
3843 dnl ========================================================
3844 dnl =
3845 dnl = Maintainer debug option (no --enable equivalent)
3846 dnl =
3847 dnl ========================================================
3848
3849 AC_SUBST(AR)
3850 AC_SUBST(AR_FLAGS)
3851 AC_SUBST(AR_LIST)
3852 AC_SUBST(AR_EXTRACT)
3853 AC_SUBST(AR_DELETE)
3854 AC_SUBST(AS)
3855 AC_SUBST(ASFLAGS)
3856 AC_SUBST(AS_DASH_C_FLAG)
3857 AC_SUBST(LD)
3858 AC_SUBST(RC)
3859 AC_SUBST(RCFLAGS)
3860 AC_SUBST(MC)
3861 AC_SUBST(WINDRES)
3862 AC_SUBST(IMPLIB)
3863 AC_SUBST(FILTER)
3864 AC_SUBST(BIN_FLAGS)
3865 AC_SUBST(MOZ_DEBUG)
3866 AC_SUBST(MOZ_DEBUG_SYMBOLS)
3867 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
3868 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
3869 AC_SUBST(MOZ_DEBUG_LDFLAGS)
3870 AC_SUBST(WARNINGS_AS_ERRORS)
3871 AC_SUBST(MOZ_JPROF)
3872 AC_SUBST(MOZ_SHARK)
3873 AC_SUBST(MOZ_INSTRUMENTS)
3874 AC_SUBST(MOZ_CALLGRIND)
3875 AC_SUBST(MOZ_VTUNE)
3876 AC_SUBST(MOZ_PROFILING)
3877 AC_SUBST(LIBICONV)
3878
3879 AC_SUBST(ENABLE_TESTS)
3880
3881 AC_SUBST(ENABLE_STRIP)
3882 AC_SUBST(PKG_SKIP_STRIP)
3883 AC_SUBST(INCREMENTAL_LINKER)
3884 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
3885 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
3886
3887 AC_SUBST(MOZ_FIX_LINK_PATHS)
3888
3889 AC_SUBST(USE_DEPENDENT_LIBS)
3890
3891 AC_SUBST(MOZ_BUILD_ROOT)
3892
3893 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
3894 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
3895
3896 AC_SUBST(MOZ_APP_NAME)
3897 AC_SUBST(MOZ_APP_DISPLAYNAME)
3898 AC_SUBST(MOZ_APP_VERSION)
3899
3900 AC_SUBST(MOZ_PKG_SPECIAL)
3901
3902 AC_SUBST(MOZILLA_OFFICIAL)
3903
3904 dnl win32 options
3905 AC_SUBST(MOZ_BROWSE_INFO)
3906 AC_SUBST(MOZ_TOOLS_DIR)
3907
3908 dnl Echo the CFLAGS to remove extra whitespace.
3909 CFLAGS=`echo \
3910 $_WARNINGS_CFLAGS \
3911 $CFLAGS`
3912
3913 CXXFLAGS=`echo \
3914 $_WARNINGS_CXXFLAGS \
3915 $CXXFLAGS`
3916
3917 COMPILE_CFLAGS=`echo \
3918 $_DEFINES_CFLAGS \
3919 $_DEPEND_CFLAGS \
3920 $COMPILE_CFLAGS`
3921
3922 COMPILE_CXXFLAGS=`echo \
3923 $_DEFINES_CXXFLAGS \
3924 $_DEPEND_CFLAGS \
3925 $COMPILE_CXXFLAGS`
3926
3927 HOST_CFLAGS=`echo \
3928 $HOST_CFLAGS \
3929 $_DEPEND_CFLAGS`
3930
3931 HOST_CXXFLAGS=`echo \
3932 $HOST_CXXFLAGS \
3933 $_DEPEND_CFLAGS`
3934
3935 AC_SUBST(NSPR_CFLAGS)
3936 AC_SUBST(NSPR_LIBS)
3937 AC_SUBST(MOZ_NATIVE_NSPR)
3938
3939 if test -n "$MOZ_NUWA_PROCESS"; then
3940 AC_DEFINE(MOZ_NUWA_PROCESS)
3941 fi
3942
3943 OS_CFLAGS="$CFLAGS"
3944 OS_CXXFLAGS="$CXXFLAGS"
3945 OS_CPPFLAGS="$CPPFLAGS"
3946 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3947 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3948 OS_LDFLAGS="$LDFLAGS"
3949 OS_LIBS="$LIBS"
3950 AC_SUBST(OS_CFLAGS)
3951 AC_SUBST(OS_CXXFLAGS)
3952 AC_SUBST(OS_CPPFLAGS)
3953 AC_SUBST(OS_COMPILE_CFLAGS)
3954 AC_SUBST(OS_COMPILE_CXXFLAGS)
3955 AC_SUBST(OS_LDFLAGS)
3956 AC_SUBST(OS_LIBS)
3957 AC_SUBST(CROSS_COMPILE)
3958 AC_SUBST(MOZ_METRO)
3959
3960 AC_SUBST(HOST_CC)
3961 AC_SUBST(HOST_CXX)
3962 AC_SUBST(HOST_CFLAGS)
3963 AC_SUBST(HOST_CXXFLAGS)
3964 AC_SUBST(HOST_LDFLAGS)
3965 AC_SUBST(HOST_OPTIMIZE_FLAGS)
3966 AC_SUBST(HOST_AR)
3967 AC_SUBST(HOST_AR_FLAGS)
3968 AC_SUBST(HOST_LD)
3969 AC_SUBST(HOST_RANLIB)
3970 AC_SUBST(HOST_NSPR_MDCPUCFG)
3971 AC_SUBST(HOST_BIN_SUFFIX)
3972 AC_SUBST(HOST_OS_ARCH)
3973
3974 AC_SUBST(TARGET_CPU)
3975 AC_SUBST(TARGET_VENDOR)
3976 AC_SUBST(TARGET_OS)
3977 AC_SUBST(TARGET_NSPR_MDCPUCFG)
3978 AC_SUBST(TARGET_MD_ARCH)
3979 AC_SUBST(TARGET_XPCOM_ABI)
3980 AC_SUBST(OS_TARGET)
3981 AC_SUBST(OS_ARCH)
3982 AC_SUBST(OS_RELEASE)
3983 AC_SUBST(OS_TEST)
3984 AC_SUBST(CPU_ARCH)
3985 AC_SUBST(INTEL_ARCHITECTURE)
3986
3987 AC_SUBST(WRAP_LDFLAGS)
3988 AC_SUBST(MKSHLIB)
3989 AC_SUBST(MKCSHLIB)
3990 AC_SUBST(MKSHLIB_FORCE_ALL)
3991 AC_SUBST(MKSHLIB_UNFORCE_ALL)
3992 AC_SUBST(DSO_CFLAGS)
3993 AC_SUBST(DSO_PIC_CFLAGS)
3994 AC_SUBST(DSO_LDOPTS)
3995 AC_SUBST(LIB_PREFIX)
3996 AC_SUBST(DLL_PREFIX)
3997 AC_SUBST(DLL_SUFFIX)
3998 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
3999 AC_SUBST(LIB_SUFFIX)
4000 AC_SUBST(OBJ_SUFFIX)
4001 AC_SUBST(BIN_SUFFIX)
4002 AC_SUBST(ASM_SUFFIX)
4003 AC_SUBST(IMPORT_LIB_SUFFIX)
4004 AC_SUBST(USE_N32)
4005 AC_SUBST(CC_VERSION)
4006 AC_SUBST(CXX_VERSION)
4007 AC_SUBST(MSMANIFEST_TOOL)
4008 AC_SUBST(MOZ_LINKER)
4009
4010 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4011
4012 dnl Check for missing components
4013 if test "$COMPILE_ENVIRONMENT"; then
4014 if test "$MOZ_X11"; then
4015 dnl ====================================================
4016 dnl = Check if X headers exist
4017 dnl ====================================================
4018 _SAVE_CFLAGS=$CFLAGS
4019 CFLAGS="$CFLAGS $XCFLAGS"
4020 AC_TRY_COMPILE([
4021 #include <stdio.h>
4022 #include <stdlib.h>
4023 #include <X11/Xlib.h>
4024 #include <X11/Intrinsic.h>
4025 ],
4026 [
4027 Display *dpy = 0;
4028 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4029 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4030 exit(1);
4031 }
4032 ], [],
4033 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4034 CFLAGS="$_SAVE_CFLAGS"
4035
4036 if test -n "$MISSING_X"; then
4037 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4038 fi
4039
4040 fi # MOZ_X11
4041 fi # COMPILE_ENVIRONMENT
4042
4043 dnl Set various defines and substitutions
4044 dnl ========================================================
4045
4046 if test "$OS_ARCH" = "Darwin"; then
4047 AC_DEFINE(XP_MACOSX)
4048 AC_DEFINE(XP_UNIX)
4049 elif test "$OS_ARCH" != "WINNT"; then
4050 AC_DEFINE(XP_UNIX)
4051 fi
4052
4053 if test "$MOZ_DEBUG"; then
4054 AC_DEFINE(MOZ_REFLOW_PERF)
4055 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4056 fi
4057
4058 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4059 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4060 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4061 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4062 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4063 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4064 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4065 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4066 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4067 fi
4068
4069
4070 dnl ========================================================
4071 dnl ECMAScript Internationalization API Support (uses ICU)
4072 dnl ========================================================
4073
4074 dnl top-level configure may override this with --without-intl-api
4075 _INTL_API=yes
4076
4077 MOZ_CONFIG_ICU()
4078
4079 MOZ_SUBCONFIGURE_ICU()
4080
4081 dnl ========================================================
4082 dnl JavaScript shell
4083 dnl ========================================================
4084
4085 AC_HAVE_FUNCS(setlocale)
4086 AC_HAVE_FUNCS(localeconv)
4087
4088 AC_SUBST(MOZILLA_VERSION)
4089
4090 AC_SUBST(ac_configure_args)
4091
4092 AC_SUBST(TOOLCHAIN_PREFIX)
4093
4094
4095 if test -n "$JS_STANDALONE"; then
4096 MOZ_APP_NAME="mozjs"
4097 MOZ_APP_VERSION="$MOZILLA_SYMBOLVERSION"
4098 JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION"
4099 else
4100 JS_LIBRARY_NAME="mozjs"
4101 fi
4102 JS_CONFIG_LIBS="$NSPR_LIBS $LIBS"
4103 if test -n "$GNU_CC"; then
4104 JS_CONFIG_MOZ_JS_LIBS='-L${libdir} -l${JS_LIBRARY_NAME}'
4105 else
4106 JS_CONFIG_MOZ_JS_LIBS='${libdir}/${JS_LIBRARY_NAME}.lib'
4107 fi
4108 AC_SUBST(JS_LIBRARY_NAME)
4109 AC_SUBST(JS_CONFIG_MOZ_JS_LIBS)
4110 AC_SUBST(JS_CONFIG_LIBS)
4111
4112 MOZ_SUBCONFIGURE_FFI()
4113
4114 dnl Spit out some output
4115 dnl ========================================================
4116 MOZ_CREATE_CONFIG_STATUS()
4117
4118 if test "$JS_STANDALONE"; then
4119 MOZ_RUN_CONFIG_STATUS()
4120 fi

mercurial