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], [22])
19 m4_define([v_micro_ver], [0])
20 m4_define([v_suffix_ver], [GIT])
21 m4_define([v_rel_date], ["?? Oct 2023"])
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 case "${host_cpu}" in
242 AC_MSG_RESULT([ok (${host_cpu})])
247 AC_MSG_RESULT([ok (${host_cpu})])
252 # this only referrs to 64-bit Big Endian
253 AC_MSG_RESULT([ok (${host_cpu})])
258 # this only referrs to 64-bit Little Endian
259 AC_MSG_RESULT([ok (${host_cpu})])
264 # On Linux this means only a 32-bit capable CPU.
265 AC_MSG_RESULT([ok (${host_cpu})])
270 AC_MSG_RESULT([ok (${host_cpu})])
275 AC_MSG_RESULT([ok (${host_cpu})])
280 AC_MSG_RESULT([ok (${host_cpu})])
285 AC_MSG_RESULT([ok (${host_cpu})])
290 AC_MSG_RESULT([ok (${host_cpu})])
295 AC_MSG_RESULT([ok (${host_cpu})])
300 AC_MSG_RESULT([ok (${host_cpu})])
305 AC_MSG_RESULT([ok (${host_cpu})])
309 AC_MSG_RESULT([ok (${host_cpu})])
314 AC_MSG_RESULT([no (${host_cpu})])
315 AC_MSG_ERROR([Unsupported host architecture. Sorry])
319 #----------------------------------------------------------------------------
321 # Sometimes it's convenient to subvert the bi-arch build system and
322 # just have a single build even though the underlying platform is
323 # capable of both. Hence handle --enable-only64bit and
324 # --enable-only32bit. Complain if both are issued :-)
325 # [Actually, if either of these options are used, I think both get built,
326 # but only one gets installed. So if you use an in-place build, both can be
329 # Check if a 64-bit only build has been requested
330 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
331 [AC_ARG_ENABLE(only64bit,
332 [ --enable-only64bit do a 64-bit only build],
333 [vg_cv_only64bit=$enableval],
334 [vg_cv_only64bit=no])])
336 # Check if a 32-bit only build has been requested
337 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
338 [AC_ARG_ENABLE(only32bit,
339 [ --enable-only32bit do a 32-bit only build],
340 [vg_cv_only32bit=$enableval],
341 [vg_cv_only32bit=no])])
344 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
346 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
349 #----------------------------------------------------------------------------
351 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
352 # compilation of many C files via -VGO_$(VGCONF_OS) and
353 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
354 AC_MSG_CHECKING([for a supported OS])
361 AC_MSG_RESULT([ok (${host_os})])
364 # Ok, this is linux. Check the kernel version
365 AC_MSG_CHECKING([for the kernel version])
370 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
371 AC_MSG_RESULT([unsupported (${kernel})])
372 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
376 AC_MSG_RESULT([2.6 or later (${kernel})])
383 AC_MSG_RESULT([ok (${host_os})])
385 AC_DEFINE([FREEBSD_10], 1000, [FREEBSD_VERS value for FreeBSD 10.x])
387 AC_DEFINE([FREEBSD_11], 1100, [FREEBSD_VERS value for FreeBSD 11.x])
389 AC_DEFINE([FREEBSD_12], 1200, [FREEBSD_VERS value for FreeBSD 12.0 to 12.1])
391 AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2])
393 AC_DEFINE([FREEBSD_13_0], 1300, [FREEBSD_VERS value for FreeBSD 13.0])
395 AC_DEFINE([FREEBSD_13_1], 1310, [FREEBSD_VERS value for FreeBSD 13.1])
397 AC_DEFINE([FREEBSD_13_2], 1320, [FREEBSD_VERS value for FreeBSD 13.2])
399 AC_DEFINE([FREEBSD_14], 1400, [FREEBSD_VERS value for FreeBSD 14.x])
402 AC_MSG_CHECKING([for the kernel version])
407 AC_MSG_RESULT([FreeBSD 10.x (${kernel})])
408 AC_DEFINE([FREEBSD_VERS], FREEBSD_10, [FreeBSD version])
409 freebsd_vers=$freebsd_10
412 AC_MSG_RESULT([FreeBSD 11.x (${kernel})])
413 AC_DEFINE([FREEBSD_VERS], FREEBSD_11, [FreeBSD version])
414 freebsd_vers=$freebsd_11
419 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
420 AC_DEFINE([FREEBSD_VERS], FREEBSD_12, [FreeBSD version])
421 freebsd_vers=$freebsd_12
424 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
425 AC_DEFINE([FREEBSD_VERS], FREEBSD_12_2, [FreeBSD version])
426 freebsd_vers=$freebsd_12_2
433 AC_MSG_RESULT([FreeBSD 13.0 (${kernel})])
434 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_0, [FreeBSD version])
435 freebsd_vers=$freebsd_13_0
438 AC_MSG_RESULT([FreeBSD 13.1 (${kernel})])
439 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_1, [FreeBSD version])
440 freebsd_vers=$freebsd_13_1
443 AC_MSG_RESULT([FreeBSD 13.2 (${kernel})])
444 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_2, [FreeBSD version])
445 freebsd_vers=$freebsd_13_2
448 AC_MSG_RESULT([unsupported (${kernel})])
449 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 14.x])
454 AC_MSG_RESULT([FreeBSD 14.x (${kernel})])
455 AC_DEFINE([FREEBSD_VERS], FREEBSD_14, [FreeBSD version])
456 freebsd_vers=$freebsd_14
459 AC_MSG_RESULT([unsupported (${kernel})])
460 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 14.x])
464 DEFAULT_SUPP="$srcdir/freebsd.supp $srcdir/freebsd-helgrind.supp $srcdir/freebsd-drd.supp ${DEFAULT_SUPP}"
468 AC_MSG_RESULT([ok (${host_os})])
470 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
471 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
472 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
473 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
474 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
475 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
476 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
477 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
478 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
480 AC_MSG_CHECKING([for the kernel version])
483 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
484 # has only one relevant version, the OS version. The `uname` check
485 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
486 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
487 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
488 # and we don't know of an macros similar to __GLIBC__ to get that info.
490 # XXX: `uname -r` won't do the right thing for cross-compiles, but
491 # that's not a problem yet.
493 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
494 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
495 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
496 # time support for 10.5 (the 9.* pattern just below), I'll leave it
497 # in for now, just in case anybody wants to give it a try. But I'm
498 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
501 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
502 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
503 DEFAULT_SUPP="$srcdir/darwin9.supp ${DEFAULT_SUPP}"
504 DEFAULT_SUPP="$srcdir/darwin9-drd.supp ${DEFAULT_SUPP}"
507 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
508 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
509 DEFAULT_SUPP="$srcdir/darwin10.supp ${DEFAULT_SUPP}"
510 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
513 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
514 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
515 DEFAULT_SUPP="$srcdir/darwin11.supp ${DEFAULT_SUPP}"
516 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
519 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
520 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
521 DEFAULT_SUPP="$srcdir/darwin12.supp ${DEFAULT_SUPP}"
522 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
525 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
526 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
527 DEFAULT_SUPP="$srcdir/darwin13.supp ${DEFAULT_SUPP}"
528 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
531 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
532 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
533 DEFAULT_SUPP="$srcdir/darwin14.supp ${DEFAULT_SUPP}"
534 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
537 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
538 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
539 DEFAULT_SUPP="$srcdir/darwin15.supp ${DEFAULT_SUPP}"
540 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
543 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
544 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
545 DEFAULT_SUPP="$srcdir/darwin16.supp ${DEFAULT_SUPP}"
546 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
549 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
550 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
551 DEFAULT_SUPP="$srcdir/darwin17.supp ${DEFAULT_SUPP}"
552 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
555 AC_MSG_RESULT([unsupported (${kernel})])
556 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)])
562 AC_MSG_RESULT([ok (${host_os})])
565 uname_v=$( uname -v )
568 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
571 DEFAULT_SUPP="$srcdir/solaris11.supp ${DEFAULT_SUPP}"
577 AC_MSG_RESULT([ok (${host_os})])
579 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
583 AC_MSG_RESULT([no (${host_os})])
584 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
588 #----------------------------------------------------------------------------
590 # If we are building on a 64 bit platform test to see if the system
591 # supports building 32 bit programs and disable 32 bit support if it
592 # does not support building 32 bit programs
594 case "$ARCH_MAX-$VGCONF_OS" in
595 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
596 AC_MSG_CHECKING([for 32 bit build support])
599 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
604 vg_cv_only64bit="yes"
607 CFLAGS=$safe_CFLAGS;;
609 AC_MSG_CHECKING([for 32 bit build support])
611 CFLAGS="$CFLAGS -mips32 -mabi=32"
612 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
613 #include <sys/prctl.h>
617 vg_cv_only64bit="yes"
620 CFLAGS=$safe_CFLAGS;;
623 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
625 [--enable-only32bit was specified but system does not support 32 bit builds])
628 #----------------------------------------------------------------------------
630 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
631 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
632 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
633 # above) will be "amd64" since that reflects the most that this cpu can do,
634 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
635 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
636 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
637 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
638 AC_SUBST(VGCONF_ARCH_PRI)
640 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
641 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
642 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
643 # It is empty if there is no secondary target.
644 AC_SUBST(VGCONF_ARCH_SEC)
646 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
647 # The entire system, including regression and performance tests, will be
648 # built for this target. The "_CAPS" indicates that the name is in capital
649 # letters, and it also uses '_' rather than '-' as a separator, because it's
650 # used to create various Makefile variables, which are all in caps by
651 # convention and cannot contain '-' characters. This is in contrast to
652 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
653 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
655 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
656 # Valgrind and tools will also be built for this target, but not the
657 # regression or performance tests.
659 # By default, the primary arch is the same as the "max" arch, as commented
660 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
661 # the big case statement just below here, in the case where we're building
662 # on a 64 bit machine but have been requested only to do a 32 bit build.
663 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
665 AC_MSG_CHECKING([for a supported CPU/OS combination])
667 # NB. The load address for a given platform may be specified in more
668 # than one place, in some cases, depending on whether we're doing a biarch,
669 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
670 # Be careful to give consistent values in all subcases. Also, all four
671 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
672 # even if it is to "0xUNSET".
674 case "$ARCH_MAX-$VGCONF_OS" in
676 VGCONF_ARCH_PRI="x86"
678 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
679 VGCONF_PLATFORM_SEC_CAPS=""
680 valt_load_address_pri_norml="0x58000000"
681 valt_load_address_pri_inner="0x38000000"
682 valt_load_address_sec_norml="0xUNSET"
683 valt_load_address_sec_inner="0xUNSET"
684 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
687 valt_load_address_sec_norml="0xUNSET"
688 valt_load_address_sec_inner="0xUNSET"
689 if test x$vg_cv_only64bit = xyes; then
690 VGCONF_ARCH_PRI="amd64"
692 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
693 VGCONF_PLATFORM_SEC_CAPS=""
694 valt_load_address_pri_norml="0x58000000"
695 valt_load_address_pri_inner="0x38000000"
696 elif test x$vg_cv_only32bit = xyes; then
697 VGCONF_ARCH_PRI="x86"
699 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
700 VGCONF_PLATFORM_SEC_CAPS=""
701 valt_load_address_pri_norml="0x58000000"
702 valt_load_address_pri_inner="0x38000000"
704 VGCONF_ARCH_PRI="amd64"
705 VGCONF_ARCH_SEC="x86"
706 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
707 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
708 valt_load_address_pri_norml="0x58000000"
709 valt_load_address_pri_inner="0x38000000"
710 valt_load_address_sec_norml="0x58000000"
711 valt_load_address_sec_inner="0x38000000"
713 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
716 VGCONF_ARCH_PRI="ppc32"
718 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
719 VGCONF_PLATFORM_SEC_CAPS=""
720 valt_load_address_pri_norml="0x58000000"
721 valt_load_address_pri_inner="0x38000000"
722 valt_load_address_sec_norml="0xUNSET"
723 valt_load_address_sec_inner="0xUNSET"
724 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
727 valt_load_address_sec_norml="0xUNSET"
728 valt_load_address_sec_inner="0xUNSET"
729 if test x$vg_cv_only64bit = xyes; then
730 VGCONF_ARCH_PRI="ppc64be"
732 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
733 VGCONF_PLATFORM_SEC_CAPS=""
734 valt_load_address_pri_norml="0x58000000"
735 valt_load_address_pri_inner="0x38000000"
736 elif test x$vg_cv_only32bit = xyes; then
737 VGCONF_ARCH_PRI="ppc32"
739 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
740 VGCONF_PLATFORM_SEC_CAPS=""
741 valt_load_address_pri_norml="0x58000000"
742 valt_load_address_pri_inner="0x38000000"
744 VGCONF_ARCH_PRI="ppc64be"
745 VGCONF_ARCH_SEC="ppc32"
746 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
747 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
748 valt_load_address_pri_norml="0x58000000"
749 valt_load_address_pri_inner="0x38000000"
750 valt_load_address_sec_norml="0x58000000"
751 valt_load_address_sec_inner="0x38000000"
753 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
756 # Little Endian is only supported on PPC64
757 valt_load_address_sec_norml="0xUNSET"
758 valt_load_address_sec_inner="0xUNSET"
759 VGCONF_ARCH_PRI="ppc64le"
761 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
762 VGCONF_PLATFORM_SEC_CAPS=""
763 valt_load_address_pri_norml="0x58000000"
764 valt_load_address_pri_inner="0x38000000"
765 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
768 VGCONF_ARCH_PRI="x86"
770 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
771 VGCONF_PLATFORM_SEC_CAPS=""
772 valt_load_address_pri_norml="0x38000000"
773 valt_load_address_pri_inner="0x28000000"
774 valt_load_address_sec_norml="0xUNSET"
775 valt_load_address_sec_inner="0xUNSET"
776 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
779 if test x$vg_cv_only64bit = xyes; then
780 VGCONF_ARCH_PRI="amd64"
782 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
783 VGCONF_PLATFORM_SEC_CAPS=""
784 elif test x$vg_cv_only32bit = xyes; then
785 VGCONF_ARCH_PRI="x86"
787 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
788 VGCONF_PLATFORM_SEC_CAPS=""
790 VGCONF_ARCH_PRI="amd64"
791 VGCONF_ARCH_SEC="x86"
792 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
793 VGCONF_PLATFORM_SEC_CAPS="X86_FREEBSD"
795 # These work with either base clang or ports installed gcc
796 # Hand rolled compilers probably need INSTALL_DIR/lib (at least for gcc)
797 if test x$is_clang = xclang ; then
798 FLAG_32ON64="-B/usr/lib32"
800 GCC_MAJOR_VERSION=`${CC} -dumpversion | $SED 's/\..*//' 2>/dev/null`
801 FLAG_32ON64="-B/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -Wl,-rpath,/usr/local/lib32/gcc${GCC_MAJOR_VERSION}/"
803 valt_load_address_pri_norml="0x38000000"
804 valt_load_address_pri_inner="0x28000000"
805 valt_load_address_sec_norml="0x38000000"
806 valt_load_address_sec_inner="0x28000000"
807 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
809 # Darwin gets identified as 32-bit even when it supports 64-bit.
810 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
811 # all Macs support both 32-bit and 64-bit, so we just build both. If
812 # someone has a really old 32-bit only machine they can (hopefully?)
813 # build with --enable-only32bit. See bug 243362.
814 x86-darwin|amd64-darwin)
816 valt_load_address_sec_norml="0xUNSET"
817 valt_load_address_sec_inner="0xUNSET"
818 if test x$vg_cv_only64bit = xyes; then
819 VGCONF_ARCH_PRI="amd64"
821 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
822 VGCONF_PLATFORM_SEC_CAPS=""
823 valt_load_address_pri_norml="0x158000000"
824 valt_load_address_pri_inner="0x138000000"
825 elif test x$vg_cv_only32bit = xyes; then
826 VGCONF_ARCH_PRI="x86"
828 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
829 VGCONF_PLATFORM_SEC_CAPS=""
830 VGCONF_ARCH_PRI_CAPS="x86"
831 valt_load_address_pri_norml="0x58000000"
832 valt_load_address_pri_inner="0x38000000"
834 VGCONF_ARCH_PRI="amd64"
835 VGCONF_ARCH_SEC="x86"
836 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
837 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
838 valt_load_address_pri_norml="0x158000000"
839 valt_load_address_pri_inner="0x138000000"
840 valt_load_address_sec_norml="0x58000000"
841 valt_load_address_sec_inner="0x38000000"
843 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
846 VGCONF_ARCH_PRI="arm"
847 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
848 VGCONF_PLATFORM_SEC_CAPS=""
849 valt_load_address_pri_norml="0x58000000"
850 valt_load_address_pri_inner="0x38000000"
851 valt_load_address_sec_norml="0xUNSET"
852 valt_load_address_sec_inner="0xUNSET"
853 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
856 valt_load_address_sec_norml="0xUNSET"
857 valt_load_address_sec_inner="0xUNSET"
858 if test x$vg_cv_only64bit = xyes; then
859 VGCONF_ARCH_PRI="arm64"
861 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
862 VGCONF_PLATFORM_SEC_CAPS=""
863 valt_load_address_pri_norml="0x58000000"
864 valt_load_address_pri_inner="0x38000000"
865 elif test x$vg_cv_only32bit = xyes; then
866 VGCONF_ARCH_PRI="arm"
868 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
869 VGCONF_PLATFORM_SEC_CAPS=""
870 valt_load_address_pri_norml="0x58000000"
871 valt_load_address_pri_inner="0x38000000"
873 VGCONF_ARCH_PRI="arm64"
874 VGCONF_ARCH_SEC="arm"
875 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
876 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
877 valt_load_address_pri_norml="0x58000000"
878 valt_load_address_pri_inner="0x38000000"
879 valt_load_address_sec_norml="0x58000000"
880 valt_load_address_sec_inner="0x38000000"
882 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
885 VGCONF_ARCH_PRI="s390x"
887 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
888 VGCONF_PLATFORM_SEC_CAPS=""
889 # To improve branch prediction hit rate we want to have
890 # the generated code close to valgrind (host) code
891 valt_load_address_pri_norml="0x800000000"
892 valt_load_address_pri_inner="0x810000000"
893 valt_load_address_sec_norml="0xUNSET"
894 valt_load_address_sec_inner="0xUNSET"
895 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
898 VGCONF_ARCH_PRI="mips32"
900 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
901 VGCONF_PLATFORM_SEC_CAPS=""
902 valt_load_address_pri_norml="0x58000000"
903 valt_load_address_pri_inner="0x38000000"
904 valt_load_address_sec_norml="0xUNSET"
905 valt_load_address_sec_inner="0xUNSET"
906 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
909 valt_load_address_sec_norml="0xUNSET"
910 valt_load_address_sec_inner="0xUNSET"
911 if test x$vg_cv_only64bit = xyes; then
912 VGCONF_ARCH_PRI="mips64"
913 VGCONF_PLATFORM_SEC_CAPS=""
914 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
915 VGCONF_PLATFORM_SEC_CAPS=""
916 valt_load_address_pri_norml="0x58000000"
917 valt_load_address_pri_inner="0x38000000"
918 elif test x$vg_cv_only32bit = xyes; then
919 VGCONF_ARCH_PRI="mips32"
921 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
922 VGCONF_PLATFORM_SEC_CAPS=""
923 valt_load_address_pri_norml="0x58000000"
924 valt_load_address_pri_inner="0x38000000"
926 VGCONF_ARCH_PRI="mips64"
927 VGCONF_ARCH_SEC="mips32"
928 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
929 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
930 valt_load_address_pri_norml="0x58000000"
931 valt_load_address_pri_inner="0x38000000"
932 valt_load_address_sec_norml="0x58000000"
933 valt_load_address_sec_inner="0x38000000"
935 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
938 VGCONF_ARCH_PRI="nanomips"
940 VGCONF_PLATFORM_PRI_CAPS="NANOMIPS_LINUX"
941 VGCONF_PLATFORM_SEC_CAPS=""
942 valt_load_address_pri_norml="0x58000000"
943 valt_load_address_pri_inner="0x38000000"
944 valt_load_address_sec_norml="0xUNSET"
945 valt_load_address_sec_inner="0xUNSET"
946 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
949 VGCONF_ARCH_PRI="x86"
951 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
952 VGCONF_PLATFORM_SEC_CAPS=""
953 valt_load_address_pri_norml="0x58000000"
954 valt_load_address_pri_inner="0x38000000"
955 valt_load_address_sec_norml="0xUNSET"
956 valt_load_address_sec_inner="0xUNSET"
957 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
960 valt_load_address_sec_norml="0xUNSET"
961 valt_load_address_sec_inner="0xUNSET"
962 if test x$vg_cv_only64bit = xyes; then
963 VGCONF_ARCH_PRI="amd64"
965 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
966 VGCONF_PLATFORM_SEC_CAPS=""
967 valt_load_address_pri_norml="0x58000000"
968 valt_load_address_pri_inner="0x38000000"
969 elif test x$vg_cv_only32bit = xyes; then
970 VGCONF_ARCH_PRI="x86"
972 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
973 VGCONF_PLATFORM_SEC_CAPS=""
974 valt_load_address_pri_norml="0x58000000"
975 valt_load_address_pri_inner="0x38000000"
977 VGCONF_ARCH_PRI="amd64"
978 VGCONF_ARCH_SEC="x86"
979 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
980 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
981 valt_load_address_pri_norml="0x58000000"
982 valt_load_address_pri_inner="0x38000000"
983 valt_load_address_sec_norml="0x58000000"
984 valt_load_address_sec_inner="0x38000000"
986 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
989 VGCONF_ARCH_PRI="unknown"
990 VGCONF_ARCH_SEC="unknown"
991 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
992 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
993 valt_load_address_pri_norml="0xUNSET"
994 valt_load_address_pri_inner="0xUNSET"
995 valt_load_address_sec_norml="0xUNSET"
996 valt_load_address_sec_inner="0xUNSET"
997 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
998 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
1002 #----------------------------------------------------------------------------
1004 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
1006 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
1007 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1008 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1009 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1010 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD \
1011 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1012 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
1013 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1014 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
1015 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
1016 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1017 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1018 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
1019 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
1020 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
1021 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1022 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
1023 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
1024 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1025 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
1026 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
1027 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1028 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
1029 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
1030 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
1031 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
1032 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
1033 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
1034 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1035 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
1036 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
1037 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
1038 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_NANOMIPS,
1039 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX )
1041 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
1043 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
1044 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1045 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
1046 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
1047 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
1048 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
1049 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1050 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
1051 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
1052 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
1053 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
1054 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
1055 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
1056 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1057 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
1058 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
1059 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
1060 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
1061 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1062 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
1063 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
1064 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1065 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
1066 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
1067 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
1068 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_NANOMIPS_LINUX,
1069 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1070 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD,
1071 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1072 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD)
1073 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD,
1074 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1075 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
1076 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1077 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
1078 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
1079 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1080 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
1081 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1082 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
1083 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
1084 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1087 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
1088 # Relies on the assumption that the primary and secondary targets are
1089 # for the same OS, so therefore only necessary to test the primary.
1090 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
1091 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1092 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1093 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1094 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1095 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
1096 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1097 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1098 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1099 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1100 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
1101 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1102 AM_CONDITIONAL(VGCONF_OS_IS_FREEBSD,
1103 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1104 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1105 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
1106 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1107 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1108 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
1109 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1110 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1111 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN_OR_FREEBSD,
1112 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1113 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1114 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1115 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1118 # Sometimes, in the Makefile.am files, it's useful to know whether or not
1119 # there is a secondary target.
1120 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
1121 test x$VGCONF_PLATFORM_SEC_CAPS != x)
1123 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
1124 dnl fallback definition
1125 dnl The macro is courtesy of Dave Hart:
1126 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
1127 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
1128 if test -z "$$1_TRUE"; then :
1137 #----------------------------------------------------------------------------
1139 #----------------------------------------------------------------------------
1141 # Check if this should be built as an inner Valgrind, to be run within
1142 # another Valgrind. Choose the load address accordingly.
1143 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
1144 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
1145 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
1146 [AC_ARG_ENABLE(inner,
1147 [ --enable-inner enables self-hosting],
1148 [vg_cv_inner=$enableval],
1150 if test "$vg_cv_inner" = yes; then
1151 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
1152 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
1153 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
1155 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
1156 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
1159 #----------------------------------------------------------------------------
1160 # Undefined behaviour sanitiser
1161 #----------------------------------------------------------------------------
1162 # Check whether we should build with the undefined beahviour sanitiser.
1164 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
1165 [AC_ARG_ENABLE(ubsan,
1166 [ --enable-ubsan enables the undefined behaviour sanitiser],
1167 [vg_cv_ubsan=$enableval],
1170 #----------------------------------------------------------------------------
1171 # Extra fine-tuning of installation directories
1172 #----------------------------------------------------------------------------
1174 [ --with-tmpdir=PATH Specify path for temporary files],
1177 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
1178 AC_SUBST(VG_TMPDIR, [$tmpdir])
1180 #----------------------------------------------------------------------------
1182 #----------------------------------------------------------------------------
1183 AM_COND_IF([VGCONF_OS_IS_DARWIN],
1184 [AC_CHECK_PROG([XCRUN], [xcrun], [yes], [no])
1185 AC_MSG_CHECKING([for xcode sdk include path])
1186 AC_ARG_WITH(xcodedir,
1187 [ --with-xcode-path=PATH Specify path for xcode sdk includes],
1188 [xcodedir="$withval"],
1190 if test "x$XCRUN" != "xno" -a ! -d /usr/include; then
1191 xcrundir=`xcrun --sdk macosx --show-sdk-path`
1192 if test -z "$xcrundir"; then
1193 xcodedir="/usr/include"
1195 xcodedir="$xcrundir/usr/include"
1198 xcodedir="/usr/include"
1201 AC_MSG_RESULT([$xcodedir])
1202 AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
1203 AC_SUBST(XCODE_DIR, [$xcodedir])])
1205 #----------------------------------------------------------------------------
1206 # Where to install gdb scripts, defaults to VG_LIBDIR (pkglibexecdir)
1207 #----------------------------------------------------------------------------
1208 AC_MSG_CHECKING([where gdb scripts are installed])
1209 AC_ARG_WITH(gdbscripts-dir,
1210 [ --with-gdbscripts-dir=PATH Specify path to install gdb scripts],
1211 [gdbscriptsdir=${withval}],
1212 [gdbscriptsdir=${libexecdir}/valgrind])
1213 AC_MSG_RESULT([$gdbscriptsdir])
1214 if test "x$gdbscriptsdir" != "xno"; then
1215 AC_SUBST(VG_GDBSCRIPTS_DIR, [$gdbscriptsdir])
1216 AM_CONDITIONAL(GDBSCRIPTS, true)
1218 AC_SUBST(VG_GDBSCRIPTS_DIR, [])
1219 AM_CONDITIONAL(GDBSCRIPTS, false)
1222 #----------------------------------------------------------------------------
1223 # Libc and suppressions
1224 #----------------------------------------------------------------------------
1225 # This variable will collect the suppression files to be used.
1226 AC_SUBST(DEFAULT_SUPP)
1228 AC_CHECK_HEADER([features.h])
1230 if test x$ac_cv_header_features_h = xyes; then
1231 AC_DEFINE([HAVE_HEADER_FEATURES_H], 1,
1232 [Define to 1 if you have the `features.h' header.])
1233 rm -f conftest.$ac_ext
1234 cat <<_ACEOF >conftest.$ac_ext
1235 #include <features.h>
1236 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1237 glibc version is: __GLIBC__ __GLIBC_MINOR__
1240 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1243 # not really a version check
1244 AC_EGREP_CPP([DARWIN_LIBC], [
1245 #include <sys/cdefs.h>
1246 #if defined(__DARWIN_VERS_1050)
1250 GLIBC_VERSION="darwin")
1252 AC_EGREP_CPP([FREEBSD_LIBC], [
1253 #include <sys/cdefs.h>
1254 #if defined(__FreeBSD__)
1258 GLIBC_VERSION="freebsd")
1260 # not really a version check
1261 AC_EGREP_CPP([BIONIC_LIBC], [
1262 #if defined(__ANDROID__)
1266 GLIBC_VERSION="bionic")
1268 # there is only one version of libc on Solaris
1269 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1270 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1271 GLIBC_VERSION="solaris"
1274 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1276 if test x$GLIBC_VERSION = x; then
1277 if $CC -dumpmachine | grep -q musl; then
1282 # If this is glibc then figure out the generic (in file) libc.so and
1283 # libpthread.so file paths to use in suppressions. Before 2.34 libpthread
1284 # was a separate library, afterwards it was merged into libc.so and
1285 # the library is called libc.so.6 (before it was libc-2.[0-9]+.so).
1286 # Use this fact to set GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH.
1287 case ${GLIBC_VERSION} in
1289 AC_MSG_CHECKING([whether pthread_create needs libpthread])
1290 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])],
1293 GLIBC_LIBC_PATH="*/lib*/libc.so.6"
1294 GLIBC_LIBPTHREAD_PATH="$GLIBC_LIBC_PATH"
1296 AC_MSG_RESULT([yes])
1297 GLIBC_LIBC_PATH="*/lib*/libc-2.*so*"
1298 GLIBC_LIBPTHREAD_PATH="*/lib*/libpthread-2.*so*"
1302 AC_MSG_CHECKING([not glibc...])
1303 AC_MSG_RESULT([${GLIBC_VERSION}])
1307 AC_MSG_CHECKING([the glibc version])
1309 case "${GLIBC_VERSION}" in
1311 AC_MSG_RESULT(${GLIBC_VERSION} family)
1312 DEFAULT_SUPP="$srcdir/glibc-2.2.supp ${DEFAULT_SUPP}"
1313 DEFAULT_SUPP="$srcdir/glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1314 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1317 AC_MSG_RESULT(${GLIBC_VERSION} family)
1318 DEFAULT_SUPP="$srcdir/glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1319 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1320 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1323 AC_MSG_RESULT(${GLIBC_VERSION} family)
1324 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1325 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1326 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1329 AC_MSG_RESULT(${GLIBC_VERSION} family)
1330 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1331 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1332 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1333 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1334 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1337 AC_MSG_RESULT(${GLIBC_VERSION} family)
1338 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1339 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1340 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1341 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1342 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1343 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1344 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1347 AC_MSG_RESULT(Darwin)
1348 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1349 # DEFAULT_SUPP set by kernel version check above.
1352 AC_MSG_RESULT(FreeBSD)
1353 AC_DEFINE([FREEBSD_LIBC], 1, [Define to 1 if you're using FreeBSD])
1354 # DEFAULT_SUPP set by kernel version check above.
1357 AC_MSG_RESULT(Bionic)
1358 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1359 DEFAULT_SUPP="$srcdir/bionic.supp ${DEFAULT_SUPP}"
1362 AC_MSG_RESULT(Solaris)
1363 # DEFAULT_SUPP set in host_os switch-case above.
1364 # No other suppression file is used.
1368 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1369 DEFAULT_SUPP="$srcdir/musl.supp ${DEFAULT_SUPP}"
1372 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1373 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1374 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1378 AC_SUBST(GLIBC_VERSION)
1379 AC_SUBST(GLIBC_LIBC_PATH)
1380 AC_SUBST(GLIBC_LIBPTHREAD_PATH)
1383 if test "$VGCONF_OS" != "solaris"; then
1384 # Add default suppressions for the X client libraries. Make no
1385 # attempt to detect whether such libraries are installed on the
1386 # build machine (or even if any X facilities are present); just
1387 # add the suppressions antidisirregardless.
1388 DEFAULT_SUPP="$srcdir/xfree-4.supp ${DEFAULT_SUPP}"
1389 DEFAULT_SUPP="$srcdir/xfree-3.supp ${DEFAULT_SUPP}"
1393 #----------------------------------------------------------------------------
1394 # Platform variants?
1395 #----------------------------------------------------------------------------
1397 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1398 # But there are times where we need a bit more control. The motivating
1399 # and currently only case is Android: this is almost identical to
1400 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1401 # platform variant tags, which get passed in the compile as
1402 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1404 # In almost all cases, the <variant> bit is "vanilla". But for Android
1405 # it is "android" instead.
1407 # Consequently (eg), plain arm-linux would build with
1409 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1411 # whilst an Android build would have
1413 # -DVGP_arm_linux -DVGPV_arm_linux_android
1415 # Same for x86. The setup of the platform variant is pushed relatively far
1416 # down this file in order that we can inspect any of the variables set above.
1418 # In the normal case ..
1419 VGCONF_PLATVARIANT="vanilla"
1422 if test "$GLIBC_VERSION" = "bionic";
1424 VGCONF_PLATVARIANT="android"
1427 AC_SUBST(VGCONF_PLATVARIANT)
1430 # FIXME: do we also want to define automake variables
1431 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1432 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1433 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1434 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1435 # that's what we'd need to do to use this, since what we'd want to write
1438 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1440 # Hmm. Can't think of a nice clean solution to this.
1442 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1443 test x$VGCONF_PLATVARIANT = xvanilla)
1444 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1445 test x$VGCONF_PLATVARIANT = xandroid)
1448 #----------------------------------------------------------------------------
1449 # Checking for various library functions and other definitions
1450 #----------------------------------------------------------------------------
1452 # Check for AT_FDCWD
1454 AC_MSG_CHECKING([for AT_FDCWD])
1455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1462 ac_have_at_fdcwd=yes
1463 AC_MSG_RESULT([yes])
1469 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1471 # Check for stpncpy function definition in string.h
1472 # This explicitly checks with _GNU_SOURCE defined since that is also
1473 # used in the test case (some systems might define it without anyway
1474 # since stpncpy is part of The Open Group Base Specifications Issue 7
1475 # IEEE Std 1003.1-2008.
1476 AC_MSG_CHECKING([for stpncpy])
1477 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1484 char *r = stpncpy(d, s, n);
1486 ac_have_gnu_stpncpy=yes
1487 AC_MSG_RESULT([yes])
1489 ac_have_gnu_stpncpy=no
1493 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1495 # Check for PTRACE_GETREGS
1497 AC_MSG_CHECKING([for PTRACE_GETREGS])
1498 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1501 #include <sys/ptrace.h>
1502 #include <sys/user.h>
1505 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1507 AC_MSG_RESULT([yes])
1508 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1509 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1515 # Check for CLOCK_MONOTONIC
1517 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1519 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1523 clock_gettime(CLOCK_MONOTONIC, &t);
1526 AC_MSG_RESULT([yes])
1527 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1528 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1534 # Check for ELF32/64_CHDR
1536 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1539 # Check for PTHREAD_RWLOCK_T
1541 AC_MSG_CHECKING([for pthread_rwlock_t])
1543 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1545 #include <pthread.h>
1547 pthread_rwlock_t rwl;
1549 AC_MSG_RESULT([yes])
1550 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1551 [Define to 1 if you have the `pthread_rwlock_t' type.])
1556 # Check for CLOCKID_T
1558 AC_MSG_CHECKING([for clockid_t])
1560 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1565 AC_MSG_RESULT([yes])
1566 AC_DEFINE([HAVE_CLOCKID_T], 1,
1567 [Define to 1 if you have the `clockid_t' type.])
1572 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1574 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1578 #include <pthread.h>
1580 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1582 AC_MSG_RESULT([yes])
1583 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1584 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1590 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1592 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1596 #include <pthread.h>
1598 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1600 AC_MSG_RESULT([yes])
1601 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1602 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1608 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1610 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1612 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1614 #include <pthread.h>
1616 return (PTHREAD_MUTEX_RECURSIVE_NP);
1618 AC_MSG_RESULT([yes])
1619 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1620 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1626 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1628 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1630 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1632 #include <pthread.h>
1634 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1637 AC_MSG_RESULT([yes])
1638 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1639 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1645 # Check whether pthread_mutex_t has a member called __m_kind.
1647 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1648 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1650 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1653 [#include <pthread.h>])
1656 # Check whether pthread_mutex_t has a member called __data.__kind.
1658 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1659 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1661 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1664 [#include <pthread.h>])
1666 # Convenience function. Set flags based on the existing HWCAP entries.
1667 # The AT_HWCAP entries are generated by glibc, and are based on
1668 # functions supported by the hardware/system/libc.
1669 # Subsequent support for whether the capability will actually be utilized
1670 # will also be checked against the compiler capabilities.
1672 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1673 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1675 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1676 if env LD_SHOW_AUXV=1 true | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1678 AC_MSG_RESULT([yes])
1679 AC_SUBST([$2],[yes])
1686 # gather hardware capabilities. (hardware/kernel/libc)
1687 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1688 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1689 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1690 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1691 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1692 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1693 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1694 AC_HWCAP_CONTAINS_FLAG([arch_3_1],[HWCAP_HAS_ISA_3_1])
1695 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1696 AC_HWCAP_CONTAINS_FLAG([mma],[HWCAP_HAS_MMA])
1699 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1700 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1701 # compiler support for isa 2.07 level instructions
1702 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1703 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1705 __asm__ __volatile__("mtvsrd 1,2 ");
1707 ac_asm_have_isa_2_07=yes
1708 AC_MSG_RESULT([yes])
1710 ac_asm_have_isa_2_07=no
1713 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1714 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1716 # altivec (vsx) support.
1717 # does this compiler support -maltivec and does it have the include file
1719 AC_MSG_CHECKING([for Altivec support in the compiler ])
1721 CFLAGS="-maltivec -Werror"
1722 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1723 #include <altivec.h>
1725 vector unsigned int v;
1728 AC_MSG_RESULT([yes])
1734 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1735 -a x$HWCAP_HAS_ALTIVEC = xyes])
1737 # Check that both: the compiler supports -mvsx and that the assembler
1738 # understands VSX instructions. If either of those doesn't work,
1739 # conclude that we can't do VSX.
1740 AC_MSG_CHECKING([for VSX compiler flag support])
1742 CFLAGS="-mvsx -Werror"
1743 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1746 ac_compiler_supports_vsx_flag=yes
1747 AC_MSG_RESULT([yes])
1749 ac_compiler_supports_vsx_flag=no
1754 AC_MSG_CHECKING([for VSX support in the assembler ])
1756 CFLAGS="-mvsx -Werror"
1757 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1758 #include <altivec.h>
1760 vector unsigned int v;
1761 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1763 ac_compiler_supports_vsx=yes
1764 AC_MSG_RESULT([yes])
1766 ac_compiler_supports_vsx=no
1770 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1771 -a x$ac_compiler_supports_vsx = xyes \
1772 -a x$HWCAP_HAS_VSX = xyes ])
1774 # DFP (Decimal Float)
1775 # The initial DFP support was added in Power 6. The dcffix instruction
1776 # support was added in Power 7.
1777 AC_MSG_CHECKING([that assembler knows DFP])
1778 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1781 __asm__ __volatile__("adtr 1, 2, 3")
1783 __asm__ __volatile__(".machine power7;\n" \
1789 AC_MSG_RESULT([yes])
1794 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1796 CFLAGS="-mhard-dfp -Werror"
1798 # The dcffix instruction is Power 7
1799 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1802 __asm__ __volatile__("adtr 1, 2, 3")
1804 __asm__ __volatile__(".machine power7;\n" \
1809 ac_compiler_have_dfp=yes
1810 AC_MSG_RESULT([yes])
1812 ac_compiler_have_dfp=no
1816 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1817 -a x$ac_compiler_have_dfp = xyes \
1818 -a x$HWCAP_HAS_DFP = xyes )
1820 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1821 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1823 _Decimal64 x = 0.0DD;
1825 ac_compiler_have_dfp_type=yes
1826 AC_MSG_RESULT([yes])
1828 ac_compiler_have_dfp_type=no
1831 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1832 -a x$HWCAP_HAS_DFP = xyes )
1835 # HTM (Hardware Transactional Memory)
1836 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1838 CFLAGS="-mhtm -Werror"
1839 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1843 AC_MSG_RESULT([yes])
1844 ac_compiler_supports_htm=yes
1847 ac_compiler_supports_htm=no
1851 AC_MSG_CHECKING([if compiler can find the htm builtins])
1853 CFLAGS="-mhtm -Werror"
1854 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1856 if (__builtin_tbegin (0))
1859 AC_MSG_RESULT([yes])
1860 ac_compiler_sees_htm_builtins=yes
1863 ac_compiler_sees_htm_builtins=no
1867 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1868 -a x$ac_compiler_sees_htm_builtins = xyes \
1869 -a x$HWCAP_HAS_HTM = xyes )
1871 # isa 3.0 checking. (actually 3.0 or newer)
1872 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1874 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1876 __asm__ __volatile__ (".machine power9;\n" \
1879 # guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste,
1882 CFLAGS="-DHAS_ISA_3_00"
1883 ac_asm_have_isa_3_00=yes
1884 AC_MSG_RESULT([yes])
1886 ac_asm_have_isa_3_00=no
1892 AC_MSG_CHECKING([that assembler knows xscvhpdp ])
1894 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1896 __asm__ __volatile__ (".machine power9;\n" \
1897 "xscvhpdp 1,2;\n" );
1899 ac_asm_have_xscvhpdp=yes
1900 AC_MSG_RESULT([yes])
1902 ac_asm_have_xscvhpdp=no
1906 # darn instruction checking
1907 AC_MSG_CHECKING([that assembler knows darn instruction ])
1909 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1911 __asm__ __volatile__(".machine power9; darn 1,0 ");
1913 ac_asm_have_darn_inst=yes
1914 AC_MSG_RESULT([yes])
1916 ac_asm_have_darn_inst=no
1921 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
1922 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1924 __asm__ __volatile__ (".machine power10;\n" \
1927 ac_asm_have_isa_3_1=yes
1928 AC_MSG_RESULT([yes])
1930 ac_asm_have_isa_3_1=no
1935 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
1936 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1938 AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes])
1939 AM_CONDITIONAL(HAS_DARN, [test x$ac_asm_have_darn_inst = xyes])
1941 AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \
1942 -a x$HWCAP_HAS_ISA_3_1 = xyes])
1944 # Check for pthread_create@GLIBC2.0
1945 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1948 CFLAGS="-lpthread -Werror"
1949 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1950 extern int pthread_create_glibc_2_0(void*, const void*,
1951 void *(*)(void*), void*);
1952 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1956 * Apparently on PowerPC linking this program succeeds and generates an
1957 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1959 #error This test does not work properly on PowerPC.
1961 pthread_create_glibc_2_0(0, 0, 0, 0);
1965 ac_have_pthread_create_glibc_2_0=yes
1966 AC_MSG_RESULT([yes])
1967 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1968 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1970 ac_have_pthread_create_glibc_2_0=no
1975 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1976 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1979 # Check for dlinfo RTLD_DI_TLS_MODID
1980 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1984 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1991 size_t sizes[10000];
1992 size_t modid_offset;
1993 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1996 ac_have_dlinfo_rtld_di_tls_modid=yes
1997 AC_MSG_RESULT([yes])
1998 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1999 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
2001 ac_have_dlinfo_rtld_di_tls_modid=no
2006 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
2007 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
2010 # Check for eventfd_t, eventfd() and eventfd_read()
2011 AC_MSG_CHECKING([for eventfd()])
2013 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2014 #include <sys/eventfd.h>
2020 eventfd_read(fd, &ev);
2023 AC_MSG_RESULT([yes])
2024 AC_DEFINE([HAVE_EVENTFD], 1,
2025 [Define to 1 if you have the `eventfd' function.])
2026 AC_DEFINE([HAVE_EVENTFD_READ], 1,
2027 [Define to 1 if you have the `eventfd_read' function.])
2032 # Check whether compiler can process #include <thread> without errors
2033 # clang 3.3 cannot process <thread> from e.g.
2034 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
2036 AC_MSG_CHECKING([that C++ compiler can compile C++17 code])
2038 safe_CXXFLAGS=$CXXFLAGS
2041 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2046 AC_MSG_RESULT([yes])
2051 CXXFLAGS=$safe_CXXFLAGS
2054 AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes)
2056 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
2058 safe_CXXFLAGS=$CXXFLAGS
2061 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2065 ac_cxx_can_include_thread_header=yes
2066 AC_MSG_RESULT([yes])
2068 ac_cxx_can_include_thread_header=no
2071 CXXFLAGS=$safe_CXXFLAGS
2074 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
2076 # Check whether compiler can process #include <condition_variable> without errors
2078 AC_MSG_CHECKING([that C++ compiler can include <condition_variable> header file])
2080 safe_CXXFLAGS=$CXXFLAGS
2083 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2084 #include <condition_variable>
2087 ac_cxx_can_include_condition_variable_header=yes
2088 AC_MSG_RESULT([yes])
2090 ac_cxx_can_include_condition_variable_header=no
2093 CXXFLAGS=$safe_CXXFLAGS
2096 AM_CONDITIONAL(CXX_CAN_INCLUDE_CONDITION_VARIABLE_HEADER, test x$ac_cxx_can_include_condition_variable_header = xyes)
2098 # check for std::shared_timed_mutex, this is a C++ 14 feature
2100 AC_MSG_CHECKING([that C++ compiler can use std::shared_timed_mutex])
2102 safe_CXXFLAGS=$CXXFLAGS
2103 CXXFLAGS="-std=c++1y -pthread"
2105 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2106 #include <shared_mutex>
2107 std::shared_timed_mutex test_mutex;
2110 ac_cxx_can_use_shared_timed_mutex=yes
2111 AC_MSG_RESULT([yes])
2113 ac_cxx_can_use_shared_timed_mutex=no
2116 CXXFLAGS=$safe_CXXFLAGS
2119 AM_CONDITIONAL(CXX_CAN_USE_SHARED_TIMED_MUTEX, test x$ac_cxx_can_use_shared_timed_mutex = xyes)
2121 # check for std::shared_mutex, this is a C++ 11 feature
2123 AC_MSG_CHECKING([that C++ compiler can use std::timed_mutex])
2125 safe_CXXFLAGS=$CXXFLAGS
2126 CXXFLAGS="-std=c++0x -pthread"
2128 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2130 std::timed_mutex test_mutex;
2133 ac_cxx_can_use_timed_mutex=yes
2134 AC_MSG_RESULT([yes])
2136 ac_cxx_can_use_timed_mutex=no
2139 CXXFLAGS=$safe_CXXFLAGS
2142 AM_CONDITIONAL(CXX_CAN_USE_TIMED_MUTEX, test x$ac_cxx_can_use_timed_mutex = xyes)
2144 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
2145 # of the user_regs_struct from sys/user.h. They are structurally the same
2146 # but we get either one or the other.
2148 AC_CHECK_TYPE([struct user_regs_struct],
2149 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
2150 [[#include <sys/ptrace.h>]
2151 [#include <sys/time.h>]
2152 [#include <sys/user.h>]])
2153 if test "$sys_user_has_user_regs" = "yes"; then
2154 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
2155 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
2158 AC_MSG_CHECKING([for __NR_membarrier])
2159 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2160 #include <linux/unistd.h>
2162 return __NR_membarrier
2164 ac_have_nr_membarrier=yes
2165 AC_MSG_RESULT([yes])
2167 ac_have_nr_membarrier=no
2171 AM_CONDITIONAL(HAVE_NR_MEMBARRIER, [test x$ac_have_nr_membarrier = xyes])
2173 #----------------------------------------------------------------------------
2174 # Checking for supported compiler flags.
2175 #----------------------------------------------------------------------------
2177 case "${host_cpu}" in
2179 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2180 if test -z "$ARCH"; then
2181 # does this compiler support -march=mips32 (mips32 default) ?
2182 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
2185 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
2187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2190 FLAG_M32="-mips32 -mabi=32"
2191 AC_MSG_RESULT([yes])
2201 # does this compiler support -march=mips64r2 (mips64r2 default) ?
2202 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
2205 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
2207 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2210 FLAG_M64="-march=mips64r2 -mabi=64"
2211 AC_MSG_RESULT([yes])
2224 # does this compiler support -m32 ?
2225 AC_MSG_CHECKING([if gcc accepts -m32])
2228 CFLAGS="${FLAG_32ON64} -m32 -Werror"
2230 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2233 FLAG_M32="${FLAG_32ON64} -m32"
2234 AC_MSG_RESULT([yes])
2244 # does this compiler support -m64 ?
2245 AC_MSG_CHECKING([if gcc accepts -m64])
2248 CFLAGS="-m64 -Werror"
2250 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2254 AC_MSG_RESULT([yes])
2266 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2267 if test -z "$ARCH"; then
2268 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
2269 AC_MSG_CHECKING([if gcc accepts -march=octeon])
2272 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
2274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2277 FLAG_OCTEON="-march=octeon"
2278 AC_MSG_RESULT([yes])
2285 AC_SUBST(FLAG_OCTEON)
2288 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
2289 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
2292 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
2294 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2297 FLAG_OCTEON2="-march=octeon2"
2298 AC_MSG_RESULT([yes])
2305 AC_SUBST(FLAG_OCTEON2)
2309 # does this compiler support -mmsa (MIPS MSA ASE) ?
2310 AC_MSG_CHECKING([if gcc accepts -mmsa])
2313 CFLAGS="$CFLAGS -mmsa -Werror"
2315 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2319 AC_MSG_RESULT([yes])
2328 # Are we compiling for the MIPS64 n32 ABI?
2329 AC_MSG_CHECKING([if gcc is producing mips n32 binaries])
2330 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2331 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABIN32))
2336 FLAG_M64="-march=mips64r2 -mabi=n32"
2337 AC_MSG_RESULT([yes])
2342 # Are we compiling for the MIPS64 n64 ABI?
2343 AC_MSG_CHECKING([if gcc is producing mips n64 binaries])
2344 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2345 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABI64))
2350 AC_MSG_RESULT([yes])
2355 # We enter the code block below in the following case:
2356 # Target architecture is set to mips64, the desired abi
2357 # was not specified and the compiler's default abi setting
2358 # is neither n32 nor n64.
2359 # Probe for and set the abi to either n64 or n32, in that order,
2360 # which is required for a mips64 build of valgrind.
2361 if test "$ARCH_MAX" = "mips64" -a "x$VGCONF_ABI" = "x"; then
2363 CFLAGS="$CFLAGS -mabi=64 -Werror"
2364 AC_MSG_CHECKING([if gcc is n64 capable])
2365 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2369 AC_MSG_RESULT([yes])
2375 if test "x$VGCONF_ABI" = "x"; then
2377 CFLAGS="$CFLAGS -mabi=n32 -Werror"
2378 AC_MSG_CHECKING([if gcc is n32 capable])
2379 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2383 FLAG_M64="-march=mips64r2 -mabi=n32"
2384 AC_MSG_RESULT([yes])
2392 AM_CONDITIONAL([VGCONF_HAVE_ABI],
2393 [test x$VGCONF_ABI != x])
2394 AC_SUBST(VGCONF_ABI)
2397 # does this compiler support -mmmx ?
2398 AC_MSG_CHECKING([if gcc accepts -mmmx])
2401 CFLAGS="-mmmx -Werror"
2403 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2407 AC_MSG_RESULT([yes])
2417 # does this compiler support -msse ?
2418 AC_MSG_CHECKING([if gcc accepts -msse])
2421 CFLAGS="-msse -Werror"
2423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2427 AC_MSG_RESULT([yes])
2437 # does this compiler support -mpreferred-stack-boundary=2 when
2438 # generating code for a 32-bit target? Note that we only care about
2439 # this when generating code for (32-bit) x86, so if the compiler
2440 # doesn't recognise -m32 it's no big deal. We'll just get code for
2441 # the Memcheck and other helper functions, that is a bit slower than
2442 # it could be, on x86; and no difference at all on any other platform.
2443 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
2446 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
2448 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2451 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
2452 AC_MSG_RESULT([yes])
2454 PREFERRED_STACK_BOUNDARY_2=""
2459 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
2462 # does this compiler support -mlong-double-128 ?
2463 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
2465 CFLAGS="-mlong-double-128 -Werror"
2466 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2469 ac_compiler_supports_mlong_double_128=yes
2470 AC_MSG_RESULT([yes])
2472 ac_compiler_supports_mlong_double_128=no
2476 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
2477 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
2478 AC_SUBST(FLAG_MLONG_DOUBLE_128)
2480 # does this toolchain support lto ?
2481 # Not checked for if --enable-lto=no was given, or if LTO_AR or LTO_RANLIG
2483 # If not enable-lto=* arg is provided, default to no, as lto builds are
2484 # a lot slower, and so not appropriate for Valgrind developments.
2485 # --enable-lto=yes should be used by distro packagers.
2486 AC_CACHE_CHECK([for using the link time optimisation], vg_cv_lto,
2488 [ --enable-lto enables building with link time optimisation],
2489 [vg_cv_lto=$enableval],
2492 if test "x${vg_cv_lto}" != "xno" -a "x${LTO_AR}" != "x" -a "x${LTO_RANLIB}" != "x"; then
2493 AC_MSG_CHECKING([if toolchain accepts lto])
2495 TEST_LTO_CFLAGS="-flto -flto-partition=one -fuse-linker-plugin"
2496 # Note : using 'one' partition is giving a slightly smaller/faster memcheck
2497 # and ld/lto-trans1 still needs a reasonable memory (about 0.5GB) when linking.
2498 CFLAGS="$TEST_LTO_CFLAGS -Werror"
2500 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2501 extern void somefun(void);
2505 LTO_CFLAGS=$TEST_LTO_CFLAGS
2506 AC_MSG_RESULT([yes])
2514 AC_SUBST(LTO_CFLAGS)
2516 # if we could not compile with lto args, or lto was disabled,
2517 # then set LTO_AR/LTO_RANLIB to the non lto values
2518 # define in config.h ENABLE_LTO (not needed by the code currently, but
2519 # this guarantees we recompile everything if we re-configure and rebuild
2520 # in a build dir previously build with another value of --enable-lto
2521 if test "x${LTO_CFLAGS}" = "x"; then
2523 LTO_RANLIB=${RANLIB}
2527 AC_DEFINE([ENABLE_LTO], 1, [configured to build with lto link time optimisation])
2530 # Convenience function to check whether GCC supports a particular
2531 # warning option. Takes two arguments,
2532 # first the warning flag name to check (without -W), then the
2533 # substitution name to set with -Wno-warning-flag if the flag exists,
2534 # or the empty string if the compiler doesn't accept the flag. Note
2535 # that checking is done against the warning flag itself, but the
2536 # substitution is then done to cancel the warning flag.
2537 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
2538 AC_MSG_CHECKING([if gcc accepts -W$1])
2540 CFLAGS="-W$1 -Werror"
2541 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2542 AC_SUBST([$2], [-Wno-$1])
2543 AC_MSG_RESULT([yes])], [
2545 AC_MSG_RESULT([no])])
2549 # A variation of the above for arguments that
2551 AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[
2552 AC_MSG_CHECKING([if gcc accepts -W$1=$2])
2554 CFLAGS="-W$1=$2 -Werror"
2555 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2556 AC_SUBST([$3], [-Wno-$1])
2557 AC_MSG_RESULT([yes])], [
2559 AC_MSG_RESULT([no])])
2563 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
2564 # -W$1 (instead of -Wno-$1).
2565 AC_DEFUN([AC_GCC_WARNING_SUBST],[
2566 AC_MSG_CHECKING([if gcc accepts -W$1])
2568 CFLAGS="-W$1 -Werror"
2569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2570 AC_SUBST([$2], [-W$1])
2571 AC_MSG_RESULT([yes])], [
2573 AC_MSG_RESULT([no])])
2577 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
2578 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
2579 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
2580 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
2581 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
2582 AC_GCC_WARNING_SUBST_NO([maybe-uninitialized], [FLAG_W_NO_MAYBE_UNINITIALIZED])
2583 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
2584 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
2585 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
2586 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2587 AC_GCC_WARNING_SUBST_NO([expansion-to-defined], [FLAG_W_NO_EXPANSION_TO_DEFINED])
2588 AC_GCC_WARNING_SUBST_NO([unused-but-set-variable], [FLAG_W_NO_UNUSED_BUT_SET_VARIABLE])
2589 AC_GCC_WARNING_SUBST_NO([non-power-of-two-alignment], [FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT])
2590 AC_GCC_WARNING_SUBST_NO([sign-compare], [FLAG_W_NO_SIGN_COMPARE])
2591 AC_GCC_WARNING_SUBST_NO([stringop-overflow], [FLAG_W_NO_STRINGOP_OVERFLOW])
2592 AC_GCC_WARNING_SUBST_NO([stringop-overread], [FLAG_W_NO_STRINGOP_OVERREAD])
2593 AC_GCC_WARNING_SUBST_NO([stringop-truncation], [FLAG_W_NO_STRINGOP_TRUNCATION])
2594 AC_GCC_WARNING_SUBST_NO([format-overflow], [FLAG_W_NO_FORMAT_OVERFLOW])
2595 AC_GCC_WARNING_SUBST_NO([use-after-free], [FLAG_W_NO_USE_AFTER_FREE])
2596 AC_GCC_WARNING_SUBST_NO([free-nonheap-object], [FLAG_W_NO_FREE_NONHEAP_OBJECT])
2597 AC_GCC_WARNING_SUBST_NO([fortify-source], [FLAG_W_NO_FORTIFY_SOURCE])
2598 AC_GCC_WARNING_SUBST_NO([builtin-memcpy-chk-size], [FLAG_W_NO_BUILTIN_MEMCPY_CHK_SIZE])
2599 AC_GCC_WARNING_SUBST_NO([incompatible-pointer-types-discards-qualifiers], [FLAG_W_NO_INCOMPATIBLE_POINTER_TYPES_DISCARDS_QUALIFIERS])
2600 AC_GCC_WARNING_SUBST_NO([suspicious-bzero], [FLAG_W_NO_SUSPICIOUS_BZERO])
2602 AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
2604 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
2605 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
2606 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
2607 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
2608 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
2609 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2610 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2611 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2612 AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
2613 AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
2614 AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
2616 # Does this compiler support -Wformat-security ?
2617 # Special handling is needed, because certain GCC versions require -Wformat
2618 # being present if -Wformat-security is given. Otherwise a warning is issued.
2619 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2620 # And with that the warning will be turned into an error with the result
2621 # that -Wformat-security is believed to be unsupported when in fact it is.
2622 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2624 CFLAGS="-Wformat -Wformat-security -Werror"
2625 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2626 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2627 AC_MSG_RESULT([yes])], [
2628 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2629 AC_MSG_RESULT([no])])
2632 # does this compiler support -Wextra or the older -W ?
2634 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2637 CFLAGS="-Wextra -Werror"
2639 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2642 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2643 AC_MSG_RESULT([-Wextra])
2646 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2649 AC_SUBST([FLAG_W_EXTRA], [-W])
2652 AC_SUBST([FLAG_W_EXTRA], [])
2653 AC_MSG_RESULT([not supported])
2658 # On ARM we do not want to pass -Wcast-align as that produces loads
2659 # of warnings. GCC is just being conservative. See here:
2660 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2661 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2662 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2664 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2667 # does this compiler support -faligned-new ?
2668 AC_MSG_CHECKING([if g++ accepts -faligned-new])
2670 safe_CXXFLAGS=$CXXFLAGS
2671 CXXFLAGS="-faligned-new -Werror"
2674 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2677 FLAG_FALIGNED_NEW="-faligned-new"
2678 AC_MSG_RESULT([yes])
2680 FLAG_FALIGNED_NEW=""
2683 CXXFLAGS=$safe_CXXFLAGS
2686 AC_SUBST(FLAG_FALIGNED_NEW)
2688 # does this compiler support -fsized-deallocation ?
2689 AC_MSG_CHECKING([if g++ accepts -fsized-deallocation])
2691 safe_CXXFLAGS=$CXXFLAGS
2692 CXXFLAGS="-fsized-deallocation -Werror"
2695 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2698 FLAG_FSIZED_DEALLOCATION="-fsized-deallocation"
2699 ac_have_sized_deallocation=yes
2700 AC_MSG_RESULT([yes])
2702 FLAG_FSIZED_DEALLOCATION=""
2703 ac_have_sized_deallocation=no
2706 CXXFLAGS=$safe_CXXFLAGS
2709 AC_SUBST(FLAG_FSIZED_DEALLOCATION)
2710 AM_CONDITIONAL([HAVE_FSIZED_DEALLOCATION], [test x$ac_have_sized_deallocation = xyes])
2712 # does this compiler support C++17 aligned new/delete?
2713 AC_MSG_CHECKING([if g++ supports aligned new and delete])
2715 safe_CXXFLAGS=$CXXFLAGS
2716 CXXFLAGS="-std=c++17"
2719 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2723 operator delete(nullptr, std::align_val_t(64U));
2725 ac_have_aligned_cxx_alloc=yes
2726 AC_MSG_RESULT([yes])
2728 ac_have_aligned_cxx_alloc=no
2731 CXXFLAGS=$safe_CXXFLAGS
2734 AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes])
2736 # does this compiler support -fno-stack-protector ?
2737 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2740 CFLAGS="-fno-stack-protector -Werror"
2742 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2745 no_stack_protector=yes
2746 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2747 AC_MSG_RESULT([yes])
2749 no_stack_protector=no
2750 FLAG_FNO_STACK_PROTECTOR=""
2755 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2757 # does this compiler support -finline-functions ?
2758 AC_MSG_CHECKING([if gcc accepts -finline-functions])
2761 CFLAGS="-finline-functions -Werror"
2763 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2766 inline_functions=yes
2767 FLAG_FINLINE_FUNCTIONS="-finline-functions"
2768 AC_MSG_RESULT([yes])
2771 FLAG_FINLINE_FUNCTIONS=""
2776 AC_SUBST(FLAG_FINLINE_FUNCTIONS)
2778 # Does GCC support disabling Identical Code Folding?
2779 # We want to disabled Identical Code Folding for the
2780 # tools preload shared objects to get better backraces.
2781 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2782 # "The optimization reduces code size and may disturb
2783 # unwind stacks by replacing a function by equivalent
2784 # one with a different name."
2785 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2788 CFLAGS="-fno-ipa-icf -Werror"
2790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2794 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2795 AC_MSG_RESULT([yes])
2803 AC_SUBST(FLAG_FNO_IPA_ICF)
2806 # Does this compiler support -fsanitize=undefined. This is true for
2807 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2808 # also checks for alignment violations on memory accesses which the valgrind
2809 # code base is sprinkled (if not littered) with. As those alignment issues
2810 # don't pose a problem we want to suppress warnings about them.
2811 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2812 # GCCs do not support that.
2814 # Only checked for if --enable-ubsan was given.
2815 if test "x${vg_cv_ubsan}" = "xyes"; then
2816 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2818 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2819 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2822 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2823 LIB_UBSAN="-static-libubsan"
2824 AC_MSG_RESULT([yes])
2826 CFLAGS="-fsanitize=undefined -Werror"
2827 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2830 FLAG_FSANITIZE="-fsanitize=undefined"
2831 LIB_UBSAN="-static-libubsan"
2832 AC_MSG_RESULT([yes])
2840 AC_SUBST(FLAG_FSANITIZE)
2843 # does this compiler support --param inline-unit-growth=... ?
2845 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2848 CFLAGS="--param inline-unit-growth=900 -Werror"
2850 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2853 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2854 ["--param inline-unit-growth=900"])
2855 AC_MSG_RESULT([yes])
2857 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2863 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2865 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2868 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2870 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2874 AC_MSG_RESULT([yes])
2879 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2883 # does this compiler support -g -gz=zlib ?
2885 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2888 CFLAGS="-g -gz=zlib"
2890 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2894 AC_MSG_RESULT([yes])
2899 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2903 # does this compiler support -g -gz=zlib-gnu ?
2905 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2908 CFLAGS="-g -gz=zlib-gnu"
2910 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2913 ac_have_gz_zlib_gnu=yes
2914 AC_MSG_RESULT([yes])
2916 ac_have_gz_zlib_gnu=no
2919 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2923 # does this compiler support nested functions ?
2925 AC_MSG_CHECKING([if gcc accepts nested functions])
2927 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2928 int foo() { return 1; }
2931 ac_have_nested_functions=yes
2932 AC_MSG_RESULT([yes])
2934 ac_have_nested_functions=no
2937 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2940 # does this compiler support the 'p' constraint in ASM statements ?
2942 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2944 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2946 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2948 ac_have_asm_constraint_p=yes
2949 AC_MSG_RESULT([yes])
2951 ac_have_asm_constraint_p=no
2954 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2957 # Does this compiler and linker support -pie?
2958 # Some compilers actually do not support -pie and report its usage
2959 # as an error. We need to check if it is safe to use it first.
2961 AC_MSG_CHECKING([if gcc accepts -pie])
2966 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2969 AC_SUBST([FLAG_PIE], ["-pie"])
2970 AC_MSG_RESULT([yes])
2972 AC_SUBST([FLAG_PIE], [""])
2977 AC_MSG_CHECKING([if gcc accepts -ansi])
2982 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2986 AC_MSG_RESULT([yes])
2991 AM_CONDITIONAL([HAVE_ANSI], [test x$ac_have_ansi = xyes])
2996 # Does this compiler support -no-pie?
2997 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2998 # default. However this gets in the way with some tests, we use -no-pie
3001 AC_MSG_CHECKING([if gcc accepts -no-pie])
3004 CFLAGS="-no-pie -Werror"
3006 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
3009 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
3010 AC_MSG_RESULT([yes])
3012 AC_SUBST([FLAG_NO_PIE], [""])
3018 # We want to use use the -Ttext-segment option to the linker.
3019 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
3020 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
3021 # semantics are NOT what we want (GNU gold -Ttext is fine).
3023 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
3024 # will reside. -Ttext aligns just the .text section start (but not any
3027 # LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes"
3028 # in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html
3029 # The --image-base option (since version 6.0?) provides the semantics needed.
3030 # -Ttext-segment generates an error, but -Ttext now more closely
3031 # follows the GNU (bfd) ld's -Ttext.
3033 # So test first for --image-base support, and if that fails then
3034 # for -Ttext-segment which is supported by all bfd ld versions
3035 # and use that if it exists. If it doesn't exist it must be an older
3036 # version of gold and we can fall back to using -Ttext which has the
3040 AC_MSG_CHECKING([if the linker accepts -Wl,--image-base])
3042 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror"
3045 [AC_LANG_SOURCE([int _start () { return 0; }])],
3047 linker_using_t_text="no"
3048 AC_SUBST([FLAG_T_TEXT], ["--image-base"])
3049 AC_MSG_RESULT([yes])
3053 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
3055 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
3058 [AC_LANG_SOURCE([int _start () { return 0; }])],
3060 linker_using_t_text="no"
3061 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
3062 AC_MSG_RESULT([yes])
3064 linker_using_t_text="yes"
3065 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
3072 # If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will
3073 # have to strip any build-id ELF NOTEs from the statically linked tools.
3074 # Otherwise the build-id NOTE might end up at the default load address.
3075 # (Pedantically if the linker is gold then -Ttext is fine, but newer
3076 # gold versions also support -Ttext-segment. So just assume that unless
3077 # we can use -Ttext-segment we need to strip the build-id NOTEs.
3078 if test "x${linker_using_t_text}" = "xyes"; then
3079 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
3080 # does the linker support -Wl,--build-id=none ? Note, it's
3081 # important that we test indirectly via whichever C compiler
3082 # is selected, rather than testing /usr/bin/ld or whatever
3084 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
3086 CFLAGS="-Wl,--build-id=none -Werror"
3089 [AC_LANG_PROGRAM([ ], [return 0;])],
3091 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
3092 AC_MSG_RESULT([yes])
3094 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3098 AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.])
3099 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3103 # On s390x, if the linker supports -Wl,--s390-pgste, then we build the
3104 # tools with that flag. This enables running programs that need it, such
3106 if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then
3107 AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste])
3109 CFLAGS="-Wl,--s390-pgste"
3112 [AC_LANG_PROGRAM([ ], [return 0;])],
3114 AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"])
3115 AC_MSG_RESULT([yes])
3117 AC_SUBST([FLAG_S390_PGSTE], [""])
3123 # does the ppc assembler support "mtocrf" et al?
3124 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
3126 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3127 __asm__ __volatile__("mtocrf 4,0");
3128 __asm__ __volatile__("mfocrf 0,4");
3130 ac_have_as_ppc_mftocrf=yes
3131 AC_MSG_RESULT([yes])
3133 ac_have_as_ppc_mftocrf=no
3136 if test x$ac_have_as_ppc_mftocrf = xyes ; then
3137 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
3141 # does the ppc assembler support "lfdp" and other phased out floating point insns?
3142 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
3144 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3145 do { typedef struct {
3149 dbl_pair_t dbl_pair[3];
3150 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
3153 ac_have_as_ppc_fpPO=yes
3154 AC_MSG_RESULT([yes])
3156 ac_have_as_ppc_fpPO=no
3159 if test x$ac_have_as_ppc_fpPO = xyes ; then
3160 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
3164 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
3165 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
3167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3169 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
3170 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
3172 ac_have_as_amd64_fxsave64=yes
3173 AC_MSG_RESULT([yes])
3175 ac_have_as_amd64_fxsave64=no
3178 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
3179 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
3182 # does the x86/amd64 assembler understand SSE3 instructions?
3183 # Note, this doesn't generate a C-level symbol. It generates a
3184 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
3185 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
3187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3188 do { long long int x;
3189 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
3193 AC_MSG_RESULT([yes])
3199 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
3202 # Ditto for SSSE3 instructions (note extra S)
3203 # Note, this doesn't generate a C-level symbol. It generates a
3204 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
3205 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
3207 save_CFLAGS="$CFLAGS"
3208 CFLAGS="$CFLAGS -msse -Werror"
3209 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3210 do { long long int x;
3211 __asm__ __volatile__(
3212 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
3215 ac_have_as_ssse3=yes
3216 AC_MSG_RESULT([yes])
3221 CFLAGS="$save_CFLAGS"
3223 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
3226 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
3227 # Note, this doesn't generate a C-level symbol. It generates a
3228 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
3229 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
3230 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3232 __asm__ __volatile__(
3233 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
3236 ac_have_as_pclmulqdq=yes
3237 AC_MSG_RESULT([yes])
3239 ac_have_as_pclmulqdq=no
3243 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
3246 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
3247 # Note, this doesn't generate a C-level symbol. It generates a
3248 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
3249 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
3250 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3253 * Carry-less multiplication of xmm1 with xmm2 and store the result in
3254 * xmm3. The immediate is used to determine which quadwords of xmm1 and
3255 * xmm2 should be used.
3257 __asm__ __volatile__(
3258 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
3261 ac_have_as_vpclmulqdq=yes
3262 AC_MSG_RESULT([yes])
3264 ac_have_as_vpclmulqdq=no
3268 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
3271 # does the x86/amd64 assembler understand FMA4 instructions?
3272 # Note, this doesn't generate a C-level symbol. It generates a
3273 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
3274 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
3275 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3277 __asm__ __volatile__(
3278 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
3281 ac_have_as_vfmaddpd=yes
3282 AC_MSG_RESULT([yes])
3284 ac_have_as_vfmaddpd=no
3288 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
3291 # does the x86/amd64 assembler understand the LZCNT instruction?
3292 # Note, this doesn't generate a C-level symbol. It generates a
3293 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
3294 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
3296 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3298 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
3301 ac_have_as_lzcnt=yes
3302 AC_MSG_RESULT([yes])
3308 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
3311 # does the x86/amd64 assembler understand the LOOPNEL instruction?
3312 # Note, this doesn't generate a C-level symbol. It generates a
3313 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
3314 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
3316 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3318 __asm__ __volatile__("1: loopnel 1b\n");
3321 ac_have_as_loopnel=yes
3322 AC_MSG_RESULT([yes])
3324 ac_have_as_loopnel=no
3328 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
3331 # does the x86/amd64 assembler understand ADDR32 ?
3332 # Note, this doesn't generate a C-level symbol. It generates a
3333 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
3334 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
3336 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3338 asm volatile ("addr32 rep movsb");
3341 ac_have_as_addr32=yes
3342 AC_MSG_RESULT([yes])
3344 ac_have_as_addr32=no
3348 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
3351 # does the x86/amd64 assembler understand SSE 4.2 instructions?
3352 # Note, this doesn't generate a C-level symbol. It generates a
3353 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
3354 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
3356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3357 do { long long int x;
3358 __asm__ __volatile__(
3359 "crc32q %%r15,%%r15" : : : "r15" );
3360 __asm__ __volatile__(
3361 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
3362 __asm__ __volatile__(
3363 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
3366 ac_have_as_sse42=yes
3367 AC_MSG_RESULT([yes])
3373 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
3376 # does the x86/amd64 assembler understand AVX instructions?
3377 # Note, this doesn't generate a C-level symbol. It generates a
3378 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
3379 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
3381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3382 do { long long int x;
3383 __asm__ __volatile__(
3384 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
3385 __asm__ __volatile__(
3386 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3390 AC_MSG_RESULT([yes])
3396 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
3399 # does the x86/amd64 assembler understand AVX2 instructions?
3400 # Note, this doesn't generate a C-level symbol. It generates a
3401 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
3402 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
3404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3405 do { long long int x;
3406 __asm__ __volatile__(
3407 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3408 __asm__ __volatile__(
3409 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3413 AC_MSG_RESULT([yes])
3419 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
3422 # does the x86/amd64 assembler understand TSX instructions and
3423 # the XACQUIRE/XRELEASE prefixes?
3424 # Note, this doesn't generate a C-level symbol. It generates a
3425 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
3426 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
3428 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3430 __asm__ __volatile__(
3433 " xacquire lock incq 0(%rsp) \n\t"
3434 " xrelease lock incq 0(%rsp) \n"
3439 AC_MSG_RESULT([yes])
3445 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
3448 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
3449 # Note, this doesn't generate a C-level symbol. It generates a
3450 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
3451 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
3453 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3454 do { unsigned int h, l;
3455 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
3456 __asm__ __volatile__(
3457 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
3458 __asm__ __volatile__(
3459 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
3463 AC_MSG_RESULT([yes])
3469 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
3472 # does the x86/amd64 assembler understand FMA instructions?
3473 # Note, this doesn't generate a C-level symbol. It generates a
3474 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
3475 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
3477 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3478 do { unsigned int h, l;
3479 __asm__ __volatile__(
3480 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3481 __asm__ __volatile__(
3482 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
3483 __asm__ __volatile__(
3484 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
3488 AC_MSG_RESULT([yes])
3494 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
3497 # does the amd64 assembler understand MPX instructions?
3498 # Note, this doesn't generate a C-level symbol. It generates a
3499 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
3500 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
3502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3504 asm ("bndmov %bnd0,(%rsp)");
3505 asm ("bndldx 3(%rbx,%rdx), %bnd2");
3506 asm ("bnd call foo\n"
3513 AC_MSG_RESULT([yes])
3519 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
3522 # does the amd64 assembler understand ADX instructions?
3523 # Note, this doesn't generate a C-level symbol. It generates a
3524 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
3525 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
3527 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3529 asm ("adcxq %r14,%r8");
3533 AC_MSG_RESULT([yes])
3539 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
3542 # does the amd64 assembler understand the RDRAND instruction?
3543 # Note, this doesn't generate a C-level symbol. It generates a
3544 # automake-level symbol (BUILD_RDRAND_TESTS), used in test Makefile.am's
3545 AC_MSG_CHECKING([if amd64 assembler knows the RDRAND instruction])
3547 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3549 asm ("rdrand %r14");
3550 asm ("rdrand %r14d");
3551 asm ("rdrand %r14w");
3554 ac_have_as_rdrand=yes
3555 AC_MSG_RESULT([yes])
3557 ac_have_as_rdrand=no
3561 AM_CONDITIONAL(BUILD_RDRAND_TESTS, test x$ac_have_as_rdrand = xyes)
3563 # does the amd64 assembler understand the RDSEED instruction?
3564 # Note, this doesn't generate a C-level symbol. It generates a
3565 # automake-level symbol (BUILD_RDSEED_TESTS), used in test Makefile.am's
3566 AC_MSG_CHECKING([if amd64 assembler knows the RDSEED instruction])
3568 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3570 asm ("rdseed %r14");
3571 asm ("rdseed %r14d");
3572 asm ("rdseed %r14w");
3575 ac_have_as_rdseed=yes
3576 AC_MSG_RESULT([yes])
3578 ac_have_as_rdseed=no
3582 AM_CONDITIONAL(BUILD_RDSEED_TESTS, test x$ac_have_as_rdseed = xyes)
3584 # does the amd64 assembler understand the F16C instructions (VCVTPH2PS and
3586 # Note, this doesn't generate a C-level symbol. It generates a
3587 # automake-level symbol (BUILD_F16C_TESTS), used in test Makefile.am's
3588 AC_MSG_CHECKING([if amd64 assembler knows the F16C instructions])
3590 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3592 asm ("vcvtph2ps %xmm5, %ymm10");
3593 // If we put the dollar sign and zero together, the shell processing
3594 // this configure.ac script substitutes the command name in. Sigh.
3595 asm ("vcvtps2ph $" "0, %ymm10, %xmm5");
3599 AC_MSG_RESULT([yes])
3605 AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes)
3608 # does the x86/amd64 assembler understand MOVBE?
3609 # Note, this doesn't generate a C-level symbol. It generates a
3610 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
3611 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
3613 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3614 do { long long int x;
3615 __asm__ __volatile__(
3616 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
3619 ac_have_as_movbe=yes
3620 AC_MSG_RESULT([yes])
3626 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
3629 # Does the C compiler support the "ifunc" attribute
3630 # Note, this doesn't generate a C-level symbol. It generates a
3631 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
3632 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
3634 AC_LINK_IFELSE([AC_LANG_SOURCE([[
3635 static void mytest(void) {}
3637 static void (*resolve_test(void))(void)
3639 return (void (*)(void))&mytest;
3642 void test(void) __attribute__((ifunc("resolve_test")));
3650 ac_have_ifunc_attr=yes
3651 AC_MSG_RESULT([yes])
3653 ac_have_ifunc_attr=no
3657 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
3659 # Does the C compiler support the armv8 crc feature flag
3660 # Note, this doesn't generate a C-level symbol. It generates a
3661 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
3662 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
3664 save_CFLAGS="$CFLAGS"
3665 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
3666 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3672 ac_have_armv8_crc_feature=yes
3673 AC_MSG_RESULT([yes])
3675 ac_have_armv8_crc_feature=no
3678 CFLAGS="$save_CFLAGS"
3680 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
3683 # Does the C compiler support the armv81 flag and the assembler v8.1 instructions
3684 # Note, this doesn't generate a C-level symbol. It generates a
3685 # automake-level symbol (BUILD_ARMV81_TESTS), used in test Makefile.am's
3686 AC_MSG_CHECKING([if gcc supports the armv81 feature flag and assembler supports v8.1 instructions])
3688 save_CFLAGS="$CFLAGS"
3689 CFLAGS="$CFLAGS -march=armv8.1-a -Werror"
3690 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3693 __asm__ __volatile__("ldadd x0, x1, [x2]" ::: "memory");
3697 ac_have_armv81_feature=yes
3698 AC_MSG_RESULT([yes])
3700 ac_have_armv81_feature=no
3703 CFLAGS="$save_CFLAGS"
3705 AM_CONDITIONAL(BUILD_ARMV81_TESTS, test x$ac_have_armv81_feature = xyes)
3708 # Does the C compiler support the armv82 flag and the assembler v8.2 instructions
3709 # Note, this doesn't generate a C-level symbol. It generates a
3710 # automake-level symbol (BUILD_ARMV82_TESTS), used in test Makefile.am's
3711 AC_MSG_CHECKING([if gcc supports the armv82 feature flag and assembler supports v8.2 instructions])
3713 save_CFLAGS="$CFLAGS"
3714 CFLAGS="$CFLAGS -march=armv8.2-a+fp16 -Werror"
3715 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3718 __asm__ __volatile__("faddp h0, v1.2h");
3722 ac_have_armv82_feature=yes
3723 AC_MSG_RESULT([yes])
3725 ac_have_armv82_feature=no
3728 CFLAGS="$save_CFLAGS"
3730 AM_CONDITIONAL(BUILD_ARMV82_TESTS, test x$ac_have_armv82_feature = xyes)
3733 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
3734 # when building the tool executables. I think we should get rid of it.
3736 # Check for TLS support in the compiler and linker
3737 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3739 [vg_cv_linktime_tls=yes],
3740 [vg_cv_linktime_tls=no])
3741 # Native compilation: check whether running a program using TLS succeeds.
3742 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
3743 # succeeds but running programs using TLS fails.
3744 # Cross-compiling: check whether linking a program using TLS succeeds.
3745 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
3746 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
3747 [vg_cv_tls=$enableval],
3748 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3752 [vg_cv_tls=$vg_cv_linktime_tls])])])
3754 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
3755 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
3759 #----------------------------------------------------------------------------
3760 # Solaris-specific checks.
3761 #----------------------------------------------------------------------------
3763 if test "$VGCONF_OS" = "solaris" ; then
3764 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
3766 # Solaris-specific check determining if the Sun Studio Assembler is used to
3767 # build Valgrind. The test checks if the x86/amd64 assembler understands the
3768 # cmovl.l instruction, if yes then it's Sun Assembler.
3770 # C-level symbol: none
3771 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
3773 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
3774 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3776 __asm__ __volatile__("cmovl.l %edx, %eax");
3778 solaris_have_sun_studio_as=yes
3779 AC_MSG_RESULT([yes])
3781 solaris_have_sun_studio_as=no
3784 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
3786 # Solaris-specific check determining if symbols __xpg4 and __xpg6
3787 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
3788 # See solaris/vgpreload-solaris.mapfile for details.
3789 # gcc on older Solaris instructs linker to include these symbols,
3790 # gcc on illumos and newer Solaris does not.
3792 # C-level symbol: none
3793 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
3795 save_CFLAGS="$CFLAGS"
3796 CFLAGS="$CFLAGS -std=gnu99"
3797 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
3798 temp_dir=$( /usr/bin/mktemp -d )
3799 cat <<_ACEOF >${temp_dir}/mylib.c
3801 int myfunc(void) { printf("LaPutyka\n"); }
3803 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
3804 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
3805 if test "x${xpg_present}" = "x" ; then
3806 solaris_xpg_symbols_present=no
3809 solaris_xpg_symbols_present=yes
3810 AC_MSG_RESULT([yes])
3813 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
3814 CFLAGS="$save_CFLAGS"
3817 # Solaris-specific check determining if gcc enables largefile support by
3818 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
3819 # variable with gcc flags which disable it.
3821 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
3822 save_CFLAGS="$CFLAGS"
3823 CFLAGS="$CFLAGS -m32"
3824 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3825 return _LARGEFILE_SOURCE;
3827 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
3828 AC_MSG_RESULT([yes])
3830 SOLARIS_UNDEF_LARGESOURCE=""
3834 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
3837 # Solaris-specific check determining if /proc/self/cmdline
3838 # or /proc/<pid>/cmdline is supported.
3840 # C-level symbol: SOLARIS_PROC_CMDLINE
3841 # Automake-level symbol: SOLARIS_PROC_CMDLINE
3843 AC_CHECK_FILE([/proc/self/cmdline],
3845 solaris_proc_cmdline=yes
3846 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
3847 [Define to 1 if you have /proc/self/cmdline.])
3849 solaris_proc_cmdline=no
3851 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3854 # Solaris-specific check determining default platform for the Valgrind launcher.
3855 # Used in case the launcher cannot select platform by looking at the client
3856 # image (for example because the executable is a shell script).
3858 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3859 # Automake-level symbol: none
3861 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3862 # Get the ELF class of /bin/sh first.
3863 if ! test -f /bin/sh; then
3864 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3866 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3867 case "$elf_class" in
3869 default_arch="$VGCONF_ARCH_PRI";
3872 if test "x$VGCONF_ARCH_SEC" != "x"; then
3873 default_arch="$VGCONF_ARCH_SEC"
3875 default_arch="$VGCONF_ARCH_PRI";
3879 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3882 default_platform="$default_arch-$VGCONF_OS"
3883 AC_MSG_RESULT([$default_platform])
3884 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3885 [Default platform for Valgrind launcher.])
3888 # Solaris-specific check determining if the old syscalls are available.
3890 # C-level symbol: SOLARIS_OLD_SYSCALLS
3891 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3893 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3894 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3895 #include <sys/syscall.h>
3899 solaris_old_syscalls=yes
3900 AC_MSG_RESULT([yes])
3901 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3902 [Define to 1 if you have the old Solaris syscalls.])
3904 solaris_old_syscalls=no
3907 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
3910 # Solaris-specific check determining if the new accept() syscall is available.
3913 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3916 # New syscall (available on illumos):
3917 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3918 # int version, int flags);
3920 # If the old syscall is present then the following syscall will fail with
3921 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
3922 # available then it will fail with EINVAL (because the flags parameter is
3925 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
3926 # Automake-level symbol: none
3928 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
3929 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3930 #include <sys/syscall.h>
3934 syscall(SYS_accept, 0, 0, 0, 0, -1);
3935 return !(errno == EINVAL);
3937 AC_MSG_RESULT([yes])
3938 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
3939 [Define to 1 if you have the new `accept' syscall.])
3945 # Solaris-specific check determining if the new illumos pipe() syscall is
3949 # longlong_t pipe();
3951 # New syscall (available on illumos):
3952 # int pipe(intptr_t arg, int flags);
3954 # If the old syscall is present then the following call will succeed, if the
3955 # new syscall is available then it will fail with EFAULT (because address 0
3956 # cannot be accessed).
3958 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
3959 # Automake-level symbol: none
3961 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
3962 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3963 #include <sys/syscall.h>
3967 syscall(SYS_pipe, 0, 0);
3968 return !(errno == EFAULT);
3970 AC_MSG_RESULT([yes])
3971 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3972 [Define to 1 if you have the new `pipe' syscall.])
3978 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
3982 # int lwp_kill(id_t lwpid, int sig);
3984 # New syscall (available on Solaris 11):
3985 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3986 # int si_code, timespec_t *timeout);
3988 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3989 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3991 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3992 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3993 #include <sys/syscall.h>
3995 return !SYS_lwp_sigqueue;
3997 solaris_lwp_sigqueue_syscall=yes
3998 AC_MSG_RESULT([yes])
3999 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
4000 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
4002 solaris_lwp_sigqueue_syscall=no
4005 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
4008 # Solaris-specific check determining if the lwp_sigqueue() syscall
4009 # takes both pid and thread id arguments or just thread id.
4011 # Old syscall (available up to Solaris 11.3):
4012 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
4013 # int si_code, timespec_t *timeout);
4015 # New syscall (available since Solaris 11.4):
4016 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
4017 # int si_code, timespec_t *timeout);
4019 # If the old syscall is present then the following syscall will fail with
4020 # EINVAL (because signal is out of range); if the new syscall is available
4021 # then it will fail with ESRCH (because it would not find such thread in the
4024 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4025 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4027 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
4028 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
4029 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4030 #include <sys/syscall.h>
4034 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
4035 return !(errno == ESRCH);
4037 solaris_lwp_sigqueue_syscall_takes_pid=yes
4038 AC_MSG_RESULT([yes])
4039 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
4040 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
4042 solaris_lwp_sigqueue_syscall_takes_pid=no
4045 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
4046 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
4048 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
4052 # Solaris-specific check determining if the new lwp_name() syscall is
4055 # New syscall (available on Solaris 11):
4056 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
4058 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
4059 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
4061 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
4062 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4063 #include <sys/syscall.h>
4065 return !SYS_lwp_name;
4067 solaris_lwp_name_syscall=yes
4068 AC_MSG_RESULT([yes])
4069 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
4070 [Define to 1 if you have the new `lwp_name' syscall.])
4072 solaris_lwp_name_syscall=no
4075 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
4078 # Solaris-specific check determining if the new getrandom() syscall is
4081 # New syscall (available on Solaris 11):
4082 # int getrandom(void *buf, size_t buflen, uint_t flags);
4084 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
4085 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
4087 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
4088 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4089 #include <sys/syscall.h>
4091 return !SYS_getrandom;
4093 solaris_getrandom_syscall=yes
4094 AC_MSG_RESULT([yes])
4095 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
4096 [Define to 1 if you have the new `getrandom' syscall.])
4098 solaris_getrandom_syscall=no
4101 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
4104 # Solaris-specific check determining if the new zone() syscall subcodes
4105 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
4106 # were added in Solaris 11 but are missing on illumos.
4108 # C-level symbol: SOLARIS_ZONE_DEFUNCT
4109 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
4111 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
4112 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4113 #include <sys/zone.h>
4115 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
4117 solaris_zone_defunct=yes
4118 AC_MSG_RESULT([yes])
4119 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
4120 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
4122 solaris_zone_defunct=no
4125 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
4128 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
4129 # for auditon(2) subcode of the auditsys() syscall are available.
4130 # These commands are available in Solaris 11 and illumos but were removed
4133 # C-level symbol: SOLARIS_AUDITON_STAT
4134 # Automake-level symbol: SOLARIS_AUDITON_STAT
4136 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
4137 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4138 #include <bsm/audit.h>
4140 return !(A_GETSTAT && A_SETSTAT);
4142 solaris_auditon_stat=yes
4143 AC_MSG_RESULT([yes])
4144 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
4145 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
4147 solaris_auditon_stat=no
4150 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
4153 # Solaris-specific check determining if the new shmsys() syscall subcodes
4154 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
4155 # These subcodes were added in Solaris 11 but are missing on illumos.
4157 # C-level symbol: SOLARIS_SHM_NEW
4158 # Automake-level symbol: SOLARIS_SHM_NEW
4160 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
4161 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4162 #include <sys/ipc_impl.h>
4163 #include <sys/shm.h>
4164 #include <sys/shm_impl.h>
4166 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
4169 AC_MSG_RESULT([yes])
4170 AC_DEFINE([SOLARIS_SHM_NEW], 1,
4171 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
4176 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
4179 # Solaris-specific check determining if prxregset_t is available. Illumos
4180 # currently does not define it on the x86 platform.
4182 # C-level symbol: SOLARIS_PRXREGSET_T
4183 # Automake-level symbol: SOLARIS_PRXREGSET_T
4185 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
4186 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4187 #include <sys/procfs_isa.h>
4189 return !sizeof(prxregset_t);
4191 solaris_prxregset_t=yes
4192 AC_MSG_RESULT([yes])
4193 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
4194 [Define to 1 if you have the `prxregset_t' type.])
4196 solaris_prxregset_t=no
4199 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
4202 # Solaris-specific check determining if the new frealpathat() syscall is
4205 # New syscall (available on Solaris 11.1):
4206 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
4208 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4209 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4211 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
4212 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4213 #include <sys/syscall.h>
4215 return !SYS_frealpathat;
4217 solaris_frealpathat_syscall=yes
4218 AC_MSG_RESULT([yes])
4219 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
4220 [Define to 1 if you have the new `frealpathat' syscall.])
4222 solaris_frealpathat_syscall=no
4225 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
4228 # Solaris-specific check determining if the new uuidsys() syscall is
4231 # New syscall (available on newer Solaris):
4232 # int uuidsys(struct uuid *uuid);
4234 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
4235 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
4237 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
4238 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4239 #include <sys/syscall.h>
4241 return !SYS_uuidsys;
4243 solaris_uuidsys_syscall=yes
4244 AC_MSG_RESULT([yes])
4245 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
4246 [Define to 1 if you have the new `uuidsys' syscall.])
4248 solaris_uuidsys_syscall=no
4251 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
4254 # Solaris-specific check determining if the new labelsys() syscall subcode
4255 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
4256 # missing on illumos.
4258 # C-level symbol: SOLARIS_TNDB_GET_TNIP
4259 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
4261 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
4262 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4263 #include <sys/tsol/tndb.h>
4265 return !TNDB_GET_TNIP;
4267 solaris_tndb_get_tnip=yes
4268 AC_MSG_RESULT([yes])
4269 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
4270 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
4272 solaris_tndb_get_tnip=no
4275 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
4278 # Solaris-specific check determining if the new labelsys() syscall opcodes
4279 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
4280 # added in Solaris 11 but are missing on illumos.
4282 # C-level symbol: SOLARIS_TSOL_CLEARANCE
4283 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
4285 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
4286 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4287 #include <sys/tsol/tsyscall.h>
4289 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
4291 solaris_tsol_clearance=yes
4292 AC_MSG_RESULT([yes])
4293 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
4294 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
4296 solaris_tsol_clearance=no
4299 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
4302 # Solaris-specific check determining if the new pset() syscall subcode
4303 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
4304 # is missing on illumos and Solaris 11.3.
4306 # C-level symbol: SOLARIS_PSET_GET_NAME
4307 # Automake-level symbol: SOLARIS_PSET_GET_NAME
4309 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
4310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4311 #include <sys/pset.h>
4313 return !(PSET_GET_NAME);
4315 solaris_pset_get_name=yes
4316 AC_MSG_RESULT([yes])
4317 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
4318 [Define to 1 if you have the `PSET_GET_NAME' constants.])
4320 solaris_pset_get_name=no
4323 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
4326 # Solaris-specific check determining if the utimesys() syscall is
4327 # available (on illumos and older Solaris).
4329 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
4330 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
4332 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
4333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4334 #include <sys/syscall.h>
4336 return !SYS_utimesys;
4338 solaris_utimesys_syscall=yes
4339 AC_MSG_RESULT([yes])
4340 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
4341 [Define to 1 if you have the `utimesys' syscall.])
4343 solaris_utimesys_syscall=no
4346 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
4349 # Solaris-specific check determining if the utimensat() syscall is
4350 # available (on newer Solaris).
4352 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4353 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4355 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
4356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4357 #include <sys/syscall.h>
4359 return !SYS_utimensat;
4361 solaris_utimensat_syscall=yes
4362 AC_MSG_RESULT([yes])
4363 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
4364 [Define to 1 if you have the `utimensat' syscall.])
4366 solaris_utimensat_syscall=no
4369 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
4372 # Solaris-specific check determining if the spawn() syscall is available
4373 # (on newer Solaris).
4375 # C-level symbol: SOLARIS_SPAWN_SYSCALL
4376 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
4378 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
4379 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4380 #include <sys/syscall.h>
4384 solaris_spawn_syscall=yes
4385 AC_MSG_RESULT([yes])
4386 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
4387 [Define to 1 if you have the `spawn' syscall.])
4389 solaris_spawn_syscall=no
4392 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
4395 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
4396 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
4398 # C-level symbol: SOLARIS_MODCTL_MODNVL
4399 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
4401 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
4402 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4403 #include <sys/modctl.h>
4405 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
4407 solaris_modctl_modnvl=yes
4408 AC_MSG_RESULT([yes])
4409 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
4410 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
4412 solaris_modctl_modnvl=no
4415 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
4418 # Solaris-specific check determining whether nscd (name switch cache daemon)
4419 # attaches its door at /system/volatile/name_service_door (Solaris)
4420 # or at /var/run/name_service_door (illumos).
4422 # Note that /var/run is a symlink to /system/volatile on Solaris
4423 # but not vice versa on illumos.
4425 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4426 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4428 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
4429 if test -e /system/volatile/name_service_door; then
4430 solaris_nscd_door_system_volatile=yes
4431 AC_MSG_RESULT([/system/volatile/name_service_door])
4432 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
4433 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
4435 solaris_nscd_door_system_volatile=no
4436 AC_MSG_RESULT([/var/run/name_service_door])
4438 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
4441 # Solaris-specific check determining if the new gethrt() fasttrap is available.
4443 # New fasttrap (available on Solaris 11):
4444 # hrt_t *gethrt(void);
4446 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
4447 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
4449 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
4450 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4451 #include <sys/trap.h>
4455 solaris_gethrt_fasttrap=yes
4456 AC_MSG_RESULT([yes])
4457 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
4458 [Define to 1 if you have the new `gethrt' fasttrap.])
4460 solaris_gethrt_fasttrap=no
4463 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
4466 # Solaris-specific check determining if the new get_zone_offset() fasttrap
4469 # New fasttrap (available on Solaris 11):
4470 # zonehrtoffset_t *get_zone_offset(void);
4472 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4473 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4475 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
4476 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4477 #include <sys/trap.h>
4479 return !T_GETZONEOFFSET;
4481 solaris_getzoneoffset_fasttrap=yes
4482 AC_MSG_RESULT([yes])
4483 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
4484 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
4486 solaris_getzoneoffset_fasttrap=no
4489 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
4492 # Solaris-specific check determining if the execve() syscall
4493 # takes fourth argument (flags) or not.
4495 # Old syscall (available on illumos):
4496 # int execve(const char *fname, const char **argv, const char **envp);
4498 # New syscall (available on Solaris):
4499 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
4501 # If the new syscall is present then it will fail with EINVAL (because flags
4502 # are invalid); if the old syscall is available then it will fail with ENOENT
4503 # (because the file could not be found).
4505 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4506 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4508 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
4509 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4510 #include <sys/syscall.h>
4514 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
4515 return !(errno == EINVAL);
4517 solaris_execve_syscall_takes_flags=yes
4518 AC_MSG_RESULT([yes])
4519 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
4520 [Define to 1 if you have the new `execve' syscall which accepts flags.])
4522 solaris_execve_syscall_takes_flags=no
4525 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
4526 test x$solaris_execve_syscall_takes_flags = xyes)
4529 # Solaris-specific check determining version of the repository cache protocol.
4530 # Every Solaris version uses a different one, ranging from 21 to current 25.
4531 # The check is very ugly, though.
4533 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
4534 # Automake-level symbol: none
4536 AC_PATH_PROG(DIS_PATH, dis, false)
4537 if test "x$DIS_PATH" = "xfalse"; then
4538 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
4540 # The illumos source is (or was) here
4541 # https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libscf/common/lowlevel.c#L1148
4542 # specifically the line
4544 # request.rdr_version = REPOSITORY_DOOR_VERSION;
4546 # rdr_version is a 32bit unsigned int
4547 # The macro REPOSITORY_DOOR_VERSION contains the ascii letters "Rep" in the top 3
4548 # bytes and the door version in the lowest byte. Hence we look for Rep which is 526570
4549 # in hex and then extrace the following byte.
4550 AC_CHECK_LIB(scf, scf_handle_bind, [], [
4551 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
4552 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4555 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
4556 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
4557 libscf=/usr/lib/64/libscf.so.1
4559 libscf=/usr/lib/libscf.so.1
4561 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q -E '0x(4d01)?526570'; then
4562 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
4563 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4565 hex=$( $DIS_PATH -F scf_handle_bind $libscf | grep 526570 | sed 's/.*526570//;s/,.*//' )
4566 if test -z "$hex"; then
4567 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
4568 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4570 version=$( printf "%d\n" 0x$hex )
4571 AC_MSG_RESULT([$version])
4572 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
4573 [Version number of the repository door cache protocol.])
4576 # Solaris-specific check determining if "sysstat" segment reservation type
4579 # New "sysstat" segment reservation (available on Solaris 11.4):
4580 # - program header type: PT_SUNW_SYSSTAT
4581 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
4583 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4584 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4586 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
4587 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4588 #include <sys/auxv.h>
4590 return !AT_SUN_SYSSTAT_ADDR;
4592 solaris_reserve_sysstat_addr=yes
4593 AC_MSG_RESULT([yes])
4594 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
4595 [Define to 1 if you have the new `sysstat' segment reservation.])
4597 solaris_reserve_sysstat_addr=no
4600 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
4603 # Solaris-specific check determining if "sysstat_zone" segment reservation type
4606 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
4607 # - program header type: PT_SUNW_SYSSTAT_ZONE
4608 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
4610 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4611 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4613 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
4614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4615 #include <sys/auxv.h>
4617 return !AT_SUN_SYSSTAT_ZONE_ADDR;
4619 solaris_reserve_sysstat_zone_addr=yes
4620 AC_MSG_RESULT([yes])
4621 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
4622 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
4624 solaris_reserve_sysstat_zone_addr=no
4627 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
4630 # Solaris-specific check determining if the system_stats() syscall is available
4631 # (on newer Solaris).
4633 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4634 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4636 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
4637 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4638 #include <sys/syscall.h>
4640 return !SYS_system_stats;
4642 solaris_system_stats_syscall=yes
4643 AC_MSG_RESULT([yes])
4644 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
4645 [Define to 1 if you have the `system_stats' syscall.])
4647 solaris_system_stats_syscall=no
4650 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
4653 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
4654 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
4656 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
4657 # Automake-level symbol: none
4659 AC_CHECK_TYPE([struct _fpchip_state],
4660 [solaris_fpchip_state_takes_underscore=yes],
4661 [solaris_fpchip_state_takes_underscore=no],
4662 [[#include <sys/regset.h>]])
4663 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
4664 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
4665 [Define to 1 if fpregset_t defines struct _fpchip_state])
4669 # Solaris-specific check determining if schedctl page shared between kernel
4670 # and userspace program is executable (illumos, older Solaris) or not (newer
4673 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
4674 # Automake-level symbol: none
4676 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
4677 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4681 #include <schedctl.h>
4685 schedctl_t *scp = schedctl_init();
4689 int fd = open("/proc/self/map", O_RDONLY);
4694 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
4695 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
4696 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
4697 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
4698 return (map.pr_mflags & MA_EXEC);
4704 solaris_schedctl_page_exec=no
4707 solaris_schedctl_page_exec=yes
4708 AC_MSG_RESULT([yes])
4709 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
4710 [Define to 1 if you have the schedctl page executable.])
4714 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
4715 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
4716 # an initial thread pointer for libc (newer Solaris).
4718 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
4719 # Automake-level symbol: none
4721 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
4722 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4723 #include <sys/fasttrap_isa.h>
4725 return !FT_SCRATCHSIZE;
4727 solaris_pt_sunwdtrace_thrp=yes
4728 AC_MSG_RESULT([yes])
4729 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
4730 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
4732 solaris_pt_sunwdtrace_thrp=no
4737 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
4738 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
4739 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
4740 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
4741 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
4742 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
4743 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
4744 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
4745 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
4746 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
4747 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
4748 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
4749 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
4750 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
4751 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
4752 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
4753 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
4754 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
4755 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
4756 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
4757 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
4758 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
4759 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
4760 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
4761 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
4762 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
4763 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
4764 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
4765 fi # test "$VGCONF_OS" = "solaris"
4767 #----------------------------------------------------------------------------
4768 # FreeBSD-specific checks.
4769 #----------------------------------------------------------------------------
4771 # Rather than having a large number of feature test as above with Solaris
4772 # these tests are per-version. This may not be entirely relialable for
4773 # FreeBSD development branches (XX.Y-CURRENT) or pre-release branches
4774 # (XX.Y-STABLE) but it should work for XX-Y-RELEASE
4776 if test "$VGCONF_OS" = "freebsd" ; then
4778 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13_0)
4782 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, false)
4784 fi # test "$VGCONF_OS" = "freebsd"
4787 #----------------------------------------------------------------------------
4788 # Checks for C header files.
4789 #----------------------------------------------------------------------------
4791 AC_CHECK_HEADERS([ \
4809 # Verify whether the <linux/futex.h> header is usable.
4810 AC_MSG_CHECKING([if <linux/futex.h> is usable])
4812 save_CFLAGS="$CFLAGS"
4813 CFLAGS="$CFLAGS -D__user="
4814 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4815 #include <linux/futex.h>
4819 ac_have_usable_linux_futex_h=yes
4820 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
4821 [Define to 1 if you have a usable <linux/futex.h> header file.])
4822 AC_MSG_RESULT([yes])
4824 ac_have_usable_linux_futex_h=no
4827 CFLAGS="$save_CFLAGS"
4830 #----------------------------------------------------------------------------
4831 # Checks for typedefs, structures, and compiler characteristics.
4832 #----------------------------------------------------------------------------
4836 AC_CHECK_HEADERS_ONCE([sys/time.h])
4838 AC_CHECK_TYPE([struct statx], [
4839 AC_DEFINE([HAVE_STRUCT_STATX_IN_SYS_STAT_H], 1,
4840 [Define to 1 if <sys/stat.h> declares struct statx.])
4843 #include <sys/stat.h>
4847 #----------------------------------------------------------------------------
4848 # Checks for library functions.
4849 #----------------------------------------------------------------------------
4853 AC_CHECK_LIB([pthread], [pthread_create])
4854 AC_CHECK_LIB([rt], [clock_gettime])
4876 pthread_barrier_init \
4877 pthread_condattr_setclock \
4878 pthread_mutex_timedlock \
4879 pthread_rwlock_timedrdlock \
4880 pthread_rwlock_timedwrlock \
4881 pthread_setname_np \
4907 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
4908 # libraries with any shared object and/or executable. This is NOT what we
4909 # want for e.g. vgpreload_core-x86-linux.so
4912 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
4913 [test x$ac_cv_func_pthread_barrier_init = xyes])
4914 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
4915 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
4916 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
4917 [test x$ac_cv_func_pthread_spin_lock = xyes])
4918 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
4919 [test x$ac_cv_func_pthread_setname_np = xyes])
4920 AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
4921 [test x$ac_cv_func_copy_file_range = xyes])
4922 AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
4923 [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
4924 AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
4925 [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes])
4926 AM_CONDITIONAL([HAVE_SETCONTEXT], [test x$ac_cv_func_setcontext = xyes])
4927 AM_CONDITIONAL([HAVE_SWAPCONTEXT], [test x$ac_cv_func_swapcontext = xyes])
4928 AM_CONDITIONAL([HAVE_MEMFD_CREATE],
4929 [test x$ac_cv_func_memfd_create = xyes])
4930 AM_CONDITIONAL([HAVE_GETADDRINFO],
4931 [test x$ac_cv_func_getaddrinfo = xyes])
4933 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4934 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
4935 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX; then
4936 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
4937 [Disable intercept pthread_spin_lock() on MIPS32, MIPS64 and nanoMIPS.])
4940 #----------------------------------------------------------------------------
4942 #----------------------------------------------------------------------------
4943 # Do we have a useable MPI setup on the primary and/or secondary targets?
4944 # On Linux, by default, assumes mpicc and -m32/-m64
4945 # Note: this is a kludge in that it assumes the specified mpicc
4946 # understands -m32/-m64 regardless of what is specified using
4948 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
4949 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
4952 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
4953 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
4954 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
4955 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
4956 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4957 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX \
4958 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
4959 mflag_primary=$FLAG_M32
4960 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
4961 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
4962 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
4963 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
4964 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
4965 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
4966 mflag_primary=$FLAG_M64
4967 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
4968 mflag_primary="$FLAG_M32 -arch i386"
4969 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
4970 mflag_primary="$FLAG_M64 -arch x86_64"
4974 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
4975 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
4976 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
4977 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX \
4978 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD ; then
4979 mflag_secondary=$FLAG_M32
4980 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
4981 mflag_secondary="$FLAG_M32 -arch i386"
4986 [ --with-mpicc= Specify name of MPI2-ised C compiler],
4991 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
4992 ## use these values in the check for a functioning mpicc.
4994 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
4995 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
4996 AM_COND_IF([VGCONF_OS_IS_LINUX],
4997 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4998 LDFLAGS_MPI="-fpic -shared"])
4999 AM_COND_IF([VGCONF_OS_IS_FREEBSD],
5000 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5001 LDFLAGS_MPI="-fpic -shared"])
5002 AM_COND_IF([VGCONF_OS_IS_DARWIN],
5003 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
5004 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
5005 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
5006 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5007 LDFLAGS_MPI="-fpic -shared"])
5009 AC_SUBST([CFLAGS_MPI])
5010 AC_SUBST([LDFLAGS_MPI])
5013 ## See if MPI_CC works for the primary target
5015 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
5017 saved_CFLAGS=$CFLAGS
5019 CFLAGS="$CFLAGS_MPI $mflag_primary"
5020 saved_LDFLAGS="$LDFLAGS"
5021 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
5022 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5026 int ni, na, nd, comb;
5027 int r = MPI_Init(NULL,NULL);
5028 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5029 r |= MPI_Finalize();
5032 ac_have_mpi2_pri=yes
5033 AC_MSG_RESULT([yes, $MPI_CC])
5039 CFLAGS=$saved_CFLAGS
5040 LDFLAGS="$saved_LDFLAGS"
5041 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
5043 ## See if MPI_CC works for the secondary target. Complication: what if
5044 ## there is no secondary target? We need this to then fail.
5045 ## Kludge this by making MPI_CC something which will surely fail in
5048 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
5050 saved_CFLAGS=$CFLAGS
5051 saved_LDFLAGS="$LDFLAGS"
5052 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
5053 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
5054 CC="$MPI_CC this will surely fail"
5058 CFLAGS="$CFLAGS_MPI $mflag_secondary"
5059 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5063 int ni, na, nd, comb;
5064 int r = MPI_Init(NULL,NULL);
5065 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5066 r |= MPI_Finalize();
5069 ac_have_mpi2_sec=yes
5070 AC_MSG_RESULT([yes, $MPI_CC])
5076 CFLAGS=$saved_CFLAGS
5077 LDFLAGS="$saved_LDFLAGS"
5078 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
5081 #----------------------------------------------------------------------------
5082 # Other library checks
5083 #----------------------------------------------------------------------------
5084 # There now follow some tests for Boost, and OpenMP. These
5085 # tests are present because Drd has some regression tests that use
5086 # these packages. All regression test programs all compiled only
5087 # for the primary target. And so it is important that the configure
5088 # checks that follow, use the correct -m32 or -m64 flag for the
5089 # primary target (called $mflag_primary). Otherwise, we can end up
5090 # in a situation (eg) where, on amd64-linux, the test for Boost checks
5091 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
5092 # only build (meaning, the primary target is x86-linux), the build
5093 # of the regtest programs that use Boost fails, because they are
5094 # build as 32-bit (IN THIS EXAMPLE).
5096 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
5097 # NEEDED BY THE REGRESSION TEST PROGRAMS.
5100 # Check whether the boost library 1.35 or later has been installed.
5101 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
5103 AC_MSG_CHECKING([for boost])
5106 safe_CXXFLAGS=$CXXFLAGS
5107 CXXFLAGS="$mflag_primary"
5109 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
5111 AC_LINK_IFELSE([AC_LANG_SOURCE([
5112 #include <boost/thread.hpp>
5113 static void thread_func(void)
5115 int main(int argc, char** argv)
5117 boost::thread t(thread_func);
5122 ac_have_boost_1_35=yes
5123 AC_SUBST([BOOST_CFLAGS], [])
5124 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
5125 AC_MSG_RESULT([yes])
5127 ac_have_boost_1_35=no
5132 CXXFLAGS=$safe_CXXFLAGS
5135 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
5138 # does this compiler support -fopenmp, does it have the include file
5139 # <omp.h> and does it have libgomp ?
5141 AC_MSG_CHECKING([for OpenMP])
5144 CFLAGS="-fopenmp $mflag_primary -Werror"
5146 AC_LINK_IFELSE([AC_LANG_SOURCE([
5148 int main(int argc, char** argv)
5156 AC_MSG_RESULT([yes])
5163 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
5166 # Check for __builtin_popcount
5167 AC_MSG_CHECKING([for __builtin_popcount()])
5168 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5170 __builtin_popcount(2);
5173 AC_MSG_RESULT([yes])
5174 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
5175 [Define to 1 if compiler provides __builtin_popcount().])
5180 # Check for __builtin_clz
5181 AC_MSG_CHECKING([for __builtin_clz()])
5182 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5187 AC_MSG_RESULT([yes])
5188 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
5189 [Define to 1 if compiler provides __builtin_clz().])
5194 # Check for __builtin_ctz
5195 AC_MSG_CHECKING([for __builtin_ctz()])
5196 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5201 AC_MSG_RESULT([yes])
5202 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
5203 [Define to 1 if compiler provides __builtin_ctz().])
5208 # does this compiler have built-in functions for atomic memory access for the
5210 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
5213 CFLAGS="$mflag_primary"
5215 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5217 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5218 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5220 ac_have_builtin_atomic_primary=yes
5221 AC_MSG_RESULT([yes])
5222 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])
5224 ac_have_builtin_atomic_primary=no
5230 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
5231 [test x$ac_have_builtin_atomic_primary = xyes])
5234 # does this compiler have built-in functions for atomic memory access for the
5235 # secondary target ?
5237 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5239 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
5242 CFLAGS="$mflag_secondary"
5244 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5246 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
5248 ac_have_builtin_atomic_secondary=yes
5249 AC_MSG_RESULT([yes])
5251 ac_have_builtin_atomic_secondary=no
5259 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
5260 [test x$ac_have_builtin_atomic_secondary = xyes])
5262 # does this compiler have built-in functions for atomic memory access on
5263 # 64-bit integers for all targets ?
5265 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
5267 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5270 uint64_t variable = 1;
5271 return __sync_add_and_fetch(&variable, 1)
5273 ac_have_builtin_atomic64_primary=yes
5275 ac_have_builtin_atomic64_primary=no
5278 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5281 CFLAGS="$mflag_secondary"
5283 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5286 uint64_t variable = 1;
5287 return __sync_add_and_fetch(&variable, 1)
5289 ac_have_builtin_atomic64_secondary=yes
5291 ac_have_builtin_atomic64_secondary=no
5298 if test x$ac_have_builtin_atomic64_primary = xyes && \
5299 test x$VGCONF_PLATFORM_SEC_CAPS = x \
5300 -o x$ac_have_builtin_atomic64_secondary = xyes; then
5301 AC_MSG_RESULT([yes])
5302 ac_have_builtin_atomic64=yes
5305 ac_have_builtin_atomic64=no
5308 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
5309 [test x$ac_have_builtin_atomic64 = xyes])
5312 AC_MSG_CHECKING([if platform has openat2 syscall])
5314 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5315 #include <sys/syscall.h>
5324 AM_CONDITIONAL([HAVE_OPENAT2],
5325 [test x$ac_have_openat2 = xyes])
5327 # does g++ have built-in functions for atomic memory access ?
5328 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
5330 safe_CXXFLAGS=$CXXFLAGS
5331 CXXFLAGS="$mflag_primary"
5334 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5336 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5337 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5339 ac_have_builtin_atomic_cxx=yes
5340 AC_MSG_RESULT([yes])
5341 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
5343 ac_have_builtin_atomic_cxx=no
5348 CXXFLAGS=$safe_CXXFLAGS
5350 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
5353 if test x$ac_have_usable_linux_futex_h = xyes \
5354 -a x$ac_have_builtin_atomic_primary = xyes; then
5355 ac_enable_linux_ticket_lock_primary=yes
5357 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
5358 [test x$ac_enable_linux_ticket_lock_primary = xyes])
5360 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
5361 -a x$ac_have_usable_linux_futex_h = xyes \
5362 -a x$ac_have_builtin_atomic_secondary = xyes; then
5363 ac_enable_linux_ticket_lock_secondary=yes
5365 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
5366 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
5369 # does libstdc++ support annotating shared pointers ?
5370 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
5372 safe_CXXFLAGS=$CXXFLAGS
5373 CXXFLAGS="-std=c++0x"
5376 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5379 std::shared_ptr<int> p
5381 ac_have_shared_ptr=yes
5383 ac_have_shared_ptr=no
5385 if test x$ac_have_shared_ptr = xyes; then
5386 # If compilation of the program below fails because of a syntax error
5387 # triggered by substituting one of the annotation macros then that
5388 # means that libstdc++ supports these macros.
5389 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5390 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
5391 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
5394 std::shared_ptr<int> p
5396 ac_have_shared_pointer_annotation=no
5399 ac_have_shared_pointer_annotation=yes
5400 AC_MSG_RESULT([yes])
5401 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
5402 [Define to 1 if libstd++ supports annotating shared pointers])
5405 ac_have_shared_pointer_annotation=no
5410 CXXFLAGS=$safe_CXXFLAGS
5412 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
5413 [test x$ac_have_shared_pointer_annotation = xyes])
5416 #----------------------------------------------------------------------------
5417 # Ok. We're done checking.
5418 #----------------------------------------------------------------------------
5420 # Nb: VEX/Makefile is generated from Makefile.vex.in.
5423 VEX/Makefile:Makefile.vex.in
5427 glibc-2.X-helgrind.supp
5431 docs/xml/vg-entities.xml
5436 gdbserver_tests/Makefile
5437 gdbserver_tests/solaris/Makefile
5443 memcheck/tests/Makefile
5444 memcheck/tests/common/Makefile
5445 memcheck/tests/amd64/Makefile
5446 memcheck/tests/x86/Makefile
5447 memcheck/tests/linux/Makefile
5448 memcheck/tests/linux/debuginfod-check.vgtest
5449 memcheck/tests/darwin/Makefile
5450 memcheck/tests/solaris/Makefile
5451 memcheck/tests/freebsd/Makefile
5452 memcheck/tests/amd64-linux/Makefile
5453 memcheck/tests/arm64-linux/Makefile
5454 memcheck/tests/x86-linux/Makefile
5455 memcheck/tests/amd64-solaris/Makefile
5456 memcheck/tests/x86-solaris/Makefile
5457 memcheck/tests/amd64-freebsd/Makefile
5458 memcheck/tests/x86-freebsd/Makefile
5459 memcheck/tests/ppc32/Makefile
5460 memcheck/tests/ppc64/Makefile
5461 memcheck/tests/s390x/Makefile
5462 memcheck/tests/mips32/Makefile
5463 memcheck/tests/mips64/Makefile
5464 memcheck/tests/vbit-test/Makefile
5466 cachegrind/tests/Makefile
5467 cachegrind/tests/x86/Makefile
5468 cachegrind/cg_annotate
5472 callgrind/callgrind_annotate
5473 callgrind/callgrind_control
5474 callgrind/tests/Makefile
5476 helgrind/tests/Makefile
5478 drd/scripts/download-and-build-splash2
5481 massif/tests/Makefile
5486 lackey/tests/Makefile
5489 none/tests/scripts/Makefile
5490 none/tests/amd64/Makefile
5491 none/tests/ppc32/Makefile
5492 none/tests/ppc64/Makefile
5493 none/tests/x86/Makefile
5494 none/tests/arm/Makefile
5495 none/tests/arm64/Makefile
5496 none/tests/s390x/Makefile
5497 none/tests/mips32/Makefile
5498 none/tests/mips64/Makefile
5499 none/tests/nanomips/Makefile
5500 none/tests/linux/Makefile
5501 none/tests/darwin/Makefile
5502 none/tests/solaris/Makefile
5503 none/tests/freebsd/Makefile
5504 none/tests/amd64-linux/Makefile
5505 none/tests/x86-linux/Makefile
5506 none/tests/amd64-darwin/Makefile
5507 none/tests/x86-darwin/Makefile
5508 none/tests/amd64-solaris/Makefile
5509 none/tests/x86-solaris/Makefile
5510 none/tests/x86-freebsd/Makefile
5512 exp-bbv/tests/Makefile
5513 exp-bbv/tests/x86/Makefile
5514 exp-bbv/tests/x86-linux/Makefile
5515 exp-bbv/tests/amd64-linux/Makefile
5516 exp-bbv/tests/ppc32-linux/Makefile
5517 exp-bbv/tests/arm-linux/Makefile
5521 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
5522 [chmod +x coregrind/link_tool_exe_linux])
5523 AC_CONFIG_FILES([coregrind/link_tool_exe_freebsd],
5524 [chmod +x coregrind/link_tool_exe_freebsd])
5525 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
5526 [chmod +x coregrind/link_tool_exe_darwin])
5527 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
5528 [chmod +x coregrind/link_tool_exe_solaris])
5529 AC_CONFIG_FILES([tests/filter_stderr_basic],
5530 [chmod +x tests/filter_stderr_basic])
5531 AC_CONFIG_FILES([tests/filter_discards],
5532 [chmod +x tests/filter_discards])
5533 AC_CONFIG_FILES([memcheck/tests/filter_stderr],
5534 [chmod +x memcheck/tests/filter_stderr])
5535 AC_CONFIG_FILES([memcheck/tests/filter_dw4],
5536 [chmod +x memcheck/tests/filter_dw4])
5537 AC_CONFIG_FILES([memcheck/tests/filter_overlaperror],
5538 [chmod +x memcheck/tests/filter_overlaperror])
5539 AC_CONFIG_FILES([memcheck/tests/x86/filter_pushfpopf],
5540 [chmod +x memcheck/tests/x86/filter_pushfpopf])
5541 AC_CONFIG_FILES([gdbserver_tests/filter_gdb],
5542 [chmod +x gdbserver_tests/filter_gdb])
5543 AC_CONFIG_FILES([gdbserver_tests/filter_memcheck_monitor],
5544 [chmod +x gdbserver_tests/filter_memcheck_monitor])
5545 AC_CONFIG_FILES([gdbserver_tests/filter_stderr],
5546 [chmod +x gdbserver_tests/filter_stderr])
5547 AC_CONFIG_FILES([gdbserver_tests/filter_vgdb],
5548 [chmod +x gdbserver_tests/filter_vgdb])
5549 AC_CONFIG_FILES([drd/tests/filter_stderr],
5550 [chmod +x drd/tests/filter_stderr])
5551 AC_CONFIG_FILES([drd/tests/filter_error_count],
5552 [chmod +x drd/tests/filter_error_count])
5553 AC_CONFIG_FILES([drd/tests/filter_error_summary],
5554 [chmod +x drd/tests/filter_error_summary])
5555 AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
5556 [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
5557 AC_CONFIG_FILES([drd/tests/filter_thread_no],
5558 [chmod +x drd/tests/filter_thread_no])
5559 AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
5560 [chmod +x drd/tests/filter_xml_and_thread_no])
5561 AC_CONFIG_FILES([helgrind/tests/filter_stderr],
5562 [chmod +x helgrind/tests/filter_stderr])
5568 Maximum build arch: ${ARCH_MAX}
5569 Primary build arch: ${VGCONF_ARCH_PRI}
5570 Secondary build arch: ${VGCONF_ARCH_SEC}
5571 Build OS: ${VGCONF_OS}
5572 Link Time Optimisation: ${vg_cv_lto}
5573 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
5574 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
5575 Platform variant: ${VGCONF_PLATVARIANT}
5576 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
5577 Default supp files: ${DEFAULT_SUPP}