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.13.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.*|applellvm-7.*|applellvm-8.*)
158 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
161 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
163 notclang-[[3-9]]|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 (${is_clang}-${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 endianness 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 # Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
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([no (${host_cpu})])
274 AC_MSG_ERROR([Unsupported host architecture. Sorry])
278 #----------------------------------------------------------------------------
280 # Sometimes it's convenient to subvert the bi-arch build system and
281 # just have a single build even though the underlying platform is
282 # capable of both. Hence handle --enable-only64bit and
283 # --enable-only32bit. Complain if both are issued :-)
284 # [Actually, if either of these options are used, I think both get built,
285 # but only one gets installed. So if you use an in-place build, both can be
288 # Check if a 64-bit only build has been requested
289 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
290 [AC_ARG_ENABLE(only64bit,
291 [ --enable-only64bit do a 64-bit only build],
292 [vg_cv_only64bit=$enableval],
293 [vg_cv_only64bit=no])])
295 # Check if a 32-bit only build has been requested
296 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
297 [AC_ARG_ENABLE(only32bit,
298 [ --enable-only32bit do a 32-bit only build],
299 [vg_cv_only32bit=$enableval],
300 [vg_cv_only32bit=no])])
303 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
305 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
308 #----------------------------------------------------------------------------
310 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
311 # compilation of many C files via -VGO_$(VGCONF_OS) and
312 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
313 AC_MSG_CHECKING([for a supported OS])
320 AC_MSG_RESULT([ok (${host_os})])
323 # Ok, this is linux. Check the kernel version
324 AC_MSG_CHECKING([for the kernel version])
329 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
330 AC_MSG_RESULT([unsupported (${kernel})])
331 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
335 AC_MSG_RESULT([2.6 or later (${kernel})])
342 AC_MSG_RESULT([ok (${host_os})])
344 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
345 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
346 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
347 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
348 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
349 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
350 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
351 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
353 AC_MSG_CHECKING([for the kernel version])
356 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
357 # has only one relevant version, the OS version. The `uname` check
358 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
359 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
360 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
361 # and we don't know of an macros similar to __GLIBC__ to get that info.
363 # XXX: `uname -r` won't do the right thing for cross-compiles, but
364 # that's not a problem yet.
366 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
367 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
368 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
369 # time support for 10.5 (the 9.* pattern just below), I'll leave it
370 # in for now, just in case anybody wants to give it a try. But I'm
371 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
374 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
375 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
376 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
377 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
380 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
381 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
382 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
383 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
386 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
387 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
388 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
389 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
392 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
393 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
394 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
395 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
398 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
399 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
400 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
401 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
404 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
405 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
406 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
407 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
410 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
411 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
412 DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
413 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
416 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
417 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
418 DEFAULT_SUPP="darwin16.supp ${DEFAULT_SUPP}"
419 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
422 AC_MSG_RESULT([unsupported (${kernel})])
423 AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x and 16.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12)])
429 AC_MSG_RESULT([ok (${host_os})])
431 DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
435 AC_MSG_RESULT([ok (${host_os})])
437 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
441 AC_MSG_RESULT([no (${host_os})])
442 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
446 #----------------------------------------------------------------------------
448 # If we are building on a 64 bit platform test to see if the system
449 # supports building 32 bit programs and disable 32 bit support if it
450 # does not support building 32 bit programs
452 case "$ARCH_MAX-$VGCONF_OS" in
453 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
454 AC_MSG_CHECKING([for 32 bit build support])
457 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
462 vg_cv_only64bit="yes"
465 CFLAGS=$safe_CFLAGS;;
468 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
470 [--enable-only32bit was specified but system does not support 32 bit builds])
473 #----------------------------------------------------------------------------
475 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
476 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
477 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
478 # above) will be "amd64" since that reflects the most that this cpu can do,
479 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
480 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
481 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
482 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
483 AC_SUBST(VGCONF_ARCH_PRI)
485 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
486 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
487 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
488 # It is empty if there is no secondary target.
489 AC_SUBST(VGCONF_ARCH_SEC)
491 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
492 # The entire system, including regression and performance tests, will be
493 # built for this target. The "_CAPS" indicates that the name is in capital
494 # letters, and it also uses '_' rather than '-' as a separator, because it's
495 # used to create various Makefile variables, which are all in caps by
496 # convention and cannot contain '-' characters. This is in contrast to
497 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
498 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
500 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
501 # Valgrind and tools will also be built for this target, but not the
502 # regression or performance tests.
504 # By default, the primary arch is the same as the "max" arch, as commented
505 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
506 # the big case statement just below here, in the case where we're building
507 # on a 64 bit machine but have been requested only to do a 32 bit build.
508 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
510 AC_MSG_CHECKING([for a supported CPU/OS combination])
512 # NB. The load address for a given platform may be specified in more
513 # than one place, in some cases, depending on whether we're doing a biarch,
514 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
515 # Be careful to give consistent values in all subcases. Also, all four
516 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
517 # even if it is to "0xUNSET".
519 case "$ARCH_MAX-$VGCONF_OS" in
521 VGCONF_ARCH_PRI="x86"
523 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
524 VGCONF_PLATFORM_SEC_CAPS=""
525 valt_load_address_pri_norml="0x58000000"
526 valt_load_address_pri_inner="0x38000000"
527 valt_load_address_sec_norml="0xUNSET"
528 valt_load_address_sec_inner="0xUNSET"
529 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
532 valt_load_address_sec_norml="0xUNSET"
533 valt_load_address_sec_inner="0xUNSET"
534 if test x$vg_cv_only64bit = xyes; then
535 VGCONF_ARCH_PRI="amd64"
537 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
538 VGCONF_PLATFORM_SEC_CAPS=""
539 valt_load_address_pri_norml="0x58000000"
540 valt_load_address_pri_inner="0x38000000"
541 elif test x$vg_cv_only32bit = xyes; then
542 VGCONF_ARCH_PRI="x86"
544 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
545 VGCONF_PLATFORM_SEC_CAPS=""
546 valt_load_address_pri_norml="0x58000000"
547 valt_load_address_pri_inner="0x38000000"
549 VGCONF_ARCH_PRI="amd64"
550 VGCONF_ARCH_SEC="x86"
551 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
552 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
553 valt_load_address_pri_norml="0x58000000"
554 valt_load_address_pri_inner="0x38000000"
555 valt_load_address_sec_norml="0x58000000"
556 valt_load_address_sec_inner="0x38000000"
558 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
561 VGCONF_ARCH_PRI="ppc32"
563 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
564 VGCONF_PLATFORM_SEC_CAPS=""
565 valt_load_address_pri_norml="0x58000000"
566 valt_load_address_pri_inner="0x38000000"
567 valt_load_address_sec_norml="0xUNSET"
568 valt_load_address_sec_inner="0xUNSET"
569 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
572 valt_load_address_sec_norml="0xUNSET"
573 valt_load_address_sec_inner="0xUNSET"
574 if test x$vg_cv_only64bit = xyes; then
575 VGCONF_ARCH_PRI="ppc64be"
577 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
578 VGCONF_PLATFORM_SEC_CAPS=""
579 valt_load_address_pri_norml="0x58000000"
580 valt_load_address_pri_inner="0x38000000"
581 elif test x$vg_cv_only32bit = xyes; then
582 VGCONF_ARCH_PRI="ppc32"
584 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
585 VGCONF_PLATFORM_SEC_CAPS=""
586 valt_load_address_pri_norml="0x58000000"
587 valt_load_address_pri_inner="0x38000000"
589 VGCONF_ARCH_PRI="ppc64be"
590 VGCONF_ARCH_SEC="ppc32"
591 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
592 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
593 valt_load_address_pri_norml="0x58000000"
594 valt_load_address_pri_inner="0x38000000"
595 valt_load_address_sec_norml="0x58000000"
596 valt_load_address_sec_inner="0x38000000"
598 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
601 # Little Endian is only supported on PPC64
602 valt_load_address_sec_norml="0xUNSET"
603 valt_load_address_sec_inner="0xUNSET"
604 VGCONF_ARCH_PRI="ppc64le"
606 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
607 VGCONF_PLATFORM_SEC_CAPS=""
608 valt_load_address_pri_norml="0x58000000"
609 valt_load_address_pri_inner="0x38000000"
610 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
612 # Darwin gets identified as 32-bit even when it supports 64-bit.
613 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
614 # all Macs support both 32-bit and 64-bit, so we just build both. If
615 # someone has a really old 32-bit only machine they can (hopefully?)
616 # build with --enable-only32bit. See bug 243362.
617 x86-darwin|amd64-darwin)
619 valt_load_address_sec_norml="0xUNSET"
620 valt_load_address_sec_inner="0xUNSET"
621 if test x$vg_cv_only64bit = xyes; then
622 VGCONF_ARCH_PRI="amd64"
624 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
625 VGCONF_PLATFORM_SEC_CAPS=""
626 valt_load_address_pri_norml="0x158000000"
627 valt_load_address_pri_inner="0x138000000"
628 elif test x$vg_cv_only32bit = xyes; then
629 VGCONF_ARCH_PRI="x86"
631 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
632 VGCONF_PLATFORM_SEC_CAPS=""
633 VGCONF_ARCH_PRI_CAPS="x86"
634 valt_load_address_pri_norml="0x58000000"
635 valt_load_address_pri_inner="0x38000000"
637 VGCONF_ARCH_PRI="amd64"
638 VGCONF_ARCH_SEC="x86"
639 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
640 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
641 valt_load_address_pri_norml="0x158000000"
642 valt_load_address_pri_inner="0x138000000"
643 valt_load_address_sec_norml="0x58000000"
644 valt_load_address_sec_inner="0x38000000"
646 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
649 VGCONF_ARCH_PRI="arm"
650 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
651 VGCONF_PLATFORM_SEC_CAPS=""
652 valt_load_address_pri_norml="0x58000000"
653 valt_load_address_pri_inner="0x38000000"
654 valt_load_address_sec_norml="0xUNSET"
655 valt_load_address_sec_inner="0xUNSET"
656 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
659 valt_load_address_sec_norml="0xUNSET"
660 valt_load_address_sec_inner="0xUNSET"
661 if test x$vg_cv_only64bit = xyes; then
662 VGCONF_ARCH_PRI="arm64"
664 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
665 VGCONF_PLATFORM_SEC_CAPS=""
666 valt_load_address_pri_norml="0x58000000"
667 valt_load_address_pri_inner="0x38000000"
668 elif test x$vg_cv_only32bit = xyes; then
669 VGCONF_ARCH_PRI="arm"
671 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
672 VGCONF_PLATFORM_SEC_CAPS=""
673 valt_load_address_pri_norml="0x58000000"
674 valt_load_address_pri_inner="0x38000000"
676 VGCONF_ARCH_PRI="arm64"
677 VGCONF_ARCH_SEC="arm"
678 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
679 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
680 valt_load_address_pri_norml="0x58000000"
681 valt_load_address_pri_inner="0x38000000"
682 valt_load_address_sec_norml="0x58000000"
683 valt_load_address_sec_inner="0x38000000"
685 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
688 VGCONF_ARCH_PRI="s390x"
690 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
691 VGCONF_PLATFORM_SEC_CAPS=""
692 # To improve branch prediction hit rate we want to have
693 # the generated code close to valgrind (host) code
694 valt_load_address_pri_norml="0x800000000"
695 valt_load_address_pri_inner="0x810000000"
696 valt_load_address_sec_norml="0xUNSET"
697 valt_load_address_sec_inner="0xUNSET"
698 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
701 VGCONF_ARCH_PRI="mips32"
702 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
703 VGCONF_PLATFORM_SEC_CAPS=""
704 valt_load_address_pri_norml="0x58000000"
705 valt_load_address_pri_inner="0x38000000"
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="mips64"
712 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
713 VGCONF_PLATFORM_SEC_CAPS=""
714 valt_load_address_pri_norml="0x58000000"
715 valt_load_address_pri_inner="0x38000000"
716 valt_load_address_sec_norml="0xUNSET"
717 valt_load_address_sec_inner="0xUNSET"
718 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
721 VGCONF_ARCH_PRI="x86"
723 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
724 VGCONF_PLATFORM_SEC_CAPS=""
725 valt_load_address_pri_norml="0x58000000"
726 valt_load_address_pri_inner="0x38000000"
727 valt_load_address_sec_norml="0xUNSET"
728 valt_load_address_sec_inner="0xUNSET"
729 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
732 valt_load_address_sec_norml="0xUNSET"
733 valt_load_address_sec_inner="0xUNSET"
734 if test x$vg_cv_only64bit = xyes; then
735 VGCONF_ARCH_PRI="amd64"
737 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
738 VGCONF_PLATFORM_SEC_CAPS=""
739 valt_load_address_pri_norml="0x58000000"
740 valt_load_address_pri_inner="0x38000000"
741 elif test x$vg_cv_only32bit = xyes; then
742 VGCONF_ARCH_PRI="x86"
744 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
745 VGCONF_PLATFORM_SEC_CAPS=""
746 valt_load_address_pri_norml="0x58000000"
747 valt_load_address_pri_inner="0x38000000"
749 VGCONF_ARCH_PRI="amd64"
750 VGCONF_ARCH_SEC="x86"
751 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
752 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
753 valt_load_address_pri_norml="0x58000000"
754 valt_load_address_pri_inner="0x38000000"
755 valt_load_address_sec_norml="0x58000000"
756 valt_load_address_sec_inner="0x38000000"
758 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
761 VGCONF_ARCH_PRI="unknown"
762 VGCONF_ARCH_SEC="unknown"
763 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
764 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
765 valt_load_address_pri_norml="0xUNSET"
766 valt_load_address_pri_inner="0xUNSET"
767 valt_load_address_sec_norml="0xUNSET"
768 valt_load_address_sec_inner="0xUNSET"
769 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
770 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
774 #----------------------------------------------------------------------------
776 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
778 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
779 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
780 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
781 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
782 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
783 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
784 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
785 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
786 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
787 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
788 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
789 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
790 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
791 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
792 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
793 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
794 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
795 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
796 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
797 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
798 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
799 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
800 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
801 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
802 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
803 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
804 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
805 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
807 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
809 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
810 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
811 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
812 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
813 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
814 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
815 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
816 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
817 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
818 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
819 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
820 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
821 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
822 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
823 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
824 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
825 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
826 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
827 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
828 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
829 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
830 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
831 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
832 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
833 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
834 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
835 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
836 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
837 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
838 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
839 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
840 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
841 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
842 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
845 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
846 # Relies on the assumption that the primary and secondary targets are
847 # for the same OS, so therefore only necessary to test the primary.
848 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
849 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
850 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
851 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
852 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
853 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
854 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
855 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
856 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
857 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
858 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
859 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
860 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
861 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
862 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
863 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
864 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
867 # Sometimes, in the Makefile.am files, it's useful to know whether or not
868 # there is a secondary target.
869 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
870 test x$VGCONF_PLATFORM_SEC_CAPS != x)
872 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
873 dnl fallback definition
874 dnl The macro is courtesy of Dave Hart:
875 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
876 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
877 if test -z "$$1_TRUE"; then :
886 #----------------------------------------------------------------------------
888 #----------------------------------------------------------------------------
890 # Check if this should be built as an inner Valgrind, to be run within
891 # another Valgrind. Choose the load address accordingly.
892 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
893 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
894 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
895 [AC_ARG_ENABLE(inner,
896 [ --enable-inner enables self-hosting],
897 [vg_cv_inner=$enableval],
899 if test "$vg_cv_inner" = yes; then
900 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
901 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
902 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
904 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
905 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
908 #----------------------------------------------------------------------------
909 # Undefined behaviour sanitiser
910 #----------------------------------------------------------------------------
911 # Check whether we should build with the undefined beahviour sanitiser.
913 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
914 [AC_ARG_ENABLE(ubsan,
915 [ --enable-ubsan enables the undefined behaviour sanitiser],
916 [vg_cv_ubsan=$enableval],
919 #----------------------------------------------------------------------------
920 # Extra fine-tuning of installation directories
921 #----------------------------------------------------------------------------
923 [ --with-tmpdir=PATH Specify path for temporary files],
926 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
927 AC_SUBST(VG_TMPDIR, [$tmpdir])
930 #----------------------------------------------------------------------------
931 # Libc and suppressions
932 #----------------------------------------------------------------------------
933 # This variable will collect the suppression files to be used.
934 AC_SUBST(DEFAULT_SUPP)
936 AC_CHECK_HEADER([features.h])
938 if test x$ac_cv_header_features_h = xyes; then
939 rm -f conftest.$ac_ext
940 cat <<_ACEOF >conftest.$ac_ext
941 #include <features.h>
942 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
943 glibc version is: __GLIBC__ __GLIBC_MINOR__
946 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
949 # not really a version check
950 AC_EGREP_CPP([DARWIN_LIBC], [
951 #include <sys/cdefs.h>
952 #if defined(__DARWIN_VERS_1050)
956 GLIBC_VERSION="darwin")
958 # not really a version check
959 AC_EGREP_CPP([BIONIC_LIBC], [
960 #if defined(__ANDROID__)
964 GLIBC_VERSION="bionic")
966 # there is only one version of libc on Solaris
967 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
968 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
969 GLIBC_VERSION="solaris"
972 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
974 if test x$GLIBC_VERSION = x; then
975 if $CC -dumpmachine | grep -q musl; then
980 AC_MSG_CHECKING([the glibc version])
982 case "${GLIBC_VERSION}" in
984 AC_MSG_RESULT(${GLIBC_VERSION} family)
985 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
986 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
987 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
990 AC_MSG_RESULT(${GLIBC_VERSION} family)
991 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
992 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
993 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
996 AC_MSG_RESULT(${GLIBC_VERSION} family)
997 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
998 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
999 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1002 AC_MSG_RESULT(${GLIBC_VERSION} family)
1003 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1004 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1005 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1006 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1007 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1010 AC_MSG_RESULT(${GLIBC_VERSION} family)
1011 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1012 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1013 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1014 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1015 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1016 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1017 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1020 AC_MSG_RESULT(Darwin)
1021 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1022 # DEFAULT_SUPP set by kernel version check above.
1025 AC_MSG_RESULT(Bionic)
1026 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1027 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1030 AC_MSG_RESULT(Solaris)
1031 # DEFAULT_SUPP set in host_os switch-case above.
1032 # No other suppression file is used.
1036 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1037 # no DEFAULT_SUPP file yet for musl libc.
1040 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1041 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1042 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1046 AC_SUBST(GLIBC_VERSION)
1049 if test "$VGCONF_OS" != "solaris"; then
1050 # Add default suppressions for the X client libraries. Make no
1051 # attempt to detect whether such libraries are installed on the
1052 # build machine (or even if any X facilities are present); just
1053 # add the suppressions antidisirregardless.
1054 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1055 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
1057 # Add glibc and X11 suppressions for exp-sgcheck
1058 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1062 #----------------------------------------------------------------------------
1063 # Platform variants?
1064 #----------------------------------------------------------------------------
1066 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1067 # But there are times where we need a bit more control. The motivating
1068 # and currently only case is Android: this is almost identical to
1069 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1070 # platform variant tags, which get passed in the compile as
1071 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1073 # In almost all cases, the <variant> bit is "vanilla". But for Android
1074 # it is "android" instead.
1076 # Consequently (eg), plain arm-linux would build with
1078 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1080 # whilst an Android build would have
1082 # -DVGP_arm_linux -DVGPV_arm_linux_android
1084 # Same for x86. The setup of the platform variant is pushed relatively far
1085 # down this file in order that we can inspect any of the variables set above.
1087 # In the normal case ..
1088 VGCONF_PLATVARIANT="vanilla"
1091 if test "$GLIBC_VERSION" = "bionic";
1093 VGCONF_PLATVARIANT="android"
1096 AC_SUBST(VGCONF_PLATVARIANT)
1099 # FIXME: do we also want to define automake variables
1100 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1101 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1102 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1103 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1104 # that's what we'd need to do to use this, since what we'd want to write
1107 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1109 # Hmm. Can't think of a nice clean solution to this.
1111 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1112 test x$VGCONF_PLATVARIANT = xvanilla)
1113 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1114 test x$VGCONF_PLATVARIANT = xandroid)
1117 #----------------------------------------------------------------------------
1118 # Checking for various library functions and other definitions
1119 #----------------------------------------------------------------------------
1121 # Check for AT_FDCWD
1123 AC_MSG_CHECKING([for AT_FDCWD])
1124 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1131 ac_have_at_fdcwd=yes
1132 AC_MSG_RESULT([yes])
1138 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1140 # Check for stpncpy function definition in string.h
1141 # This explicitly checks with _GNU_SOURCE defined since that is also
1142 # used in the test case (some systems might define it without anyway
1143 # since stpncpy is part of The Open Group Base Specifications Issue 7
1144 # IEEE Std 1003.1-2008.
1145 AC_MSG_CHECKING([for stpncpy])
1146 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1153 char *r = stpncpy(d, s, n);
1155 ac_have_gnu_stpncpy=yes
1156 AC_MSG_RESULT([yes])
1158 ac_have_gnu_stpncpy=no
1162 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1164 # Check for PTRACE_GETREGS
1166 AC_MSG_CHECKING([for PTRACE_GETREGS])
1167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1170 #include <sys/ptrace.h>
1171 #include <sys/user.h>
1174 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1176 AC_MSG_RESULT([yes])
1177 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1178 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1184 # Check for CLOCK_MONOTONIC
1186 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1192 clock_gettime(CLOCK_MONOTONIC, &t);
1195 AC_MSG_RESULT([yes])
1196 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1197 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1203 # Check for ELF32/64_CHDR
1205 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1208 # Check for PTHREAD_RWLOCK_T
1210 AC_MSG_CHECKING([for pthread_rwlock_t])
1212 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1214 #include <pthread.h>
1216 pthread_rwlock_t rwl;
1218 AC_MSG_RESULT([yes])
1219 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1220 [Define to 1 if you have the `pthread_rwlock_t' type.])
1226 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1228 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1230 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1232 #include <pthread.h>
1234 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1236 AC_MSG_RESULT([yes])
1237 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1238 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1244 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1246 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1248 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1250 #include <pthread.h>
1252 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1254 AC_MSG_RESULT([yes])
1255 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1256 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1262 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1264 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1266 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1268 #include <pthread.h>
1270 return (PTHREAD_MUTEX_RECURSIVE_NP);
1272 AC_MSG_RESULT([yes])
1273 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1274 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1280 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1282 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1284 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1286 #include <pthread.h>
1288 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1291 AC_MSG_RESULT([yes])
1292 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1293 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1299 # Check whether pthread_mutex_t has a member called __m_kind.
1301 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1302 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1304 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1307 [#include <pthread.h>])
1310 # Check whether pthread_mutex_t has a member called __data.__kind.
1312 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1313 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1315 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1318 [#include <pthread.h>])
1320 # Convenience function. Set flags based on the existing HWCAP entries.
1321 # The AT_HWCAP entries are generated by glibc, and are based on
1322 # functions supported by the hardware/system/libc.
1323 # Subsequent support for whether the capability will actually be utilized
1324 # will also be checked against the compiler capabilities.
1326 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1327 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1329 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1330 if LD_SHOW_AUXV=1 `which true` | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1332 AC_MSG_RESULT([yes])
1333 AC_SUBST([$2],[yes])
1340 # gather hardware capabilities. (hardware/kernel/libc)
1341 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1342 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1343 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1344 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1345 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1346 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1347 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1348 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1351 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1352 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1353 # compiler support for isa 2.07 level instructions
1354 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1355 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1357 __asm__ __volatile__("mtvsrd 1,2 ");
1359 ac_asm_have_isa_2_07=yes
1360 AC_MSG_RESULT([yes])
1362 ac_asm_have_isa_2_07=no
1365 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1366 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1368 # altivec (vsx) support.
1369 # does this compiler support -maltivec and does it have the include file
1371 AC_MSG_CHECKING([for Altivec support in the compiler ])
1373 CFLAGS="-maltivec -Werror"
1374 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1375 #include <altivec.h>
1377 vector unsigned int v;
1380 AC_MSG_RESULT([yes])
1386 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1387 -a x$HWCAP_HAS_ALTIVEC = xyes])
1389 # Check that both: the compiler supports -mvsx and that the assembler
1390 # understands VSX instructions. If either of those doesn't work,
1391 # conclude that we can't do VSX.
1392 AC_MSG_CHECKING([for VSX compiler flag support])
1394 CFLAGS="-mvsx -Werror"
1395 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1398 ac_compiler_supports_vsx_flag=yes
1399 AC_MSG_RESULT([yes])
1401 ac_compiler_supports_vsx_flag=no
1406 AC_MSG_CHECKING([for VSX support in the assembler ])
1408 CFLAGS="-mvsx -Werror"
1409 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1410 #include <altivec.h>
1412 vector unsigned int v;
1413 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1415 ac_compiler_supports_vsx=yes
1416 AC_MSG_RESULT([yes])
1418 ac_compiler_supports_vsx=no
1422 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1423 -a x$ac_compiler_supports_vsx = xyes \
1424 -a x$HWCAP_HAS_VSX = xyes ])
1426 # DFP (Decimal Float)
1427 AC_MSG_CHECKING([that assembler knows DFP])
1428 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1431 __asm__ __volatile__("adtr 1, 2, 3")
1433 __asm__ __volatile__("dadd 1, 2, 3");
1434 __asm__ __volatile__("dcffix 1, 2");
1438 AC_MSG_RESULT([yes])
1443 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1445 CFLAGS="-mhard-dfp -Werror"
1446 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1449 __asm__ __volatile__("adtr 1, 2, 3")
1451 __asm__ __volatile__("dadd 1, 2, 3");
1452 __asm__ __volatile__("dcffix 1, 2");
1455 ac_compiler_have_dfp=yes
1456 AC_MSG_RESULT([yes])
1458 ac_compiler_have_dfp=no
1462 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1463 -a x$ac_compiler_have_dfp = xyes \
1464 -a x$HWCAP_HAS_DFP = xyes )
1466 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1467 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1469 _Decimal64 x = 0.0DD;
1471 ac_compiler_have_dfp_type=yes
1472 AC_MSG_RESULT([yes])
1474 ac_compiler_have_dfp_type=no
1477 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1478 -a x$HWCAP_HAS_DFP = xyes )
1481 # HTM (Hardware Transactional Memory)
1482 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1484 CFLAGS="-mhtm -Werror"
1485 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1489 AC_MSG_RESULT([yes])
1490 ac_compiler_supports_htm=yes
1493 ac_compiler_supports_htm=no
1497 AC_MSG_CHECKING([if compiler can find the htm builtins])
1499 CFLAGS="-mhtm -Werror"
1500 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1502 if (__builtin_tbegin (0))
1505 AC_MSG_RESULT([yes])
1506 ac_compiler_sees_htm_builtins=yes
1509 ac_compiler_sees_htm_builtins=no
1513 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1514 -a x$ac_compiler_sees_htm_builtins = xyes \
1515 -a x$HWCAP_HAS_HTM = xyes )
1518 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1520 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1522 __asm__ __volatile__("cnttzw 1,2 ");
1524 ac_asm_have_isa_3_00=yes
1525 AC_MSG_RESULT([yes])
1527 ac_asm_have_isa_3_00=no
1531 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
1532 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1534 # Check for pthread_create@GLIBC2.0
1535 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1538 CFLAGS="-lpthread -Werror"
1539 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1540 extern int pthread_create_glibc_2_0(void*, const void*,
1541 void *(*)(void*), void*);
1542 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1546 * Apparently on PowerPC linking this program succeeds and generates an
1547 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1549 #error This test does not work properly on PowerPC.
1551 pthread_create_glibc_2_0(0, 0, 0, 0);
1555 ac_have_pthread_create_glibc_2_0=yes
1556 AC_MSG_RESULT([yes])
1557 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1558 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1560 ac_have_pthread_create_glibc_2_0=no
1565 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1566 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1569 # Check for dlinfo RTLD_DI_TLS_MODID
1570 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1574 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1581 size_t sizes[10000];
1582 size_t modid_offset;
1583 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1586 ac_have_dlinfo_rtld_di_tls_modid=yes
1587 AC_MSG_RESULT([yes])
1588 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1589 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1591 ac_have_dlinfo_rtld_di_tls_modid=no
1596 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1597 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1600 # Check for eventfd_t, eventfd() and eventfd_read()
1601 AC_MSG_CHECKING([for eventfd()])
1603 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1604 #include <sys/eventfd.h>
1610 eventfd_read(fd, &ev);
1613 AC_MSG_RESULT([yes])
1614 AC_DEFINE([HAVE_EVENTFD], 1,
1615 [Define to 1 if you have the `eventfd' function.])
1616 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1617 [Define to 1 if you have the `eventfd_read' function.])
1622 # Check whether compiler can process #include <thread> without errors
1623 # clang 3.3 cannot process <thread> from e.g.
1624 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1626 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1628 safe_CXXFLAGS=$CXXFLAGS
1631 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1635 ac_cxx_can_include_thread_header=yes
1636 AC_MSG_RESULT([yes])
1638 ac_cxx_can_include_thread_header=no
1641 CXXFLAGS=$safe_CXXFLAGS
1644 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1647 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1648 # of the user_regs_struct from sys/user.h. They are structurally the same
1649 # but we get either one or the other.
1651 AC_CHECK_TYPE([struct user_regs_struct],
1652 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1653 [[#include <sys/ptrace.h>]
1654 [#include <sys/time.h>]
1655 [#include <sys/user.h>]])
1656 if test "$sys_user_has_user_regs" = "yes"; then
1657 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1658 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1662 #----------------------------------------------------------------------------
1663 # Checking for supported compiler flags.
1664 #----------------------------------------------------------------------------
1666 # does this compiler support -m32 ?
1667 AC_MSG_CHECKING([if gcc accepts -m32])
1670 CFLAGS="-m32 -Werror"
1672 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1676 AC_MSG_RESULT([yes])
1686 # does this compiler support -m64 ?
1687 AC_MSG_CHECKING([if gcc accepts -m64])
1690 CFLAGS="-m64 -Werror"
1692 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1696 AC_MSG_RESULT([yes])
1706 # does this compiler support -march=mips32 (mips32 default) ?
1707 AC_MSG_CHECKING([if gcc accepts -march=mips32])
1710 CFLAGS="$CFLAGS -march=mips32 -Werror"
1712 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1715 FLAG_MIPS32="-march=mips32"
1716 AC_MSG_RESULT([yes])
1723 AC_SUBST(FLAG_MIPS32)
1726 # does this compiler support -march=mips64 (mips64 default) ?
1727 AC_MSG_CHECKING([if gcc accepts -march=mips64])
1730 CFLAGS="$CFLAGS -march=mips64 -Werror"
1732 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1735 FLAG_MIPS64="-march=mips64"
1736 AC_MSG_RESULT([yes])
1743 AC_SUBST(FLAG_MIPS64)
1746 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1747 AC_MSG_CHECKING([if gcc accepts -march=octeon])
1750 CFLAGS="$CFLAGS -march=octeon -Werror"
1752 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1755 FLAG_OCTEON="-march=octeon"
1756 AC_MSG_RESULT([yes])
1763 AC_SUBST(FLAG_OCTEON)
1766 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1767 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1770 CFLAGS="$CFLAGS -march=octeon2 -Werror"
1772 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1775 FLAG_OCTEON2="-march=octeon2"
1776 AC_MSG_RESULT([yes])
1783 AC_SUBST(FLAG_OCTEON2)
1786 # does this compiler support -mmmx ?
1787 AC_MSG_CHECKING([if gcc accepts -mmmx])
1790 CFLAGS="-mmmx -Werror"
1792 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1796 AC_MSG_RESULT([yes])
1806 # does this compiler support -msse ?
1807 AC_MSG_CHECKING([if gcc accepts -msse])
1810 CFLAGS="-msse -Werror"
1812 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1816 AC_MSG_RESULT([yes])
1826 # does this compiler support -mpreferred-stack-boundary=2 when
1827 # generating code for a 32-bit target? Note that we only care about
1828 # this when generating code for (32-bit) x86, so if the compiler
1829 # doesn't recognise -m32 it's no big deal. We'll just get code for
1830 # the Memcheck and other helper functions, that is a bit slower than
1831 # it could be, on x86; and no difference at all on any other platform.
1832 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
1835 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
1837 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1840 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
1841 AC_MSG_RESULT([yes])
1843 PREFERRED_STACK_BOUNDARY_2=""
1848 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
1851 # does this compiler support -mlong-double-128 ?
1852 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
1854 CFLAGS="-mlong-double-128 -Werror"
1855 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1858 ac_compiler_supports_mlong_double_128=yes
1859 AC_MSG_RESULT([yes])
1861 ac_compiler_supports_mlong_double_128=no
1865 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
1866 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
1867 AC_SUBST(FLAG_MLONG_DOUBLE_128)
1870 # Convenience function to check whether GCC supports a particular
1871 # warning option. Takes two arguments,
1872 # first the warning flag name to check (without -W), then the
1873 # substitution name to set with -Wno-warning-flag if the flag exists,
1874 # or the empty string if the compiler doesn't accept the flag. Note
1875 # that checking is done against the warning flag itself, but the
1876 # substitution is then done to cancel the warning flag.
1877 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
1878 AC_MSG_CHECKING([if gcc accepts -W$1])
1880 CFLAGS="-W$1 -Werror"
1881 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1882 AC_SUBST([$2], [-Wno-$1])
1883 AC_MSG_RESULT([yes])], [
1885 AC_MSG_RESULT([no])])
1889 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
1890 # -W$1 (instead of -Wno-$1).
1891 AC_DEFUN([AC_GCC_WARNING_SUBST],[
1892 AC_MSG_CHECKING([if gcc accepts -W$1])
1894 CFLAGS="-W$1 -Werror"
1895 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1896 AC_SUBST([$2], [-W$1])
1897 AC_MSG_RESULT([yes])], [
1899 AC_MSG_RESULT([no])])
1903 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
1904 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1905 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
1906 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
1907 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
1908 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1909 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
1910 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
1911 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
1912 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
1913 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
1914 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
1915 # Disabled for now until all platforms are clean
1916 format_checking_enabled=no
1917 #format_checking_enabled=yes
1918 if test "$format_checking_enabled" = "yes"; then
1919 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
1921 dumy_assignment_to_avoid_syntax_errors=1
1922 AC_SUBST([FLAG_W_FORMAT_SIGNEDNESS], [])
1924 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
1925 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
1926 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
1927 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
1929 # Does this compiler support -Wformat-security ?
1930 # Special handling is needed, because certain GCC versions require -Wformat
1931 # being present if -Wformat-security is given. Otherwise a warning is issued.
1932 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
1933 # And with that the warning will be turned into an error with the result
1934 # that -Wformat-security is believed to be unsupported when in fact it is.
1935 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
1937 CFLAGS="-Wformat -Wformat-security -Werror"
1938 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1939 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
1940 AC_MSG_RESULT([yes])], [
1941 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
1942 AC_MSG_RESULT([no])])
1945 # does this compiler support -Wextra or the older -W ?
1947 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1950 CFLAGS="-Wextra -Werror"
1952 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1955 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1956 AC_MSG_RESULT([-Wextra])
1959 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1962 AC_SUBST([FLAG_W_EXTRA], [-W])
1965 AC_SUBST([FLAG_W_EXTRA], [])
1966 AC_MSG_RESULT([not supported])
1971 # On ARM we do not want to pass -Wcast-align as that produces loads
1972 # of warnings. GCC is just being conservative. See here:
1973 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
1974 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
1975 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
1977 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
1980 # does this compiler support -fno-stack-protector ?
1981 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1984 CFLAGS="-fno-stack-protector -Werror"
1986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1989 no_stack_protector=yes
1990 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1991 AC_MSG_RESULT([yes])
1993 no_stack_protector=no
1994 FLAG_FNO_STACK_PROTECTOR=""
1999 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2001 # Does GCC support disabling Identical Code Folding?
2002 # We want to disabled Identical Code Folding for the
2003 # tools preload shared objects to get better backraces.
2004 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2005 # "The optimization reduces code size and may disturb
2006 # unwind stacks by replacing a function by equivalent
2007 # one with a different name."
2008 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2011 CFLAGS="-fno-ipa-icf -Werror"
2013 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2017 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2018 AC_MSG_RESULT([yes])
2026 AC_SUBST(FLAG_FNO_IPA_ICF)
2029 # Does this compiler support -fsanitize=undefined. This is true for
2030 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2031 # also checks for alignment violations on memory accesses which the valgrind
2032 # code base is sprinkled (if not littered) with. As those alignment issues
2033 # don't pose a problem we want to suppress warnings about them.
2034 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2035 # GCCs do not support that.
2037 # Only checked for if --enable-ubsan was given.
2038 if test "x${vg_cv_ubsan}" = "xyes"; then
2039 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2041 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2042 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2045 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2046 LIB_UBSAN="-static-libubsan"
2047 AC_MSG_RESULT([yes])
2049 CFLAGS="-fsanitize=undefined -Werror"
2050 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2053 FLAG_FSANITIZE="-fsanitize=undefined"
2054 LIB_UBSAN="-static-libubsan"
2055 AC_MSG_RESULT([yes])
2063 AC_SUBST(FLAG_FSANITIZE)
2066 # does this compiler support --param inline-unit-growth=... ?
2068 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2071 CFLAGS="--param inline-unit-growth=900 -Werror"
2073 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2076 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2077 ["--param inline-unit-growth=900"])
2078 AC_MSG_RESULT([yes])
2080 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2086 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2088 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2091 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2093 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2097 AC_MSG_RESULT([yes])
2102 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2106 # does this compiler support -g -gz=zlib ?
2108 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2111 CFLAGS="-g -gz=zlib"
2113 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2117 AC_MSG_RESULT([yes])
2122 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2126 # does this compiler support -g -gz=zlib-gnu ?
2128 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2131 CFLAGS="-g -gz=zlib-gnu"
2133 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2136 ac_have_gz_zlib_gnu=yes
2137 AC_MSG_RESULT([yes])
2139 ac_have_gz_zlib_gnu=no
2142 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2146 # does this compiler support nested functions ?
2148 AC_MSG_CHECKING([if gcc accepts nested functions])
2150 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2151 int foo() { return 1; }
2154 ac_have_nested_functions=yes
2155 AC_MSG_RESULT([yes])
2157 ac_have_nested_functions=no
2160 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2163 # does this compiler support the 'p' constraint in ASM statements ?
2165 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2169 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2171 ac_have_asm_constraint_p=yes
2172 AC_MSG_RESULT([yes])
2174 ac_have_asm_constraint_p=no
2177 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2180 # Does this compiler support -no-pie?
2181 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2182 # default. However this gets in the way with some tests, we use -no-pie
2185 AC_MSG_CHECKING([if gcc accepts -no-pie])
2190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2193 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
2194 AC_MSG_RESULT([yes])
2196 AC_SUBST([FLAG_NO_PIE], [""])
2202 # We want to use use the -Ttext-segment option to the linker.
2203 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
2204 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2205 # semantics are NOT what we want (GNU gold -Ttext is fine).
2207 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2208 # will reside. -Ttext aligns just the .text section start (but not any
2211 # So test for -Ttext-segment which is supported by all bfd ld versions
2212 # and use that if it exists. If it doesn't exist it must be an older
2213 # version of gold and we can fall back to using -Ttext which has the
2216 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
2219 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
2222 [AC_LANG_SOURCE([int _start () { return 0; }])],
2224 linker_using_t_text="no"
2225 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
2226 AC_MSG_RESULT([yes])
2228 linker_using_t_text="yes"
2229 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
2234 # If the linker only supports -Ttext (not -Ttext-segment) then we will
2235 # have to strip any build-id ELF NOTEs from the statically linked tools.
2236 # Otherwise the build-id NOTE might end up at the default load address.
2237 # (Pedantically if the linker is gold then -Ttext is fine, but newer
2238 # gold versions also support -Ttext-segment. So just assume that unless
2239 # we can use -Ttext-segment we need to strip the build-id NOTEs.
2240 if test "x${linker_using_t_text}" = "xyes"; then
2241 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
2242 # does the linker support -Wl,--build-id=none ? Note, it's
2243 # important that we test indirectly via whichever C compiler
2244 # is selected, rather than testing /usr/bin/ld or whatever
2246 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
2248 CFLAGS="-Wl,--build-id=none -Werror"
2251 [AC_LANG_PROGRAM([ ], [return 0;])],
2253 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
2254 AC_MSG_RESULT([yes])
2256 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2260 AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
2261 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2265 # does the ppc assembler support "mtocrf" et al?
2266 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
2268 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2269 __asm__ __volatile__("mtocrf 4,0");
2270 __asm__ __volatile__("mfocrf 0,4");
2272 ac_have_as_ppc_mftocrf=yes
2273 AC_MSG_RESULT([yes])
2275 ac_have_as_ppc_mftocrf=no
2278 if test x$ac_have_as_ppc_mftocrf = xyes ; then
2279 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2283 # does the ppc assembler support "lfdp" and other phased out floating point insns?
2284 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2286 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2287 do { typedef struct {
2291 dbl_pair_t dbl_pair[3];
2292 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2295 ac_have_as_ppc_fpPO=yes
2296 AC_MSG_RESULT([yes])
2298 ac_have_as_ppc_fpPO=no
2301 if test x$ac_have_as_ppc_fpPO = xyes ; then
2302 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2306 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
2307 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
2309 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2311 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
2312 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
2314 ac_have_as_amd64_fxsave64=yes
2315 AC_MSG_RESULT([yes])
2317 ac_have_as_amd64_fxsave64=no
2320 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
2321 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
2324 # does the x86/amd64 assembler understand SSE3 instructions?
2325 # Note, this doesn't generate a C-level symbol. It generates a
2326 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
2327 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2329 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2330 do { long long int x;
2331 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2335 AC_MSG_RESULT([yes])
2341 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
2344 # Ditto for SSSE3 instructions (note extra S)
2345 # Note, this doesn't generate a C-level symbol. It generates a
2346 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2347 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2349 save_CFLAGS="$CFLAGS"
2350 CFLAGS="$CFLAGS -msse -Werror"
2351 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2352 do { long long int x;
2353 __asm__ __volatile__(
2354 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2357 ac_have_as_ssse3=yes
2358 AC_MSG_RESULT([yes])
2363 CFLAGS="$save_CFLAGS"
2365 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2368 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2369 # Note, this doesn't generate a C-level symbol. It generates a
2370 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
2371 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
2372 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2374 __asm__ __volatile__(
2375 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2378 ac_have_as_pclmulqdq=yes
2379 AC_MSG_RESULT([yes])
2381 ac_have_as_pclmulqdq=no
2385 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2388 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2389 # Note, this doesn't generate a C-level symbol. It generates a
2390 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2391 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2392 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2395 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2396 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2397 * xmm2 should be used.
2399 __asm__ __volatile__(
2400 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2403 ac_have_as_vpclmulqdq=yes
2404 AC_MSG_RESULT([yes])
2406 ac_have_as_vpclmulqdq=no
2410 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2413 # does the x86/amd64 assembler understand FMA4 instructions?
2414 # Note, this doesn't generate a C-level symbol. It generates a
2415 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
2416 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
2417 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2419 __asm__ __volatile__(
2420 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
2423 ac_have_as_vfmaddpd=yes
2424 AC_MSG_RESULT([yes])
2426 ac_have_as_vfmaddpd=no
2430 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
2433 # does the x86/amd64 assembler understand the LZCNT instruction?
2434 # Note, this doesn't generate a C-level symbol. It generates a
2435 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
2436 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2438 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2440 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
2443 ac_have_as_lzcnt=yes
2444 AC_MSG_RESULT([yes])
2450 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2453 # does the x86/amd64 assembler understand the LOOPNEL instruction?
2454 # Note, this doesn't generate a C-level symbol. It generates a
2455 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2456 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2458 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2460 __asm__ __volatile__("1: loopnel 1b\n");
2463 ac_have_as_loopnel=yes
2464 AC_MSG_RESULT([yes])
2466 ac_have_as_loopnel=no
2470 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2473 # does the x86/amd64 assembler understand ADDR32 ?
2474 # Note, this doesn't generate a C-level symbol. It generates a
2475 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2476 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2478 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2480 asm volatile ("addr32 rep movsb");
2483 ac_have_as_addr32=yes
2484 AC_MSG_RESULT([yes])
2486 ac_have_as_addr32=no
2490 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2493 # does the x86/amd64 assembler understand SSE 4.2 instructions?
2494 # Note, this doesn't generate a C-level symbol. It generates a
2495 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2496 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2498 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2499 do { long long int x;
2500 __asm__ __volatile__(
2501 "crc32q %%r15,%%r15" : : : "r15" );
2502 __asm__ __volatile__(
2503 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2504 __asm__ __volatile__(
2505 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
2508 ac_have_as_sse42=yes
2509 AC_MSG_RESULT([yes])
2515 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2518 # does the x86/amd64 assembler understand AVX instructions?
2519 # Note, this doesn't generate a C-level symbol. It generates a
2520 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2521 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2524 do { long long int x;
2525 __asm__ __volatile__(
2526 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2527 __asm__ __volatile__(
2528 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2532 AC_MSG_RESULT([yes])
2538 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2541 # does the x86/amd64 assembler understand AVX2 instructions?
2542 # Note, this doesn't generate a C-level symbol. It generates a
2543 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2544 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2546 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2547 do { long long int x;
2548 __asm__ __volatile__(
2549 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2550 __asm__ __volatile__(
2551 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2555 AC_MSG_RESULT([yes])
2561 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2564 # does the x86/amd64 assembler understand TSX instructions and
2565 # the XACQUIRE/XRELEASE prefixes?
2566 # Note, this doesn't generate a C-level symbol. It generates a
2567 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2568 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2570 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2572 __asm__ __volatile__(
2575 " xacquire lock incq 0(%rsp) \n\t"
2576 " xrelease lock incq 0(%rsp) \n"
2581 AC_MSG_RESULT([yes])
2587 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2590 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2591 # Note, this doesn't generate a C-level symbol. It generates a
2592 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2593 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2595 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2596 do { unsigned int h, l;
2597 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
2598 __asm__ __volatile__(
2599 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
2600 __asm__ __volatile__(
2601 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
2605 AC_MSG_RESULT([yes])
2611 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2614 # does the x86/amd64 assembler understand FMA instructions?
2615 # Note, this doesn't generate a C-level symbol. It generates a
2616 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2617 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2619 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2620 do { unsigned int h, l;
2621 __asm__ __volatile__(
2622 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2623 __asm__ __volatile__(
2624 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2625 __asm__ __volatile__(
2626 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2630 AC_MSG_RESULT([yes])
2636 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2639 # does the amd64 assembler understand MPX instructions?
2640 # Note, this doesn't generate a C-level symbol. It generates a
2641 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2642 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2644 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2646 asm ("bndmov %bnd0,(%rsp)");
2647 asm ("bndldx 3(%rbx,%rdx), %bnd2");
2648 asm ("bnd call foo\n"
2655 AC_MSG_RESULT([yes])
2661 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2664 # does the amd64 assembler understand ADX instructions?
2665 # Note, this doesn't generate a C-level symbol. It generates a
2666 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
2667 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
2669 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2671 asm ("adcxq %r14,%r8");
2675 AC_MSG_RESULT([yes])
2681 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
2684 # Does the C compiler support the "ifunc" attribute
2685 # Note, this doesn't generate a C-level symbol. It generates a
2686 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2687 # does the x86/amd64 assembler understand MOVBE?
2688 # Note, this doesn't generate a C-level symbol. It generates a
2689 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2690 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2692 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2693 do { long long int x;
2694 __asm__ __volatile__(
2695 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
2698 ac_have_as_movbe=yes
2699 AC_MSG_RESULT([yes])
2705 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2708 # Does the C compiler support the "ifunc" attribute
2709 # Note, this doesn't generate a C-level symbol. It generates a
2710 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2711 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2713 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2714 static void mytest(void) {}
2716 static void (*resolve_test(void))(void)
2718 return (void (*)(void))&mytest;
2721 void test(void) __attribute__((ifunc("resolve_test")));
2729 ac_have_ifunc_attr=yes
2730 AC_MSG_RESULT([yes])
2732 ac_have_ifunc_attr=no
2736 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2738 # Does the C compiler support the armv8 crc feature flag
2739 # Note, this doesn't generate a C-level symbol. It generates a
2740 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
2741 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
2743 save_CFLAGS="$CFLAGS"
2744 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
2745 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2751 ac_have_armv8_crc_feature=yes
2752 AC_MSG_RESULT([yes])
2754 ac_have_armv8_crc_feature=no
2757 CFLAGS="$save_CFLAGS"
2759 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
2762 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2763 # when building the tool executables. I think we should get rid of it.
2765 # Check for TLS support in the compiler and linker
2766 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2768 [vg_cv_linktime_tls=yes],
2769 [vg_cv_linktime_tls=no])
2770 # Native compilation: check whether running a program using TLS succeeds.
2771 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2772 # succeeds but running programs using TLS fails.
2773 # Cross-compiling: check whether linking a program using TLS succeeds.
2774 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2775 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2776 [vg_cv_tls=$enableval],
2777 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2781 [vg_cv_tls=$vg_cv_linktime_tls])])])
2783 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
2784 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2788 #----------------------------------------------------------------------------
2789 # Solaris-specific checks.
2790 #----------------------------------------------------------------------------
2792 if test "$VGCONF_OS" = "solaris" ; then
2793 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
2795 # Solaris-specific check determining if the Sun Studio Assembler is used to
2796 # build Valgrind. The test checks if the x86/amd64 assembler understands the
2797 # cmovl.l instruction, if yes then it's Sun Assembler.
2799 # C-level symbol: none
2800 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
2802 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
2803 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2805 __asm__ __volatile__("cmovl.l %edx, %eax");
2807 solaris_have_sun_studio_as=yes
2808 AC_MSG_RESULT([yes])
2810 solaris_have_sun_studio_as=no
2813 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
2815 # Solaris-specific check determining if symbols __xpg4 and __xpg6
2816 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
2817 # See solaris/vgpreload-solaris.mapfile for details.
2818 # gcc on older Solaris instructs linker to include these symbols,
2819 # gcc on illumos and newer Solaris does not.
2821 # C-level symbol: none
2822 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
2824 save_CFLAGS="$CFLAGS"
2825 CFLAGS="$CFLAGS -std=gnu99"
2826 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
2827 temp_dir=$( /usr/bin/mktemp -d )
2828 cat <<_ACEOF >${temp_dir}/mylib.c
2830 int myfunc(void) { printf("LaPutyka\n"); }
2832 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
2833 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
2834 if test "x${xpg_present}" = "x" ; then
2835 solaris_xpg_symbols_present=no
2838 solaris_xpg_symbols_present=yes
2839 AC_MSG_RESULT([yes])
2842 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
2843 CFLAGS="$save_CFLAGS"
2846 # Solaris-specific check determining if gcc enables largefile support by
2847 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
2848 # variable with gcc flags which disable it.
2850 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
2851 save_CFLAGS="$CFLAGS"
2852 CFLAGS="$CFLAGS -m32"
2853 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2854 return _LARGEFILE_SOURCE;
2856 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
2857 AC_MSG_RESULT([yes])
2859 SOLARIS_UNDEF_LARGESOURCE=""
2863 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
2866 # Solaris-specific check determining if /proc/self/cmdline
2867 # or /proc/<pid>/cmdline is supported.
2869 # C-level symbol: SOLARIS_PROC_CMDLINE
2870 # Automake-level symbol: SOLARIS_PROC_CMDLINE
2872 AC_CHECK_FILE([/proc/self/cmdline],
2874 solaris_proc_cmdline=yes
2875 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
2876 [Define to 1 if you have /proc/self/cmdline.])
2878 solaris_proc_cmdline=no
2880 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
2883 # Solaris-specific check determining default platform for the Valgrind launcher.
2884 # Used in case the launcher cannot select platform by looking at the client
2885 # image (for example because the executable is a shell script).
2887 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
2888 # Automake-level symbol: none
2890 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
2891 # Get the ELF class of /bin/sh first.
2892 if ! test -f /bin/sh; then
2893 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
2895 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
2896 case "$elf_class" in
2898 default_arch="$VGCONF_ARCH_PRI";
2901 if test "x$VGCONF_ARCH_SEC" != "x"; then
2902 default_arch="$VGCONF_ARCH_SEC"
2904 default_arch="$VGCONF_ARCH_PRI";
2908 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
2911 default_platform="$default_arch-$VGCONF_OS"
2912 AC_MSG_RESULT([$default_platform])
2913 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
2914 [Default platform for Valgrind launcher.])
2917 # Solaris-specific check determining if the old syscalls are available.
2919 # C-level symbol: SOLARIS_OLD_SYSCALLS
2920 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
2922 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
2923 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2924 #include <sys/syscall.h>
2928 solaris_old_syscalls=yes
2929 AC_MSG_RESULT([yes])
2930 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
2931 [Define to 1 if you have the old Solaris syscalls.])
2933 solaris_old_syscalls=no
2936 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
2939 # Solaris-specific check determining if the new accept() syscall is available.
2942 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2945 # New syscall (available on illumos):
2946 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2947 # int version, int flags);
2949 # If the old syscall is present then the following syscall will fail with
2950 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
2951 # available then it will fail with EINVAL (because the flags parameter is
2954 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
2955 # Automake-level symbol: none
2957 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
2958 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2959 #include <sys/syscall.h>
2963 syscall(SYS_accept, 0, 0, 0, 0, -1);
2964 return !(errno == EINVAL);
2966 AC_MSG_RESULT([yes])
2967 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
2968 [Define to 1 if you have the new `accept' syscall.])
2974 # Solaris-specific check determining if the new illumos pipe() syscall is
2978 # longlong_t pipe();
2980 # New syscall (available on illumos):
2981 # int pipe(intptr_t arg, int flags);
2983 # If the old syscall is present then the following call will succeed, if the
2984 # new syscall is available then it will fail with EFAULT (because address 0
2985 # cannot be accessed).
2987 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
2988 # Automake-level symbol: none
2990 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
2991 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2992 #include <sys/syscall.h>
2996 syscall(SYS_pipe, 0, 0);
2997 return !(errno == EFAULT);
2999 AC_MSG_RESULT([yes])
3000 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3001 [Define to 1 if you have the new `pipe' syscall.])
3007 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
3011 # int lwp_kill(id_t lwpid, int sig);
3013 # New syscall (available on Solaris 11):
3014 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3015 # int si_code, timespec_t *timeout);
3017 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3018 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3020 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3021 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3022 #include <sys/syscall.h>
3024 return !SYS_lwp_sigqueue;
3026 solaris_lwp_sigqueue_syscall=yes
3027 AC_MSG_RESULT([yes])
3028 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
3029 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
3031 solaris_lwp_sigqueue_syscall=no
3034 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3037 # Solaris-specific check determining if the lwp_sigqueue() syscall
3038 # takes both pid and thread id arguments or just thread id.
3040 # Old syscall (available on Solaris 11.x):
3041 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3042 # int si_code, timespec_t *timeout);
3044 # New syscall (available on Solaris 12):
3045 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
3046 # int si_code, timespec_t *timeout);
3048 # If the old syscall is present then the following syscall will fail with
3049 # EINVAL (because signal is out of range); if the new syscall is available
3050 # then it will fail with ESRCH (because it would not find such thread in the
3053 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3054 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3056 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
3057 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
3058 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3059 #include <sys/syscall.h>
3063 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
3064 return !(errno == ESRCH);
3066 solaris_lwp_sigqueue_syscall_takes_pid=yes
3067 AC_MSG_RESULT([yes])
3068 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
3069 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
3071 solaris_lwp_sigqueue_syscall_takes_pid=no
3074 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
3075 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
3077 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
3081 # Solaris-specific check determining if the new lwp_name() syscall is
3084 # New syscall (available on Solaris 11):
3085 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
3087 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
3088 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
3090 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
3091 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3092 #include <sys/syscall.h>
3094 return !SYS_lwp_name;
3096 solaris_lwp_name_syscall=yes
3097 AC_MSG_RESULT([yes])
3098 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
3099 [Define to 1 if you have the new `lwp_name' syscall.])
3101 solaris_lwp_name_syscall=no
3104 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
3107 # Solaris-specific check determining if the new getrandom() syscall is
3110 # New syscall (available on Solaris 11):
3111 # int getrandom(void *buf, size_t buflen, uint_t flags);
3113 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
3114 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
3116 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
3117 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3118 #include <sys/syscall.h>
3120 return !SYS_getrandom;
3122 solaris_getrandom_syscall=yes
3123 AC_MSG_RESULT([yes])
3124 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
3125 [Define to 1 if you have the new `getrandom' syscall.])
3127 solaris_getrandom_syscall=no
3130 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
3133 # Solaris-specific check determining if the new zone() syscall subcodes
3134 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
3135 # were added in Solaris 11 but are missing on illumos.
3137 # C-level symbol: SOLARIS_ZONE_DEFUNCT
3138 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
3140 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
3141 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3142 #include <sys/zone.h>
3144 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
3146 solaris_zone_defunct=yes
3147 AC_MSG_RESULT([yes])
3148 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
3149 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
3151 solaris_zone_defunct=no
3154 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
3157 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
3158 # for auditon(2) subcode of the auditsys() syscall are available.
3159 # These commands are available in Solaris 11 and illumos but were removed
3162 # C-level symbol: SOLARIS_AUDITON_STAT
3163 # Automake-level symbol: SOLARIS_AUDITON_STAT
3165 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
3166 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3167 #include <bsm/audit.h>
3169 return !(A_GETSTAT && A_SETSTAT);
3171 solaris_auditon_stat=yes
3172 AC_MSG_RESULT([yes])
3173 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
3174 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
3176 solaris_auditon_stat=no
3179 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
3182 # Solaris-specific check determining if the new shmsys() syscall subcodes
3183 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
3184 # These subcodes were added in Solaris 11 but are missing on illumos.
3186 # C-level symbol: SOLARIS_SHM_NEW
3187 # Automake-level symbol: SOLARIS_SHM_NEW
3189 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
3190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3191 #include <sys/ipc_impl.h>
3192 #include <sys/shm.h>
3193 #include <sys/shm_impl.h>
3195 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
3198 AC_MSG_RESULT([yes])
3199 AC_DEFINE([SOLARIS_SHM_NEW], 1,
3200 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
3205 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
3208 # Solaris-specific check determining if prxregset_t is available. Illumos
3209 # currently does not define it on the x86 platform.
3211 # C-level symbol: SOLARIS_PRXREGSET_T
3212 # Automake-level symbol: SOLARIS_PRXREGSET_T
3214 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
3215 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3216 #include <sys/procfs_isa.h>
3218 return !sizeof(prxregset_t);
3220 solaris_prxregset_t=yes
3221 AC_MSG_RESULT([yes])
3222 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
3223 [Define to 1 if you have the `prxregset_t' type.])
3225 solaris_prxregset_t=no
3228 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
3231 # Solaris-specific check determining if the new frealpathat() syscall is
3234 # New syscall (available on Solaris 11.1):
3235 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
3237 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3238 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3240 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
3241 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3242 #include <sys/syscall.h>
3244 return !SYS_frealpathat;
3246 solaris_frealpathat_syscall=yes
3247 AC_MSG_RESULT([yes])
3248 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
3249 [Define to 1 if you have the new `frealpathat' syscall.])
3251 solaris_frealpathat_syscall=no
3254 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
3257 # Solaris-specific check determining if the new uuidsys() syscall is
3260 # New syscall (available on newer Solaris):
3261 # int uuidsys(struct uuid *uuid);
3263 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
3264 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
3266 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
3267 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3268 #include <sys/syscall.h>
3270 return !SYS_uuidsys;
3272 solaris_uuidsys_syscall=yes
3273 AC_MSG_RESULT([yes])
3274 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
3275 [Define to 1 if you have the new `uuidsys' syscall.])
3277 solaris_uuidsys_syscall=no
3280 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
3283 # Solaris-specific check determining if the new labelsys() syscall subcode
3284 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
3285 # missing on illumos.
3287 # C-level symbol: SOLARIS_TNDB_GET_TNIP
3288 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
3290 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
3291 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3292 #include <sys/tsol/tndb.h>
3294 return !TNDB_GET_TNIP;
3296 solaris_tndb_get_tnip=yes
3297 AC_MSG_RESULT([yes])
3298 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
3299 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
3301 solaris_tndb_get_tnip=no
3304 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
3307 # Solaris-specific check determining if the new labelsys() syscall opcodes
3308 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
3309 # added in Solaris 11 but are missing on illumos.
3311 # C-level symbol: SOLARIS_TSOL_CLEARANCE
3312 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
3314 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
3315 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3316 #include <sys/tsol/tsyscall.h>
3318 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
3320 solaris_tsol_clearance=yes
3321 AC_MSG_RESULT([yes])
3322 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
3323 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
3325 solaris_tsol_clearance=no
3328 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
3331 # Solaris-specific check determining if the new pset() syscall subcode
3332 # PSET_GET_NAME is available. This subcode was added in Solaris 12 but
3333 # is missing on illumos and Solaris 11.
3335 # C-level symbol: SOLARIS_PSET_GET_NAME
3336 # Automake-level symbol: SOLARIS_PSET_GET_NAME
3338 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
3339 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3340 #include <sys/pset.h>
3342 return !(PSET_GET_NAME);
3344 solaris_pset_get_name=yes
3345 AC_MSG_RESULT([yes])
3346 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
3347 [Define to 1 if you have the `PSET_GET_NAME' constants.])
3349 solaris_pset_get_name=no
3352 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
3355 # Solaris-specific check determining if the utimesys() syscall is
3356 # available (on illumos and older Solaris).
3358 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
3359 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
3361 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
3362 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3363 #include <sys/syscall.h>
3365 return !SYS_utimesys;
3367 solaris_utimesys_syscall=yes
3368 AC_MSG_RESULT([yes])
3369 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
3370 [Define to 1 if you have the `utimesys' syscall.])
3372 solaris_utimesys_syscall=no
3375 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
3378 # Solaris-specific check determining if the utimensat() syscall is
3379 # available (on newer Solaris).
3381 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3382 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3384 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
3385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3386 #include <sys/syscall.h>
3388 return !SYS_utimensat;
3390 solaris_utimensat_syscall=yes
3391 AC_MSG_RESULT([yes])
3392 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
3393 [Define to 1 if you have the `utimensat' syscall.])
3395 solaris_utimensat_syscall=no
3398 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
3401 # Solaris-specific check determining if the spawn() syscall is available
3402 # (on newer Solaris).
3404 # C-level symbol: SOLARIS_SPAWN_SYSCALL
3405 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
3407 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
3408 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3409 #include <sys/syscall.h>
3413 solaris_spawn_syscall=yes
3414 AC_MSG_RESULT([yes])
3415 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
3416 [Define to 1 if you have the `spawn' syscall.])
3418 solaris_spawn_syscall=no
3421 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
3424 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
3425 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
3427 # C-level symbol: SOLARIS_MODCTL_MODNVL
3428 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
3430 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
3431 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3432 #include <sys/modctl.h>
3434 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
3436 solaris_modctl_modnvl=yes
3437 AC_MSG_RESULT([yes])
3438 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
3439 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
3441 solaris_modctl_modnvl=no
3444 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
3447 # Solaris-specific check determining whether nscd (name switch cache daemon)
3448 # attaches its door at /system/volatile/name_service_door (Solaris)
3449 # or at /var/run/name_service_door (illumos).
3451 # Note that /var/run is a symlink to /system/volatile on Solaris
3452 # but not vice versa on illumos.
3454 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3455 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3457 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
3458 if test -e /system/volatile/name_service_door; then
3459 solaris_nscd_door_system_volatile=yes
3460 AC_MSG_RESULT([/system/volatile/name_service_door])
3461 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
3462 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
3464 solaris_nscd_door_system_volatile=no
3465 AC_MSG_RESULT([/var/run/name_service_door])
3467 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
3470 # Solaris-specific check determining if the new gethrt() fasttrap is available.
3472 # New fasttrap (available on Solaris 11):
3473 # hrt_t *gethrt(void);
3475 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
3476 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
3478 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
3479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3480 #include <sys/trap.h>
3484 solaris_gethrt_fasttrap=yes
3485 AC_MSG_RESULT([yes])
3486 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
3487 [Define to 1 if you have the new `gethrt' fasttrap.])
3489 solaris_gethrt_fasttrap=no
3492 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
3495 # Solaris-specific check determining if the new get_zone_offset() fasttrap
3498 # New fasttrap (available on Solaris 11):
3499 # zonehrtoffset_t *get_zone_offset(void);
3501 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3502 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3504 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
3505 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3506 #include <sys/trap.h>
3508 return !T_GETZONEOFFSET;
3510 solaris_getzoneoffset_fasttrap=yes
3511 AC_MSG_RESULT([yes])
3512 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
3513 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
3515 solaris_getzoneoffset_fasttrap=no
3518 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
3521 # Solaris-specific check determining if the execve() syscall
3522 # takes fourth argument (flags) or not.
3524 # Old syscall (available on illumos):
3525 # int execve(const char *fname, const char **argv, const char **envp);
3527 # New syscall (available on Solaris):
3528 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
3530 # If the new syscall is present then it will fail with EINVAL (because flags
3531 # are invalid); if the old syscall is available then it will fail with ENOENT
3532 # (because the file could not be found).
3534 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3535 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3537 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
3538 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3539 #include <sys/syscall.h>
3543 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
3544 return !(errno == EINVAL);
3546 solaris_execve_syscall_takes_flags=yes
3547 AC_MSG_RESULT([yes])
3548 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
3549 [Define to 1 if you have the new `execve' syscall which accepts flags.])
3551 solaris_execve_syscall_takes_flags=no
3554 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
3555 test x$solaris_execve_syscall_takes_flags = xyes)
3558 # Solaris-specific check determining version of the repository cache protocol.
3559 # Every Solaris version uses a different one, ranging from 21 to current 25.
3560 # The check is very ugly, though.
3562 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
3563 # Automake-level symbol: none
3565 AC_PATH_PROG(DIS_PATH, dis, false)
3566 if test "x$DIS_PATH" = "xfalse"; then
3567 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
3569 AC_CHECK_LIB(scf, scf_handle_bind, [], [
3570 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
3571 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3574 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
3575 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
3576 libscf=/usr/lib/64/libscf.so.1
3578 libscf=/usr/lib/libscf.so.1
3580 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
3581 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
3582 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3584 hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
3585 if test -z "$hex"; then
3586 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
3587 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3589 version=$( printf "%d\n" 0x$hex )
3590 AC_MSG_RESULT([$version])
3591 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
3592 [Version number of the repository door cache protocol.])
3595 # Solaris-specific check determining if "sysstat" segment reservation type
3598 # New "sysstat" segment reservation (available on Solaris 12):
3599 # - program header type: PT_SUNW_SYSSTAT
3600 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
3602 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3603 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3605 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
3606 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3607 #include <sys/auxv.h>
3609 return !AT_SUN_SYSSTAT_ADDR;
3611 solaris_reserve_sysstat_addr=yes
3612 AC_MSG_RESULT([yes])
3613 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
3614 [Define to 1 if you have the new `sysstat' segment reservation.])
3616 solaris_reserve_sysstat_addr=no
3619 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
3622 # Solaris-specific check determining if "sysstat_zone" segment reservation type
3625 # New "sysstat_zone" segment reservation (available on Solaris 12):
3626 # - program header type: PT_SUNW_SYSSTAT_ZONE
3627 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
3629 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3630 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3632 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
3633 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3634 #include <sys/auxv.h>
3636 return !AT_SUN_SYSSTAT_ZONE_ADDR;
3638 solaris_reserve_sysstat_zone_addr=yes
3639 AC_MSG_RESULT([yes])
3640 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
3641 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
3643 solaris_reserve_sysstat_zone_addr=no
3646 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
3649 # Solaris-specific check determining if the system_stats() syscall is available
3650 # (on newer Solaris).
3652 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3653 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3655 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
3656 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3657 #include <sys/syscall.h>
3659 return !SYS_system_stats;
3661 solaris_system_stats_syscall=yes
3662 AC_MSG_RESULT([yes])
3663 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
3664 [Define to 1 if you have the `system_stats' syscall.])
3666 solaris_system_stats_syscall=no
3669 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
3672 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
3673 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
3675 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
3676 # Automake-level symbol: none
3678 AC_CHECK_TYPE([struct _fpchip_state],
3679 [solaris_fpchip_state_takes_underscore=yes],
3680 [solaris_fpchip_state_takes_underscore=no],
3681 [[#include <sys/regset.h>]])
3682 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
3683 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
3684 [Define to 1 if fpregset_t defines struct _fpchip_state])
3688 # Solaris-specific check determining if schedctl page shared between kernel
3689 # and userspace program is executable (illumos, older Solaris) or not (newer
3692 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
3693 # Automake-level symbol: none
3695 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
3696 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3700 #include <schedctl.h>
3704 schedctl_t *scp = schedctl_init();
3708 int fd = open("/proc/self/map", O_RDONLY);
3713 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
3714 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
3715 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
3716 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
3717 return (map.pr_mflags & MA_EXEC);
3723 solaris_schedctl_page_exec=no
3726 solaris_schedctl_page_exec=yes
3727 AC_MSG_RESULT([yes])
3728 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
3729 [Define to 1 if you have the schedctl page executable.])
3733 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
3734 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
3735 # an initial thread pointer for libc (newer Solaris).
3737 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
3738 # Automake-level symbol: none
3740 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
3741 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3742 #include <sys/fasttrap_isa.h>
3744 return !FT_SCRATCHSIZE;
3746 solaris_pt_sunwdtrace_thrp=yes
3747 AC_MSG_RESULT([yes])
3748 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
3749 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
3751 solaris_pt_sunwdtrace_thrp=no
3756 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
3757 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
3758 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
3759 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
3760 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
3761 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
3762 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
3763 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
3764 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
3765 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
3766 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
3767 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
3768 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
3769 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
3770 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
3771 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
3772 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
3773 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
3774 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
3775 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
3776 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
3777 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
3778 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
3779 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
3780 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
3781 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
3782 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
3783 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
3784 fi # test "$VGCONF_OS" = "solaris"
3787 #----------------------------------------------------------------------------
3788 # Checks for C header files.
3789 #----------------------------------------------------------------------------
3792 AC_CHECK_HEADERS([ \
3810 # Verify whether the <linux/futex.h> header is usable.
3811 AC_MSG_CHECKING([if <linux/futex.h> is usable])
3813 save_CFLAGS="$CFLAGS"
3814 CFLAGS="$CFLAGS -D__user="
3815 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3816 #include <linux/futex.h>
3820 ac_have_usable_linux_futex_h=yes
3821 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
3822 [Define to 1 if you have a usable <linux/futex.h> header file.])
3823 AC_MSG_RESULT([yes])
3825 ac_have_usable_linux_futex_h=no
3828 CFLAGS="$save_CFLAGS"
3831 #----------------------------------------------------------------------------
3832 # Checks for typedefs, structures, and compiler characteristics.
3833 #----------------------------------------------------------------------------
3840 #----------------------------------------------------------------------------
3841 # Checks for library functions.
3842 #----------------------------------------------------------------------------
3846 AC_CHECK_LIB([pthread], [pthread_create])
3847 AC_CHECK_LIB([rt], [clock_gettime])
3860 pthread_barrier_init \
3861 pthread_condattr_setclock \
3862 pthread_mutex_timedlock \
3863 pthread_rwlock_timedrdlock \
3864 pthread_rwlock_timedwrlock \
3867 pthread_setname_np \
3883 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
3884 # libraries with any shared object and/or executable. This is NOT what we
3885 # want for e.g. vgpreload_core-x86-linux.so
3888 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
3889 [test x$ac_cv_func_pthread_barrier_init = xyes])
3890 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
3891 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
3892 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
3893 [test x$ac_cv_func_pthread_spin_lock = xyes])
3894 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
3895 [test x$ac_cv_func_pthread_setname_np = xyes])
3897 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3898 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
3899 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
3900 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
3903 #----------------------------------------------------------------------------
3905 #----------------------------------------------------------------------------
3906 # Do we have a useable MPI setup on the primary and/or secondary targets?
3907 # On Linux, by default, assumes mpicc and -m32/-m64
3908 # Note: this is a kludge in that it assumes the specified mpicc
3909 # understands -m32/-m64 regardless of what is specified using
3911 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
3912 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
3915 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
3916 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
3917 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
3918 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3919 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
3920 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
3921 mflag_primary=$FLAG_M32
3922 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
3923 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
3924 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
3925 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
3926 mflag_primary=$FLAG_M64
3927 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
3928 mflag_primary="$FLAG_M32 -arch i386"
3929 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
3930 mflag_primary="$FLAG_M64 -arch x86_64"
3934 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
3935 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
3936 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS ; then
3937 mflag_secondary=$FLAG_M32
3938 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
3939 mflag_secondary="$FLAG_M32 -arch i386"
3944 [ --with-mpicc= Specify name of MPI2-ised C compiler],
3949 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
3950 ## use these values in the check for a functioning mpicc.
3952 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
3953 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
3954 AM_COND_IF([VGCONF_OS_IS_LINUX],
3955 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3956 LDFLAGS_MPI="-fpic -shared"])
3957 AM_COND_IF([VGCONF_OS_IS_DARWIN],
3958 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
3959 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
3960 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
3961 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3962 LDFLAGS_MPI="-fpic -shared"])
3964 AC_SUBST([CFLAGS_MPI])
3965 AC_SUBST([LDFLAGS_MPI])
3968 ## See if MPI_CC works for the primary target
3970 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
3972 saved_CFLAGS=$CFLAGS
3974 CFLAGS="$CFLAGS_MPI $mflag_primary"
3975 saved_LDFLAGS="$LDFLAGS"
3976 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
3977 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3981 int ni, na, nd, comb;
3982 int r = MPI_Init(NULL,NULL);
3983 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
3984 r |= MPI_Finalize();
3987 ac_have_mpi2_pri=yes
3988 AC_MSG_RESULT([yes, $MPI_CC])
3994 CFLAGS=$saved_CFLAGS
3995 LDFLAGS="$saved_LDFLAGS"
3996 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
3998 ## See if MPI_CC works for the secondary target. Complication: what if
3999 ## there is no secondary target? We need this to then fail.
4000 ## Kludge this by making MPI_CC something which will surely fail in
4003 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
4005 saved_CFLAGS=$CFLAGS
4006 saved_LDFLAGS="$LDFLAGS"
4007 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
4008 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
4009 CC="$MPI_CC this will surely fail"
4013 CFLAGS="$CFLAGS_MPI $mflag_secondary"
4014 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4018 int ni, na, nd, comb;
4019 int r = MPI_Init(NULL,NULL);
4020 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4021 r |= MPI_Finalize();
4024 ac_have_mpi2_sec=yes
4025 AC_MSG_RESULT([yes, $MPI_CC])
4031 CFLAGS=$saved_CFLAGS
4032 LDFLAGS="$saved_LDFLAGS"
4033 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
4036 #----------------------------------------------------------------------------
4037 # Other library checks
4038 #----------------------------------------------------------------------------
4039 # There now follow some tests for Boost, and OpenMP. These
4040 # tests are present because Drd has some regression tests that use
4041 # these packages. All regression test programs all compiled only
4042 # for the primary target. And so it is important that the configure
4043 # checks that follow, use the correct -m32 or -m64 flag for the
4044 # primary target (called $mflag_primary). Otherwise, we can end up
4045 # in a situation (eg) where, on amd64-linux, the test for Boost checks
4046 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
4047 # only build (meaning, the primary target is x86-linux), the build
4048 # of the regtest programs that use Boost fails, because they are
4049 # build as 32-bit (IN THIS EXAMPLE).
4051 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
4052 # NEEDED BY THE REGRESSION TEST PROGRAMS.
4055 # Check whether the boost library 1.35 or later has been installed.
4056 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
4058 AC_MSG_CHECKING([for boost])
4061 safe_CXXFLAGS=$CXXFLAGS
4062 CXXFLAGS="$mflag_primary"
4064 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
4066 AC_LINK_IFELSE([AC_LANG_SOURCE([
4067 #include <boost/thread.hpp>
4068 static void thread_func(void)
4070 int main(int argc, char** argv)
4072 boost::thread t(thread_func);
4077 ac_have_boost_1_35=yes
4078 AC_SUBST([BOOST_CFLAGS], [])
4079 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
4080 AC_MSG_RESULT([yes])
4082 ac_have_boost_1_35=no
4087 CXXFLAGS=$safe_CXXFLAGS
4090 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
4093 # does this compiler support -fopenmp, does it have the include file
4094 # <omp.h> and does it have libgomp ?
4096 AC_MSG_CHECKING([for OpenMP])
4099 CFLAGS="-fopenmp $mflag_primary -Werror"
4101 AC_LINK_IFELSE([AC_LANG_SOURCE([
4103 int main(int argc, char** argv)
4111 AC_MSG_RESULT([yes])
4118 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
4121 # Check for __builtin_popcount
4122 AC_MSG_CHECKING([for __builtin_popcount()])
4123 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4125 __builtin_popcount(2);
4128 AC_MSG_RESULT([yes])
4129 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
4130 [Define to 1 if compiler provides __builtin_popcount().])
4135 # Check for __builtin_clz
4136 AC_MSG_CHECKING([for __builtin_clz()])
4137 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4142 AC_MSG_RESULT([yes])
4143 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
4144 [Define to 1 if compiler provides __builtin_clz().])
4149 # Check for __builtin_ctz
4150 AC_MSG_CHECKING([for __builtin_ctz()])
4151 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4156 AC_MSG_RESULT([yes])
4157 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
4158 [Define to 1 if compiler provides __builtin_ctz().])
4163 # does this compiler have built-in functions for atomic memory access for the
4165 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
4168 CFLAGS="$mflag_primary"
4170 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4172 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4173 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4175 ac_have_builtin_atomic_primary=yes
4176 AC_MSG_RESULT([yes])
4177 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])
4179 ac_have_builtin_atomic_primary=no
4185 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
4186 [test x$ac_have_builtin_atomic_primary = xyes])
4189 # does this compiler have built-in functions for atomic memory access for the
4190 # secondary target ?
4192 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4194 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
4197 CFLAGS="$mflag_secondary"
4199 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4201 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
4203 ac_have_builtin_atomic_secondary=yes
4204 AC_MSG_RESULT([yes])
4206 ac_have_builtin_atomic_secondary=no
4214 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
4215 [test x$ac_have_builtin_atomic_secondary = xyes])
4217 # does this compiler have built-in functions for atomic memory access on
4218 # 64-bit integers for all targets ?
4220 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
4222 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4225 uint64_t variable = 1;
4226 return __sync_add_and_fetch(&variable, 1)
4228 ac_have_builtin_atomic64_primary=yes
4230 ac_have_builtin_atomic64_primary=no
4233 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4236 CFLAGS="$mflag_secondary"
4238 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4241 uint64_t variable = 1;
4242 return __sync_add_and_fetch(&variable, 1)
4244 ac_have_builtin_atomic64_secondary=yes
4246 ac_have_builtin_atomic64_secondary=no
4253 if test x$ac_have_builtin_atomic64_primary = xyes && \
4254 test x$VGCONF_PLATFORM_SEC_CAPS = x \
4255 -o x$ac_have_builtin_atomic64_secondary = xyes; then
4256 AC_MSG_RESULT([yes])
4257 ac_have_builtin_atomic64=yes
4260 ac_have_builtin_atomic64=no
4263 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
4264 [test x$ac_have_builtin_atomic64 = xyes])
4267 # does g++ have built-in functions for atomic memory access ?
4268 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
4270 safe_CXXFLAGS=$CXXFLAGS
4271 CXXFLAGS="$mflag_primary"
4274 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4276 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4277 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4279 ac_have_builtin_atomic_cxx=yes
4280 AC_MSG_RESULT([yes])
4281 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
4283 ac_have_builtin_atomic_cxx=no
4288 CXXFLAGS=$safe_CXXFLAGS
4290 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
4293 if test x$ac_have_usable_linux_futex_h = xyes \
4294 -a x$ac_have_builtin_atomic_primary = xyes; then
4295 ac_enable_linux_ticket_lock_primary=yes
4297 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
4298 [test x$ac_enable_linux_ticket_lock_primary = xyes])
4300 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
4301 -a x$ac_have_usable_linux_futex_h = xyes \
4302 -a x$ac_have_builtin_atomic_secondary = xyes; then
4303 ac_enable_linux_ticket_lock_secondary=yes
4305 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
4306 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
4309 # does libstdc++ support annotating shared pointers ?
4310 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
4312 safe_CXXFLAGS=$CXXFLAGS
4313 CXXFLAGS="-std=c++0x"
4316 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4319 std::shared_ptr<int> p
4321 ac_have_shared_ptr=yes
4323 ac_have_shared_ptr=no
4325 if test x$ac_have_shared_ptr = xyes; then
4326 # If compilation of the program below fails because of a syntax error
4327 # triggered by substituting one of the annotation macros then that
4328 # means that libstdc++ supports these macros.
4329 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4330 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
4331 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
4334 std::shared_ptr<int> p
4336 ac_have_shared_pointer_annotation=no
4339 ac_have_shared_pointer_annotation=yes
4340 AC_MSG_RESULT([yes])
4341 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
4342 [Define to 1 if libstd++ supports annotating shared pointers])
4345 ac_have_shared_pointer_annotation=no
4350 CXXFLAGS=$safe_CXXFLAGS
4352 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
4353 [test x$ac_have_shared_pointer_annotation = xyes])
4356 #----------------------------------------------------------------------------
4357 # Ok. We're done checking.
4358 #----------------------------------------------------------------------------
4360 # Nb: VEX/Makefile is generated from Makefile.vex.in.
4363 VEX/Makefile:Makefile.vex.in
4372 gdbserver_tests/Makefile
4373 gdbserver_tests/solaris/Makefile
4379 memcheck/tests/Makefile
4380 memcheck/tests/common/Makefile
4381 memcheck/tests/amd64/Makefile
4382 memcheck/tests/x86/Makefile
4383 memcheck/tests/linux/Makefile
4384 memcheck/tests/darwin/Makefile
4385 memcheck/tests/solaris/Makefile
4386 memcheck/tests/amd64-linux/Makefile
4387 memcheck/tests/arm64-linux/Makefile
4388 memcheck/tests/x86-linux/Makefile
4389 memcheck/tests/amd64-solaris/Makefile
4390 memcheck/tests/x86-solaris/Makefile
4391 memcheck/tests/ppc32/Makefile
4392 memcheck/tests/ppc64/Makefile
4393 memcheck/tests/s390x/Makefile
4394 memcheck/tests/mips32/Makefile
4395 memcheck/tests/mips64/Makefile
4396 memcheck/tests/vbit-test/Makefile
4398 cachegrind/tests/Makefile
4399 cachegrind/tests/x86/Makefile
4400 cachegrind/cg_annotate
4403 callgrind/callgrind_annotate
4404 callgrind/callgrind_control
4405 callgrind/tests/Makefile
4407 helgrind/tests/Makefile
4409 massif/tests/Makefile
4412 lackey/tests/Makefile
4415 none/tests/scripts/Makefile
4416 none/tests/amd64/Makefile
4417 none/tests/ppc32/Makefile
4418 none/tests/ppc64/Makefile
4419 none/tests/x86/Makefile
4420 none/tests/arm/Makefile
4421 none/tests/arm64/Makefile
4422 none/tests/s390x/Makefile
4423 none/tests/mips32/Makefile
4424 none/tests/mips64/Makefile
4425 none/tests/linux/Makefile
4426 none/tests/darwin/Makefile
4427 none/tests/solaris/Makefile
4428 none/tests/amd64-linux/Makefile
4429 none/tests/x86-linux/Makefile
4430 none/tests/amd64-darwin/Makefile
4431 none/tests/x86-darwin/Makefile
4432 none/tests/amd64-solaris/Makefile
4433 none/tests/x86-solaris/Makefile
4434 exp-sgcheck/Makefile
4435 exp-sgcheck/tests/Makefile
4437 drd/scripts/download-and-build-splash2
4440 exp-bbv/tests/Makefile
4441 exp-bbv/tests/x86/Makefile
4442 exp-bbv/tests/x86-linux/Makefile
4443 exp-bbv/tests/amd64-linux/Makefile
4444 exp-bbv/tests/ppc32-linux/Makefile
4445 exp-bbv/tests/arm-linux/Makefile
4447 exp-dhat/tests/Makefile
4451 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
4452 [chmod +x coregrind/link_tool_exe_linux])
4453 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
4454 [chmod +x coregrind/link_tool_exe_darwin])
4455 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
4456 [chmod +x coregrind/link_tool_exe_solaris])
4461 Maximum build arch: ${ARCH_MAX}
4462 Primary build arch: ${VGCONF_ARCH_PRI}
4463 Secondary build arch: ${VGCONF_ARCH_SEC}
4464 Build OS: ${VGCONF_OS}
4465 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
4466 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
4467 Platform variant: ${VGCONF_PLATVARIANT}
4468 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
4469 Default supp files: ${DEFAULT_SUPP}