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.11.0.SVN],[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 # Do NOT modify these flags here. Except in feature tests in which case
20 # the original values must be properly restored.
21 #----------------------------------------------------------------------------
25 #----------------------------------------------------------------------------
26 # Checks for various programs.
27 #----------------------------------------------------------------------------
34 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
35 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
36 # base (eg. most likely as Darwin-specific tests) we'll need one of the
38 # - put AC_PROG_OBJC in a Darwin-specific part of this file
39 # - Use AC_PROG_OBJC here and up the minimum autoconf version
40 # - Use the following, which is apparently equivalent:
41 # m4_ifdef([AC_PROG_OBJC],
43 # [AC_CHECK_TOOL([OBJC], [gcc])
45 # AC_SUBST([OBJCFLAGS])
48 # provide a very basic definition for AC_PROG_SED if it's not provided by
49 # autoconf (as e.g. in autoconf 2.59).
50 m4_ifndef([AC_PROG_SED],
51 [AC_DEFUN([AC_PROG_SED],
53 AC_CHECK_PROGS([SED],[gsed sed])])])
56 # If no AR variable was specified, look up the name of the archiver. Otherwise
57 # do not touch the AR variable.
58 if test "x$AR" = "x"; then
59 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
61 AC_ARG_VAR([AR],[Archiver command])
63 # Check for the compiler support
64 if test "${GCC}" != "yes" ; then
65 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
68 # figure out where perl lives
69 AC_PATH_PROG(PERL, perl)
71 # figure out where gdb lives
72 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
73 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
75 # some older automake's don't have it so try something on our own
76 ifdef([AM_PROG_AS],[AM_PROG_AS],
86 # Check if 'diff' supports -u (universal diffs) and use it if possible.
88 AC_MSG_CHECKING([for diff -u])
91 # Comparing two identical files results in 0.
92 tmpfile="tmp-xxx-yyy-zzz"
94 if diff -u $tmpfile $tmpfile ; then
104 # We don't want gcc < 3.0
105 AC_MSG_CHECKING([for a supported version of gcc])
107 # Obtain the compiler version.
109 # A few examples of how the ${CC} --version output looks like:
111 # ######## gcc variants ########
112 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
113 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
114 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
115 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
116 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
117 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
118 # 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)
120 # ######## clang variants ########
121 # Clang: clang version 2.9 (tags/RELEASE_29/final)
122 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
123 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
125 # ######## Apple LLVM variants ########
126 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
127 # Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
130 if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
133 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
134 elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
137 # Don't use -dumpversion with clang: it will always produce "4.2.1".
138 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
139 elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
142 gcc_version=`${CC} -dumpversion 2>/dev/null`
145 gcc_version=`${CC} -dumpversion 2>/dev/null`
146 if test "x$gcc_version" = x; then
147 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
151 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
152 AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
154 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
155 # statements have to be quoted.
156 case "${is_clang}-${gcc_version}" in
157 applellvm-5.1|applellvm-6.0*)
158 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
161 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
163 notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
164 AC_MSG_RESULT([ok (${gcc_version})])
166 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
167 AC_MSG_RESULT([ok (clang-${gcc_version})])
170 AC_MSG_RESULT([no (${gcc_version})])
171 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0])
175 #----------------------------------------------------------------------------
176 # Arch/OS/platform tests.
177 #----------------------------------------------------------------------------
178 # We create a number of arch/OS/platform-related variables. We prefix them
179 # all with "VGCONF_" which indicates that they are defined at
180 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
181 # variables used when compiling C files.
185 AC_MSG_CHECKING([for a supported CPU])
187 # ARCH_MAX reflects the most that this CPU can do: for example if it
188 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
189 # Ditto for amd64. It is used for more configuration below, but is not used
192 # Power PC returns powerpc for Big Endian. This was not changed when Little
193 # Endian support was added to the 64-bit architecture. The 64-bit Little
194 # Endian systems explicitly state le in the host_cpu. For clarity in the
195 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianess of
196 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
197 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
198 # Endianess. The name PPC64 or ppc64 to 64-bit systems of either Endianess.
199 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
200 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
203 case "${host_cpu}" in
205 AC_MSG_RESULT([ok (${host_cpu})])
210 AC_MSG_RESULT([ok (${host_cpu})])
215 # this only referrs to 64-bit Big Endian
216 AC_MSG_RESULT([ok (${host_cpu})])
221 # this only referrs to 64-bit Little Endian
222 AC_MSG_RESULT([ok (${host_cpu})])
227 # On Linux this means only a 32-bit capable 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})])
248 AC_MSG_RESULT([ok (${host_cpu})])
253 AC_MSG_RESULT([ok (${host_cpu})])
258 AC_MSG_RESULT([ok (${host_cpu})])
263 AC_MSG_RESULT([ok (${host_cpu})])
268 AC_MSG_RESULT([ok (${host_cpu})])
273 AC_MSG_RESULT([ok (${host_cpu})])
278 AC_MSG_RESULT([no (${host_cpu})])
279 AC_MSG_ERROR([Unsupported host architecture. Sorry])
283 #----------------------------------------------------------------------------
285 # Sometimes it's convenient to subvert the bi-arch build system and
286 # just have a single build even though the underlying platform is
287 # capable of both. Hence handle --enable-only64bit and
288 # --enable-only32bit. Complain if both are issued :-)
289 # [Actually, if either of these options are used, I think both get built,
290 # but only one gets installed. So if you use an in-place build, both can be
293 # Check if a 64-bit only build has been requested
294 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
295 [AC_ARG_ENABLE(only64bit,
296 [ --enable-only64bit do a 64-bit only build],
297 [vg_cv_only64bit=$enableval],
298 [vg_cv_only64bit=no])])
300 # Check if a 32-bit only build has been requested
301 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
302 [AC_ARG_ENABLE(only32bit,
303 [ --enable-only32bit do a 32-bit only build],
304 [vg_cv_only32bit=$enableval],
305 [vg_cv_only32bit=no])])
308 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
310 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
313 #----------------------------------------------------------------------------
315 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
316 # compilation of many C files via -VGO_$(VGCONF_OS) and
317 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
318 AC_MSG_CHECKING([for a supported OS])
325 AC_MSG_RESULT([ok (${host_os})])
328 # Ok, this is linux. Check the kernel version
329 AC_MSG_CHECKING([for the kernel version])
334 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
335 AC_MSG_RESULT([unsupported (${kernel})])
336 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
340 AC_MSG_RESULT([2.6 or later (${kernel})])
347 AC_MSG_RESULT([ok (${host_os})])
349 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
350 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
351 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
352 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
353 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
354 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
356 AC_MSG_CHECKING([for the kernel version])
359 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
360 # has only one relevant version, the OS version. The `uname` check
361 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
362 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
363 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
364 # and we don't know of an macros similar to __GLIBC__ to get that info.
366 # XXX: `uname -r` won't do the right thing for cross-compiles, but
367 # that's not a problem yet.
369 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
370 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
371 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
372 # time support for 10.5 (the 9.* pattern just below), I'll leave it
373 # in for now, just in case anybody wants to give it a try. But I'm
374 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
377 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
378 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
379 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
380 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
383 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
384 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
385 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
386 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
389 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
390 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
391 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
392 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
395 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
396 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
397 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
398 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
401 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
402 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
403 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
404 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
407 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
408 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
409 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
410 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
413 AC_MSG_RESULT([unsupported (${kernel})])
414 AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x and 14.x (Mac OS X 10.6/7/8/9/10)])
420 AC_MSG_RESULT([no (${host_os})])
421 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
425 #----------------------------------------------------------------------------
427 # If we are building on a 64 bit platform test to see if the system
428 # supports building 32 bit programs and disable 32 bit support if it
429 # does not support building 32 bit programs
431 case "$ARCH_MAX-$VGCONF_OS" in
432 amd64-linux|ppc64be-linux|arm64-linux)
433 AC_MSG_CHECKING([for 32 bit build support])
436 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
441 vg_cv_only64bit="yes"
444 CFLAGS=$safe_CFLAGS;;
447 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
449 [--enable-only32bit was specified but system does not support 32 bit builds])
452 #----------------------------------------------------------------------------
454 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
455 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
456 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
457 # above) will be "amd64" since that reflects the most that this cpu can do,
458 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
459 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
460 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
461 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
462 AC_SUBST(VGCONF_ARCH_PRI)
464 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
465 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
466 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
467 # It is empty if there is no secondary target.
468 AC_SUBST(VGCONF_ARCH_SEC)
470 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
471 # The entire system, including regression and performance tests, will be
472 # built for this target. The "_CAPS" indicates that the name is in capital
473 # letters, and it also uses '_' rather than '-' as a separator, because it's
474 # used to create various Makefile variables, which are all in caps by
475 # convention and cannot contain '-' characters. This is in contrast to
476 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
477 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
479 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
480 # Valgrind and tools will also be built for this target, but not the
481 # regression or performance tests.
483 # By default, the primary arch is the same as the "max" arch, as commented
484 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
485 # the big case statement just below here, in the case where we're building
486 # on a 64 bit machine but have been requested only to do a 32 bit build.
487 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
489 AC_MSG_CHECKING([for a supported CPU/OS combination])
491 # NB. The load address for a given platform may be specified in more
492 # than one place, in some cases, depending on whether we're doing a biarch,
493 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
494 # Be careful to give consistent values in all subcases. Also, all four
495 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
496 # even if it is to "0xUNSET".
498 case "$ARCH_MAX-$VGCONF_OS" in
500 VGCONF_ARCH_PRI="x86"
502 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
503 VGCONF_PLATFORM_SEC_CAPS=""
504 valt_load_address_pri_norml="0x38000000"
505 valt_load_address_pri_inner="0x28000000"
506 valt_load_address_sec_norml="0xUNSET"
507 valt_load_address_sec_inner="0xUNSET"
508 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
511 valt_load_address_sec_norml="0xUNSET"
512 valt_load_address_sec_inner="0xUNSET"
513 if test x$vg_cv_only64bit = xyes; then
514 VGCONF_ARCH_PRI="amd64"
516 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
517 VGCONF_PLATFORM_SEC_CAPS=""
518 valt_load_address_pri_norml="0x38000000"
519 valt_load_address_pri_inner="0x28000000"
520 elif test x$vg_cv_only32bit = xyes; then
521 VGCONF_ARCH_PRI="x86"
523 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
524 VGCONF_PLATFORM_SEC_CAPS=""
525 valt_load_address_pri_norml="0x38000000"
526 valt_load_address_pri_inner="0x28000000"
528 VGCONF_ARCH_PRI="amd64"
529 VGCONF_ARCH_SEC="x86"
530 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
531 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
532 valt_load_address_pri_norml="0x38000000"
533 valt_load_address_pri_inner="0x28000000"
534 valt_load_address_sec_norml="0x38000000"
535 valt_load_address_sec_inner="0x28000000"
537 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
540 VGCONF_ARCH_PRI="ppc32"
542 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
543 VGCONF_PLATFORM_SEC_CAPS=""
544 valt_load_address_pri_norml="0x38000000"
545 valt_load_address_pri_inner="0x28000000"
546 valt_load_address_sec_norml="0xUNSET"
547 valt_load_address_sec_inner="0xUNSET"
548 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
551 valt_load_address_sec_norml="0xUNSET"
552 valt_load_address_sec_inner="0xUNSET"
553 if test x$vg_cv_only64bit = xyes; then
554 VGCONF_ARCH_PRI="ppc64be"
556 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
557 VGCONF_PLATFORM_SEC_CAPS=""
558 valt_load_address_pri_norml="0x38000000"
559 valt_load_address_pri_inner="0x28000000"
560 elif test x$vg_cv_only32bit = xyes; then
561 VGCONF_ARCH_PRI="ppc32"
563 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
564 VGCONF_PLATFORM_SEC_CAPS=""
565 valt_load_address_pri_norml="0x38000000"
566 valt_load_address_pri_inner="0x28000000"
568 VGCONF_ARCH_PRI="ppc64be"
569 VGCONF_ARCH_SEC="ppc32"
570 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
571 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
572 valt_load_address_pri_norml="0x38000000"
573 valt_load_address_pri_inner="0x28000000"
574 valt_load_address_sec_norml="0x38000000"
575 valt_load_address_sec_inner="0x28000000"
577 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
580 # Little Endian is only supported on PPC64
581 valt_load_address_sec_norml="0xUNSET"
582 valt_load_address_sec_inner="0xUNSET"
583 VGCONF_ARCH_PRI="ppc64le"
585 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
586 VGCONF_PLATFORM_SEC_CAPS=""
587 valt_load_address_pri_norml="0x38000000"
588 valt_load_address_pri_inner="0x28000000"
589 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
591 # Darwin gets identified as 32-bit even when it supports 64-bit.
592 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
593 # all Macs support both 32-bit and 64-bit, so we just build both. If
594 # someone has a really old 32-bit only machine they can (hopefully?)
595 # build with --enable-only32bit. See bug 243362.
596 x86-darwin|amd64-darwin)
598 valt_load_address_sec_norml="0xUNSET"
599 valt_load_address_sec_inner="0xUNSET"
600 if test x$vg_cv_only64bit = xyes; then
601 VGCONF_ARCH_PRI="amd64"
603 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
604 VGCONF_PLATFORM_SEC_CAPS=""
605 valt_load_address_pri_norml="0x138000000"
606 valt_load_address_pri_inner="0x128000000"
607 elif test x$vg_cv_only32bit = xyes; then
608 VGCONF_ARCH_PRI="x86"
610 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
611 VGCONF_PLATFORM_SEC_CAPS=""
612 VGCONF_ARCH_PRI_CAPS="x86"
613 valt_load_address_pri_norml="0x38000000"
614 valt_load_address_pri_inner="0x28000000"
616 VGCONF_ARCH_PRI="amd64"
617 VGCONF_ARCH_SEC="x86"
618 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
619 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
620 valt_load_address_pri_norml="0x138000000"
621 valt_load_address_pri_inner="0x128000000"
622 valt_load_address_sec_norml="0x38000000"
623 valt_load_address_sec_inner="0x28000000"
625 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
628 VGCONF_ARCH_PRI="arm"
629 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
630 VGCONF_PLATFORM_SEC_CAPS=""
631 valt_load_address_pri_norml="0x38000000"
632 valt_load_address_pri_inner="0x28000000"
633 valt_load_address_sec_norml="0xUNSET"
634 valt_load_address_sec_inner="0xUNSET"
635 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
638 valt_load_address_sec_norml="0xUNSET"
639 valt_load_address_sec_inner="0xUNSET"
640 if test x$vg_cv_only64bit = xyes; then
641 VGCONF_ARCH_PRI="arm64"
643 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
644 VGCONF_PLATFORM_SEC_CAPS=""
645 valt_load_address_pri_norml="0x38000000"
646 valt_load_address_pri_inner="0x28000000"
647 elif test x$vg_cv_only32bit = xyes; then
648 VGCONF_ARCH_PRI="arm"
650 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
651 VGCONF_PLATFORM_SEC_CAPS=""
652 valt_load_address_pri_norml="0x38000000"
653 valt_load_address_pri_inner="0x28000000"
655 VGCONF_ARCH_PRI="arm64"
656 VGCONF_ARCH_SEC="arm"
657 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
658 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
659 valt_load_address_pri_norml="0x38000000"
660 valt_load_address_pri_inner="0x28000000"
661 valt_load_address_sec_norml="0x38000000"
662 valt_load_address_sec_inner="0x28000000"
664 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
667 VGCONF_ARCH_PRI="s390x"
669 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
670 VGCONF_PLATFORM_SEC_CAPS=""
671 # To improve branch prediction hit rate we want to have
672 # the generated code close to valgrind (host) code
673 valt_load_address_pri_norml="0x800000000"
674 valt_load_address_pri_inner="0x810000000"
675 valt_load_address_sec_norml="0xUNSET"
676 valt_load_address_sec_inner="0xUNSET"
677 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
680 VGCONF_ARCH_PRI="mips32"
681 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
682 VGCONF_PLATFORM_SEC_CAPS=""
683 valt_load_address_pri_norml="0x38000000"
684 valt_load_address_pri_inner="0x28000000"
685 valt_load_address_sec_norml="0xUNSET"
686 valt_load_address_sec_inner="0xUNSET"
687 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
690 VGCONF_ARCH_PRI="mips64"
691 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
692 VGCONF_PLATFORM_SEC_CAPS=""
693 valt_load_address_pri_norml="0x38000000"
694 valt_load_address_pri_inner="0x28000000"
695 valt_load_address_sec_norml="0xUNSET"
696 valt_load_address_sec_inner="0xUNSET"
697 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
700 VGCONF_ARCH_PRI="tilegx"
702 VGCONF_PLATFORM_PRI_CAPS="TILEGX_LINUX"
703 VGCONF_PLATFORM_SEC_CAPS=""
704 valt_load_address_pri_norml="0x38000000"
705 valt_load_address_pri_inner="0x28000000"
706 valt_load_address_sec_norml="0xUNSET"
707 valt_load_address_sec_inner="0xUNSET"
708 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
711 VGCONF_ARCH_PRI="unknown"
712 VGCONF_ARCH_SEC="unknown"
713 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
714 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
715 valt_load_address_pri_norml="0xUNSET"
716 valt_load_address_pri_inner="0xUNSET"
717 valt_load_address_sec_norml="0xUNSET"
718 valt_load_address_sec_inner="0xUNSET"
719 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
720 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
724 #----------------------------------------------------------------------------
726 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
728 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
729 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
730 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
731 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
732 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
733 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
734 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
735 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
736 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
737 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
738 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
739 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
740 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
741 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
742 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
743 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
744 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
745 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
746 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
747 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
748 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
749 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
750 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
751 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
752 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
753 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_TILEGX,
754 test x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX )
756 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
758 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
759 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
760 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
761 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
762 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
763 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
764 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
765 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
766 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
767 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
768 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
769 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
770 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
771 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
772 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
773 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
774 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
775 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
776 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
777 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
778 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
779 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
780 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
781 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
782 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_TILEGX_LINUX,
783 test x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX)
784 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
785 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
786 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
787 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
788 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
791 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
792 # Relies on the assumption that the primary and secondary targets are
793 # for the same OS, so therefore only necessary to test the primary.
794 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
795 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
796 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
797 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
798 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
799 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
800 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
801 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
802 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
803 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
804 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
805 -o x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX)
806 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
807 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
808 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
811 # Sometimes, in the Makefile.am files, it's useful to know whether or not
812 # there is a secondary target.
813 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
814 test x$VGCONF_PLATFORM_SEC_CAPS != x)
816 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
817 dnl fallback definition
818 dnl The macro is courtesy of Dave Hart:
819 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
820 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
821 if test -z "$$1_TRUE"; then :
830 #----------------------------------------------------------------------------
832 #----------------------------------------------------------------------------
834 # Check if this should be built as an inner Valgrind, to be run within
835 # another Valgrind. Choose the load address accordingly.
836 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
837 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
838 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
839 [AC_ARG_ENABLE(inner,
840 [ --enable-inner enables self-hosting],
841 [vg_cv_inner=$enableval],
843 if test "$vg_cv_inner" = yes; then
844 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
845 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
846 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
848 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
849 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
852 #----------------------------------------------------------------------------
853 # Undefined behaviour sanitiser
854 #----------------------------------------------------------------------------
855 # Check whether we should build with the undefined beahviour sanitiser.
857 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
858 [AC_ARG_ENABLE(ubsan,
859 [ --enable-ubsan enables the undefined behaviour sanitiser],
860 [vg_cv_ubsan=$enableval],
863 #----------------------------------------------------------------------------
864 # Define MIPS_PAGE_SHIFT (--with-pagesize)
865 #----------------------------------------------------------------------------
866 AC_ARG_WITH(pagesize,
867 [ --with-pagesize= override detected page size (4, 16 or 64)],
872 if test "$psize" = "0"; then
873 psizer=`getconf PAGESIZE`
874 psize=$((${psizer}/1024))
877 if test "$psize" = "4"; then
878 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured page size 4k])
879 elif test "$psize" = "16"; then
880 AC_DEFINE([MIPS_PAGE_SHIFT], 14, [configured page size 16k])
881 elif test "$psize" = "64"; then
882 AC_DEFINE([MIPS_PAGE_SHIFT], 16, [configured page size 64k])
884 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured default page size 4k])
886 AC_MSG_RESULT([checking for Pagesize... ${psize}k])
889 #----------------------------------------------------------------------------
890 # Extra fine-tuning of installation directories
891 #----------------------------------------------------------------------------
893 [ --with-tmpdir=PATH Specify path for temporary files],
896 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
897 AC_SUBST(VG_TMPDIR, [$tmpdir])
900 #----------------------------------------------------------------------------
901 # Libc and suppressions
902 #----------------------------------------------------------------------------
903 # This variable will collect the suppression files to be used.
904 AC_SUBST(DEFAULT_SUPP)
906 AC_CHECK_HEADER([features.h])
908 if test x$ac_cv_header_features_h = xyes; then
909 rm -f conftest.$ac_ext
910 cat <<_ACEOF >conftest.$ac_ext
911 #include <features.h>
912 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
913 glibc version is: __GLIBC__ __GLIBC_MINOR__
916 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
919 # not really a version check
920 AC_EGREP_CPP([DARWIN_LIBC], [
921 #include <sys/cdefs.h>
922 #if defined(__DARWIN_VERS_1050)
926 GLIBC_VERSION="darwin")
928 # not really a version check
929 AC_EGREP_CPP([BIONIC_LIBC], [
930 #if defined(__ANDROID__)
934 GLIBC_VERSION="bionic")
937 AC_MSG_CHECKING([the glibc version])
939 case "${GLIBC_VERSION}" in
941 AC_MSG_RESULT(${GLIBC_VERSION} family)
942 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
943 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
944 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
947 AC_MSG_RESULT(${GLIBC_VERSION} family)
948 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
949 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
950 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
953 AC_MSG_RESULT(${GLIBC_VERSION} family)
954 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
955 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
956 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
959 AC_MSG_RESULT(${GLIBC_VERSION} family)
960 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
961 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
962 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
963 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
964 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
967 AC_MSG_RESULT(${GLIBC_VERSION} family)
968 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
969 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
970 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
971 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
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(Darwin)
978 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
979 # DEFAULT_SUPP set by kernel version check above.
982 AC_MSG_RESULT(Bionic)
983 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
984 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
987 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
988 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later])
989 AC_MSG_ERROR([or Darwin or Bionic libc])
993 AC_SUBST(GLIBC_VERSION)
996 # Add default suppressions for the X client libraries. Make no
997 # attempt to detect whether such libraries are installed on the
998 # build machine (or even if any X facilities are present); just
999 # add the suppressions antidisirregardless.
1000 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1001 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
1003 # Add glibc and X11 suppressions for exp-sgcheck
1004 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1007 #----------------------------------------------------------------------------
1008 # Platform variants?
1009 #----------------------------------------------------------------------------
1011 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1012 # But there are times where we need a bit more control. The motivating
1013 # and currently only case is Android: this is almost identical to
1014 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1015 # platform variant tags, which get passed in the compile as
1016 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1018 # In almost all cases, the <variant> bit is "vanilla". But for Android
1019 # it is "android" instead.
1021 # Consequently (eg), plain arm-linux would build with
1023 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1025 # whilst an Android build would have
1027 # -DVGP_arm_linux -DVGPV_arm_linux_android
1029 # Same for x86. The setup of the platform variant is pushed relatively far
1030 # down this file in order that we can inspect any of the variables set above.
1032 # In the normal case ..
1033 VGCONF_PLATVARIANT="vanilla"
1036 if test "$GLIBC_VERSION" = "bionic";
1038 VGCONF_PLATVARIANT="android"
1041 AC_SUBST(VGCONF_PLATVARIANT)
1044 # FIXME: do we also want to define automake variables
1045 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1046 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1047 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1048 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1049 # that's what we'd need to do to use this, since what we'd want to write
1052 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1054 # Hmm. Can't think of a nice clean solution to this.
1056 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1057 test x$VGCONF_PLATVARIANT = xvanilla)
1058 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1059 test x$VGCONF_PLATVARIANT = xandroid)
1062 #----------------------------------------------------------------------------
1063 # Checking for various library functions and other definitions
1064 #----------------------------------------------------------------------------
1066 # Check for AT_FDCWD
1068 AC_MSG_CHECKING([for AT_FDCWD])
1069 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1076 ac_have_at_fdcwd=yes
1077 AC_MSG_RESULT([yes])
1083 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1085 # Check for stpncpy function definition in string.h
1086 # This explicitly checks with _GNU_SOURCE defined since that is also
1087 # used in the test case (some systems might define it without anyway
1088 # since stpncpy is part of The Open Group Base Specifications Issue 7
1089 # IEEE Std 1003.1-2008.
1090 AC_MSG_CHECKING([for stpncpy])
1091 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1098 char *r = stpncpy(d, s, n);
1100 ac_have_gnu_stpncpy=yes
1101 AC_MSG_RESULT([yes])
1103 ac_have_gnu_stpncpy=no
1107 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1109 # Check for PTRACE_GETREGS
1111 AC_MSG_CHECKING([for PTRACE_GETREGS])
1112 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1115 #include <sys/ptrace.h>
1116 #include <sys/user.h>
1119 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1121 AC_MSG_RESULT([yes])
1122 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1123 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1129 # Check for CLOCK_MONOTONIC
1131 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1133 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1137 clock_gettime(CLOCK_MONOTONIC, &t);
1140 AC_MSG_RESULT([yes])
1141 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1142 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1148 # Check for PTHREAD_RWLOCK_T
1150 AC_MSG_CHECKING([for pthread_rwlock_t])
1152 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1154 #include <pthread.h>
1156 pthread_rwlock_t rwl;
1158 AC_MSG_RESULT([yes])
1159 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1160 [Define to 1 if you have the `pthread_rwlock_t' type.])
1166 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1168 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1170 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1172 #include <pthread.h>
1174 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1176 AC_MSG_RESULT([yes])
1177 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1178 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1184 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1186 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1190 #include <pthread.h>
1192 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1194 AC_MSG_RESULT([yes])
1195 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1196 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1202 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1204 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1206 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1208 #include <pthread.h>
1210 return (PTHREAD_MUTEX_RECURSIVE_NP);
1212 AC_MSG_RESULT([yes])
1213 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1214 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1220 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1222 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1224 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1226 #include <pthread.h>
1228 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1231 AC_MSG_RESULT([yes])
1232 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1233 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1239 # Check whether pthread_mutex_t has a member called __m_kind.
1241 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1242 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1244 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1247 [#include <pthread.h>])
1250 # Check whether pthread_mutex_t has a member called __data.__kind.
1252 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1253 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1255 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1258 [#include <pthread.h>])
1261 # does this compiler support -maltivec and does it have the include file
1264 AC_MSG_CHECKING([for Altivec])
1269 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1270 #include <altivec.h>
1272 vector unsigned int v;
1275 AC_MSG_RESULT([yes])
1276 AC_DEFINE([HAS_ALTIVEC], 1,
1277 [Define to 1 if gcc/as can do Altivec.])
1284 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
1287 # Check that both: the compiler supports -mvsx and that the assembler
1288 # understands VSX instructions. If either of those doesn't work,
1289 # conclude that we can't do VSX. NOTE: basically this is a kludge
1290 # in that it conflates two things that should be separate -- whether
1291 # the compiler understands the flag vs whether the assembler
1292 # understands the opcodes. This really ought to be cleaned up
1293 # and done properly, like it is for x86/x86_64.
1295 AC_MSG_CHECKING([for VSX])
1300 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1301 #include <altivec.h>
1303 vector unsigned int v;
1304 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1307 AC_MSG_RESULT([yes])
1314 AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1317 AC_MSG_CHECKING([that assembler knows DFP])
1319 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1321 __asm__ __volatile__("dadd 1, 2, 3");
1322 __asm__ __volatile__("dcffix 1, 2");
1325 AC_MSG_RESULT([yes])
1332 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1337 __asm__ __volatile__("dadd 1, 2, 3");
1338 __asm__ __volatile__("dcffix 1, 2");
1341 AC_MSG_RESULT([yes])
1349 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes -a x$ac_gcc_have_dfp = xyes)
1352 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1353 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1355 _Decimal64 x = 0.0DD;
1357 ac_gcc_have_dfp_type=yes
1358 AC_MSG_RESULT([yes])
1360 ac_gcc_have_dfp_type=no
1364 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_gcc_have_dfp_type = xyes)
1367 AC_MSG_CHECKING([that assembler knows ISA 2.07 ])
1369 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1371 __asm__ __volatile__("mtvsrd 1,2 ");
1373 ac_asm_have_isa_2_07=yes
1374 AC_MSG_RESULT([yes])
1376 ac_asm_have_isa_2_07=no
1380 AM_CONDITIONAL(HAS_ISA_2_07, test x$ac_asm_have_isa_2_07 = xyes)
1382 # Check for pthread_create@GLIBC2.0
1383 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1387 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1388 extern int pthread_create_glibc_2_0(void*, const void*,
1389 void *(*)(void*), void*);
1390 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1394 * Apparently on PowerPC linking this program succeeds and generates an
1395 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1397 #error This test does not work properly on PowerPC.
1399 pthread_create_glibc_2_0(0, 0, 0, 0);
1403 ac_have_pthread_create_glibc_2_0=yes
1404 AC_MSG_RESULT([yes])
1405 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1406 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1408 ac_have_pthread_create_glibc_2_0=no
1413 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1414 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1417 # Check for dlinfo RTLD_DI_TLS_MODID
1418 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1422 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1429 size_t sizes[10000];
1430 size_t modid_offset;
1431 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1434 ac_have_dlinfo_rtld_di_tls_modid=yes
1435 AC_MSG_RESULT([yes])
1436 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1437 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1439 ac_have_dlinfo_rtld_di_tls_modid=no
1444 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1445 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1448 # Check for eventfd_t, eventfd() and eventfd_read()
1449 AC_MSG_CHECKING([for eventfd()])
1451 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1452 #include <sys/eventfd.h>
1458 eventfd_read(fd, &ev);
1461 AC_MSG_RESULT([yes])
1462 AC_DEFINE([HAVE_EVENTFD], 1,
1463 [Define to 1 if you have the `eventfd' function.])
1464 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1465 [Define to 1 if you have the `eventfd_read' function.])
1470 # Check whether compiler can process #include <thread> without errors
1471 # clang 3.3 cannot process <thread> from e.g.
1472 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1474 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1476 safe_CXXFLAGS=$CXXFLAGS
1479 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1483 ac_cxx_can_include_thread_header=yes
1484 AC_MSG_RESULT([yes])
1486 ac_cxx_can_include_thread_header=no
1489 CXXFLAGS=$safe_CXXFLAGS
1492 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1495 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1496 # of the user_regs_struct from sys/user.h. They are structurally the same
1497 # but we get either one or the other.
1499 AC_CHECK_TYPE([struct user_regs_struct],
1500 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1501 [[#include <sys/ptrace.h>]
1502 [#include <sys/time.h>]
1503 [#include <sys/user.h>]])
1504 if test "$sys_user_has_user_regs" = "yes"; then
1505 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1506 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1510 #----------------------------------------------------------------------------
1511 # Checking for supported compiler flags.
1512 #----------------------------------------------------------------------------
1514 # does this compiler support -m32 ?
1515 AC_MSG_CHECKING([if gcc accepts -m32])
1520 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1524 AC_MSG_RESULT([yes])
1534 # does this compiler support -m64 ?
1535 AC_MSG_CHECKING([if gcc accepts -m64])
1540 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1544 AC_MSG_RESULT([yes])
1554 # does this compiler support -march=mips32 (mips32 default) ?
1555 AC_MSG_CHECKING([if gcc accepts -march=mips32])
1558 CFLAGS="$CFLAGS -march=mips32"
1560 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1563 FLAG_MIPS32="-march=mips32"
1564 AC_MSG_RESULT([yes])
1571 AC_SUBST(FLAG_MIPS32)
1574 # does this compiler support -march=mips64 (mips64 default) ?
1575 AC_MSG_CHECKING([if gcc accepts -march=mips64])
1578 CFLAGS="$CFLAGS -march=mips64"
1580 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1583 FLAG_MIPS64="-march=mips64"
1584 AC_MSG_RESULT([yes])
1591 AC_SUBST(FLAG_MIPS64)
1594 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1595 AC_MSG_CHECKING([if gcc accepts -march=octeon])
1598 CFLAGS="$CFLAGS -march=octeon"
1600 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1603 FLAG_OCTEON="-march=octeon"
1604 AC_MSG_RESULT([yes])
1611 AC_SUBST(FLAG_OCTEON)
1614 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1615 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1618 CFLAGS="$CFLAGS -march=octeon2"
1620 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1623 FLAG_OCTEON2="-march=octeon2"
1624 AC_MSG_RESULT([yes])
1631 AC_SUBST(FLAG_OCTEON2)
1634 # does this compiler support -mmmx ?
1635 AC_MSG_CHECKING([if gcc accepts -mmmx])
1640 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1644 AC_MSG_RESULT([yes])
1654 # does this compiler support -msse ?
1655 AC_MSG_CHECKING([if gcc accepts -msse])
1660 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1664 AC_MSG_RESULT([yes])
1674 # does this compiler support -mpreferred-stack-boundary=2 when
1675 # generating code for a 32-bit target? Note that we only care about
1676 # this when generating code for (32-bit) x86, so if the compiler
1677 # doesn't recognise -m32 it's no big deal. We'll just get code for
1678 # the Memcheck and other helper functions, that is a bit slower than
1679 # it could be, on x86; and no difference at all on any other platform.
1680 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
1683 CFLAGS="-mpreferred-stack-boundary=2 -m32"
1685 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1688 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
1689 AC_MSG_RESULT([yes])
1691 PREFERRED_STACK_BOUNDARY_2=""
1696 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
1699 # Convenience function to check whether GCC supports a particular
1700 # warning option. Takes two arguments, first the warning flag name
1701 # to check (without -W), then the conditional name to set if that
1702 # warning flag is supported.
1703 AC_DEFUN([AC_GCC_WARNING_COND],[
1704 AC_MSG_CHECKING([if gcc accepts -W$1])
1707 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1708 has_warning_flag=yes
1709 AC_MSG_RESULT([yes])], [
1711 AC_MSG_RESULT([no])])
1713 AM_CONDITIONAL([$2], test x$has_warning_flag = xyes)
1716 AC_GCC_WARNING_COND([pointer-sign], [HAS_POINTER_SIGN_WARNING])
1718 # Convenience function to check whether GCC supports a particular
1719 # warning option. Similar to AC_GCC_WARNING_COND, but does a
1720 # substitution instead of setting an conditional. Takes two arguments,
1721 # first the warning flag name to check (without -W), then the
1722 # substitution name to set with -Wno-warning-flag if the flag exists,
1723 # or the empty string if the compiler doesn't accept the flag. Note
1724 # that checking is done against the warning flag itself, but the
1725 # substitution is then done to cancel the warning flag.
1726 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
1727 AC_MSG_CHECKING([if gcc accepts -W$1])
1730 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1731 AC_SUBST([$2], [-Wno-$1])
1732 AC_MSG_RESULT([yes])], [
1734 AC_MSG_RESULT([no])])
1738 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
1739 # -W$1 (instead of -Wno-$1).
1740 AC_DEFUN([AC_GCC_WARNING_SUBST],[
1741 AC_MSG_CHECKING([if gcc accepts -W$1])
1744 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1745 AC_SUBST([$2], [-W$1])
1746 AC_MSG_RESULT([yes])], [
1748 AC_MSG_RESULT([no])])
1752 AC_GCC_WARNING_SUBST_NO([empty-body], [FLAG_W_NO_EMPTY_BODY])
1753 AC_GCC_WARNING_SUBST_NO([format-zero-length], [FLAG_W_NO_FORMAT_ZERO_LENGTH])
1754 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1755 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
1756 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
1757 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1758 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
1759 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
1760 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
1761 AC_GCC_WARNING_SUBST([format-security], [FLAG_W_FORMAT_SECURITY])
1762 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
1765 # does this compiler support -Wextra or the older -W ?
1767 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1772 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1775 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1776 AC_MSG_RESULT([-Wextra])
1779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1782 AC_SUBST([FLAG_W_EXTRA], [-W])
1785 AC_SUBST([FLAG_W_EXTRA], [])
1786 AC_MSG_RESULT([not supported])
1791 # does this compiler support -fno-stack-protector ?
1792 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1795 CFLAGS="-fno-stack-protector"
1797 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1800 no_stack_protector=yes
1801 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1802 AC_MSG_RESULT([yes])
1804 no_stack_protector=no
1805 FLAG_FNO_STACK_PROTECTOR=""
1810 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1813 # Does this compiler support -fsanitize=undefined?
1814 # Only checked for if --enable-ubsan was given.
1815 if test "x${vg_cv_ubsan}" = "xyes"; then
1816 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined])
1818 CFLAGS="-fsanitize=undefined"
1819 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1822 FLAG_FSANITIZE="-fsanitize=undefined"
1823 LIB_UBSAN="-static-libubsan"
1824 AC_MSG_RESULT([yes])
1831 AC_SUBST(FLAG_FSANITIZE)
1834 # does this compiler support --param inline-unit-growth=... ?
1836 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1839 CFLAGS="--param inline-unit-growth=900"
1841 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1844 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1845 ["--param inline-unit-growth=900"])
1846 AC_MSG_RESULT([yes])
1848 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1854 # does this compiler support -gdwarf-4 -fdebug-types-section ?
1856 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
1859 CFLAGS="-gdwarf-4 -fdebug-types-section"
1861 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1865 AC_MSG_RESULT([yes])
1870 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
1874 # does this compiler support nested functions ?
1876 AC_MSG_CHECKING([if gcc accepts nested functions])
1878 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1879 int foo() { return 1; }
1882 ac_have_nested_functions=yes
1883 AC_MSG_RESULT([yes])
1885 ac_have_nested_functions=no
1888 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
1891 # does this compiler support the 'p' constraint in ASM statements ?
1893 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
1895 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1897 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
1899 ac_have_asm_constraint_p=yes
1900 AC_MSG_RESULT([yes])
1902 ac_have_asm_constraint_p=no
1905 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
1908 # We want to use use the -Ttext-segment option to the linker.
1909 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
1910 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
1911 # semantics are NOT what we want (GNU gold -Ttext is fine).
1913 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
1914 # will reside. -Ttext aligns just the .text section start (but not any
1917 # So test for -Ttext-segment which is supported by all bfd ld versions
1918 # and use that if it exists. If it doesn't exist it must be an older
1919 # version of gold and we can fall back to using -Ttext which has the
1922 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
1925 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml"
1928 [AC_LANG_SOURCE([int _start () { return 0; }])],
1930 linker_using_t_text="no"
1931 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
1932 AC_MSG_RESULT([yes])
1934 linker_using_t_text="yes"
1935 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
1940 # If the linker only supports -Ttext (not -Ttext-segment) then we will
1941 # have to strip any build-id ELF NOTEs from the staticly linked tools.
1942 # Otherwise the build-id NOTE might end up at the default load address.
1943 # (Pedantically if the linker is gold then -Ttext is fine, but newer
1944 # gold versions also support -Ttext-segment. So just assume that unless
1945 # we can use -Ttext-segment we need to strip the build-id NOTEs.
1946 if test "x${linker_using_t_text}" = "xyes"; then
1947 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
1948 # does the linker support -Wl,--build-id=none ? Note, it's
1949 # important that we test indirectly via whichever C compiler
1950 # is selected, rather than testing /usr/bin/ld or whatever
1952 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
1954 CFLAGS="-Wl,--build-id=none"
1957 [AC_LANG_PROGRAM([ ], [return 0;])],
1959 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1960 AC_MSG_RESULT([yes])
1962 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1966 AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
1967 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1971 # does the ppc assembler support "mtocrf" et al?
1972 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1974 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1975 __asm__ __volatile__("mtocrf 4,0");
1976 __asm__ __volatile__("mfocrf 0,4");
1978 ac_have_as_ppc_mftocrf=yes
1979 AC_MSG_RESULT([yes])
1981 ac_have_as_ppc_mftocrf=no
1984 if test x$ac_have_as_ppc_mftocrf = xyes ; then
1985 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1989 # does the ppc assembler support "lfdp" and other phased out floating point insns?
1990 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
1992 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1993 do { typedef struct {
1997 dbl_pair_t dbl_pair[3];
1998 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2001 ac_have_as_ppc_fpPO=yes
2002 AC_MSG_RESULT([yes])
2004 ac_have_as_ppc_fpPO=no
2007 if test x$ac_have_as_ppc_fpPO = xyes ; then
2008 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2012 # does the x86/amd64 assembler understand SSE3 instructions?
2013 # Note, this doesn't generate a C-level symbol. It generates a
2014 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
2015 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2017 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2018 do { long long int x;
2019 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2023 AC_MSG_RESULT([yes])
2029 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
2032 # Ditto for SSSE3 instructions (note extra S)
2033 # Note, this doesn't generate a C-level symbol. It generates a
2034 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2035 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2037 save_CFLAGS="$CFLAGS"
2038 CFLAGS="$CFLAGS -msse"
2039 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2040 do { long long int x;
2041 __asm__ __volatile__(
2042 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2045 ac_have_as_ssse3=yes
2046 AC_MSG_RESULT([yes])
2051 CFLAGS="$save_CFLAGS"
2053 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2056 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2057 # Note, this doesn't generate a C-level symbol. It generates a
2058 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
2059 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
2060 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2062 __asm__ __volatile__(
2063 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2066 ac_have_as_pclmulqdq=yes
2067 AC_MSG_RESULT([yes])
2069 ac_have_as_pclmulqdq=no
2073 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2076 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2077 # Note, this doesn't generate a C-level symbol. It generates a
2078 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2079 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2080 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2083 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2084 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2085 * xmm2 should be used.
2087 __asm__ __volatile__(
2088 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2091 ac_have_as_vpclmulqdq=yes
2092 AC_MSG_RESULT([yes])
2094 ac_have_as_vpclmulqdq=no
2098 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2101 # does the x86/amd64 assembler understand the LZCNT instruction?
2102 # Note, this doesn't generate a C-level symbol. It generates a
2103 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
2104 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2106 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2108 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
2111 ac_have_as_lzcnt=yes
2112 AC_MSG_RESULT([yes])
2118 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2121 # does the x86/amd64 assembler understand the LOOPNEL instruction?
2122 # Note, this doesn't generate a C-level symbol. It generates a
2123 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2124 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2126 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2128 __asm__ __volatile__("1: loopnel 1b\n");
2131 ac_have_as_loopnel=yes
2132 AC_MSG_RESULT([yes])
2134 ac_have_as_loopnel=no
2138 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2141 # does the x86/amd64 assembler understand ADDR32 ?
2142 # Note, this doesn't generate a C-level symbol. It generates a
2143 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2144 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2146 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2148 asm volatile ("addr32 rep movsb");
2151 ac_have_as_addr32=yes
2152 AC_MSG_RESULT([yes])
2154 ac_have_as_addr32=no
2158 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2161 # does the x86/amd64 assembler understand SSE 4.2 instructions?
2162 # Note, this doesn't generate a C-level symbol. It generates a
2163 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2164 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2166 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2167 do { long long int x;
2168 __asm__ __volatile__(
2169 "crc32q %%r15,%%r15" : : : "r15" );
2170 __asm__ __volatile__(
2171 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2172 __asm__ __volatile__(
2173 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
2176 ac_have_as_sse42=yes
2177 AC_MSG_RESULT([yes])
2183 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2186 # does the x86/amd64 assembler understand AVX instructions?
2187 # Note, this doesn't generate a C-level symbol. It generates a
2188 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2189 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2191 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2192 do { long long int x;
2193 __asm__ __volatile__(
2194 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2195 __asm__ __volatile__(
2196 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2200 AC_MSG_RESULT([yes])
2206 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2209 # does the x86/amd64 assembler understand AVX2 instructions?
2210 # Note, this doesn't generate a C-level symbol. It generates a
2211 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2212 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2214 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2215 do { long long int x;
2216 __asm__ __volatile__(
2217 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2218 __asm__ __volatile__(
2219 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2223 AC_MSG_RESULT([yes])
2229 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2232 # does the x86/amd64 assembler understand TSX instructions and
2233 # the XACQUIRE/XRELEASE prefixes?
2234 # Note, this doesn't generate a C-level symbol. It generates a
2235 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2236 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2238 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2240 __asm__ __volatile__(
2243 " xacquire lock incq 0(%rsp) \n\t"
2244 " xrelease lock incq 0(%rsp) \n"
2249 AC_MSG_RESULT([yes])
2255 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2258 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2259 # Note, this doesn't generate a C-level symbol. It generates a
2260 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2261 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2263 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2264 do { unsigned int h, l;
2265 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
2266 __asm__ __volatile__(
2267 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
2268 __asm__ __volatile__(
2269 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
2273 AC_MSG_RESULT([yes])
2279 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2282 # does the x86/amd64 assembler understand FMA instructions?
2283 # Note, this doesn't generate a C-level symbol. It generates a
2284 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2285 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2287 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2288 do { unsigned int h, l;
2289 __asm__ __volatile__(
2290 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2291 __asm__ __volatile__(
2292 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2293 __asm__ __volatile__(
2294 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2298 AC_MSG_RESULT([yes])
2304 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2307 # does the amd64 assembler understand MPX instructions?
2308 # Note, this doesn't generate a C-level symbol. It generates a
2309 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2310 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2314 asm ("bndmov %bnd0,(%rsp)");
2315 asm ("bndldx 3(%rbx,%rdx), %bnd2");
2319 AC_MSG_RESULT([yes])
2325 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2328 # Does the C compiler support the "ifunc" attribute
2329 # Note, this doesn't generate a C-level symbol. It generates a
2330 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2331 # does the x86/amd64 assembler understand MOVBE?
2332 # Note, this doesn't generate a C-level symbol. It generates a
2333 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2334 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2336 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2337 do { long long int x;
2338 __asm__ __volatile__(
2339 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
2342 ac_have_as_movbe=yes
2343 AC_MSG_RESULT([yes])
2349 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2352 # Does the C compiler support the "ifunc" attribute
2353 # Note, this doesn't generate a C-level symbol. It generates a
2354 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2355 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2357 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2358 static void mytest(void) {}
2360 static void (*resolve_test(void))(void)
2362 return (void (*)(void))&mytest;
2365 void test(void) __attribute__((ifunc("resolve_test")));
2373 ac_have_ifunc_attr=yes
2374 AC_MSG_RESULT([yes])
2376 ac_have_ifunc_attr=no
2380 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2383 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2384 # when building the tool executables. I think we should get rid of it.
2386 # Check for TLS support in the compiler and linker
2387 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2389 [vg_cv_linktime_tls=yes],
2390 [vg_cv_linktime_tls=no])
2391 # Native compilation: check whether running a program using TLS succeeds.
2392 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2393 # succeeds but running programs using TLS fails.
2394 # Cross-compiling: check whether linking a program using TLS succeeds.
2395 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2396 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2397 [vg_cv_tls=$enableval],
2398 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2402 [vg_cv_tls=$vg_cv_linktime_tls])])])
2404 if test "$vg_cv_tls" = yes; then
2405 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2409 #----------------------------------------------------------------------------
2410 # Checks for C header files.
2411 #----------------------------------------------------------------------------
2414 AC_CHECK_HEADERS([ \
2430 # Verify whether the <linux/futex.h> header is usable.
2431 AC_MSG_CHECKING([if <linux/futex.h> is usable])
2433 save_CFLAGS="$CFLAGS"
2434 CFLAGS="$CFLAGS -D__user="
2435 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2436 #include <linux/futex.h>
2440 ac_have_usable_linux_futex_h=yes
2441 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
2442 [Define to 1 if you have a usable <linux/futex.h> header file.])
2443 AC_MSG_RESULT([yes])
2445 ac_have_usable_linux_futex_h=no
2448 CFLAGS="$save_CFLAGS"
2451 #----------------------------------------------------------------------------
2452 # Checks for typedefs, structures, and compiler characteristics.
2453 #----------------------------------------------------------------------------
2460 #----------------------------------------------------------------------------
2461 # Checks for library functions.
2462 #----------------------------------------------------------------------------
2466 AC_CHECK_LIB([pthread], [pthread_create])
2467 AC_CHECK_LIB([rt], [clock_gettime])
2480 pthread_barrier_init \
2481 pthread_condattr_setclock \
2482 pthread_mutex_timedlock \
2483 pthread_rwlock_timedrdlock \
2484 pthread_rwlock_timedwrlock \
2487 pthread_setname_np \
2503 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
2504 # libraries with any shared object and/or executable. This is NOT what we
2505 # want for e.g. vgpreload_core-x86-linux.so
2508 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
2509 [test x$ac_cv_func_pthread_barrier_init = xyes])
2510 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
2511 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
2512 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
2513 [test x$ac_cv_func_pthread_spin_lock = xyes])
2514 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
2515 [test x$ac_cv_func_pthread_setname_np = xyes])
2517 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2518 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
2519 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
2520 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
2523 #----------------------------------------------------------------------------
2525 #----------------------------------------------------------------------------
2526 # Do we have a useable MPI setup on the primary and/or secondary targets?
2527 # On Linux, by default, assumes mpicc and -m32/-m64
2528 # Note: this is a kludge in that it assumes the specified mpicc
2529 # understands -m32/-m64 regardless of what is specified using
2531 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
2532 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
2535 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
2536 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
2537 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
2538 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2539 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
2540 mflag_primary=$FLAG_M32
2541 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
2542 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
2543 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
2544 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
2545 mflag_primary=$FLAG_M64
2546 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
2547 mflag_primary="$FLAG_M32 -arch i386"
2548 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
2549 mflag_primary="$FLAG_M64 -arch x86_64"
2553 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
2554 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
2555 mflag_secondary=$FLAG_M32
2556 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
2557 mflag_secondary="$FLAG_M32 -arch i386"
2562 [ --with-mpicc= Specify name of MPI2-ised C compiler],
2567 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
2568 ## use these values in the check for a functioning mpicc.
2570 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
2571 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
2572 AM_COND_IF([VGCONF_OS_IS_LINUX],
2573 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
2574 LDFLAGS_MPI="-fpic -shared"])
2575 AM_COND_IF([VGCONF_OS_IS_DARWIN],
2576 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
2577 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
2579 AC_SUBST([CFLAGS_MPI])
2580 AC_SUBST([LDFLAGS_MPI])
2583 ## See if MPI_CC works for the primary target
2585 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
2587 saved_CFLAGS=$CFLAGS
2589 CFLAGS="$CFLAGS_MPI $mflag_primary"
2590 saved_LDFLAGS="$LDFLAGS"
2591 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
2592 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2596 int ni, na, nd, comb;
2597 int r = MPI_Init(NULL,NULL);
2598 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2599 r |= MPI_Finalize();
2602 ac_have_mpi2_pri=yes
2603 AC_MSG_RESULT([yes, $MPI_CC])
2609 CFLAGS=$saved_CFLAGS
2610 LDFLAGS="$saved_LDFLAGS"
2611 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
2613 ## See if MPI_CC works for the secondary target. Complication: what if
2614 ## there is no secondary target? We need this to then fail.
2615 ## Kludge this by making MPI_CC something which will surely fail in
2618 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
2620 saved_CFLAGS=$CFLAGS
2621 saved_LDFLAGS="$LDFLAGS"
2622 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
2623 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
2624 CC="$MPI_CC this will surely fail"
2628 CFLAGS="$CFLAGS_MPI $mflag_secondary"
2629 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2633 int ni, na, nd, comb;
2634 int r = MPI_Init(NULL,NULL);
2635 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2636 r |= MPI_Finalize();
2639 ac_have_mpi2_sec=yes
2640 AC_MSG_RESULT([yes, $MPI_CC])
2646 CFLAGS=$saved_CFLAGS
2647 LDFLAGS="$saved_LDFLAGS"
2648 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
2651 #----------------------------------------------------------------------------
2652 # Other library checks
2653 #----------------------------------------------------------------------------
2654 # There now follow some tests for Boost, and OpenMP. These
2655 # tests are present because Drd has some regression tests that use
2656 # these packages. All regression test programs all compiled only
2657 # for the primary target. And so it is important that the configure
2658 # checks that follow, use the correct -m32 or -m64 flag for the
2659 # primary target (called $mflag_primary). Otherwise, we can end up
2660 # in a situation (eg) where, on amd64-linux, the test for Boost checks
2661 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
2662 # only build (meaning, the primary target is x86-linux), the build
2663 # of the regtest programs that use Boost fails, because they are
2664 # build as 32-bit (IN THIS EXAMPLE).
2666 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
2667 # NEEDED BY THE REGRESSION TEST PROGRAMS.
2670 # Check whether the boost library 1.35 or later has been installed.
2671 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
2673 AC_MSG_CHECKING([for boost])
2676 safe_CXXFLAGS=$CXXFLAGS
2677 CXXFLAGS="$mflag_primary"
2679 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
2681 AC_LINK_IFELSE([AC_LANG_SOURCE([
2682 #include <boost/thread.hpp>
2683 static void thread_func(void)
2685 int main(int argc, char** argv)
2687 boost::thread t(thread_func);
2692 ac_have_boost_1_35=yes
2693 AC_SUBST([BOOST_CFLAGS], [])
2694 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
2695 AC_MSG_RESULT([yes])
2697 ac_have_boost_1_35=no
2702 CXXFLAGS=$safe_CXXFLAGS
2705 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
2708 # does this compiler support -fopenmp, does it have the include file
2709 # <omp.h> and does it have libgomp ?
2711 AC_MSG_CHECKING([for OpenMP])
2714 CFLAGS="-fopenmp $mflag_primary"
2716 AC_LINK_IFELSE([AC_LANG_SOURCE([
2718 int main(int argc, char** argv)
2726 AC_MSG_RESULT([yes])
2733 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
2736 # Check for __builtin_popcount
2737 AC_MSG_CHECKING([for __builtin_popcount()])
2738 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2740 __builtin_popcount(2);
2743 AC_MSG_RESULT([yes])
2744 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
2745 [Define to 1 if compiler provides __builtin_popcount().])
2750 # Check for __builtin_clz
2751 AC_MSG_CHECKING([for __builtin_clz()])
2752 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2757 AC_MSG_RESULT([yes])
2758 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
2759 [Define to 1 if compiler provides __builtin_clz().])
2764 # Check for __builtin_ctz
2765 AC_MSG_CHECKING([for __builtin_ctz()])
2766 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2771 AC_MSG_RESULT([yes])
2772 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
2773 [Define to 1 if compiler provides __builtin_ctz().])
2778 # does this compiler have built-in functions for atomic memory access for the
2780 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
2783 CFLAGS="$mflag_primary"
2785 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2787 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2788 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
2790 ac_have_builtin_atomic_primary=yes
2791 AC_MSG_RESULT([yes])
2792 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])
2794 ac_have_builtin_atomic_primary=no
2800 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
2801 [test x$ac_have_builtin_atomic_primary = xyes])
2804 # does this compiler have built-in functions for atomic memory access for the
2805 # secondary target ?
2807 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2809 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
2812 CFLAGS="$mflag_secondary"
2814 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2816 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
2818 ac_have_builtin_atomic_secondary=yes
2819 AC_MSG_RESULT([yes])
2821 ac_have_builtin_atomic_secondary=no
2829 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
2830 [test x$ac_have_builtin_atomic_secondary = xyes])
2832 # does this compiler have built-in functions for atomic memory access on
2833 # 64-bit integers for all targets ?
2835 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
2837 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2840 uint64_t variable = 1;
2841 return __sync_add_and_fetch(&variable, 1)
2843 ac_have_builtin_atomic64_primary=yes
2845 ac_have_builtin_atomic64_primary=no
2848 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2851 CFLAGS="$mflag_secondary"
2853 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2856 uint64_t variable = 1;
2857 return __sync_add_and_fetch(&variable, 1)
2859 ac_have_builtin_atomic64_secondary=yes
2861 ac_have_builtin_atomic64_secondary=no
2868 if test x$ac_have_builtin_atomic64_primary = xyes && \
2869 test x$VGCONF_PLATFORM_SEC_CAPS = x \
2870 -o x$ac_have_builtin_atomic64_secondary = xyes; then
2871 AC_MSG_RESULT([yes])
2872 ac_have_builtin_atomic64=yes
2875 ac_have_builtin_atomic64=no
2878 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
2879 [test x$ac_have_builtin_atomic64 = xyes])
2882 # does g++ have built-in functions for atomic memory access ?
2883 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
2885 safe_CXXFLAGS=$CXXFLAGS
2886 CXXFLAGS="$mflag_primary"
2889 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2891 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2892 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
2894 ac_have_builtin_atomic_cxx=yes
2895 AC_MSG_RESULT([yes])
2896 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
2898 ac_have_builtin_atomic_cxx=no
2903 CXXFLAGS=$safe_CXXFLAGS
2905 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
2908 if test x$ac_have_usable_linux_futex_h = xyes \
2909 -a x$ac_have_builtin_atomic_primary = xyes; then
2910 ac_enable_linux_ticket_lock_primary=yes
2912 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
2913 [test x$ac_enable_linux_ticket_lock_primary = xyes])
2915 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
2916 -a x$ac_have_usable_linux_futex_h = xyes \
2917 -a x$ac_have_builtin_atomic_secondary = xyes; then
2918 ac_enable_linux_ticket_lock_secondary=yes
2920 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
2921 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
2924 # does libstdc++ support annotating shared pointers ?
2925 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
2927 safe_CXXFLAGS=$CXXFLAGS
2928 CXXFLAGS="-std=c++0x"
2931 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2934 std::shared_ptr<int> p
2936 ac_have_shared_ptr=yes
2938 ac_have_shared_ptr=no
2940 if test x$ac_have_shared_ptr = xyes; then
2941 # If compilation of the program below fails because of a syntax error
2942 # triggered by substituting one of the annotation macros then that
2943 # means that libstdc++ supports these macros.
2944 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2945 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
2946 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
2949 std::shared_ptr<int> p
2951 ac_have_shared_pointer_annotation=no
2954 ac_have_shared_pointer_annotation=yes
2955 AC_MSG_RESULT([yes])
2956 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
2957 [Define to 1 if libstd++ supports annotating shared pointers])
2960 ac_have_shared_pointer_annotation=no
2965 CXXFLAGS=$safe_CXXFLAGS
2967 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
2968 [test x$ac_have_shared_pointer_annotation = xyes])
2971 #----------------------------------------------------------------------------
2972 # Ok. We're done checking.
2973 #----------------------------------------------------------------------------
2975 # Nb: VEX/Makefile is generated from Makefile.vex.in.
2978 VEX/Makefile:Makefile.vex.in
2987 gdbserver_tests/Makefile
2993 memcheck/tests/Makefile
2994 memcheck/tests/common/Makefile
2995 memcheck/tests/amd64/Makefile
2996 memcheck/tests/x86/Makefile
2997 memcheck/tests/linux/Makefile
2998 memcheck/tests/darwin/Makefile
2999 memcheck/tests/amd64-linux/Makefile
3000 memcheck/tests/x86-linux/Makefile
3001 memcheck/tests/ppc32/Makefile
3002 memcheck/tests/ppc64/Makefile
3003 memcheck/tests/s390x/Makefile
3004 memcheck/tests/vbit-test/Makefile
3006 cachegrind/tests/Makefile
3007 cachegrind/tests/x86/Makefile
3008 cachegrind/cg_annotate
3011 callgrind/callgrind_annotate
3012 callgrind/callgrind_control
3013 callgrind/tests/Makefile
3015 helgrind/tests/Makefile
3017 massif/tests/Makefile
3020 lackey/tests/Makefile
3023 none/tests/scripts/Makefile
3024 none/tests/amd64/Makefile
3025 none/tests/ppc32/Makefile
3026 none/tests/ppc64/Makefile
3027 none/tests/x86/Makefile
3028 none/tests/arm/Makefile
3029 none/tests/arm64/Makefile
3030 none/tests/s390x/Makefile
3031 none/tests/mips32/Makefile
3032 none/tests/mips64/Makefile
3033 none/tests/tilegx/Makefile
3034 none/tests/linux/Makefile
3035 none/tests/darwin/Makefile
3036 none/tests/x86-linux/Makefile
3037 exp-sgcheck/Makefile
3038 exp-sgcheck/tests/Makefile
3040 drd/scripts/download-and-build-splash2
3043 exp-bbv/tests/Makefile
3044 exp-bbv/tests/x86/Makefile
3045 exp-bbv/tests/x86-linux/Makefile
3046 exp-bbv/tests/amd64-linux/Makefile
3047 exp-bbv/tests/ppc32-linux/Makefile
3048 exp-bbv/tests/arm-linux/Makefile
3050 exp-dhat/tests/Makefile
3053 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
3054 [chmod +x coregrind/link_tool_exe_linux])
3055 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
3056 [chmod +x coregrind/link_tool_exe_darwin])
3061 Maximum build arch: ${ARCH_MAX}
3062 Primary build arch: ${VGCONF_ARCH_PRI}
3063 Secondary build arch: ${VGCONF_ARCH_SEC}
3064 Build OS: ${VGCONF_OS}
3065 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
3066 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
3067 Platform variant: ${VGCONF_PLATVARIANT}
3068 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
3069 Default supp files: ${DEFAULT_SUPP}