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])
219 AC_MSG_RESULT([ok (${host_os})])
222 # Ok, this is linux. Check the kernel version
223 AC_MSG_CHECKING([for the kernel version])
229 AC_MSG_RESULT([2.6 family (${kernel})])
230 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
234 AC_MSG_RESULT([2.4 family (${kernel})])
235 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
239 AC_MSG_RESULT([unsupported (${kernel})])
240 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
247 AC_MSG_RESULT([ok (${host_os})])
251 AC_MSG_RESULT([ok (${host_os})])
255 AC_MSG_RESULT([ok (${host_os})])
260 AC_MSG_RESULT([ok (${host_os})])
262 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
263 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
264 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
266 AC_MSG_CHECKING([for the kernel version])
269 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
270 # has only one relevant version, the OS version. The `uname` check
271 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
272 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard),
273 # and we don't know of an macros similar to __GLIBC__ to get that info.
275 # XXX: `uname -r` won't do the right thing for cross-compiles, but
276 # that's not a problem yet.
279 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
280 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
281 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
282 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
285 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
286 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
287 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
288 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
291 AC_MSG_RESULT([unsupported (${kernel})])
292 AC_MSG_ERROR([Valgrind works on Darwin 9.x and 10.x (Mac OS X 10.5 and 10.6)])
298 AC_MSG_RESULT([no (${host_os})])
299 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
303 #----------------------------------------------------------------------------
305 # If we are building on a 64 bit platform test to see if the system
306 # supports building 32 bit programs and disable 32 bit support if it
307 # does not support building 32 bit programs
309 case "$ARCH_MAX-$VGCONF_OS" in
310 amd64-linux|ppc64-linux)
311 AC_MSG_CHECKING([for 32 bit build support])
320 vg_cv_only64bit="yes"
323 CFLAGS=$safe_CFLAGS;;
326 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
328 [--enable-only32bit was specified but system does not support 32 bit builds])
331 #----------------------------------------------------------------------------
333 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
334 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
335 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
336 # above) will be "amd64" since that reflects the most that this cpu can do,
337 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
338 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
339 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
340 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
341 AC_SUBST(VGCONF_ARCH_PRI)
343 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
344 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
345 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
346 # It is empty if there is no secondary target.
347 AC_SUBST(VGCONF_ARCH_SEC)
349 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
350 # The entire system, including regression and performance tests, will be
351 # built for this target. The "_CAPS" indicates that the name is in capital
352 # letters, and it also uses '_' rather than '-' as a separator, because it's
353 # used to create various Makefile variables, which are all in caps by
354 # convention and cannot contain '-' characters. This is in contrast to
355 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
356 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
358 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
359 # Valgrind and tools will also be built for this target, but not the
360 # regression or performance tests.
362 # By default, the primary arch is the same as the "max" arch, as commented
363 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
364 # the big case statement just below here, in the case where we're building
365 # on a 64 bit machine but have been requested only to do a 32 bit build.
366 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
368 AC_MSG_CHECKING([for a supported CPU/OS combination])
370 # NB. The load address for a given platform may be specified in more
371 # than one place, in some cases, depending on whether we're doing a biarch,
372 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
373 # Be careful to give consistent values in all subcases. Also, all four
374 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
375 # even if it is to "0xUNSET".
377 case "$ARCH_MAX-$VGCONF_OS" in
379 VGCONF_ARCH_PRI="x86"
381 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
382 VGCONF_PLATFORM_SEC_CAPS=""
383 valt_load_address_pri_norml="0x38000000"
384 valt_load_address_pri_inner="0x28000000"
385 valt_load_address_sec_norml="0xUNSET"
386 valt_load_address_sec_inner="0xUNSET"
387 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
390 valt_load_address_sec_norml="0xUNSET"
391 valt_load_address_sec_inner="0xUNSET"
392 if test x$vg_cv_only64bit = xyes; then
393 VGCONF_ARCH_PRI="amd64"
395 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
396 VGCONF_PLATFORM_SEC_CAPS=""
397 valt_load_address_pri_norml="0x38000000"
398 valt_load_address_pri_inner="0x28000000"
399 elif test x$vg_cv_only32bit = xyes; then
400 VGCONF_ARCH_PRI="x86"
402 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
403 VGCONF_PLATFORM_SEC_CAPS=""
404 valt_load_address_pri_norml="0x38000000"
405 valt_load_address_pri_inner="0x28000000"
407 VGCONF_ARCH_PRI="amd64"
408 VGCONF_ARCH_SEC="x86"
409 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
410 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
411 valt_load_address_pri_norml="0x38000000"
412 valt_load_address_pri_inner="0x28000000"
413 valt_load_address_sec_norml="0x38000000"
414 valt_load_address_sec_inner="0x28000000"
416 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
419 VGCONF_ARCH_PRI="ppc32"
421 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
422 VGCONF_PLATFORM_SEC_CAPS=""
423 valt_load_address_pri_norml="0x38000000"
424 valt_load_address_pri_inner="0x28000000"
425 valt_load_address_sec_norml="0xUNSET"
426 valt_load_address_sec_inner="0xUNSET"
427 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
430 valt_load_address_pri_norml="0xUNSET"
431 valt_load_address_pri_inner="0xUNSET"
432 valt_load_address_sec_norml="0xUNSET"
433 valt_load_address_sec_inner="0xUNSET"
434 if test x$vg_cv_only64bit = xyes; then
435 VGCONF_ARCH_PRI="ppc64"
437 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
438 VGCONF_PLATFORM_SEC_CAPS=""
439 elif test x$vg_cv_only32bit = xyes; then
440 VGCONF_ARCH_PRI="ppc32"
442 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
443 VGCONF_PLATFORM_SEC_CAPS=""
445 VGCONF_ARCH_PRI="ppc64"
446 VGCONF_ARCH_SEC="ppc32"
447 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
448 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
450 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
453 valt_load_address_sec_norml="0xUNSET"
454 valt_load_address_sec_inner="0xUNSET"
455 if test x$vg_cv_only64bit = xyes; then
456 VGCONF_ARCH_PRI="ppc64"
458 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
459 VGCONF_PLATFORM_SEC_CAPS=""
460 valt_load_address_pri_norml="0x38000000"
461 valt_load_address_pri_inner="0x28000000"
462 elif test x$vg_cv_only32bit = xyes; then
463 VGCONF_ARCH_PRI="ppc32"
465 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
466 VGCONF_PLATFORM_SEC_CAPS=""
467 valt_load_address_pri_norml="0x38000000"
468 valt_load_address_pri_inner="0x28000000"
470 VGCONF_ARCH_PRI="ppc64"
471 VGCONF_ARCH_SEC="ppc32"
472 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
473 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
474 valt_load_address_pri_norml="0x38000000"
475 valt_load_address_pri_inner="0x28000000"
476 valt_load_address_sec_norml="0x38000000"
477 valt_load_address_sec_inner="0x28000000"
479 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
481 # Darwin gets identified as 32-bit even when it supports 64-bit.
482 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
483 # all Macs support both 32-bit and 64-bit, so we just build both. If
484 # someone has a really old 32-bit only machine they can (hopefully?)
485 # build with --enable-only32bit. See bug 243362.
486 x86-darwin|amd64-darwin)
488 valt_load_address_sec_norml="0xUNSET"
489 valt_load_address_sec_inner="0xUNSET"
490 if test x$vg_cv_only64bit = xyes; then
491 VGCONF_ARCH_PRI="amd64"
493 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
494 VGCONF_PLATFORM_SEC_CAPS=""
495 valt_load_address_pri_norml="0x138000000"
496 valt_load_address_pri_inner="0x128000000"
497 elif test x$vg_cv_only32bit = xyes; then
498 VGCONF_ARCH_PRI="x86"
500 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
501 VGCONF_PLATFORM_SEC_CAPS=""
502 VGCONF_ARCH_PRI_CAPS="x86"
503 valt_load_address_pri_norml="0x38000000"
504 valt_load_address_pri_inner="0x28000000"
506 VGCONF_ARCH_PRI="amd64"
507 VGCONF_ARCH_SEC="x86"
508 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
509 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
510 valt_load_address_pri_norml="0x138000000"
511 valt_load_address_pri_inner="0x128000000"
512 valt_load_address_sec_norml="0x38000000"
513 valt_load_address_sec_inner="0x28000000"
515 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
518 VGCONF_ARCH_PRI="arm"
519 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
520 VGCONF_PLATFORM_SEC_CAPS=""
521 valt_load_address_pri_norml="0x38000000"
522 valt_load_address_pri_inner="0x28000000"
523 valt_load_address_sec_norml="0xUNSET"
524 valt_load_address_sec_inner="0xUNSET"
525 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
528 VGCONF_ARCH_PRI="s390x"
530 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
531 VGCONF_PLATFORM_SEC_CAPS=""
532 # we want to have the generated code close to the dispatcher
533 valt_load_address_pri_norml="0x401000000"
534 valt_load_address_pri_inner="0x410000000"
535 valt_load_address_sec_norml="0xUNSET"
536 valt_load_address_sec_inner="0xUNSET"
537 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
540 VGCONF_ARCH_PRI="unknown"
541 VGCONF_ARCH_SEC="unknown"
542 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
543 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
544 valt_load_address_pri_norml="0xUNSET"
545 valt_load_address_pri_inner="0xUNSET"
546 valt_load_address_sec_norml="0xUNSET"
547 valt_load_address_sec_inner="0xUNSET"
548 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
549 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
553 #----------------------------------------------------------------------------
555 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
557 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
558 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
559 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
560 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
561 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
562 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
563 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
564 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
565 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
566 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
567 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
568 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
569 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
570 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
571 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
572 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
573 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
574 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
575 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
576 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
578 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
580 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
581 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
582 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
583 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
584 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
585 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
586 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
587 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
588 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
589 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
590 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
591 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
592 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
593 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
594 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
596 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
597 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
598 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
599 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
600 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
602 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
603 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
604 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
605 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
606 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
609 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
610 # Relies on the assumption that the primary and secondary targets are
611 # for the same OS, so therefore only necessary to test the primary.
612 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
613 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
614 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
615 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
616 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
617 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
618 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX)
619 AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
620 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
621 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
622 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
623 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
624 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
627 # Sometimes, in the Makefile.am files, it's useful to know whether or not
628 # there is a secondary target.
629 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
630 test x$VGCONF_PLATFORM_SEC_CAPS != x)
633 #----------------------------------------------------------------------------
635 #----------------------------------------------------------------------------
637 # Check if this should be built as an inner Valgrind, to be run within
638 # another Valgrind. Choose the load address accordingly.
639 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
640 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
641 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
642 [AC_ARG_ENABLE(inner,
643 [ --enable-inner enables self-hosting],
644 [vg_cv_inner=$enableval],
646 if test "$vg_cv_inner" = yes; then
647 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
648 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
649 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
651 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
652 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
656 #----------------------------------------------------------------------------
657 # Libc and suppressions
658 #----------------------------------------------------------------------------
659 # This variable will collect the suppression files to be used.
660 AC_SUBST(DEFAULT_SUPP)
662 AC_CHECK_HEADER([features.h])
664 if test x$ac_cv_header_features_h = xyes; then
665 rm -f conftest.$ac_ext
666 cat <<_ACEOF >conftest.$ac_ext
667 #include <features.h>
668 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
669 glibc version is: __GLIBC__ __GLIBC_MINOR__
672 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
675 AC_EGREP_CPP([AIX5_LIBC], [
676 #include <standards.h>
677 #if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
681 GLIBC_VERSION="aix5")
683 # not really a version check
684 AC_EGREP_CPP([DARWIN_LIBC], [
685 #include <sys/cdefs.h>
686 #if defined(__DARWIN_VERS_1050)
690 GLIBC_VERSION="darwin")
692 AC_MSG_CHECKING([the GLIBC_VERSION version])
694 case "${GLIBC_VERSION}" in
696 AC_MSG_RESULT(2.2 family)
697 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
698 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
699 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
700 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
704 AC_MSG_RESULT(2.3 family)
705 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
706 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
707 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
708 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
712 AC_MSG_RESULT(2.4 family)
713 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
714 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
715 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
716 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
720 AC_MSG_RESULT(2.5 family)
721 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
722 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
723 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
724 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
727 AC_MSG_RESULT(2.6 family)
728 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
729 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
730 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
731 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
734 AC_MSG_RESULT(2.7 family)
735 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
736 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
737 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
738 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
741 AC_MSG_RESULT(2.8 family)
742 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
743 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
744 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
745 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
748 AC_MSG_RESULT(2.9 family)
749 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
750 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
751 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
752 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
755 AC_MSG_RESULT(2.10 family)
756 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
757 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
758 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
759 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
762 AC_MSG_RESULT(2.11 family)
763 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
764 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
765 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
766 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
769 AC_MSG_RESULT(2.12 family)
770 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
771 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
772 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
773 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
776 AC_MSG_RESULT(2.13 family)
777 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
778 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
779 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
780 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
783 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
784 AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
785 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
788 AC_MSG_RESULT(Darwin)
789 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
790 # DEFAULT_SUPP set by kernel version check above.
794 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
795 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.13])
796 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
797 AC_MSG_ERROR([or Darwin libc])
801 AC_SUBST(GLIBC_VERSION)
804 # Add default suppressions for the X client libraries. Make no
805 # attempt to detect whether such libraries are installed on the
806 # build machine (or even if any X facilities are present); just
807 # add the suppressions antidisirregardless.
808 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
809 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
811 # Add glibc and X11 suppressions for exp-ptrcheck
812 DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
815 #----------------------------------------------------------------------------
816 # Checking for various library functions and other definitions
817 #----------------------------------------------------------------------------
819 # Check for CLOCK_MONOTONIC
821 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
828 clock_gettime(CLOCK_MONOTONIC, &t);
833 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
834 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
840 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
842 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
849 return (PTHREAD_MUTEX_ADAPTIVE_NP);
853 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
854 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
860 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
862 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
869 return (PTHREAD_MUTEX_ERRORCHECK_NP);
873 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
874 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
880 # Check for PTHREAD_MUTEX_RECURSIVE_NP
882 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
889 return (PTHREAD_MUTEX_RECURSIVE_NP);
893 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
894 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
900 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
902 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
909 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
914 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
915 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
921 # Check whether pthread_mutex_t has a member called __m_kind.
923 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
924 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
926 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
929 [#include <pthread.h>])
932 # Check whether pthread_mutex_t has a member called __data.__kind.
934 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
935 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
937 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
940 [#include <pthread.h>])
943 # does this compiler support -maltivec and does it have the include file
946 AC_MSG_CHECKING([for Altivec])
955 vector unsigned int v;
960 AC_DEFINE([HAS_ALTIVEC], 1,
961 [Define to 1 if gcc/as can do Altivec.])
968 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
971 # Check for pthread_create@GLIBC2.0
972 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
978 extern int pthread_create_glibc_2_0(void*, const void*,
979 void *(*)(void*), void*);
980 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
984 * Apparently on PowerPC linking this program succeeds and generates an
985 * executable with the undefined symbol pthread_create@GLIBC_2.0.
987 #error This test does not work properly on PowerPC.
989 pthread_create_glibc_2_0(0, 0, 0, 0);
994 ac_have_pthread_create_glibc_2_0=yes
996 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
997 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
999 ac_have_pthread_create_glibc_2_0=no
1004 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1005 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1008 # Check for eventfd_t, eventfd() and eventfd_read()
1009 AC_MSG_CHECKING([for eventfd()])
1013 #include <sys/eventfd.h>
1019 eventfd_read(fd, &ev);
1023 AC_MSG_RESULT([yes])
1024 AC_DEFINE([HAVE_EVENTFD], 1,
1025 [Define to 1 if you have the `eventfd' function.])
1026 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1027 [Define to 1 if you have the `eventfd_read' function.])
1033 #----------------------------------------------------------------------------
1034 # Checking for supported compiler flags.
1035 #----------------------------------------------------------------------------
1037 # does this compiler support -m32 ?
1038 AC_MSG_CHECKING([if gcc accepts -m32])
1048 AC_MSG_RESULT([yes])
1058 # does this compiler support -maix32 ?
1059 AC_MSG_CHECKING([if gcc accepts -maix32])
1068 FLAG_MAIX32="-maix32"
1069 AC_MSG_RESULT([yes])
1076 AC_SUBST(FLAG_MAIX32)
1079 # does this compiler support -m64 ?
1080 AC_MSG_CHECKING([if gcc accepts -m64])
1090 AC_MSG_RESULT([yes])
1100 # does this compiler support -maix64 ?
1101 AC_MSG_CHECKING([if gcc accepts -maix64])
1110 FLAG_MAIX64="-maix64"
1111 AC_MSG_RESULT([yes])
1118 AC_SUBST(FLAG_MAIX64)
1121 # does this compiler support -mmmx ?
1122 AC_MSG_CHECKING([if gcc accepts -mmmx])
1132 AC_MSG_RESULT([yes])
1142 # does this compiler support -msse ?
1143 AC_MSG_CHECKING([if gcc accepts -msse])
1153 AC_MSG_RESULT([yes])
1163 # does this compiler support -mpreferred-stack-boundary=2 ?
1164 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1167 CFLAGS="-mpreferred-stack-boundary=2"
1173 PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
1174 AC_MSG_RESULT([yes])
1176 PREFERRED_STACK_BOUNDARY=""
1181 AC_SUBST(PREFERRED_STACK_BOUNDARY)
1184 # does this compiler support -Wno-pointer-sign ?
1185 AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
1188 CFLAGS="-Wno-pointer-sign"
1195 AC_MSG_RESULT([yes])
1202 if test x$no_pointer_sign = xyes; then
1203 CFLAGS="$CFLAGS -Wno-pointer-sign"
1207 # does this compiler support -Wno-empty-body ?
1209 AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1212 CFLAGS="-Wno-empty-body"
1220 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1221 AC_MSG_RESULT([yes])
1224 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1230 # does this compiler support -Wno-format-zero-length ?
1232 AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1235 CFLAGS="-Wno-format-zero-length"
1243 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1244 AC_MSG_RESULT([yes])
1247 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1253 # does this compiler support -Wno-uninitialized ?
1255 AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1258 CFLAGS="-Wno-uninitialized"
1266 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1267 AC_MSG_RESULT([yes])
1270 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1276 # does this compiler support -Wextra or the older -W ?
1278 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1289 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1290 AC_MSG_RESULT([-Wextra])
1299 AC_SUBST([FLAG_W_EXTRA], [-W])
1302 AC_SUBST([FLAG_W_EXTRA], [])
1303 AC_MSG_RESULT([not supported])
1309 # does this compiler support -fno-stack-protector ?
1310 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1313 CFLAGS="-fno-stack-protector"
1319 no_stack_protector=yes
1320 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1321 AC_MSG_RESULT([yes])
1323 no_stack_protector=no
1324 FLAG_FNO_STACK_PROTECTOR=""
1329 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1331 if test x$no_stack_protector = xyes; then
1332 CFLAGS="$CFLAGS -fno-stack-protector"
1336 # does this compiler support --param inline-unit-growth=... ?
1338 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1341 CFLAGS="--param inline-unit-growth=900"
1349 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1350 ["--param inline-unit-growth=900"])
1351 AC_MSG_RESULT([yes])
1353 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1359 # does the linker support -Wl,--build-id=none ? Note, it's
1360 # important that we test indirectly via whichever C compiler
1361 # is selected, rather than testing /usr/bin/ld or whatever
1364 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
1367 CFLAGS="-Wl,--build-id=none"
1370 [AC_LANG_PROGRAM([ ], [return 0;])],
1372 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1373 AC_MSG_RESULT([yes])
1375 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1381 # does the ppc assembler support "mtocrf" et al?
1382 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1385 __asm__ __volatile__("mtocrf 4,0");
1386 __asm__ __volatile__("mfocrf 0,4");
1389 ac_have_as_ppc_mftocrf=yes
1390 AC_MSG_RESULT([yes])
1392 ac_have_as_ppc_mftocrf=no
1395 if test x$ac_have_as_ppc_mftocrf = xyes ; then
1396 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1402 # does the x86/amd64 assembler understand SSE3 instructions?
1403 # Note, this doesn't generate a C-level symbol. It generates a
1404 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
1405 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1408 do { long long int x;
1409 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1414 AC_MSG_RESULT([yes])
1420 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
1423 # Ditto for SSSE3 instructions (note extra S)
1424 # Note, this doesn't generate a C-level symbol. It generates a
1425 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1426 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1429 do { long long int x;
1430 __asm__ __volatile__(
1431 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1435 ac_have_as_ssse3=yes
1436 AC_MSG_RESULT([yes])
1442 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1445 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1446 # Note, this doesn't generate a C-level symbol. It generates a
1447 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
1448 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
1451 __asm__ __volatile__(
1452 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1456 ac_have_as_pclmulqdq=yes
1457 AC_MSG_RESULT([yes])
1459 ac_have_as_pclmulqdq=no
1463 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1466 # does the x86/amd64 assembler understand the LZCNT instruction?
1467 # Note, this doesn't generate a C-level symbol. It generates a
1468 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
1469 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1471 AC_TRY_COMPILE([], [
1473 __asm__ __volatile__("lzcnt %rax,%rax");
1477 ac_have_as_lzcnt=yes
1478 AC_MSG_RESULT([yes])
1484 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1487 # does the x86/amd64 assembler understand SSE 4.2 instructions?
1488 # Note, this doesn't generate a C-level symbol. It generates a
1489 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
1490 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
1493 do { long long int x;
1494 __asm__ __volatile__(
1495 "crc32q %%r15,%%r15" : : : "r15" ); }
1499 ac_have_as_sse42=yes
1500 AC_MSG_RESULT([yes])
1506 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
1509 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
1510 # when building the tool executables. I think we should get rid of it.
1512 # Check for TLS support in the compiler and linker
1513 if test "x${cross_compiling}" = "xno"; then
1514 # Native compilation: check whether running a program using TLS succeeds.
1515 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1516 # succeeds but running programs using TLS fails.
1517 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1518 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1519 [vg_cv_tls=$enableval],
1520 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1525 # Cross-compiling: check whether linking a program using TLS succeeds.
1526 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1527 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1528 [vg_cv_tls=$enableval],
1529 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1535 if test "$vg_cv_tls" = yes; then
1536 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1540 #----------------------------------------------------------------------------
1541 # Checks for C header files.
1542 #----------------------------------------------------------------------------
1545 AC_CHECK_HEADERS([ \
1561 #----------------------------------------------------------------------------
1562 # Checks for typedefs, structures, and compiler characteristics.
1563 #----------------------------------------------------------------------------
1570 #----------------------------------------------------------------------------
1571 # Checks for library functions.
1572 #----------------------------------------------------------------------------
1577 AC_CHECK_LIB([pthread], [pthread_create])
1578 AC_CHECK_LIB([rt], [clock_gettime])
1591 pthread_barrier_init \
1592 pthread_condattr_setclock \
1593 pthread_mutex_timedlock \
1594 pthread_rwlock_timedrdlock \
1595 pthread_rwlock_timedwrlock \
1611 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1612 # libraries with any shared object and/or executable. This is NOT what we
1613 # want for e.g. vgpreload_core-x86-linux.so
1616 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1617 [test x$ac_cv_func_pthread_barrier_init = xyes])
1618 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1619 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
1620 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1621 [test x$ac_cv_func_pthread_spin_lock = xyes])
1624 #----------------------------------------------------------------------------
1626 #----------------------------------------------------------------------------
1627 # Do we have a useable MPI setup on the primary and/or secondary targets?
1628 # On Linux, by default, assumes mpicc and -m32/-m64
1629 # On AIX, by default, assumes mpxlc and -q32/-q64
1630 # Note: this is a kludge in that it assumes the specified mpicc
1631 # understands -m32/-m64/-q32/-q64 regardless of what is specified using
1634 if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1635 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1640 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1641 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
1642 mflag_primary=$FLAG_M32
1643 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1644 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
1645 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
1646 mflag_primary=$FLAG_M64
1647 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
1649 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1654 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1655 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
1656 mflag_secondary=$FLAG_M32
1657 elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
1658 mflag_secondary=-q32
1663 [ --with-mpicc= Specify name of MPI2-ised C compiler],
1668 ## See if MPI_CC works for the primary target
1670 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
1672 saved_CFLAGS=$CFLAGS
1674 CFLAGS=$mflag_primary
1679 int r = MPI_Init(NULL,NULL);
1680 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1683 ac_have_mpi2_pri=yes
1684 AC_MSG_RESULT([yes, $MPI_CC])
1690 CFLAGS=$saved_CFLAGS
1691 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
1693 ## See if MPI_CC works for the secondary target. Complication: what if
1694 ## there is no secondary target? We need this to then fail.
1695 ## Kludge this by making MPI_CC something which will surely fail in
1698 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1700 saved_CFLAGS=$CFLAGS
1701 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
1702 CC="$MPI_CC this will surely fail"
1706 CFLAGS=$mflag_secondary
1711 int r = MPI_Init(NULL,NULL);
1712 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1715 ac_have_mpi2_sec=yes
1716 AC_MSG_RESULT([yes, $MPI_CC])
1722 CFLAGS=$saved_CFLAGS
1723 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
1726 #----------------------------------------------------------------------------
1727 # Other library checks
1728 #----------------------------------------------------------------------------
1729 # There now follow some tests for Boost, and OpenMP. These
1730 # tests are present because Drd has some regression tests that use
1731 # these packages. All regression test programs all compiled only
1732 # for the primary target. And so it is important that the configure
1733 # checks that follow, use the correct -m32 or -m64 flag for the
1734 # primary target (called $mflag_primary). Otherwise, we can end up
1735 # in a situation (eg) where, on amd64-linux, the test for Boost checks
1736 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
1737 # only build (meaning, the primary target is x86-linux), the build
1738 # of the regtest programs that use Boost fails, because they are
1739 # build as 32-bit (IN THIS EXAMPLE).
1741 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1742 # NEEDED BY THE REGRESSION TEST PROGRAMS.
1745 # Check whether the boost library 1.35 or later has been installed.
1746 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1748 AC_MSG_CHECKING([for boost])
1751 safe_CXXFLAGS=$CXXFLAGS
1752 CXXFLAGS="-lboost_thread-mt $mflag_primary"
1754 AC_LINK_IFELSE([AC_LANG_SOURCE([
1755 #include <boost/thread.hpp>
1756 static void thread_func(void)
1758 int main(int argc, char** argv)
1760 boost::thread t(thread_func);
1765 ac_have_boost_1_35=yes
1766 AC_SUBST([BOOST_CFLAGS], [])
1767 AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1768 AC_MSG_RESULT([yes])
1770 ac_have_boost_1_35=no
1774 CXXFLAGS=$safe_CXXFLAGS
1777 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1780 # does this compiler support -fopenmp, does it have the include file
1781 # <omp.h> and does it have libgomp ?
1783 AC_MSG_CHECKING([for OpenMP])
1786 CFLAGS="-fopenmp $mflag_primary"
1788 AC_LINK_IFELSE([AC_LANG_SOURCE([
1790 int main(int argc, char** argv)
1798 AC_MSG_RESULT([yes])
1805 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1808 # does this compiler have built-in functions for atomic memory access ?
1809 AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1812 CFLAGS="$mflag_primary"
1817 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1818 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1821 ac_have_builtin_atomic=yes
1822 AC_MSG_RESULT([yes])
1823 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
1826 ac_have_builtin_atomic=no
1832 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1834 # does g++ have built-in functions for atomic memory access ?
1835 AC_MSG_CHECKING([if g++ supports __sync_bool_compare_and_swap])
1837 safe_CXXFLAGS=$CXXFLAGS
1838 CXXFLAGS="$mflag_primary"
1844 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1845 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1848 ac_have_builtin_atomic_cxx=yes
1849 AC_MSG_RESULT([yes])
1850 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
1853 ac_have_builtin_atomic_cxx=no
1858 CXXFLAGS=$safe_CXXFLAGS
1860 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
1862 #----------------------------------------------------------------------------
1863 # Ok. We're done checking.
1864 #----------------------------------------------------------------------------
1866 # Nb: VEX/Makefile is generated from Makefile.vex.in.
1869 VEX/Makefile:Makefile.vex.in
1883 memcheck/tests/Makefile
1884 memcheck/tests/amd64/Makefile
1885 memcheck/tests/x86/Makefile
1886 memcheck/tests/linux/Makefile
1887 memcheck/tests/darwin/Makefile
1888 memcheck/tests/amd64-linux/Makefile
1889 memcheck/tests/x86-linux/Makefile
1890 memcheck/tests/ppc32/Makefile
1891 memcheck/tests/ppc64/Makefile
1892 memcheck/perf/Makefile
1894 cachegrind/tests/Makefile
1895 cachegrind/tests/x86/Makefile
1896 cachegrind/cg_annotate
1899 callgrind/callgrind_annotate
1900 callgrind/callgrind_control
1901 callgrind/tests/Makefile
1903 helgrind/tests/Makefile
1905 massif/tests/Makefile
1906 massif/perf/Makefile
1909 lackey/tests/Makefile
1912 none/tests/amd64/Makefile
1913 none/tests/ppc32/Makefile
1914 none/tests/ppc64/Makefile
1915 none/tests/x86/Makefile
1916 none/tests/arm/Makefile
1917 none/tests/s390x/Makefile
1918 none/tests/linux/Makefile
1919 none/tests/darwin/Makefile
1920 none/tests/x86-linux/Makefile
1921 exp-ptrcheck/Makefile
1922 exp-ptrcheck/tests/Makefile
1924 drd/scripts/download-and-build-splash2
1927 exp-bbv/tests/Makefile
1928 exp-bbv/tests/x86/Makefile
1929 exp-bbv/tests/x86-linux/Makefile
1930 exp-bbv/tests/amd64-linux/Makefile
1931 exp-bbv/tests/ppc32-linux/Makefile
1932 exp-bbv/tests/arm-linux/Makefile
1934 exp-dhat/tests/Makefile
1936 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
1937 [chmod +x coregrind/link_tool_exe_linux])
1938 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
1939 [chmod +x coregrind/link_tool_exe_darwin])
1940 AC_CONFIG_FILES([coregrind/link_tool_exe_aix5],
1941 [chmod +x coregrind/link_tool_exe_aix5])
1946 Maximum build arch: ${ARCH_MAX}
1947 Primary build arch: ${VGCONF_ARCH_PRI}
1948 Secondary build arch: ${VGCONF_ARCH_SEC}
1949 Build OS: ${VGCONF_OS}
1950 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1951 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
1952 Default supp files: ${DEFAULT_SUPP}