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.6.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"
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])
43 # If no AR variable was specified, look up the name of the archiver. Otherwise
44 # do not touch the AR variable.
45 if test "x$AR" = "x"; then
46 AC_PATH_PROGS([AR], [`echo $LD | sed 's/ld$/ar/'` "ar"], [ar])
48 AC_ARG_VAR([AR],[Archiver command])
50 # Check for the compiler support
51 if test "${GCC}" != "yes" ; then
52 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
55 # figure out where perl lives
56 AC_PATH_PROG(PERL, perl)
58 # figure out where gdb lives
59 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
60 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
62 # some older automake's don't have it so try something on our own
63 ifdef([AM_PROG_AS],[AM_PROG_AS],
73 # Check if 'diff' supports -u (universal diffs) and use it if possible.
75 AC_MSG_CHECKING([for diff -u])
78 # Comparing two identical files results in 0, unless -u isn't supported (as
80 tmpfile="tmp-xxx-yyy-zzz"
82 if diff -u $tmpfile $tmpfile ; then
92 # We don't want gcc < 3.0
93 AC_MSG_CHECKING([for a supported version of gcc])
95 [gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
97 case "${gcc_version}" in
99 AC_MSG_RESULT([no (${gcc_version})])
100 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
103 AC_MSG_RESULT([ok (${gcc_version})])
107 #----------------------------------------------------------------------------
108 # Arch/OS/platform tests.
109 #----------------------------------------------------------------------------
110 # We create a number of arch/OS/platform-related variables. We prefix them
111 # all with "VGCONF_" which indicates that they are defined at
112 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
113 # variables used when compiling C files.
117 AC_MSG_CHECKING([for a supported CPU])
119 # ARCH_MAX reflects the most that this CPU can do: for example if it
120 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
121 # Ditto for amd64. It is used for more configuration below, but is not used
123 case "${host_cpu}" in
125 AC_MSG_RESULT([ok (${host_cpu})])
130 AC_MSG_RESULT([ok (${host_cpu})])
135 # This value can only happen on Linux, not on AIX
136 AC_MSG_RESULT([ok (${host_cpu})])
141 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
142 # Whereas in Linux that means only a 32-bit capable CPU.
143 AC_MSG_RESULT([ok (${host_cpu})])
155 AC_MSG_RESULT([ok (${host_cpu})])
160 AC_MSG_RESULT([no (${host_cpu})])
161 AC_MSG_ERROR([Unsupported host architecture. Sorry])
165 #----------------------------------------------------------------------------
167 # Sometimes it's convenient to subvert the bi-arch build system and
168 # just have a single build even though the underlying platform is
169 # capable of both. Hence handle --enable-only64bit and
170 # --enable-only32bit. Complain if both are issued :-)
171 # [Actually, if either of these options are used, I think both get built,
172 # but only one gets installed. So if you use an in-place build, both can be
175 # Check if a 64-bit only build has been requested
176 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
177 [AC_ARG_ENABLE(only64bit,
178 [ --enable-only64bit do a 64-bit only build],
179 [vg_cv_only64bit=$enableval],
180 [vg_cv_only64bit=no])])
182 # Check if a 32-bit only build has been requested
183 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
184 [AC_ARG_ENABLE(only32bit,
185 [ --enable-only32bit do a 32-bit only build],
186 [vg_cv_only32bit=$enableval],
187 [vg_cv_only32bit=no])])
190 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
192 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
195 #----------------------------------------------------------------------------
197 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
198 # compilation of many C files via -VGO_$(VGCONF_OS) and
199 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
200 AC_MSG_CHECKING([for a supported OS])
207 AC_MSG_RESULT([ok (${host_os})])
210 # Ok, this is linux. Check the kernel version
211 AC_MSG_CHECKING([for the kernel version])
217 AC_MSG_RESULT([2.6 family (${kernel})])
218 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
222 AC_MSG_RESULT([2.4 family (${kernel})])
223 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
227 AC_MSG_RESULT([unsupported (${kernel})])
228 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
235 AC_MSG_RESULT([ok (${host_os})])
239 AC_MSG_RESULT([ok (${host_os})])
243 AC_MSG_RESULT([ok (${host_os})])
248 AC_MSG_RESULT([ok (${host_os})])
253 AC_MSG_RESULT([ok (${host_os})])
256 AC_MSG_CHECKING([for the kernel version])
259 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
260 # has only one relevant version, the OS version. The `uname` check
261 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
262 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
263 # Snow Leopard and darwin10.supp), and we don't know of an macros
264 # similar to __GLIBC__ to get that info.
266 # XXX: `uname -r` won't do the right thing for cross-compiles, but
267 # that's not a problem yet.
270 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
271 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
272 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
275 AC_MSG_RESULT([unsupported (${kernel})])
276 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
282 AC_MSG_RESULT([no (${host_os})])
283 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
287 #----------------------------------------------------------------------------
289 # If we are building on a 64 bit platform test to see if the system
290 # supports building 32 bit programs and disable 32 bit support if it
291 # does not support building 32 bit programs
293 case "$ARCH_MAX-$VGCONF_OS" in
294 amd64-linux|ppc64-linux)
295 AC_MSG_CHECKING([for 32 bit build support])
304 vg_cv_only64bit="yes"
307 CFLAGS=$safe_CFLAGS;;
310 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
312 [--enable-only32bit was specified but system does not support 32 bit builds])
315 #----------------------------------------------------------------------------
317 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
318 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
319 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
320 # above) will be "amd64" since that reflects the most that this cpu can do,
321 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
322 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
323 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
324 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
325 AC_SUBST(VGCONF_ARCH_PRI)
327 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
328 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
329 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
330 # It is empty if there is no secondary target.
331 AC_SUBST(VGCONF_ARCH_SEC)
333 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
334 # The entire system, including regression and performance tests, will be
335 # built for this target. The "_CAPS" indicates that the name is in capital
336 # letters, and it also uses '_' rather than '-' as a separator, because it's
337 # used to create various Makefile variables, which are all in caps by
338 # convention and cannot contain '-' characters. This is in contrast to
339 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
340 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
342 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
343 # Valgrind and tools will also be built for this target, but not the
344 # regression or performance tests.
346 # By default, the primary arch is the same as the "max" arch, as commented
347 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
348 # the big case statement just below here, in the case where we're building
349 # on a 64 bit machine but have been requested only to do a 32 bit build.
350 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
352 AC_MSG_CHECKING([for a supported CPU/OS combination])
354 case "$ARCH_MAX-$VGCONF_OS" in
356 VGCONF_ARCH_PRI="x86"
358 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
359 VGCONF_PLATFORM_SEC_CAPS=""
360 valt_load_address_normal="0x38000000"
361 valt_load_address_inner="0x28000000"
362 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
365 if test x$vg_cv_only64bit = xyes; then
366 VGCONF_ARCH_PRI="amd64"
368 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
369 VGCONF_PLATFORM_SEC_CAPS=""
370 elif test x$vg_cv_only32bit = xyes; then
371 VGCONF_ARCH_PRI="x86"
373 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
374 VGCONF_PLATFORM_SEC_CAPS=""
376 VGCONF_ARCH_PRI="amd64"
377 VGCONF_ARCH_SEC="x86"
378 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
379 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
381 valt_load_address_normal="0x38000000"
382 valt_load_address_inner="0x28000000"
383 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
386 VGCONF_ARCH_PRI="ppc32"
388 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
389 VGCONF_PLATFORM_SEC_CAPS=""
390 valt_load_address_normal="0x38000000"
391 valt_load_address_inner="0x28000000"
392 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
395 if test x$vg_cv_only64bit = xyes; then
396 VGCONF_ARCH_PRI="ppc64"
398 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
399 VGCONF_PLATFORM_SEC_CAPS=""
400 elif test x$vg_cv_only32bit = xyes; then
401 VGCONF_ARCH_PRI="ppc32"
403 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
404 VGCONF_PLATFORM_SEC_CAPS=""
406 VGCONF_ARCH_PRI="ppc64"
407 VGCONF_ARCH_SEC="ppc32"
408 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
409 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
411 valt_load_address_normal="0x38000000"
412 valt_load_address_inner="0x28000000"
413 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
416 if test x$vg_cv_only64bit = xyes; then
417 VGCONF_ARCH_PRI="ppc64"
419 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
420 VGCONF_PLATFORM_SEC_CAPS=""
421 elif test x$vg_cv_only32bit = xyes; then
422 VGCONF_ARCH_PRI="ppc32"
424 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
425 VGCONF_PLATFORM_SEC_CAPS=""
427 VGCONF_ARCH_PRI="ppc64"
428 VGCONF_ARCH_SEC="ppc32"
429 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
430 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
432 valt_load_address_normal="0x38000000"
433 valt_load_address_inner="0x28000000"
434 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
437 VGCONF_ARCH_PRI="x86"
439 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
440 VGCONF_PLATFORM_SEC_CAPS=""
441 valt_load_address_normal="0x0"
442 valt_load_address_inner="0x0"
443 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
446 if test x$vg_cv_only64bit = xyes; then
447 VGCONF_ARCH_PRI="amd64"
449 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
450 VGCONF_PLATFORM_SEC_CAPS=""
451 elif test x$vg_cv_only32bit = xyes; then
452 VGCONF_ARCH_PRI="x86"
454 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
455 VGCONF_PLATFORM_SEC_CAPS=""
456 VGCONF_ARCH_PRI_CAPS="x86"
458 VGCONF_ARCH_PRI="amd64"
459 VGCONF_ARCH_SEC="x86"
460 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
461 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
463 valt_load_address_normal="0x0"
464 valt_load_address_inner="0x0"
465 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
468 VGCONF_ARCH_PRI="arm"
469 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
470 VGCONF_PLATFORM_SEC_CAPS=""
471 valt_load_address_normal="0x38000000"
472 valt_load_address_inner="0x28000000"
473 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
476 VGCONF_ARCH_PRI="unknown"
477 VGCONF_ARCH_SEC="unknown"
478 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
479 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
480 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
481 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
485 #----------------------------------------------------------------------------
487 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
489 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
490 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
491 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
492 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
493 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
494 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
495 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
496 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
497 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
498 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
499 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
500 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
501 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
502 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
503 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
504 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
505 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
506 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
508 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
510 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
511 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
512 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
513 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
514 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
515 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
516 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
517 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
518 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
519 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
520 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
521 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
523 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
524 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
525 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
526 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
527 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
529 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
530 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
531 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
532 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
533 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
536 # Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
537 # Relies on the assumption that the primary and secondary targets are
538 # for the same OS, so therefore only necessary to test the primary.
539 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
540 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
541 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
542 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
543 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
544 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
545 AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
546 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
547 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
548 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
549 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
550 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
553 # Sometimes, in the Makefile.am files, it's useful to know whether or not
554 # there is a secondary target.
555 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
556 test x$VGCONF_PLATFORM_SEC_CAPS != x)
559 #----------------------------------------------------------------------------
561 #----------------------------------------------------------------------------
563 # Check if this should be built as an inner Valgrind, to be run within
564 # another Valgrind. Choose the load address accordingly.
565 AC_SUBST(VALT_LOAD_ADDRESS)
566 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
567 [AC_ARG_ENABLE(inner,
568 [ --enable-inner enables self-hosting],
569 [vg_cv_inner=$enableval],
571 if test "$vg_cv_inner" = yes; then
572 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
573 VALT_LOAD_ADDRESS=$valt_load_address_inner
575 VALT_LOAD_ADDRESS=$valt_load_address_normal
579 #----------------------------------------------------------------------------
580 # Libc and suppressions
581 #----------------------------------------------------------------------------
582 # This variable will collect the suppression files to be used.
583 AC_SUBST(DEFAULT_SUPP)
587 AC_EGREP_CPP([GLIBC_22], [
588 #include <features.h>
589 #ifdef __GNU_LIBRARY__
590 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
597 AC_EGREP_CPP([GLIBC_23], [
598 #include <features.h>
599 #ifdef __GNU_LIBRARY__
600 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
607 AC_EGREP_CPP([GLIBC_24], [
608 #include <features.h>
609 #ifdef __GNU_LIBRARY__
610 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
617 AC_EGREP_CPP([GLIBC_25], [
618 #include <features.h>
619 #ifdef __GNU_LIBRARY__
620 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
627 AC_EGREP_CPP([GLIBC_26], [
628 #include <features.h>
629 #ifdef __GNU_LIBRARY__
630 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
637 AC_EGREP_CPP([GLIBC_27], [
638 #include <features.h>
639 #ifdef __GNU_LIBRARY__
640 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
647 AC_EGREP_CPP([GLIBC_28], [
648 #include <features.h>
649 #ifdef __GNU_LIBRARY__
650 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
657 AC_EGREP_CPP([GLIBC_29], [
658 #include <features.h>
659 #ifdef __GNU_LIBRARY__
660 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
667 AC_EGREP_CPP([GLIBC_210], [
668 #include <features.h>
669 #ifdef __GNU_LIBRARY__
670 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
675 GLIBC_VERSION="2.10")
677 AC_EGREP_CPP([GLIBC_211], [
678 #include <features.h>
679 #ifdef __GNU_LIBRARY__
680 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 11)
685 GLIBC_VERSION="2.11")
687 AC_EGREP_CPP([GLIBC_212], [
688 #include <features.h>
689 #ifdef __GNU_LIBRARY__
690 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 12)
695 GLIBC_VERSION="2.12")
697 AC_EGREP_CPP([AIX5_LIBC], [
698 #include <standards.h>
699 #if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
703 GLIBC_VERSION="aix5")
705 # not really a version check
706 AC_EGREP_CPP([DARWIN_LIBC], [
707 #include <sys/cdefs.h>
708 #if defined(__DARWIN_VERS_1050)
712 GLIBC_VERSION="darwin")
714 AC_MSG_CHECKING([the GLIBC_VERSION version])
716 case "${GLIBC_VERSION}" in
718 AC_MSG_RESULT(2.2 family)
719 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
720 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
721 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
722 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
726 AC_MSG_RESULT(2.3 family)
727 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
728 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
729 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
730 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
734 AC_MSG_RESULT(2.4 family)
735 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
736 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
737 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
738 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
742 AC_MSG_RESULT(2.5 family)
743 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
744 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
745 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
746 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
749 AC_MSG_RESULT(2.6 family)
750 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
751 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
752 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
753 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
756 AC_MSG_RESULT(2.7 family)
757 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
758 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
759 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
760 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
763 AC_MSG_RESULT(2.8 family)
764 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
765 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
766 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
767 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
770 AC_MSG_RESULT(2.9 family)
771 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
772 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
773 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
774 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
777 AC_MSG_RESULT(2.10 family)
778 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
779 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
780 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
781 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
784 AC_MSG_RESULT(2.11 family)
785 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
786 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
787 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
788 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
791 AC_MSG_RESULT(2.12 family)
792 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
793 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
794 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
795 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
798 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
799 AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
800 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
803 AC_MSG_RESULT(Darwin)
804 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
805 # DEFAULT_SUPP set by kernel version check above.
809 AC_MSG_RESULT(unsupported version)
810 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.12])
811 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
812 AC_MSG_ERROR([or Darwin libc])
816 AC_SUBST(GLIBC_VERSION)
819 # Add default suppressions for the X client libraries. Make no
820 # attempt to detect whether such libraries are installed on the
821 # build machine (or even if any X facilities are present); just
822 # add the suppressions antidisirregardless.
823 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
824 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
826 # Add glibc and X11 suppressions for exp-ptrcheck
827 DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
830 #----------------------------------------------------------------------------
831 # Checking for various library functions and other definitions
832 #----------------------------------------------------------------------------
834 # Check for CLOCK_MONOTONIC
836 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
843 clock_gettime(CLOCK_MONOTONIC, &t);
848 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
849 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
855 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
857 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
864 return (PTHREAD_MUTEX_ADAPTIVE_NP);
868 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
869 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
875 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
877 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
884 return (PTHREAD_MUTEX_ERRORCHECK_NP);
888 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
889 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
895 # Check for PTHREAD_MUTEX_RECURSIVE_NP
897 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
904 return (PTHREAD_MUTEX_RECURSIVE_NP);
908 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
909 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
915 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
917 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
924 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
929 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
930 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
936 # Check whether pthread_mutex_t has a member called __m_kind.
938 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
939 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
941 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
944 [#include <pthread.h>])
947 # Check whether pthread_mutex_t has a member called __data.__kind.
949 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
950 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
952 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
955 [#include <pthread.h>])
958 # does this compiler support -maltivec and does it have the include file
961 AC_MSG_CHECKING([for Altivec])
970 vector unsigned int v;
981 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
982 AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
985 # Check for pthread_create@GLIBC2.0
986 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
992 extern int pthread_create_glibc_2_0(void*, const void*,
993 void *(*)(void*), void*);
994 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
998 * Apparently on PowerPC linking this program succeeds and generates an
999 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1001 #error This test does not work properly on PowerPC.
1003 pthread_create_glibc_2_0(0, 0, 0, 0);
1008 ac_have_pthread_create_glibc_2_0=yes
1009 AC_MSG_RESULT([yes])
1010 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1011 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1013 ac_have_pthread_create_glibc_2_0=no
1018 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1019 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1022 # Check for eventfd_t, eventfd() and eventfd_read()
1023 AC_MSG_CHECKING([for eventfd()])
1027 #include <sys/eventfd.h>
1033 eventfd_read(fd, &ev);
1037 AC_MSG_RESULT([yes])
1038 AC_DEFINE([HAVE_EVENTFD], 1,
1039 [Define to 1 if you have the `eventfd' function.])
1040 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1041 [Define to 1 if you have the `eventfd_read' function.])
1047 #----------------------------------------------------------------------------
1048 # Checking for supported compiler flags.
1049 #----------------------------------------------------------------------------
1051 # does this compiler support -m32 ?
1052 AC_MSG_CHECKING([if gcc accepts -m32])
1062 AC_MSG_RESULT([yes])
1072 # does this compiler support -maix32 ?
1073 AC_MSG_CHECKING([if gcc accepts -maix32])
1082 FLAG_MAIX32="-maix32"
1083 AC_MSG_RESULT([yes])
1090 AC_SUBST(FLAG_MAIX32)
1093 # does this compiler support -m64 ?
1094 AC_MSG_CHECKING([if gcc accepts -m64])
1104 AC_MSG_RESULT([yes])
1114 # does this compiler support -maix64 ?
1115 AC_MSG_CHECKING([if gcc accepts -maix64])
1124 FLAG_MAIX64="-maix64"
1125 AC_MSG_RESULT([yes])
1132 AC_SUBST(FLAG_MAIX64)
1135 # does this compiler support -mmmx ?
1136 AC_MSG_CHECKING([if gcc accepts -mmmx])
1146 AC_MSG_RESULT([yes])
1156 # does this compiler support -msse ?
1157 AC_MSG_CHECKING([if gcc accepts -msse])
1167 AC_MSG_RESULT([yes])
1177 # does this compiler support -mpreferred-stack-boundary=2 ?
1178 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1181 CFLAGS="-mpreferred-stack-boundary=2"
1187 PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
1188 AC_MSG_RESULT([yes])
1190 PREFERRED_STACK_BOUNDARY=""
1195 AC_SUBST(PREFERRED_STACK_BOUNDARY)
1198 # does this compiler support -Wno-pointer-sign ?
1199 AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
1202 CFLAGS="-Wno-pointer-sign"
1209 AC_MSG_RESULT([yes])
1216 if test x$no_pointer_sign = xyes; then
1217 CFLAGS="$CFLAGS -Wno-pointer-sign"
1221 # does this compiler support -Wno-empty-body ?
1223 AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1226 CFLAGS="-Wno-empty-body"
1234 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1235 AC_MSG_RESULT([yes])
1238 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1244 # does this compiler support -Wno-format-zero-length ?
1246 AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1249 CFLAGS="-Wno-format-zero-length"
1257 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1258 AC_MSG_RESULT([yes])
1261 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1267 # does this compiler support -Wno-uninitialized ?
1269 AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1272 CFLAGS="-Wno-uninitialized"
1280 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1281 AC_MSG_RESULT([yes])
1284 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1290 # does this compiler support -Wextra or the older -W ?
1292 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1303 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1304 AC_MSG_RESULT([-Wextra])
1313 AC_SUBST([FLAG_W_EXTRA], [-W])
1316 AC_SUBST([FLAG_W_EXTRA], [])
1317 AC_MSG_RESULT([not supported])
1323 # does this compiler support -fno-stack-protector ?
1324 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1327 CFLAGS="-fno-stack-protector"
1333 no_stack_protector=yes
1334 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1335 AC_MSG_RESULT([yes])
1337 no_stack_protector=no
1338 FLAG_FNO_STACK_PROTECTOR=""
1343 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1345 if test x$no_stack_protector = xyes; then
1346 CFLAGS="$CFLAGS -fno-stack-protector"
1350 # does this compiler support --param inline-unit-growth=... ?
1352 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1355 CFLAGS="--param inline-unit-growth=900"
1363 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1364 ["--param inline-unit-growth=900"])
1365 AC_MSG_RESULT([yes])
1367 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1373 # does the ppc assembler support "mtocrf" et al?
1374 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1377 __asm__ __volatile__("mtocrf 4,0");
1378 __asm__ __volatile__("mfocrf 0,4");
1381 ac_have_as_ppc_mftocrf=yes
1382 AC_MSG_RESULT([yes])
1384 ac_have_as_ppc_mftocrf=no
1387 if test x$ac_have_as_ppc_mftocrf = xyes ; then
1388 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1392 # does the x86/amd64 assembler understand SSE3 instructions?
1393 # Note, this doesn't generate a C-level symbol. It generates a
1394 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
1395 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1398 do { long long int x;
1399 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1404 AC_MSG_RESULT([yes])
1410 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
1413 # Ditto for SSSE3 instructions (note extra S)
1414 # Note, this doesn't generate a C-level symbol. It generates a
1415 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1416 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1419 do { long long int x;
1420 __asm__ __volatile__(
1421 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1425 ac_have_as_ssse3=yes
1426 AC_MSG_RESULT([yes])
1432 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1435 # Check for TLS support in the compiler and linker
1436 if test "x${cross_compiling}" = "xno"; then
1437 # Native compilation: check whether running a program using TLS succeeds.
1438 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1439 # succeeds but running programs using TLS fails.
1440 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1441 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1442 [vg_cv_tls=$enableval],
1443 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1448 # Cross-compiling: check whether linking a program using TLS succeeds.
1449 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1450 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1451 [vg_cv_tls=$enableval],
1452 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1458 if test "$vg_cv_tls" = yes; then
1459 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1463 #----------------------------------------------------------------------------
1464 # Checks for C header files.
1465 #----------------------------------------------------------------------------
1468 AC_CHECK_HEADERS([ \
1484 #----------------------------------------------------------------------------
1485 # Checks for typedefs, structures, and compiler characteristics.
1486 #----------------------------------------------------------------------------
1493 #----------------------------------------------------------------------------
1494 # Checks for library functions.
1495 #----------------------------------------------------------------------------
1500 AC_CHECK_LIB([rt], [clock_gettime])
1514 pthread_barrier_init \
1515 pthread_condattr_setclock \
1516 pthread_mutex_timedlock \
1517 pthread_rwlock_timedrdlock \
1518 pthread_rwlock_timedwrlock \
1535 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1536 # libraries with any shared object and/or executable. This is NOT what we
1537 # want for e.g. vgpreload_core-x86-linux.so
1540 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1541 [test x$ac_cv_func_pthread_barrier_init = xyes])
1542 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1543 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
1544 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1545 [test x$ac_cv_func_pthread_spin_lock = xyes])
1548 #----------------------------------------------------------------------------
1550 #----------------------------------------------------------------------------
1551 # Do we have a useable MPI setup on the primary and/or secondary targets?
1552 # On Linux, by default, assumes mpicc and -m32/-m64
1553 # On AIX, by default, assumes mpxlc and -q32/-q64
1554 # Note: this is a kludge in that it assumes the specified mpicc
1555 # understands -m32/-m64/-q32/-q64 regardless of what is specified using
1558 if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1559 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1564 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1565 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
1566 mflag_primary=$FLAG_M32
1567 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1568 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
1569 mflag_primary=$FLAG_M64
1570 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
1572 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1577 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1578 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
1579 mflag_secondary=$FLAG_M32
1580 elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
1581 mflag_secondary=-q32
1586 [ --with-mpicc= Specify name of MPI2-ised C compiler],
1591 ## See if MPI_CC works for the primary target
1593 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
1595 saved_CFLAGS=$CFLAGS
1597 CFLAGS=$mflag_primary
1602 int r = MPI_Init(NULL,NULL);
1603 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1606 ac_have_mpi2_pri=yes
1607 AC_MSG_RESULT([yes, $MPI_CC])
1613 CFLAGS=$saved_CFLAGS
1614 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
1616 ## See if MPI_CC works for the secondary target. Complication: what if
1617 ## there is no secondary target? We need this to then fail.
1618 ## Kludge this by making MPI_CC something which will surely fail in
1621 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1623 saved_CFLAGS=$CFLAGS
1624 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
1625 CC="$MPI_CC this will surely fail"
1629 CFLAGS=$mflag_secondary
1634 int r = MPI_Init(NULL,NULL);
1635 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1638 ac_have_mpi2_sec=yes
1639 AC_MSG_RESULT([yes, $MPI_CC])
1645 CFLAGS=$saved_CFLAGS
1646 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
1649 #----------------------------------------------------------------------------
1650 # Other library checks
1651 #----------------------------------------------------------------------------
1652 # There now follow some tests for QtCore, Boost, and OpenMP. These
1653 # tests are present because Drd has some regression tests that use
1654 # these packages. All regression test programs all compiled only
1655 # for the primary target. And so it is important that the configure
1656 # checks that follow, use the correct -m32 or -m64 flag for the
1657 # primary target (called $mflag_primary). Otherwise, we can end up
1658 # in a situation (eg) where, on amd64-linux, the test for Boost checks
1659 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
1660 # only build (meaning, the primary target is x86-linux), the build
1661 # of the regtest programs that use Boost fails, because they are
1662 # build as 32-bit (IN THIS EXAMPLE).
1664 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1665 # NEEDED BY THE REGRESSION TEST PROGRAMS.
1668 # The test below verifies whether the QtCore package been installed.
1669 # This test works as follows:
1670 # - If pkg-config was not installed at the time autogen.sh was run,
1671 # the definition of the PKG_CHECK_EXISTS() macro will not be found by
1672 # autogen.sh. Augogen.sh will generate a configure script that prints
1673 # a warning about pkg-config and proceeds as if Qt4 has not been installed.
1674 # - If pkg-config was installed at the time autogen.sh was run,
1675 # the generated configure script will try to detect the presence of the
1676 # Qt4 QtCore library by looking up compile and linker flags in the file
1678 # - pkg-config settings can be overridden via the configure variables
1679 # QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1680 # configure script -- see also ./configure --help).
1681 # - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1682 # the pkg-config executable is not present on the system on which the
1683 # configure script is run.
1690 PKG_CHECK_MODULES([QTCORE], [QtCore])
1691 # Paranoia: don't trust the result reported by pkg-config, but when
1692 # pkg-config reports that QtCore has been found, verify whether linking
1693 # programs with QtCore succeeds.
1695 safe_CXXFLAGS="${CXXFLAGS}"
1696 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
1698 [#include <QMutex>],
1700 [ac_have_qtcore=yes],
1702 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1706 CXXFLAGS="${safe_CXXFLAGS}"
1713 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1714 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1718 AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1721 # Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1722 # See also http://doc.trolltech.com/4.3/qmutex.html.
1723 if test x$ac_have_qtcore = xyes; then
1724 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1726 safe_CXXFLAGS="${CXXFLAGS}"
1727 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1729 #include <QtCore/QMutex>
1738 AC_MSG_RESULT([yes])
1739 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1744 CXXFLAGS="${safe_CXXFLAGS}"
1749 # Test for QAtomicInt, which has been introduced in Qt 4.4.
1750 # See also http://doc.trolltech.com/4.4/qatomicint.html.
1751 if test x$ac_have_qtcore = xyes; then
1752 AC_MSG_CHECKING([for Qt4 QAtomicInt])
1754 safe_CXXFLAGS="${CXXFLAGS}"
1755 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1757 #include <QtCore/QAtomicInt>
1761 I.testAndSetOrdered(0, 1);
1765 ac_have_qtcore_qatomicint=yes
1766 AC_MSG_RESULT([yes])
1767 AC_DEFINE([HAVE_QTCORE_QATOMICINT], [1], [Define to 1 if the installed version of Qt4 provides QAtomicInt.])
1770 ac_have_qtcore_qatomicint=no
1773 CXXFLAGS="${safe_CXXFLAGS}"
1777 AM_CONDITIONAL([HAVE_QTCORE_QATOMICINT], [test x$ac_have_qtcore_qatomicint = xyes])
1781 # Check whether the boost library 1.35 or later has been installed.
1782 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1784 AC_MSG_CHECKING([for boost])
1787 safe_CXXFLAGS=$CXXFLAGS
1788 CXXFLAGS="-lboost_thread-mt $mflag_primary"
1792 #include <boost/thread.hpp>
1793 static void thread_func(void)
1795 int main(int argc, char** argv)
1797 boost::thread t(thread_func);
1802 ac_have_boost_1_35=yes
1803 AC_SUBST([BOOST_CFLAGS], [])
1804 AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1805 AC_MSG_RESULT([yes])
1807 ac_have_boost_1_35=no
1811 CXXFLAGS=$safe_CXXFLAGS
1814 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1817 # does this compiler support -fopenmp, does it have the include file
1818 # <omp.h> and does it have libgomp ?
1820 AC_MSG_CHECKING([for OpenMP])
1823 CFLAGS="-fopenmp $mflag_primary"
1828 int main(int argc, char** argv)
1836 AC_MSG_RESULT([yes])
1843 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1846 # does this compiler have built-in functions for atomic memory access ?
1847 AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1850 CFLAGS="$mflag_primary"
1855 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1856 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1859 ac_have_builtin_atomic=yes
1860 AC_MSG_RESULT([yes])
1861 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1864 ac_have_builtin_atomic=no
1870 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1873 #----------------------------------------------------------------------------
1874 # Ok. We're done checking.
1875 #----------------------------------------------------------------------------
1877 # Nb: VEX/Makefile is generated from Makefile.vex.in.
1880 VEX/Makefile:Makefile.vex.in
1894 memcheck/tests/Makefile
1895 memcheck/tests/amd64/Makefile
1896 memcheck/tests/x86/Makefile
1897 memcheck/tests/linux/Makefile
1898 memcheck/tests/darwin/Makefile
1899 memcheck/tests/x86-linux/Makefile
1900 memcheck/perf/Makefile
1902 cachegrind/tests/Makefile
1903 cachegrind/tests/x86/Makefile
1904 cachegrind/cg_annotate
1906 callgrind/callgrind_annotate
1907 callgrind/callgrind_control
1908 callgrind/tests/Makefile
1910 helgrind/tests/Makefile
1912 massif/tests/Makefile
1913 massif/perf/Makefile
1916 lackey/tests/Makefile
1919 none/tests/amd64/Makefile
1920 none/tests/ppc32/Makefile
1921 none/tests/ppc64/Makefile
1922 none/tests/x86/Makefile
1923 none/tests/arm/Makefile
1924 none/tests/linux/Makefile
1925 none/tests/darwin/Makefile
1926 none/tests/x86-linux/Makefile
1927 exp-ptrcheck/Makefile
1928 exp-ptrcheck/tests/Makefile
1930 drd/scripts/download-and-build-splash2
1933 exp-bbv/tests/Makefile
1934 exp-bbv/tests/x86/Makefile
1935 exp-bbv/tests/x86-linux/Makefile
1936 exp-bbv/tests/amd64-linux/Makefile
1937 exp-bbv/tests/ppc32-linux/Makefile
1938 exp-bbv/tests/arm-linux/Makefile
1944 Maximum build arch: ${ARCH_MAX}
1945 Primary build arch: ${VGCONF_ARCH_PRI}
1946 Secondary build arch: ${VGCONF_ARCH_SEC}
1947 Build OS: ${VGCONF_OS}
1948 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1949 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
1950 Default supp files: ${DEFAULT_SUPP}