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.
12 # Define major, minor, micro and suffix here once, then reuse them
13 # for version number in valgrind.h and vg-entities (documentation).
14 # suffix must be empty for a release, otherwise it is GIT or RC1, etc.
15 # Also set the (expected/last) release date here.
16 # Do not forget to rerun ./autogen.sh
17 m4_define([v_major_ver], [3])
18 m4_define([v_minor_ver], [25])
19 m4_define([v_micro_ver], [0])
20 m4_define([v_suffix_ver], [GIT])
21 m4_define([v_rel_date], ["?? Apr 2025"])
22 m4_define([v_version],
23 m4_if(v_suffix_ver, [],
24 [v_major_ver.v_minor_ver.v_micro_ver],
25 [v_major_ver.v_minor_ver.v_micro_ver.v_suffix_ver]))
26 AC_INIT([Valgrind],[v_version],[valgrind-users@lists.sourceforge.net])
29 AC_SUBST(VG_VER_MAJOR, v_major_ver)
30 AC_SUBST(VG_VER_MINOR, v_minor_ver)
32 # For docs/xml/vg-entities.xml
33 AC_SUBST(VG_DATE, v_rel_date)
35 AC_CONFIG_SRCDIR(coregrind/m_main.c)
36 AC_CONFIG_HEADERS([config.h])
37 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
41 #----------------------------------------------------------------------------
42 # Do NOT modify these flags here. Except in feature tests in which case
43 # the original values must be properly restored.
44 #----------------------------------------------------------------------------
48 #----------------------------------------------------------------------------
49 # Checks for various programs.
50 #----------------------------------------------------------------------------
53 m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
54 # Make sure we can compile in C99 mode.
55 if test "$ac_cv_prog_cc_c99" = "no"; then
56 AC_MSG_ERROR([Valgrind relies on a C compiler supporting C99])
60 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
61 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
62 # base (eg. most likely as Darwin-specific tests) we'll need one of the
64 # - put AC_PROG_OBJC in a Darwin-specific part of this file
65 # - Use AC_PROG_OBJC here and up the minimum autoconf version
66 # - Use the following, which is apparently equivalent:
67 # m4_ifdef([AC_PROG_OBJC],
69 # [AC_CHECK_TOOL([OBJC], [gcc])
71 # AC_SUBST([OBJCFLAGS])
74 # Set LTO_RANLIB variable to an lto enabled ranlib
75 if test "x$LTO_RANLIB" = "x"; then
76 AC_PATH_PROGS([LTO_RANLIB], [gcc-ranlib])
78 AC_ARG_VAR([LTO_RANLIB],[Library indexer command for link time optimisation])
80 # provide a very basic definition for AC_PROG_SED if it's not provided by
81 # autoconf (as e.g. in autoconf 2.59).
82 m4_ifndef([AC_PROG_SED],
83 [AC_DEFUN([AC_PROG_SED],
85 AC_CHECK_PROGS([SED],[gsed sed])])])
88 AC_DEFUN([AC_PROG_SHA256SUM],
89 [AC_ARG_VAR([SHA256SUM])
90 AC_CHECK_PROGS([SHA256SUM],[gsha256sum sha256sum])])
93 # If no AR variable was specified, look up the name of the archiver. Otherwise
94 # do not touch the AR variable.
95 if test "x$AR" = "x"; then
96 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
98 AC_ARG_VAR([AR],[Archiver command])
100 # same for LTO_AR variable for lto enabled archiver
101 if test "x$LTO_AR" = "x"; then
102 AC_PATH_PROGS([LTO_AR], [gcc-ar])
104 AC_ARG_VAR([LTO_AR],[Archiver command for link time optimisation])
106 # figure out where perl lives
107 AC_PATH_PROG(PERL, perl)
109 # figure out where gdb lives
110 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
111 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
113 # some older automake's don't have it so try something on our own
114 ifdef([AM_PROG_AS],[AM_PROG_AS],
124 # Check if 'diff' supports -u (universal diffs) and use it if possible.
126 AC_MSG_CHECKING([for diff -u])
129 # Comparing two identical files results in 0.
130 tmpfile="tmp-xxx-yyy-zzz"
132 if diff -u $tmpfile $tmpfile ; then
141 # We don't want gcc < 3.0
142 AC_MSG_CHECKING([for a supported version of gcc])
144 # Obtain the compiler version.
146 # A few examples of how the ${CC} --version output looks like:
148 # ######## gcc variants ########
149 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
150 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
151 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
152 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
153 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
154 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
155 # 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)
157 # ######## clang variants ########
158 # Clang: clang version 2.9 (tags/RELEASE_29/final)
159 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
160 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
162 # ######## Apple LLVM variants ########
163 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
164 # Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
167 if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
170 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
171 elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
174 # Don't use -dumpversion with clang: it will always produce "4.2.1".
175 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
176 elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
179 gcc_version=`${CC} -dumpversion 2>/dev/null`
182 gcc_version=`${CC} -dumpversion 2>/dev/null`
183 if test "x$gcc_version" = x; then
184 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
188 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
189 AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
191 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
192 # statements have to be quoted.
193 case "${is_clang}-${gcc_version}" in
194 applellvm-5.1|applellvm-[[6-9]].*|applellvm-[[1-9][0-9]]*)
195 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
197 icc-1[[3-9]].*|icc-202[[0-9]].*)
198 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
200 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
201 AC_MSG_RESULT([ok (${gcc_version})])
203 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
204 AC_MSG_RESULT([ok (clang-${gcc_version})])
207 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
208 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0 or Apple LLVM >= 5.1])
212 #----------------------------------------------------------------------------
213 # Arch/OS/platform tests.
214 #----------------------------------------------------------------------------
215 # We create a number of arch/OS/platform-related variables. We prefix them
216 # all with "VGCONF_" which indicates that they are defined at
217 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
218 # variables used when compiling C files.
222 AC_MSG_CHECKING([for a supported CPU])
224 # ARCH_MAX reflects the most that this CPU can do: for example if it
225 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
226 # Ditto for amd64. It is used for more configuration below, but is not used
229 # Power PC returns powerpc for Big Endian. This was not changed when Little
230 # Endian support was added to the 64-bit architecture. The 64-bit Little
231 # Endian systems explicitly state le in the host_cpu. For clarity in the
232 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianness of
233 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
234 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
235 # Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
236 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
237 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
240 VGCONF_PLATFORM_ARM_ARCH=
242 case "${host_cpu}" in
244 AC_MSG_RESULT([ok (${host_cpu})])
249 AC_MSG_RESULT([ok (${host_cpu})])
254 # this only referrs to 64-bit Big Endian
255 AC_MSG_RESULT([ok (${host_cpu})])
260 # this only referrs to 64-bit Little Endian
261 AC_MSG_RESULT([ok (${host_cpu})])
266 # On Linux this means only a 32-bit capable CPU.
267 AC_MSG_RESULT([ok (${host_cpu})])
272 AC_MSG_RESULT([ok (${host_cpu})])
277 AC_MSG_RESULT([ok (${host_cpu})])
278 VGCONF_PLATFORM_ARM_ARCH="-marm -mcpu=cortex-a8"
283 AC_MSG_RESULT([ok (${host_cpu})])
284 VGCONF_PLATFORM_ARM_ARCH="-marm -mcpu=cortex-a8"
289 AC_MSG_RESULT([ok (${host_cpu})])
290 VGCONF_PLATFORM_ARM_ARCH="-march=armv6"
295 AC_MSG_RESULT([ok (${host_cpu})])
300 AC_MSG_RESULT([ok (${host_cpu})])
305 AC_MSG_RESULT([ok (${host_cpu})])
310 AC_MSG_RESULT([ok (${host_cpu})])
315 AC_MSG_RESULT([ok (${host_cpu})])
320 AC_MSG_RESULT([ok (${host_cpu})])
324 AC_MSG_RESULT([ok (${host_cpu})])
329 AC_MSG_RESULT([no (${host_cpu})])
330 AC_MSG_ERROR([Unsupported host architecture. Sorry])
334 AC_SUBST(VGCONF_PLATFORM_ARM_ARCH)
336 #----------------------------------------------------------------------------
338 # Sometimes it's convenient to subvert the bi-arch build system and
339 # just have a single build even though the underlying platform is
340 # capable of both. Hence handle --enable-only64bit and
341 # --enable-only32bit. Complain if both are issued :-)
342 # [Actually, if either of these options are used, I think both get built,
343 # but only one gets installed. So if you use an in-place build, both can be
346 # Check if a 64-bit only build has been requested
347 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
348 [AC_ARG_ENABLE(only64bit,
349 [ --enable-only64bit do a 64-bit only build],
350 [vg_cv_only64bit=$enableval],
351 [vg_cv_only64bit=no])])
353 # Check if a 32-bit only build has been requested
354 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
355 [AC_ARG_ENABLE(only32bit,
356 [ --enable-only32bit do a 32-bit only build],
357 [vg_cv_only32bit=$enableval],
358 [vg_cv_only32bit=no])])
361 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
363 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
366 #----------------------------------------------------------------------------
368 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
369 # compilation of many C files via -VGO_$(VGCONF_OS) and
370 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
371 AC_MSG_CHECKING([for a supported OS])
378 AC_MSG_RESULT([ok (${host_os})])
381 # Ok, this is linux. Check the kernel version
382 AC_MSG_CHECKING([for the kernel version])
387 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
388 AC_MSG_RESULT([unsupported (${kernel})])
389 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
393 AC_MSG_RESULT([2.6 or later (${kernel})])
400 AC_MSG_RESULT([ok (${host_os})])
403 DEFAULT_SUPP="$srcdir/freebsd.supp $srcdir/freebsd-helgrind.supp $srcdir/freebsd-drd.supp ${DEFAULT_SUPP}"
407 AC_MSG_RESULT([ok (${host_os})])
409 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
410 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
411 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
412 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
413 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
414 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
415 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
416 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
417 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
419 AC_MSG_CHECKING([for the kernel version])
422 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
423 # has only one relevant version, the OS version. The `uname` check
424 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
425 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
426 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
427 # and we don't know of an macros similar to __GLIBC__ to get that info.
429 # XXX: `uname -r` won't do the right thing for cross-compiles, but
430 # that's not a problem yet.
432 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
433 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
434 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
435 # time support for 10.5 (the 9.* pattern just below), I'll leave it
436 # in for now, just in case anybody wants to give it a try. But I'm
437 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
440 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
441 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
442 DEFAULT_SUPP="$srcdir/darwin9.supp ${DEFAULT_SUPP}"
443 DEFAULT_SUPP="$srcdir/darwin9-drd.supp ${DEFAULT_SUPP}"
446 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
447 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
448 DEFAULT_SUPP="$srcdir/darwin10.supp ${DEFAULT_SUPP}"
449 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
452 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
453 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
454 DEFAULT_SUPP="$srcdir/darwin11.supp ${DEFAULT_SUPP}"
455 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
458 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
459 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
460 DEFAULT_SUPP="$srcdir/darwin12.supp ${DEFAULT_SUPP}"
461 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
464 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
465 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
466 DEFAULT_SUPP="$srcdir/darwin13.supp ${DEFAULT_SUPP}"
467 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
470 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
471 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
472 DEFAULT_SUPP="$srcdir/darwin14.supp ${DEFAULT_SUPP}"
473 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
476 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
477 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
478 DEFAULT_SUPP="$srcdir/darwin15.supp ${DEFAULT_SUPP}"
479 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
482 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
483 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
484 DEFAULT_SUPP="$srcdir/darwin16.supp ${DEFAULT_SUPP}"
485 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
488 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
489 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
490 DEFAULT_SUPP="$srcdir/darwin17.supp ${DEFAULT_SUPP}"
491 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
494 AC_MSG_RESULT([unsupported (${kernel})])
495 AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x and 17.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12/13)])
501 AC_MSG_RESULT([ok (${host_os})])
504 uname_v=$( uname -v )
507 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
510 DEFAULT_SUPP="$srcdir/solaris11.supp ${DEFAULT_SUPP}"
516 AC_MSG_RESULT([ok (${host_os})])
518 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
522 AC_MSG_RESULT([no (${host_os})])
523 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
527 #----------------------------------------------------------------------------
529 # If we are building on a 64 bit platform test to see if the system
530 # supports building 32 bit programs and disable 32 bit support if it
531 # does not support building 32 bit programs
533 case "$ARCH_MAX-$VGCONF_OS" in
534 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
535 AC_MSG_CHECKING([for 32 bit build support])
538 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
543 vg_cv_only64bit="yes"
546 CFLAGS=$safe_CFLAGS;;
548 AC_MSG_CHECKING([for 32 bit build support])
550 CFLAGS="$CFLAGS -mips32 -mabi=32"
551 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
552 #include <sys/prctl.h>
556 vg_cv_only64bit="yes"
559 CFLAGS=$safe_CFLAGS;;
562 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
564 [--enable-only32bit was specified but system does not support 32 bit builds])
567 #----------------------------------------------------------------------------
569 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
570 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
571 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
572 # above) will be "amd64" since that reflects the most that this cpu can do,
573 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
574 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
575 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
576 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
577 AC_SUBST(VGCONF_ARCH_PRI)
579 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
580 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
581 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
582 # It is empty if there is no secondary target.
583 AC_SUBST(VGCONF_ARCH_SEC)
585 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
586 # The entire system, including regression and performance tests, will be
587 # built for this target. The "_CAPS" indicates that the name is in capital
588 # letters, and it also uses '_' rather than '-' as a separator, because it's
589 # used to create various Makefile variables, which are all in caps by
590 # convention and cannot contain '-' characters. This is in contrast to
591 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
592 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
594 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
595 # Valgrind and tools will also be built for this target, but not the
596 # regression or performance tests.
598 # By default, the primary arch is the same as the "max" arch, as commented
599 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
600 # the big case statement just below here, in the case where we're building
601 # on a 64 bit machine but have been requested only to do a 32 bit build.
602 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
604 AC_MSG_CHECKING([for a supported CPU/OS combination])
606 # NB. The load address for a given platform may be specified in more
607 # than one place, in some cases, depending on whether we're doing a biarch,
608 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
609 # Be careful to give consistent values in all subcases. Also, all four
610 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
611 # even if it is to "0xUNSET".
613 case "$ARCH_MAX-$VGCONF_OS" in
615 VGCONF_ARCH_PRI="x86"
617 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
618 VGCONF_PLATFORM_SEC_CAPS=""
619 valt_load_address_pri_norml="0x58000000"
620 valt_load_address_pri_inner="0x38000000"
621 valt_load_address_sec_norml="0xUNSET"
622 valt_load_address_sec_inner="0xUNSET"
623 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
626 valt_load_address_sec_norml="0xUNSET"
627 valt_load_address_sec_inner="0xUNSET"
628 if test x$vg_cv_only64bit = xyes; then
629 VGCONF_ARCH_PRI="amd64"
631 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
632 VGCONF_PLATFORM_SEC_CAPS=""
633 valt_load_address_pri_norml="0x58000000"
634 valt_load_address_pri_inner="0x38000000"
635 elif test x$vg_cv_only32bit = xyes; then
636 VGCONF_ARCH_PRI="x86"
638 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
639 VGCONF_PLATFORM_SEC_CAPS=""
640 valt_load_address_pri_norml="0x58000000"
641 valt_load_address_pri_inner="0x38000000"
643 VGCONF_ARCH_PRI="amd64"
644 VGCONF_ARCH_SEC="x86"
645 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
646 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
647 valt_load_address_pri_norml="0x58000000"
648 valt_load_address_pri_inner="0x38000000"
649 valt_load_address_sec_norml="0x58000000"
650 valt_load_address_sec_inner="0x38000000"
652 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
655 VGCONF_ARCH_PRI="ppc32"
657 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
658 VGCONF_PLATFORM_SEC_CAPS=""
659 valt_load_address_pri_norml="0x58000000"
660 valt_load_address_pri_inner="0x38000000"
661 valt_load_address_sec_norml="0xUNSET"
662 valt_load_address_sec_inner="0xUNSET"
663 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
666 valt_load_address_sec_norml="0xUNSET"
667 valt_load_address_sec_inner="0xUNSET"
668 if test x$vg_cv_only64bit = xyes; then
669 VGCONF_ARCH_PRI="ppc64be"
671 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
672 VGCONF_PLATFORM_SEC_CAPS=""
673 valt_load_address_pri_norml="0x58000000"
674 valt_load_address_pri_inner="0x38000000"
675 elif test x$vg_cv_only32bit = xyes; then
676 VGCONF_ARCH_PRI="ppc32"
678 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
679 VGCONF_PLATFORM_SEC_CAPS=""
680 valt_load_address_pri_norml="0x58000000"
681 valt_load_address_pri_inner="0x38000000"
683 VGCONF_ARCH_PRI="ppc64be"
684 VGCONF_ARCH_SEC="ppc32"
685 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
686 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
687 valt_load_address_pri_norml="0x58000000"
688 valt_load_address_pri_inner="0x38000000"
689 valt_load_address_sec_norml="0x58000000"
690 valt_load_address_sec_inner="0x38000000"
692 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
695 # Little Endian is only supported on PPC64
696 valt_load_address_sec_norml="0xUNSET"
697 valt_load_address_sec_inner="0xUNSET"
698 VGCONF_ARCH_PRI="ppc64le"
700 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
701 VGCONF_PLATFORM_SEC_CAPS=""
702 valt_load_address_pri_norml="0x58000000"
703 valt_load_address_pri_inner="0x38000000"
704 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
707 VGCONF_ARCH_PRI="x86"
709 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
710 VGCONF_PLATFORM_SEC_CAPS=""
711 valt_load_address_pri_norml="0x38000000"
712 valt_load_address_pri_inner="0x28000000"
713 valt_load_address_sec_norml="0xUNSET"
714 valt_load_address_sec_inner="0xUNSET"
715 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
718 if test x$vg_cv_only64bit = xyes; then
719 VGCONF_ARCH_PRI="amd64"
721 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
722 VGCONF_PLATFORM_SEC_CAPS=""
723 elif test x$vg_cv_only32bit = xyes; then
724 VGCONF_ARCH_PRI="x86"
726 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
727 VGCONF_PLATFORM_SEC_CAPS=""
729 VGCONF_ARCH_PRI="amd64"
730 VGCONF_ARCH_SEC="x86"
731 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
732 VGCONF_PLATFORM_SEC_CAPS="X86_FREEBSD"
734 # These work with either base clang or ports installed gcc
735 # Hand rolled compilers probably need INSTALL_DIR/lib (at least for gcc)
736 if test x$is_clang = xclang ; then
737 FLAG_32ON64="-B/usr/lib32"
739 GCC_MAJOR_VERSION=`${CC} -dumpversion | $SED 's/\..*//' 2>/dev/null`
740 FLAG_32ON64="-B/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -Wl,-rpath,/usr/local/lib32/gcc${GCC_MAJOR_VERSION}/"
741 FLAG_32ON64_GXX="-L/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -lgcc_s"
742 AC_SUBST(FLAG_32ON64_GXX)
744 valt_load_address_pri_norml="0x38000000"
745 valt_load_address_pri_inner="0x28000000"
746 valt_load_address_sec_norml="0x38000000"
747 valt_load_address_sec_inner="0x28000000"
748 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
751 VGCONF_ARCH_PRI="arm64"
753 VGCONF_PLATFORM_PRI_CAPS="ARM64_FREEBSD"
754 VGCONF_PLATFORM_SEC_CAPS=""
755 valt_load_address_pri_norml="0x38000000"
756 valt_load_address_pri_inner="0x28000000"
757 valt_load_address_sec_norml="0xUNSET"
758 valt_load_address_sec_inner="0xUNSET"
759 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
761 # Darwin gets identified as 32-bit even when it supports 64-bit.
762 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
763 # all Macs support both 32-bit and 64-bit, so we just build both. If
764 # someone has a really old 32-bit only machine they can (hopefully?)
765 # build with --enable-only32bit. See bug 243362.
766 x86-darwin|amd64-darwin)
768 valt_load_address_sec_norml="0xUNSET"
769 valt_load_address_sec_inner="0xUNSET"
770 if test x$vg_cv_only64bit = xyes; then
771 VGCONF_ARCH_PRI="amd64"
773 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
774 VGCONF_PLATFORM_SEC_CAPS=""
775 valt_load_address_pri_norml="0x158000000"
776 valt_load_address_pri_inner="0x138000000"
777 elif test x$vg_cv_only32bit = xyes; then
778 VGCONF_ARCH_PRI="x86"
780 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
781 VGCONF_PLATFORM_SEC_CAPS=""
782 VGCONF_ARCH_PRI_CAPS="x86"
783 valt_load_address_pri_norml="0x58000000"
784 valt_load_address_pri_inner="0x38000000"
786 VGCONF_ARCH_PRI="amd64"
787 VGCONF_ARCH_SEC="x86"
788 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
789 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
790 valt_load_address_pri_norml="0x158000000"
791 valt_load_address_pri_inner="0x138000000"
792 valt_load_address_sec_norml="0x58000000"
793 valt_load_address_sec_inner="0x38000000"
795 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
798 VGCONF_ARCH_PRI="arm"
799 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
800 VGCONF_PLATFORM_SEC_CAPS=""
801 valt_load_address_pri_norml="0x58000000"
802 valt_load_address_pri_inner="0x38000000"
803 valt_load_address_sec_norml="0xUNSET"
804 valt_load_address_sec_inner="0xUNSET"
805 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
808 valt_load_address_sec_norml="0xUNSET"
809 valt_load_address_sec_inner="0xUNSET"
810 if test x$vg_cv_only64bit = xyes; then
811 VGCONF_ARCH_PRI="arm64"
813 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
814 VGCONF_PLATFORM_SEC_CAPS=""
815 valt_load_address_pri_norml="0x58000000"
816 valt_load_address_pri_inner="0x38000000"
817 elif test x$vg_cv_only32bit = xyes; then
818 VGCONF_ARCH_PRI="arm"
820 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
821 VGCONF_PLATFORM_SEC_CAPS=""
822 valt_load_address_pri_norml="0x58000000"
823 valt_load_address_pri_inner="0x38000000"
825 VGCONF_ARCH_PRI="arm64"
826 VGCONF_ARCH_SEC="arm"
827 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
828 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
829 valt_load_address_pri_norml="0x58000000"
830 valt_load_address_pri_inner="0x38000000"
831 valt_load_address_sec_norml="0x58000000"
832 valt_load_address_sec_inner="0x38000000"
834 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
837 VGCONF_ARCH_PRI="s390x"
839 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
840 VGCONF_PLATFORM_SEC_CAPS=""
841 # To improve branch prediction hit rate we want to have
842 # the generated code close to valgrind (host) code
843 valt_load_address_pri_norml="0x800000000"
844 valt_load_address_pri_inner="0x810000000"
845 valt_load_address_sec_norml="0xUNSET"
846 valt_load_address_sec_inner="0xUNSET"
847 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
850 VGCONF_ARCH_PRI="mips32"
852 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
853 VGCONF_PLATFORM_SEC_CAPS=""
854 valt_load_address_pri_norml="0x58000000"
855 valt_load_address_pri_inner="0x38000000"
856 valt_load_address_sec_norml="0xUNSET"
857 valt_load_address_sec_inner="0xUNSET"
858 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
861 valt_load_address_sec_norml="0xUNSET"
862 valt_load_address_sec_inner="0xUNSET"
863 if test x$vg_cv_only64bit = xyes; then
864 VGCONF_ARCH_PRI="mips64"
865 VGCONF_PLATFORM_SEC_CAPS=""
866 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
867 VGCONF_PLATFORM_SEC_CAPS=""
868 valt_load_address_pri_norml="0x58000000"
869 valt_load_address_pri_inner="0x38000000"
870 elif test x$vg_cv_only32bit = xyes; then
871 VGCONF_ARCH_PRI="mips32"
873 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
874 VGCONF_PLATFORM_SEC_CAPS=""
875 valt_load_address_pri_norml="0x58000000"
876 valt_load_address_pri_inner="0x38000000"
878 VGCONF_ARCH_PRI="mips64"
879 VGCONF_ARCH_SEC="mips32"
880 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
881 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
882 valt_load_address_pri_norml="0x58000000"
883 valt_load_address_pri_inner="0x38000000"
884 valt_load_address_sec_norml="0x58000000"
885 valt_load_address_sec_inner="0x38000000"
887 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
890 VGCONF_ARCH_PRI="nanomips"
892 VGCONF_PLATFORM_PRI_CAPS="NANOMIPS_LINUX"
893 VGCONF_PLATFORM_SEC_CAPS=""
894 valt_load_address_pri_norml="0x58000000"
895 valt_load_address_pri_inner="0x38000000"
896 valt_load_address_sec_norml="0xUNSET"
897 valt_load_address_sec_inner="0xUNSET"
898 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
901 VGCONF_ARCH_PRI="x86"
903 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
904 VGCONF_PLATFORM_SEC_CAPS=""
905 valt_load_address_pri_norml="0x58000000"
906 valt_load_address_pri_inner="0x38000000"
907 valt_load_address_sec_norml="0xUNSET"
908 valt_load_address_sec_inner="0xUNSET"
909 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
912 valt_load_address_sec_norml="0xUNSET"
913 valt_load_address_sec_inner="0xUNSET"
914 if test x$vg_cv_only64bit = xyes; then
915 VGCONF_ARCH_PRI="amd64"
917 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
918 VGCONF_PLATFORM_SEC_CAPS=""
919 valt_load_address_pri_norml="0x58000000"
920 valt_load_address_pri_inner="0x38000000"
921 elif test x$vg_cv_only32bit = xyes; then
922 VGCONF_ARCH_PRI="x86"
924 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
925 VGCONF_PLATFORM_SEC_CAPS=""
926 valt_load_address_pri_norml="0x58000000"
927 valt_load_address_pri_inner="0x38000000"
929 VGCONF_ARCH_PRI="amd64"
930 VGCONF_ARCH_SEC="x86"
931 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
932 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
933 valt_load_address_pri_norml="0x58000000"
934 valt_load_address_pri_inner="0x38000000"
935 valt_load_address_sec_norml="0x58000000"
936 valt_load_address_sec_inner="0x38000000"
938 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
941 VGCONF_ARCH_PRI="unknown"
942 VGCONF_ARCH_SEC="unknown"
943 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
944 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
945 valt_load_address_pri_norml="0xUNSET"
946 valt_load_address_pri_inner="0xUNSET"
947 valt_load_address_sec_norml="0xUNSET"
948 valt_load_address_sec_inner="0xUNSET"
949 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
950 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
954 #----------------------------------------------------------------------------
956 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
958 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
959 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
960 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
961 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
962 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD \
963 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
964 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
965 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
966 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
967 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
968 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
969 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
970 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
971 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
972 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
973 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
974 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
975 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
976 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
977 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
978 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
979 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
980 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
981 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
982 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
983 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD )
984 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
985 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
986 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
987 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
988 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
989 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
990 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
991 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_NANOMIPS,
992 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX )
994 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
996 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
997 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
998 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
999 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
1000 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
1001 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
1002 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1003 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
1004 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
1005 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
1006 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
1007 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
1008 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
1009 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1010 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
1011 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
1012 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
1013 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
1014 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1015 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
1016 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
1017 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1018 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
1019 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
1020 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
1021 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_NANOMIPS_LINUX,
1022 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1023 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD,
1024 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1025 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD)
1026 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD,
1027 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1028 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_FREEBSD,
1029 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD)
1030 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
1031 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1032 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
1033 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
1034 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1035 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
1036 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1037 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
1038 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
1039 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1042 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
1043 # Relies on the assumption that the primary and secondary targets are
1044 # for the same OS, so therefore only necessary to test the primary.
1045 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
1046 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1047 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1048 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1049 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1050 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
1051 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1052 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1053 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1054 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1055 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
1056 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1057 AM_CONDITIONAL(VGCONF_OS_IS_FREEBSD,
1058 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1059 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1060 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD)
1061 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
1062 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1063 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1064 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
1065 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1066 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1067 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN_OR_FREEBSD,
1068 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1069 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1070 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD \
1071 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1072 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1075 # Sometimes, in the Makefile.am files, it's useful to know whether or not
1076 # there is a secondary target.
1077 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
1078 test x$VGCONF_PLATFORM_SEC_CAPS != x)
1080 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
1081 dnl fallback definition
1082 dnl The macro is courtesy of Dave Hart:
1083 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
1084 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
1085 if test -z "$$1_TRUE"; then :
1094 #----------------------------------------------------------------------------
1096 #----------------------------------------------------------------------------
1098 # Check if this should be built as an inner Valgrind, to be run within
1099 # another Valgrind. Choose the load address accordingly.
1100 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
1101 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
1102 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
1103 [AC_ARG_ENABLE(inner,
1104 [ --enable-inner enables self-hosting],
1105 [vg_cv_inner=$enableval],
1107 if test "$vg_cv_inner" = yes; then
1108 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
1109 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
1110 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
1112 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
1113 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
1116 #----------------------------------------------------------------------------
1117 # Undefined behaviour sanitiser
1118 #----------------------------------------------------------------------------
1119 # Check whether we should build with the undefined beahviour sanitiser.
1121 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
1122 [AC_ARG_ENABLE(ubsan,
1123 [ --enable-ubsan enables the undefined behaviour sanitiser],
1124 [vg_cv_ubsan=$enableval],
1127 #----------------------------------------------------------------------------
1128 # Extra fine-tuning of installation directories
1129 #----------------------------------------------------------------------------
1131 [ --with-tmpdir=PATH Specify path for temporary files],
1134 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
1135 AC_SUBST(VG_TMPDIR, [$tmpdir])
1137 #----------------------------------------------------------------------------
1139 #----------------------------------------------------------------------------
1140 AM_COND_IF([VGCONF_OS_IS_DARWIN],
1141 [AC_CHECK_PROG([XCRUN], [xcrun], [yes], [no])
1142 AC_MSG_CHECKING([for xcode sdk include path])
1143 AC_ARG_WITH(xcodedir,
1144 [ --with-xcode-path=PATH Specify path for xcode sdk includes],
1145 [xcodedir="$withval"],
1147 if test "x$XCRUN" != "xno" -a ! -d /usr/include; then
1148 xcrundir=`xcrun --sdk macosx --show-sdk-path`
1149 if test -z "$xcrundir"; then
1150 xcodedir="/usr/include"
1152 xcodedir="$xcrundir/usr/include"
1155 xcodedir="/usr/include"
1158 AC_MSG_RESULT([$xcodedir])
1159 AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
1160 AC_SUBST(XCODE_DIR, [$xcodedir])])
1162 #----------------------------------------------------------------------------
1163 # Where to install gdb scripts, defaults to VG_LIBDIR (pkglibexecdir)
1164 #----------------------------------------------------------------------------
1165 AC_MSG_CHECKING([where gdb scripts are installed])
1166 AC_ARG_WITH(gdbscripts-dir,
1167 [ --with-gdbscripts-dir=PATH Specify path to install gdb scripts],
1168 [gdbscriptsdir=${withval}],
1169 [gdbscriptsdir=${libexecdir}/valgrind])
1170 AC_MSG_RESULT([$gdbscriptsdir])
1171 if test "x$gdbscriptsdir" != "xno"; then
1172 AC_SUBST(VG_GDBSCRIPTS_DIR, [$gdbscriptsdir])
1173 AM_CONDITIONAL(GDBSCRIPTS, true)
1175 AC_SUBST(VG_GDBSCRIPTS_DIR, [])
1176 AM_CONDITIONAL(GDBSCRIPTS, false)
1179 #----------------------------------------------------------------------------
1180 # Libc and suppressions
1181 #----------------------------------------------------------------------------
1182 # This variable will collect the suppression files to be used.
1183 AC_SUBST(DEFAULT_SUPP)
1185 AC_CHECK_HEADER([features.h])
1187 if test x$ac_cv_header_features_h = xyes; then
1188 AC_DEFINE([HAVE_HEADER_FEATURES_H], 1,
1189 [Define to 1 if you have the `features.h' header.])
1190 rm -f conftest.$ac_ext
1191 cat <<_ACEOF >conftest.$ac_ext
1192 #include <features.h>
1193 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1194 glibc version is: __GLIBC__ __GLIBC_MINOR__
1197 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1200 # not really a version check
1201 AC_EGREP_CPP([DARWIN_LIBC], [
1202 #include <sys/cdefs.h>
1203 #if defined(__DARWIN_VERS_1050)
1207 GLIBC_VERSION="darwin")
1209 AC_EGREP_CPP([FREEBSD_LIBC], [
1210 #include <sys/cdefs.h>
1211 #if defined(__FreeBSD__)
1215 GLIBC_VERSION="freebsd")
1217 # not really a version check
1218 AC_EGREP_CPP([BIONIC_LIBC], [
1219 #if defined(__ANDROID__)
1223 GLIBC_VERSION="bionic")
1225 # there is only one version of libc on Solaris
1226 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1227 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1228 GLIBC_VERSION="solaris"
1231 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1233 if test x$GLIBC_VERSION = x; then
1234 if $CC -dumpmachine | grep -q musl; then
1239 # If this is glibc then figure out the generic (in file) libc.so and
1240 # libpthread.so file paths to use in suppressions. Before 2.34 libpthread
1241 # was a separate library, afterwards it was merged into libc.so and
1242 # the library is called libc.so.6 (before it was libc-2.[0-9]+.so).
1243 # Use this fact to set GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH.
1244 case ${GLIBC_VERSION} in
1246 AC_MSG_CHECKING([whether pthread_create needs libpthread])
1247 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])],
1250 GLIBC_LIBC_PATH="*/lib*/libc.so.6"
1251 GLIBC_LIBPTHREAD_PATH="$GLIBC_LIBC_PATH"
1253 AC_MSG_RESULT([yes])
1254 GLIBC_LIBC_PATH="*/lib*/libc-2.*so*"
1255 GLIBC_LIBPTHREAD_PATH="*/lib*/libpthread-2.*so*"
1259 AC_MSG_CHECKING([not glibc...])
1260 AC_MSG_RESULT([${GLIBC_VERSION}])
1264 AC_MSG_CHECKING([the glibc version])
1266 case "${GLIBC_VERSION}" in
1268 AC_MSG_RESULT(${GLIBC_VERSION} family)
1269 DEFAULT_SUPP="$srcdir/glibc-2.2.supp ${DEFAULT_SUPP}"
1270 DEFAULT_SUPP="$srcdir/glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1271 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1274 AC_MSG_RESULT(${GLIBC_VERSION} family)
1275 DEFAULT_SUPP="$srcdir/glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1276 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1277 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1280 AC_MSG_RESULT(${GLIBC_VERSION} family)
1281 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1282 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1283 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1286 AC_MSG_RESULT(${GLIBC_VERSION} family)
1287 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1288 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1289 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1290 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1291 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1294 AC_MSG_RESULT(${GLIBC_VERSION} family)
1295 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1296 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1297 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1298 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1299 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1300 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1301 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1304 AC_MSG_RESULT(Darwin)
1305 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1306 # DEFAULT_SUPP set by kernel version check above.
1309 AC_MSG_RESULT(FreeBSD)
1310 AC_DEFINE([FREEBSD_LIBC], 1, [Define to 1 if you're using FreeBSD])
1311 # DEFAULT_SUPP set by kernel version check above.
1314 AC_MSG_RESULT(Bionic)
1315 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1316 DEFAULT_SUPP="$srcdir/bionic.supp ${DEFAULT_SUPP}"
1319 AC_MSG_RESULT(Solaris)
1320 # DEFAULT_SUPP set in host_os switch-case above.
1321 # No other suppression file is used.
1325 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1326 DEFAULT_SUPP="$srcdir/musl.supp ${DEFAULT_SUPP}"
1329 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1330 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1331 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1335 AC_SUBST(GLIBC_VERSION)
1336 AC_SUBST(GLIBC_LIBC_PATH)
1337 AC_SUBST(GLIBC_LIBPTHREAD_PATH)
1340 if test "$VGCONF_OS" != "solaris"; then
1341 # Add default suppressions for the X client libraries. Make no
1342 # attempt to detect whether such libraries are installed on the
1343 # build machine (or even if any X facilities are present); just
1344 # add the suppressions antidisirregardless.
1345 DEFAULT_SUPP="$srcdir/xfree-4.supp ${DEFAULT_SUPP}"
1346 DEFAULT_SUPP="$srcdir/xfree-3.supp ${DEFAULT_SUPP}"
1350 #----------------------------------------------------------------------------
1351 # Platform variants?
1352 #----------------------------------------------------------------------------
1354 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1355 # But there are times where we need a bit more control. The motivating
1356 # and currently only case is Android: this is almost identical to
1357 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1358 # platform variant tags, which get passed in the compile as
1359 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1361 # In almost all cases, the <variant> bit is "vanilla". But for Android
1362 # it is "android" instead.
1364 # Consequently (eg), plain arm-linux would build with
1366 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1368 # whilst an Android build would have
1370 # -DVGP_arm_linux -DVGPV_arm_linux_android
1372 # Same for x86. The setup of the platform variant is pushed relatively far
1373 # down this file in order that we can inspect any of the variables set above.
1375 # In the normal case ..
1376 VGCONF_PLATVARIANT="vanilla"
1379 if test "$GLIBC_VERSION" = "bionic";
1381 VGCONF_PLATVARIANT="android"
1384 AC_SUBST(VGCONF_PLATVARIANT)
1387 # FIXME: do we also want to define automake variables
1388 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1389 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1390 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1391 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1392 # that's what we'd need to do to use this, since what we'd want to write
1395 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1397 # Hmm. Can't think of a nice clean solution to this.
1399 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1400 test x$VGCONF_PLATVARIANT = xvanilla)
1401 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1402 test x$VGCONF_PLATVARIANT = xandroid)
1405 #----------------------------------------------------------------------------
1406 # Checking for various library functions and other definitions
1407 #----------------------------------------------------------------------------
1409 # Check for AT_FDCWD
1411 AC_MSG_CHECKING([for AT_FDCWD])
1412 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1419 ac_have_at_fdcwd=yes
1420 AC_MSG_RESULT([yes])
1426 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1428 # Check for stpncpy function definition in string.h
1429 # This explicitly checks with _GNU_SOURCE defined since that is also
1430 # used in the test case (some systems might define it without anyway
1431 # since stpncpy is part of The Open Group Base Specifications Issue 7
1432 # IEEE Std 1003.1-2008.
1433 AC_MSG_CHECKING([for stpncpy])
1434 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1441 char *r = stpncpy(d, s, n);
1443 ac_have_gnu_stpncpy=yes
1444 AC_MSG_RESULT([yes])
1446 ac_have_gnu_stpncpy=no
1450 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1452 # Check for PTRACE_GETREGS
1454 AC_MSG_CHECKING([for PTRACE_GETREGS])
1455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1458 #include <sys/ptrace.h>
1459 #include <sys/user.h>
1462 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1464 AC_MSG_RESULT([yes])
1465 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1466 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1472 # Check for CLOCK_MONOTONIC
1474 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1476 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1480 clock_gettime(CLOCK_MONOTONIC, &t);
1483 AC_MSG_RESULT([yes])
1484 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1485 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1491 # Check for ELF32/64_CHDR
1493 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1496 # Check for PTHREAD_RWLOCK_T
1498 AC_MSG_CHECKING([for pthread_rwlock_t])
1500 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1502 #include <pthread.h>
1504 pthread_rwlock_t rwl;
1506 AC_MSG_RESULT([yes])
1507 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1508 [Define to 1 if you have the `pthread_rwlock_t' type.])
1513 # Check for CLOCKID_T
1515 AC_MSG_CHECKING([for clockid_t])
1517 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1522 AC_MSG_RESULT([yes])
1523 AC_DEFINE([HAVE_CLOCKID_T], 1,
1524 [Define to 1 if you have the `clockid_t' type.])
1529 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1531 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1533 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1535 #include <pthread.h>
1537 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1539 AC_MSG_RESULT([yes])
1540 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1541 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1547 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1549 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1551 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1553 #include <pthread.h>
1555 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1557 AC_MSG_RESULT([yes])
1558 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1559 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1565 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1567 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1571 #include <pthread.h>
1573 return (PTHREAD_MUTEX_RECURSIVE_NP);
1575 AC_MSG_RESULT([yes])
1576 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1577 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1583 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1585 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1587 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1589 #include <pthread.h>
1591 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1594 AC_MSG_RESULT([yes])
1595 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1596 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1602 # Check whether pthread_mutex_t has a member called __m_kind.
1604 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1605 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1607 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1610 [#include <pthread.h>])
1613 # Check whether pthread_mutex_t has a member called __data.__kind.
1615 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1616 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1618 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1621 [#include <pthread.h>])
1623 # Convenience function. Set flags based on the existing HWCAP entries.
1624 # The AT_HWCAP entries are generated by glibc, and are based on
1625 # functions supported by the hardware/system/libc.
1626 # Subsequent support for whether the capability will actually be utilized
1627 # will also be checked against the compiler capabilities.
1629 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1630 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1632 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1633 if env LD_SHOW_AUXV=1 true | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1635 AC_MSG_RESULT([yes])
1636 AC_SUBST([$2],[yes])
1643 # gather hardware capabilities. (hardware/kernel/libc)
1644 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1645 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1646 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1647 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1648 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1649 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1650 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1651 AC_HWCAP_CONTAINS_FLAG([arch_3_1],[HWCAP_HAS_ISA_3_1])
1652 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1653 AC_HWCAP_CONTAINS_FLAG([mma],[HWCAP_HAS_MMA])
1656 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1657 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1658 # compiler support for isa 2.07 level instructions
1659 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1660 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1662 __asm__ __volatile__("mtvsrd 1,2 ");
1664 ac_asm_have_isa_2_07=yes
1665 AC_MSG_RESULT([yes])
1667 ac_asm_have_isa_2_07=no
1670 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1671 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1673 # altivec (vsx) support.
1674 # does this compiler support -maltivec and does it have the include file
1676 AC_MSG_CHECKING([for Altivec support in the compiler ])
1678 CFLAGS="-maltivec -Werror"
1679 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1680 #include <altivec.h>
1682 vector unsigned int v;
1685 AC_MSG_RESULT([yes])
1691 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1692 -a x$HWCAP_HAS_ALTIVEC = xyes])
1694 # Check that both: the compiler supports -mvsx and that the assembler
1695 # understands VSX instructions. If either of those doesn't work,
1696 # conclude that we can't do VSX.
1697 AC_MSG_CHECKING([for VSX compiler flag support])
1699 CFLAGS="-mvsx -Werror"
1700 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1703 ac_compiler_supports_vsx_flag=yes
1704 AC_MSG_RESULT([yes])
1706 ac_compiler_supports_vsx_flag=no
1711 AC_MSG_CHECKING([for VSX support in the assembler ])
1713 CFLAGS="-mvsx -Werror"
1714 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1715 #include <altivec.h>
1717 vector unsigned int v;
1718 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1720 ac_compiler_supports_vsx=yes
1721 AC_MSG_RESULT([yes])
1723 ac_compiler_supports_vsx=no
1727 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1728 -a x$ac_compiler_supports_vsx = xyes \
1729 -a x$HWCAP_HAS_VSX = xyes ])
1731 # DFP (Decimal Float)
1732 # The initial DFP support was added in Power 6. The dcffix instruction
1733 # support was added in Power 7.
1734 AC_MSG_CHECKING([that assembler knows DFP])
1735 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1738 __asm__ __volatile__("adtr 1, 2, 3")
1740 __asm__ __volatile__(".machine power7;\n" \
1746 AC_MSG_RESULT([yes])
1751 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1753 CFLAGS="-mhard-dfp -Werror"
1755 # The dcffix instruction is Power 7
1756 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1759 __asm__ __volatile__("adtr 1, 2, 3")
1761 __asm__ __volatile__(".machine power7;\n" \
1766 ac_compiler_have_dfp=yes
1767 AC_MSG_RESULT([yes])
1769 ac_compiler_have_dfp=no
1773 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1774 -a x$ac_compiler_have_dfp = xyes \
1775 -a x$HWCAP_HAS_DFP = xyes )
1777 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1778 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1780 _Decimal64 x = 0.0DD;
1782 ac_compiler_have_dfp_type=yes
1783 AC_MSG_RESULT([yes])
1785 ac_compiler_have_dfp_type=no
1788 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1789 -a x$HWCAP_HAS_DFP = xyes )
1792 # HTM (Hardware Transactional Memory)
1793 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1795 CFLAGS="-mhtm -Werror"
1796 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1800 AC_MSG_RESULT([yes])
1801 ac_compiler_supports_htm=yes
1804 ac_compiler_supports_htm=no
1808 AC_MSG_CHECKING([if compiler can find the htm builtins])
1810 CFLAGS="-mhtm -Werror"
1811 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1813 if (__builtin_tbegin (0))
1816 AC_MSG_RESULT([yes])
1817 ac_compiler_sees_htm_builtins=yes
1820 ac_compiler_sees_htm_builtins=no
1824 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1825 -a x$ac_compiler_sees_htm_builtins = xyes \
1826 -a x$HWCAP_HAS_HTM = xyes )
1828 # isa 3.0 checking. (actually 3.0 or newer)
1829 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1831 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1833 __asm__ __volatile__ (".machine power9;\n" \
1836 # guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste,
1839 CFLAGS="-DHAS_ISA_3_00"
1840 ac_asm_have_isa_3_00=yes
1841 AC_MSG_RESULT([yes])
1843 ac_asm_have_isa_3_00=no
1849 AC_MSG_CHECKING([that assembler knows xscvhpdp ])
1851 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1853 __asm__ __volatile__ (".machine power9;\n" \
1854 "xscvhpdp 1,2;\n" );
1856 ac_asm_have_xscvhpdp=yes
1857 AC_MSG_RESULT([yes])
1859 ac_asm_have_xscvhpdp=no
1863 # darn instruction checking
1864 AC_MSG_CHECKING([that assembler knows darn instruction ])
1866 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1868 __asm__ __volatile__(".machine power9; darn 1,0 ");
1870 ac_asm_have_darn_inst=yes
1871 AC_MSG_RESULT([yes])
1873 ac_asm_have_darn_inst=no
1878 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
1879 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1881 __asm__ __volatile__ (".machine power10;\n" \
1884 ac_asm_have_isa_3_1=yes
1885 AC_MSG_RESULT([yes])
1887 ac_asm_have_isa_3_1=no
1892 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
1893 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1895 AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes])
1896 AM_CONDITIONAL(HAS_DARN, [test x$ac_asm_have_darn_inst = xyes])
1898 AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \
1899 -a x$HWCAP_HAS_ISA_3_1 = xyes])
1901 # Check for pthread_create@GLIBC2.0
1902 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1905 CFLAGS="-lpthread -Werror"
1906 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1907 extern int pthread_create_glibc_2_0(void*, const void*,
1908 void *(*)(void*), void*);
1909 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1913 * Apparently on PowerPC linking this program succeeds and generates an
1914 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1916 #error This test does not work properly on PowerPC.
1918 pthread_create_glibc_2_0(0, 0, 0, 0);
1922 ac_have_pthread_create_glibc_2_0=yes
1923 AC_MSG_RESULT([yes])
1924 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1925 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1927 ac_have_pthread_create_glibc_2_0=no
1932 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1933 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1936 # Check for dlinfo RTLD_DI_TLS_MODID
1937 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1941 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1948 size_t sizes[10000];
1949 size_t modid_offset;
1950 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1953 ac_have_dlinfo_rtld_di_tls_modid=yes
1954 AC_MSG_RESULT([yes])
1955 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1956 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1958 ac_have_dlinfo_rtld_di_tls_modid=no
1963 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1964 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1967 # Check for eventfd_t, eventfd() and eventfd_read()
1968 AC_MSG_CHECKING([for eventfd()])
1970 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1971 #include <sys/eventfd.h>
1977 eventfd_read(fd, &ev);
1980 AC_MSG_RESULT([yes])
1981 AC_DEFINE([HAVE_EVENTFD], 1,
1982 [Define to 1 if you have the `eventfd' function.])
1983 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1984 [Define to 1 if you have the `eventfd_read' function.])
1989 # Check whether compiler can process #include <thread> without errors
1990 # clang 3.3 cannot process <thread> from e.g.
1991 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1993 AC_MSG_CHECKING([that C++ compiler can compile C++17 code])
1995 safe_CXXFLAGS=$CXXFLAGS
1998 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2003 AC_MSG_RESULT([yes])
2008 CXXFLAGS=$safe_CXXFLAGS
2011 AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes)
2013 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
2015 safe_CXXFLAGS=$CXXFLAGS
2018 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2022 ac_cxx_can_include_thread_header=yes
2023 AC_MSG_RESULT([yes])
2025 ac_cxx_can_include_thread_header=no
2028 CXXFLAGS=$safe_CXXFLAGS
2031 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
2033 # Check whether compiler can process #include <condition_variable> without errors
2035 AC_MSG_CHECKING([that C++ compiler can include <condition_variable> header file])
2037 safe_CXXFLAGS=$CXXFLAGS
2040 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2041 #include <condition_variable>
2044 ac_cxx_can_include_condition_variable_header=yes
2045 AC_MSG_RESULT([yes])
2047 ac_cxx_can_include_condition_variable_header=no
2050 CXXFLAGS=$safe_CXXFLAGS
2053 AM_CONDITIONAL(CXX_CAN_INCLUDE_CONDITION_VARIABLE_HEADER, test x$ac_cxx_can_include_condition_variable_header = xyes)
2055 # check for std::shared_timed_mutex, this is a C++ 14 feature
2057 AC_MSG_CHECKING([that C++ compiler can use std::shared_timed_mutex])
2059 safe_CXXFLAGS=$CXXFLAGS
2060 CXXFLAGS="-std=c++1y -pthread"
2062 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2063 #include <shared_mutex>
2064 std::shared_timed_mutex test_mutex;
2067 ac_cxx_can_use_shared_timed_mutex=yes
2068 AC_MSG_RESULT([yes])
2070 ac_cxx_can_use_shared_timed_mutex=no
2073 CXXFLAGS=$safe_CXXFLAGS
2076 AM_CONDITIONAL(CXX_CAN_USE_SHARED_TIMED_MUTEX, test x$ac_cxx_can_use_shared_timed_mutex = xyes)
2078 # check for std::shared_mutex, this is a C++ 11 feature
2080 AC_MSG_CHECKING([that C++ compiler can use std::timed_mutex])
2082 safe_CXXFLAGS=$CXXFLAGS
2083 CXXFLAGS="-std=c++0x -pthread"
2085 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2087 std::timed_mutex test_mutex;
2090 ac_cxx_can_use_timed_mutex=yes
2091 AC_MSG_RESULT([yes])
2093 ac_cxx_can_use_timed_mutex=no
2096 CXXFLAGS=$safe_CXXFLAGS
2099 AM_CONDITIONAL(CXX_CAN_USE_TIMED_MUTEX, test x$ac_cxx_can_use_timed_mutex = xyes)
2101 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
2102 # of the user_regs_struct from sys/user.h. They are structurally the same
2103 # but we get either one or the other.
2105 AC_CHECK_TYPE([struct user_regs_struct],
2106 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
2107 [[#include <sys/ptrace.h>]
2108 [#include <sys/time.h>]
2109 [#include <sys/user.h>]])
2110 if test "$sys_user_has_user_regs" = "yes"; then
2111 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
2112 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
2115 AC_MSG_CHECKING([for __NR_membarrier])
2116 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2117 #include <linux/unistd.h>
2119 return __NR_membarrier
2121 ac_have_nr_membarrier=yes
2122 AC_MSG_RESULT([yes])
2124 ac_have_nr_membarrier=no
2128 AM_CONDITIONAL(HAVE_NR_MEMBARRIER, [test x$ac_have_nr_membarrier = xyes])
2130 #----------------------------------------------------------------------------
2131 # Checking for supported compiler flags.
2132 #----------------------------------------------------------------------------
2134 case "${host_cpu}" in
2136 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2137 if test -z "$ARCH"; then
2138 # does this compiler support -march=mips32 (mips32 default) ?
2139 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
2142 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
2144 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2147 FLAG_M32="-mips32 -mabi=32"
2148 AC_MSG_RESULT([yes])
2158 # does this compiler support -march=mips64r2 (mips64r2 default) ?
2159 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
2162 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
2164 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2167 FLAG_M64="-march=mips64r2 -mabi=64"
2168 AC_MSG_RESULT([yes])
2181 # does this compiler support -m32 ?
2182 AC_MSG_CHECKING([if gcc accepts -m32])
2185 CFLAGS="${FLAG_32ON64} -m32 -Werror"
2187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2190 FLAG_M32="${FLAG_32ON64} -m32"
2191 AC_MSG_RESULT([yes])
2201 # does this compiler support -m64 ?
2202 AC_MSG_CHECKING([if gcc accepts -m64])
2205 CFLAGS="-m64 -Werror"
2207 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2211 AC_MSG_RESULT([yes])
2223 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2224 if test -z "$ARCH"; then
2225 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
2226 AC_MSG_CHECKING([if gcc accepts -march=octeon])
2229 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
2231 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2234 FLAG_OCTEON="-march=octeon"
2235 AC_MSG_RESULT([yes])
2242 AC_SUBST(FLAG_OCTEON)
2245 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
2246 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
2249 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
2251 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2254 FLAG_OCTEON2="-march=octeon2"
2255 AC_MSG_RESULT([yes])
2262 AC_SUBST(FLAG_OCTEON2)
2266 # does this compiler support -mmsa (MIPS MSA ASE) ?
2267 AC_MSG_CHECKING([if gcc accepts -mmsa])
2270 CFLAGS="$CFLAGS -mmsa -Werror"
2272 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2276 AC_MSG_RESULT([yes])
2285 # Are we compiling for the MIPS64 n32 ABI?
2286 AC_MSG_CHECKING([if gcc is producing mips n32 binaries])
2287 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2288 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABIN32))
2293 FLAG_M64="-march=mips64r2 -mabi=n32"
2294 AC_MSG_RESULT([yes])
2299 # Are we compiling for the MIPS64 n64 ABI?
2300 AC_MSG_CHECKING([if gcc is producing mips n64 binaries])
2301 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2302 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABI64))
2307 AC_MSG_RESULT([yes])
2312 # We enter the code block below in the following case:
2313 # Target architecture is set to mips64, the desired abi
2314 # was not specified and the compiler's default abi setting
2315 # is neither n32 nor n64.
2316 # Probe for and set the abi to either n64 or n32, in that order,
2317 # which is required for a mips64 build of valgrind.
2318 if test "$ARCH_MAX" = "mips64" -a "x$VGCONF_ABI" = "x"; then
2320 CFLAGS="$CFLAGS -mabi=64 -Werror"
2321 AC_MSG_CHECKING([if gcc is n64 capable])
2322 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2326 AC_MSG_RESULT([yes])
2332 if test "x$VGCONF_ABI" = "x"; then
2334 CFLAGS="$CFLAGS -mabi=n32 -Werror"
2335 AC_MSG_CHECKING([if gcc is n32 capable])
2336 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2340 FLAG_M64="-march=mips64r2 -mabi=n32"
2341 AC_MSG_RESULT([yes])
2349 AM_CONDITIONAL([VGCONF_HAVE_ABI],
2350 [test x$VGCONF_ABI != x])
2351 AC_SUBST(VGCONF_ABI)
2354 # does this compiler support -mmmx ?
2355 AC_MSG_CHECKING([if gcc accepts -mmmx])
2358 CFLAGS="-mmmx -Werror"
2360 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2364 AC_MSG_RESULT([yes])
2374 # does this compiler support -msse ?
2375 AC_MSG_CHECKING([if gcc accepts -msse])
2378 CFLAGS="-msse -Werror"
2380 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2384 AC_MSG_RESULT([yes])
2394 # does this compiler support -mpreferred-stack-boundary=2 when
2395 # generating code for a 32-bit target? Note that we only care about
2396 # this when generating code for (32-bit) x86, so if the compiler
2397 # doesn't recognise -m32 it's no big deal. We'll just get code for
2398 # the Memcheck and other helper functions, that is a bit slower than
2399 # it could be, on x86; and no difference at all on any other platform.
2400 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
2403 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
2405 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2408 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
2409 AC_MSG_RESULT([yes])
2411 PREFERRED_STACK_BOUNDARY_2=""
2416 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
2419 # does this compiler support -mlong-double-128 ?
2420 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
2422 CFLAGS="-mlong-double-128 -Werror"
2423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2426 ac_compiler_supports_mlong_double_128=yes
2427 AC_MSG_RESULT([yes])
2429 ac_compiler_supports_mlong_double_128=no
2433 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
2434 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
2435 AC_SUBST(FLAG_MLONG_DOUBLE_128)
2437 # does this toolchain support lto ?
2438 # Not checked for if --enable-lto=no was given, or if LTO_AR or LTO_RANLIB
2440 # If not enable-lto=* arg is provided, default to no, as lto builds are
2441 # a lot slower, and so not appropriate for Valgrind developments.
2442 # --enable-lto=yes should be used by distro packagers.
2443 AC_CACHE_CHECK([for using the link time optimisation], vg_cv_lto,
2445 [ --enable-lto enables building with link time optimisation],
2446 [vg_cv_lto=$enableval],
2449 if test "x${vg_cv_lto}" != "xno" -a "x${LTO_AR}" != "x" -a "x${LTO_RANLIB}" != "x"; then
2450 AC_MSG_CHECKING([if toolchain accepts lto])
2452 TEST_LTO_CFLAGS="-flto -fuse-linker-plugin"
2453 CFLAGS="$TEST_LTO_CFLAGS -Werror"
2455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2456 extern void somefun(void);
2460 LTO_CFLAGS=$TEST_LTO_CFLAGS
2461 AC_MSG_RESULT([yes])
2469 AC_SUBST(LTO_CFLAGS)
2471 # if we could not compile with lto args, or lto was disabled,
2472 # then set LTO_AR/LTO_RANLIB to the non lto values
2473 # define in config.h ENABLE_LTO (not needed by the code currently, but
2474 # this guarantees we recompile everything if we re-configure and rebuild
2475 # in a build dir previously build with another value of --enable-lto
2476 if test "x${LTO_CFLAGS}" = "x"; then
2478 LTO_RANLIB=${RANLIB}
2482 AC_DEFINE([ENABLE_LTO], 1, [configured to build with lto link time optimisation])
2485 # Convenience function to check whether GCC supports a particular
2486 # warning option. Takes two arguments,
2487 # first the warning flag name to check (without -W), then the
2488 # substitution name to set with -Wno-warning-flag if the flag exists,
2489 # or the empty string if the compiler doesn't accept the flag. Note
2490 # that checking is done against the warning flag itself, but the
2491 # substitution is then done to cancel the warning flag.
2492 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
2493 AC_MSG_CHECKING([if gcc accepts -W$1])
2495 CFLAGS="-W$1 -Werror"
2496 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2497 AC_SUBST([$2], [-Wno-$1])
2498 AC_MSG_RESULT([yes])], [
2500 AC_MSG_RESULT([no])])
2504 # A variation of the above for arguments that
2506 AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[
2507 AC_MSG_CHECKING([if gcc accepts -W$1=$2])
2509 CFLAGS="-W$1=$2 -Werror"
2510 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2511 AC_SUBST([$3], [-Wno-$1])
2512 AC_MSG_RESULT([yes])], [
2514 AC_MSG_RESULT([no])])
2518 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
2519 # -W$1 (instead of -Wno-$1).
2520 AC_DEFUN([AC_GCC_WARNING_SUBST],[
2521 AC_MSG_CHECKING([if gcc accepts -W$1])
2523 CFLAGS="-W$1 -Werror"
2524 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2525 AC_SUBST([$2], [-W$1])
2526 AC_MSG_RESULT([yes])], [
2528 AC_MSG_RESULT([no])])
2532 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
2533 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
2534 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
2535 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
2536 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
2537 AC_GCC_WARNING_SUBST_NO([maybe-uninitialized], [FLAG_W_NO_MAYBE_UNINITIALIZED])
2538 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
2539 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
2540 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
2541 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2542 AC_GCC_WARNING_SUBST_NO([expansion-to-defined], [FLAG_W_NO_EXPANSION_TO_DEFINED])
2543 AC_GCC_WARNING_SUBST_NO([unused-variable], [FLAG_W_NO_UNUSED_VARIABLE])
2544 AC_GCC_WARNING_SUBST_NO([unused-but-set-variable], [FLAG_W_NO_UNUSED_BUT_SET_VARIABLE])
2545 AC_GCC_WARNING_SUBST_NO([non-power-of-two-alignment], [FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT])
2546 AC_GCC_WARNING_SUBST_NO([sign-compare], [FLAG_W_NO_SIGN_COMPARE])
2547 AC_GCC_WARNING_SUBST_NO([stringop-overflow], [FLAG_W_NO_STRINGOP_OVERFLOW])
2548 AC_GCC_WARNING_SUBST_NO([stringop-overread], [FLAG_W_NO_STRINGOP_OVERREAD])
2549 AC_GCC_WARNING_SUBST_NO([stringop-truncation], [FLAG_W_NO_STRINGOP_TRUNCATION])
2550 AC_GCC_WARNING_SUBST_NO([format-overflow], [FLAG_W_NO_FORMAT_OVERFLOW])
2551 AC_GCC_WARNING_SUBST_NO([use-after-free], [FLAG_W_NO_USE_AFTER_FREE])
2552 AC_GCC_WARNING_SUBST_NO([free-nonheap-object], [FLAG_W_NO_FREE_NONHEAP_OBJECT])
2553 AC_GCC_WARNING_SUBST_NO([fortify-source], [FLAG_W_NO_FORTIFY_SOURCE])
2554 AC_GCC_WARNING_SUBST_NO([builtin-memcpy-chk-size], [FLAG_W_NO_BUILTIN_MEMCPY_CHK_SIZE])
2555 AC_GCC_WARNING_SUBST_NO([incompatible-pointer-types-discards-qualifiers], [FLAG_W_NO_INCOMPATIBLE_POINTER_TYPES_DISCARDS_QUALIFIERS])
2556 AC_GCC_WARNING_SUBST_NO([suspicious-bzero], [FLAG_W_NO_SUSPICIOUS_BZERO])
2557 AC_GCC_WARNING_SUBST_NO([attributes], [FLAG_W_NO_ATTRIBUTES])
2558 AC_GCC_WARNING_SUBST_NO([unused-result], [FLAG_W_NO_UNUSED_RESULT])
2559 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2560 AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED])
2562 AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
2564 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
2565 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
2566 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
2567 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
2568 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
2569 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2570 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2571 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2572 AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
2573 AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
2574 AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
2576 # Does this compiler support -Wformat-security ?
2577 # Special handling is needed, because certain GCC versions require -Wformat
2578 # being present if -Wformat-security is given. Otherwise a warning is issued.
2579 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2580 # And with that the warning will be turned into an error with the result
2581 # that -Wformat-security is believed to be unsupported when in fact it is.
2582 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2584 CFLAGS="-Wformat -Wformat-security -Werror"
2585 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2586 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2587 AC_MSG_RESULT([yes])], [
2588 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2589 AC_MSG_RESULT([no])])
2592 # does this compiler support -Wextra or the older -W ?
2594 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2597 CFLAGS="-Wextra -Werror"
2599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2602 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2603 AC_MSG_RESULT([-Wextra])
2606 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2609 AC_SUBST([FLAG_W_EXTRA], [-W])
2612 AC_SUBST([FLAG_W_EXTRA], [])
2613 AC_MSG_RESULT([not supported])
2618 # On ARM we do not want to pass -Wcast-align as that produces loads
2619 # of warnings. GCC is just being conservative. See here:
2620 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2621 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2622 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2624 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2627 # does this compiler support -faligned-new ?
2628 AC_MSG_CHECKING([if g++ accepts -faligned-new])
2630 safe_CXXFLAGS=$CXXFLAGS
2631 CXXFLAGS="-faligned-new -Werror"
2634 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2637 FLAG_FALIGNED_NEW="-faligned-new"
2638 AC_MSG_RESULT([yes])
2640 FLAG_FALIGNED_NEW=""
2643 CXXFLAGS=$safe_CXXFLAGS
2646 AC_SUBST(FLAG_FALIGNED_NEW)
2648 # does this compiler support -fsized-deallocation ?
2649 AC_MSG_CHECKING([if g++ accepts -fsized-deallocation])
2651 safe_CXXFLAGS=$CXXFLAGS
2652 CXXFLAGS="-fsized-deallocation -Werror"
2655 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2658 FLAG_FSIZED_DEALLOCATION="-fsized-deallocation"
2659 ac_have_sized_deallocation=yes
2660 AC_MSG_RESULT([yes])
2662 FLAG_FSIZED_DEALLOCATION=""
2663 ac_have_sized_deallocation=no
2666 CXXFLAGS=$safe_CXXFLAGS
2669 AC_SUBST(FLAG_FSIZED_DEALLOCATION)
2670 AM_CONDITIONAL([HAVE_FSIZED_DEALLOCATION], [test x$ac_have_sized_deallocation = xyes])
2672 # does this compiler support C++17 aligned new/delete?
2673 AC_MSG_CHECKING([if g++ supports aligned new and delete])
2675 safe_CXXFLAGS=$CXXFLAGS
2676 CXXFLAGS="-std=c++17"
2679 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2683 operator delete(nullptr, std::align_val_t(64U));
2685 ac_have_aligned_cxx_alloc=yes
2686 AC_MSG_RESULT([yes])
2688 ac_have_aligned_cxx_alloc=no
2691 CXXFLAGS=$safe_CXXFLAGS
2694 AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes])
2696 # does this compiler support -fno-stack-protector ?
2697 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2700 CFLAGS="-fno-stack-protector -Werror"
2702 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2705 no_stack_protector=yes
2706 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2707 AC_MSG_RESULT([yes])
2709 no_stack_protector=no
2710 FLAG_FNO_STACK_PROTECTOR=""
2715 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2717 # does this compiler support -finline-functions ?
2718 AC_MSG_CHECKING([if gcc accepts -finline-functions])
2721 CFLAGS="-finline-functions -Werror"
2723 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2726 inline_functions=yes
2727 FLAG_FINLINE_FUNCTIONS="-finline-functions"
2728 AC_MSG_RESULT([yes])
2731 FLAG_FINLINE_FUNCTIONS=""
2736 AC_SUBST(FLAG_FINLINE_FUNCTIONS)
2738 # Does GCC support disabling Identical Code Folding?
2739 # We want to disabled Identical Code Folding for the
2740 # tools preload shared objects to get better backraces.
2741 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2742 # "The optimization reduces code size and may disturb
2743 # unwind stacks by replacing a function by equivalent
2744 # one with a different name."
2745 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2748 CFLAGS="-fno-ipa-icf -Werror"
2750 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2754 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2755 AC_MSG_RESULT([yes])
2763 AC_SUBST(FLAG_FNO_IPA_ICF)
2766 # Does this compiler support -fsanitize=undefined. This is true for
2767 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2768 # also checks for alignment violations on memory accesses which the valgrind
2769 # code base is sprinkled (if not littered) with. As those alignment issues
2770 # don't pose a problem we want to suppress warnings about them.
2771 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2772 # GCCs do not support that.
2774 # Only checked for if --enable-ubsan was given.
2775 if test "x${vg_cv_ubsan}" = "xyes"; then
2776 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2778 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2782 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2783 LIB_UBSAN="-static-libubsan"
2784 AC_MSG_RESULT([yes])
2786 CFLAGS="-fsanitize=undefined -Werror"
2787 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2790 FLAG_FSANITIZE="-fsanitize=undefined"
2791 LIB_UBSAN="-static-libubsan"
2792 AC_MSG_RESULT([yes])
2800 AC_SUBST(FLAG_FSANITIZE)
2803 # does this compiler support --param inline-unit-growth=... ?
2805 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2808 CFLAGS="--param inline-unit-growth=900 -Werror"
2810 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2813 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2814 ["--param inline-unit-growth=900"])
2815 AC_MSG_RESULT([yes])
2817 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2823 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2825 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2828 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2830 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2834 AC_MSG_RESULT([yes])
2839 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2843 # does this compiler support -g -gz=zlib ?
2845 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2848 CFLAGS="-g -gz=zlib"
2850 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2854 AC_MSG_RESULT([yes])
2859 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2863 # does this compiler support -g -gz=zlib-gnu ?
2865 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2868 CFLAGS="-g -gz=zlib-gnu"
2870 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2873 ac_have_gz_zlib_gnu=yes
2874 AC_MSG_RESULT([yes])
2876 ac_have_gz_zlib_gnu=no
2879 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2883 # does this compiler support -g -gz=zstd ?
2885 AC_MSG_CHECKING([if gcc accepts -g -gz=zstd])
2888 CFLAGS="-g -gz=zstd"
2890 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2894 AC_MSG_RESULT([yes])
2899 AM_CONDITIONAL(GZ_ZSTD, test x$ac_have_gz_zstd = xyes)
2903 # does this compiler support nested functions ?
2905 AC_MSG_CHECKING([if gcc accepts nested functions])
2907 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2908 int foo() { return 1; }
2911 ac_have_nested_functions=yes
2912 AC_MSG_RESULT([yes])
2914 ac_have_nested_functions=no
2917 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2920 # does this compiler support the 'p' constraint in ASM statements ?
2922 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2924 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2926 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2928 ac_have_asm_constraint_p=yes
2929 AC_MSG_RESULT([yes])
2931 ac_have_asm_constraint_p=no
2934 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2937 # Does this compiler and linker support -pie?
2938 # Some compilers actually do not support -pie and report its usage
2939 # as an error. We need to check if it is safe to use it first.
2941 AC_MSG_CHECKING([if gcc accepts -pie])
2946 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2949 AC_SUBST([FLAG_PIE], ["-pie"])
2950 AC_MSG_RESULT([yes])
2952 AC_SUBST([FLAG_PIE], [""])
2957 AC_MSG_CHECKING([if gcc accepts -ansi])
2962 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2966 AC_MSG_RESULT([yes])
2971 AM_CONDITIONAL([HAVE_ANSI], [test x$ac_have_ansi = xyes])
2976 # Does this compiler support -no-pie?
2977 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2978 # default. However this gets in the way with some tests, we use -no-pie
2981 AC_MSG_CHECKING([if gcc accepts -no-pie])
2984 CFLAGS="-no-pie -Werror"
2986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2989 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
2990 AC_MSG_RESULT([yes])
2992 AC_SUBST([FLAG_NO_PIE], [""])
2998 # We want to use use the -Ttext-segment option to the linker.
2999 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
3000 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
3001 # semantics are NOT what we want (GNU gold -Ttext is fine).
3003 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
3004 # will reside. -Ttext aligns just the .text section start (but not any
3007 # LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes"
3008 # in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html
3009 # The --image-base option (since version 6.0?) provides the semantics needed.
3010 # -Ttext-segment generates an error, but -Ttext now more closely
3011 # follows the GNU (bfd) ld's -Ttext.
3013 # So test first for --image-base support, and if that fails then
3014 # for -Ttext-segment which is supported by all bfd ld versions
3015 # and use that if it exists. If it doesn't exist it must be an older
3016 # version of gold and we can fall back to using -Ttext which has the
3020 AC_MSG_CHECKING([if the linker accepts -Wl,--image-base])
3022 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror"
3025 [AC_LANG_SOURCE([int _start () { return 0; }])],
3027 linker_using_t_text="no"
3028 AC_SUBST([FLAG_T_TEXT], ["--image-base"])
3029 AC_MSG_RESULT([yes])
3033 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
3035 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
3038 [AC_LANG_SOURCE([int _start () { return 0; }])],
3040 linker_using_t_text="no"
3041 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
3042 AC_MSG_RESULT([yes])
3044 linker_using_t_text="yes"
3045 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
3052 # If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will
3053 # have to strip any build-id ELF NOTEs from the statically linked tools.
3054 # Otherwise the build-id NOTE might end up at the default load address.
3055 # (Pedantically if the linker is gold then -Ttext is fine, but newer
3056 # gold versions also support -Ttext-segment. So just assume that unless
3057 # we can use -Ttext-segment we need to strip the build-id NOTEs.
3058 if test "x${linker_using_t_text}" = "xyes"; then
3059 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
3060 # does the linker support -Wl,--build-id=none ? Note, it's
3061 # important that we test indirectly via whichever C compiler
3062 # is selected, rather than testing /usr/bin/ld or whatever
3064 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
3066 CFLAGS="-Wl,--build-id=none -Werror"
3069 [AC_LANG_PROGRAM([ ], [return 0;])],
3071 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
3072 AC_MSG_RESULT([yes])
3074 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3078 AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.])
3079 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3083 # On s390x, if the linker supports -Wl,--s390-pgste, then we build the
3084 # tools with that flag. This enables running programs that need it, such
3086 if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then
3087 AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste])
3089 CFLAGS="-Wl,--s390-pgste"
3092 [AC_LANG_PROGRAM([ ], [return 0;])],
3094 AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"])
3095 AC_MSG_RESULT([yes])
3097 AC_SUBST([FLAG_S390_PGSTE], [""])
3103 # does the ppc assembler support "mtocrf" et al?
3104 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
3106 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3107 __asm__ __volatile__("mtocrf 4,0");
3108 __asm__ __volatile__("mfocrf 0,4");
3110 ac_have_as_ppc_mftocrf=yes
3111 AC_MSG_RESULT([yes])
3113 ac_have_as_ppc_mftocrf=no
3116 if test x$ac_have_as_ppc_mftocrf = xyes ; then
3117 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
3121 # does the ppc assembler support "lfdp" and other phased out floating point insns?
3122 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
3124 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3125 do { typedef struct {
3129 dbl_pair_t dbl_pair[3];
3130 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
3133 ac_have_as_ppc_fpPO=yes
3134 AC_MSG_RESULT([yes])
3136 ac_have_as_ppc_fpPO=no
3139 if test x$ac_have_as_ppc_fpPO = xyes ; then
3140 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
3144 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
3145 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
3147 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3149 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
3150 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
3152 ac_have_as_amd64_fxsave64=yes
3153 AC_MSG_RESULT([yes])
3155 ac_have_as_amd64_fxsave64=no
3158 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
3159 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
3162 # does the x86/amd64 assembler understand SSE3 instructions?
3163 # Note, this doesn't generate a C-level symbol. It generates a
3164 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
3165 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
3167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3168 do { long long int x;
3169 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
3173 AC_MSG_RESULT([yes])
3179 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
3182 # Ditto for SSSE3 instructions (note extra S)
3183 # Note, this doesn't generate a C-level symbol. It generates a
3184 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
3185 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
3187 save_CFLAGS="$CFLAGS"
3188 CFLAGS="$CFLAGS -msse -Werror"
3189 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3190 do { long long int x;
3191 __asm__ __volatile__(
3192 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
3195 ac_have_as_ssse3=yes
3196 AC_MSG_RESULT([yes])
3201 CFLAGS="$save_CFLAGS"
3203 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
3206 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
3207 # Note, this doesn't generate a C-level symbol. It generates a
3208 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
3209 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
3210 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3212 __asm__ __volatile__(
3213 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
3216 ac_have_as_pclmulqdq=yes
3217 AC_MSG_RESULT([yes])
3219 ac_have_as_pclmulqdq=no
3223 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
3226 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
3227 # Note, this doesn't generate a C-level symbol. It generates a
3228 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
3229 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
3230 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3233 * Carry-less multiplication of xmm1 with xmm2 and store the result in
3234 * xmm3. The immediate is used to determine which quadwords of xmm1 and
3235 * xmm2 should be used.
3237 __asm__ __volatile__(
3238 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
3241 ac_have_as_vpclmulqdq=yes
3242 AC_MSG_RESULT([yes])
3244 ac_have_as_vpclmulqdq=no
3248 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
3251 # does the x86/amd64 assembler understand FMA4 instructions?
3252 # Note, this doesn't generate a C-level symbol. It generates a
3253 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
3254 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
3255 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3257 __asm__ __volatile__(
3258 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
3261 ac_have_as_vfmaddpd=yes
3262 AC_MSG_RESULT([yes])
3264 ac_have_as_vfmaddpd=no
3268 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
3271 # does the x86/amd64 assembler understand the LZCNT instruction?
3272 # Note, this doesn't generate a C-level symbol. It generates a
3273 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
3274 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
3276 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3278 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
3281 ac_have_as_lzcnt=yes
3282 AC_MSG_RESULT([yes])
3288 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
3291 # does the x86/amd64 assembler understand the LOOPNEL instruction?
3292 # Note, this doesn't generate a C-level symbol. It generates a
3293 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
3294 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
3296 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3298 __asm__ __volatile__("1: loopnel 1b\n");
3301 ac_have_as_loopnel=yes
3302 AC_MSG_RESULT([yes])
3304 ac_have_as_loopnel=no
3308 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
3311 # does the x86/amd64 assembler understand ADDR32 ?
3312 # Note, this doesn't generate a C-level symbol. It generates a
3313 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
3314 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
3316 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3318 asm volatile ("addr32 rep movsb");
3321 ac_have_as_addr32=yes
3322 AC_MSG_RESULT([yes])
3324 ac_have_as_addr32=no
3328 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
3331 # does the x86/amd64 assembler understand SSE 4.2 instructions?
3332 # Note, this doesn't generate a C-level symbol. It generates a
3333 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
3334 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
3336 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3337 do { long long int x;
3338 __asm__ __volatile__(
3339 "crc32q %%r15,%%r15" : : : "r15" );
3340 __asm__ __volatile__(
3341 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
3342 __asm__ __volatile__(
3343 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
3346 ac_have_as_sse42=yes
3347 AC_MSG_RESULT([yes])
3353 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
3356 # does the x86/amd64 assembler understand AVX instructions?
3357 # Note, this doesn't generate a C-level symbol. It generates a
3358 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
3359 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
3361 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3362 do { long long int x;
3363 __asm__ __volatile__(
3364 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
3365 __asm__ __volatile__(
3366 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3370 AC_MSG_RESULT([yes])
3376 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
3379 # does the x86/amd64 assembler understand AVX2 instructions?
3380 # Note, this doesn't generate a C-level symbol. It generates a
3381 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
3382 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
3384 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3385 do { long long int x;
3386 __asm__ __volatile__(
3387 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3388 __asm__ __volatile__(
3389 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3393 AC_MSG_RESULT([yes])
3399 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
3402 # does the x86/amd64 assembler understand TSX instructions and
3403 # the XACQUIRE/XRELEASE prefixes?
3404 # Note, this doesn't generate a C-level symbol. It generates a
3405 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
3406 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
3408 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3410 __asm__ __volatile__(
3413 " xacquire lock incq 0(%rsp) \n\t"
3414 " xrelease lock incq 0(%rsp) \n"
3419 AC_MSG_RESULT([yes])
3425 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
3428 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
3429 # Note, this doesn't generate a C-level symbol. It generates a
3430 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
3431 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
3433 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3434 do { unsigned int h, l;
3435 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
3436 __asm__ __volatile__(
3437 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
3438 __asm__ __volatile__(
3439 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
3443 AC_MSG_RESULT([yes])
3449 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
3452 # does the x86/amd64 assembler understand FMA instructions?
3453 # Note, this doesn't generate a C-level symbol. It generates a
3454 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
3455 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
3457 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3458 do { unsigned int h, l;
3459 __asm__ __volatile__(
3460 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3461 __asm__ __volatile__(
3462 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
3463 __asm__ __volatile__(
3464 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
3468 AC_MSG_RESULT([yes])
3474 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
3477 # does the amd64 assembler understand MPX instructions?
3478 # Note, this doesn't generate a C-level symbol. It generates a
3479 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
3480 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
3482 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3484 asm ("bndmov %bnd0,(%rsp)");
3485 asm ("bndldx 3(%rbx,%rdx), %bnd2");
3486 asm ("bnd call foo\n"
3493 AC_MSG_RESULT([yes])
3499 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
3502 # does the amd64 assembler understand ADX instructions?
3503 # Note, this doesn't generate a C-level symbol. It generates a
3504 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
3505 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
3507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3509 asm ("adcxq %r14,%r8");
3513 AC_MSG_RESULT([yes])
3519 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
3522 # does the amd64 assembler understand the RDRAND instruction?
3523 # Note, this doesn't generate a C-level symbol. It generates a
3524 # automake-level symbol (BUILD_RDRAND_TESTS), used in test Makefile.am's
3525 AC_MSG_CHECKING([if amd64 assembler knows the RDRAND instruction])
3527 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3529 asm ("rdrand %r14");
3530 asm ("rdrand %r14d");
3531 asm ("rdrand %r14w");
3534 ac_have_as_rdrand=yes
3535 AC_MSG_RESULT([yes])
3537 ac_have_as_rdrand=no
3541 AM_CONDITIONAL(BUILD_RDRAND_TESTS, test x$ac_have_as_rdrand = xyes)
3543 # does the amd64 assembler understand the RDSEED instruction?
3544 # Note, this doesn't generate a C-level symbol. It generates a
3545 # automake-level symbol (BUILD_RDSEED_TESTS), used in test Makefile.am's
3546 AC_MSG_CHECKING([if amd64 assembler knows the RDSEED instruction])
3548 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3550 asm ("rdseed %r14");
3551 asm ("rdseed %r14d");
3552 asm ("rdseed %r14w");
3555 ac_have_as_rdseed=yes
3556 AC_MSG_RESULT([yes])
3558 ac_have_as_rdseed=no
3562 AM_CONDITIONAL(BUILD_RDSEED_TESTS, test x$ac_have_as_rdseed = xyes)
3564 # does the amd64 assembler understand the F16C instructions (VCVTPH2PS and
3566 # Note, this doesn't generate a C-level symbol. It generates a
3567 # automake-level symbol (BUILD_F16C_TESTS), used in test Makefile.am's
3568 AC_MSG_CHECKING([if amd64 assembler knows the F16C instructions])
3570 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3572 asm ("vcvtph2ps %xmm5, %ymm10");
3573 // If we put the dollar sign and zero together, the shell processing
3574 // this configure.ac script substitutes the command name in. Sigh.
3575 asm ("vcvtps2ph $" "0, %ymm10, %xmm5");
3579 AC_MSG_RESULT([yes])
3585 AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes)
3588 # does the x86/amd64 assembler understand MOVBE?
3589 # Note, this doesn't generate a C-level symbol. It generates a
3590 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
3591 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
3593 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3594 do { long long int x;
3595 __asm__ __volatile__(
3596 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
3599 ac_have_as_movbe=yes
3600 AC_MSG_RESULT([yes])
3606 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
3609 # Does the C compiler support the "ifunc" attribute
3610 # Note, this doesn't generate a C-level symbol. It generates a
3611 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
3612 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
3614 AC_LINK_IFELSE([AC_LANG_SOURCE([[
3615 static void mytest(void) {}
3617 static void (*resolve_test(void))(void)
3619 return (void (*)(void))&mytest;
3622 void test(void) __attribute__((ifunc("resolve_test")));
3630 ac_have_ifunc_attr=yes
3631 AC_MSG_RESULT([yes])
3633 ac_have_ifunc_attr=no
3637 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
3639 # Does the C compiler support the armv8 crc feature flag
3640 # Note, this doesn't generate a C-level symbol. It generates a
3641 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
3642 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
3644 save_CFLAGS="$CFLAGS"
3645 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
3646 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3652 ac_have_armv8_crc_feature=yes
3653 AC_MSG_RESULT([yes])
3655 ac_have_armv8_crc_feature=no
3658 CFLAGS="$save_CFLAGS"
3660 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
3663 # Does the C compiler support the armv81 flag and the assembler v8.1 instructions
3664 # Note, this doesn't generate a C-level symbol. It generates a
3665 # automake-level symbol (BUILD_ARMV81_TESTS), used in test Makefile.am's
3666 AC_MSG_CHECKING([if gcc supports the armv81 feature flag and assembler supports v8.1 instructions])
3668 save_CFLAGS="$CFLAGS"
3669 CFLAGS="$CFLAGS -march=armv8.1-a -Werror"
3670 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3673 __asm__ __volatile__("ldadd x0, x1, [x2]" ::: "memory");
3677 ac_have_armv81_feature=yes
3678 AC_MSG_RESULT([yes])
3680 ac_have_armv81_feature=no
3683 CFLAGS="$save_CFLAGS"
3685 AM_CONDITIONAL(BUILD_ARMV81_TESTS, test x$ac_have_armv81_feature = xyes)
3688 # Does the C compiler support the armv82 flag and the assembler v8.2 instructions
3689 # Note, this doesn't generate a C-level symbol. It generates a
3690 # automake-level symbol (BUILD_ARMV82_TESTS), used in test Makefile.am's
3691 AC_MSG_CHECKING([if gcc supports the armv82 feature flag and assembler supports v8.2 instructions])
3693 save_CFLAGS="$CFLAGS"
3694 CFLAGS="$CFLAGS -march=armv8.2-a+fp16 -Werror"
3695 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3698 __asm__ __volatile__("faddp h0, v1.2h");
3702 ac_have_armv82_feature=yes
3703 AC_MSG_RESULT([yes])
3705 ac_have_armv82_feature=no
3708 CFLAGS="$save_CFLAGS"
3710 AM_CONDITIONAL(BUILD_ARMV82_TESTS, test x$ac_have_armv82_feature = xyes)
3713 # Does the C compiler support the armv82-a+dotprod flag and assembler dotprod instructions
3714 # Note, this doesn't generate a C-level symbol. It generates a
3715 # automake-level symbol (BUILD_ARMV82_DOTPROD_TESTS), used in test Makefile.am's
3716 AC_MSG_CHECKING([if gcc supports the armv82-a+dotprod feature flag and assembler supports dotprod instructions])
3718 save_CFLAGS="$CFLAGS"
3719 CFLAGS="$CFLAGS -march=armv8.2-a+dotprod -Werror"
3720 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3723 __asm__ __volatile__("sdot v1.4s, v2.16b, v3.16b");
3727 ac_have_armv82_dotprod_feature=yes
3728 AC_MSG_RESULT([yes])
3730 ac_have_armv82_dotprod_feature=no
3733 CFLAGS="$save_CFLAGS"
3735 AM_CONDITIONAL(BUILD_ARMV82_DOTPROD_TESTS, test x$ac_have_armv82_dotprod_feature = xyes)
3738 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
3739 # when building the tool executables. I think we should get rid of it.
3741 # Check for TLS support in the compiler and linker
3742 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3744 [vg_cv_linktime_tls=yes],
3745 [vg_cv_linktime_tls=no])
3746 # Native compilation: check whether running a program using TLS succeeds.
3747 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
3748 # succeeds but running programs using TLS fails.
3749 # Cross-compiling: check whether linking a program using TLS succeeds.
3750 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
3751 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
3752 [vg_cv_tls=$enableval],
3753 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3757 [vg_cv_tls=$vg_cv_linktime_tls])])])
3759 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
3760 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
3764 #----------------------------------------------------------------------------
3765 # Solaris-specific checks.
3766 #----------------------------------------------------------------------------
3768 if test "$VGCONF_OS" = "solaris" ; then
3769 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
3771 # Solaris-specific check determining if the Sun Studio Assembler is used to
3772 # build Valgrind. The test checks if the x86/amd64 assembler understands the
3773 # cmovl.l instruction, if yes then it's Sun Assembler.
3775 # C-level symbol: none
3776 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
3778 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
3779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3781 __asm__ __volatile__("cmovl.l %edx, %eax");
3783 solaris_have_sun_studio_as=yes
3784 AC_MSG_RESULT([yes])
3786 solaris_have_sun_studio_as=no
3789 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
3791 # Solaris-specific check determining if symbols __xpg4 and __xpg6
3792 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
3793 # See solaris/vgpreload-solaris.mapfile for details.
3794 # gcc on older Solaris instructs linker to include these symbols,
3795 # gcc on illumos and newer Solaris does not.
3797 # C-level symbol: none
3798 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
3800 save_CFLAGS="$CFLAGS"
3801 CFLAGS="$CFLAGS -std=gnu99"
3802 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
3803 temp_dir=$( /usr/bin/mktemp -d )
3804 cat <<_ACEOF >${temp_dir}/mylib.c
3806 int myfunc(void) { printf("LaPutyka\n"); }
3808 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
3809 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
3810 if test "x${xpg_present}" = "x" ; then
3811 solaris_xpg_symbols_present=no
3814 solaris_xpg_symbols_present=yes
3815 AC_MSG_RESULT([yes])
3818 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
3819 CFLAGS="$save_CFLAGS"
3822 # Solaris-specific check determining if gcc enables largefile support by
3823 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
3824 # variable with gcc flags which disable it.
3826 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
3827 save_CFLAGS="$CFLAGS"
3828 CFLAGS="$CFLAGS -m32"
3829 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3830 return _LARGEFILE_SOURCE;
3832 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
3833 AC_MSG_RESULT([yes])
3835 SOLARIS_UNDEF_LARGESOURCE=""
3839 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
3842 # Solaris-specific check determining if /proc/self/cmdline
3843 # or /proc/<pid>/cmdline is supported.
3845 # C-level symbol: SOLARIS_PROC_CMDLINE
3846 # Automake-level symbol: SOLARIS_PROC_CMDLINE
3848 AC_CHECK_FILE([/proc/self/cmdline],
3850 solaris_proc_cmdline=yes
3851 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
3852 [Define to 1 if you have /proc/self/cmdline.])
3854 solaris_proc_cmdline=no
3856 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3859 # Solaris-specific check determining default platform for the Valgrind launcher.
3860 # Used in case the launcher cannot select platform by looking at the client
3861 # image (for example because the executable is a shell script).
3863 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3864 # Automake-level symbol: none
3866 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3867 # Get the ELF class of /bin/sh first.
3868 if ! test -f /bin/sh; then
3869 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3871 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3872 case "$elf_class" in
3874 default_arch="$VGCONF_ARCH_PRI";
3877 if test "x$VGCONF_ARCH_SEC" != "x"; then
3878 default_arch="$VGCONF_ARCH_SEC"
3880 default_arch="$VGCONF_ARCH_PRI";
3884 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3887 default_platform="$default_arch-$VGCONF_OS"
3888 AC_MSG_RESULT([$default_platform])
3889 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3890 [Default platform for Valgrind launcher.])
3893 # Solaris-specific check determining if the old syscalls are available.
3895 # C-level symbol: SOLARIS_OLD_SYSCALLS
3896 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3898 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3899 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3900 #include <sys/syscall.h>
3904 solaris_old_syscalls=yes
3905 AC_MSG_RESULT([yes])
3906 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3907 [Define to 1 if you have the old Solaris syscalls.])
3909 solaris_old_syscalls=no
3912 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
3915 # Solaris-specific check determining if the new accept() syscall is available.
3918 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3921 # New syscall (available on illumos):
3922 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3923 # int version, int flags);
3925 # If the old syscall is present then the following syscall will fail with
3926 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
3927 # available then it will fail with EINVAL (because the flags parameter is
3930 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
3931 # Automake-level symbol: none
3933 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
3934 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3935 #include <sys/syscall.h>
3939 syscall(SYS_accept, 0, 0, 0, 0, -1);
3940 return !(errno == EINVAL);
3942 AC_MSG_RESULT([yes])
3943 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
3944 [Define to 1 if you have the new `accept' syscall.])
3950 # Solaris-specific check determining if the new illumos pipe() syscall is
3954 # longlong_t pipe();
3956 # New syscall (available on illumos):
3957 # int pipe(intptr_t arg, int flags);
3959 # If the old syscall is present then the following call will succeed, if the
3960 # new syscall is available then it will fail with EFAULT (because address 0
3961 # cannot be accessed).
3963 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
3964 # Automake-level symbol: none
3966 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
3967 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3968 #include <sys/syscall.h>
3972 syscall(SYS_pipe, 0, 0);
3973 return !(errno == EFAULT);
3975 AC_MSG_RESULT([yes])
3976 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3977 [Define to 1 if you have the new `pipe' syscall.])
3983 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
3987 # int lwp_kill(id_t lwpid, int sig);
3989 # New syscall (available on Solaris 11):
3990 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3991 # int si_code, timespec_t *timeout);
3993 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3994 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3996 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3997 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3998 #include <sys/syscall.h>
4000 return !SYS_lwp_sigqueue;
4002 solaris_lwp_sigqueue_syscall=yes
4003 AC_MSG_RESULT([yes])
4004 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
4005 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
4007 solaris_lwp_sigqueue_syscall=no
4010 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
4013 # Solaris-specific check determining if the lwp_sigqueue() syscall
4014 # takes both pid and thread id arguments or just thread id.
4016 # Old syscall (available up to Solaris 11.3):
4017 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
4018 # int si_code, timespec_t *timeout);
4020 # New syscall (available since Solaris 11.4):
4021 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
4022 # int si_code, timespec_t *timeout);
4024 # If the old syscall is present then the following syscall will fail with
4025 # EINVAL (because signal is out of range); if the new syscall is available
4026 # then it will fail with ESRCH (because it would not find such thread in the
4029 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4030 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4032 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
4033 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
4034 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4035 #include <sys/syscall.h>
4039 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
4040 return !(errno == ESRCH);
4042 solaris_lwp_sigqueue_syscall_takes_pid=yes
4043 AC_MSG_RESULT([yes])
4044 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
4045 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
4047 solaris_lwp_sigqueue_syscall_takes_pid=no
4050 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
4051 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
4053 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
4057 # Solaris-specific check determining if the new lwp_name() syscall is
4060 # New syscall (available on Solaris 11):
4061 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
4063 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
4064 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
4066 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
4067 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4068 #include <sys/syscall.h>
4070 return !SYS_lwp_name;
4072 solaris_lwp_name_syscall=yes
4073 AC_MSG_RESULT([yes])
4074 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
4075 [Define to 1 if you have the new `lwp_name' syscall.])
4077 solaris_lwp_name_syscall=no
4080 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
4083 # Solaris-specific check determining if the new getrandom() syscall is
4086 # New syscall (available on Solaris 11):
4087 # int getrandom(void *buf, size_t buflen, uint_t flags);
4089 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
4090 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
4092 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
4093 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4094 #include <sys/syscall.h>
4096 return !SYS_getrandom;
4098 solaris_getrandom_syscall=yes
4099 AC_MSG_RESULT([yes])
4100 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
4101 [Define to 1 if you have the new `getrandom' syscall.])
4103 solaris_getrandom_syscall=no
4106 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
4109 # Solaris-specific check determining if the new zone() syscall subcodes
4110 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
4111 # were added in Solaris 11 but are missing on illumos.
4113 # C-level symbol: SOLARIS_ZONE_DEFUNCT
4114 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
4116 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
4117 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4118 #include <sys/zone.h>
4120 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
4122 solaris_zone_defunct=yes
4123 AC_MSG_RESULT([yes])
4124 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
4125 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
4127 solaris_zone_defunct=no
4130 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
4133 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
4134 # for auditon(2) subcode of the auditsys() syscall are available.
4135 # These commands are available in Solaris 11 and illumos but were removed
4138 # C-level symbol: SOLARIS_AUDITON_STAT
4139 # Automake-level symbol: SOLARIS_AUDITON_STAT
4141 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
4142 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4143 #include <bsm/audit.h>
4145 return !(A_GETSTAT && A_SETSTAT);
4147 solaris_auditon_stat=yes
4148 AC_MSG_RESULT([yes])
4149 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
4150 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
4152 solaris_auditon_stat=no
4155 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
4158 # Solaris-specific check determining if the new shmsys() syscall subcodes
4159 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
4160 # These subcodes were added in Solaris 11 but are missing on illumos.
4162 # C-level symbol: SOLARIS_SHM_NEW
4163 # Automake-level symbol: SOLARIS_SHM_NEW
4165 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
4166 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4167 #include <sys/ipc_impl.h>
4168 #include <sys/shm.h>
4169 #include <sys/shm_impl.h>
4171 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
4174 AC_MSG_RESULT([yes])
4175 AC_DEFINE([SOLARIS_SHM_NEW], 1,
4176 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
4181 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
4184 # Solaris-specific check determining if prxregset_t is available. Illumos
4185 # currently does not define it on the x86 platform.
4187 # C-level symbol: SOLARIS_PRXREGSET_T
4188 # Automake-level symbol: SOLARIS_PRXREGSET_T
4190 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
4191 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4192 #include <sys/procfs_isa.h>
4194 return !sizeof(prxregset_t);
4196 solaris_prxregset_t=yes
4197 AC_MSG_RESULT([yes])
4198 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
4199 [Define to 1 if you have the `prxregset_t' type.])
4201 solaris_prxregset_t=no
4204 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
4207 # Solaris-specific check determining if the new frealpathat() syscall is
4210 # New syscall (available on Solaris 11.1):
4211 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
4213 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4214 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4216 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
4217 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4218 #include <sys/syscall.h>
4220 return !SYS_frealpathat;
4222 solaris_frealpathat_syscall=yes
4223 AC_MSG_RESULT([yes])
4224 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
4225 [Define to 1 if you have the new `frealpathat' syscall.])
4227 solaris_frealpathat_syscall=no
4230 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
4233 # Solaris-specific check determining if the new uuidsys() syscall is
4236 # New syscall (available on newer Solaris):
4237 # int uuidsys(struct uuid *uuid);
4239 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
4240 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
4242 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
4243 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4244 #include <sys/syscall.h>
4246 return !SYS_uuidsys;
4248 solaris_uuidsys_syscall=yes
4249 AC_MSG_RESULT([yes])
4250 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
4251 [Define to 1 if you have the new `uuidsys' syscall.])
4253 solaris_uuidsys_syscall=no
4256 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
4259 # Solaris-specific check determining if the new labelsys() syscall subcode
4260 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
4261 # missing on illumos.
4263 # C-level symbol: SOLARIS_TNDB_GET_TNIP
4264 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
4266 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
4267 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4268 #include <sys/tsol/tndb.h>
4270 return !TNDB_GET_TNIP;
4272 solaris_tndb_get_tnip=yes
4273 AC_MSG_RESULT([yes])
4274 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
4275 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
4277 solaris_tndb_get_tnip=no
4280 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
4283 # Solaris-specific check determining if the new labelsys() syscall opcodes
4284 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
4285 # added in Solaris 11 but are missing on illumos.
4287 # C-level symbol: SOLARIS_TSOL_CLEARANCE
4288 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
4290 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
4291 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4292 #include <sys/tsol/tsyscall.h>
4294 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
4296 solaris_tsol_clearance=yes
4297 AC_MSG_RESULT([yes])
4298 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
4299 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
4301 solaris_tsol_clearance=no
4304 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
4307 # Solaris-specific check determining if the new pset() syscall subcode
4308 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
4309 # is missing on illumos and Solaris 11.3.
4311 # C-level symbol: SOLARIS_PSET_GET_NAME
4312 # Automake-level symbol: SOLARIS_PSET_GET_NAME
4314 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
4315 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4316 #include <sys/pset.h>
4318 return !(PSET_GET_NAME);
4320 solaris_pset_get_name=yes
4321 AC_MSG_RESULT([yes])
4322 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
4323 [Define to 1 if you have the `PSET_GET_NAME' constants.])
4325 solaris_pset_get_name=no
4328 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
4331 # Solaris-specific check determining if the utimesys() syscall is
4332 # available (on illumos and older Solaris).
4334 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
4335 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
4337 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
4338 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4339 #include <sys/syscall.h>
4341 return !SYS_utimesys;
4343 solaris_utimesys_syscall=yes
4344 AC_MSG_RESULT([yes])
4345 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
4346 [Define to 1 if you have the `utimesys' syscall.])
4348 solaris_utimesys_syscall=no
4351 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
4354 # Solaris-specific check determining if the utimensat() syscall is
4355 # available (on newer Solaris).
4357 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4358 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4360 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
4361 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4362 #include <sys/syscall.h>
4364 return !SYS_utimensat;
4366 solaris_utimensat_syscall=yes
4367 AC_MSG_RESULT([yes])
4368 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
4369 [Define to 1 if you have the `utimensat' syscall.])
4371 solaris_utimensat_syscall=no
4374 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
4377 # Solaris-specific check determining if the spawn() syscall is available
4378 # (on newer Solaris).
4380 # C-level symbol: SOLARIS_SPAWN_SYSCALL
4381 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
4383 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
4384 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4385 #include <sys/syscall.h>
4389 solaris_spawn_syscall=yes
4390 AC_MSG_RESULT([yes])
4391 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
4392 [Define to 1 if you have the `spawn' syscall.])
4394 solaris_spawn_syscall=no
4397 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
4400 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
4401 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
4403 # C-level symbol: SOLARIS_MODCTL_MODNVL
4404 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
4406 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
4407 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4408 #include <sys/modctl.h>
4410 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
4412 solaris_modctl_modnvl=yes
4413 AC_MSG_RESULT([yes])
4414 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
4415 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
4417 solaris_modctl_modnvl=no
4420 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
4423 # Solaris-specific check determining whether nscd (name switch cache daemon)
4424 # attaches its door at /system/volatile/name_service_door (Solaris)
4425 # or at /var/run/name_service_door (illumos).
4427 # Note that /var/run is a symlink to /system/volatile on Solaris
4428 # but not vice versa on illumos.
4430 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4431 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4433 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
4434 if test -e /system/volatile/name_service_door; then
4435 solaris_nscd_door_system_volatile=yes
4436 AC_MSG_RESULT([/system/volatile/name_service_door])
4437 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
4438 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
4440 solaris_nscd_door_system_volatile=no
4441 AC_MSG_RESULT([/var/run/name_service_door])
4443 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
4446 # Solaris-specific check determining if the new gethrt() fasttrap is available.
4448 # New fasttrap (available on Solaris 11):
4449 # hrt_t *gethrt(void);
4451 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
4452 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
4454 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
4455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4456 #include <sys/trap.h>
4460 solaris_gethrt_fasttrap=yes
4461 AC_MSG_RESULT([yes])
4462 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
4463 [Define to 1 if you have the new `gethrt' fasttrap.])
4465 solaris_gethrt_fasttrap=no
4468 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
4471 # Solaris-specific check determining if the new get_zone_offset() fasttrap
4474 # New fasttrap (available on Solaris 11):
4475 # zonehrtoffset_t *get_zone_offset(void);
4477 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4478 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4480 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
4481 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4482 #include <sys/trap.h>
4484 return !T_GETZONEOFFSET;
4486 solaris_getzoneoffset_fasttrap=yes
4487 AC_MSG_RESULT([yes])
4488 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
4489 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
4491 solaris_getzoneoffset_fasttrap=no
4494 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
4497 # Solaris-specific check determining if the execve() syscall
4498 # takes fourth argument (flags) or not.
4500 # Old syscall (available on illumos):
4501 # int execve(const char *fname, const char **argv, const char **envp);
4503 # New syscall (available on Solaris):
4504 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
4506 # If the new syscall is present then it will fail with EINVAL (because flags
4507 # are invalid); if the old syscall is available then it will fail with ENOENT
4508 # (because the file could not be found).
4510 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4511 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4513 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
4514 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4515 #include <sys/syscall.h>
4519 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
4520 return !(errno == EINVAL);
4522 solaris_execve_syscall_takes_flags=yes
4523 AC_MSG_RESULT([yes])
4524 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
4525 [Define to 1 if you have the new `execve' syscall which accepts flags.])
4527 solaris_execve_syscall_takes_flags=no
4530 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
4531 test x$solaris_execve_syscall_takes_flags = xyes)
4534 # Solaris-specific check determining version of the repository cache protocol.
4535 # Every Solaris version uses a different one, ranging from 21 to current 25.
4536 # The check is very ugly, though.
4538 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
4539 # Automake-level symbol: none
4541 AC_PATH_PROG(DIS_PATH, dis, false)
4542 if test "x$DIS_PATH" = "xfalse"; then
4543 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
4545 # The illumos source is (or was) here
4546 # https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libscf/common/lowlevel.c#L1148
4547 # specifically the line
4549 # request.rdr_version = REPOSITORY_DOOR_VERSION;
4551 # rdr_version is a 32bit unsigned int
4552 # The macro REPOSITORY_DOOR_VERSION contains the ascii letters "Rep" in the top 3
4553 # bytes and the door version in the lowest byte. Hence we look for Rep which is 526570
4554 # in hex and then extrace the following byte.
4555 AC_CHECK_LIB(scf, scf_handle_bind, [], [
4556 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
4557 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4560 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
4561 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
4562 libscf=/usr/lib/64/libscf.so.1
4564 libscf=/usr/lib/libscf.so.1
4566 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q -E '0x(4d01)?526570'; then
4567 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
4568 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4570 hex=$( $DIS_PATH -F scf_handle_bind $libscf | grep 526570 | sed 's/.*526570//;s/,.*//' )
4571 if test -z "$hex"; then
4572 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
4573 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4575 version=$( printf "%d\n" 0x$hex )
4576 AC_MSG_RESULT([$version])
4577 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
4578 [Version number of the repository door cache protocol.])
4581 # Solaris-specific check determining if "sysstat" segment reservation type
4584 # New "sysstat" segment reservation (available on Solaris 11.4):
4585 # - program header type: PT_SUNW_SYSSTAT
4586 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
4588 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4589 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4591 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
4592 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4593 #include <sys/auxv.h>
4595 return !AT_SUN_SYSSTAT_ADDR;
4597 solaris_reserve_sysstat_addr=yes
4598 AC_MSG_RESULT([yes])
4599 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
4600 [Define to 1 if you have the new `sysstat' segment reservation.])
4602 solaris_reserve_sysstat_addr=no
4605 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
4608 # Solaris-specific check determining if "sysstat_zone" segment reservation type
4611 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
4612 # - program header type: PT_SUNW_SYSSTAT_ZONE
4613 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
4615 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4616 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4618 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
4619 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4620 #include <sys/auxv.h>
4622 return !AT_SUN_SYSSTAT_ZONE_ADDR;
4624 solaris_reserve_sysstat_zone_addr=yes
4625 AC_MSG_RESULT([yes])
4626 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
4627 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
4629 solaris_reserve_sysstat_zone_addr=no
4632 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
4635 # Solaris-specific check determining if the system_stats() syscall is available
4636 # (on newer Solaris).
4638 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4639 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4641 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
4642 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4643 #include <sys/syscall.h>
4645 return !SYS_system_stats;
4647 solaris_system_stats_syscall=yes
4648 AC_MSG_RESULT([yes])
4649 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
4650 [Define to 1 if you have the `system_stats' syscall.])
4652 solaris_system_stats_syscall=no
4655 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
4658 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
4659 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
4661 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
4662 # Automake-level symbol: none
4664 AC_CHECK_TYPE([struct _fpchip_state],
4665 [solaris_fpchip_state_takes_underscore=yes],
4666 [solaris_fpchip_state_takes_underscore=no],
4667 [[#include <sys/regset.h>]])
4668 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
4669 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
4670 [Define to 1 if fpregset_t defines struct _fpchip_state])
4674 # Solaris-specific check determining if schedctl page shared between kernel
4675 # and userspace program is executable (illumos, older Solaris) or not (newer
4678 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
4679 # Automake-level symbol: none
4681 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
4682 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4686 #include <schedctl.h>
4690 schedctl_t *scp = schedctl_init();
4694 int fd = open("/proc/self/map", O_RDONLY);
4699 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
4700 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
4701 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
4702 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
4703 return (map.pr_mflags & MA_EXEC);
4709 solaris_schedctl_page_exec=no
4712 solaris_schedctl_page_exec=yes
4713 AC_MSG_RESULT([yes])
4714 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
4715 [Define to 1 if you have the schedctl page executable.])
4719 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
4720 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
4721 # an initial thread pointer for libc (newer Solaris).
4723 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
4724 # Automake-level symbol: none
4726 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
4727 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4728 #include <sys/fasttrap_isa.h>
4730 return !FT_SCRATCHSIZE;
4732 solaris_pt_sunwdtrace_thrp=yes
4733 AC_MSG_RESULT([yes])
4734 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
4735 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
4737 solaris_pt_sunwdtrace_thrp=no
4742 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
4743 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
4744 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
4745 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
4746 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
4747 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
4748 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
4749 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
4750 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
4751 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
4752 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
4753 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
4754 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
4755 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
4756 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
4757 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
4758 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
4759 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
4760 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
4761 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
4762 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
4763 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
4764 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
4765 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
4766 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
4767 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
4768 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
4769 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
4770 fi # test "$VGCONF_OS" = "solaris"
4772 #----------------------------------------------------------------------------
4773 # FreeBSD-specific checks.
4774 #----------------------------------------------------------------------------
4776 # Rather than having a large number of feature test as above with Solaris
4777 # these tests are per-version. This may not be entirely reliable for
4778 # FreeBSD development branches (XX.Y-CURRENT) or pre-release branches
4779 # (XX.Y-STABLE) but it should work for XX-Y-RELEASE
4781 if test "$VGCONF_OS" = "freebsd" ; then
4787 AM_CONDITIONAL([FREEBSD_EVENTFD],
4788 [test x$ac_cv_func_eventfd = xyes])
4790 AC_MSG_CHECKING([for the SYS___realpathat syscall (FreeBSD-specific)])
4791 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4792 #include <sys/syscall.h>
4794 return !SYS___realpathat;
4796 freebsd_realpathat_syscall=yes
4797 AC_MSG_RESULT([yes])
4798 AC_DEFINE([FREEBSD_REALPATHAT_SYSCALL], 1,
4799 [Define to 1 if you have the new SYS___realpathat syscall.])
4801 freebsd_realpathat_syscall=no
4804 AM_CONDITIONAL(FREEBSD_REALPATHAT_SYSCALL, test x$freebsd_realpathat_syscall = xyes)
4806 AC_MSG_CHECKING([for the SYS_kqueuex syscall (FreeBSD-specific)])
4807 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4808 #include <sys/syscall.h>
4810 return !SYS_kqueuex;
4812 freebsd_kqueuex_syscall=yes
4813 AC_MSG_RESULT([yes])
4814 AC_DEFINE([FREEBSD_KQUEUEX_SYSCALL], 1,
4815 [Define to 1 if you have the new SYS___realpathat syscall.])
4817 freebsd_kqueuex_syscall=no
4820 AM_CONDITIONAL(FREEBSD_KQUEUEX_SYSCALL, test x$freebsd_kqueuex_syscall = xyes)
4822 AC_MSG_CHECKING([for the SYS_timerfd_create syscall (FreeBSD-specific)])
4823 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4824 #include <sys/syscall.h>
4826 return !SYS_timerfd_create;
4828 freebsd_timerfd_syscall=yes
4829 AC_MSG_RESULT([yes])
4830 AC_DEFINE([FREEBSD_TIMERFD_SYSCALL], 1,
4831 [Define to 1 if you have the new SYS_timer_fd_create syscall.])
4833 freebsd_timerfd_syscall=no
4836 AM_CONDITIONAL(FREEBSD_TIMERFD_SYSCALL, test x$freebsd_timerfd_syscall = xyes)
4840 AM_CONDITIONAL(FREEBSD_EVENTFD, false)
4841 AM_CONDITIONAL(FREEBSD_REALPATHAT_SYSCALL, false)
4842 AM_CONDITIONAL(FREEBSD_KQUEUEX_SYSCALL, false)
4843 AM_CONDITIONAL(FREEBSD_TIMERFD_SYSCALL, false)
4845 fi # test "$VGCONF_OS" = "freebsd"
4848 #----------------------------------------------------------------------------
4849 # Checks for C header files.
4850 #----------------------------------------------------------------------------
4852 AC_CHECK_HEADERS([ \
4870 # Verify whether the <linux/futex.h> header is usable.
4871 AC_MSG_CHECKING([if <linux/futex.h> is usable])
4873 save_CFLAGS="$CFLAGS"
4874 CFLAGS="$CFLAGS -D__user="
4875 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4876 #include <linux/futex.h>
4880 ac_have_usable_linux_futex_h=yes
4881 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
4882 [Define to 1 if you have a usable <linux/futex.h> header file.])
4883 AC_MSG_RESULT([yes])
4885 ac_have_usable_linux_futex_h=no
4888 CFLAGS="$save_CFLAGS"
4891 #----------------------------------------------------------------------------
4892 # Checks for typedefs, structures, and compiler characteristics.
4893 #----------------------------------------------------------------------------
4897 AC_CHECK_HEADERS_ONCE([sys/time.h])
4899 AC_CHECK_TYPE([struct statx], [
4900 AC_DEFINE([HAVE_STRUCT_STATX_IN_SYS_STAT_H], 1,
4901 [Define to 1 if <sys/stat.h> declares struct statx.])
4904 #include <sys/stat.h>
4908 #----------------------------------------------------------------------------
4909 # Checks for library functions.
4910 #----------------------------------------------------------------------------
4914 AC_CHECK_LIB([pthread], [pthread_create])
4915 AC_CHECK_LIB([rt], [clock_gettime])
4937 pthread_barrier_init \
4938 pthread_condattr_setclock \
4939 pthread_mutex_timedlock \
4940 pthread_rwlock_timedrdlock \
4941 pthread_rwlock_timedwrlock \
4942 pthread_setname_np \
4971 free_aligned_sized \
4982 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
4983 # libraries with any shared object and/or executable. This is NOT what we
4984 # want for e.g. vgpreload_core-x86-linux.so
4987 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
4988 [test x$ac_cv_func_pthread_barrier_init = xyes])
4989 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
4990 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
4991 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
4992 [test x$ac_cv_func_pthread_spin_lock = xyes])
4993 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
4994 [test x$ac_cv_func_pthread_setname_np = xyes])
4995 AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
4996 [test x$ac_cv_func_copy_file_range = xyes])
4997 AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
4998 [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
4999 AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
5000 [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes])
5001 AM_CONDITIONAL([HAVE_SETCONTEXT], [test x$ac_cv_func_setcontext = xyes])
5002 AM_CONDITIONAL([HAVE_SWAPCONTEXT], [test x$ac_cv_func_swapcontext = xyes])
5003 AM_CONDITIONAL([HAVE_MEMFD_CREATE],
5004 [test x$ac_cv_func_memfd_create = xyes])
5005 AM_CONDITIONAL([HAVE_GETADDRINFO],
5006 [test x$ac_cv_func_getaddrinfo = xyes])
5007 AM_CONDITIONAL([HAVE_CLOSE_RANGE],
5008 [test x$ac_cv_func_close_range = xyes])
5009 AM_CONDITIONAL([HAVE_REALLOCARRAY],
5010 [test x$ac_cv_func_reallocarray = xyes])
5011 AM_CONDITIONAL([HAVE_WCSNCPY],
5012 [test x$ac_cv_func_wcsncpy = xyes])
5013 AM_CONDITIONAL([HAVE_STRLCAT],
5014 [test x$ac_cv_func_strlcat = xyes])
5015 AM_CONDITIONAL([HAVE_STRLCPY],
5016 [test x$ac_cv_func_strlcpy = xyes])
5017 AM_CONDITIONAL([HAVE_FREE_ALIGNED_SIZED],
5018 [test x$ac_cv_func_free_aligned_sized = xyes])
5019 AM_CONDITIONAL([HAVE_SBRK],
5020 [test x$ac_cv_func_sbrk = xyes])
5021 AM_CONDITIONAL([HAVE_WCPNCPY],
5022 [test x$ac_cv_func_wcpncpy = xyes])
5023 AM_CONDITIONAL([HAVE_WCSXFRM],
5024 [test x$ac_cv_func_wcsxfrm = xyes])
5025 AM_CONDITIONAL([HAVE_SEM_TIMEDWAIT],
5026 [test x$ac_cv_func_sem_timedwait = xyes])
5027 AM_CONDITIONAL([HAVE_SEM_CLOCKWAIT_NP],
5028 [test x$ac_cv_func_sem_clockwait_np = xyes])
5029 AM_CONDITIONAL([HAVE_FDATASYNC],
5030 [test x$ac_cv_func_fdatasync = xyes])
5031 AM_CONDITIONAL([HAVE_GETRANDOM],
5032 [test x$ac_cv_func_getrandom = xyes])
5033 AM_CONDITIONAL([HAVE_GETRLIMITUSAGE],
5034 [test x$ac_cv_func_getrlimitusage = xyes])
5036 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5037 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5038 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX; then
5039 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
5040 [Disable intercept pthread_spin_lock() on MIPS32, MIPS64 and nanoMIPS.])
5043 #----------------------------------------------------------------------------
5045 #----------------------------------------------------------------------------
5046 # Do we have a useable MPI setup on the primary and/or secondary targets?
5047 # On Linux, by default, assumes mpicc and -m32/-m64
5048 # Note: this is a kludge in that it assumes the specified mpicc
5049 # understands -m32/-m64 regardless of what is specified using
5051 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
5052 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
5055 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
5056 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
5057 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
5058 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
5059 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5060 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX \
5061 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
5062 mflag_primary=$FLAG_M32
5063 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
5064 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
5065 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
5066 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
5067 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD \
5068 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5069 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
5070 mflag_primary=$FLAG_M64
5071 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
5072 mflag_primary="$FLAG_M32 -arch i386"
5073 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
5074 mflag_primary="$FLAG_M64 -arch x86_64"
5078 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
5079 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
5080 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
5081 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX \
5082 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD ; then
5083 mflag_secondary=$FLAG_M32
5084 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
5085 mflag_secondary="$FLAG_M32 -arch i386"
5090 [ --with-mpicc= Specify name of MPI2-ised C compiler],
5095 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
5096 ## use these values in the check for a functioning mpicc.
5098 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
5099 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
5100 AM_COND_IF([VGCONF_OS_IS_LINUX],
5101 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5102 LDFLAGS_MPI="-fpic -shared"])
5103 AM_COND_IF([VGCONF_OS_IS_FREEBSD],
5104 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5105 LDFLAGS_MPI="-fpic -shared"])
5106 AM_COND_IF([VGCONF_OS_IS_DARWIN],
5107 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
5108 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
5109 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
5110 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5111 LDFLAGS_MPI="-fpic -shared"])
5113 AC_SUBST([CFLAGS_MPI])
5114 AC_SUBST([LDFLAGS_MPI])
5117 ## See if MPI_CC works for the primary target
5119 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
5121 saved_CFLAGS=$CFLAGS
5123 CFLAGS="$CFLAGS_MPI $mflag_primary"
5124 saved_LDFLAGS="$LDFLAGS"
5125 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
5126 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5130 int ni, na, nd, comb;
5131 int r = MPI_Init(NULL,NULL);
5132 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5133 r |= MPI_Finalize();
5136 ac_have_mpi2_pri=yes
5137 AC_MSG_RESULT([yes, $MPI_CC])
5143 CFLAGS=$saved_CFLAGS
5144 LDFLAGS="$saved_LDFLAGS"
5145 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
5147 ## See if MPI_CC works for the secondary target. Complication: what if
5148 ## there is no secondary target? We need this to then fail.
5149 ## Kludge this by making MPI_CC something which will surely fail in
5152 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
5154 saved_CFLAGS=$CFLAGS
5155 saved_LDFLAGS="$LDFLAGS"
5156 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
5157 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
5158 CC="$MPI_CC this will surely fail"
5162 CFLAGS="$CFLAGS_MPI $mflag_secondary"
5163 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5167 int ni, na, nd, comb;
5168 int r = MPI_Init(NULL,NULL);
5169 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5170 r |= MPI_Finalize();
5173 ac_have_mpi2_sec=yes
5174 AC_MSG_RESULT([yes, $MPI_CC])
5180 CFLAGS=$saved_CFLAGS
5181 LDFLAGS="$saved_LDFLAGS"
5182 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
5184 #----------------------------------------------------------------------------
5186 #----------------------------------------------------------------------------
5187 AC_MSG_CHECKING([if static libc is available])
5189 saved_LDFLAGS="$LDFLAGS"
5190 LDFLAGS="-nostdlib -lc -static"
5191 AC_LINK_IFELSE([AC_LANG_SOURCE([[
5196 ac_have_static_libc=yes
5197 AC_MSG_RESULT([yes])
5199 ac_have_static_libc=no
5202 LDFLAGS="$saved_LDFLAGS"
5203 AM_CONDITIONAL(HAVE_STATIC_LIBC, test x$ac_have_static_libc = xyes)
5206 #----------------------------------------------------------------------------
5207 # Other library checks
5208 #----------------------------------------------------------------------------
5209 # There now follow some tests for Boost, and OpenMP. These
5210 # tests are present because Drd has some regression tests that use
5211 # these packages. All regression test programs all compiled only
5212 # for the primary target. And so it is important that the configure
5213 # checks that follow, use the correct -m32 or -m64 flag for the
5214 # primary target (called $mflag_primary). Otherwise, we can end up
5215 # in a situation (eg) where, on amd64-linux, the test for Boost checks
5216 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
5217 # only build (meaning, the primary target is x86-linux), the build
5218 # of the regtest programs that use Boost fails, because they are
5219 # build as 32-bit (IN THIS EXAMPLE).
5221 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
5222 # NEEDED BY THE REGRESSION TEST PROGRAMS.
5225 # Check whether the boost library 1.35 or later has been installed.
5226 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
5228 AC_MSG_CHECKING([for boost])
5231 safe_CXXFLAGS=$CXXFLAGS
5232 CXXFLAGS="$mflag_primary"
5234 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
5236 AC_LINK_IFELSE([AC_LANG_SOURCE([
5237 #include <boost/thread.hpp>
5238 static void thread_func(void)
5240 int main(int argc, char** argv)
5242 boost::thread t(thread_func);
5247 ac_have_boost_1_35=yes
5248 AC_SUBST([BOOST_CFLAGS], [])
5249 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
5250 AC_MSG_RESULT([yes])
5252 ac_have_boost_1_35=no
5257 CXXFLAGS=$safe_CXXFLAGS
5260 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
5263 # does this compiler support -fopenmp, does it have the include file
5264 # <omp.h> and does it have libgomp ?
5266 AC_MSG_CHECKING([for OpenMP])
5269 CFLAGS="-fopenmp $mflag_primary -Werror"
5271 AC_LINK_IFELSE([AC_LANG_SOURCE([
5273 int main(int argc, char** argv)
5281 AC_MSG_RESULT([yes])
5288 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
5291 # Check for __builtin_popcount
5292 AC_MSG_CHECKING([for __builtin_popcount()])
5293 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5295 __builtin_popcount(2);
5298 AC_MSG_RESULT([yes])
5299 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
5300 [Define to 1 if compiler provides __builtin_popcount().])
5305 # Check for __builtin_clz
5306 AC_MSG_CHECKING([for __builtin_clz()])
5307 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5312 AC_MSG_RESULT([yes])
5313 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
5314 [Define to 1 if compiler provides __builtin_clz().])
5319 # Check for __builtin_ctz
5320 AC_MSG_CHECKING([for __builtin_ctz()])
5321 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5326 AC_MSG_RESULT([yes])
5327 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
5328 [Define to 1 if compiler provides __builtin_ctz().])
5333 # does this compiler have built-in functions for atomic memory access for the
5335 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
5338 CFLAGS="$mflag_primary"
5340 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5342 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5343 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5345 ac_have_builtin_atomic_primary=yes
5346 AC_MSG_RESULT([yes])
5347 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])
5349 ac_have_builtin_atomic_primary=no
5355 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
5356 [test x$ac_have_builtin_atomic_primary = xyes])
5359 # does this compiler have built-in functions for atomic memory access for the
5360 # secondary target ?
5362 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5364 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
5367 CFLAGS="$mflag_secondary"
5369 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5371 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
5373 ac_have_builtin_atomic_secondary=yes
5374 AC_MSG_RESULT([yes])
5376 ac_have_builtin_atomic_secondary=no
5384 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
5385 [test x$ac_have_builtin_atomic_secondary = xyes])
5387 # does this compiler have built-in functions for atomic memory access on
5388 # 64-bit integers for all targets ?
5390 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
5392 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5395 uint64_t variable = 1;
5396 return __sync_add_and_fetch(&variable, 1)
5398 ac_have_builtin_atomic64_primary=yes
5400 ac_have_builtin_atomic64_primary=no
5403 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5406 CFLAGS="$mflag_secondary"
5408 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5411 uint64_t variable = 1;
5412 return __sync_add_and_fetch(&variable, 1)
5414 ac_have_builtin_atomic64_secondary=yes
5416 ac_have_builtin_atomic64_secondary=no
5423 if test x$ac_have_builtin_atomic64_primary = xyes && \
5424 test x$VGCONF_PLATFORM_SEC_CAPS = x \
5425 -o x$ac_have_builtin_atomic64_secondary = xyes; then
5426 AC_MSG_RESULT([yes])
5427 ac_have_builtin_atomic64=yes
5430 ac_have_builtin_atomic64=no
5433 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
5434 [test x$ac_have_builtin_atomic64 = xyes])
5437 AC_MSG_CHECKING([if platform has openat2 syscall])
5439 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5440 #include <sys/syscall.h>
5445 AC_MSG_RESULT([yes])
5451 AM_CONDITIONAL([HAVE_OPENAT2],
5452 [test x$ac_have_openat2 = xyes])
5458 AC_MSG_CHECKING([if platform has openssl crypto])
5460 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5461 #include <openssl/crypto.h>
5463 CRYPTO_secure_malloc_init(1<<20, 8);
5466 AC_MSG_RESULT([yes])
5473 AM_CONDITIONAL([HAVE_OPENSSL],
5474 [test x$ac_have_openssl = xyes])
5476 AC_MSG_CHECKING([if platform has aio_readv])
5478 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5484 ac_have_aio_readv=yes
5485 AC_MSG_RESULT([yes])
5488 ac_have_aio_readv=no
5492 AM_CONDITIONAL([HAVE_AIO_READV],
5493 [test x$ac_have_aio_readv = xyes])
5495 # does g++ have built-in functions for atomic memory access ?
5496 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
5498 safe_CXXFLAGS=$CXXFLAGS
5499 CXXFLAGS="$mflag_primary"
5502 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5504 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5505 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5507 ac_have_builtin_atomic_cxx=yes
5508 AC_MSG_RESULT([yes])
5509 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
5511 ac_have_builtin_atomic_cxx=no
5516 CXXFLAGS=$safe_CXXFLAGS
5518 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
5521 if test x$ac_have_usable_linux_futex_h = xyes \
5522 -a x$ac_have_builtin_atomic_primary = xyes; then
5523 ac_enable_linux_ticket_lock_primary=yes
5525 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
5526 [test x$ac_enable_linux_ticket_lock_primary = xyes])
5528 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
5529 -a x$ac_have_usable_linux_futex_h = xyes \
5530 -a x$ac_have_builtin_atomic_secondary = xyes; then
5531 ac_enable_linux_ticket_lock_secondary=yes
5533 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
5534 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
5537 # does libstdc++ support annotating shared pointers ?
5538 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
5540 safe_CXXFLAGS=$CXXFLAGS
5541 CXXFLAGS="-std=c++0x"
5544 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5547 std::shared_ptr<int> p
5549 ac_have_shared_ptr=yes
5551 ac_have_shared_ptr=no
5553 if test x$ac_have_shared_ptr = xyes; then
5554 # If compilation of the program below fails because of a syntax error
5555 # triggered by substituting one of the annotation macros then that
5556 # means that libstdc++ supports these macros.
5557 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5558 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
5559 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
5562 std::shared_ptr<int> p
5564 ac_have_shared_pointer_annotation=no
5567 ac_have_shared_pointer_annotation=yes
5568 AC_MSG_RESULT([yes])
5569 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
5570 [Define to 1 if libstd++ supports annotating shared pointers])
5573 ac_have_shared_pointer_annotation=no
5578 CXXFLAGS=$safe_CXXFLAGS
5580 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
5581 [test x$ac_have_shared_pointer_annotation = xyes])
5583 # checking for GNU libc C17 aligned_alloc
5584 # just check glibc version rather than trying to muck around
5585 # checking the runtime behaviour or seeing if it is a weak alias
5586 AC_MSG_CHECKING([for AT_GNU_LIBC_C17_ALIGNED_ALLOC])
5587 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5588 #include <features.h>
5590 #if !defined(__GLIBC__) || __GLIBC__ != 2 || !defined(__GLIBC_MINOR__) || __GLIBC_MINOR__ < 38
5591 #error "not GNU libc 2.38 or later"
5594 AC_MSG_RESULT([yes])
5595 AC_DEFINE([HAVE_GNU_LIBC_C17_ALIGNED_ALLOC], 1,
5596 [Define to 1 if you have GNU libc C17 aligned_alloc.])
5602 # Check for C11 thrd_create()
5603 AC_MSG_CHECKING([for thrd_create()])
5604 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
5605 #include <threads.h>
5606 int thrd_entry(void *arg) { return 0; }
5607 ], [[thrd_t thr; return thrd_create(&thr, thrd_entry, NULL);]])],
5609 ac_cxx_have_thrd_create=yes
5610 AC_MSG_RESULT([yes])
5612 ac_cxx_have_thrd_create=no
5616 AM_CONDITIONAL(HAVE_THRD_CREATE, test x$ac_cxx_have_thrd_create = xyes)
5621 CFLAGS="${CFLAGS} -march=armv8.2-a+sha3"
5622 AC_MSG_CHECKING([for sha3])
5623 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
5628 AC_MSG_RESULT([yes])
5634 AM_CONDITIONAL(HAVE_SHA3, test x$ac_have_sha3 = xyes)
5637 #----------------------------------------------------------------------------
5638 # Ok. We're done checking.
5639 #----------------------------------------------------------------------------
5641 # Nb: VEX/Makefile is generated from Makefile.vex.in.
5644 VEX/Makefile:Makefile.vex.in
5648 glibc-2.X-helgrind.supp
5652 docs/xml/vg-entities.xml
5657 gdbserver_tests/Makefile
5658 gdbserver_tests/solaris/Makefile
5664 memcheck/tests/Makefile
5665 memcheck/tests/common/Makefile
5666 memcheck/tests/amd64/Makefile
5667 memcheck/tests/arm64/Makefile
5668 memcheck/tests/x86/Makefile
5669 memcheck/tests/linux/Makefile
5670 memcheck/tests/linux/debuginfod-check.vgtest
5671 memcheck/tests/darwin/Makefile
5672 memcheck/tests/solaris/Makefile
5673 memcheck/tests/freebsd/Makefile
5674 memcheck/tests/amd64-linux/Makefile
5675 memcheck/tests/arm64-linux/Makefile
5676 memcheck/tests/x86-linux/Makefile
5677 memcheck/tests/amd64-solaris/Makefile
5678 memcheck/tests/x86-solaris/Makefile
5679 memcheck/tests/amd64-freebsd/Makefile
5680 memcheck/tests/x86-freebsd/Makefile
5681 memcheck/tests/ppc32/Makefile
5682 memcheck/tests/ppc64/Makefile
5683 memcheck/tests/s390x/Makefile
5684 memcheck/tests/mips32/Makefile
5685 memcheck/tests/mips64/Makefile
5686 memcheck/tests/vbit-test/Makefile
5688 cachegrind/tests/Makefile
5689 cachegrind/tests/x86/Makefile
5690 cachegrind/cg_annotate
5694 callgrind/callgrind_annotate
5695 callgrind/callgrind_control
5696 callgrind/tests/Makefile
5698 helgrind/tests/Makefile
5700 drd/scripts/download-and-build-splash2
5703 massif/tests/Makefile
5708 lackey/tests/Makefile
5711 none/tests/scripts/Makefile
5712 none/tests/amd64/Makefile
5713 none/tests/ppc32/Makefile
5714 none/tests/ppc64/Makefile
5715 none/tests/x86/Makefile
5716 none/tests/arm/Makefile
5717 none/tests/arm64/Makefile
5718 none/tests/s390x/Makefile
5719 none/tests/mips32/Makefile
5720 none/tests/mips64/Makefile
5721 none/tests/nanomips/Makefile
5722 none/tests/linux/Makefile
5723 none/tests/darwin/Makefile
5724 none/tests/solaris/Makefile
5725 none/tests/freebsd/Makefile
5726 none/tests/amd64-linux/Makefile
5727 none/tests/x86-linux/Makefile
5728 none/tests/amd64-darwin/Makefile
5729 none/tests/x86-darwin/Makefile
5730 none/tests/amd64-solaris/Makefile
5731 none/tests/x86-solaris/Makefile
5732 none/tests/x86-freebsd/Makefile
5734 exp-bbv/tests/Makefile
5735 exp-bbv/tests/x86/Makefile
5736 exp-bbv/tests/x86-linux/Makefile
5737 exp-bbv/tests/amd64-linux/Makefile
5738 exp-bbv/tests/ppc32-linux/Makefile
5739 exp-bbv/tests/arm-linux/Makefile
5743 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
5744 [chmod +x coregrind/link_tool_exe_linux])
5745 AC_CONFIG_FILES([coregrind/link_tool_exe_freebsd],
5746 [chmod +x coregrind/link_tool_exe_freebsd])
5747 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
5748 [chmod +x coregrind/link_tool_exe_darwin])
5749 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
5750 [chmod +x coregrind/link_tool_exe_solaris])
5751 AC_CONFIG_FILES([tests/filter_stderr_basic],
5752 [chmod +x tests/filter_stderr_basic])
5753 AC_CONFIG_FILES([tests/filter_discards],
5754 [chmod +x tests/filter_discards])
5755 AC_CONFIG_FILES([memcheck/tests/filter_stderr],
5756 [chmod +x memcheck/tests/filter_stderr])
5757 AC_CONFIG_FILES([memcheck/tests/filter_dw4],
5758 [chmod +x memcheck/tests/filter_dw4])
5759 AC_CONFIG_FILES([memcheck/tests/filter_overlaperror],
5760 [chmod +x memcheck/tests/filter_overlaperror])
5761 AC_CONFIG_FILES([memcheck/tests/filter_supp],
5762 [chmod +x memcheck/tests/filter_supp])
5763 AC_CONFIG_FILES([memcheck/tests/x86/filter_pushfpopf],
5764 [chmod +x memcheck/tests/x86/filter_pushfpopf])
5765 AC_CONFIG_FILES([gdbserver_tests/filter_gdb],
5766 [chmod +x gdbserver_tests/filter_gdb])
5767 AC_CONFIG_FILES([gdbserver_tests/filter_memcheck_monitor],
5768 [chmod +x gdbserver_tests/filter_memcheck_monitor])
5769 AC_CONFIG_FILES([gdbserver_tests/filter_stderr],
5770 [chmod +x gdbserver_tests/filter_stderr])
5771 AC_CONFIG_FILES([gdbserver_tests/filter_vgdb],
5772 [chmod +x gdbserver_tests/filter_vgdb])
5773 AC_CONFIG_FILES([drd/tests/filter_stderr],
5774 [chmod +x drd/tests/filter_stderr])
5775 AC_CONFIG_FILES([drd/tests/filter_error_count],
5776 [chmod +x drd/tests/filter_error_count])
5777 AC_CONFIG_FILES([drd/tests/filter_error_summary],
5778 [chmod +x drd/tests/filter_error_summary])
5779 AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
5780 [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
5781 AC_CONFIG_FILES([drd/tests/filter_thread_no],
5782 [chmod +x drd/tests/filter_thread_no])
5783 AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
5784 [chmod +x drd/tests/filter_xml_and_thread_no])
5785 AC_CONFIG_FILES([helgrind/tests/filter_stderr],
5786 [chmod +x helgrind/tests/filter_stderr])
5792 Maximum build arch: ${ARCH_MAX}
5793 Primary build arch: ${VGCONF_ARCH_PRI}
5794 Secondary build arch: ${VGCONF_ARCH_SEC}
5795 Build OS: ${VGCONF_OS}
5796 Link Time Optimisation: ${vg_cv_lto}
5797 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
5798 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
5799 Platform variant: ${VGCONF_PLATVARIANT}
5800 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
5801 Default supp files: ${DEFAULT_SUPP}