2 ##------------------------------------------------------------##
4 # The multiple-architecture stuff in this file is pretty
5 # cryptic. Read docs/internals/multiple-architectures.txt
6 # for at least a partial explanation of what is going on.
8 ##------------------------------------------------------------##
10 # Process this file with autoconf to produce a configure script.
11 AC_INIT(Valgrind, 3.7.0.SVN, valgrind-users@lists.sourceforge.net)
12 AC_CONFIG_SRCDIR(coregrind/m_main.c)
13 AM_CONFIG_HEADER(config.h)
14 AM_INIT_AUTOMAKE([foreign])
18 #----------------------------------------------------------------------------
19 # Checks for various programs.
20 #----------------------------------------------------------------------------
21 CFLAGS="-Wno-long-long $CFLAGS"
28 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
29 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
30 # base (eg. most likely as Darwin-specific tests) we'll need one of the
32 # - put AC_PROG_OBJC in a Darwin-specific part of this file
33 # - Use AC_PROG_OBJC here and up the minimum autoconf version
34 # - Use the following, which is apparently equivalent:
35 # m4_ifdef([AC_PROG_OBJC],
37 # [AC_CHECK_TOOL([OBJC], [gcc])
39 # AC_SUBST([OBJCFLAGS])
42 # provide a very basic definition for AC_PROG_SED if it's not provided by
43 # autoconf (as e.g. in autoconf 2.59).
44 m4_ifndef([AC_PROG_SED],
45 [AC_DEFUN([AC_PROG_SED],
47 AC_CHECK_PROGS([SED],[gsed sed])])])
50 # If no AR variable was specified, look up the name of the archiver. Otherwise
51 # do not touch the AR variable.
52 if test "x$AR" = "x"; then
53 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
55 AC_ARG_VAR([AR],[Archiver command])
57 # Check for the compiler support
58 if test "${GCC}" != "yes" ; then
59 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
62 # figure out where perl lives
63 AC_PATH_PROG(PERL, perl)
65 # figure out where gdb lives
66 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
67 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
69 # some older automake's don't have it so try something on our own
70 ifdef([AM_PROG_AS],[AM_PROG_AS],
80 # Check if 'diff' supports -u (universal diffs) and use it if possible.
82 AC_MSG_CHECKING([for diff -u])
85 # Comparing two identical files results in 0, unless -u isn't supported (as
87 tmpfile="tmp-xxx-yyy-zzz"
89 if diff -u $tmpfile $tmpfile ; then
99 # We don't want gcc < 3.0
100 AC_MSG_CHECKING([for a supported version of gcc])
102 [gcc_version=`${CC} --version | head -n 1 | $SED 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
104 case "${gcc_version}" in
106 AC_MSG_RESULT([no (${gcc_version})])
107 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
110 AC_MSG_RESULT([ok (${gcc_version})])
114 #----------------------------------------------------------------------------
115 # Arch/OS/platform tests.
116 #----------------------------------------------------------------------------
117 # We create a number of arch/OS/platform-related variables. We prefix them
118 # all with "VGCONF_" which indicates that they are defined at
119 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
120 # variables used when compiling C files.
124 AC_MSG_CHECKING([for a supported CPU])
126 # ARCH_MAX reflects the most that this CPU can do: for example if it
127 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
128 # Ditto for amd64. It is used for more configuration below, but is not used
130 case "${host_cpu}" in
132 AC_MSG_RESULT([ok (${host_cpu})])
137 AC_MSG_RESULT([ok (${host_cpu})])
142 # This value can only happen on Linux, not on AIX
143 AC_MSG_RESULT([ok (${host_cpu})])
148 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
149 # Whereas in Linux that means only a 32-bit capable CPU.
150 AC_MSG_RESULT([ok (${host_cpu})])
162 AC_MSG_RESULT([ok (${host_cpu})])
167 AC_MSG_RESULT([ok (${host_cpu})])
172 AC_MSG_RESULT([no (${host_cpu})])
173 AC_MSG_ERROR([Unsupported host architecture. Sorry])
177 #----------------------------------------------------------------------------
179 # Sometimes it's convenient to subvert the bi-arch build system and
180 # just have a single build even though the underlying platform is
181 # capable of both. Hence handle --enable-only64bit and
182 # --enable-only32bit. Complain if both are issued :-)
183 # [Actually, if either of these options are used, I think both get built,
184 # but only one gets installed. So if you use an in-place build, both can be
187 # Check if a 64-bit only build has been requested
188 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
189 [AC_ARG_ENABLE(only64bit,
190 [ --enable-only64bit do a 64-bit only build],
191 [vg_cv_only64bit=$enableval],
192 [vg_cv_only64bit=no])])
194 # Check if a 32-bit only build has been requested
195 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
196 [AC_ARG_ENABLE(only32bit,
197 [ --enable-only32bit do a 32-bit only build],
198 [vg_cv_only32bit=$enableval],
199 [vg_cv_only32bit=no])])
202 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
204 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
207 #----------------------------------------------------------------------------
209 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
210 # compilation of many C files via -VGO_$(VGCONF_OS) and
211 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
212 AC_MSG_CHECKING([for a supported OS])
220 AC_MSG_RESULT([ok (${host_os})])
223 # Ok, this is linux. Check the kernel version
224 AC_MSG_CHECKING([for the kernel version])
230 AC_MSG_RESULT([2.6 family (${kernel})])
231 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
235 AC_MSG_RESULT([2.4 family (${kernel})])
236 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
240 AC_MSG_RESULT([unsupported (${kernel})])
241 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
248 AC_MSG_RESULT([ok (${host_os})])
252 AC_MSG_RESULT([ok (${host_os})])
256 AC_MSG_RESULT([ok (${host_os})])
261 AC_MSG_RESULT([ok (${host_os})])
263 DEFAULT_SUPP="pthread_l4re.supp"
267 AC_MSG_RESULT([ok (${host_os})])
269 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
270 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
271 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
273 AC_MSG_CHECKING([for the kernel version])
276 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
277 # has only one relevant version, the OS version. The `uname` check
278 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
279 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard),
280 # and we don't know of an macros similar to __GLIBC__ to get that info.
282 # XXX: `uname -r` won't do the right thing for cross-compiles, but
283 # that's not a problem yet.
286 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
287 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
288 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
289 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
292 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
293 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
294 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
295 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
298 AC_MSG_RESULT([unsupported (${kernel})])
299 AC_MSG_ERROR([Valgrind works on Darwin 9.x and 10.x (Mac OS X 10.5 and 10.6)])
305 AC_MSG_RESULT([no (${host_os})])
306 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
310 #----------------------------------------------------------------------------
312 # If we are building on a 64 bit platform test to see if the system
313 # supports building 32 bit programs and disable 32 bit support if it
314 # does not support building 32 bit programs
316 case "$ARCH_MAX-$VGCONF_OS" in
317 amd64-linux|ppc64-linux)
318 AC_MSG_CHECKING([for 32 bit build support])
327 vg_cv_only64bit="yes"
330 CFLAGS=$safe_CFLAGS;;
333 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
335 [--enable-only32bit was specified but system does not support 32 bit builds])
338 #----------------------------------------------------------------------------
340 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
341 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
342 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
343 # above) will be "amd64" since that reflects the most that this cpu can do,
344 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
345 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
346 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
347 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
348 AC_SUBST(VGCONF_ARCH_PRI)
350 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
351 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
352 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
353 # It is empty if there is no secondary target.
354 AC_SUBST(VGCONF_ARCH_SEC)
356 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
357 # The entire system, including regression and performance tests, will be
358 # built for this target. The "_CAPS" indicates that the name is in capital
359 # letters, and it also uses '_' rather than '-' as a separator, because it's
360 # used to create various Makefile variables, which are all in caps by
361 # convention and cannot contain '-' characters. This is in contrast to
362 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
363 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
365 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
366 # Valgrind and tools will also be built for this target, but not the
367 # regression or performance tests.
369 # By default, the primary arch is the same as the "max" arch, as commented
370 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
371 # the big case statement just below here, in the case where we're building
372 # on a 64 bit machine but have been requested only to do a 32 bit build.
373 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
375 AC_MSG_CHECKING([for a supported CPU/OS combination])
377 # NB. The load address for a given platform may be specified in more
378 # than one place, in some cases, depending on whether we're doing a biarch,
379 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
380 # Be careful to give consistent values in all subcases. Also, all four
381 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
382 # even if it is to "0xUNSET".
384 case "$ARCH_MAX-$VGCONF_OS" in
386 VGCONF_ARCH_PRI="x86"
388 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
389 VGCONF_PLATFORM_SEC_CAPS=""
390 valt_load_address_pri_norml="0x38000000"
391 valt_load_address_pri_inner="0x28000000"
392 valt_load_address_sec_norml="0xUNSET"
393 valt_load_address_sec_inner="0xUNSET"
394 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
397 valt_load_address_sec_norml="0xUNSET"
398 valt_load_address_sec_inner="0xUNSET"
399 if test x$vg_cv_only64bit = xyes; then
400 VGCONF_ARCH_PRI="amd64"
402 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
403 VGCONF_PLATFORM_SEC_CAPS=""
404 valt_load_address_pri_norml="0x38000000"
405 valt_load_address_pri_inner="0x28000000"
406 elif test x$vg_cv_only32bit = xyes; then
407 VGCONF_ARCH_PRI="x86"
409 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
410 VGCONF_PLATFORM_SEC_CAPS=""
411 valt_load_address_pri_norml="0x38000000"
412 valt_load_address_pri_inner="0x28000000"
414 VGCONF_ARCH_PRI="amd64"
415 VGCONF_ARCH_SEC="x86"
416 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
417 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
418 valt_load_address_pri_norml="0x38000000"
419 valt_load_address_pri_inner="0x28000000"
420 valt_load_address_sec_norml="0x38000000"
421 valt_load_address_sec_inner="0x28000000"
423 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
426 VGCONF_ARCH_PRI="ppc32"
428 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
429 VGCONF_PLATFORM_SEC_CAPS=""
430 valt_load_address_pri_norml="0x38000000"
431 valt_load_address_pri_inner="0x28000000"
432 valt_load_address_sec_norml="0xUNSET"
433 valt_load_address_sec_inner="0xUNSET"
434 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
437 valt_load_address_pri_norml="0xUNSET"
438 valt_load_address_pri_inner="0xUNSET"
439 valt_load_address_sec_norml="0xUNSET"
440 valt_load_address_sec_inner="0xUNSET"
441 if test x$vg_cv_only64bit = xyes; then
442 VGCONF_ARCH_PRI="ppc64"
444 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
445 VGCONF_PLATFORM_SEC_CAPS=""
446 elif test x$vg_cv_only32bit = xyes; then
447 VGCONF_ARCH_PRI="ppc32"
449 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
450 VGCONF_PLATFORM_SEC_CAPS=""
452 VGCONF_ARCH_PRI="ppc64"
453 VGCONF_ARCH_SEC="ppc32"
454 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
455 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
457 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
460 valt_load_address_sec_norml="0xUNSET"
461 valt_load_address_sec_inner="0xUNSET"
462 if test x$vg_cv_only64bit = xyes; then
463 VGCONF_ARCH_PRI="ppc64"
465 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
466 VGCONF_PLATFORM_SEC_CAPS=""
467 valt_load_address_pri_norml="0x38000000"
468 valt_load_address_pri_inner="0x28000000"
469 elif test x$vg_cv_only32bit = xyes; then
470 VGCONF_ARCH_PRI="ppc32"
472 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
473 VGCONF_PLATFORM_SEC_CAPS=""
474 valt_load_address_pri_norml="0x38000000"
475 valt_load_address_pri_inner="0x28000000"
477 VGCONF_ARCH_PRI="ppc64"
478 VGCONF_ARCH_SEC="ppc32"
479 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
480 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
481 valt_load_address_pri_norml="0x38000000"
482 valt_load_address_pri_inner="0x28000000"
483 valt_load_address_sec_norml="0x38000000"
484 valt_load_address_sec_inner="0x28000000"
486 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
489 VGCONF_ARCH_PRI="x86"
491 VGCONF_PLATFORM_PRI_CAPS="X86_L4RE"
492 VGCONF_PLATFORM_SEC_CAPS=""
493 valt_load_address_pri_norml="0x38000000"
494 valt_load_address_pri_inner="0x28000000"
495 valt_load_address_sec_norml="0x38000000"
496 valt_load_address_sec_inner="0x28000000"
497 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
499 # Darwin gets identified as 32-bit even when it supports 64-bit.
500 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
501 # all Macs support both 32-bit and 64-bit, so we just build both. If
502 # someone has a really old 32-bit only machine they can (hopefully?)
503 # build with --enable-only32bit. See bug 243362.
504 x86-darwin|amd64-darwin)
506 valt_load_address_sec_norml="0xUNSET"
507 valt_load_address_sec_inner="0xUNSET"
508 if test x$vg_cv_only64bit = xyes; then
509 VGCONF_ARCH_PRI="amd64"
511 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
512 VGCONF_PLATFORM_SEC_CAPS=""
513 valt_load_address_pri_norml="0x138000000"
514 valt_load_address_pri_inner="0x128000000"
515 elif test x$vg_cv_only32bit = xyes; then
516 VGCONF_ARCH_PRI="x86"
518 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
519 VGCONF_PLATFORM_SEC_CAPS=""
520 VGCONF_ARCH_PRI_CAPS="x86"
521 valt_load_address_pri_norml="0x38000000"
522 valt_load_address_pri_inner="0x28000000"
524 VGCONF_ARCH_PRI="amd64"
525 VGCONF_ARCH_SEC="x86"
526 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
527 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
528 valt_load_address_pri_norml="0x138000000"
529 valt_load_address_pri_inner="0x128000000"
530 valt_load_address_sec_norml="0x38000000"
531 valt_load_address_sec_inner="0x28000000"
533 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
536 VGCONF_ARCH_PRI="arm"
537 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
538 VGCONF_PLATFORM_SEC_CAPS=""
539 valt_load_address_pri_norml="0x38000000"
540 valt_load_address_pri_inner="0x28000000"
541 valt_load_address_sec_norml="0xUNSET"
542 valt_load_address_sec_inner="0xUNSET"
543 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
546 VGCONF_ARCH_PRI="s390x"
548 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
549 VGCONF_PLATFORM_SEC_CAPS=""
550 # we want to have the generated code close to the dispatcher
551 valt_load_address_pri_norml="0x401000000"
552 valt_load_address_pri_inner="0x410000000"
553 valt_load_address_sec_norml="0xUNSET"
554 valt_load_address_sec_inner="0xUNSET"
555 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
558 VGCONF_ARCH_PRI="unknown"
559 VGCONF_ARCH_SEC="unknown"
560 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
561 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
562 valt_load_address_pri_norml="0xUNSET"
563 valt_load_address_pri_inner="0xUNSET"
564 valt_load_address_sec_norml="0xUNSET"
565 valt_load_address_sec_inner="0xUNSET"
566 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
567 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
571 #----------------------------------------------------------------------------
573 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
575 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
576 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
577 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
578 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
579 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
580 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
581 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
582 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
583 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
584 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
585 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
586 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
587 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
588 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
589 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
590 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
591 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
592 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
593 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
594 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
596 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
598 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
599 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
600 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
601 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
602 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
603 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
604 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
605 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
606 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
607 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
608 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
609 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
610 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
611 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
612 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
614 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
615 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
616 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
617 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
618 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
620 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
621 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
622 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
623 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
624 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
625 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_L4RE,
626 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_L4RE)
629 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
630 # Relies on the assumption that the primary and secondary targets are
631 # for the same OS, so therefore only necessary to test the primary.
632 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
633 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
634 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
635 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
636 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
637 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
638 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX)
639 AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
640 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
641 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
642 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
643 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
644 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
645 AM_CONDITIONAL(VGCONF_OS_IS_L4RE,
646 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_L4RE)
649 # Sometimes, in the Makefile.am files, it's useful to know whether or not
650 # there is a secondary target.
651 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
652 test x$VGCONF_PLATFORM_SEC_CAPS != x)
655 #----------------------------------------------------------------------------
657 #----------------------------------------------------------------------------
659 # Check if this should be built as an inner Valgrind, to be run within
660 # another Valgrind. Choose the load address accordingly.
661 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
662 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
663 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
664 [AC_ARG_ENABLE(inner,
665 [ --enable-inner enables self-hosting],
666 [vg_cv_inner=$enableval],
668 if test "$vg_cv_inner" = yes; then
669 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
670 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
671 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
673 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
674 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
678 #----------------------------------------------------------------------------
679 # Libc and suppressions
680 #----------------------------------------------------------------------------
681 # This variable will collect the suppression files to be used.
682 AC_SUBST(DEFAULT_SUPP)
683 # This variable holds generated suppression files (such as the one used for
685 AC_SUBST(GENERATED_SUPP)
687 AC_CHECK_HEADER([features.h])
689 if test x$ac_cv_header_features_h = xyes; then
690 rm -f conftest.$ac_ext
691 cat <<_ACEOF >conftest.$ac_ext
692 #include <features.h>
693 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
694 glibc version is: __GLIBC__ __GLIBC_MINOR__
697 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
700 AC_EGREP_CPP([AIX5_LIBC], [
701 #include <standards.h>
702 #if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
706 GLIBC_VERSION="aix5")
708 # not really a version check
709 AC_EGREP_CPP([DARWIN_LIBC], [
710 #include <sys/cdefs.h>
711 #if defined(__DARWIN_VERS_1050)
715 GLIBC_VERSION="darwin")
717 AC_MSG_CHECKING([the GLIBC_VERSION version])
719 case "${GLIBC_VERSION}" in
721 AC_MSG_RESULT(2.2 family)
722 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
723 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
724 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
725 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
729 AC_MSG_RESULT(2.3 family)
730 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
731 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
732 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
733 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
737 AC_MSG_RESULT(2.4 family)
738 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
739 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
740 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
741 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
745 AC_MSG_RESULT(2.5 family)
746 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
747 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
748 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
749 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
752 AC_MSG_RESULT(2.6 family)
753 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
754 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
755 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
756 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
759 AC_MSG_RESULT(2.7 family)
760 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
761 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
762 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
763 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
766 AC_MSG_RESULT(2.8 family)
767 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
768 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
769 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
770 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
773 AC_MSG_RESULT(2.9 family)
774 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
775 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
776 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
777 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
780 AC_MSG_RESULT(2.10 family)
781 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
782 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
783 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
784 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
787 AC_MSG_RESULT(2.11 family)
788 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
789 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
790 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
791 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
794 AC_MSG_RESULT(2.12 family)
795 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
796 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
797 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
798 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
801 AC_MSG_RESULT(2.13 family)
802 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
803 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
804 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
805 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
808 AC_MSG_RESULT(2.13 family)
809 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
810 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
811 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
812 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
815 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
816 AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
817 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
820 AC_MSG_RESULT(Darwin)
821 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
822 # DEFAULT_SUPP set by kernel version check above.
826 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
827 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.13])
828 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
829 AC_MSG_ERROR([or Darwin libc])
833 AC_SUBST(GLIBC_VERSION)
836 # Add default suppressions for the X client libraries. Make no
837 # attempt to detect whether such libraries are installed on the
838 # build machine (or even if any X facilities are present); just
839 # add the suppressions antidisirregardless.
840 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
841 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
843 # Add glibc and X11 suppressions for exp-sgcheck
844 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
847 #----------------------------------------------------------------------------
848 # Checking for various library functions and other definitions
849 #----------------------------------------------------------------------------
851 # Check for CLOCK_MONOTONIC
853 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
860 clock_gettime(CLOCK_MONOTONIC, &t);
865 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
866 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
872 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
874 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
881 return (PTHREAD_MUTEX_ADAPTIVE_NP);
885 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
886 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
892 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
894 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
901 return (PTHREAD_MUTEX_ERRORCHECK_NP);
905 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
906 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
912 # Check for PTHREAD_MUTEX_RECURSIVE_NP
914 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
921 return (PTHREAD_MUTEX_RECURSIVE_NP);
925 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
926 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
932 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
934 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
941 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
946 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
947 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
953 # Check whether pthread_mutex_t has a member called __m_kind.
955 AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
965 AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
966 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
972 # Check whether pthread_mutex_t has a member called __data.__kind.
974 AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
981 return m.__data.__kind;
984 AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
985 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
991 # does this compiler support -maltivec and does it have the include file
994 AC_MSG_CHECKING([for Altivec])
1001 #include <altivec.h>
1003 vector unsigned int v;
1007 AC_MSG_RESULT([yes])
1008 AC_DEFINE([HAS_ALTIVEC], 1,
1009 [Define to 1 if gcc/as can do Altivec.])
1016 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
1019 # Check that both: the compiler supports -mvsx and that the assembler
1020 # understands VSX instructions. If either of those doesn't work,
1021 # conclude that we can't do VSX. NOTE: basically this is a kludge
1022 # in that it conflates two things that should be separate -- whether
1023 # the compiler understands the flag vs whether the assembler
1024 # understands the opcodes. This really ought to be cleaned up
1025 # and done properly, like it is for x86/x86_64.
1027 AC_MSG_CHECKING([for VSX])
1034 #include <altivec.h>
1036 vector unsigned int v;
1037 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1041 AC_MSG_RESULT([yes])
1048 AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1051 # Check for pthread_create@GLIBC2.0
1052 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1058 extern int pthread_create_glibc_2_0(void*, const void*,
1059 void *(*)(void*), void*);
1060 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1064 * Apparently on PowerPC linking this program succeeds and generates an
1065 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1067 #error This test does not work properly on PowerPC.
1069 pthread_create_glibc_2_0(0, 0, 0, 0);
1074 ac_have_pthread_create_glibc_2_0=yes
1075 AC_MSG_RESULT([yes])
1076 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1077 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1079 ac_have_pthread_create_glibc_2_0=no
1084 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1085 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1088 # Check for eventfd_t, eventfd() and eventfd_read()
1089 AC_MSG_CHECKING([for eventfd()])
1093 #include <sys/eventfd.h>
1099 eventfd_read(fd, &ev);
1103 AC_MSG_RESULT([yes])
1104 AC_DEFINE([HAVE_EVENTFD], 1,
1105 [Define to 1 if you have the `eventfd' function.])
1106 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1107 [Define to 1 if you have the `eventfd_read' function.])
1113 #----------------------------------------------------------------------------
1114 # Checking for supported compiler flags.
1115 #----------------------------------------------------------------------------
1117 # does this compiler support -m32 ?
1118 AC_MSG_CHECKING([if gcc accepts -m32])
1128 AC_MSG_RESULT([yes])
1138 # does this compiler support -maix32 ?
1139 AC_MSG_CHECKING([if gcc accepts -maix32])
1148 FLAG_MAIX32="-maix32"
1149 AC_MSG_RESULT([yes])
1156 AC_SUBST(FLAG_MAIX32)
1159 # does this compiler support -m64 ?
1160 AC_MSG_CHECKING([if gcc accepts -m64])
1170 AC_MSG_RESULT([yes])
1180 # does this compiler support -maix64 ?
1181 AC_MSG_CHECKING([if gcc accepts -maix64])
1190 FLAG_MAIX64="-maix64"
1191 AC_MSG_RESULT([yes])
1198 AC_SUBST(FLAG_MAIX64)
1201 # does this compiler support -mmmx ?
1202 AC_MSG_CHECKING([if gcc accepts -mmmx])
1212 AC_MSG_RESULT([yes])
1222 # does this compiler support -msse ?
1223 AC_MSG_CHECKING([if gcc accepts -msse])
1233 AC_MSG_RESULT([yes])
1243 # does this compiler support -mpreferred-stack-boundary=2 ?
1244 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1247 CFLAGS="-mpreferred-stack-boundary=2"
1253 PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
1254 AC_MSG_RESULT([yes])
1256 PREFERRED_STACK_BOUNDARY=""
1261 AC_SUBST(PREFERRED_STACK_BOUNDARY)
1264 # does this compiler support -Wno-pointer-sign ?
1265 AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
1268 CFLAGS="-Wno-pointer-sign"
1275 AC_MSG_RESULT([yes])
1282 if test x$no_pointer_sign = xyes; then
1283 CFLAGS="$CFLAGS -Wno-pointer-sign"
1287 # does this compiler support -Wno-empty-body ?
1289 AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1292 CFLAGS="-Wno-empty-body"
1300 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1301 AC_MSG_RESULT([yes])
1304 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1310 # does this compiler support -Wno-format-zero-length ?
1312 AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1315 CFLAGS="-Wno-format-zero-length"
1323 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1324 AC_MSG_RESULT([yes])
1327 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1333 # does this compiler support -Wno-nonnull ?
1335 AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
1338 CFLAGS="-Wno-nonnull"
1346 AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
1347 AC_MSG_RESULT([yes])
1350 AC_SUBST([FLAG_W_NO_NONNULL], [])
1356 # does this compiler support -Wno-overflow ?
1358 AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
1361 CFLAGS="-Wno-overflow"
1369 AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
1370 AC_MSG_RESULT([yes])
1373 AC_SUBST([FLAG_W_NO_OVERFLOW], [])
1379 # does this compiler support -Wno-uninitialized ?
1381 AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1384 CFLAGS="-Wno-uninitialized"
1392 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1393 AC_MSG_RESULT([yes])
1396 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1402 # does this compiler support -Wextra or the older -W ?
1404 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1415 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1416 AC_MSG_RESULT([-Wextra])
1425 AC_SUBST([FLAG_W_EXTRA], [-W])
1428 AC_SUBST([FLAG_W_EXTRA], [])
1429 AC_MSG_RESULT([not supported])
1435 # does this compiler support -fno-stack-protector ?
1436 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1439 CFLAGS="-fno-stack-protector"
1445 no_stack_protector=yes
1446 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1447 AC_MSG_RESULT([yes])
1449 no_stack_protector=no
1450 FLAG_FNO_STACK_PROTECTOR=""
1455 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1457 if test x$no_stack_protector = xyes; then
1458 CFLAGS="$CFLAGS -fno-stack-protector"
1462 # does this compiler support --param inline-unit-growth=... ?
1464 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1467 CFLAGS="--param inline-unit-growth=900"
1475 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1476 ["--param inline-unit-growth=900"])
1477 AC_MSG_RESULT([yes])
1479 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1485 # does the linker support -Wl,--build-id=none ? Note, it's
1486 # important that we test indirectly via whichever C compiler
1487 # is selected, rather than testing /usr/bin/ld or whatever
1490 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
1493 CFLAGS="-Wl,--build-id=none"
1496 [AC_LANG_PROGRAM([ ], [return 0;])],
1498 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1499 AC_MSG_RESULT([yes])
1501 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1507 # does the ppc assembler support "mtocrf" et al?
1508 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1511 __asm__ __volatile__("mtocrf 4,0");
1512 __asm__ __volatile__("mfocrf 0,4");
1515 ac_have_as_ppc_mftocrf=yes
1516 AC_MSG_RESULT([yes])
1518 ac_have_as_ppc_mftocrf=no
1521 if test x$ac_have_as_ppc_mftocrf = xyes ; then
1522 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1528 # does the x86/amd64 assembler understand SSE3 instructions?
1529 # Note, this doesn't generate a C-level symbol. It generates a
1530 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
1531 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1534 do { long long int x;
1535 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1540 AC_MSG_RESULT([yes])
1546 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
1549 # Ditto for SSSE3 instructions (note extra S)
1550 # Note, this doesn't generate a C-level symbol. It generates a
1551 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1552 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1555 do { long long int x;
1556 __asm__ __volatile__(
1557 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1561 ac_have_as_ssse3=yes
1562 AC_MSG_RESULT([yes])
1568 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1571 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1572 # Note, this doesn't generate a C-level symbol. It generates a
1573 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
1574 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
1577 __asm__ __volatile__(
1578 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1582 ac_have_as_pclmulqdq=yes
1583 AC_MSG_RESULT([yes])
1585 ac_have_as_pclmulqdq=no
1589 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1592 # does the x86/amd64 assembler understand the LZCNT instruction?
1593 # Note, this doesn't generate a C-level symbol. It generates a
1594 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
1595 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1597 AC_TRY_COMPILE([], [
1599 __asm__ __volatile__("lzcnt %rax,%rax");
1603 ac_have_as_lzcnt=yes
1604 AC_MSG_RESULT([yes])
1610 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1613 # does the x86/amd64 assembler understand SSE 4.2 instructions?
1614 # Note, this doesn't generate a C-level symbol. It generates a
1615 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
1616 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
1619 do { long long int x;
1620 __asm__ __volatile__(
1621 "crc32q %%r15,%%r15" : : : "r15" ); }
1625 ac_have_as_sse42=yes
1626 AC_MSG_RESULT([yes])
1632 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
1635 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
1636 # when building the tool executables. I think we should get rid of it.
1638 # Check for TLS support in the compiler and linker
1639 if test "x${cross_compiling}" = "xno"; then
1640 # Native compilation: check whether running a program using TLS succeeds.
1641 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1642 # succeeds but running programs using TLS fails.
1643 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1644 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1645 [vg_cv_tls=$enableval],
1646 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1651 # Cross-compiling: check whether linking a program using TLS succeeds.
1652 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1653 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1654 [vg_cv_tls=$enableval],
1655 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1661 if test "$vg_cv_tls" = yes; then
1662 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1666 #----------------------------------------------------------------------------
1667 # Checks for C header files.
1668 #----------------------------------------------------------------------------
1671 AC_CHECK_HEADERS([ \
1687 #----------------------------------------------------------------------------
1688 # Checks for typedefs, structures, and compiler characteristics.
1689 #----------------------------------------------------------------------------
1696 #----------------------------------------------------------------------------
1697 # Checks for library functions.
1698 #----------------------------------------------------------------------------
1703 AC_CHECK_LIB([pthread], [pthread_create])
1704 AC_CHECK_LIB([rt], [clock_gettime])
1717 pthread_barrier_init \
1718 pthread_condattr_setclock \
1719 pthread_mutex_timedlock \
1720 pthread_rwlock_timedrdlock \
1721 pthread_rwlock_timedwrlock \
1736 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1737 # libraries with any shared object and/or executable. This is NOT what we
1738 # want for e.g. vgpreload_core-x86-linux.so
1741 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1742 [test x$ac_cv_func_pthread_barrier_init = xyes])
1743 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1744 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
1745 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1746 [test x$ac_cv_func_pthread_spin_lock = xyes])
1749 #----------------------------------------------------------------------------
1751 #----------------------------------------------------------------------------
1752 # Do we have a useable MPI setup on the primary and/or secondary targets?
1753 # On Linux, by default, assumes mpicc and -m32/-m64
1754 # On AIX, by default, assumes mpxlc and -q32/-q64
1755 # Note: this is a kludge in that it assumes the specified mpicc
1756 # understands -m32/-m64/-q32/-q64 regardless of what is specified using
1759 if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1760 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1765 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1766 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
1767 mflag_primary=$FLAG_M32
1768 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1769 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
1770 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
1771 mflag_primary=$FLAG_M64
1772 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
1774 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1779 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1780 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
1781 mflag_secondary=$FLAG_M32
1782 elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
1783 mflag_secondary=-q32
1788 [ --with-mpicc= Specify name of MPI2-ised C compiler],
1793 ## See if MPI_CC works for the primary target
1795 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
1797 saved_CFLAGS=$CFLAGS
1799 CFLAGS=$mflag_primary
1804 int r = MPI_Init(NULL,NULL);
1805 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1808 ac_have_mpi2_pri=yes
1809 AC_MSG_RESULT([yes, $MPI_CC])
1815 CFLAGS=$saved_CFLAGS
1816 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
1818 ## See if MPI_CC works for the secondary target. Complication: what if
1819 ## there is no secondary target? We need this to then fail.
1820 ## Kludge this by making MPI_CC something which will surely fail in
1823 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1825 saved_CFLAGS=$CFLAGS
1826 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
1827 CC="$MPI_CC this will surely fail"
1831 CFLAGS=$mflag_secondary
1836 int r = MPI_Init(NULL,NULL);
1837 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1840 ac_have_mpi2_sec=yes
1841 AC_MSG_RESULT([yes, $MPI_CC])
1847 CFLAGS=$saved_CFLAGS
1848 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
1851 #----------------------------------------------------------------------------
1852 # Other library checks
1853 #----------------------------------------------------------------------------
1854 # There now follow some tests for Boost, and OpenMP. These
1855 # tests are present because Drd has some regression tests that use
1856 # these packages. All regression test programs all compiled only
1857 # for the primary target. And so it is important that the configure
1858 # checks that follow, use the correct -m32 or -m64 flag for the
1859 # primary target (called $mflag_primary). Otherwise, we can end up
1860 # in a situation (eg) where, on amd64-linux, the test for Boost checks
1861 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
1862 # only build (meaning, the primary target is x86-linux), the build
1863 # of the regtest programs that use Boost fails, because they are
1864 # build as 32-bit (IN THIS EXAMPLE).
1866 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1867 # NEEDED BY THE REGRESSION TEST PROGRAMS.
1870 # Check whether the boost library 1.35 or later has been installed.
1871 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1873 AC_MSG_CHECKING([for boost])
1876 safe_CXXFLAGS=$CXXFLAGS
1877 CXXFLAGS="-lboost_thread-mt $mflag_primary"
1879 AC_LINK_IFELSE([AC_LANG_SOURCE([
1880 #include <boost/thread.hpp>
1881 static void thread_func(void)
1883 int main(int argc, char** argv)
1885 boost::thread t(thread_func);
1890 ac_have_boost_1_35=yes
1891 AC_SUBST([BOOST_CFLAGS], [])
1892 AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1893 AC_MSG_RESULT([yes])
1895 ac_have_boost_1_35=no
1899 CXXFLAGS=$safe_CXXFLAGS
1902 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1905 # does this compiler support -fopenmp, does it have the include file
1906 # <omp.h> and does it have libgomp ?
1908 AC_MSG_CHECKING([for OpenMP])
1911 CFLAGS="-fopenmp $mflag_primary"
1913 AC_LINK_IFELSE([AC_LANG_SOURCE([
1915 int main(int argc, char** argv)
1923 AC_MSG_RESULT([yes])
1930 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1933 # does this compiler have built-in functions for atomic memory access ?
1934 AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1937 CFLAGS="$mflag_primary"
1942 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1943 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1946 ac_have_builtin_atomic=yes
1947 AC_MSG_RESULT([yes])
1948 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
1951 ac_have_builtin_atomic=no
1957 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1959 # does g++ have built-in functions for atomic memory access ?
1960 AC_MSG_CHECKING([if g++ supports __sync_bool_compare_and_swap])
1962 safe_CXXFLAGS=$CXXFLAGS
1963 CXXFLAGS="$mflag_primary"
1969 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1970 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1973 ac_have_builtin_atomic_cxx=yes
1974 AC_MSG_RESULT([yes])
1975 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
1978 ac_have_builtin_atomic_cxx=no
1983 CXXFLAGS=$safe_CXXFLAGS
1985 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
1987 #----------------------------------------------------------------------------
1988 # Ok. We're done checking.
1989 #----------------------------------------------------------------------------
1991 # Nb: VEX/Makefile is generated from Makefile.vex.in.
1994 VEX/Makefile:Makefile.vex.in
2003 gdbserver_tests/Makefile
2009 memcheck/tests/Makefile
2010 memcheck/tests/amd64/Makefile
2011 memcheck/tests/x86/Makefile
2012 memcheck/tests/linux/Makefile
2013 memcheck/tests/darwin/Makefile
2014 memcheck/tests/amd64-linux/Makefile
2015 memcheck/tests/x86-linux/Makefile
2016 memcheck/tests/ppc32/Makefile
2017 memcheck/tests/ppc64/Makefile
2018 memcheck/perf/Makefile
2020 cachegrind/tests/Makefile
2021 cachegrind/tests/x86/Makefile
2022 cachegrind/cg_annotate
2025 callgrind/callgrind_annotate
2026 callgrind/callgrind_control
2027 callgrind/tests/Makefile
2029 helgrind/tests/Makefile
2031 massif/tests/Makefile
2032 massif/perf/Makefile
2035 lackey/tests/Makefile
2038 none/tests/amd64/Makefile
2039 none/tests/ppc32/Makefile
2040 none/tests/ppc64/Makefile
2041 none/tests/x86/Makefile
2042 none/tests/arm/Makefile
2043 none/tests/s390x/Makefile
2044 none/tests/linux/Makefile
2045 none/tests/darwin/Makefile
2046 none/tests/x86-linux/Makefile
2047 exp-sgcheck/Makefile
2048 exp-sgcheck/tests/Makefile
2050 drd/scripts/download-and-build-splash2
2053 exp-bbv/tests/Makefile
2054 exp-bbv/tests/x86/Makefile
2055 exp-bbv/tests/x86-linux/Makefile
2056 exp-bbv/tests/amd64-linux/Makefile
2057 exp-bbv/tests/ppc32-linux/Makefile
2059 exp-dhat/tests/Makefile
2061 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
2062 [chmod +x coregrind/link_tool_exe_linux])
2063 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
2064 [chmod +x coregrind/link_tool_exe_darwin])
2065 AC_CONFIG_FILES([coregrind/link_tool_exe_aix5],
2066 [chmod +x coregrind/link_tool_exe_aix5])
2067 AC_CONFIG_FILES([coregrind/link_tool_exe_l4re],
2068 [chmod +x coregrind/link_tool_exe_l4re])
2073 Maximum build arch: ${ARCH_MAX}
2074 Primary build arch: ${VGCONF_ARCH_PRI}
2075 Secondary build arch: ${VGCONF_ARCH_SEC}
2076 Build OS: ${VGCONF_OS}
2077 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
2078 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
2079 Default supp files: ${DEFAULT_SUPP}
2080 Generated supp files: ${GENERATED_SUPP}