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])
208 AC_MSG_RESULT([ok (${host_os})])
211 # Ok, this is linux. Check the kernel version
212 AC_MSG_CHECKING([for the kernel version])
218 AC_MSG_RESULT([2.6 family (${kernel})])
219 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
223 AC_MSG_RESULT([2.4 family (${kernel})])
224 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
228 AC_MSG_RESULT([unsupported (${kernel})])
229 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
236 AC_MSG_RESULT([ok (${host_os})])
240 AC_MSG_RESULT([ok (${host_os})])
244 AC_MSG_RESULT([ok (${host_os})])
249 AC_MSG_RESULT([ok (${host_os})])
254 AC_MSG_RESULT([ok (${host_os})])
259 AC_MSG_RESULT([ok (${host_os})])
262 AC_MSG_CHECKING([for the kernel version])
265 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
266 # has only one relevant version, the OS version. The `uname` check
267 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
268 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
269 # Snow Leopard and darwin10.supp), and we don't know of an macros
270 # similar to __GLIBC__ to get that info.
272 # XXX: `uname -r` won't do the right thing for cross-compiles, but
273 # that's not a problem yet.
276 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
277 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
278 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
281 AC_MSG_RESULT([unsupported (${kernel})])
282 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
288 AC_MSG_RESULT([no (${host_os})])
289 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
293 #----------------------------------------------------------------------------
295 # If we are building on a 64 bit platform test to see if the system
296 # supports building 32 bit programs and disable 32 bit support if it
297 # does not support building 32 bit programs
299 case "$ARCH_MAX-$VGCONF_OS" in
300 amd64-linux|ppc64-linux)
301 AC_MSG_CHECKING([for 32 bit build support])
310 vg_cv_only64bit="yes"
313 CFLAGS=$safe_CFLAGS;;
316 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
318 [--enable-only32bit was specified but system does not support 32 bit builds])
321 #----------------------------------------------------------------------------
323 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
324 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
325 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
326 # above) will be "amd64" since that reflects the most that this cpu can do,
327 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
328 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
329 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
330 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
331 AC_SUBST(VGCONF_ARCH_PRI)
333 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
334 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
335 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
336 # It is empty if there is no secondary target.
337 AC_SUBST(VGCONF_ARCH_SEC)
339 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
340 # The entire system, including regression and performance tests, will be
341 # built for this target. The "_CAPS" indicates that the name is in capital
342 # letters, and it also uses '_' rather than '-' as a separator, because it's
343 # used to create various Makefile variables, which are all in caps by
344 # convention and cannot contain '-' characters. This is in contrast to
345 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
346 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
348 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
349 # Valgrind and tools will also be built for this target, but not the
350 # regression or performance tests.
352 # By default, the primary arch is the same as the "max" arch, as commented
353 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
354 # the big case statement just below here, in the case where we're building
355 # on a 64 bit machine but have been requested only to do a 32 bit build.
356 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
358 AC_MSG_CHECKING([for a supported CPU/OS combination])
360 case "$ARCH_MAX-$VGCONF_OS" in
362 VGCONF_ARCH_PRI="x86"
364 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
365 VGCONF_PLATFORM_SEC_CAPS=""
366 valt_load_address_normal="0x38000000"
367 valt_load_address_inner="0x28000000"
368 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
371 if test x$vg_cv_only64bit = xyes; then
372 VGCONF_ARCH_PRI="amd64"
374 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
375 VGCONF_PLATFORM_SEC_CAPS=""
376 elif test x$vg_cv_only32bit = xyes; then
377 VGCONF_ARCH_PRI="x86"
379 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
380 VGCONF_PLATFORM_SEC_CAPS=""
382 VGCONF_ARCH_PRI="amd64"
383 VGCONF_ARCH_SEC="x86"
384 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
385 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
387 valt_load_address_normal="0x38000000"
388 valt_load_address_inner="0x28000000"
389 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
392 VGCONF_ARCH_PRI="ppc32"
394 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
395 VGCONF_PLATFORM_SEC_CAPS=""
396 valt_load_address_normal="0x38000000"
397 valt_load_address_inner="0x28000000"
398 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
401 if test x$vg_cv_only64bit = xyes; then
402 VGCONF_ARCH_PRI="ppc64"
404 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
405 VGCONF_PLATFORM_SEC_CAPS=""
406 elif test x$vg_cv_only32bit = xyes; then
407 VGCONF_ARCH_PRI="ppc32"
409 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
410 VGCONF_PLATFORM_SEC_CAPS=""
412 VGCONF_ARCH_PRI="ppc64"
413 VGCONF_ARCH_SEC="ppc32"
414 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
415 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
417 valt_load_address_normal="0x38000000"
418 valt_load_address_inner="0x28000000"
419 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
422 if test x$vg_cv_only64bit = xyes; then
423 VGCONF_ARCH_PRI="ppc64"
425 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
426 VGCONF_PLATFORM_SEC_CAPS=""
427 elif test x$vg_cv_only32bit = xyes; then
428 VGCONF_ARCH_PRI="ppc32"
430 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
431 VGCONF_PLATFORM_SEC_CAPS=""
433 VGCONF_ARCH_PRI="ppc64"
434 VGCONF_ARCH_SEC="ppc32"
435 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
436 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
438 valt_load_address_normal="0x38000000"
439 valt_load_address_inner="0x28000000"
440 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
443 VGCONF_ARCH_PRI="x86"
445 VGCONF_PLATFORM_PRI_CAPS="X86_L4RE"
446 VGCONF_PLATFORM_SEC_CAPS=""
447 valt_load_address_normal="0x38000000"
448 valt_load_address_inner="0x28000000"
449 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
452 VGCONF_ARCH_PRI="x86"
454 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
455 VGCONF_PLATFORM_SEC_CAPS=""
456 valt_load_address_normal="0x0"
457 valt_load_address_inner="0x0"
458 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
461 if test x$vg_cv_only64bit = xyes; then
462 VGCONF_ARCH_PRI="amd64"
464 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
465 VGCONF_PLATFORM_SEC_CAPS=""
466 elif test x$vg_cv_only32bit = xyes; then
467 VGCONF_ARCH_PRI="x86"
469 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
470 VGCONF_PLATFORM_SEC_CAPS=""
471 VGCONF_ARCH_PRI_CAPS="x86"
473 VGCONF_ARCH_PRI="amd64"
474 VGCONF_ARCH_SEC="x86"
475 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
476 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
478 valt_load_address_normal="0x0"
479 valt_load_address_inner="0x0"
480 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
483 VGCONF_ARCH_PRI="arm"
484 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
485 VGCONF_PLATFORM_SEC_CAPS=""
486 valt_load_address_normal="0x38000000"
487 valt_load_address_inner="0x28000000"
488 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
491 VGCONF_ARCH_PRI="unknown"
492 VGCONF_ARCH_SEC="unknown"
493 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
494 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
495 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
496 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
500 #----------------------------------------------------------------------------
502 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
504 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
505 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
506 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
507 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
508 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
509 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
510 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
511 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
512 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
513 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
514 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
515 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
516 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
517 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
518 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
519 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
520 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
521 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
523 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
525 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
526 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
527 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
528 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
529 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
530 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
531 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
532 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
533 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
534 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
535 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
536 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
538 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
539 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
540 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
541 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
542 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
544 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
545 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
546 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
547 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
548 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
549 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_L4RE,
550 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_L4RE)
553 # Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
554 # Relies on the assumption that the primary and secondary targets are
555 # for the same OS, so therefore only necessary to test the primary.
556 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
557 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
558 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
559 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
560 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
561 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
562 AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
563 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
564 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
565 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
566 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
567 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
568 AM_CONDITIONAL(VGCONF_OS_IS_L4RE,
569 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_L4RE)
572 # Sometimes, in the Makefile.am files, it's useful to know whether or not
573 # there is a secondary target.
574 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
575 test x$VGCONF_PLATFORM_SEC_CAPS != x)
578 #----------------------------------------------------------------------------
580 #----------------------------------------------------------------------------
582 # Check if this should be built as an inner Valgrind, to be run within
583 # another Valgrind. Choose the load address accordingly.
584 AC_SUBST(VALT_LOAD_ADDRESS)
585 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
586 [AC_ARG_ENABLE(inner,
587 [ --enable-inner enables self-hosting],
588 [vg_cv_inner=$enableval],
590 if test "$vg_cv_inner" = yes; then
591 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
592 VALT_LOAD_ADDRESS=$valt_load_address_inner
594 VALT_LOAD_ADDRESS=$valt_load_address_normal
598 #----------------------------------------------------------------------------
599 # Libc and suppressions
600 #----------------------------------------------------------------------------
601 # This variable will collect the suppression files to be used.
602 AC_SUBST(DEFAULT_SUPP)
603 # This variable holds generated suppression files (such as the one used for
605 AC_SUBST(GENERATED_SUPP)
609 AC_EGREP_CPP([GLIBC_22], [
610 #include <features.h>
611 #ifdef __GNU_LIBRARY__
612 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
619 AC_EGREP_CPP([GLIBC_23], [
620 #include <features.h>
621 #ifdef __GNU_LIBRARY__
622 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
629 AC_EGREP_CPP([GLIBC_24], [
630 #include <features.h>
631 #ifdef __GNU_LIBRARY__
632 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
639 AC_EGREP_CPP([GLIBC_25], [
640 #include <features.h>
641 #ifdef __GNU_LIBRARY__
642 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
649 AC_EGREP_CPP([GLIBC_26], [
650 #include <features.h>
651 #ifdef __GNU_LIBRARY__
652 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
659 AC_EGREP_CPP([GLIBC_27], [
660 #include <features.h>
661 #ifdef __GNU_LIBRARY__
662 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
669 AC_EGREP_CPP([GLIBC_28], [
670 #include <features.h>
671 #ifdef __GNU_LIBRARY__
672 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
679 AC_EGREP_CPP([GLIBC_29], [
680 #include <features.h>
681 #ifdef __GNU_LIBRARY__
682 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
689 AC_EGREP_CPP([GLIBC_210], [
690 #include <features.h>
691 #ifdef __GNU_LIBRARY__
692 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
697 GLIBC_VERSION="2.10")
699 AC_EGREP_CPP([GLIBC_211], [
700 #include <features.h>
701 #ifdef __GNU_LIBRARY__
702 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 11)
707 GLIBC_VERSION="2.11")
709 AC_EGREP_CPP([AIX5_LIBC], [
710 #include <standards.h>
711 #if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
715 GLIBC_VERSION="aix5")
717 # not really a version check
718 AC_EGREP_CPP([DARWIN_LIBC], [
719 #include <sys/cdefs.h>
720 #if defined(__DARWIN_VERS_1050)
724 GLIBC_VERSION="darwin")
726 AC_MSG_CHECKING([the GLIBC_VERSION version])
728 case "${GLIBC_VERSION}" in
730 AC_MSG_RESULT(2.2 family)
731 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
732 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
733 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
734 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
738 AC_MSG_RESULT(2.3 family)
739 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
740 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
741 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
742 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
746 AC_MSG_RESULT(2.4 family)
747 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
748 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
749 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
750 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
754 AC_MSG_RESULT(2.5 family)
755 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
756 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
757 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
758 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
761 AC_MSG_RESULT(2.6 family)
762 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
763 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
764 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
765 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
768 AC_MSG_RESULT(2.7 family)
769 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
770 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
771 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
772 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
775 AC_MSG_RESULT(2.8 family)
776 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
777 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
778 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
779 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
782 AC_MSG_RESULT(2.9 family)
783 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
784 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
785 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
786 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
789 AC_MSG_RESULT(2.10 family)
790 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
791 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
792 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
793 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
796 AC_MSG_RESULT(2.11 family)
797 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
798 GENERATED_SUPP="glibc-2.X.supp ${GENERATED_SUPP}"
799 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
800 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
803 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
804 AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
805 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
808 AC_MSG_RESULT(Darwin)
809 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
810 # DEFAULT_SUPP set by kernel version check above.
814 AC_MSG_RESULT(unsupported version)
815 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.11])
816 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
817 AC_MSG_ERROR([or Darwin libc])
821 AC_SUBST(GLIBC_VERSION)
824 # Add default suppressions for the X client libraries. Make no
825 # attempt to detect whether such libraries are installed on the
826 # build machine (or even if any X facilities are present); just
827 # add the suppressions antidisirregardless.
828 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
829 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
831 # Add glibc and X11 suppressions for exp-ptrcheck
832 DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
835 #----------------------------------------------------------------------------
836 # Checking for various library functions and other definitions
837 #----------------------------------------------------------------------------
839 # Check for CLOCK_MONOTONIC
841 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
848 clock_gettime(CLOCK_MONOTONIC, &t);
853 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
854 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
860 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
862 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
869 return (PTHREAD_MUTEX_ADAPTIVE_NP);
873 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
874 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
880 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
882 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
889 return (PTHREAD_MUTEX_ERRORCHECK_NP);
893 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
894 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
900 # Check for PTHREAD_MUTEX_RECURSIVE_NP
902 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
909 return (PTHREAD_MUTEX_RECURSIVE_NP);
913 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
914 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
920 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
922 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
929 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
934 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
935 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
941 # Check whether pthread_mutex_t has a member called __m_kind.
943 AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
953 AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
954 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
960 # Check whether pthread_mutex_t has a member called __data.__kind.
962 AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
969 return m.__data.__kind;
972 AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
973 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
979 # does this compiler support -maltivec and does it have the include file
982 AC_MSG_CHECKING([for Altivec])
991 vector unsigned int v;
1002 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
1003 AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
1006 # Check for pthread_create@GLIBC2.0
1007 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1013 extern int pthread_create_glibc_2_0(void*, const void*,
1014 void *(*)(void*), void*);
1015 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1019 * Apparently on PowerPC linking this program succeeds and generates an
1020 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1022 #error This test does not work properly on PowerPC.
1024 pthread_create_glibc_2_0(0, 0, 0, 0);
1029 ac_have_pthread_create_glibc_2_0=yes
1030 AC_MSG_RESULT([yes])
1031 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1032 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1034 ac_have_pthread_create_glibc_2_0=no
1039 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1040 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1043 # Check for eventfd_t, eventfd() and eventfd_read()
1044 AC_MSG_CHECKING([for eventfd()])
1048 #include <sys/eventfd.h>
1054 eventfd_read(fd, &ev);
1058 AC_MSG_RESULT([yes])
1059 AC_DEFINE([HAVE_EVENTFD], 1,
1060 [Define to 1 if you have the `eventfd' function.])
1061 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1062 [Define to 1 if you have the `eventfd_read' function.])
1068 #----------------------------------------------------------------------------
1069 # Checking for supported compiler flags.
1070 #----------------------------------------------------------------------------
1072 # does this compiler support -m32 ?
1073 AC_MSG_CHECKING([if gcc accepts -m32])
1083 AC_MSG_RESULT([yes])
1093 # does this compiler support -maix32 ?
1094 AC_MSG_CHECKING([if gcc accepts -maix32])
1103 FLAG_MAIX32="-maix32"
1104 AC_MSG_RESULT([yes])
1111 AC_SUBST(FLAG_MAIX32)
1114 # does this compiler support -m64 ?
1115 AC_MSG_CHECKING([if gcc accepts -m64])
1125 AC_MSG_RESULT([yes])
1135 # does this compiler support -maix64 ?
1136 AC_MSG_CHECKING([if gcc accepts -maix64])
1145 FLAG_MAIX64="-maix64"
1146 AC_MSG_RESULT([yes])
1153 AC_SUBST(FLAG_MAIX64)
1156 # does this compiler support -mmmx ?
1157 AC_MSG_CHECKING([if gcc accepts -mmmx])
1167 AC_MSG_RESULT([yes])
1177 # does this compiler support -msse ?
1178 AC_MSG_CHECKING([if gcc accepts -msse])
1188 AC_MSG_RESULT([yes])
1198 # does this compiler support -mpreferred-stack-boundary=2 ?
1199 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1202 CFLAGS="-mpreferred-stack-boundary=2"
1208 PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
1209 AC_MSG_RESULT([yes])
1211 PREFERRED_STACK_BOUNDARY=""
1216 AC_SUBST(PREFERRED_STACK_BOUNDARY)
1219 # does this compiler support -Wno-pointer-sign ?
1220 AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
1223 CFLAGS="-Wno-pointer-sign"
1230 AC_MSG_RESULT([yes])
1237 if test x$no_pointer_sign = xyes; then
1238 CFLAGS="$CFLAGS -Wno-pointer-sign"
1242 # does this compiler support -Wno-empty-body ?
1244 AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1247 CFLAGS="-Wno-empty-body"
1255 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1256 AC_MSG_RESULT([yes])
1259 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1265 # does this compiler support -Wno-format-zero-length ?
1267 AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1270 CFLAGS="-Wno-format-zero-length"
1278 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1279 AC_MSG_RESULT([yes])
1282 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1288 # does this compiler support -Wno-uninitialized ?
1290 AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1293 CFLAGS="-Wno-uninitialized"
1301 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1302 AC_MSG_RESULT([yes])
1305 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1311 # does this compiler support -Wextra or the older -W ?
1313 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1324 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1325 AC_MSG_RESULT([-Wextra])
1334 AC_SUBST([FLAG_W_EXTRA], [-W])
1337 AC_SUBST([FLAG_W_EXTRA], [])
1338 AC_MSG_RESULT([not supported])
1344 # does this compiler support -fno-stack-protector ?
1345 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1348 CFLAGS="-fno-stack-protector"
1354 no_stack_protector=yes
1355 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1356 AC_MSG_RESULT([yes])
1358 no_stack_protector=no
1359 FLAG_FNO_STACK_PROTECTOR=""
1364 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1366 if test x$no_stack_protector = xyes; then
1367 CFLAGS="$CFLAGS -fno-stack-protector"
1371 # does this compiler support --param inline-unit-growth=... ?
1373 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1376 CFLAGS="--param inline-unit-growth=900"
1384 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1385 ["--param inline-unit-growth=900"])
1386 AC_MSG_RESULT([yes])
1388 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1394 # does the ppc assembler support "mtocrf" et al?
1395 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1398 __asm__ __volatile__("mtocrf 4,0");
1399 __asm__ __volatile__("mfocrf 0,4");
1402 ac_have_as_ppc_mftocrf=yes
1403 AC_MSG_RESULT([yes])
1405 ac_have_as_ppc_mftocrf=no
1408 if test x$ac_have_as_ppc_mftocrf = xyes ; then
1409 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1413 # does the x86/amd64 assembler understand SSE3 instructions?
1414 # Note, this doesn't generate a C-level symbol. It generates a
1415 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
1416 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1419 do { long long int x;
1420 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1425 AC_MSG_RESULT([yes])
1431 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
1434 # Ditto for SSSE3 instructions (note extra S)
1435 # Note, this doesn't generate a C-level symbol. It generates a
1436 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1437 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1440 do { long long int x;
1441 __asm__ __volatile__(
1442 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1446 ac_have_as_ssse3=yes
1447 AC_MSG_RESULT([yes])
1453 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1456 # Check for TLS support in the compiler and linker
1457 if test "x${cross_compiling}" = "xno"; then
1458 # Native compilation: check whether running a program using TLS succeeds.
1459 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1460 # succeeds but running programs using TLS fails.
1461 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1462 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1463 [vg_cv_tls=$enableval],
1464 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1469 # Cross-compiling: check whether linking a program using TLS succeeds.
1470 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1471 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1472 [vg_cv_tls=$enableval],
1473 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1479 if test "$vg_cv_tls" = yes; then
1480 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1484 #----------------------------------------------------------------------------
1485 # Checks for C header files.
1486 #----------------------------------------------------------------------------
1489 AC_CHECK_HEADERS([ \
1505 #----------------------------------------------------------------------------
1506 # Checks for typedefs, structures, and compiler characteristics.
1507 #----------------------------------------------------------------------------
1514 #----------------------------------------------------------------------------
1515 # Checks for library functions.
1516 #----------------------------------------------------------------------------
1521 AC_CHECK_LIB([rt], [clock_gettime])
1535 pthread_barrier_init \
1536 pthread_condattr_setclock \
1537 pthread_mutex_timedlock \
1538 pthread_rwlock_timedrdlock \
1539 pthread_rwlock_timedwrlock \
1555 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1556 # libraries with any shared object and/or executable. This is NOT what we
1557 # want for e.g. vgpreload_core-x86-linux.so
1560 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1561 [test x$ac_cv_func_pthread_barrier_init = xyes])
1562 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1563 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
1564 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1565 [test x$ac_cv_func_pthread_spin_lock = xyes])
1568 #----------------------------------------------------------------------------
1570 #----------------------------------------------------------------------------
1571 # Do we have a useable MPI setup on the primary and/or secondary targets?
1572 # On Linux, by default, assumes mpicc and -m32/-m64
1573 # On AIX, by default, assumes mpxlc and -q32/-q64
1574 # Note: this is a kludge in that it assumes the specified mpicc
1575 # understands -m32/-m64/-q32/-q64 regardless of what is specified using
1578 if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1579 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1584 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1585 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
1586 mflag_primary=$FLAG_M32
1587 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1588 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
1589 mflag_primary=$FLAG_M64
1590 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
1592 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1597 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1598 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
1599 mflag_secondary=$FLAG_M32
1600 elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
1601 mflag_secondary=-q32
1606 [ --with-mpicc= Specify name of MPI2-ised C compiler],
1611 ## See if MPI_CC works for the primary target
1613 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
1615 saved_CFLAGS=$CFLAGS
1617 CFLAGS=$mflag_primary
1622 int r = MPI_Init(NULL,NULL);
1623 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1626 ac_have_mpi2_pri=yes
1627 AC_MSG_RESULT([yes, $MPI_CC])
1633 CFLAGS=$saved_CFLAGS
1634 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
1636 ## See if MPI_CC works for the secondary target. Complication: what if
1637 ## there is no secondary target? We need this to then fail.
1638 ## Kludge this by making MPI_CC something which will surely fail in
1641 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1643 saved_CFLAGS=$CFLAGS
1644 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
1645 CC="$MPI_CC this will surely fail"
1649 CFLAGS=$mflag_secondary
1654 int r = MPI_Init(NULL,NULL);
1655 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1658 ac_have_mpi2_sec=yes
1659 AC_MSG_RESULT([yes, $MPI_CC])
1665 CFLAGS=$saved_CFLAGS
1666 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
1669 #----------------------------------------------------------------------------
1670 # Other library checks
1671 #----------------------------------------------------------------------------
1672 # There now follow some tests for QtCore, Boost, and OpenMP. These
1673 # tests are present because Drd has some regression tests that use
1674 # these packages. All regression test programs all compiled only
1675 # for the primary target. And so it is important that the configure
1676 # checks that follow, use the correct -m32 or -m64 flag for the
1677 # primary target (called $mflag_primary). Otherwise, we can end up
1678 # in a situation (eg) where, on amd64-linux, the test for Boost checks
1679 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
1680 # only build (meaning, the primary target is x86-linux), the build
1681 # of the regtest programs that use Boost fails, because they are
1682 # build as 32-bit (IN THIS EXAMPLE).
1684 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1685 # NEEDED BY THE REGRESSION TEST PROGRAMS.
1688 # The test below verifies whether the QtCore package been installed.
1689 # This test works as follows:
1690 # - If pkg-config was not installed at the time autogen.sh was run,
1691 # the definition of the PKG_CHECK_EXISTS() macro will not be found by
1692 # autogen.sh. Augogen.sh will generate a configure script that prints
1693 # a warning about pkg-config and proceeds as if Qt4 has not been installed.
1694 # - If pkg-config was installed at the time autogen.sh was run,
1695 # the generated configure script will try to detect the presence of the
1696 # Qt4 QtCore library by looking up compile and linker flags in the file
1698 # - pkg-config settings can be overridden via the configure variables
1699 # QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1700 # configure script -- see also ./configure --help).
1701 # - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1702 # the pkg-config executable is not present on the system on which the
1703 # configure script is run.
1710 PKG_CHECK_MODULES([QTCORE], [QtCore])
1711 # Paranoia: don't trust the result reported by pkg-config, but when
1712 # pkg-config reports that QtCore has been found, verify whether linking
1713 # programs with QtCore succeeds.
1715 safe_CXXFLAGS="${CXXFLAGS}"
1716 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
1718 [#include <QMutex>],
1720 [ac_have_qtcore=yes],
1722 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1726 CXXFLAGS="${safe_CXXFLAGS}"
1733 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1734 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1738 AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1741 # Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1742 # See also http://doc.trolltech.com/4.3/qmutex.html.
1743 if test x$ac_have_qtcore = xyes; then
1744 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1746 safe_CXXFLAGS="${CXXFLAGS}"
1747 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1749 #include <QtCore/QMutex>
1758 AC_MSG_RESULT([yes])
1759 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1764 CXXFLAGS="${safe_CXXFLAGS}"
1769 # Test for QAtomicInt, which has been introduced in Qt 4.4.
1770 # See also http://doc.trolltech.com/4.4/qatomicint.html.
1771 if test x$ac_have_qtcore = xyes; then
1772 AC_MSG_CHECKING([for Qt4 QAtomicInt])
1774 safe_CXXFLAGS="${CXXFLAGS}"
1775 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1777 #include <QtCore/QAtomicInt>
1781 I.testAndSetOrdered(0, 1);
1785 ac_have_qtcore_qatomicint=yes
1786 AC_MSG_RESULT([yes])
1787 AC_DEFINE([HAVE_QTCORE_QATOMICINT], [1], [Define to 1 if the installed version of Qt4 provides QAtomicInt.])
1790 ac_have_qtcore_qatomicint=no
1793 CXXFLAGS="${safe_CXXFLAGS}"
1797 AM_CONDITIONAL([HAVE_QTCORE_QATOMICINT], [test x$ac_have_qtcore_qatomicint = xyes])
1801 # Check whether the boost library 1.35 or later has been installed.
1802 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1804 AC_MSG_CHECKING([for boost])
1807 safe_CXXFLAGS=$CXXFLAGS
1808 CXXFLAGS="-lboost_thread-mt $mflag_primary"
1812 #include <boost/thread.hpp>
1813 static void thread_func(void)
1815 int main(int argc, char** argv)
1817 boost::thread t(thread_func);
1822 ac_have_boost_1_35=yes
1823 AC_SUBST([BOOST_CFLAGS], [])
1824 AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1825 AC_MSG_RESULT([yes])
1827 ac_have_boost_1_35=no
1831 CXXFLAGS=$safe_CXXFLAGS
1834 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1837 # does this compiler support -fopenmp, does it have the include file
1838 # <omp.h> and does it have libgomp ?
1840 AC_MSG_CHECKING([for OpenMP])
1843 CFLAGS="-fopenmp $mflag_primary"
1848 int main(int argc, char** argv)
1856 AC_MSG_RESULT([yes])
1863 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1866 # does this compiler have built-in functions for atomic memory access ?
1867 AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1870 CFLAGS="$mflag_primary"
1875 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1876 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1879 ac_have_builtin_atomic=yes
1880 AC_MSG_RESULT([yes])
1881 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1884 ac_have_builtin_atomic=no
1890 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1893 #----------------------------------------------------------------------------
1894 # Ok. We're done checking.
1895 #----------------------------------------------------------------------------
1897 # Nb: VEX/Makefile is generated from Makefile.vex.in.
1900 VEX/Makefile:Makefile.vex.in
1914 memcheck/tests/Makefile
1915 memcheck/tests/amd64/Makefile
1916 memcheck/tests/x86/Makefile
1917 memcheck/tests/linux/Makefile
1918 memcheck/tests/darwin/Makefile
1919 memcheck/tests/x86-linux/Makefile
1920 memcheck/perf/Makefile
1922 cachegrind/tests/Makefile
1923 cachegrind/tests/x86/Makefile
1924 cachegrind/cg_annotate
1926 callgrind/callgrind_annotate
1927 callgrind/callgrind_control
1928 callgrind/tests/Makefile
1930 helgrind/tests/Makefile
1932 massif/tests/Makefile
1933 massif/perf/Makefile
1936 lackey/tests/Makefile
1939 none/tests/amd64/Makefile
1940 none/tests/ppc32/Makefile
1941 none/tests/ppc64/Makefile
1942 none/tests/x86/Makefile
1943 none/tests/arm/Makefile
1944 none/tests/linux/Makefile
1945 none/tests/darwin/Makefile
1946 none/tests/x86-linux/Makefile
1947 exp-ptrcheck/Makefile
1948 exp-ptrcheck/tests/Makefile
1950 drd/scripts/download-and-build-splash2
1953 exp-bbv/tests/Makefile
1954 exp-bbv/tests/x86/Makefile
1955 exp-bbv/tests/x86-linux/Makefile
1956 exp-bbv/tests/amd64-linux/Makefile
1957 exp-bbv/tests/ppc32-linux/Makefile
1963 Maximum build arch: ${ARCH_MAX}
1964 Primary build arch: ${VGCONF_ARCH_PRI}
1965 Secondary build arch: ${VGCONF_ARCH_SEC}
1966 Build OS: ${VGCONF_OS}
1967 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1968 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
1969 Default supp files: ${DEFAULT_SUPP}
1970 Generated supp files: ${GENERATED_SUPP}