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.10.0.BETA1],[valgrind-users@lists.sourceforge.net])
12 AC_CONFIG_SRCDIR(coregrind/m_main.c)
13 AC_CONFIG_HEADERS([config.h])
14 AM_INIT_AUTOMAKE([foreign subdir-objects])
18 #----------------------------------------------------------------------------
19 # Checks for various programs.
20 #----------------------------------------------------------------------------
21 CFLAGS="-Wno-long-long $CFLAGS"
22 CXXFLAGS="-Wno-long-long $CXXFLAGS"
29 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
30 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
31 # base (eg. most likely as Darwin-specific tests) we'll need one of the
33 # - put AC_PROG_OBJC in a Darwin-specific part of this file
34 # - Use AC_PROG_OBJC here and up the minimum autoconf version
35 # - Use the following, which is apparently equivalent:
36 # m4_ifdef([AC_PROG_OBJC],
38 # [AC_CHECK_TOOL([OBJC], [gcc])
40 # AC_SUBST([OBJCFLAGS])
43 # provide a very basic definition for AC_PROG_SED if it's not provided by
44 # autoconf (as e.g. in autoconf 2.59).
45 m4_ifndef([AC_PROG_SED],
46 [AC_DEFUN([AC_PROG_SED],
48 AC_CHECK_PROGS([SED],[gsed sed])])])
51 # If no AR variable was specified, look up the name of the archiver. Otherwise
52 # do not touch the AR variable.
53 if test "x$AR" = "x"; then
54 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
56 AC_ARG_VAR([AR],[Archiver command])
58 # Check for the compiler support
59 if test "${GCC}" != "yes" ; then
60 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
63 # figure out where perl lives
64 AC_PATH_PROG(PERL, perl)
66 # figure out where gdb lives
67 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
68 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
70 # some older automake's don't have it so try something on our own
71 ifdef([AM_PROG_AS],[AM_PROG_AS],
81 # Check if 'diff' supports -u (universal diffs) and use it if possible.
83 AC_MSG_CHECKING([for diff -u])
86 # Comparing two identical files results in 0.
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 # Obtain the compiler version.
104 # A few examples of how the ${CC} --version output looks like:
106 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
107 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
108 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
109 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
110 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
111 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
112 # OS/X 10.7: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
113 # Clang: clang version 2.9 (tags/RELEASE_29/final)
114 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
115 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
118 if test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ; then
120 # Don't use -dumpversion with clang: it will always produce "4.2.1".
121 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
122 CFLAGS="$CFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign"
123 CXXFLAGS="$CXXFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign"
126 gcc_version=`${CC} -dumpversion 2>/dev/null`
127 if test "x$gcc_version" = x; then
128 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
132 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang)
134 case "${is_clang}-${gcc_version}" in
136 AC_MSG_RESULT([ok (${gcc_version})])
139 AC_MSG_RESULT([ok (${gcc_version})])
141 clang-2.9|clang-3.*|clang-4.*)
142 AC_MSG_RESULT([ok (clang-${gcc_version})])
145 AC_MSG_RESULT([no (${gcc_version})])
146 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9])
150 #----------------------------------------------------------------------------
151 # Arch/OS/platform tests.
152 #----------------------------------------------------------------------------
153 # We create a number of arch/OS/platform-related variables. We prefix them
154 # all with "VGCONF_" which indicates that they are defined at
155 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
156 # variables used when compiling C files.
160 AC_MSG_CHECKING([for a supported CPU])
162 # ARCH_MAX reflects the most that this CPU can do: for example if it
163 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
164 # Ditto for amd64. It is used for more configuration below, but is not used
167 # Power PC returns powerpc for Big Endian. This was not changed when Little
168 # Endian support was added to the 64-bit architecture. The 64-bit Little
169 # Endian systems explicitly state le in the host_cpu. For clarity in the
170 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianess of
171 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
172 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
173 # Endianess. The name PPC64 or ppc64 to 64-bit systems of either Endianess.
174 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
175 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
178 case "${host_cpu}" in
180 AC_MSG_RESULT([ok (${host_cpu})])
185 AC_MSG_RESULT([ok (${host_cpu})])
190 # this only referrs to 64-bit Big Endian
191 AC_MSG_RESULT([ok (${host_cpu})])
196 # this only referrs to 64-bit Little Endian
197 AC_MSG_RESULT([ok (${host_cpu})])
202 # On Linux this means only a 32-bit capable CPU.
203 AC_MSG_RESULT([ok (${host_cpu})])
208 AC_MSG_RESULT([ok (${host_cpu})])
213 AC_MSG_RESULT([ok (${host_cpu})])
218 AC_MSG_RESULT([ok (${host_cpu})])
223 AC_MSG_RESULT([ok (${host_cpu})])
228 AC_MSG_RESULT([ok (${host_cpu})])
233 AC_MSG_RESULT([ok (${host_cpu})])
238 AC_MSG_RESULT([ok (${host_cpu})])
243 AC_MSG_RESULT([ok (${host_cpu})])
247 AC_MSG_RESULT([no (${host_cpu})])
248 AC_MSG_ERROR([Unsupported host architecture. Sorry])
252 #----------------------------------------------------------------------------
254 # Sometimes it's convenient to subvert the bi-arch build system and
255 # just have a single build even though the underlying platform is
256 # capable of both. Hence handle --enable-only64bit and
257 # --enable-only32bit. Complain if both are issued :-)
258 # [Actually, if either of these options are used, I think both get built,
259 # but only one gets installed. So if you use an in-place build, both can be
262 # Check if a 64-bit only build has been requested
263 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
264 [AC_ARG_ENABLE(only64bit,
265 [ --enable-only64bit do a 64-bit only build],
266 [vg_cv_only64bit=$enableval],
267 [vg_cv_only64bit=no])])
269 # Check if a 32-bit only build has been requested
270 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
271 [AC_ARG_ENABLE(only32bit,
272 [ --enable-only32bit do a 32-bit only build],
273 [vg_cv_only32bit=$enableval],
274 [vg_cv_only32bit=no])])
277 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
279 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
282 #----------------------------------------------------------------------------
284 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
285 # compilation of many C files via -VGO_$(VGCONF_OS) and
286 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
287 AC_MSG_CHECKING([for a supported OS])
294 AC_MSG_RESULT([ok (${host_os})])
297 # Ok, this is linux. Check the kernel version
298 AC_MSG_CHECKING([for the kernel version])
304 AC_MSG_RESULT([2.6.x/3.x family (${kernel})])
305 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x or Linux 3.x])
309 AC_MSG_RESULT([2.4 family (${kernel})])
310 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
314 AC_MSG_RESULT([unsupported (${kernel})])
315 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
322 AC_MSG_RESULT([ok (${host_os})])
324 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
325 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
326 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
327 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
328 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
330 AC_MSG_CHECKING([for the kernel version])
333 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
334 # has only one relevant version, the OS version. The `uname` check
335 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
336 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
337 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
338 # and we don't know of an macros similar to __GLIBC__ to get that info.
340 # XXX: `uname -r` won't do the right thing for cross-compiles, but
341 # that's not a problem yet.
343 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
344 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
345 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
346 # time support for 10.5 (the 9.* pattern just below), I'll leave it
347 # in for now, just in case anybody wants to give it a try. But I'm
348 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
351 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
352 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
353 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
354 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
357 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
358 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
359 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
360 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
363 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
364 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
365 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
366 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
369 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
370 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
371 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
372 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
375 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
376 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
377 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
378 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
381 AC_MSG_RESULT([unsupported (${kernel})])
382 AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x and 13.x (Mac OS X 10.6/7/8/9)])
388 AC_MSG_RESULT([no (${host_os})])
389 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
393 #----------------------------------------------------------------------------
395 # If we are building on a 64 bit platform test to see if the system
396 # supports building 32 bit programs and disable 32 bit support if it
397 # does not support building 32 bit programs
399 case "$ARCH_MAX-$VGCONF_OS" in
400 amd64-linux|ppc64be-linux|arm64-linux)
401 AC_MSG_CHECKING([for 32 bit build support])
404 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
409 vg_cv_only64bit="yes"
412 CFLAGS=$safe_CFLAGS;;
415 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
417 [--enable-only32bit was specified but system does not support 32 bit builds])
420 #----------------------------------------------------------------------------
422 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
423 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
424 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
425 # above) will be "amd64" since that reflects the most that this cpu can do,
426 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
427 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
428 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
429 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
430 AC_SUBST(VGCONF_ARCH_PRI)
432 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
433 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
434 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
435 # It is empty if there is no secondary target.
436 AC_SUBST(VGCONF_ARCH_SEC)
438 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
439 # The entire system, including regression and performance tests, will be
440 # built for this target. The "_CAPS" indicates that the name is in capital
441 # letters, and it also uses '_' rather than '-' as a separator, because it's
442 # used to create various Makefile variables, which are all in caps by
443 # convention and cannot contain '-' characters. This is in contrast to
444 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
445 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
447 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
448 # Valgrind and tools will also be built for this target, but not the
449 # regression or performance tests.
451 # By default, the primary arch is the same as the "max" arch, as commented
452 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
453 # the big case statement just below here, in the case where we're building
454 # on a 64 bit machine but have been requested only to do a 32 bit build.
455 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
457 AC_MSG_CHECKING([for a supported CPU/OS combination])
459 # NB. The load address for a given platform may be specified in more
460 # than one place, in some cases, depending on whether we're doing a biarch,
461 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
462 # Be careful to give consistent values in all subcases. Also, all four
463 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
464 # even if it is to "0xUNSET".
466 case "$ARCH_MAX-$VGCONF_OS" in
468 VGCONF_ARCH_PRI="x86"
470 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
471 VGCONF_PLATFORM_SEC_CAPS=""
472 valt_load_address_pri_norml="0x38000000"
473 valt_load_address_pri_inner="0x28000000"
474 valt_load_address_sec_norml="0xUNSET"
475 valt_load_address_sec_inner="0xUNSET"
476 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
479 valt_load_address_sec_norml="0xUNSET"
480 valt_load_address_sec_inner="0xUNSET"
481 if test x$vg_cv_only64bit = xyes; then
482 VGCONF_ARCH_PRI="amd64"
484 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
485 VGCONF_PLATFORM_SEC_CAPS=""
486 valt_load_address_pri_norml="0x38000000"
487 valt_load_address_pri_inner="0x28000000"
488 elif test x$vg_cv_only32bit = xyes; then
489 VGCONF_ARCH_PRI="x86"
491 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
492 VGCONF_PLATFORM_SEC_CAPS=""
493 valt_load_address_pri_norml="0x38000000"
494 valt_load_address_pri_inner="0x28000000"
496 VGCONF_ARCH_PRI="amd64"
497 VGCONF_ARCH_SEC="x86"
498 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
499 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
500 valt_load_address_pri_norml="0x38000000"
501 valt_load_address_pri_inner="0x28000000"
502 valt_load_address_sec_norml="0x38000000"
503 valt_load_address_sec_inner="0x28000000"
505 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
508 VGCONF_ARCH_PRI="ppc32"
510 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
511 VGCONF_PLATFORM_SEC_CAPS=""
512 valt_load_address_pri_norml="0x38000000"
513 valt_load_address_pri_inner="0x28000000"
514 valt_load_address_sec_norml="0xUNSET"
515 valt_load_address_sec_inner="0xUNSET"
516 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
519 valt_load_address_sec_norml="0xUNSET"
520 valt_load_address_sec_inner="0xUNSET"
521 if test x$vg_cv_only64bit = xyes; then
522 VGCONF_ARCH_PRI="ppc64be"
524 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
525 VGCONF_PLATFORM_SEC_CAPS=""
526 valt_load_address_pri_norml="0x38000000"
527 valt_load_address_pri_inner="0x28000000"
528 elif test x$vg_cv_only32bit = xyes; then
529 VGCONF_ARCH_PRI="ppc32"
531 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
532 VGCONF_PLATFORM_SEC_CAPS=""
533 valt_load_address_pri_norml="0x38000000"
534 valt_load_address_pri_inner="0x28000000"
536 VGCONF_ARCH_PRI="ppc64be"
537 VGCONF_ARCH_SEC="ppc32"
538 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
539 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
540 valt_load_address_pri_norml="0x38000000"
541 valt_load_address_pri_inner="0x28000000"
542 valt_load_address_sec_norml="0x38000000"
543 valt_load_address_sec_inner="0x28000000"
545 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
548 # Little Endian is only supported on PPC64
549 valt_load_address_sec_norml="0xUNSET"
550 valt_load_address_sec_inner="0xUNSET"
551 VGCONF_ARCH_PRI="ppc64le"
553 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
554 VGCONF_PLATFORM_SEC_CAPS=""
555 valt_load_address_pri_norml="0x38000000"
556 valt_load_address_pri_inner="0x28000000"
557 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
559 # Darwin gets identified as 32-bit even when it supports 64-bit.
560 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
561 # all Macs support both 32-bit and 64-bit, so we just build both. If
562 # someone has a really old 32-bit only machine they can (hopefully?)
563 # build with --enable-only32bit. See bug 243362.
564 x86-darwin|amd64-darwin)
566 valt_load_address_sec_norml="0xUNSET"
567 valt_load_address_sec_inner="0xUNSET"
568 if test x$vg_cv_only64bit = xyes; then
569 VGCONF_ARCH_PRI="amd64"
571 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
572 VGCONF_PLATFORM_SEC_CAPS=""
573 valt_load_address_pri_norml="0x138000000"
574 valt_load_address_pri_inner="0x128000000"
575 elif test x$vg_cv_only32bit = xyes; then
576 VGCONF_ARCH_PRI="x86"
578 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
579 VGCONF_PLATFORM_SEC_CAPS=""
580 VGCONF_ARCH_PRI_CAPS="x86"
581 valt_load_address_pri_norml="0x38000000"
582 valt_load_address_pri_inner="0x28000000"
584 VGCONF_ARCH_PRI="amd64"
585 VGCONF_ARCH_SEC="x86"
586 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
587 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
588 valt_load_address_pri_norml="0x138000000"
589 valt_load_address_pri_inner="0x128000000"
590 valt_load_address_sec_norml="0x38000000"
591 valt_load_address_sec_inner="0x28000000"
593 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
596 VGCONF_ARCH_PRI="arm"
597 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
598 VGCONF_PLATFORM_SEC_CAPS=""
599 valt_load_address_pri_norml="0x38000000"
600 valt_load_address_pri_inner="0x28000000"
601 valt_load_address_sec_norml="0xUNSET"
602 valt_load_address_sec_inner="0xUNSET"
603 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
606 valt_load_address_sec_norml="0xUNSET"
607 valt_load_address_sec_inner="0xUNSET"
608 if test x$vg_cv_only64bit = xyes; then
609 VGCONF_ARCH_PRI="arm64"
611 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
612 VGCONF_PLATFORM_SEC_CAPS=""
613 valt_load_address_pri_norml="0x38000000"
614 valt_load_address_pri_inner="0x28000000"
615 elif test x$vg_cv_only32bit = xyes; then
616 VGCONF_ARCH_PRI="arm"
618 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
619 VGCONF_PLATFORM_SEC_CAPS=""
620 valt_load_address_pri_norml="0x38000000"
621 valt_load_address_pri_inner="0x28000000"
623 VGCONF_ARCH_PRI="arm64"
624 VGCONF_ARCH_SEC="arm"
625 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
626 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
627 valt_load_address_pri_norml="0x38000000"
628 valt_load_address_pri_inner="0x28000000"
629 valt_load_address_sec_norml="0x38000000"
630 valt_load_address_sec_inner="0x28000000"
632 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
635 VGCONF_ARCH_PRI="s390x"
637 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
638 VGCONF_PLATFORM_SEC_CAPS=""
639 # To improve branch prediction hit rate we want to have
640 # the generated code close to valgrind (host) code
641 valt_load_address_pri_norml="0x800000000"
642 valt_load_address_pri_inner="0x810000000"
643 valt_load_address_sec_norml="0xUNSET"
644 valt_load_address_sec_inner="0xUNSET"
645 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
648 VGCONF_ARCH_PRI="mips32"
649 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
650 VGCONF_PLATFORM_SEC_CAPS=""
651 valt_load_address_pri_norml="0x38000000"
652 valt_load_address_pri_inner="0x28000000"
653 valt_load_address_sec_norml="0xUNSET"
654 valt_load_address_sec_inner="0xUNSET"
655 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
658 VGCONF_ARCH_PRI="mips64"
659 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
660 VGCONF_PLATFORM_SEC_CAPS=""
661 valt_load_address_pri_norml="0x38000000"
662 valt_load_address_pri_inner="0x28000000"
663 valt_load_address_sec_norml="0xUNSET"
664 valt_load_address_sec_inner="0xUNSET"
665 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
668 VGCONF_ARCH_PRI="unknown"
669 VGCONF_ARCH_SEC="unknown"
670 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
671 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
672 valt_load_address_pri_norml="0xUNSET"
673 valt_load_address_pri_inner="0xUNSET"
674 valt_load_address_sec_norml="0xUNSET"
675 valt_load_address_sec_inner="0xUNSET"
676 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
677 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
681 #----------------------------------------------------------------------------
683 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
685 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
686 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
687 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
688 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
689 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
690 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
691 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
692 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
693 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
694 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
695 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
696 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
697 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
698 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
699 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
700 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
701 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
702 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
703 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
704 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
705 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
706 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
707 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
708 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
709 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
711 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
713 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
714 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
715 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
716 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
717 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
718 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
719 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
720 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
721 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
722 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
723 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
724 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
725 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
726 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
727 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
728 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
729 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
730 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
731 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
732 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
733 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
734 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
735 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
736 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
737 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
738 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
739 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
740 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
741 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
744 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
745 # Relies on the assumption that the primary and secondary targets are
746 # for the same OS, so therefore only necessary to test the primary.
747 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
748 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
749 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
750 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
751 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
752 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
753 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
754 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
755 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
756 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
757 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
758 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
759 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
760 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
763 # Sometimes, in the Makefile.am files, it's useful to know whether or not
764 # there is a secondary target.
765 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
766 test x$VGCONF_PLATFORM_SEC_CAPS != x)
768 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
769 dnl fallback definition
770 dnl The macro is courtesy of Dave Hart:
771 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
772 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
773 if test -z "$$1_TRUE"; then :
782 #----------------------------------------------------------------------------
784 #----------------------------------------------------------------------------
786 # Check if this should be built as an inner Valgrind, to be run within
787 # another Valgrind. Choose the load address accordingly.
788 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
789 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
790 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
791 [AC_ARG_ENABLE(inner,
792 [ --enable-inner enables self-hosting],
793 [vg_cv_inner=$enableval],
795 if test "$vg_cv_inner" = yes; then
796 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
797 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
798 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
800 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
801 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
805 #----------------------------------------------------------------------------
806 # Define MIPS_PAGE_SHIFT (--with-pagesize)
807 #----------------------------------------------------------------------------
808 AC_ARG_WITH(pagesize,
809 [ --with-pagesize= override detected page size (4, 16 or 64)],
814 if test "$psize" = "0"; then
815 psizer=`getconf PAGESIZE`
816 psize=$((${psizer}/1024))
819 if test "$psize" = "4"; then
820 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured page size 4k])
821 elif test "$psize" = "16"; then
822 AC_DEFINE([MIPS_PAGE_SHIFT], 14, [configured page size 16k])
823 elif test "$psize" = "64"; then
824 AC_DEFINE([MIPS_PAGE_SHIFT], 16, [configured page size 64k])
826 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured default page size 4k])
828 AC_MSG_RESULT([checking for Pagesize... ${psize}k])
831 #----------------------------------------------------------------------------
832 # Extra fine-tuning of installation directories
833 #----------------------------------------------------------------------------
835 [ --with-tmpdir=PATH Specify path for temporary files],
838 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
839 AC_SUBST(VG_TMPDIR, [$tmpdir])
842 #----------------------------------------------------------------------------
843 # Libc and suppressions
844 #----------------------------------------------------------------------------
845 # This variable will collect the suppression files to be used.
846 AC_SUBST(DEFAULT_SUPP)
848 AC_CHECK_HEADER([features.h])
850 if test x$ac_cv_header_features_h = xyes; then
851 rm -f conftest.$ac_ext
852 cat <<_ACEOF >conftest.$ac_ext
853 #include <features.h>
854 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
855 glibc version is: __GLIBC__ __GLIBC_MINOR__
858 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
861 # not really a version check
862 AC_EGREP_CPP([DARWIN_LIBC], [
863 #include <sys/cdefs.h>
864 #if defined(__DARWIN_VERS_1050)
868 GLIBC_VERSION="darwin")
870 # not really a version check
871 AC_EGREP_CPP([BIONIC_LIBC], [
872 #if defined(__ANDROID__)
876 GLIBC_VERSION="bionic")
879 AC_MSG_CHECKING([the GLIBC_VERSION version])
881 case "${GLIBC_VERSION}" in
883 AC_MSG_RESULT(2.2 family)
884 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
885 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
886 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
887 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
891 AC_MSG_RESULT(2.3 family)
892 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
893 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
894 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
895 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
899 AC_MSG_RESULT(2.4 family)
900 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
901 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
902 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
903 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
907 AC_MSG_RESULT(2.5 family)
908 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
909 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
910 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
911 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
914 AC_MSG_RESULT(2.6 family)
915 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
916 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
917 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
918 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
921 AC_MSG_RESULT(2.7 family)
922 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
923 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
924 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
925 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
928 AC_MSG_RESULT(2.8 family)
929 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
930 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
931 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
932 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
935 AC_MSG_RESULT(2.9 family)
936 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
937 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
938 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
939 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
942 AC_MSG_RESULT(2.10 family)
943 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
944 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
945 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
946 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
949 AC_MSG_RESULT(2.11 family)
950 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
951 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
952 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
953 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
956 AC_MSG_RESULT(2.12 family)
957 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
958 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
959 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
960 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
963 AC_MSG_RESULT(2.13 family)
964 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
965 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
966 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
967 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
970 AC_MSG_RESULT(2.14 family)
971 AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x])
972 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
973 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
974 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
977 AC_MSG_RESULT(2.15 family)
978 AC_DEFINE([GLIBC_2_15], 1, [Define to 1 if you're using glibc 2.15.x])
979 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
980 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
981 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
984 AC_MSG_RESULT(2.16 family)
985 AC_DEFINE([GLIBC_2_16], 1, [Define to 1 if you're using glibc 2.16.x])
986 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
987 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
988 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
991 AC_MSG_RESULT(2.17 family)
992 AC_DEFINE([GLIBC_2_17], 1, [Define to 1 if you're using glibc 2.17.x])
993 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
994 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
995 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
998 AC_MSG_RESULT(2.18 family)
999 AC_DEFINE([GLIBC_2_18], 1, [Define to 1 if you're using glibc 2.18.x])
1000 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1001 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1002 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1005 AC_MSG_RESULT(2.19 family)
1006 AC_DEFINE([GLIBC_2_19], 1, [Define to 1 if you're using glibc 2.19.x])
1007 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1008 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1009 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1012 AC_MSG_RESULT(Darwin)
1013 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1014 # DEFAULT_SUPP set by kernel version check above.
1017 AC_MSG_RESULT(Bionic)
1018 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1019 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1023 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1024 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.19])
1025 AC_MSG_ERROR([or Darwin or Bionic libc])
1029 AC_SUBST(GLIBC_VERSION)
1032 # Add default suppressions for the X client libraries. Make no
1033 # attempt to detect whether such libraries are installed on the
1034 # build machine (or even if any X facilities are present); just
1035 # add the suppressions antidisirregardless.
1036 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1037 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
1039 # Add glibc and X11 suppressions for exp-sgcheck
1040 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1043 #----------------------------------------------------------------------------
1044 # Platform variants?
1045 #----------------------------------------------------------------------------
1047 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1048 # But there are times where we need a bit more control. The motivating
1049 # and currently only case is Android: this is almost identical to
1050 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1051 # platform variant tags, which get passed in the compile as
1052 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1054 # In almost all cases, the <variant> bit is "vanilla". But for Android
1055 # it is "android" instead.
1057 # Consequently (eg), plain arm-linux would build with
1059 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1061 # whilst an Android build would have
1063 # -DVGP_arm_linux -DVGPV_arm_linux_android
1065 # Same for x86. The setup of the platform variant is pushed relatively far
1066 # down this file in order that we can inspect any of the variables set above.
1068 # In the normal case ..
1069 VGCONF_PLATVARIANT="vanilla"
1072 if test "$GLIBC_VERSION" = "bionic";
1074 VGCONF_PLATVARIANT="android"
1077 AC_SUBST(VGCONF_PLATVARIANT)
1080 # FIXME: do we also want to define automake variables
1081 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1082 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1083 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1084 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1085 # that's what we'd need to do to use this, since what we'd want to write
1088 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1090 # Hmm. Can't think of a nice clean solution to this.
1092 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1093 test x$VGCONF_PLATVARIANT = xvanilla)
1094 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1095 test x$VGCONF_PLATVARIANT = xandroid)
1098 #----------------------------------------------------------------------------
1099 # Checking for various library functions and other definitions
1100 #----------------------------------------------------------------------------
1102 # Check for AT_FDCWD
1104 AC_MSG_CHECKING([for AT_FDCWD])
1105 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1112 ac_have_at_fdcwd=yes
1113 AC_MSG_RESULT([yes])
1119 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1121 # Check for stpncpy function definition in string.h
1122 # This explicitly checks with _GNU_SOURCE defined since that is also
1123 # used in the test case (some systems might define it without anyway
1124 # since stpncpy is part of The Open Group Base Specifications Issue 7
1125 # IEEE Std 1003.1-2008.
1126 AC_MSG_CHECKING([for stpncpy])
1127 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1134 char *r = stpncpy(d, s, n);
1136 ac_have_gnu_stpncpy=yes
1137 AC_MSG_RESULT([yes])
1139 ac_have_gnu_stpncpy=no
1143 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1145 # Check for PTRACE_GETREGS
1147 AC_MSG_CHECKING([for PTRACE_GETREGS])
1148 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1150 #include <sys/ptrace.h>
1151 #include <sys/user.h>
1154 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1156 AC_MSG_RESULT([yes])
1157 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1158 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1164 # Check for CLOCK_MONOTONIC
1166 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1168 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1172 clock_gettime(CLOCK_MONOTONIC, &t);
1175 AC_MSG_RESULT([yes])
1176 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1177 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1183 # Check for PTHREAD_RWLOCK_T
1185 AC_MSG_CHECKING([for pthread_rwlock_t])
1187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1189 #include <pthread.h>
1191 pthread_rwlock_t rwl;
1193 AC_MSG_RESULT([yes])
1194 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1195 [Define to 1 if you have the `pthread_rwlock_t' type.])
1201 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1203 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1205 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1207 #include <pthread.h>
1209 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1211 AC_MSG_RESULT([yes])
1212 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1213 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1219 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1221 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1223 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1225 #include <pthread.h>
1227 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1229 AC_MSG_RESULT([yes])
1230 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1231 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1237 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1239 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1241 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1243 #include <pthread.h>
1245 return (PTHREAD_MUTEX_RECURSIVE_NP);
1247 AC_MSG_RESULT([yes])
1248 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1249 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1255 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1257 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1259 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1261 #include <pthread.h>
1263 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1266 AC_MSG_RESULT([yes])
1267 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1268 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1274 # Check whether pthread_mutex_t has a member called __m_kind.
1276 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1277 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1279 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1282 [#include <pthread.h>])
1285 # Check whether pthread_mutex_t has a member called __data.__kind.
1287 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1288 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1290 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1293 [#include <pthread.h>])
1296 # does this compiler support -maltivec and does it have the include file
1299 AC_MSG_CHECKING([for Altivec])
1304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1305 #include <altivec.h>
1307 vector unsigned int v;
1310 AC_MSG_RESULT([yes])
1311 AC_DEFINE([HAS_ALTIVEC], 1,
1312 [Define to 1 if gcc/as can do Altivec.])
1319 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
1322 # Check that both: the compiler supports -mvsx and that the assembler
1323 # understands VSX instructions. If either of those doesn't work,
1324 # conclude that we can't do VSX. NOTE: basically this is a kludge
1325 # in that it conflates two things that should be separate -- whether
1326 # the compiler understands the flag vs whether the assembler
1327 # understands the opcodes. This really ought to be cleaned up
1328 # and done properly, like it is for x86/x86_64.
1330 AC_MSG_CHECKING([for VSX])
1335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1336 #include <altivec.h>
1338 vector unsigned int v;
1339 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1342 AC_MSG_RESULT([yes])
1349 AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1352 AC_MSG_CHECKING([that assembler knows DFP])
1354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1356 __asm__ __volatile__("dadd 1, 2, 3");
1357 __asm__ __volatile__("dcffix 1, 2");
1360 AC_MSG_RESULT([yes])
1367 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1370 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1372 __asm__ __volatile__("dadd 1, 2, 3");
1373 __asm__ __volatile__("dcffix 1, 2");
1376 AC_MSG_RESULT([yes])
1384 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes -a x$ac_gcc_have_dfp = xyes)
1387 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1388 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1390 _Decimal64 x = 0.0DD;
1392 ac_gcc_have_dfp_type=yes
1393 AC_MSG_RESULT([yes])
1395 ac_gcc_have_dfp_type=no
1399 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_gcc_have_dfp_type = xyes)
1402 AC_MSG_CHECKING([that assembler knows ISA 2.07 ])
1404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1406 __asm__ __volatile__("mtvsrd 1,2 ");
1408 ac_asm_have_isa_2_07=yes
1409 AC_MSG_RESULT([yes])
1411 ac_asm_have_isa_2_07=no
1415 AM_CONDITIONAL(HAS_ISA_2_07, test x$ac_asm_have_isa_2_07 = xyes)
1417 # Check for pthread_create@GLIBC2.0
1418 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1422 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1423 extern int pthread_create_glibc_2_0(void*, const void*,
1424 void *(*)(void*), void*);
1425 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1429 * Apparently on PowerPC linking this program succeeds and generates an
1430 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1432 #error This test does not work properly on PowerPC.
1434 pthread_create_glibc_2_0(0, 0, 0, 0);
1438 ac_have_pthread_create_glibc_2_0=yes
1439 AC_MSG_RESULT([yes])
1440 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1441 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1443 ac_have_pthread_create_glibc_2_0=no
1448 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1449 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1452 # Check for dlinfo RTLD_DI_TLS_MODID
1453 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1457 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1464 size_t sizes[10000];
1465 size_t modid_offset;
1466 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1469 ac_have_dlinfo_rtld_di_tls_modid=yes
1470 AC_MSG_RESULT([yes])
1471 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1472 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1474 ac_have_dlinfo_rtld_di_tls_modid=no
1479 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1480 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1483 # Check for eventfd_t, eventfd() and eventfd_read()
1484 AC_MSG_CHECKING([for eventfd()])
1486 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1487 #include <sys/eventfd.h>
1493 eventfd_read(fd, &ev);
1496 AC_MSG_RESULT([yes])
1497 AC_DEFINE([HAVE_EVENTFD], 1,
1498 [Define to 1 if you have the `eventfd' function.])
1499 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1500 [Define to 1 if you have the `eventfd_read' function.])
1506 # Check whether compiler can process #include <thread> without errors
1507 # clang 3.3 cannot process <thread> from e.g.
1508 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1510 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1512 safe_CXXFLAGS=$CXXFLAGS
1515 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1519 ac_cxx_can_include_thread_header=yes
1520 AC_MSG_RESULT([yes])
1522 ac_cxx_can_include_thread_header=no
1525 CXXFLAGS=$safe_CXXFLAGS
1528 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1531 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1532 # of the user_regs_struct from sys/user.h. They are structurally the same
1533 # but we get either one or the other.
1535 AC_CHECK_TYPE([struct user_regs_struct],
1536 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1537 [[#include <sys/ptrace.h>]
1538 [#include <sys/time.h>]
1539 [#include <sys/user.h>]])
1540 if test "$sys_user_has_user_regs" = "yes"; then
1541 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1542 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1546 #----------------------------------------------------------------------------
1547 # Checking for supported compiler flags.
1548 #----------------------------------------------------------------------------
1550 # does this compiler support -m32 ?
1551 AC_MSG_CHECKING([if gcc accepts -m32])
1556 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1560 AC_MSG_RESULT([yes])
1570 # does this compiler support -m64 ?
1571 AC_MSG_CHECKING([if gcc accepts -m64])
1576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1580 AC_MSG_RESULT([yes])
1590 # does this compiler support -march=mips32 (mips32 default) ?
1591 AC_MSG_CHECKING([if gcc accepts -march=mips32])
1594 CFLAGS="$CFLAGS -march=mips32"
1596 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1599 FLAG_MIPS32="-march=mips32"
1600 AC_MSG_RESULT([yes])
1607 AC_SUBST(FLAG_MIPS32)
1610 # does this compiler support -march=mips64 (mips64 default) ?
1611 AC_MSG_CHECKING([if gcc accepts -march=mips64])
1614 CFLAGS="$CFLAGS -march=mips64"
1616 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1619 FLAG_MIPS64="-march=mips64"
1620 AC_MSG_RESULT([yes])
1627 AC_SUBST(FLAG_MIPS64)
1630 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1631 AC_MSG_CHECKING([if gcc accepts -march=octeon])
1634 CFLAGS="$CFLAGS -march=octeon"
1636 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1639 FLAG_OCTEON="-march=octeon"
1640 AC_MSG_RESULT([yes])
1647 AC_SUBST(FLAG_OCTEON)
1650 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1651 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1654 CFLAGS="$CFLAGS -march=octeon2"
1656 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1659 FLAG_OCTEON2="-march=octeon2"
1660 AC_MSG_RESULT([yes])
1667 AC_SUBST(FLAG_OCTEON2)
1670 # does this compiler support -mmmx ?
1671 AC_MSG_CHECKING([if gcc accepts -mmmx])
1676 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1680 AC_MSG_RESULT([yes])
1690 # does this compiler support -msse ?
1691 AC_MSG_CHECKING([if gcc accepts -msse])
1696 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1700 AC_MSG_RESULT([yes])
1710 # does this compiler support -mpreferred-stack-boundary=2 when
1711 # generating code for a 32-bit target? Note that we only care about
1712 # this when generating code for (32-bit) x86, so if the compiler
1713 # doesn't recognise -m32 it's no big deal. We'll just get code for
1714 # the Memcheck and other helper functions, that is a bit slower than
1715 # it could be, on x86; and no difference at all on any other platform.
1716 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
1719 CFLAGS="-mpreferred-stack-boundary=2 -m32"
1721 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1724 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
1725 AC_MSG_RESULT([yes])
1727 PREFERRED_STACK_BOUNDARY_2=""
1732 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
1735 # Convenience function to check whether GCC supports a particular
1736 # warning option. Takes two arguments, first the warning flag name
1737 # to check (without -W), then the conditional name to set if that
1738 # warning flag is supported.
1739 AC_DEFUN([AC_GCC_WARNING_COND],[
1740 AC_MSG_CHECKING([if gcc accepts -W$1])
1743 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1744 has_warning_flag=yes
1745 AC_MSG_RESULT([yes])], [
1747 AC_MSG_RESULT([no])])
1749 AM_CONDITIONAL([$2], test x$has_warning_flag = xyes)
1752 AC_GCC_WARNING_COND([pointer-sign], [HAS_POINTER_SIGN_WARNING])
1753 AC_GCC_WARNING_COND([write-strings], [HAS_WRITE_STRINGS_WARNING])
1755 # Convenience function to check whether GCC supports a particular
1756 # warning option. Similar to AC_GCC_WARNING_COND, but does a
1757 # substitution instead of setting an conditional. Takes two arguments,
1758 # first the warning flag name to check (without -W), then the
1759 # substitution name to set with -Wno-warning-flag if the flag exists,
1760 # or the empty string if the compiler doesn't accept the flag. Note
1761 # that checking is done against the warning flag itself, but the
1762 # substitution is then done to cancel the warning flag.
1763 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
1764 AC_MSG_CHECKING([if gcc accepts -W$1])
1767 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1768 AC_SUBST([$2], [-Wno-$1])
1769 AC_MSG_RESULT([yes])], [
1771 AC_MSG_RESULT([no])])
1775 AC_GCC_WARNING_SUBST_NO([empty-body], [FLAG_W_NO_EMPTY_BODY])
1776 AC_GCC_WARNING_SUBST_NO([format-zero-length], [FLAG_W_NO_FORMAT_ZERO_LENGTH])
1777 AC_GCC_WARNING_SUBST_NO([tautological-compare], [FLAG_W_NO_TAUTOLOGICAL_COMPARE])
1778 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1779 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
1780 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
1781 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1782 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
1785 # does this compiler support -Wextra or the older -W ?
1787 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1792 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1795 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1796 AC_MSG_RESULT([-Wextra])
1799 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1802 AC_SUBST([FLAG_W_EXTRA], [-W])
1805 AC_SUBST([FLAG_W_EXTRA], [])
1806 AC_MSG_RESULT([not supported])
1812 # does this compiler support -fno-stack-protector ?
1813 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1816 CFLAGS="-fno-stack-protector"
1818 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1821 no_stack_protector=yes
1822 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1823 AC_MSG_RESULT([yes])
1825 no_stack_protector=no
1826 FLAG_FNO_STACK_PROTECTOR=""
1831 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1833 if test x$no_stack_protector = xyes; then
1834 CFLAGS="$CFLAGS -fno-stack-protector"
1835 CXXFLAGS="$CXXFLAGS -fno-stack-protector"
1839 # does this compiler support --param inline-unit-growth=... ?
1841 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1844 CFLAGS="--param inline-unit-growth=900"
1846 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1849 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1850 ["--param inline-unit-growth=900"])
1851 AC_MSG_RESULT([yes])
1853 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1859 # does this compiler support -gdwarf-4 -fdebug-types-section ?
1861 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
1864 CFLAGS="-gdwarf-4 -fdebug-types-section"
1866 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1870 AC_MSG_RESULT([yes])
1875 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
1879 # does this compiler support -gstabs ?
1881 AC_MSG_CHECKING([if gcc accepts -gstabs])
1885 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1889 AC_MSG_RESULT([yes])
1895 AM_CONDITIONAL([HAVE_GSTABS], [test x$ac_have_gstabs = xyes])
1898 # does this compiler support nested functions ?
1900 AC_MSG_CHECKING([if gcc accepts nested functions])
1902 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1903 int foo() { return 1; }
1906 ac_have_nested_functions=yes
1907 AC_MSG_RESULT([yes])
1909 ac_have_nested_functions=no
1912 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
1915 # does this compiler support the 'p' constraint in ASM statements ?
1917 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
1919 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1921 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
1923 ac_have_asm_constraint_p=yes
1924 AC_MSG_RESULT([yes])
1926 ac_have_asm_constraint_p=no
1929 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
1932 # We want to use use the -Ttext-segment option to the linker.
1933 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
1934 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
1935 # semantics are NOT what we want (GNU gold -Ttext is fine).
1937 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
1938 # will reside. -Ttext aligns just the .text section start (but not any
1941 # So test for -Ttext-segment which is supported by all bfd ld versions
1942 # and use that if it exists. If it doesn't exist it must be an older
1943 # version of gold and we can fall back to using -Ttext which has the
1946 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
1949 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml"
1952 [AC_LANG_SOURCE([int _start () { return 0; }])],
1954 linker_using_t_text="no"
1955 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
1956 AC_MSG_RESULT([yes])
1958 linker_using_t_text="yes"
1959 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
1964 # If the linker only supports -Ttext (not -Ttext-segment) then we will
1965 # have to strip any build-id ELF NOTEs from the staticly linked tools.
1966 # Otherwise the build-id NOTE might end up at the default load address.
1967 # (Pedantically if the linker is gold then -Ttext is fine, but newer
1968 # gold versions also support -Ttext-segment. So just assume that unless
1969 # we can use -Ttext-segment we need to strip the build-id NOTEs.
1970 if test "x${linker_using_t_text}" = "xyes"; then
1971 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
1972 # does the linker support -Wl,--build-id=none ? Note, it's
1973 # important that we test indirectly via whichever C compiler
1974 # is selected, rather than testing /usr/bin/ld or whatever
1976 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
1978 CFLAGS="-Wl,--build-id=none"
1981 [AC_LANG_PROGRAM([ ], [return 0;])],
1983 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1984 AC_MSG_RESULT([yes])
1986 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1990 AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
1991 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1995 # does the ppc assembler support "mtocrf" et al?
1996 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1998 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1999 __asm__ __volatile__("mtocrf 4,0");
2000 __asm__ __volatile__("mfocrf 0,4");
2002 ac_have_as_ppc_mftocrf=yes
2003 AC_MSG_RESULT([yes])
2005 ac_have_as_ppc_mftocrf=no
2008 if test x$ac_have_as_ppc_mftocrf = xyes ; then
2009 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2013 # does the ppc assembler support "lfdp" and other phased out floating point insns?
2014 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2016 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2017 do { typedef struct {
2021 dbl_pair_t dbl_pair[3];
2022 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2025 ac_have_as_ppc_fpPO=yes
2026 AC_MSG_RESULT([yes])
2028 ac_have_as_ppc_fpPO=no
2031 if test x$ac_have_as_ppc_fpPO = xyes ; then
2032 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2036 # does the x86/amd64 assembler understand SSE3 instructions?
2037 # Note, this doesn't generate a C-level symbol. It generates a
2038 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
2039 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2041 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2042 do { long long int x;
2043 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2047 AC_MSG_RESULT([yes])
2053 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
2056 # Ditto for SSSE3 instructions (note extra S)
2057 # Note, this doesn't generate a C-level symbol. It generates a
2058 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2059 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2061 save_CFLAGS="$CFLAGS"
2062 CFLAGS="$CFLAGS -msse"
2063 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2064 do { long long int x;
2065 __asm__ __volatile__(
2066 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2069 ac_have_as_ssse3=yes
2070 AC_MSG_RESULT([yes])
2075 CFLAGS="$save_CFLAGS"
2077 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2080 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2081 # Note, this doesn't generate a C-level symbol. It generates a
2082 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
2083 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
2084 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2086 __asm__ __volatile__(
2087 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2090 ac_have_as_pclmulqdq=yes
2091 AC_MSG_RESULT([yes])
2093 ac_have_as_pclmulqdq=no
2097 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2100 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2101 # Note, this doesn't generate a C-level symbol. It generates a
2102 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2103 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2104 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2107 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2108 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2109 * xmm2 should be used.
2111 __asm__ __volatile__(
2112 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2115 ac_have_as_vpclmulqdq=yes
2116 AC_MSG_RESULT([yes])
2118 ac_have_as_vpclmulqdq=no
2122 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2125 # does the x86/amd64 assembler understand the LZCNT instruction?
2126 # Note, this doesn't generate a C-level symbol. It generates a
2127 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
2128 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2130 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2132 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
2135 ac_have_as_lzcnt=yes
2136 AC_MSG_RESULT([yes])
2142 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2145 # does the x86/amd64 assembler understand the LOOPNEL instruction?
2146 # Note, this doesn't generate a C-level symbol. It generates a
2147 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2148 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2150 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2152 __asm__ __volatile__("1: loopnel 1b\n");
2155 ac_have_as_loopnel=yes
2156 AC_MSG_RESULT([yes])
2158 ac_have_as_loopnel=no
2162 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2165 # does the x86/amd64 assembler understand ADDR32 ?
2166 # Note, this doesn't generate a C-level symbol. It generates a
2167 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2168 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2170 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2172 asm volatile ("addr32 rep movsb");
2175 ac_have_as_addr32=yes
2176 AC_MSG_RESULT([yes])
2178 ac_have_as_addr32=no
2182 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2185 # does the x86/amd64 assembler understand SSE 4.2 instructions?
2186 # Note, this doesn't generate a C-level symbol. It generates a
2187 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2188 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2191 do { long long int x;
2192 __asm__ __volatile__(
2193 "crc32q %%r15,%%r15" : : : "r15" );
2194 __asm__ __volatile__(
2195 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2196 __asm__ __volatile__(
2197 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
2200 ac_have_as_sse42=yes
2201 AC_MSG_RESULT([yes])
2207 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2210 # does the x86/amd64 assembler understand AVX instructions?
2211 # Note, this doesn't generate a C-level symbol. It generates a
2212 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2213 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2215 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2216 do { long long int x;
2217 __asm__ __volatile__(
2218 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2219 __asm__ __volatile__(
2220 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2224 AC_MSG_RESULT([yes])
2230 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2233 # does the x86/amd64 assembler understand AVX2 instructions?
2234 # Note, this doesn't generate a C-level symbol. It generates a
2235 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2236 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2238 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2239 do { long long int x;
2240 __asm__ __volatile__(
2241 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2242 __asm__ __volatile__(
2243 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2247 AC_MSG_RESULT([yes])
2253 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2256 # does the x86/amd64 assembler understand TSX instructions and
2257 # the XACQUIRE/XRELEASE prefixes?
2258 # Note, this doesn't generate a C-level symbol. It generates a
2259 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2260 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2262 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2264 __asm__ __volatile__(
2267 " xacquire lock incq 0(%rsp) \n\t"
2268 " xrelease lock incq 0(%rsp) \n"
2273 AC_MSG_RESULT([yes])
2279 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2282 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2283 # Note, this doesn't generate a C-level symbol. It generates a
2284 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2285 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2287 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2288 do { unsigned int h, l;
2289 __asm__ __volatile__(
2290 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
2291 __asm__ __volatile__(
2292 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
2296 AC_MSG_RESULT([yes])
2302 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2305 # does the x86/amd64 assembler understand FMA instructions?
2306 # Note, this doesn't generate a C-level symbol. It generates a
2307 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2308 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2311 do { unsigned int h, l;
2312 __asm__ __volatile__(
2313 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2314 __asm__ __volatile__(
2315 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2316 __asm__ __volatile__(
2317 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2321 AC_MSG_RESULT([yes])
2327 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2330 # does the amd64 assembler understand MPX instructions?
2331 # Note, this doesn't generate a C-level symbol. It generates a
2332 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2333 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2336 asm ("bndmov %bnd0,(%rsp)")
2339 AC_MSG_RESULT([yes])
2345 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2348 # Does the C compiler support the "ifunc" attribute
2349 # Note, this doesn't generate a C-level symbol. It generates a
2350 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2351 # does the x86/amd64 assembler understand MOVBE?
2352 # Note, this doesn't generate a C-level symbol. It generates a
2353 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2354 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2357 do { long long int x;
2358 __asm__ __volatile__(
2359 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
2362 ac_have_as_movbe=yes
2363 AC_MSG_RESULT([yes])
2369 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2372 # Does the C compiler support the "ifunc" attribute
2373 # Note, this doesn't generate a C-level symbol. It generates a
2374 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2375 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2377 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2378 static void mytest(void) {}
2380 static void (*resolve_test(void))(void)
2382 return (void (*)(void))&mytest;
2385 void test(void) __attribute__((ifunc("resolve_test")));
2393 ac_have_ifunc_attr=yes
2394 AC_MSG_RESULT([yes])
2396 ac_have_ifunc_attr=no
2400 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2403 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2404 # when building the tool executables. I think we should get rid of it.
2406 # Check for TLS support in the compiler and linker
2407 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2409 [vg_cv_linktime_tls=yes],
2410 [vg_cv_linktime_tls=no])
2411 # Native compilation: check whether running a program using TLS succeeds.
2412 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2413 # succeeds but running programs using TLS fails.
2414 # Cross-compiling: check whether linking a program using TLS succeeds.
2415 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2416 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2417 [vg_cv_tls=$enableval],
2418 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2422 [vg_cv_tls=$vg_cv_linktime_tls])])])
2424 if test "$vg_cv_tls" = yes; then
2425 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2429 #----------------------------------------------------------------------------
2430 # Checks for C header files.
2431 #----------------------------------------------------------------------------
2434 AC_CHECK_HEADERS([ \
2450 # Verify whether the <linux/futex.h> header is usable.
2451 AC_MSG_CHECKING([if <linux/futex.h> is usable])
2453 save_CFLAGS="$CFLAGS"
2454 CFLAGS="$CFLAGS -D__user="
2455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2456 #include <linux/futex.h>
2460 ac_have_usable_linux_futex_h=yes
2461 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
2462 [Define to 1 if you have a usable <linux/futex.h> header file.])
2463 AC_MSG_RESULT([yes])
2465 ac_have_usable_linux_futex_h=no
2468 CFLAGS="$save_CFLAGS"
2471 #----------------------------------------------------------------------------
2472 # Checks for typedefs, structures, and compiler characteristics.
2473 #----------------------------------------------------------------------------
2480 #----------------------------------------------------------------------------
2481 # Checks for library functions.
2482 #----------------------------------------------------------------------------
2486 AC_CHECK_LIB([pthread], [pthread_create])
2487 AC_CHECK_LIB([rt], [clock_gettime])
2500 pthread_barrier_init \
2501 pthread_condattr_setclock \
2502 pthread_mutex_timedlock \
2503 pthread_rwlock_timedrdlock \
2504 pthread_rwlock_timedwrlock \
2507 pthread_setname_np \
2523 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
2524 # libraries with any shared object and/or executable. This is NOT what we
2525 # want for e.g. vgpreload_core-x86-linux.so
2528 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
2529 [test x$ac_cv_func_pthread_barrier_init = xyes])
2530 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
2531 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
2532 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
2533 [test x$ac_cv_func_pthread_spin_lock = xyes])
2534 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
2535 [test x$ac_cv_func_pthread_setname_np = xyes])
2537 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2538 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
2539 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
2540 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
2543 #----------------------------------------------------------------------------
2545 #----------------------------------------------------------------------------
2546 # Do we have a useable MPI setup on the primary and/or secondary targets?
2547 # On Linux, by default, assumes mpicc and -m32/-m64
2548 # Note: this is a kludge in that it assumes the specified mpicc
2549 # understands -m32/-m64 regardless of what is specified using
2551 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
2552 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
2555 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
2556 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
2557 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
2558 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2559 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
2560 mflag_primary=$FLAG_M32
2561 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
2562 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
2563 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
2564 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
2565 mflag_primary=$FLAG_M64
2566 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
2567 mflag_primary="$FLAG_M32 -arch i386"
2568 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
2569 mflag_primary="$FLAG_M64 -arch x86_64"
2573 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
2574 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
2575 mflag_secondary=$FLAG_M32
2576 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
2577 mflag_secondary="$FLAG_M32 -arch i386"
2582 [ --with-mpicc= Specify name of MPI2-ised C compiler],
2587 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
2588 ## use these values in the check for a functioning mpicc.
2590 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
2591 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
2592 AM_COND_IF([VGCONF_OS_IS_LINUX],
2593 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
2594 LDFLAGS_MPI="-fpic -shared"])
2595 AM_COND_IF([VGCONF_OS_IS_DARWIN],
2596 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
2597 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
2599 AC_SUBST([CFLAGS_MPI])
2600 AC_SUBST([LDFLAGS_MPI])
2603 ## See if MPI_CC works for the primary target
2605 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
2607 saved_CFLAGS=$CFLAGS
2609 CFLAGS="$CFLAGS_MPI $mflag_primary"
2610 saved_LDFLAGS="$LDFLAGS"
2611 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
2612 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2616 int ni, na, nd, comb;
2617 int r = MPI_Init(NULL,NULL);
2618 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2619 r |= MPI_Finalize();
2622 ac_have_mpi2_pri=yes
2623 AC_MSG_RESULT([yes, $MPI_CC])
2629 CFLAGS=$saved_CFLAGS
2630 LDFLAGS="$saved_LDFLAGS"
2631 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
2633 ## See if MPI_CC works for the secondary target. Complication: what if
2634 ## there is no secondary target? We need this to then fail.
2635 ## Kludge this by making MPI_CC something which will surely fail in
2638 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
2640 saved_CFLAGS=$CFLAGS
2641 saved_LDFLAGS="$LDFLAGS"
2642 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
2643 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
2644 CC="$MPI_CC this will surely fail"
2648 CFLAGS="$CFLAGS_MPI $mflag_secondary"
2649 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2653 int ni, na, nd, comb;
2654 int r = MPI_Init(NULL,NULL);
2655 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2656 r |= MPI_Finalize();
2659 ac_have_mpi2_sec=yes
2660 AC_MSG_RESULT([yes, $MPI_CC])
2666 CFLAGS=$saved_CFLAGS
2667 LDFLAGS="$saved_LDFLAGS"
2668 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
2671 #----------------------------------------------------------------------------
2672 # Other library checks
2673 #----------------------------------------------------------------------------
2674 # There now follow some tests for Boost, and OpenMP. These
2675 # tests are present because Drd has some regression tests that use
2676 # these packages. All regression test programs all compiled only
2677 # for the primary target. And so it is important that the configure
2678 # checks that follow, use the correct -m32 or -m64 flag for the
2679 # primary target (called $mflag_primary). Otherwise, we can end up
2680 # in a situation (eg) where, on amd64-linux, the test for Boost checks
2681 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
2682 # only build (meaning, the primary target is x86-linux), the build
2683 # of the regtest programs that use Boost fails, because they are
2684 # build as 32-bit (IN THIS EXAMPLE).
2686 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
2687 # NEEDED BY THE REGRESSION TEST PROGRAMS.
2690 # Check whether the boost library 1.35 or later has been installed.
2691 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
2693 AC_MSG_CHECKING([for boost])
2696 safe_CXXFLAGS=$CXXFLAGS
2697 CXXFLAGS="$mflag_primary"
2699 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
2701 AC_LINK_IFELSE([AC_LANG_SOURCE([
2702 #include <boost/thread.hpp>
2703 static void thread_func(void)
2705 int main(int argc, char** argv)
2707 boost::thread t(thread_func);
2712 ac_have_boost_1_35=yes
2713 AC_SUBST([BOOST_CFLAGS], [])
2714 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
2715 AC_MSG_RESULT([yes])
2717 ac_have_boost_1_35=no
2722 CXXFLAGS=$safe_CXXFLAGS
2725 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
2728 # does this compiler support -fopenmp, does it have the include file
2729 # <omp.h> and does it have libgomp ?
2731 AC_MSG_CHECKING([for OpenMP])
2734 CFLAGS="-fopenmp $mflag_primary"
2736 AC_LINK_IFELSE([AC_LANG_SOURCE([
2738 int main(int argc, char** argv)
2746 AC_MSG_RESULT([yes])
2753 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
2756 # does this compiler have built-in functions for atomic memory access for the
2758 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
2761 CFLAGS="$mflag_primary"
2763 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2765 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2766 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
2768 ac_have_builtin_atomic_primary=yes
2769 AC_MSG_RESULT([yes])
2770 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch() for the primary target])
2772 ac_have_builtin_atomic_primary=no
2778 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
2779 [test x$ac_have_builtin_atomic_primary = xyes])
2782 # does this compiler have built-in functions for atomic memory access for the
2783 # secondary target ?
2785 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2787 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
2790 CFLAGS="$mflag_secondary"
2792 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2794 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
2796 ac_have_builtin_atomic_secondary=yes
2797 AC_MSG_RESULT([yes])
2799 ac_have_builtin_atomic_secondary=no
2807 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
2808 [test x$ac_have_builtin_atomic_secondary = xyes])
2810 # does this compiler have built-in functions for atomic memory access on
2811 # 64-bit integers for all targets ?
2813 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
2815 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2818 uint64_t variable = 1;
2819 return __sync_add_and_fetch(&variable, 1)
2821 ac_have_builtin_atomic64_primary=yes
2823 ac_have_builtin_atomic64_primary=no
2826 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2829 CFLAGS="$mflag_secondary"
2831 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2834 uint64_t variable = 1;
2835 return __sync_add_and_fetch(&variable, 1)
2837 ac_have_builtin_atomic64_secondary=yes
2839 ac_have_builtin_atomic64_secondary=no
2846 if test x$ac_have_builtin_atomic64_primary = xyes && \
2847 test x$VGCONF_PLATFORM_SEC_CAPS = x \
2848 -o x$ac_have_builtin_atomic64_secondary = xyes; then
2849 AC_MSG_RESULT([yes])
2850 ac_have_builtin_atomic64=yes
2853 ac_have_builtin_atomic64=no
2856 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
2857 [test x$ac_have_builtin_atomic64 = xyes])
2860 # does g++ have built-in functions for atomic memory access ?
2861 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
2863 safe_CXXFLAGS=$CXXFLAGS
2864 CXXFLAGS="$mflag_primary"
2867 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2869 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2870 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
2872 ac_have_builtin_atomic_cxx=yes
2873 AC_MSG_RESULT([yes])
2874 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
2876 ac_have_builtin_atomic_cxx=no
2881 CXXFLAGS=$safe_CXXFLAGS
2883 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
2886 if test x$ac_have_usable_linux_futex_h = xyes \
2887 -a x$ac_have_builtin_atomic_primary = xyes; then
2888 ac_enable_linux_ticket_lock_primary=yes
2890 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
2891 [test x$ac_enable_linux_ticket_lock_primary = xyes])
2893 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
2894 -a x$ac_have_usable_linux_futex_h = xyes \
2895 -a x$ac_have_builtin_atomic_secondary = xyes; then
2896 ac_enable_linux_ticket_lock_secondary=yes
2898 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
2899 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
2902 # does libstdc++ support annotating shared pointers ?
2903 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
2905 safe_CXXFLAGS=$CXXFLAGS
2906 CXXFLAGS="-std=c++0x"
2909 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2912 std::shared_ptr<int> p
2914 ac_have_shared_ptr=yes
2916 ac_have_shared_ptr=no
2918 if test x$ac_have_shared_ptr = xyes; then
2919 # If compilation of the program below fails because of a syntax error
2920 # triggered by substituting one of the annotation macros then that
2921 # means that libstdc++ supports these macros.
2922 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2923 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
2924 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
2927 std::shared_ptr<int> p
2929 ac_have_shared_pointer_annotation=no
2932 ac_have_shared_pointer_annotation=yes
2933 AC_MSG_RESULT([yes])
2934 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
2935 [Define to 1 if libstd++ supports annotating shared pointers])
2938 ac_have_shared_pointer_annotation=no
2943 CXXFLAGS=$safe_CXXFLAGS
2945 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
2946 [test x$ac_have_shared_pointer_annotation = xyes])
2949 #----------------------------------------------------------------------------
2950 # Ok. We're done checking.
2951 #----------------------------------------------------------------------------
2953 # Nb: VEX/Makefile is generated from Makefile.vex.in.
2956 VEX/Makefile:Makefile.vex.in
2965 gdbserver_tests/Makefile
2971 memcheck/tests/Makefile
2972 memcheck/tests/common/Makefile
2973 memcheck/tests/amd64/Makefile
2974 memcheck/tests/x86/Makefile
2975 memcheck/tests/linux/Makefile
2976 memcheck/tests/darwin/Makefile
2977 memcheck/tests/amd64-linux/Makefile
2978 memcheck/tests/x86-linux/Makefile
2979 memcheck/tests/ppc32/Makefile
2980 memcheck/tests/ppc64/Makefile
2981 memcheck/tests/s390x/Makefile
2982 memcheck/tests/vbit-test/Makefile
2984 cachegrind/tests/Makefile
2985 cachegrind/tests/x86/Makefile
2986 cachegrind/cg_annotate
2989 callgrind/callgrind_annotate
2990 callgrind/callgrind_control
2991 callgrind/tests/Makefile
2993 helgrind/tests/Makefile
2995 massif/tests/Makefile
2998 lackey/tests/Makefile
3001 none/tests/amd64/Makefile
3002 none/tests/ppc32/Makefile
3003 none/tests/ppc64/Makefile
3004 none/tests/x86/Makefile
3005 none/tests/arm/Makefile
3006 none/tests/arm64/Makefile
3007 none/tests/s390x/Makefile
3008 none/tests/mips32/Makefile
3009 none/tests/mips64/Makefile
3010 none/tests/linux/Makefile
3011 none/tests/darwin/Makefile
3012 none/tests/x86-linux/Makefile
3013 exp-sgcheck/Makefile
3014 exp-sgcheck/tests/Makefile
3016 drd/scripts/download-and-build-splash2
3019 exp-bbv/tests/Makefile
3020 exp-bbv/tests/x86/Makefile
3021 exp-bbv/tests/x86-linux/Makefile
3022 exp-bbv/tests/amd64-linux/Makefile
3023 exp-bbv/tests/ppc32-linux/Makefile
3024 exp-bbv/tests/arm-linux/Makefile
3026 exp-dhat/tests/Makefile
3029 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
3030 [chmod +x coregrind/link_tool_exe_linux])
3031 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
3032 [chmod +x coregrind/link_tool_exe_darwin])
3037 Maximum build arch: ${ARCH_MAX}
3038 Primary build arch: ${VGCONF_ARCH_PRI}
3039 Secondary build arch: ${VGCONF_ARCH_SEC}
3040 Build OS: ${VGCONF_OS}
3041 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
3042 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
3043 Platform variant: ${VGCONF_PLATVARIANT}
3044 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
3045 Default supp files: ${DEFAULT_SUPP}