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], [24])
19 m4_define([v_micro_ver], [0])
20 m4_define([v_suffix_ver], [GIT])
21 m4_define([v_rel_date], ["?? Oct 2024"])
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 nested functions ?
2885 AC_MSG_CHECKING([if gcc accepts nested functions])
2887 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2888 int foo() { return 1; }
2891 ac_have_nested_functions=yes
2892 AC_MSG_RESULT([yes])
2894 ac_have_nested_functions=no
2897 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2900 # does this compiler support the 'p' constraint in ASM statements ?
2902 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2904 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2906 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2908 ac_have_asm_constraint_p=yes
2909 AC_MSG_RESULT([yes])
2911 ac_have_asm_constraint_p=no
2914 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2917 # Does this compiler and linker support -pie?
2918 # Some compilers actually do not support -pie and report its usage
2919 # as an error. We need to check if it is safe to use it first.
2921 AC_MSG_CHECKING([if gcc accepts -pie])
2926 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2929 AC_SUBST([FLAG_PIE], ["-pie"])
2930 AC_MSG_RESULT([yes])
2932 AC_SUBST([FLAG_PIE], [""])
2937 AC_MSG_CHECKING([if gcc accepts -ansi])
2942 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2946 AC_MSG_RESULT([yes])
2951 AM_CONDITIONAL([HAVE_ANSI], [test x$ac_have_ansi = xyes])
2956 # Does this compiler support -no-pie?
2957 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2958 # default. However this gets in the way with some tests, we use -no-pie
2961 AC_MSG_CHECKING([if gcc accepts -no-pie])
2964 CFLAGS="-no-pie -Werror"
2966 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2969 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
2970 AC_MSG_RESULT([yes])
2972 AC_SUBST([FLAG_NO_PIE], [""])
2978 # We want to use use the -Ttext-segment option to the linker.
2979 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
2980 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2981 # semantics are NOT what we want (GNU gold -Ttext is fine).
2983 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2984 # will reside. -Ttext aligns just the .text section start (but not any
2987 # LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes"
2988 # in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html
2989 # The --image-base option (since version 6.0?) provides the semantics needed.
2990 # -Ttext-segment generates an error, but -Ttext now more closely
2991 # follows the GNU (bfd) ld's -Ttext.
2993 # So test first for --image-base support, and if that fails then
2994 # for -Ttext-segment which is supported by all bfd ld versions
2995 # and use that if it exists. If it doesn't exist it must be an older
2996 # version of gold and we can fall back to using -Ttext which has the
3000 AC_MSG_CHECKING([if the linker accepts -Wl,--image-base])
3002 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror"
3005 [AC_LANG_SOURCE([int _start () { return 0; }])],
3007 linker_using_t_text="no"
3008 AC_SUBST([FLAG_T_TEXT], ["--image-base"])
3009 AC_MSG_RESULT([yes])
3013 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
3015 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
3018 [AC_LANG_SOURCE([int _start () { return 0; }])],
3020 linker_using_t_text="no"
3021 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
3022 AC_MSG_RESULT([yes])
3024 linker_using_t_text="yes"
3025 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
3032 # If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will
3033 # have to strip any build-id ELF NOTEs from the statically linked tools.
3034 # Otherwise the build-id NOTE might end up at the default load address.
3035 # (Pedantically if the linker is gold then -Ttext is fine, but newer
3036 # gold versions also support -Ttext-segment. So just assume that unless
3037 # we can use -Ttext-segment we need to strip the build-id NOTEs.
3038 if test "x${linker_using_t_text}" = "xyes"; then
3039 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
3040 # does the linker support -Wl,--build-id=none ? Note, it's
3041 # important that we test indirectly via whichever C compiler
3042 # is selected, rather than testing /usr/bin/ld or whatever
3044 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
3046 CFLAGS="-Wl,--build-id=none -Werror"
3049 [AC_LANG_PROGRAM([ ], [return 0;])],
3051 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
3052 AC_MSG_RESULT([yes])
3054 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3058 AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.])
3059 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3063 # On s390x, if the linker supports -Wl,--s390-pgste, then we build the
3064 # tools with that flag. This enables running programs that need it, such
3066 if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then
3067 AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste])
3069 CFLAGS="-Wl,--s390-pgste"
3072 [AC_LANG_PROGRAM([ ], [return 0;])],
3074 AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"])
3075 AC_MSG_RESULT([yes])
3077 AC_SUBST([FLAG_S390_PGSTE], [""])
3083 # does the ppc assembler support "mtocrf" et al?
3084 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
3086 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3087 __asm__ __volatile__("mtocrf 4,0");
3088 __asm__ __volatile__("mfocrf 0,4");
3090 ac_have_as_ppc_mftocrf=yes
3091 AC_MSG_RESULT([yes])
3093 ac_have_as_ppc_mftocrf=no
3096 if test x$ac_have_as_ppc_mftocrf = xyes ; then
3097 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
3101 # does the ppc assembler support "lfdp" and other phased out floating point insns?
3102 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
3104 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3105 do { typedef struct {
3109 dbl_pair_t dbl_pair[3];
3110 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
3113 ac_have_as_ppc_fpPO=yes
3114 AC_MSG_RESULT([yes])
3116 ac_have_as_ppc_fpPO=no
3119 if test x$ac_have_as_ppc_fpPO = xyes ; then
3120 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
3124 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
3125 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
3127 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3129 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
3130 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
3132 ac_have_as_amd64_fxsave64=yes
3133 AC_MSG_RESULT([yes])
3135 ac_have_as_amd64_fxsave64=no
3138 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
3139 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
3142 # does the x86/amd64 assembler understand SSE3 instructions?
3143 # Note, this doesn't generate a C-level symbol. It generates a
3144 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
3145 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
3147 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3148 do { long long int x;
3149 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
3153 AC_MSG_RESULT([yes])
3159 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
3162 # Ditto for SSSE3 instructions (note extra S)
3163 # Note, this doesn't generate a C-level symbol. It generates a
3164 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
3165 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
3167 save_CFLAGS="$CFLAGS"
3168 CFLAGS="$CFLAGS -msse -Werror"
3169 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3170 do { long long int x;
3171 __asm__ __volatile__(
3172 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
3175 ac_have_as_ssse3=yes
3176 AC_MSG_RESULT([yes])
3181 CFLAGS="$save_CFLAGS"
3183 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
3186 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
3187 # Note, this doesn't generate a C-level symbol. It generates a
3188 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
3189 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
3190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3192 __asm__ __volatile__(
3193 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
3196 ac_have_as_pclmulqdq=yes
3197 AC_MSG_RESULT([yes])
3199 ac_have_as_pclmulqdq=no
3203 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
3206 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
3207 # Note, this doesn't generate a C-level symbol. It generates a
3208 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
3209 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
3210 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3213 * Carry-less multiplication of xmm1 with xmm2 and store the result in
3214 * xmm3. The immediate is used to determine which quadwords of xmm1 and
3215 * xmm2 should be used.
3217 __asm__ __volatile__(
3218 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
3221 ac_have_as_vpclmulqdq=yes
3222 AC_MSG_RESULT([yes])
3224 ac_have_as_vpclmulqdq=no
3228 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
3231 # does the x86/amd64 assembler understand FMA4 instructions?
3232 # Note, this doesn't generate a C-level symbol. It generates a
3233 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
3234 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
3235 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3237 __asm__ __volatile__(
3238 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
3241 ac_have_as_vfmaddpd=yes
3242 AC_MSG_RESULT([yes])
3244 ac_have_as_vfmaddpd=no
3248 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
3251 # does the x86/amd64 assembler understand the LZCNT instruction?
3252 # Note, this doesn't generate a C-level symbol. It generates a
3253 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
3254 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
3256 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3258 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
3261 ac_have_as_lzcnt=yes
3262 AC_MSG_RESULT([yes])
3268 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
3271 # does the x86/amd64 assembler understand the LOOPNEL instruction?
3272 # Note, this doesn't generate a C-level symbol. It generates a
3273 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
3274 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
3276 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3278 __asm__ __volatile__("1: loopnel 1b\n");
3281 ac_have_as_loopnel=yes
3282 AC_MSG_RESULT([yes])
3284 ac_have_as_loopnel=no
3288 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
3291 # does the x86/amd64 assembler understand ADDR32 ?
3292 # Note, this doesn't generate a C-level symbol. It generates a
3293 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
3294 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
3296 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3298 asm volatile ("addr32 rep movsb");
3301 ac_have_as_addr32=yes
3302 AC_MSG_RESULT([yes])
3304 ac_have_as_addr32=no
3308 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
3311 # does the x86/amd64 assembler understand SSE 4.2 instructions?
3312 # Note, this doesn't generate a C-level symbol. It generates a
3313 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
3314 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
3316 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3317 do { long long int x;
3318 __asm__ __volatile__(
3319 "crc32q %%r15,%%r15" : : : "r15" );
3320 __asm__ __volatile__(
3321 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
3322 __asm__ __volatile__(
3323 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
3326 ac_have_as_sse42=yes
3327 AC_MSG_RESULT([yes])
3333 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
3336 # does the x86/amd64 assembler understand AVX instructions?
3337 # Note, this doesn't generate a C-level symbol. It generates a
3338 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
3339 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
3341 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3342 do { long long int x;
3343 __asm__ __volatile__(
3344 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
3345 __asm__ __volatile__(
3346 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3350 AC_MSG_RESULT([yes])
3356 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
3359 # does the x86/amd64 assembler understand AVX2 instructions?
3360 # Note, this doesn't generate a C-level symbol. It generates a
3361 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
3362 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
3364 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3365 do { long long int x;
3366 __asm__ __volatile__(
3367 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3368 __asm__ __volatile__(
3369 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3373 AC_MSG_RESULT([yes])
3379 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
3382 # does the x86/amd64 assembler understand TSX instructions and
3383 # the XACQUIRE/XRELEASE prefixes?
3384 # Note, this doesn't generate a C-level symbol. It generates a
3385 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
3386 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
3388 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3390 __asm__ __volatile__(
3393 " xacquire lock incq 0(%rsp) \n\t"
3394 " xrelease lock incq 0(%rsp) \n"
3399 AC_MSG_RESULT([yes])
3405 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
3408 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
3409 # Note, this doesn't generate a C-level symbol. It generates a
3410 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
3411 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
3413 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3414 do { unsigned int h, l;
3415 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
3416 __asm__ __volatile__(
3417 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
3418 __asm__ __volatile__(
3419 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
3423 AC_MSG_RESULT([yes])
3429 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
3432 # does the x86/amd64 assembler understand FMA instructions?
3433 # Note, this doesn't generate a C-level symbol. It generates a
3434 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
3435 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
3437 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3438 do { unsigned int h, l;
3439 __asm__ __volatile__(
3440 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3441 __asm__ __volatile__(
3442 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
3443 __asm__ __volatile__(
3444 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
3448 AC_MSG_RESULT([yes])
3454 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
3457 # does the amd64 assembler understand MPX instructions?
3458 # Note, this doesn't generate a C-level symbol. It generates a
3459 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
3460 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
3462 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3464 asm ("bndmov %bnd0,(%rsp)");
3465 asm ("bndldx 3(%rbx,%rdx), %bnd2");
3466 asm ("bnd call foo\n"
3473 AC_MSG_RESULT([yes])
3479 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
3482 # does the amd64 assembler understand ADX instructions?
3483 # Note, this doesn't generate a C-level symbol. It generates a
3484 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
3485 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
3487 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3489 asm ("adcxq %r14,%r8");
3493 AC_MSG_RESULT([yes])
3499 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
3502 # does the amd64 assembler understand the RDRAND instruction?
3503 # Note, this doesn't generate a C-level symbol. It generates a
3504 # automake-level symbol (BUILD_RDRAND_TESTS), used in test Makefile.am's
3505 AC_MSG_CHECKING([if amd64 assembler knows the RDRAND instruction])
3507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3509 asm ("rdrand %r14");
3510 asm ("rdrand %r14d");
3511 asm ("rdrand %r14w");
3514 ac_have_as_rdrand=yes
3515 AC_MSG_RESULT([yes])
3517 ac_have_as_rdrand=no
3521 AM_CONDITIONAL(BUILD_RDRAND_TESTS, test x$ac_have_as_rdrand = xyes)
3523 # does the amd64 assembler understand the RDSEED instruction?
3524 # Note, this doesn't generate a C-level symbol. It generates a
3525 # automake-level symbol (BUILD_RDSEED_TESTS), used in test Makefile.am's
3526 AC_MSG_CHECKING([if amd64 assembler knows the RDSEED instruction])
3528 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3530 asm ("rdseed %r14");
3531 asm ("rdseed %r14d");
3532 asm ("rdseed %r14w");
3535 ac_have_as_rdseed=yes
3536 AC_MSG_RESULT([yes])
3538 ac_have_as_rdseed=no
3542 AM_CONDITIONAL(BUILD_RDSEED_TESTS, test x$ac_have_as_rdseed = xyes)
3544 # does the amd64 assembler understand the F16C instructions (VCVTPH2PS and
3546 # Note, this doesn't generate a C-level symbol. It generates a
3547 # automake-level symbol (BUILD_F16C_TESTS), used in test Makefile.am's
3548 AC_MSG_CHECKING([if amd64 assembler knows the F16C instructions])
3550 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3552 asm ("vcvtph2ps %xmm5, %ymm10");
3553 // If we put the dollar sign and zero together, the shell processing
3554 // this configure.ac script substitutes the command name in. Sigh.
3555 asm ("vcvtps2ph $" "0, %ymm10, %xmm5");
3559 AC_MSG_RESULT([yes])
3565 AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes)
3568 # does the x86/amd64 assembler understand MOVBE?
3569 # Note, this doesn't generate a C-level symbol. It generates a
3570 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
3571 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
3573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3574 do { long long int x;
3575 __asm__ __volatile__(
3576 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
3579 ac_have_as_movbe=yes
3580 AC_MSG_RESULT([yes])
3586 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
3589 # Does the C compiler support the "ifunc" attribute
3590 # Note, this doesn't generate a C-level symbol. It generates a
3591 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
3592 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
3594 AC_LINK_IFELSE([AC_LANG_SOURCE([[
3595 static void mytest(void) {}
3597 static void (*resolve_test(void))(void)
3599 return (void (*)(void))&mytest;
3602 void test(void) __attribute__((ifunc("resolve_test")));
3610 ac_have_ifunc_attr=yes
3611 AC_MSG_RESULT([yes])
3613 ac_have_ifunc_attr=no
3617 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
3619 # Does the C compiler support the armv8 crc feature flag
3620 # Note, this doesn't generate a C-level symbol. It generates a
3621 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
3622 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
3624 save_CFLAGS="$CFLAGS"
3625 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
3626 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3632 ac_have_armv8_crc_feature=yes
3633 AC_MSG_RESULT([yes])
3635 ac_have_armv8_crc_feature=no
3638 CFLAGS="$save_CFLAGS"
3640 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
3643 # Does the C compiler support the armv81 flag and the assembler v8.1 instructions
3644 # Note, this doesn't generate a C-level symbol. It generates a
3645 # automake-level symbol (BUILD_ARMV81_TESTS), used in test Makefile.am's
3646 AC_MSG_CHECKING([if gcc supports the armv81 feature flag and assembler supports v8.1 instructions])
3648 save_CFLAGS="$CFLAGS"
3649 CFLAGS="$CFLAGS -march=armv8.1-a -Werror"
3650 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3653 __asm__ __volatile__("ldadd x0, x1, [x2]" ::: "memory");
3657 ac_have_armv81_feature=yes
3658 AC_MSG_RESULT([yes])
3660 ac_have_armv81_feature=no
3663 CFLAGS="$save_CFLAGS"
3665 AM_CONDITIONAL(BUILD_ARMV81_TESTS, test x$ac_have_armv81_feature = xyes)
3668 # Does the C compiler support the armv82 flag and the assembler v8.2 instructions
3669 # Note, this doesn't generate a C-level symbol. It generates a
3670 # automake-level symbol (BUILD_ARMV82_TESTS), used in test Makefile.am's
3671 AC_MSG_CHECKING([if gcc supports the armv82 feature flag and assembler supports v8.2 instructions])
3673 save_CFLAGS="$CFLAGS"
3674 CFLAGS="$CFLAGS -march=armv8.2-a+fp16 -Werror"
3675 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3678 __asm__ __volatile__("faddp h0, v1.2h");
3682 ac_have_armv82_feature=yes
3683 AC_MSG_RESULT([yes])
3685 ac_have_armv82_feature=no
3688 CFLAGS="$save_CFLAGS"
3690 AM_CONDITIONAL(BUILD_ARMV82_TESTS, test x$ac_have_armv82_feature = xyes)
3693 # Does the C compiler support the armv82-a+dotprod flag and assembler dotprod instructions
3694 # Note, this doesn't generate a C-level symbol. It generates a
3695 # automake-level symbol (BUILD_ARMV82_DOTPROD_TESTS), used in test Makefile.am's
3696 AC_MSG_CHECKING([if gcc supports the armv82-a+dotprod feature flag and assembler supports dotprod instructions])
3698 save_CFLAGS="$CFLAGS"
3699 CFLAGS="$CFLAGS -march=armv8.2-a+dotprod -Werror"
3700 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3703 __asm__ __volatile__("sdot v1.4s, v2.16b, v3.16b");
3707 ac_have_armv82_dotprod_feature=yes
3708 AC_MSG_RESULT([yes])
3710 ac_have_armv82_dotprod_feature=no
3713 CFLAGS="$save_CFLAGS"
3715 AM_CONDITIONAL(BUILD_ARMV82_DOTPROD_TESTS, test x$ac_have_armv82_dotprod_feature = xyes)
3718 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
3719 # when building the tool executables. I think we should get rid of it.
3721 # Check for TLS support in the compiler and linker
3722 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3724 [vg_cv_linktime_tls=yes],
3725 [vg_cv_linktime_tls=no])
3726 # Native compilation: check whether running a program using TLS succeeds.
3727 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
3728 # succeeds but running programs using TLS fails.
3729 # Cross-compiling: check whether linking a program using TLS succeeds.
3730 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
3731 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
3732 [vg_cv_tls=$enableval],
3733 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3737 [vg_cv_tls=$vg_cv_linktime_tls])])])
3739 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
3740 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
3744 #----------------------------------------------------------------------------
3745 # Solaris-specific checks.
3746 #----------------------------------------------------------------------------
3748 if test "$VGCONF_OS" = "solaris" ; then
3749 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
3751 # Solaris-specific check determining if the Sun Studio Assembler is used to
3752 # build Valgrind. The test checks if the x86/amd64 assembler understands the
3753 # cmovl.l instruction, if yes then it's Sun Assembler.
3755 # C-level symbol: none
3756 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
3758 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
3759 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3761 __asm__ __volatile__("cmovl.l %edx, %eax");
3763 solaris_have_sun_studio_as=yes
3764 AC_MSG_RESULT([yes])
3766 solaris_have_sun_studio_as=no
3769 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
3771 # Solaris-specific check determining if symbols __xpg4 and __xpg6
3772 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
3773 # See solaris/vgpreload-solaris.mapfile for details.
3774 # gcc on older Solaris instructs linker to include these symbols,
3775 # gcc on illumos and newer Solaris does not.
3777 # C-level symbol: none
3778 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
3780 save_CFLAGS="$CFLAGS"
3781 CFLAGS="$CFLAGS -std=gnu99"
3782 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
3783 temp_dir=$( /usr/bin/mktemp -d )
3784 cat <<_ACEOF >${temp_dir}/mylib.c
3786 int myfunc(void) { printf("LaPutyka\n"); }
3788 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
3789 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
3790 if test "x${xpg_present}" = "x" ; then
3791 solaris_xpg_symbols_present=no
3794 solaris_xpg_symbols_present=yes
3795 AC_MSG_RESULT([yes])
3798 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
3799 CFLAGS="$save_CFLAGS"
3802 # Solaris-specific check determining if gcc enables largefile support by
3803 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
3804 # variable with gcc flags which disable it.
3806 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
3807 save_CFLAGS="$CFLAGS"
3808 CFLAGS="$CFLAGS -m32"
3809 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3810 return _LARGEFILE_SOURCE;
3812 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
3813 AC_MSG_RESULT([yes])
3815 SOLARIS_UNDEF_LARGESOURCE=""
3819 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
3822 # Solaris-specific check determining if /proc/self/cmdline
3823 # or /proc/<pid>/cmdline is supported.
3825 # C-level symbol: SOLARIS_PROC_CMDLINE
3826 # Automake-level symbol: SOLARIS_PROC_CMDLINE
3828 AC_CHECK_FILE([/proc/self/cmdline],
3830 solaris_proc_cmdline=yes
3831 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
3832 [Define to 1 if you have /proc/self/cmdline.])
3834 solaris_proc_cmdline=no
3836 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3839 # Solaris-specific check determining default platform for the Valgrind launcher.
3840 # Used in case the launcher cannot select platform by looking at the client
3841 # image (for example because the executable is a shell script).
3843 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3844 # Automake-level symbol: none
3846 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3847 # Get the ELF class of /bin/sh first.
3848 if ! test -f /bin/sh; then
3849 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3851 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3852 case "$elf_class" in
3854 default_arch="$VGCONF_ARCH_PRI";
3857 if test "x$VGCONF_ARCH_SEC" != "x"; then
3858 default_arch="$VGCONF_ARCH_SEC"
3860 default_arch="$VGCONF_ARCH_PRI";
3864 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3867 default_platform="$default_arch-$VGCONF_OS"
3868 AC_MSG_RESULT([$default_platform])
3869 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3870 [Default platform for Valgrind launcher.])
3873 # Solaris-specific check determining if the old syscalls are available.
3875 # C-level symbol: SOLARIS_OLD_SYSCALLS
3876 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3878 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3879 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3880 #include <sys/syscall.h>
3884 solaris_old_syscalls=yes
3885 AC_MSG_RESULT([yes])
3886 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3887 [Define to 1 if you have the old Solaris syscalls.])
3889 solaris_old_syscalls=no
3892 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
3895 # Solaris-specific check determining if the new accept() syscall is available.
3898 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3901 # New syscall (available on illumos):
3902 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3903 # int version, int flags);
3905 # If the old syscall is present then the following syscall will fail with
3906 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
3907 # available then it will fail with EINVAL (because the flags parameter is
3910 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
3911 # Automake-level symbol: none
3913 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
3914 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3915 #include <sys/syscall.h>
3919 syscall(SYS_accept, 0, 0, 0, 0, -1);
3920 return !(errno == EINVAL);
3922 AC_MSG_RESULT([yes])
3923 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
3924 [Define to 1 if you have the new `accept' syscall.])
3930 # Solaris-specific check determining if the new illumos pipe() syscall is
3934 # longlong_t pipe();
3936 # New syscall (available on illumos):
3937 # int pipe(intptr_t arg, int flags);
3939 # If the old syscall is present then the following call will succeed, if the
3940 # new syscall is available then it will fail with EFAULT (because address 0
3941 # cannot be accessed).
3943 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
3944 # Automake-level symbol: none
3946 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
3947 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3948 #include <sys/syscall.h>
3952 syscall(SYS_pipe, 0, 0);
3953 return !(errno == EFAULT);
3955 AC_MSG_RESULT([yes])
3956 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3957 [Define to 1 if you have the new `pipe' syscall.])
3963 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
3967 # int lwp_kill(id_t lwpid, int sig);
3969 # New syscall (available on Solaris 11):
3970 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3971 # int si_code, timespec_t *timeout);
3973 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3974 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3976 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3977 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3978 #include <sys/syscall.h>
3980 return !SYS_lwp_sigqueue;
3982 solaris_lwp_sigqueue_syscall=yes
3983 AC_MSG_RESULT([yes])
3984 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
3985 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
3987 solaris_lwp_sigqueue_syscall=no
3990 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3993 # Solaris-specific check determining if the lwp_sigqueue() syscall
3994 # takes both pid and thread id arguments or just thread id.
3996 # Old syscall (available up to Solaris 11.3):
3997 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3998 # int si_code, timespec_t *timeout);
4000 # New syscall (available since Solaris 11.4):
4001 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
4002 # int si_code, timespec_t *timeout);
4004 # If the old syscall is present then the following syscall will fail with
4005 # EINVAL (because signal is out of range); if the new syscall is available
4006 # then it will fail with ESRCH (because it would not find such thread in the
4009 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4010 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4012 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
4013 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
4014 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4015 #include <sys/syscall.h>
4019 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
4020 return !(errno == ESRCH);
4022 solaris_lwp_sigqueue_syscall_takes_pid=yes
4023 AC_MSG_RESULT([yes])
4024 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
4025 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
4027 solaris_lwp_sigqueue_syscall_takes_pid=no
4030 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
4031 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
4033 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
4037 # Solaris-specific check determining if the new lwp_name() syscall is
4040 # New syscall (available on Solaris 11):
4041 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
4043 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
4044 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
4046 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
4047 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4048 #include <sys/syscall.h>
4050 return !SYS_lwp_name;
4052 solaris_lwp_name_syscall=yes
4053 AC_MSG_RESULT([yes])
4054 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
4055 [Define to 1 if you have the new `lwp_name' syscall.])
4057 solaris_lwp_name_syscall=no
4060 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
4063 # Solaris-specific check determining if the new getrandom() syscall is
4066 # New syscall (available on Solaris 11):
4067 # int getrandom(void *buf, size_t buflen, uint_t flags);
4069 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
4070 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
4072 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
4073 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4074 #include <sys/syscall.h>
4076 return !SYS_getrandom;
4078 solaris_getrandom_syscall=yes
4079 AC_MSG_RESULT([yes])
4080 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
4081 [Define to 1 if you have the new `getrandom' syscall.])
4083 solaris_getrandom_syscall=no
4086 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
4089 # Solaris-specific check determining if the new zone() syscall subcodes
4090 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
4091 # were added in Solaris 11 but are missing on illumos.
4093 # C-level symbol: SOLARIS_ZONE_DEFUNCT
4094 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
4096 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
4097 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4098 #include <sys/zone.h>
4100 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
4102 solaris_zone_defunct=yes
4103 AC_MSG_RESULT([yes])
4104 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
4105 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
4107 solaris_zone_defunct=no
4110 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
4113 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
4114 # for auditon(2) subcode of the auditsys() syscall are available.
4115 # These commands are available in Solaris 11 and illumos but were removed
4118 # C-level symbol: SOLARIS_AUDITON_STAT
4119 # Automake-level symbol: SOLARIS_AUDITON_STAT
4121 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
4122 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4123 #include <bsm/audit.h>
4125 return !(A_GETSTAT && A_SETSTAT);
4127 solaris_auditon_stat=yes
4128 AC_MSG_RESULT([yes])
4129 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
4130 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
4132 solaris_auditon_stat=no
4135 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
4138 # Solaris-specific check determining if the new shmsys() syscall subcodes
4139 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
4140 # These subcodes were added in Solaris 11 but are missing on illumos.
4142 # C-level symbol: SOLARIS_SHM_NEW
4143 # Automake-level symbol: SOLARIS_SHM_NEW
4145 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
4146 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4147 #include <sys/ipc_impl.h>
4148 #include <sys/shm.h>
4149 #include <sys/shm_impl.h>
4151 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
4154 AC_MSG_RESULT([yes])
4155 AC_DEFINE([SOLARIS_SHM_NEW], 1,
4156 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
4161 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
4164 # Solaris-specific check determining if prxregset_t is available. Illumos
4165 # currently does not define it on the x86 platform.
4167 # C-level symbol: SOLARIS_PRXREGSET_T
4168 # Automake-level symbol: SOLARIS_PRXREGSET_T
4170 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
4171 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4172 #include <sys/procfs_isa.h>
4174 return !sizeof(prxregset_t);
4176 solaris_prxregset_t=yes
4177 AC_MSG_RESULT([yes])
4178 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
4179 [Define to 1 if you have the `prxregset_t' type.])
4181 solaris_prxregset_t=no
4184 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
4187 # Solaris-specific check determining if the new frealpathat() syscall is
4190 # New syscall (available on Solaris 11.1):
4191 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
4193 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4194 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4196 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
4197 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4198 #include <sys/syscall.h>
4200 return !SYS_frealpathat;
4202 solaris_frealpathat_syscall=yes
4203 AC_MSG_RESULT([yes])
4204 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
4205 [Define to 1 if you have the new `frealpathat' syscall.])
4207 solaris_frealpathat_syscall=no
4210 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
4213 # Solaris-specific check determining if the new uuidsys() syscall is
4216 # New syscall (available on newer Solaris):
4217 # int uuidsys(struct uuid *uuid);
4219 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
4220 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
4222 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
4223 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4224 #include <sys/syscall.h>
4226 return !SYS_uuidsys;
4228 solaris_uuidsys_syscall=yes
4229 AC_MSG_RESULT([yes])
4230 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
4231 [Define to 1 if you have the new `uuidsys' syscall.])
4233 solaris_uuidsys_syscall=no
4236 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
4239 # Solaris-specific check determining if the new labelsys() syscall subcode
4240 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
4241 # missing on illumos.
4243 # C-level symbol: SOLARIS_TNDB_GET_TNIP
4244 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
4246 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
4247 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4248 #include <sys/tsol/tndb.h>
4250 return !TNDB_GET_TNIP;
4252 solaris_tndb_get_tnip=yes
4253 AC_MSG_RESULT([yes])
4254 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
4255 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
4257 solaris_tndb_get_tnip=no
4260 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
4263 # Solaris-specific check determining if the new labelsys() syscall opcodes
4264 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
4265 # added in Solaris 11 but are missing on illumos.
4267 # C-level symbol: SOLARIS_TSOL_CLEARANCE
4268 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
4270 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
4271 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4272 #include <sys/tsol/tsyscall.h>
4274 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
4276 solaris_tsol_clearance=yes
4277 AC_MSG_RESULT([yes])
4278 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
4279 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
4281 solaris_tsol_clearance=no
4284 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
4287 # Solaris-specific check determining if the new pset() syscall subcode
4288 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
4289 # is missing on illumos and Solaris 11.3.
4291 # C-level symbol: SOLARIS_PSET_GET_NAME
4292 # Automake-level symbol: SOLARIS_PSET_GET_NAME
4294 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
4295 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4296 #include <sys/pset.h>
4298 return !(PSET_GET_NAME);
4300 solaris_pset_get_name=yes
4301 AC_MSG_RESULT([yes])
4302 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
4303 [Define to 1 if you have the `PSET_GET_NAME' constants.])
4305 solaris_pset_get_name=no
4308 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
4311 # Solaris-specific check determining if the utimesys() syscall is
4312 # available (on illumos and older Solaris).
4314 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
4315 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
4317 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
4318 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4319 #include <sys/syscall.h>
4321 return !SYS_utimesys;
4323 solaris_utimesys_syscall=yes
4324 AC_MSG_RESULT([yes])
4325 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
4326 [Define to 1 if you have the `utimesys' syscall.])
4328 solaris_utimesys_syscall=no
4331 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
4334 # Solaris-specific check determining if the utimensat() syscall is
4335 # available (on newer Solaris).
4337 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4338 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4340 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
4341 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4342 #include <sys/syscall.h>
4344 return !SYS_utimensat;
4346 solaris_utimensat_syscall=yes
4347 AC_MSG_RESULT([yes])
4348 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
4349 [Define to 1 if you have the `utimensat' syscall.])
4351 solaris_utimensat_syscall=no
4354 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
4357 # Solaris-specific check determining if the spawn() syscall is available
4358 # (on newer Solaris).
4360 # C-level symbol: SOLARIS_SPAWN_SYSCALL
4361 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
4363 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
4364 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4365 #include <sys/syscall.h>
4369 solaris_spawn_syscall=yes
4370 AC_MSG_RESULT([yes])
4371 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
4372 [Define to 1 if you have the `spawn' syscall.])
4374 solaris_spawn_syscall=no
4377 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
4380 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
4381 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
4383 # C-level symbol: SOLARIS_MODCTL_MODNVL
4384 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
4386 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
4387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4388 #include <sys/modctl.h>
4390 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
4392 solaris_modctl_modnvl=yes
4393 AC_MSG_RESULT([yes])
4394 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
4395 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
4397 solaris_modctl_modnvl=no
4400 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
4403 # Solaris-specific check determining whether nscd (name switch cache daemon)
4404 # attaches its door at /system/volatile/name_service_door (Solaris)
4405 # or at /var/run/name_service_door (illumos).
4407 # Note that /var/run is a symlink to /system/volatile on Solaris
4408 # but not vice versa on illumos.
4410 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4411 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4413 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
4414 if test -e /system/volatile/name_service_door; then
4415 solaris_nscd_door_system_volatile=yes
4416 AC_MSG_RESULT([/system/volatile/name_service_door])
4417 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
4418 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
4420 solaris_nscd_door_system_volatile=no
4421 AC_MSG_RESULT([/var/run/name_service_door])
4423 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
4426 # Solaris-specific check determining if the new gethrt() fasttrap is available.
4428 # New fasttrap (available on Solaris 11):
4429 # hrt_t *gethrt(void);
4431 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
4432 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
4434 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
4435 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4436 #include <sys/trap.h>
4440 solaris_gethrt_fasttrap=yes
4441 AC_MSG_RESULT([yes])
4442 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
4443 [Define to 1 if you have the new `gethrt' fasttrap.])
4445 solaris_gethrt_fasttrap=no
4448 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
4451 # Solaris-specific check determining if the new get_zone_offset() fasttrap
4454 # New fasttrap (available on Solaris 11):
4455 # zonehrtoffset_t *get_zone_offset(void);
4457 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4458 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4460 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
4461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4462 #include <sys/trap.h>
4464 return !T_GETZONEOFFSET;
4466 solaris_getzoneoffset_fasttrap=yes
4467 AC_MSG_RESULT([yes])
4468 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
4469 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
4471 solaris_getzoneoffset_fasttrap=no
4474 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
4477 # Solaris-specific check determining if the execve() syscall
4478 # takes fourth argument (flags) or not.
4480 # Old syscall (available on illumos):
4481 # int execve(const char *fname, const char **argv, const char **envp);
4483 # New syscall (available on Solaris):
4484 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
4486 # If the new syscall is present then it will fail with EINVAL (because flags
4487 # are invalid); if the old syscall is available then it will fail with ENOENT
4488 # (because the file could not be found).
4490 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4491 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4493 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
4494 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4495 #include <sys/syscall.h>
4499 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
4500 return !(errno == EINVAL);
4502 solaris_execve_syscall_takes_flags=yes
4503 AC_MSG_RESULT([yes])
4504 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
4505 [Define to 1 if you have the new `execve' syscall which accepts flags.])
4507 solaris_execve_syscall_takes_flags=no
4510 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
4511 test x$solaris_execve_syscall_takes_flags = xyes)
4514 # Solaris-specific check determining version of the repository cache protocol.
4515 # Every Solaris version uses a different one, ranging from 21 to current 25.
4516 # The check is very ugly, though.
4518 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
4519 # Automake-level symbol: none
4521 AC_PATH_PROG(DIS_PATH, dis, false)
4522 if test "x$DIS_PATH" = "xfalse"; then
4523 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
4525 # The illumos source is (or was) here
4526 # https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libscf/common/lowlevel.c#L1148
4527 # specifically the line
4529 # request.rdr_version = REPOSITORY_DOOR_VERSION;
4531 # rdr_version is a 32bit unsigned int
4532 # The macro REPOSITORY_DOOR_VERSION contains the ascii letters "Rep" in the top 3
4533 # bytes and the door version in the lowest byte. Hence we look for Rep which is 526570
4534 # in hex and then extrace the following byte.
4535 AC_CHECK_LIB(scf, scf_handle_bind, [], [
4536 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
4537 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4540 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
4541 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
4542 libscf=/usr/lib/64/libscf.so.1
4544 libscf=/usr/lib/libscf.so.1
4546 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q -E '0x(4d01)?526570'; then
4547 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
4548 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4550 hex=$( $DIS_PATH -F scf_handle_bind $libscf | grep 526570 | sed 's/.*526570//;s/,.*//' )
4551 if test -z "$hex"; then
4552 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
4553 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4555 version=$( printf "%d\n" 0x$hex )
4556 AC_MSG_RESULT([$version])
4557 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
4558 [Version number of the repository door cache protocol.])
4561 # Solaris-specific check determining if "sysstat" segment reservation type
4564 # New "sysstat" segment reservation (available on Solaris 11.4):
4565 # - program header type: PT_SUNW_SYSSTAT
4566 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
4568 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4569 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4571 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
4572 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4573 #include <sys/auxv.h>
4575 return !AT_SUN_SYSSTAT_ADDR;
4577 solaris_reserve_sysstat_addr=yes
4578 AC_MSG_RESULT([yes])
4579 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
4580 [Define to 1 if you have the new `sysstat' segment reservation.])
4582 solaris_reserve_sysstat_addr=no
4585 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
4588 # Solaris-specific check determining if "sysstat_zone" segment reservation type
4591 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
4592 # - program header type: PT_SUNW_SYSSTAT_ZONE
4593 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
4595 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4596 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4598 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
4599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4600 #include <sys/auxv.h>
4602 return !AT_SUN_SYSSTAT_ZONE_ADDR;
4604 solaris_reserve_sysstat_zone_addr=yes
4605 AC_MSG_RESULT([yes])
4606 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
4607 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
4609 solaris_reserve_sysstat_zone_addr=no
4612 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
4615 # Solaris-specific check determining if the system_stats() syscall is available
4616 # (on newer Solaris).
4618 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4619 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4621 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
4622 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4623 #include <sys/syscall.h>
4625 return !SYS_system_stats;
4627 solaris_system_stats_syscall=yes
4628 AC_MSG_RESULT([yes])
4629 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
4630 [Define to 1 if you have the `system_stats' syscall.])
4632 solaris_system_stats_syscall=no
4635 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
4638 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
4639 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
4641 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
4642 # Automake-level symbol: none
4644 AC_CHECK_TYPE([struct _fpchip_state],
4645 [solaris_fpchip_state_takes_underscore=yes],
4646 [solaris_fpchip_state_takes_underscore=no],
4647 [[#include <sys/regset.h>]])
4648 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
4649 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
4650 [Define to 1 if fpregset_t defines struct _fpchip_state])
4654 # Solaris-specific check determining if schedctl page shared between kernel
4655 # and userspace program is executable (illumos, older Solaris) or not (newer
4658 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
4659 # Automake-level symbol: none
4661 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
4662 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4666 #include <schedctl.h>
4670 schedctl_t *scp = schedctl_init();
4674 int fd = open("/proc/self/map", O_RDONLY);
4679 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
4680 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
4681 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
4682 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
4683 return (map.pr_mflags & MA_EXEC);
4689 solaris_schedctl_page_exec=no
4692 solaris_schedctl_page_exec=yes
4693 AC_MSG_RESULT([yes])
4694 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
4695 [Define to 1 if you have the schedctl page executable.])
4699 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
4700 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
4701 # an initial thread pointer for libc (newer Solaris).
4703 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
4704 # Automake-level symbol: none
4706 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
4707 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4708 #include <sys/fasttrap_isa.h>
4710 return !FT_SCRATCHSIZE;
4712 solaris_pt_sunwdtrace_thrp=yes
4713 AC_MSG_RESULT([yes])
4714 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
4715 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
4717 solaris_pt_sunwdtrace_thrp=no
4722 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
4723 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
4724 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
4725 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
4726 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
4727 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
4728 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
4729 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
4730 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
4731 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
4732 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
4733 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
4734 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
4735 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
4736 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
4737 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
4738 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
4739 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
4740 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
4741 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
4742 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
4743 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
4744 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
4745 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
4746 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
4747 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
4748 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
4749 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
4750 fi # test "$VGCONF_OS" = "solaris"
4752 #----------------------------------------------------------------------------
4753 # FreeBSD-specific checks.
4754 #----------------------------------------------------------------------------
4756 # Rather than having a large number of feature test as above with Solaris
4757 # these tests are per-version. This may not be entirely reliable for
4758 # FreeBSD development branches (XX.Y-CURRENT) or pre-release branches
4759 # (XX.Y-STABLE) but it should work for XX-Y-RELEASE
4761 if test "$VGCONF_OS" = "freebsd" ; then
4767 AM_CONDITIONAL([FREEBSD_EVENTFD],
4768 [test x$ac_cv_func_eventfd = xyes])
4770 AC_MSG_CHECKING([for the SYS___realpathat syscall (FreeBSD-specific)])
4771 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4772 #include <sys/syscall.h>
4774 return !SYS___realpathat;
4776 freebsd_realpathat_syscall=yes
4777 AC_MSG_RESULT([yes])
4778 AC_DEFINE([FREEBSD_REALPATHAT_SYSCALL], 1,
4779 [Define to 1 if you have the new SYS___realpathat syscall.])
4781 freebsd_realpathat_syscall=no
4784 AM_CONDITIONAL(FREEBSD_REALPATHAT_SYSCALL, test x$freebsd_realpathat_syscall = xyes)
4786 AC_MSG_CHECKING([for syscalls only in FreeBSD 13 and later])
4787 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4788 #include <sys/syscall.h>
4790 return !SYS_aio_readv;
4792 freebsd_syscall13=yes
4793 AC_MSG_RESULT([yes])
4794 AC_DEFINE([FREEBSD_SYSCALL13], 1,
4795 [Define to 1 if you are using FreeBSD 13 or later.])
4797 freebsd_syscall13=no
4800 AM_CONDITIONAL(FREEBSD_SYSCALL13, test x$freebsd_syscall13 = xyes)
4802 AC_MSG_CHECKING([for the SYS_kqueuex syscall (FreeBSD-specific)])
4803 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4804 #include <sys/syscall.h>
4806 return !SYS_kqueuex;
4808 freebsd_kqueuex_syscall=yes
4809 AC_MSG_RESULT([yes])
4810 AC_DEFINE([FREEBSD_KQUEUEX_SYSCALL], 1,
4811 [Define to 1 if you have the new SYS___realpathat syscall.])
4813 freebsd_kqueuex_syscall=no
4816 AM_CONDITIONAL(FREEBSD_KQUEUEX_SYSCALL, test x$freebsd_kqueuex_syscall = xyes)
4818 AC_MSG_CHECKING([for the SYS_timerfd_create syscall (FreeBSD-specific)])
4819 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4820 #include <sys/syscall.h>
4822 return !SYS_timerfd_create;
4824 freebsd_timerfd_syscall=yes
4825 AC_MSG_RESULT([yes])
4826 AC_DEFINE([FREEBSD_TIMERFD_SYSCALL], 1,
4827 [Define to 1 if you have the new SYS_timer_fd_create syscall.])
4829 freebsd_timerfd_syscall=no
4832 AM_CONDITIONAL(FREEBSD_TIMERFD_SYSCALL, test x$freebsd_timerfd_syscall = xyes)
4834 AC_MSG_CHECKING([for syscalls only in FreeBSD 15 and later])
4835 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4836 #include <sys/syscall.h>
4838 return !SYS_getrlimitusage;
4840 freebsd_syscall15=yes
4841 AC_MSG_RESULT([yes])
4842 AC_DEFINE([FREEBSD_SYSCALL15], 1,
4843 [Define to 1 if you are using FreeBSD 15 or later.])
4845 freebsd_syscall15=no
4848 AM_CONDITIONAL(FREEBSD_SYSCALL15, test x$freebsd_syscall15 = xyes)
4852 AM_CONDITIONAL(FREEBSD_EVENTFD, false)
4853 AM_CONDITIONAL(FREEBSD_REALPATHAT_SYSCALL, false)
4854 AM_CONDITIONAL(FREEBSD_SYSCALL13, false)
4855 AM_CONDITIONAL(FREEBSD_KQUEUEX_SYSCALL, false)
4856 AM_CONDITIONAL(FREEBSD_TIMERFD_SYSCALL, false)
4857 AM_CONDITIONAL(FREEBSD_SYSCALL15, false)
4859 fi # test "$VGCONF_OS" = "freebsd"
4862 #----------------------------------------------------------------------------
4863 # Checks for C header files.
4864 #----------------------------------------------------------------------------
4866 AC_CHECK_HEADERS([ \
4884 # Verify whether the <linux/futex.h> header is usable.
4885 AC_MSG_CHECKING([if <linux/futex.h> is usable])
4887 save_CFLAGS="$CFLAGS"
4888 CFLAGS="$CFLAGS -D__user="
4889 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4890 #include <linux/futex.h>
4894 ac_have_usable_linux_futex_h=yes
4895 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
4896 [Define to 1 if you have a usable <linux/futex.h> header file.])
4897 AC_MSG_RESULT([yes])
4899 ac_have_usable_linux_futex_h=no
4902 CFLAGS="$save_CFLAGS"
4905 #----------------------------------------------------------------------------
4906 # Checks for typedefs, structures, and compiler characteristics.
4907 #----------------------------------------------------------------------------
4911 AC_CHECK_HEADERS_ONCE([sys/time.h])
4913 AC_CHECK_TYPE([struct statx], [
4914 AC_DEFINE([HAVE_STRUCT_STATX_IN_SYS_STAT_H], 1,
4915 [Define to 1 if <sys/stat.h> declares struct statx.])
4918 #include <sys/stat.h>
4922 #----------------------------------------------------------------------------
4923 # Checks for library functions.
4924 #----------------------------------------------------------------------------
4928 AC_CHECK_LIB([pthread], [pthread_create])
4929 AC_CHECK_LIB([rt], [clock_gettime])
4951 pthread_barrier_init \
4952 pthread_condattr_setclock \
4953 pthread_mutex_timedlock \
4954 pthread_rwlock_timedrdlock \
4955 pthread_rwlock_timedwrlock \
4956 pthread_setname_np \
4985 free_aligned_sized \
4995 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
4996 # libraries with any shared object and/or executable. This is NOT what we
4997 # want for e.g. vgpreload_core-x86-linux.so
5000 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
5001 [test x$ac_cv_func_pthread_barrier_init = xyes])
5002 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
5003 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
5004 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
5005 [test x$ac_cv_func_pthread_spin_lock = xyes])
5006 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
5007 [test x$ac_cv_func_pthread_setname_np = xyes])
5008 AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
5009 [test x$ac_cv_func_copy_file_range = xyes])
5010 AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
5011 [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
5012 AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
5013 [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes])
5014 AM_CONDITIONAL([HAVE_SETCONTEXT], [test x$ac_cv_func_setcontext = xyes])
5015 AM_CONDITIONAL([HAVE_SWAPCONTEXT], [test x$ac_cv_func_swapcontext = xyes])
5016 AM_CONDITIONAL([HAVE_MEMFD_CREATE],
5017 [test x$ac_cv_func_memfd_create = xyes])
5018 AM_CONDITIONAL([HAVE_GETADDRINFO],
5019 [test x$ac_cv_func_getaddrinfo = xyes])
5020 AM_CONDITIONAL([HAVE_CLOSE_RANGE],
5021 [test x$ac_cv_func_close_range = xyes])
5022 AM_CONDITIONAL([HAVE_REALLOCARRAY],
5023 [test x$ac_cv_func_reallocarray = xyes])
5024 AM_CONDITIONAL([HAVE_WCSNCPY],
5025 [test x$ac_cv_func_wcsncpy = xyes])
5026 AM_CONDITIONAL([HAVE_STRLCAT],
5027 [test x$ac_cv_func_strlcat = xyes])
5028 AM_CONDITIONAL([HAVE_STRLCPY],
5029 [test x$ac_cv_func_strlcpy = xyes])
5030 AM_CONDITIONAL([HAVE_FREE_ALIGNED_SIZED],
5031 [test x$ac_cv_func_free_aligned_sized = xyes])
5032 AM_CONDITIONAL([HAVE_SBRK],
5033 [test x$ac_cv_func_sbrk = xyes])
5034 AM_CONDITIONAL([HAVE_WCPNCPY],
5035 [test x$ac_cv_func_wcpncpy = xyes])
5036 AM_CONDITIONAL([HAVE_WCSXFRM],
5037 [test x$ac_cv_func_wcsxfrm = xyes])
5038 AM_CONDITIONAL([HAVE_SEM_TIMEDWAIT],
5039 [test x$ac_cv_func_sem_timedwait = xyes])
5040 AM_CONDITIONAL([HAVE_SEM_CLOCKWAIT_NP],
5041 [test x$ac_cv_func_sem_clockwait_np = xyes])
5042 AM_CONDITIONAL([HAVE_FDATASYNC],
5043 [test x$ac_cv_func_fdatasync = xyes])
5044 AM_CONDITIONAL([HAVE_GETRANDOM],
5045 [test x$ac_cv_func_getrandom = xyes])
5047 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5048 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5049 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX; then
5050 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
5051 [Disable intercept pthread_spin_lock() on MIPS32, MIPS64 and nanoMIPS.])
5054 #----------------------------------------------------------------------------
5056 #----------------------------------------------------------------------------
5057 # Do we have a useable MPI setup on the primary and/or secondary targets?
5058 # On Linux, by default, assumes mpicc and -m32/-m64
5059 # Note: this is a kludge in that it assumes the specified mpicc
5060 # understands -m32/-m64 regardless of what is specified using
5062 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
5063 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
5066 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
5067 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
5068 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
5069 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
5070 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5071 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX \
5072 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
5073 mflag_primary=$FLAG_M32
5074 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
5075 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
5076 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
5077 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
5078 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD \
5079 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5080 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
5081 mflag_primary=$FLAG_M64
5082 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
5083 mflag_primary="$FLAG_M32 -arch i386"
5084 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
5085 mflag_primary="$FLAG_M64 -arch x86_64"
5089 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
5090 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
5091 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
5092 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX \
5093 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD ; then
5094 mflag_secondary=$FLAG_M32
5095 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
5096 mflag_secondary="$FLAG_M32 -arch i386"
5101 [ --with-mpicc= Specify name of MPI2-ised C compiler],
5106 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
5107 ## use these values in the check for a functioning mpicc.
5109 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
5110 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
5111 AM_COND_IF([VGCONF_OS_IS_LINUX],
5112 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5113 LDFLAGS_MPI="-fpic -shared"])
5114 AM_COND_IF([VGCONF_OS_IS_FREEBSD],
5115 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5116 LDFLAGS_MPI="-fpic -shared"])
5117 AM_COND_IF([VGCONF_OS_IS_DARWIN],
5118 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
5119 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
5120 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
5121 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5122 LDFLAGS_MPI="-fpic -shared"])
5124 AC_SUBST([CFLAGS_MPI])
5125 AC_SUBST([LDFLAGS_MPI])
5128 ## See if MPI_CC works for the primary target
5130 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
5132 saved_CFLAGS=$CFLAGS
5134 CFLAGS="$CFLAGS_MPI $mflag_primary"
5135 saved_LDFLAGS="$LDFLAGS"
5136 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
5137 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5141 int ni, na, nd, comb;
5142 int r = MPI_Init(NULL,NULL);
5143 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5144 r |= MPI_Finalize();
5147 ac_have_mpi2_pri=yes
5148 AC_MSG_RESULT([yes, $MPI_CC])
5154 CFLAGS=$saved_CFLAGS
5155 LDFLAGS="$saved_LDFLAGS"
5156 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
5158 ## See if MPI_CC works for the secondary target. Complication: what if
5159 ## there is no secondary target? We need this to then fail.
5160 ## Kludge this by making MPI_CC something which will surely fail in
5163 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
5165 saved_CFLAGS=$CFLAGS
5166 saved_LDFLAGS="$LDFLAGS"
5167 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
5168 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
5169 CC="$MPI_CC this will surely fail"
5173 CFLAGS="$CFLAGS_MPI $mflag_secondary"
5174 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5178 int ni, na, nd, comb;
5179 int r = MPI_Init(NULL,NULL);
5180 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5181 r |= MPI_Finalize();
5184 ac_have_mpi2_sec=yes
5185 AC_MSG_RESULT([yes, $MPI_CC])
5191 CFLAGS=$saved_CFLAGS
5192 LDFLAGS="$saved_LDFLAGS"
5193 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
5195 #----------------------------------------------------------------------------
5197 #----------------------------------------------------------------------------
5198 AC_MSG_CHECKING([if static libc is available])
5200 saved_LDFLAGS="$LDFLAGS"
5201 LDFLAGS="-nostdlib -lc -static"
5202 AC_LINK_IFELSE([AC_LANG_SOURCE([[
5207 ac_have_static_libc=yes
5208 AC_MSG_RESULT([yes])
5210 ac_have_static_libc=no
5213 LDFLAGS="$saved_LDFLAGS"
5214 AM_CONDITIONAL(HAVE_STATIC_LIBC, test x$ac_have_static_libc = xyes)
5217 #----------------------------------------------------------------------------
5218 # Other library checks
5219 #----------------------------------------------------------------------------
5220 # There now follow some tests for Boost, and OpenMP. These
5221 # tests are present because Drd has some regression tests that use
5222 # these packages. All regression test programs all compiled only
5223 # for the primary target. And so it is important that the configure
5224 # checks that follow, use the correct -m32 or -m64 flag for the
5225 # primary target (called $mflag_primary). Otherwise, we can end up
5226 # in a situation (eg) where, on amd64-linux, the test for Boost checks
5227 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
5228 # only build (meaning, the primary target is x86-linux), the build
5229 # of the regtest programs that use Boost fails, because they are
5230 # build as 32-bit (IN THIS EXAMPLE).
5232 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
5233 # NEEDED BY THE REGRESSION TEST PROGRAMS.
5236 # Check whether the boost library 1.35 or later has been installed.
5237 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
5239 AC_MSG_CHECKING([for boost])
5242 safe_CXXFLAGS=$CXXFLAGS
5243 CXXFLAGS="$mflag_primary"
5245 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
5247 AC_LINK_IFELSE([AC_LANG_SOURCE([
5248 #include <boost/thread.hpp>
5249 static void thread_func(void)
5251 int main(int argc, char** argv)
5253 boost::thread t(thread_func);
5258 ac_have_boost_1_35=yes
5259 AC_SUBST([BOOST_CFLAGS], [])
5260 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
5261 AC_MSG_RESULT([yes])
5263 ac_have_boost_1_35=no
5268 CXXFLAGS=$safe_CXXFLAGS
5271 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
5274 # does this compiler support -fopenmp, does it have the include file
5275 # <omp.h> and does it have libgomp ?
5277 AC_MSG_CHECKING([for OpenMP])
5280 CFLAGS="-fopenmp $mflag_primary -Werror"
5282 AC_LINK_IFELSE([AC_LANG_SOURCE([
5284 int main(int argc, char** argv)
5292 AC_MSG_RESULT([yes])
5299 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
5302 # Check for __builtin_popcount
5303 AC_MSG_CHECKING([for __builtin_popcount()])
5304 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5306 __builtin_popcount(2);
5309 AC_MSG_RESULT([yes])
5310 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
5311 [Define to 1 if compiler provides __builtin_popcount().])
5316 # Check for __builtin_clz
5317 AC_MSG_CHECKING([for __builtin_clz()])
5318 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5323 AC_MSG_RESULT([yes])
5324 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
5325 [Define to 1 if compiler provides __builtin_clz().])
5330 # Check for __builtin_ctz
5331 AC_MSG_CHECKING([for __builtin_ctz()])
5332 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5337 AC_MSG_RESULT([yes])
5338 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
5339 [Define to 1 if compiler provides __builtin_ctz().])
5344 # does this compiler have built-in functions for atomic memory access for the
5346 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
5349 CFLAGS="$mflag_primary"
5351 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5353 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5354 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5356 ac_have_builtin_atomic_primary=yes
5357 AC_MSG_RESULT([yes])
5358 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])
5360 ac_have_builtin_atomic_primary=no
5366 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
5367 [test x$ac_have_builtin_atomic_primary = xyes])
5370 # does this compiler have built-in functions for atomic memory access for the
5371 # secondary target ?
5373 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5375 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
5378 CFLAGS="$mflag_secondary"
5380 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5382 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
5384 ac_have_builtin_atomic_secondary=yes
5385 AC_MSG_RESULT([yes])
5387 ac_have_builtin_atomic_secondary=no
5395 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
5396 [test x$ac_have_builtin_atomic_secondary = xyes])
5398 # does this compiler have built-in functions for atomic memory access on
5399 # 64-bit integers for all targets ?
5401 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
5403 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5406 uint64_t variable = 1;
5407 return __sync_add_and_fetch(&variable, 1)
5409 ac_have_builtin_atomic64_primary=yes
5411 ac_have_builtin_atomic64_primary=no
5414 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5417 CFLAGS="$mflag_secondary"
5419 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5422 uint64_t variable = 1;
5423 return __sync_add_and_fetch(&variable, 1)
5425 ac_have_builtin_atomic64_secondary=yes
5427 ac_have_builtin_atomic64_secondary=no
5434 if test x$ac_have_builtin_atomic64_primary = xyes && \
5435 test x$VGCONF_PLATFORM_SEC_CAPS = x \
5436 -o x$ac_have_builtin_atomic64_secondary = xyes; then
5437 AC_MSG_RESULT([yes])
5438 ac_have_builtin_atomic64=yes
5441 ac_have_builtin_atomic64=no
5444 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
5445 [test x$ac_have_builtin_atomic64 = xyes])
5448 AC_MSG_CHECKING([if platform has openat2 syscall])
5450 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5451 #include <sys/syscall.h>
5456 AC_MSG_RESULT([yes])
5462 AM_CONDITIONAL([HAVE_OPENAT2],
5463 [test x$ac_have_openat2 = xyes])
5469 AC_MSG_CHECKING([if platform has openssl crypto])
5471 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5472 #include <openssl/crypto.h>
5474 CRYPTO_secure_malloc_init(1<<20, 8);
5477 AC_MSG_RESULT([yes])
5484 AM_CONDITIONAL([HAVE_OPENSSL],
5485 [test x$ac_have_openssl = xyes])
5487 AC_MSG_CHECKING([if platform has aio_readv])
5489 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5495 ac_have_aio_readv=yes
5496 AC_MSG_RESULT([yes])
5499 ac_have_aio_readv=no
5503 AM_CONDITIONAL([HAVE_AIO_READV],
5504 [test x$ac_have_aio_readv = xyes])
5506 # does g++ have built-in functions for atomic memory access ?
5507 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
5509 safe_CXXFLAGS=$CXXFLAGS
5510 CXXFLAGS="$mflag_primary"
5513 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5515 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5516 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5518 ac_have_builtin_atomic_cxx=yes
5519 AC_MSG_RESULT([yes])
5520 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
5522 ac_have_builtin_atomic_cxx=no
5527 CXXFLAGS=$safe_CXXFLAGS
5529 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
5532 if test x$ac_have_usable_linux_futex_h = xyes \
5533 -a x$ac_have_builtin_atomic_primary = xyes; then
5534 ac_enable_linux_ticket_lock_primary=yes
5536 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
5537 [test x$ac_enable_linux_ticket_lock_primary = xyes])
5539 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
5540 -a x$ac_have_usable_linux_futex_h = xyes \
5541 -a x$ac_have_builtin_atomic_secondary = xyes; then
5542 ac_enable_linux_ticket_lock_secondary=yes
5544 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
5545 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
5548 # does libstdc++ support annotating shared pointers ?
5549 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
5551 safe_CXXFLAGS=$CXXFLAGS
5552 CXXFLAGS="-std=c++0x"
5555 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5558 std::shared_ptr<int> p
5560 ac_have_shared_ptr=yes
5562 ac_have_shared_ptr=no
5564 if test x$ac_have_shared_ptr = xyes; then
5565 # If compilation of the program below fails because of a syntax error
5566 # triggered by substituting one of the annotation macros then that
5567 # means that libstdc++ supports these macros.
5568 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5569 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
5570 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
5573 std::shared_ptr<int> p
5575 ac_have_shared_pointer_annotation=no
5578 ac_have_shared_pointer_annotation=yes
5579 AC_MSG_RESULT([yes])
5580 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
5581 [Define to 1 if libstd++ supports annotating shared pointers])
5584 ac_have_shared_pointer_annotation=no
5589 CXXFLAGS=$safe_CXXFLAGS
5591 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
5592 [test x$ac_have_shared_pointer_annotation = xyes])
5594 # checking for GNU libc C17 aligned_alloc
5595 # just check glibc version rather than trying to muck around
5596 # checking the runtime behaviour or seeing if it is a weak alias
5597 AC_MSG_CHECKING([for AT_GNU_LIBC_C17_ALIGNED_ALLOC])
5598 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5599 #include <features.h>
5601 #if !defined(__GLIBC__) || __GLIBC__ != 2 || !defined(__GLIBC_MINOR__) || __GLIBC_MINOR__ < 38
5602 #error "not GNU libc 2.38 or later"
5605 AC_MSG_RESULT([yes])
5606 AC_DEFINE([HAVE_GNU_LIBC_C17_ALIGNED_ALLOC], 1,
5607 [Define to 1 if you have GNU libc C17 aligned_alloc.])
5613 # Check for C11 thrd_create()
5614 AC_MSG_CHECKING([for thrd_create()])
5615 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
5616 #include <threads.h>
5617 int thrd_entry(void *arg) { return 0; }
5618 ], [[thrd_t thr; return thrd_create(&thr, thrd_entry, NULL);]])],
5620 ac_cxx_have_thrd_create=yes
5621 AC_MSG_RESULT([yes])
5623 ac_cxx_have_thrd_create=no
5627 AM_CONDITIONAL(HAVE_THRD_CREATE, test x$ac_cxx_have_thrd_create = xyes)
5632 CFLAGS="${CFLAGS} -march=armv8.2-a+sha3"
5633 AC_MSG_CHECKING([for sha3])
5634 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
5639 AC_MSG_RESULT([yes])
5645 AM_CONDITIONAL(HAVE_SHA3, test x$ac_have_sha3 = xyes)
5648 #----------------------------------------------------------------------------
5649 # Ok. We're done checking.
5650 #----------------------------------------------------------------------------
5652 # Nb: VEX/Makefile is generated from Makefile.vex.in.
5655 VEX/Makefile:Makefile.vex.in
5659 glibc-2.X-helgrind.supp
5663 docs/xml/vg-entities.xml
5668 gdbserver_tests/Makefile
5669 gdbserver_tests/solaris/Makefile
5675 memcheck/tests/Makefile
5676 memcheck/tests/common/Makefile
5677 memcheck/tests/amd64/Makefile
5678 memcheck/tests/arm64/Makefile
5679 memcheck/tests/x86/Makefile
5680 memcheck/tests/linux/Makefile
5681 memcheck/tests/linux/debuginfod-check.vgtest
5682 memcheck/tests/darwin/Makefile
5683 memcheck/tests/solaris/Makefile
5684 memcheck/tests/freebsd/Makefile
5685 memcheck/tests/amd64-linux/Makefile
5686 memcheck/tests/arm64-linux/Makefile
5687 memcheck/tests/x86-linux/Makefile
5688 memcheck/tests/amd64-solaris/Makefile
5689 memcheck/tests/x86-solaris/Makefile
5690 memcheck/tests/amd64-freebsd/Makefile
5691 memcheck/tests/x86-freebsd/Makefile
5692 memcheck/tests/ppc32/Makefile
5693 memcheck/tests/ppc64/Makefile
5694 memcheck/tests/s390x/Makefile
5695 memcheck/tests/mips32/Makefile
5696 memcheck/tests/mips64/Makefile
5697 memcheck/tests/vbit-test/Makefile
5699 cachegrind/tests/Makefile
5700 cachegrind/tests/x86/Makefile
5701 cachegrind/cg_annotate
5705 callgrind/callgrind_annotate
5706 callgrind/callgrind_control
5707 callgrind/tests/Makefile
5709 helgrind/tests/Makefile
5711 drd/scripts/download-and-build-splash2
5714 massif/tests/Makefile
5719 lackey/tests/Makefile
5722 none/tests/scripts/Makefile
5723 none/tests/amd64/Makefile
5724 none/tests/ppc32/Makefile
5725 none/tests/ppc64/Makefile
5726 none/tests/x86/Makefile
5727 none/tests/arm/Makefile
5728 none/tests/arm64/Makefile
5729 none/tests/s390x/Makefile
5730 none/tests/mips32/Makefile
5731 none/tests/mips64/Makefile
5732 none/tests/nanomips/Makefile
5733 none/tests/linux/Makefile
5734 none/tests/darwin/Makefile
5735 none/tests/solaris/Makefile
5736 none/tests/freebsd/Makefile
5737 none/tests/amd64-linux/Makefile
5738 none/tests/x86-linux/Makefile
5739 none/tests/amd64-darwin/Makefile
5740 none/tests/x86-darwin/Makefile
5741 none/tests/amd64-solaris/Makefile
5742 none/tests/x86-solaris/Makefile
5743 none/tests/x86-freebsd/Makefile
5745 exp-bbv/tests/Makefile
5746 exp-bbv/tests/x86/Makefile
5747 exp-bbv/tests/x86-linux/Makefile
5748 exp-bbv/tests/amd64-linux/Makefile
5749 exp-bbv/tests/ppc32-linux/Makefile
5750 exp-bbv/tests/arm-linux/Makefile
5754 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
5755 [chmod +x coregrind/link_tool_exe_linux])
5756 AC_CONFIG_FILES([coregrind/link_tool_exe_freebsd],
5757 [chmod +x coregrind/link_tool_exe_freebsd])
5758 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
5759 [chmod +x coregrind/link_tool_exe_darwin])
5760 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
5761 [chmod +x coregrind/link_tool_exe_solaris])
5762 AC_CONFIG_FILES([tests/filter_stderr_basic],
5763 [chmod +x tests/filter_stderr_basic])
5764 AC_CONFIG_FILES([tests/filter_discards],
5765 [chmod +x tests/filter_discards])
5766 AC_CONFIG_FILES([memcheck/tests/filter_stderr],
5767 [chmod +x memcheck/tests/filter_stderr])
5768 AC_CONFIG_FILES([memcheck/tests/filter_dw4],
5769 [chmod +x memcheck/tests/filter_dw4])
5770 AC_CONFIG_FILES([memcheck/tests/filter_overlaperror],
5771 [chmod +x memcheck/tests/filter_overlaperror])
5772 AC_CONFIG_FILES([memcheck/tests/filter_supp],
5773 [chmod +x memcheck/tests/filter_supp])
5774 AC_CONFIG_FILES([memcheck/tests/x86/filter_pushfpopf],
5775 [chmod +x memcheck/tests/x86/filter_pushfpopf])
5776 AC_CONFIG_FILES([gdbserver_tests/filter_gdb],
5777 [chmod +x gdbserver_tests/filter_gdb])
5778 AC_CONFIG_FILES([gdbserver_tests/filter_memcheck_monitor],
5779 [chmod +x gdbserver_tests/filter_memcheck_monitor])
5780 AC_CONFIG_FILES([gdbserver_tests/filter_stderr],
5781 [chmod +x gdbserver_tests/filter_stderr])
5782 AC_CONFIG_FILES([gdbserver_tests/filter_vgdb],
5783 [chmod +x gdbserver_tests/filter_vgdb])
5784 AC_CONFIG_FILES([drd/tests/filter_stderr],
5785 [chmod +x drd/tests/filter_stderr])
5786 AC_CONFIG_FILES([drd/tests/filter_error_count],
5787 [chmod +x drd/tests/filter_error_count])
5788 AC_CONFIG_FILES([drd/tests/filter_error_summary],
5789 [chmod +x drd/tests/filter_error_summary])
5790 AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
5791 [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
5792 AC_CONFIG_FILES([drd/tests/filter_thread_no],
5793 [chmod +x drd/tests/filter_thread_no])
5794 AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
5795 [chmod +x drd/tests/filter_xml_and_thread_no])
5796 AC_CONFIG_FILES([helgrind/tests/filter_stderr],
5797 [chmod +x helgrind/tests/filter_stderr])
5803 Maximum build arch: ${ARCH_MAX}
5804 Primary build arch: ${VGCONF_ARCH_PRI}
5805 Secondary build arch: ${VGCONF_ARCH_SEC}
5806 Build OS: ${VGCONF_OS}
5807 Link Time Optimisation: ${vg_cv_lto}
5808 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
5809 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
5810 Platform variant: ${VGCONF_PLATVARIANT}
5811 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
5812 Default supp files: ${DEFAULT_SUPP}