2 ##------------------------------------------------------------##
4 # The multiple-architecture stuff in this file is pretty
5 # cryptic. Read docs/internals/multiple-architectures.txt
6 # for at least a partial explanation of what is going on.
8 ##------------------------------------------------------------##
10 # Process this file with autoconf to produce a configure script.
12 # Define major, minor, micro and suffix here once, then reuse them
13 # for version number in valgrind.h and vg-entities (documentation).
14 # suffix must be empty for a release, otherwise it is GIT or RC1, etc.
15 # Also set the (expected/last) release date here.
16 # Do not forget to rerun ./autogen.sh
17 m4_define([v_major_ver], [3])
18 m4_define([v_minor_ver], [24])
19 m4_define([v_micro_ver], [0])
20 m4_define([v_suffix_ver], [GIT])
21 m4_define([v_rel_date], ["?? Oct 2024"])
22 m4_define([v_version],
23 m4_if(v_suffix_ver, [],
24 [v_major_ver.v_minor_ver.v_micro_ver],
25 [v_major_ver.v_minor_ver.v_micro_ver.v_suffix_ver]))
26 AC_INIT([Valgrind],[v_version],[valgrind-users@lists.sourceforge.net])
29 AC_SUBST(VG_VER_MAJOR, v_major_ver)
30 AC_SUBST(VG_VER_MINOR, v_minor_ver)
32 # For docs/xml/vg-entities.xml
33 AC_SUBST(VG_DATE, v_rel_date)
35 AC_CONFIG_SRCDIR(coregrind/m_main.c)
36 AC_CONFIG_HEADERS([config.h])
37 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
41 #----------------------------------------------------------------------------
42 # Do NOT modify these flags here. Except in feature tests in which case
43 # the original values must be properly restored.
44 #----------------------------------------------------------------------------
48 #----------------------------------------------------------------------------
49 # Checks for various programs.
50 #----------------------------------------------------------------------------
53 m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
54 # Make sure we can compile in C99 mode.
55 if test "$ac_cv_prog_cc_c99" = "no"; then
56 AC_MSG_ERROR([Valgrind relies on a C compiler supporting C99])
60 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
61 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
62 # base (eg. most likely as Darwin-specific tests) we'll need one of the
64 # - put AC_PROG_OBJC in a Darwin-specific part of this file
65 # - Use AC_PROG_OBJC here and up the minimum autoconf version
66 # - Use the following, which is apparently equivalent:
67 # m4_ifdef([AC_PROG_OBJC],
69 # [AC_CHECK_TOOL([OBJC], [gcc])
71 # AC_SUBST([OBJCFLAGS])
74 # Set LTO_RANLIB variable to an lto enabled ranlib
75 if test "x$LTO_RANLIB" = "x"; then
76 AC_PATH_PROGS([LTO_RANLIB], [gcc-ranlib])
78 AC_ARG_VAR([LTO_RANLIB],[Library indexer command for link time optimisation])
80 # provide a very basic definition for AC_PROG_SED if it's not provided by
81 # autoconf (as e.g. in autoconf 2.59).
82 m4_ifndef([AC_PROG_SED],
83 [AC_DEFUN([AC_PROG_SED],
85 AC_CHECK_PROGS([SED],[gsed sed])])])
88 AC_DEFUN([AC_PROG_SHA256SUM],
89 [AC_ARG_VAR([SHA256SUM])
90 AC_CHECK_PROGS([SHA256SUM],[gsha256sum sha256sum])])
93 # If no AR variable was specified, look up the name of the archiver. Otherwise
94 # do not touch the AR variable.
95 if test "x$AR" = "x"; then
96 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
98 AC_ARG_VAR([AR],[Archiver command])
100 # same for LTO_AR variable for lto enabled archiver
101 if test "x$LTO_AR" = "x"; then
102 AC_PATH_PROGS([LTO_AR], [gcc-ar])
104 AC_ARG_VAR([LTO_AR],[Archiver command for link time optimisation])
106 # figure out where perl lives
107 AC_PATH_PROG(PERL, perl)
109 # figure out where gdb lives
110 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
111 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
113 # some older automake's don't have it so try something on our own
114 ifdef([AM_PROG_AS],[AM_PROG_AS],
124 # Check if 'diff' supports -u (universal diffs) and use it if possible.
126 AC_MSG_CHECKING([for diff -u])
129 # Comparing two identical files results in 0.
130 tmpfile="tmp-xxx-yyy-zzz"
132 if diff -u $tmpfile $tmpfile ; then
141 # We don't want gcc < 3.0
142 AC_MSG_CHECKING([for a supported version of gcc])
144 # Obtain the compiler version.
146 # A few examples of how the ${CC} --version output looks like:
148 # ######## gcc variants ########
149 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
150 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
151 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
152 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
153 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
154 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
155 # OS/X 10.7: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
157 # ######## clang variants ########
158 # Clang: clang version 2.9 (tags/RELEASE_29/final)
159 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
160 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
162 # ######## Apple LLVM variants ########
163 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
164 # Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
167 if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
170 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
171 elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
174 # Don't use -dumpversion with clang: it will always produce "4.2.1".
175 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
176 elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
179 gcc_version=`${CC} -dumpversion 2>/dev/null`
182 gcc_version=`${CC} -dumpversion 2>/dev/null`
183 if test "x$gcc_version" = x; then
184 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
188 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
189 AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
191 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
192 # statements have to be quoted.
193 case "${is_clang}-${gcc_version}" in
194 applellvm-5.1|applellvm-[[6-9]].*|applellvm-[[1-9][0-9]]*)
195 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
197 icc-1[[3-9]].*|icc-202[[0-9]].*)
198 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
200 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
201 AC_MSG_RESULT([ok (${gcc_version})])
203 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
204 AC_MSG_RESULT([ok (clang-${gcc_version})])
207 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
208 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0 or Apple LLVM >= 5.1])
212 #----------------------------------------------------------------------------
213 # Arch/OS/platform tests.
214 #----------------------------------------------------------------------------
215 # We create a number of arch/OS/platform-related variables. We prefix them
216 # all with "VGCONF_" which indicates that they are defined at
217 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
218 # variables used when compiling C files.
222 AC_MSG_CHECKING([for a supported CPU])
224 # ARCH_MAX reflects the most that this CPU can do: for example if it
225 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
226 # Ditto for amd64. It is used for more configuration below, but is not used
229 # Power PC returns powerpc for Big Endian. This was not changed when Little
230 # Endian support was added to the 64-bit architecture. The 64-bit Little
231 # Endian systems explicitly state le in the host_cpu. For clarity in the
232 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianness of
233 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
234 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
235 # Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
236 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
237 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
240 VGCONF_PLATFORM_ARM_ARCH=
242 case "${host_cpu}" in
244 AC_MSG_RESULT([ok (${host_cpu})])
249 AC_MSG_RESULT([ok (${host_cpu})])
254 # this only referrs to 64-bit Big Endian
255 AC_MSG_RESULT([ok (${host_cpu})])
260 # this only referrs to 64-bit Little Endian
261 AC_MSG_RESULT([ok (${host_cpu})])
266 # On Linux this means only a 32-bit capable CPU.
267 AC_MSG_RESULT([ok (${host_cpu})])
272 AC_MSG_RESULT([ok (${host_cpu})])
277 AC_MSG_RESULT([ok (${host_cpu})])
278 VGCONF_PLATFORM_ARM_ARCH="-marm -mcpu=cortex-a8"
283 AC_MSG_RESULT([ok (${host_cpu})])
284 VGCONF_PLATFORM_ARM_ARCH="-marm -mcpu=cortex-a8"
289 AC_MSG_RESULT([ok (${host_cpu})])
290 VGCONF_PLATFORM_ARM_ARCH="-march=armv6"
295 AC_MSG_RESULT([ok (${host_cpu})])
300 AC_MSG_RESULT([ok (${host_cpu})])
305 AC_MSG_RESULT([ok (${host_cpu})])
310 AC_MSG_RESULT([ok (${host_cpu})])
315 AC_MSG_RESULT([ok (${host_cpu})])
320 AC_MSG_RESULT([ok (${host_cpu})])
324 AC_MSG_RESULT([ok (${host_cpu})])
329 AC_MSG_RESULT([no (${host_cpu})])
330 AC_MSG_ERROR([Unsupported host architecture. Sorry])
334 AC_SUBST(VGCONF_PLATFORM_ARM_ARCH)
336 #----------------------------------------------------------------------------
338 # Sometimes it's convenient to subvert the bi-arch build system and
339 # just have a single build even though the underlying platform is
340 # capable of both. Hence handle --enable-only64bit and
341 # --enable-only32bit. Complain if both are issued :-)
342 # [Actually, if either of these options are used, I think both get built,
343 # but only one gets installed. So if you use an in-place build, both can be
346 # Check if a 64-bit only build has been requested
347 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
348 [AC_ARG_ENABLE(only64bit,
349 [ --enable-only64bit do a 64-bit only build],
350 [vg_cv_only64bit=$enableval],
351 [vg_cv_only64bit=no])])
353 # Check if a 32-bit only build has been requested
354 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
355 [AC_ARG_ENABLE(only32bit,
356 [ --enable-only32bit do a 32-bit only build],
357 [vg_cv_only32bit=$enableval],
358 [vg_cv_only32bit=no])])
361 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
363 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
366 #----------------------------------------------------------------------------
368 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
369 # compilation of many C files via -VGO_$(VGCONF_OS) and
370 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
371 AC_MSG_CHECKING([for a supported OS])
378 AC_MSG_RESULT([ok (${host_os})])
381 # Ok, this is linux. Check the kernel version
382 AC_MSG_CHECKING([for the kernel version])
387 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
388 AC_MSG_RESULT([unsupported (${kernel})])
389 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
393 AC_MSG_RESULT([2.6 or later (${kernel})])
400 AC_MSG_RESULT([ok (${host_os})])
402 AC_DEFINE([FREEBSD_10], 1000, [FREEBSD_VERS value for FreeBSD 10.x])
404 AC_DEFINE([FREEBSD_11], 1100, [FREEBSD_VERS value for FreeBSD 11.x])
406 AC_DEFINE([FREEBSD_12], 1200, [FREEBSD_VERS value for FreeBSD 12.0 to 12.1])
408 AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2])
410 AC_DEFINE([FREEBSD_13_0], 1300, [FREEBSD_VERS value for FreeBSD 13.0])
412 AC_DEFINE([FREEBSD_13_1], 1310, [FREEBSD_VERS value for FreeBSD 13.1])
414 AC_DEFINE([FREEBSD_13_2], 1320, [FREEBSD_VERS value for FreeBSD 13.2])
416 AC_DEFINE([FREEBSD_13_3], 1330, [FREEBSD_VERS value for FreeBSD 13.3])
418 AC_DEFINE([FREEBSD_13_4], 1340, [FREEBSD_VERS value for FreeBSD 13.4])
420 AC_DEFINE([FREEBSD_14_0], 1400, [FREEBSD_VERS value for FreeBSD 14.0])
422 AC_DEFINE([FREEBSD_14_1], 1410, [FREEBSD_VERS value for FreeBSD 14.1])
424 AC_DEFINE([FREEBSD_15], 1500, [FREEBSD_VERS value for FreeBSD 15.x])
427 AC_MSG_CHECKING([for the kernel version])
432 AC_MSG_RESULT([FreeBSD 10.x (${kernel})])
433 AC_DEFINE([FREEBSD_VERS], FREEBSD_10, [FreeBSD version])
434 freebsd_vers=$freebsd_10
437 AC_MSG_RESULT([FreeBSD 11.x (${kernel})])
438 AC_DEFINE([FREEBSD_VERS], FREEBSD_11, [FreeBSD version])
439 freebsd_vers=$freebsd_11
444 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
445 AC_DEFINE([FREEBSD_VERS], FREEBSD_12, [FreeBSD version])
446 freebsd_vers=$freebsd_12
449 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
450 AC_DEFINE([FREEBSD_VERS], FREEBSD_12_2, [FreeBSD version])
451 freebsd_vers=$freebsd_12_2
458 AC_MSG_RESULT([FreeBSD 13.0 (${kernel})])
459 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_0, [FreeBSD version])
460 freebsd_vers=$freebsd_13_0
463 AC_MSG_RESULT([FreeBSD 13.1 (${kernel})])
464 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_1, [FreeBSD version])
465 freebsd_vers=$freebsd_13_1
468 AC_MSG_RESULT([FreeBSD 13.2 (${kernel})])
469 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_2, [FreeBSD version])
470 freebsd_vers=$freebsd_13_2
473 AC_MSG_RESULT([FreeBSD 13.3 (${kernel})])
474 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_3, [FreeBSD version])
475 freebsd_vers=$freebsd_13_3
478 AC_MSG_RESULT([FreeBSD 13.4 (${kernel})])
479 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_4, [FreeBSD version])
480 freebsd_vers=$freebsd_13_4
483 AC_MSG_RESULT([unsupported (${kernel})])
484 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 15.x])
491 AC_MSG_RESULT([FreeBSD 14.0 (${kernel})])
492 AC_DEFINE([FREEBSD_VERS], FREEBSD_14_0, [FreeBSD version])
493 freebsd_vers=$freebsd_14_0
496 AC_MSG_RESULT([FreeBSD 14.1 (${kernel})])
497 AC_DEFINE([FREEBSD_VERS], FREEBSD_14_1, [FreeBSD version])
498 freebsd_vers=$freebsd_14_1
501 AC_MSG_RESULT([unsupported (${kernel})])
502 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 15.x])
507 AC_MSG_RESULT([FreeBSD 15.x (${kernel})])
508 AC_DEFINE([FREEBSD_VERS], FREEBSD_15, [FreeBSD version])
509 freebsd_vers=$freebsd_15
512 AC_MSG_RESULT([unsupported (${kernel})])
513 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 15.x])
517 DEFAULT_SUPP="$srcdir/freebsd.supp $srcdir/freebsd-helgrind.supp $srcdir/freebsd-drd.supp ${DEFAULT_SUPP}"
521 AC_MSG_RESULT([ok (${host_os})])
523 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
524 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
525 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
526 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
527 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
528 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
529 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
530 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
531 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
533 AC_MSG_CHECKING([for the kernel version])
536 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
537 # has only one relevant version, the OS version. The `uname` check
538 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
539 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
540 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
541 # and we don't know of an macros similar to __GLIBC__ to get that info.
543 # XXX: `uname -r` won't do the right thing for cross-compiles, but
544 # that's not a problem yet.
546 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
547 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
548 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
549 # time support for 10.5 (the 9.* pattern just below), I'll leave it
550 # in for now, just in case anybody wants to give it a try. But I'm
551 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
554 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
555 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
556 DEFAULT_SUPP="$srcdir/darwin9.supp ${DEFAULT_SUPP}"
557 DEFAULT_SUPP="$srcdir/darwin9-drd.supp ${DEFAULT_SUPP}"
560 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
561 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
562 DEFAULT_SUPP="$srcdir/darwin10.supp ${DEFAULT_SUPP}"
563 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
566 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
567 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
568 DEFAULT_SUPP="$srcdir/darwin11.supp ${DEFAULT_SUPP}"
569 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
572 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
573 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
574 DEFAULT_SUPP="$srcdir/darwin12.supp ${DEFAULT_SUPP}"
575 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
578 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
579 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
580 DEFAULT_SUPP="$srcdir/darwin13.supp ${DEFAULT_SUPP}"
581 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
584 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
585 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
586 DEFAULT_SUPP="$srcdir/darwin14.supp ${DEFAULT_SUPP}"
587 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
590 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
591 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
592 DEFAULT_SUPP="$srcdir/darwin15.supp ${DEFAULT_SUPP}"
593 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
596 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
597 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
598 DEFAULT_SUPP="$srcdir/darwin16.supp ${DEFAULT_SUPP}"
599 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
602 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
603 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
604 DEFAULT_SUPP="$srcdir/darwin17.supp ${DEFAULT_SUPP}"
605 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
608 AC_MSG_RESULT([unsupported (${kernel})])
609 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)])
615 AC_MSG_RESULT([ok (${host_os})])
618 uname_v=$( uname -v )
621 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
624 DEFAULT_SUPP="$srcdir/solaris11.supp ${DEFAULT_SUPP}"
630 AC_MSG_RESULT([ok (${host_os})])
632 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
636 AC_MSG_RESULT([no (${host_os})])
637 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
641 #----------------------------------------------------------------------------
643 # If we are building on a 64 bit platform test to see if the system
644 # supports building 32 bit programs and disable 32 bit support if it
645 # does not support building 32 bit programs
647 case "$ARCH_MAX-$VGCONF_OS" in
648 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
649 AC_MSG_CHECKING([for 32 bit build support])
652 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
657 vg_cv_only64bit="yes"
660 CFLAGS=$safe_CFLAGS;;
662 AC_MSG_CHECKING([for 32 bit build support])
664 CFLAGS="$CFLAGS -mips32 -mabi=32"
665 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
666 #include <sys/prctl.h>
670 vg_cv_only64bit="yes"
673 CFLAGS=$safe_CFLAGS;;
676 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
678 [--enable-only32bit was specified but system does not support 32 bit builds])
681 #----------------------------------------------------------------------------
683 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
684 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
685 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
686 # above) will be "amd64" since that reflects the most that this cpu can do,
687 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
688 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
689 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
690 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
691 AC_SUBST(VGCONF_ARCH_PRI)
693 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
694 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
695 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
696 # It is empty if there is no secondary target.
697 AC_SUBST(VGCONF_ARCH_SEC)
699 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
700 # The entire system, including regression and performance tests, will be
701 # built for this target. The "_CAPS" indicates that the name is in capital
702 # letters, and it also uses '_' rather than '-' as a separator, because it's
703 # used to create various Makefile variables, which are all in caps by
704 # convention and cannot contain '-' characters. This is in contrast to
705 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
706 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
708 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
709 # Valgrind and tools will also be built for this target, but not the
710 # regression or performance tests.
712 # By default, the primary arch is the same as the "max" arch, as commented
713 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
714 # the big case statement just below here, in the case where we're building
715 # on a 64 bit machine but have been requested only to do a 32 bit build.
716 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
718 AC_MSG_CHECKING([for a supported CPU/OS combination])
720 # NB. The load address for a given platform may be specified in more
721 # than one place, in some cases, depending on whether we're doing a biarch,
722 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
723 # Be careful to give consistent values in all subcases. Also, all four
724 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
725 # even if it is to "0xUNSET".
727 case "$ARCH_MAX-$VGCONF_OS" in
729 VGCONF_ARCH_PRI="x86"
731 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
732 VGCONF_PLATFORM_SEC_CAPS=""
733 valt_load_address_pri_norml="0x58000000"
734 valt_load_address_pri_inner="0x38000000"
735 valt_load_address_sec_norml="0xUNSET"
736 valt_load_address_sec_inner="0xUNSET"
737 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
740 valt_load_address_sec_norml="0xUNSET"
741 valt_load_address_sec_inner="0xUNSET"
742 if test x$vg_cv_only64bit = xyes; then
743 VGCONF_ARCH_PRI="amd64"
745 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
746 VGCONF_PLATFORM_SEC_CAPS=""
747 valt_load_address_pri_norml="0x58000000"
748 valt_load_address_pri_inner="0x38000000"
749 elif test x$vg_cv_only32bit = xyes; then
750 VGCONF_ARCH_PRI="x86"
752 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
753 VGCONF_PLATFORM_SEC_CAPS=""
754 valt_load_address_pri_norml="0x58000000"
755 valt_load_address_pri_inner="0x38000000"
757 VGCONF_ARCH_PRI="amd64"
758 VGCONF_ARCH_SEC="x86"
759 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
760 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
761 valt_load_address_pri_norml="0x58000000"
762 valt_load_address_pri_inner="0x38000000"
763 valt_load_address_sec_norml="0x58000000"
764 valt_load_address_sec_inner="0x38000000"
766 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
769 VGCONF_ARCH_PRI="ppc32"
771 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
772 VGCONF_PLATFORM_SEC_CAPS=""
773 valt_load_address_pri_norml="0x58000000"
774 valt_load_address_pri_inner="0x38000000"
775 valt_load_address_sec_norml="0xUNSET"
776 valt_load_address_sec_inner="0xUNSET"
777 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
780 valt_load_address_sec_norml="0xUNSET"
781 valt_load_address_sec_inner="0xUNSET"
782 if test x$vg_cv_only64bit = xyes; then
783 VGCONF_ARCH_PRI="ppc64be"
785 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
786 VGCONF_PLATFORM_SEC_CAPS=""
787 valt_load_address_pri_norml="0x58000000"
788 valt_load_address_pri_inner="0x38000000"
789 elif test x$vg_cv_only32bit = xyes; then
790 VGCONF_ARCH_PRI="ppc32"
792 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
793 VGCONF_PLATFORM_SEC_CAPS=""
794 valt_load_address_pri_norml="0x58000000"
795 valt_load_address_pri_inner="0x38000000"
797 VGCONF_ARCH_PRI="ppc64be"
798 VGCONF_ARCH_SEC="ppc32"
799 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
800 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
801 valt_load_address_pri_norml="0x58000000"
802 valt_load_address_pri_inner="0x38000000"
803 valt_load_address_sec_norml="0x58000000"
804 valt_load_address_sec_inner="0x38000000"
806 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
809 # Little Endian is only supported on PPC64
810 valt_load_address_sec_norml="0xUNSET"
811 valt_load_address_sec_inner="0xUNSET"
812 VGCONF_ARCH_PRI="ppc64le"
814 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
815 VGCONF_PLATFORM_SEC_CAPS=""
816 valt_load_address_pri_norml="0x58000000"
817 valt_load_address_pri_inner="0x38000000"
818 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
821 VGCONF_ARCH_PRI="x86"
823 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
824 VGCONF_PLATFORM_SEC_CAPS=""
825 valt_load_address_pri_norml="0x38000000"
826 valt_load_address_pri_inner="0x28000000"
827 valt_load_address_sec_norml="0xUNSET"
828 valt_load_address_sec_inner="0xUNSET"
829 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
832 if test x$vg_cv_only64bit = xyes; then
833 VGCONF_ARCH_PRI="amd64"
835 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
836 VGCONF_PLATFORM_SEC_CAPS=""
837 elif test x$vg_cv_only32bit = xyes; then
838 VGCONF_ARCH_PRI="x86"
840 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
841 VGCONF_PLATFORM_SEC_CAPS=""
843 VGCONF_ARCH_PRI="amd64"
844 VGCONF_ARCH_SEC="x86"
845 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
846 VGCONF_PLATFORM_SEC_CAPS="X86_FREEBSD"
848 # These work with either base clang or ports installed gcc
849 # Hand rolled compilers probably need INSTALL_DIR/lib (at least for gcc)
850 if test x$is_clang = xclang ; then
851 FLAG_32ON64="-B/usr/lib32"
853 GCC_MAJOR_VERSION=`${CC} -dumpversion | $SED 's/\..*//' 2>/dev/null`
854 FLAG_32ON64="-B/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -Wl,-rpath,/usr/local/lib32/gcc${GCC_MAJOR_VERSION}/"
855 FLAG_32ON64_GXX="-L/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -lgcc_s"
856 AC_SUBST(FLAG_32ON64_GXX)
858 valt_load_address_pri_norml="0x38000000"
859 valt_load_address_pri_inner="0x28000000"
860 valt_load_address_sec_norml="0x38000000"
861 valt_load_address_sec_inner="0x28000000"
862 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
865 VGCONF_ARCH_PRI="arm64"
867 VGCONF_PLATFORM_PRI_CAPS="ARM64_FREEBSD"
868 VGCONF_PLATFORM_SEC_CAPS=""
869 valt_load_address_pri_norml="0x38000000"
870 valt_load_address_pri_inner="0x28000000"
871 valt_load_address_sec_norml="0xUNSET"
872 valt_load_address_sec_inner="0xUNSET"
873 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
875 # Darwin gets identified as 32-bit even when it supports 64-bit.
876 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
877 # all Macs support both 32-bit and 64-bit, so we just build both. If
878 # someone has a really old 32-bit only machine they can (hopefully?)
879 # build with --enable-only32bit. See bug 243362.
880 x86-darwin|amd64-darwin)
882 valt_load_address_sec_norml="0xUNSET"
883 valt_load_address_sec_inner="0xUNSET"
884 if test x$vg_cv_only64bit = xyes; then
885 VGCONF_ARCH_PRI="amd64"
887 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
888 VGCONF_PLATFORM_SEC_CAPS=""
889 valt_load_address_pri_norml="0x158000000"
890 valt_load_address_pri_inner="0x138000000"
891 elif test x$vg_cv_only32bit = xyes; then
892 VGCONF_ARCH_PRI="x86"
894 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
895 VGCONF_PLATFORM_SEC_CAPS=""
896 VGCONF_ARCH_PRI_CAPS="x86"
897 valt_load_address_pri_norml="0x58000000"
898 valt_load_address_pri_inner="0x38000000"
900 VGCONF_ARCH_PRI="amd64"
901 VGCONF_ARCH_SEC="x86"
902 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
903 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
904 valt_load_address_pri_norml="0x158000000"
905 valt_load_address_pri_inner="0x138000000"
906 valt_load_address_sec_norml="0x58000000"
907 valt_load_address_sec_inner="0x38000000"
909 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
912 VGCONF_ARCH_PRI="arm"
913 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
914 VGCONF_PLATFORM_SEC_CAPS=""
915 valt_load_address_pri_norml="0x58000000"
916 valt_load_address_pri_inner="0x38000000"
917 valt_load_address_sec_norml="0xUNSET"
918 valt_load_address_sec_inner="0xUNSET"
919 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
922 valt_load_address_sec_norml="0xUNSET"
923 valt_load_address_sec_inner="0xUNSET"
924 if test x$vg_cv_only64bit = xyes; then
925 VGCONF_ARCH_PRI="arm64"
927 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
928 VGCONF_PLATFORM_SEC_CAPS=""
929 valt_load_address_pri_norml="0x58000000"
930 valt_load_address_pri_inner="0x38000000"
931 elif test x$vg_cv_only32bit = xyes; then
932 VGCONF_ARCH_PRI="arm"
934 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
935 VGCONF_PLATFORM_SEC_CAPS=""
936 valt_load_address_pri_norml="0x58000000"
937 valt_load_address_pri_inner="0x38000000"
939 VGCONF_ARCH_PRI="arm64"
940 VGCONF_ARCH_SEC="arm"
941 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
942 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
943 valt_load_address_pri_norml="0x58000000"
944 valt_load_address_pri_inner="0x38000000"
945 valt_load_address_sec_norml="0x58000000"
946 valt_load_address_sec_inner="0x38000000"
948 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
951 VGCONF_ARCH_PRI="s390x"
953 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
954 VGCONF_PLATFORM_SEC_CAPS=""
955 # To improve branch prediction hit rate we want to have
956 # the generated code close to valgrind (host) code
957 valt_load_address_pri_norml="0x800000000"
958 valt_load_address_pri_inner="0x810000000"
959 valt_load_address_sec_norml="0xUNSET"
960 valt_load_address_sec_inner="0xUNSET"
961 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
964 VGCONF_ARCH_PRI="mips32"
966 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
967 VGCONF_PLATFORM_SEC_CAPS=""
968 valt_load_address_pri_norml="0x58000000"
969 valt_load_address_pri_inner="0x38000000"
970 valt_load_address_sec_norml="0xUNSET"
971 valt_load_address_sec_inner="0xUNSET"
972 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
975 valt_load_address_sec_norml="0xUNSET"
976 valt_load_address_sec_inner="0xUNSET"
977 if test x$vg_cv_only64bit = xyes; then
978 VGCONF_ARCH_PRI="mips64"
979 VGCONF_PLATFORM_SEC_CAPS=""
980 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
981 VGCONF_PLATFORM_SEC_CAPS=""
982 valt_load_address_pri_norml="0x58000000"
983 valt_load_address_pri_inner="0x38000000"
984 elif test x$vg_cv_only32bit = xyes; then
985 VGCONF_ARCH_PRI="mips32"
987 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
988 VGCONF_PLATFORM_SEC_CAPS=""
989 valt_load_address_pri_norml="0x58000000"
990 valt_load_address_pri_inner="0x38000000"
992 VGCONF_ARCH_PRI="mips64"
993 VGCONF_ARCH_SEC="mips32"
994 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
995 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
996 valt_load_address_pri_norml="0x58000000"
997 valt_load_address_pri_inner="0x38000000"
998 valt_load_address_sec_norml="0x58000000"
999 valt_load_address_sec_inner="0x38000000"
1001 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
1004 VGCONF_ARCH_PRI="nanomips"
1006 VGCONF_PLATFORM_PRI_CAPS="NANOMIPS_LINUX"
1007 VGCONF_PLATFORM_SEC_CAPS=""
1008 valt_load_address_pri_norml="0x58000000"
1009 valt_load_address_pri_inner="0x38000000"
1010 valt_load_address_sec_norml="0xUNSET"
1011 valt_load_address_sec_inner="0xUNSET"
1012 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
1015 VGCONF_ARCH_PRI="x86"
1017 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
1018 VGCONF_PLATFORM_SEC_CAPS=""
1019 valt_load_address_pri_norml="0x58000000"
1020 valt_load_address_pri_inner="0x38000000"
1021 valt_load_address_sec_norml="0xUNSET"
1022 valt_load_address_sec_inner="0xUNSET"
1023 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
1026 valt_load_address_sec_norml="0xUNSET"
1027 valt_load_address_sec_inner="0xUNSET"
1028 if test x$vg_cv_only64bit = xyes; then
1029 VGCONF_ARCH_PRI="amd64"
1031 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
1032 VGCONF_PLATFORM_SEC_CAPS=""
1033 valt_load_address_pri_norml="0x58000000"
1034 valt_load_address_pri_inner="0x38000000"
1035 elif test x$vg_cv_only32bit = xyes; then
1036 VGCONF_ARCH_PRI="x86"
1038 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
1039 VGCONF_PLATFORM_SEC_CAPS=""
1040 valt_load_address_pri_norml="0x58000000"
1041 valt_load_address_pri_inner="0x38000000"
1043 VGCONF_ARCH_PRI="amd64"
1044 VGCONF_ARCH_SEC="x86"
1045 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
1046 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
1047 valt_load_address_pri_norml="0x58000000"
1048 valt_load_address_pri_inner="0x38000000"
1049 valt_load_address_sec_norml="0x58000000"
1050 valt_load_address_sec_inner="0x38000000"
1052 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
1055 VGCONF_ARCH_PRI="unknown"
1056 VGCONF_ARCH_SEC="unknown"
1057 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
1058 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
1059 valt_load_address_pri_norml="0xUNSET"
1060 valt_load_address_pri_inner="0xUNSET"
1061 valt_load_address_sec_norml="0xUNSET"
1062 valt_load_address_sec_inner="0xUNSET"
1063 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
1064 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
1068 #----------------------------------------------------------------------------
1070 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
1072 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
1073 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1074 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1075 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1076 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD \
1077 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1078 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
1079 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1080 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
1081 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
1082 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1083 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1084 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
1085 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
1086 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
1087 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1088 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
1089 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
1090 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1091 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
1092 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
1093 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1094 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
1095 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
1096 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1097 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD )
1098 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
1099 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
1100 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
1101 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1102 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
1103 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
1104 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
1105 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_NANOMIPS,
1106 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX )
1108 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
1110 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
1111 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1112 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
1113 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
1114 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
1115 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
1116 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1117 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
1118 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
1119 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
1120 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
1121 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
1122 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
1123 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1124 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
1125 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
1126 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
1127 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
1128 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1129 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
1130 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
1131 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1132 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
1133 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
1134 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
1135 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_NANOMIPS_LINUX,
1136 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1137 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD,
1138 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1139 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD)
1140 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD,
1141 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1142 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_FREEBSD,
1143 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD)
1144 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
1145 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1146 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
1147 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
1148 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1149 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
1150 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1151 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
1152 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
1153 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1156 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
1157 # Relies on the assumption that the primary and secondary targets are
1158 # for the same OS, so therefore only necessary to test the primary.
1159 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
1160 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1161 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1162 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1163 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1164 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
1165 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1166 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1167 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1168 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1169 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
1170 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1171 AM_CONDITIONAL(VGCONF_OS_IS_FREEBSD,
1172 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1173 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1174 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD)
1175 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
1176 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1177 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1178 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
1179 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1180 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1181 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN_OR_FREEBSD,
1182 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1183 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1184 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD \
1185 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1186 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1189 # Sometimes, in the Makefile.am files, it's useful to know whether or not
1190 # there is a secondary target.
1191 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
1192 test x$VGCONF_PLATFORM_SEC_CAPS != x)
1194 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
1195 dnl fallback definition
1196 dnl The macro is courtesy of Dave Hart:
1197 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
1198 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
1199 if test -z "$$1_TRUE"; then :
1208 #----------------------------------------------------------------------------
1210 #----------------------------------------------------------------------------
1212 # Check if this should be built as an inner Valgrind, to be run within
1213 # another Valgrind. Choose the load address accordingly.
1214 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
1215 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
1216 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
1217 [AC_ARG_ENABLE(inner,
1218 [ --enable-inner enables self-hosting],
1219 [vg_cv_inner=$enableval],
1221 if test "$vg_cv_inner" = yes; then
1222 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
1223 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
1224 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
1226 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
1227 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
1230 #----------------------------------------------------------------------------
1231 # Undefined behaviour sanitiser
1232 #----------------------------------------------------------------------------
1233 # Check whether we should build with the undefined beahviour sanitiser.
1235 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
1236 [AC_ARG_ENABLE(ubsan,
1237 [ --enable-ubsan enables the undefined behaviour sanitiser],
1238 [vg_cv_ubsan=$enableval],
1241 #----------------------------------------------------------------------------
1242 # Extra fine-tuning of installation directories
1243 #----------------------------------------------------------------------------
1245 [ --with-tmpdir=PATH Specify path for temporary files],
1248 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
1249 AC_SUBST(VG_TMPDIR, [$tmpdir])
1251 #----------------------------------------------------------------------------
1253 #----------------------------------------------------------------------------
1254 AM_COND_IF([VGCONF_OS_IS_DARWIN],
1255 [AC_CHECK_PROG([XCRUN], [xcrun], [yes], [no])
1256 AC_MSG_CHECKING([for xcode sdk include path])
1257 AC_ARG_WITH(xcodedir,
1258 [ --with-xcode-path=PATH Specify path for xcode sdk includes],
1259 [xcodedir="$withval"],
1261 if test "x$XCRUN" != "xno" -a ! -d /usr/include; then
1262 xcrundir=`xcrun --sdk macosx --show-sdk-path`
1263 if test -z "$xcrundir"; then
1264 xcodedir="/usr/include"
1266 xcodedir="$xcrundir/usr/include"
1269 xcodedir="/usr/include"
1272 AC_MSG_RESULT([$xcodedir])
1273 AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
1274 AC_SUBST(XCODE_DIR, [$xcodedir])])
1276 #----------------------------------------------------------------------------
1277 # Where to install gdb scripts, defaults to VG_LIBDIR (pkglibexecdir)
1278 #----------------------------------------------------------------------------
1279 AC_MSG_CHECKING([where gdb scripts are installed])
1280 AC_ARG_WITH(gdbscripts-dir,
1281 [ --with-gdbscripts-dir=PATH Specify path to install gdb scripts],
1282 [gdbscriptsdir=${withval}],
1283 [gdbscriptsdir=${libexecdir}/valgrind])
1284 AC_MSG_RESULT([$gdbscriptsdir])
1285 if test "x$gdbscriptsdir" != "xno"; then
1286 AC_SUBST(VG_GDBSCRIPTS_DIR, [$gdbscriptsdir])
1287 AM_CONDITIONAL(GDBSCRIPTS, true)
1289 AC_SUBST(VG_GDBSCRIPTS_DIR, [])
1290 AM_CONDITIONAL(GDBSCRIPTS, false)
1293 #----------------------------------------------------------------------------
1294 # Libc and suppressions
1295 #----------------------------------------------------------------------------
1296 # This variable will collect the suppression files to be used.
1297 AC_SUBST(DEFAULT_SUPP)
1299 AC_CHECK_HEADER([features.h])
1301 if test x$ac_cv_header_features_h = xyes; then
1302 AC_DEFINE([HAVE_HEADER_FEATURES_H], 1,
1303 [Define to 1 if you have the `features.h' header.])
1304 rm -f conftest.$ac_ext
1305 cat <<_ACEOF >conftest.$ac_ext
1306 #include <features.h>
1307 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1308 glibc version is: __GLIBC__ __GLIBC_MINOR__
1311 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1314 # not really a version check
1315 AC_EGREP_CPP([DARWIN_LIBC], [
1316 #include <sys/cdefs.h>
1317 #if defined(__DARWIN_VERS_1050)
1321 GLIBC_VERSION="darwin")
1323 AC_EGREP_CPP([FREEBSD_LIBC], [
1324 #include <sys/cdefs.h>
1325 #if defined(__FreeBSD__)
1329 GLIBC_VERSION="freebsd")
1331 # not really a version check
1332 AC_EGREP_CPP([BIONIC_LIBC], [
1333 #if defined(__ANDROID__)
1337 GLIBC_VERSION="bionic")
1339 # there is only one version of libc on Solaris
1340 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1341 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1342 GLIBC_VERSION="solaris"
1345 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1347 if test x$GLIBC_VERSION = x; then
1348 if $CC -dumpmachine | grep -q musl; then
1353 # If this is glibc then figure out the generic (in file) libc.so and
1354 # libpthread.so file paths to use in suppressions. Before 2.34 libpthread
1355 # was a separate library, afterwards it was merged into libc.so and
1356 # the library is called libc.so.6 (before it was libc-2.[0-9]+.so).
1357 # Use this fact to set GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH.
1358 case ${GLIBC_VERSION} in
1360 AC_MSG_CHECKING([whether pthread_create needs libpthread])
1361 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])],
1364 GLIBC_LIBC_PATH="*/lib*/libc.so.6"
1365 GLIBC_LIBPTHREAD_PATH="$GLIBC_LIBC_PATH"
1367 AC_MSG_RESULT([yes])
1368 GLIBC_LIBC_PATH="*/lib*/libc-2.*so*"
1369 GLIBC_LIBPTHREAD_PATH="*/lib*/libpthread-2.*so*"
1373 AC_MSG_CHECKING([not glibc...])
1374 AC_MSG_RESULT([${GLIBC_VERSION}])
1378 AC_MSG_CHECKING([the glibc version])
1380 case "${GLIBC_VERSION}" in
1382 AC_MSG_RESULT(${GLIBC_VERSION} family)
1383 DEFAULT_SUPP="$srcdir/glibc-2.2.supp ${DEFAULT_SUPP}"
1384 DEFAULT_SUPP="$srcdir/glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1385 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1388 AC_MSG_RESULT(${GLIBC_VERSION} family)
1389 DEFAULT_SUPP="$srcdir/glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1390 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1391 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1394 AC_MSG_RESULT(${GLIBC_VERSION} family)
1395 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1396 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1397 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1400 AC_MSG_RESULT(${GLIBC_VERSION} family)
1401 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1402 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1403 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1404 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1405 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1408 AC_MSG_RESULT(${GLIBC_VERSION} family)
1409 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1410 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1411 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1412 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1413 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1414 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1415 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1418 AC_MSG_RESULT(Darwin)
1419 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1420 # DEFAULT_SUPP set by kernel version check above.
1423 AC_MSG_RESULT(FreeBSD)
1424 AC_DEFINE([FREEBSD_LIBC], 1, [Define to 1 if you're using FreeBSD])
1425 # DEFAULT_SUPP set by kernel version check above.
1428 AC_MSG_RESULT(Bionic)
1429 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1430 DEFAULT_SUPP="$srcdir/bionic.supp ${DEFAULT_SUPP}"
1433 AC_MSG_RESULT(Solaris)
1434 # DEFAULT_SUPP set in host_os switch-case above.
1435 # No other suppression file is used.
1439 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1440 DEFAULT_SUPP="$srcdir/musl.supp ${DEFAULT_SUPP}"
1443 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1444 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1445 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1449 AC_SUBST(GLIBC_VERSION)
1450 AC_SUBST(GLIBC_LIBC_PATH)
1451 AC_SUBST(GLIBC_LIBPTHREAD_PATH)
1454 if test "$VGCONF_OS" != "solaris"; then
1455 # Add default suppressions for the X client libraries. Make no
1456 # attempt to detect whether such libraries are installed on the
1457 # build machine (or even if any X facilities are present); just
1458 # add the suppressions antidisirregardless.
1459 DEFAULT_SUPP="$srcdir/xfree-4.supp ${DEFAULT_SUPP}"
1460 DEFAULT_SUPP="$srcdir/xfree-3.supp ${DEFAULT_SUPP}"
1464 #----------------------------------------------------------------------------
1465 # Platform variants?
1466 #----------------------------------------------------------------------------
1468 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1469 # But there are times where we need a bit more control. The motivating
1470 # and currently only case is Android: this is almost identical to
1471 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1472 # platform variant tags, which get passed in the compile as
1473 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1475 # In almost all cases, the <variant> bit is "vanilla". But for Android
1476 # it is "android" instead.
1478 # Consequently (eg), plain arm-linux would build with
1480 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1482 # whilst an Android build would have
1484 # -DVGP_arm_linux -DVGPV_arm_linux_android
1486 # Same for x86. The setup of the platform variant is pushed relatively far
1487 # down this file in order that we can inspect any of the variables set above.
1489 # In the normal case ..
1490 VGCONF_PLATVARIANT="vanilla"
1493 if test "$GLIBC_VERSION" = "bionic";
1495 VGCONF_PLATVARIANT="android"
1498 AC_SUBST(VGCONF_PLATVARIANT)
1501 # FIXME: do we also want to define automake variables
1502 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1503 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1504 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1505 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1506 # that's what we'd need to do to use this, since what we'd want to write
1509 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1511 # Hmm. Can't think of a nice clean solution to this.
1513 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1514 test x$VGCONF_PLATVARIANT = xvanilla)
1515 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1516 test x$VGCONF_PLATVARIANT = xandroid)
1519 #----------------------------------------------------------------------------
1520 # Checking for various library functions and other definitions
1521 #----------------------------------------------------------------------------
1523 # Check for AT_FDCWD
1525 AC_MSG_CHECKING([for AT_FDCWD])
1526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1533 ac_have_at_fdcwd=yes
1534 AC_MSG_RESULT([yes])
1540 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1542 # Check for stpncpy function definition in string.h
1543 # This explicitly checks with _GNU_SOURCE defined since that is also
1544 # used in the test case (some systems might define it without anyway
1545 # since stpncpy is part of The Open Group Base Specifications Issue 7
1546 # IEEE Std 1003.1-2008.
1547 AC_MSG_CHECKING([for stpncpy])
1548 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1555 char *r = stpncpy(d, s, n);
1557 ac_have_gnu_stpncpy=yes
1558 AC_MSG_RESULT([yes])
1560 ac_have_gnu_stpncpy=no
1564 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1566 # Check for PTRACE_GETREGS
1568 AC_MSG_CHECKING([for PTRACE_GETREGS])
1569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1572 #include <sys/ptrace.h>
1573 #include <sys/user.h>
1576 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1578 AC_MSG_RESULT([yes])
1579 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1580 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1586 # Check for CLOCK_MONOTONIC
1588 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1590 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1594 clock_gettime(CLOCK_MONOTONIC, &t);
1597 AC_MSG_RESULT([yes])
1598 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1599 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1605 # Check for ELF32/64_CHDR
1607 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1610 # Check for PTHREAD_RWLOCK_T
1612 AC_MSG_CHECKING([for pthread_rwlock_t])
1614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1616 #include <pthread.h>
1618 pthread_rwlock_t rwl;
1620 AC_MSG_RESULT([yes])
1621 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1622 [Define to 1 if you have the `pthread_rwlock_t' type.])
1627 # Check for CLOCKID_T
1629 AC_MSG_CHECKING([for clockid_t])
1631 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1636 AC_MSG_RESULT([yes])
1637 AC_DEFINE([HAVE_CLOCKID_T], 1,
1638 [Define to 1 if you have the `clockid_t' type.])
1643 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1645 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1647 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1649 #include <pthread.h>
1651 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1653 AC_MSG_RESULT([yes])
1654 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1655 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1661 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1663 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1665 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1667 #include <pthread.h>
1669 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1671 AC_MSG_RESULT([yes])
1672 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1673 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1679 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1681 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1685 #include <pthread.h>
1687 return (PTHREAD_MUTEX_RECURSIVE_NP);
1689 AC_MSG_RESULT([yes])
1690 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1691 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1697 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1699 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1701 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1703 #include <pthread.h>
1705 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1708 AC_MSG_RESULT([yes])
1709 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1710 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1716 # Check whether pthread_mutex_t has a member called __m_kind.
1718 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1719 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1721 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1724 [#include <pthread.h>])
1727 # Check whether pthread_mutex_t has a member called __data.__kind.
1729 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1730 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1732 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1735 [#include <pthread.h>])
1737 # Convenience function. Set flags based on the existing HWCAP entries.
1738 # The AT_HWCAP entries are generated by glibc, and are based on
1739 # functions supported by the hardware/system/libc.
1740 # Subsequent support for whether the capability will actually be utilized
1741 # will also be checked against the compiler capabilities.
1743 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1744 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1746 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1747 if env LD_SHOW_AUXV=1 true | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1749 AC_MSG_RESULT([yes])
1750 AC_SUBST([$2],[yes])
1757 # gather hardware capabilities. (hardware/kernel/libc)
1758 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1759 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1760 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1761 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1762 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1763 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1764 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1765 AC_HWCAP_CONTAINS_FLAG([arch_3_1],[HWCAP_HAS_ISA_3_1])
1766 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1767 AC_HWCAP_CONTAINS_FLAG([mma],[HWCAP_HAS_MMA])
1770 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1771 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1772 # compiler support for isa 2.07 level instructions
1773 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1774 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1776 __asm__ __volatile__("mtvsrd 1,2 ");
1778 ac_asm_have_isa_2_07=yes
1779 AC_MSG_RESULT([yes])
1781 ac_asm_have_isa_2_07=no
1784 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1785 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1787 # altivec (vsx) support.
1788 # does this compiler support -maltivec and does it have the include file
1790 AC_MSG_CHECKING([for Altivec support in the compiler ])
1792 CFLAGS="-maltivec -Werror"
1793 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1794 #include <altivec.h>
1796 vector unsigned int v;
1799 AC_MSG_RESULT([yes])
1805 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1806 -a x$HWCAP_HAS_ALTIVEC = xyes])
1808 # Check that both: the compiler supports -mvsx and that the assembler
1809 # understands VSX instructions. If either of those doesn't work,
1810 # conclude that we can't do VSX.
1811 AC_MSG_CHECKING([for VSX compiler flag support])
1813 CFLAGS="-mvsx -Werror"
1814 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1817 ac_compiler_supports_vsx_flag=yes
1818 AC_MSG_RESULT([yes])
1820 ac_compiler_supports_vsx_flag=no
1825 AC_MSG_CHECKING([for VSX support in the assembler ])
1827 CFLAGS="-mvsx -Werror"
1828 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1829 #include <altivec.h>
1831 vector unsigned int v;
1832 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1834 ac_compiler_supports_vsx=yes
1835 AC_MSG_RESULT([yes])
1837 ac_compiler_supports_vsx=no
1841 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1842 -a x$ac_compiler_supports_vsx = xyes \
1843 -a x$HWCAP_HAS_VSX = xyes ])
1845 # DFP (Decimal Float)
1846 # The initial DFP support was added in Power 6. The dcffix instruction
1847 # support was added in Power 7.
1848 AC_MSG_CHECKING([that assembler knows DFP])
1849 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1852 __asm__ __volatile__("adtr 1, 2, 3")
1854 __asm__ __volatile__(".machine power7;\n" \
1860 AC_MSG_RESULT([yes])
1865 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1867 CFLAGS="-mhard-dfp -Werror"
1869 # The dcffix instruction is Power 7
1870 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1873 __asm__ __volatile__("adtr 1, 2, 3")
1875 __asm__ __volatile__(".machine power7;\n" \
1880 ac_compiler_have_dfp=yes
1881 AC_MSG_RESULT([yes])
1883 ac_compiler_have_dfp=no
1887 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1888 -a x$ac_compiler_have_dfp = xyes \
1889 -a x$HWCAP_HAS_DFP = xyes )
1891 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1892 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1894 _Decimal64 x = 0.0DD;
1896 ac_compiler_have_dfp_type=yes
1897 AC_MSG_RESULT([yes])
1899 ac_compiler_have_dfp_type=no
1902 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1903 -a x$HWCAP_HAS_DFP = xyes )
1906 # HTM (Hardware Transactional Memory)
1907 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1909 CFLAGS="-mhtm -Werror"
1910 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1914 AC_MSG_RESULT([yes])
1915 ac_compiler_supports_htm=yes
1918 ac_compiler_supports_htm=no
1922 AC_MSG_CHECKING([if compiler can find the htm builtins])
1924 CFLAGS="-mhtm -Werror"
1925 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1927 if (__builtin_tbegin (0))
1930 AC_MSG_RESULT([yes])
1931 ac_compiler_sees_htm_builtins=yes
1934 ac_compiler_sees_htm_builtins=no
1938 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1939 -a x$ac_compiler_sees_htm_builtins = xyes \
1940 -a x$HWCAP_HAS_HTM = xyes )
1942 # isa 3.0 checking. (actually 3.0 or newer)
1943 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1945 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1947 __asm__ __volatile__ (".machine power9;\n" \
1950 # guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste,
1953 CFLAGS="-DHAS_ISA_3_00"
1954 ac_asm_have_isa_3_00=yes
1955 AC_MSG_RESULT([yes])
1957 ac_asm_have_isa_3_00=no
1963 AC_MSG_CHECKING([that assembler knows xscvhpdp ])
1965 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1967 __asm__ __volatile__ (".machine power9;\n" \
1968 "xscvhpdp 1,2;\n" );
1970 ac_asm_have_xscvhpdp=yes
1971 AC_MSG_RESULT([yes])
1973 ac_asm_have_xscvhpdp=no
1977 # darn instruction checking
1978 AC_MSG_CHECKING([that assembler knows darn instruction ])
1980 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1982 __asm__ __volatile__(".machine power9; darn 1,0 ");
1984 ac_asm_have_darn_inst=yes
1985 AC_MSG_RESULT([yes])
1987 ac_asm_have_darn_inst=no
1992 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
1993 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1995 __asm__ __volatile__ (".machine power10;\n" \
1998 ac_asm_have_isa_3_1=yes
1999 AC_MSG_RESULT([yes])
2001 ac_asm_have_isa_3_1=no
2006 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
2007 -a x$HWCAP_HAS_ISA_3_00 = xyes])
2009 AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes])
2010 AM_CONDITIONAL(HAS_DARN, [test x$ac_asm_have_darn_inst = xyes])
2012 AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \
2013 -a x$HWCAP_HAS_ISA_3_1 = xyes])
2015 # Check for pthread_create@GLIBC2.0
2016 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
2019 CFLAGS="-lpthread -Werror"
2020 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2021 extern int pthread_create_glibc_2_0(void*, const void*,
2022 void *(*)(void*), void*);
2023 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
2027 * Apparently on PowerPC linking this program succeeds and generates an
2028 * executable with the undefined symbol pthread_create@GLIBC_2.0.
2030 #error This test does not work properly on PowerPC.
2032 pthread_create_glibc_2_0(0, 0, 0, 0);
2036 ac_have_pthread_create_glibc_2_0=yes
2037 AC_MSG_RESULT([yes])
2038 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
2039 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
2041 ac_have_pthread_create_glibc_2_0=no
2046 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
2047 test x$ac_have_pthread_create_glibc_2_0 = xyes)
2050 # Check for dlinfo RTLD_DI_TLS_MODID
2051 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
2055 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2062 size_t sizes[10000];
2063 size_t modid_offset;
2064 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
2067 ac_have_dlinfo_rtld_di_tls_modid=yes
2068 AC_MSG_RESULT([yes])
2069 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
2070 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
2072 ac_have_dlinfo_rtld_di_tls_modid=no
2077 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
2078 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
2081 # Check for eventfd_t, eventfd() and eventfd_read()
2082 AC_MSG_CHECKING([for eventfd()])
2084 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2085 #include <sys/eventfd.h>
2091 eventfd_read(fd, &ev);
2094 AC_MSG_RESULT([yes])
2095 AC_DEFINE([HAVE_EVENTFD], 1,
2096 [Define to 1 if you have the `eventfd' function.])
2097 AC_DEFINE([HAVE_EVENTFD_READ], 1,
2098 [Define to 1 if you have the `eventfd_read' function.])
2103 # Check whether compiler can process #include <thread> without errors
2104 # clang 3.3 cannot process <thread> from e.g.
2105 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
2107 AC_MSG_CHECKING([that C++ compiler can compile C++17 code])
2109 safe_CXXFLAGS=$CXXFLAGS
2112 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2117 AC_MSG_RESULT([yes])
2122 CXXFLAGS=$safe_CXXFLAGS
2125 AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes)
2127 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
2129 safe_CXXFLAGS=$CXXFLAGS
2132 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2136 ac_cxx_can_include_thread_header=yes
2137 AC_MSG_RESULT([yes])
2139 ac_cxx_can_include_thread_header=no
2142 CXXFLAGS=$safe_CXXFLAGS
2145 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
2147 # Check whether compiler can process #include <condition_variable> without errors
2149 AC_MSG_CHECKING([that C++ compiler can include <condition_variable> header file])
2151 safe_CXXFLAGS=$CXXFLAGS
2154 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2155 #include <condition_variable>
2158 ac_cxx_can_include_condition_variable_header=yes
2159 AC_MSG_RESULT([yes])
2161 ac_cxx_can_include_condition_variable_header=no
2164 CXXFLAGS=$safe_CXXFLAGS
2167 AM_CONDITIONAL(CXX_CAN_INCLUDE_CONDITION_VARIABLE_HEADER, test x$ac_cxx_can_include_condition_variable_header = xyes)
2169 # check for std::shared_timed_mutex, this is a C++ 14 feature
2171 AC_MSG_CHECKING([that C++ compiler can use std::shared_timed_mutex])
2173 safe_CXXFLAGS=$CXXFLAGS
2174 CXXFLAGS="-std=c++1y -pthread"
2176 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2177 #include <shared_mutex>
2178 std::shared_timed_mutex test_mutex;
2181 ac_cxx_can_use_shared_timed_mutex=yes
2182 AC_MSG_RESULT([yes])
2184 ac_cxx_can_use_shared_timed_mutex=no
2187 CXXFLAGS=$safe_CXXFLAGS
2190 AM_CONDITIONAL(CXX_CAN_USE_SHARED_TIMED_MUTEX, test x$ac_cxx_can_use_shared_timed_mutex = xyes)
2192 # check for std::shared_mutex, this is a C++ 11 feature
2194 AC_MSG_CHECKING([that C++ compiler can use std::timed_mutex])
2196 safe_CXXFLAGS=$CXXFLAGS
2197 CXXFLAGS="-std=c++0x -pthread"
2199 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2201 std::timed_mutex test_mutex;
2204 ac_cxx_can_use_timed_mutex=yes
2205 AC_MSG_RESULT([yes])
2207 ac_cxx_can_use_timed_mutex=no
2210 CXXFLAGS=$safe_CXXFLAGS
2213 AM_CONDITIONAL(CXX_CAN_USE_TIMED_MUTEX, test x$ac_cxx_can_use_timed_mutex = xyes)
2215 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
2216 # of the user_regs_struct from sys/user.h. They are structurally the same
2217 # but we get either one or the other.
2219 AC_CHECK_TYPE([struct user_regs_struct],
2220 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
2221 [[#include <sys/ptrace.h>]
2222 [#include <sys/time.h>]
2223 [#include <sys/user.h>]])
2224 if test "$sys_user_has_user_regs" = "yes"; then
2225 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
2226 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
2229 AC_MSG_CHECKING([for __NR_membarrier])
2230 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2231 #include <linux/unistd.h>
2233 return __NR_membarrier
2235 ac_have_nr_membarrier=yes
2236 AC_MSG_RESULT([yes])
2238 ac_have_nr_membarrier=no
2242 AM_CONDITIONAL(HAVE_NR_MEMBARRIER, [test x$ac_have_nr_membarrier = xyes])
2244 #----------------------------------------------------------------------------
2245 # Checking for supported compiler flags.
2246 #----------------------------------------------------------------------------
2248 case "${host_cpu}" in
2250 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2251 if test -z "$ARCH"; then
2252 # does this compiler support -march=mips32 (mips32 default) ?
2253 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
2256 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
2258 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2261 FLAG_M32="-mips32 -mabi=32"
2262 AC_MSG_RESULT([yes])
2272 # does this compiler support -march=mips64r2 (mips64r2 default) ?
2273 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
2276 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
2278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2281 FLAG_M64="-march=mips64r2 -mabi=64"
2282 AC_MSG_RESULT([yes])
2295 # does this compiler support -m32 ?
2296 AC_MSG_CHECKING([if gcc accepts -m32])
2299 CFLAGS="${FLAG_32ON64} -m32 -Werror"
2301 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2304 FLAG_M32="${FLAG_32ON64} -m32"
2305 AC_MSG_RESULT([yes])
2315 # does this compiler support -m64 ?
2316 AC_MSG_CHECKING([if gcc accepts -m64])
2319 CFLAGS="-m64 -Werror"
2321 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2325 AC_MSG_RESULT([yes])
2337 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2338 if test -z "$ARCH"; then
2339 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
2340 AC_MSG_CHECKING([if gcc accepts -march=octeon])
2343 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
2345 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2348 FLAG_OCTEON="-march=octeon"
2349 AC_MSG_RESULT([yes])
2356 AC_SUBST(FLAG_OCTEON)
2359 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
2360 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
2363 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
2365 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2368 FLAG_OCTEON2="-march=octeon2"
2369 AC_MSG_RESULT([yes])
2376 AC_SUBST(FLAG_OCTEON2)
2380 # does this compiler support -mmsa (MIPS MSA ASE) ?
2381 AC_MSG_CHECKING([if gcc accepts -mmsa])
2384 CFLAGS="$CFLAGS -mmsa -Werror"
2386 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2390 AC_MSG_RESULT([yes])
2399 # Are we compiling for the MIPS64 n32 ABI?
2400 AC_MSG_CHECKING([if gcc is producing mips n32 binaries])
2401 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2402 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABIN32))
2407 FLAG_M64="-march=mips64r2 -mabi=n32"
2408 AC_MSG_RESULT([yes])
2413 # Are we compiling for the MIPS64 n64 ABI?
2414 AC_MSG_CHECKING([if gcc is producing mips n64 binaries])
2415 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2416 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABI64))
2421 AC_MSG_RESULT([yes])
2426 # We enter the code block below in the following case:
2427 # Target architecture is set to mips64, the desired abi
2428 # was not specified and the compiler's default abi setting
2429 # is neither n32 nor n64.
2430 # Probe for and set the abi to either n64 or n32, in that order,
2431 # which is required for a mips64 build of valgrind.
2432 if test "$ARCH_MAX" = "mips64" -a "x$VGCONF_ABI" = "x"; then
2434 CFLAGS="$CFLAGS -mabi=64 -Werror"
2435 AC_MSG_CHECKING([if gcc is n64 capable])
2436 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2440 AC_MSG_RESULT([yes])
2446 if test "x$VGCONF_ABI" = "x"; then
2448 CFLAGS="$CFLAGS -mabi=n32 -Werror"
2449 AC_MSG_CHECKING([if gcc is n32 capable])
2450 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2454 FLAG_M64="-march=mips64r2 -mabi=n32"
2455 AC_MSG_RESULT([yes])
2463 AM_CONDITIONAL([VGCONF_HAVE_ABI],
2464 [test x$VGCONF_ABI != x])
2465 AC_SUBST(VGCONF_ABI)
2468 # does this compiler support -mmmx ?
2469 AC_MSG_CHECKING([if gcc accepts -mmmx])
2472 CFLAGS="-mmmx -Werror"
2474 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2478 AC_MSG_RESULT([yes])
2488 # does this compiler support -msse ?
2489 AC_MSG_CHECKING([if gcc accepts -msse])
2492 CFLAGS="-msse -Werror"
2494 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2498 AC_MSG_RESULT([yes])
2508 # does this compiler support -mpreferred-stack-boundary=2 when
2509 # generating code for a 32-bit target? Note that we only care about
2510 # this when generating code for (32-bit) x86, so if the compiler
2511 # doesn't recognise -m32 it's no big deal. We'll just get code for
2512 # the Memcheck and other helper functions, that is a bit slower than
2513 # it could be, on x86; and no difference at all on any other platform.
2514 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
2517 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
2519 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2522 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
2523 AC_MSG_RESULT([yes])
2525 PREFERRED_STACK_BOUNDARY_2=""
2530 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
2533 # does this compiler support -mlong-double-128 ?
2534 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
2536 CFLAGS="-mlong-double-128 -Werror"
2537 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2540 ac_compiler_supports_mlong_double_128=yes
2541 AC_MSG_RESULT([yes])
2543 ac_compiler_supports_mlong_double_128=no
2547 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
2548 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
2549 AC_SUBST(FLAG_MLONG_DOUBLE_128)
2551 # does this toolchain support lto ?
2552 # Not checked for if --enable-lto=no was given, or if LTO_AR or LTO_RANLIB
2554 # If not enable-lto=* arg is provided, default to no, as lto builds are
2555 # a lot slower, and so not appropriate for Valgrind developments.
2556 # --enable-lto=yes should be used by distro packagers.
2557 AC_CACHE_CHECK([for using the link time optimisation], vg_cv_lto,
2559 [ --enable-lto enables building with link time optimisation],
2560 [vg_cv_lto=$enableval],
2563 if test "x${vg_cv_lto}" != "xno" -a "x${LTO_AR}" != "x" -a "x${LTO_RANLIB}" != "x"; then
2564 AC_MSG_CHECKING([if toolchain accepts lto])
2566 TEST_LTO_CFLAGS="-flto -fuse-linker-plugin"
2567 CFLAGS="$TEST_LTO_CFLAGS -Werror"
2569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2570 extern void somefun(void);
2574 LTO_CFLAGS=$TEST_LTO_CFLAGS
2575 AC_MSG_RESULT([yes])
2583 AC_SUBST(LTO_CFLAGS)
2585 # if we could not compile with lto args, or lto was disabled,
2586 # then set LTO_AR/LTO_RANLIB to the non lto values
2587 # define in config.h ENABLE_LTO (not needed by the code currently, but
2588 # this guarantees we recompile everything if we re-configure and rebuild
2589 # in a build dir previously build with another value of --enable-lto
2590 if test "x${LTO_CFLAGS}" = "x"; then
2592 LTO_RANLIB=${RANLIB}
2596 AC_DEFINE([ENABLE_LTO], 1, [configured to build with lto link time optimisation])
2599 # Convenience function to check whether GCC supports a particular
2600 # warning option. Takes two arguments,
2601 # first the warning flag name to check (without -W), then the
2602 # substitution name to set with -Wno-warning-flag if the flag exists,
2603 # or the empty string if the compiler doesn't accept the flag. Note
2604 # that checking is done against the warning flag itself, but the
2605 # substitution is then done to cancel the warning flag.
2606 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
2607 AC_MSG_CHECKING([if gcc accepts -W$1])
2609 CFLAGS="-W$1 -Werror"
2610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2611 AC_SUBST([$2], [-Wno-$1])
2612 AC_MSG_RESULT([yes])], [
2614 AC_MSG_RESULT([no])])
2618 # A variation of the above for arguments that
2620 AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[
2621 AC_MSG_CHECKING([if gcc accepts -W$1=$2])
2623 CFLAGS="-W$1=$2 -Werror"
2624 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2625 AC_SUBST([$3], [-Wno-$1])
2626 AC_MSG_RESULT([yes])], [
2628 AC_MSG_RESULT([no])])
2632 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
2633 # -W$1 (instead of -Wno-$1).
2634 AC_DEFUN([AC_GCC_WARNING_SUBST],[
2635 AC_MSG_CHECKING([if gcc accepts -W$1])
2637 CFLAGS="-W$1 -Werror"
2638 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2639 AC_SUBST([$2], [-W$1])
2640 AC_MSG_RESULT([yes])], [
2642 AC_MSG_RESULT([no])])
2646 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
2647 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
2648 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
2649 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
2650 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
2651 AC_GCC_WARNING_SUBST_NO([maybe-uninitialized], [FLAG_W_NO_MAYBE_UNINITIALIZED])
2652 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
2653 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
2654 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
2655 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2656 AC_GCC_WARNING_SUBST_NO([expansion-to-defined], [FLAG_W_NO_EXPANSION_TO_DEFINED])
2657 AC_GCC_WARNING_SUBST_NO([unused-variable], [FLAG_W_NO_UNUSED_VARIABLE])
2658 AC_GCC_WARNING_SUBST_NO([unused-but-set-variable], [FLAG_W_NO_UNUSED_BUT_SET_VARIABLE])
2659 AC_GCC_WARNING_SUBST_NO([non-power-of-two-alignment], [FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT])
2660 AC_GCC_WARNING_SUBST_NO([sign-compare], [FLAG_W_NO_SIGN_COMPARE])
2661 AC_GCC_WARNING_SUBST_NO([stringop-overflow], [FLAG_W_NO_STRINGOP_OVERFLOW])
2662 AC_GCC_WARNING_SUBST_NO([stringop-overread], [FLAG_W_NO_STRINGOP_OVERREAD])
2663 AC_GCC_WARNING_SUBST_NO([stringop-truncation], [FLAG_W_NO_STRINGOP_TRUNCATION])
2664 AC_GCC_WARNING_SUBST_NO([format-overflow], [FLAG_W_NO_FORMAT_OVERFLOW])
2665 AC_GCC_WARNING_SUBST_NO([use-after-free], [FLAG_W_NO_USE_AFTER_FREE])
2666 AC_GCC_WARNING_SUBST_NO([free-nonheap-object], [FLAG_W_NO_FREE_NONHEAP_OBJECT])
2667 AC_GCC_WARNING_SUBST_NO([fortify-source], [FLAG_W_NO_FORTIFY_SOURCE])
2668 AC_GCC_WARNING_SUBST_NO([builtin-memcpy-chk-size], [FLAG_W_NO_BUILTIN_MEMCPY_CHK_SIZE])
2669 AC_GCC_WARNING_SUBST_NO([incompatible-pointer-types-discards-qualifiers], [FLAG_W_NO_INCOMPATIBLE_POINTER_TYPES_DISCARDS_QUALIFIERS])
2670 AC_GCC_WARNING_SUBST_NO([suspicious-bzero], [FLAG_W_NO_SUSPICIOUS_BZERO])
2671 AC_GCC_WARNING_SUBST_NO([attributes], [FLAG_W_NO_ATTRIBUTES])
2672 AC_GCC_WARNING_SUBST_NO([unused-result], [FLAG_W_NO_UNUSED_RESULT])
2673 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2674 AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED])
2676 AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
2678 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
2679 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
2680 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
2681 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
2682 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
2683 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2684 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2685 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2686 AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
2687 AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
2688 AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
2690 # Does this compiler support -Wformat-security ?
2691 # Special handling is needed, because certain GCC versions require -Wformat
2692 # being present if -Wformat-security is given. Otherwise a warning is issued.
2693 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2694 # And with that the warning will be turned into an error with the result
2695 # that -Wformat-security is believed to be unsupported when in fact it is.
2696 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2698 CFLAGS="-Wformat -Wformat-security -Werror"
2699 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2700 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2701 AC_MSG_RESULT([yes])], [
2702 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2703 AC_MSG_RESULT([no])])
2706 # does this compiler support -Wextra or the older -W ?
2708 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2711 CFLAGS="-Wextra -Werror"
2713 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2716 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2717 AC_MSG_RESULT([-Wextra])
2720 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2723 AC_SUBST([FLAG_W_EXTRA], [-W])
2726 AC_SUBST([FLAG_W_EXTRA], [])
2727 AC_MSG_RESULT([not supported])
2732 # On ARM we do not want to pass -Wcast-align as that produces loads
2733 # of warnings. GCC is just being conservative. See here:
2734 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2735 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2736 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2738 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2741 # does this compiler support -faligned-new ?
2742 AC_MSG_CHECKING([if g++ accepts -faligned-new])
2744 safe_CXXFLAGS=$CXXFLAGS
2745 CXXFLAGS="-faligned-new -Werror"
2748 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2751 FLAG_FALIGNED_NEW="-faligned-new"
2752 AC_MSG_RESULT([yes])
2754 FLAG_FALIGNED_NEW=""
2757 CXXFLAGS=$safe_CXXFLAGS
2760 AC_SUBST(FLAG_FALIGNED_NEW)
2762 # does this compiler support -fsized-deallocation ?
2763 AC_MSG_CHECKING([if g++ accepts -fsized-deallocation])
2765 safe_CXXFLAGS=$CXXFLAGS
2766 CXXFLAGS="-fsized-deallocation -Werror"
2769 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2772 FLAG_FSIZED_DEALLOCATION="-fsized-deallocation"
2773 ac_have_sized_deallocation=yes
2774 AC_MSG_RESULT([yes])
2776 FLAG_FSIZED_DEALLOCATION=""
2777 ac_have_sized_deallocation=no
2780 CXXFLAGS=$safe_CXXFLAGS
2783 AC_SUBST(FLAG_FSIZED_DEALLOCATION)
2784 AM_CONDITIONAL([HAVE_FSIZED_DEALLOCATION], [test x$ac_have_sized_deallocation = xyes])
2786 # does this compiler support C++17 aligned new/delete?
2787 AC_MSG_CHECKING([if g++ supports aligned new and delete])
2789 safe_CXXFLAGS=$CXXFLAGS
2790 CXXFLAGS="-std=c++17"
2793 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2797 operator delete(nullptr, std::align_val_t(64U));
2799 ac_have_aligned_cxx_alloc=yes
2800 AC_MSG_RESULT([yes])
2802 ac_have_aligned_cxx_alloc=no
2805 CXXFLAGS=$safe_CXXFLAGS
2808 AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes])
2810 # does this compiler support -fno-stack-protector ?
2811 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2814 CFLAGS="-fno-stack-protector -Werror"
2816 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2819 no_stack_protector=yes
2820 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2821 AC_MSG_RESULT([yes])
2823 no_stack_protector=no
2824 FLAG_FNO_STACK_PROTECTOR=""
2829 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2831 # does this compiler support -finline-functions ?
2832 AC_MSG_CHECKING([if gcc accepts -finline-functions])
2835 CFLAGS="-finline-functions -Werror"
2837 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2840 inline_functions=yes
2841 FLAG_FINLINE_FUNCTIONS="-finline-functions"
2842 AC_MSG_RESULT([yes])
2845 FLAG_FINLINE_FUNCTIONS=""
2850 AC_SUBST(FLAG_FINLINE_FUNCTIONS)
2852 # Does GCC support disabling Identical Code Folding?
2853 # We want to disabled Identical Code Folding for the
2854 # tools preload shared objects to get better backraces.
2855 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2856 # "The optimization reduces code size and may disturb
2857 # unwind stacks by replacing a function by equivalent
2858 # one with a different name."
2859 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2862 CFLAGS="-fno-ipa-icf -Werror"
2864 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2868 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2869 AC_MSG_RESULT([yes])
2877 AC_SUBST(FLAG_FNO_IPA_ICF)
2880 # Does this compiler support -fsanitize=undefined. This is true for
2881 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2882 # also checks for alignment violations on memory accesses which the valgrind
2883 # code base is sprinkled (if not littered) with. As those alignment issues
2884 # don't pose a problem we want to suppress warnings about them.
2885 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2886 # GCCs do not support that.
2888 # Only checked for if --enable-ubsan was given.
2889 if test "x${vg_cv_ubsan}" = "xyes"; then
2890 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2892 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2893 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2896 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2897 LIB_UBSAN="-static-libubsan"
2898 AC_MSG_RESULT([yes])
2900 CFLAGS="-fsanitize=undefined -Werror"
2901 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2904 FLAG_FSANITIZE="-fsanitize=undefined"
2905 LIB_UBSAN="-static-libubsan"
2906 AC_MSG_RESULT([yes])
2914 AC_SUBST(FLAG_FSANITIZE)
2917 # does this compiler support --param inline-unit-growth=... ?
2919 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2922 CFLAGS="--param inline-unit-growth=900 -Werror"
2924 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2927 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2928 ["--param inline-unit-growth=900"])
2929 AC_MSG_RESULT([yes])
2931 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2937 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2939 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2942 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2944 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2948 AC_MSG_RESULT([yes])
2953 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2957 # does this compiler support -g -gz=zlib ?
2959 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2962 CFLAGS="-g -gz=zlib"
2964 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2968 AC_MSG_RESULT([yes])
2973 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2977 # does this compiler support -g -gz=zlib-gnu ?
2979 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2982 CFLAGS="-g -gz=zlib-gnu"
2984 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2987 ac_have_gz_zlib_gnu=yes
2988 AC_MSG_RESULT([yes])
2990 ac_have_gz_zlib_gnu=no
2993 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2997 # does this compiler support nested functions ?
2999 AC_MSG_CHECKING([if gcc accepts nested functions])
3001 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3002 int foo() { return 1; }
3005 ac_have_nested_functions=yes
3006 AC_MSG_RESULT([yes])
3008 ac_have_nested_functions=no
3011 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
3014 # does this compiler support the 'p' constraint in ASM statements ?
3016 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
3018 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3020 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
3022 ac_have_asm_constraint_p=yes
3023 AC_MSG_RESULT([yes])
3025 ac_have_asm_constraint_p=no
3028 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
3031 # Does this compiler and linker support -pie?
3032 # Some compilers actually do not support -pie and report its usage
3033 # as an error. We need to check if it is safe to use it first.
3035 AC_MSG_CHECKING([if gcc accepts -pie])
3040 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
3043 AC_SUBST([FLAG_PIE], ["-pie"])
3044 AC_MSG_RESULT([yes])
3046 AC_SUBST([FLAG_PIE], [""])
3051 AC_MSG_CHECKING([if gcc accepts -ansi])
3056 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3060 AC_MSG_RESULT([yes])
3065 AM_CONDITIONAL([HAVE_ANSI], [test x$ac_have_ansi = xyes])
3070 # Does this compiler support -no-pie?
3071 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
3072 # default. However this gets in the way with some tests, we use -no-pie
3075 AC_MSG_CHECKING([if gcc accepts -no-pie])
3078 CFLAGS="-no-pie -Werror"
3080 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
3083 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
3084 AC_MSG_RESULT([yes])
3086 AC_SUBST([FLAG_NO_PIE], [""])
3092 # We want to use use the -Ttext-segment option to the linker.
3093 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
3094 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
3095 # semantics are NOT what we want (GNU gold -Ttext is fine).
3097 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
3098 # will reside. -Ttext aligns just the .text section start (but not any
3101 # LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes"
3102 # in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html
3103 # The --image-base option (since version 6.0?) provides the semantics needed.
3104 # -Ttext-segment generates an error, but -Ttext now more closely
3105 # follows the GNU (bfd) ld's -Ttext.
3107 # So test first for --image-base support, and if that fails then
3108 # for -Ttext-segment which is supported by all bfd ld versions
3109 # and use that if it exists. If it doesn't exist it must be an older
3110 # version of gold and we can fall back to using -Ttext which has the
3114 AC_MSG_CHECKING([if the linker accepts -Wl,--image-base])
3116 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror"
3119 [AC_LANG_SOURCE([int _start () { return 0; }])],
3121 linker_using_t_text="no"
3122 AC_SUBST([FLAG_T_TEXT], ["--image-base"])
3123 AC_MSG_RESULT([yes])
3127 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
3129 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
3132 [AC_LANG_SOURCE([int _start () { return 0; }])],
3134 linker_using_t_text="no"
3135 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
3136 AC_MSG_RESULT([yes])
3138 linker_using_t_text="yes"
3139 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
3146 # If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will
3147 # have to strip any build-id ELF NOTEs from the statically linked tools.
3148 # Otherwise the build-id NOTE might end up at the default load address.
3149 # (Pedantically if the linker is gold then -Ttext is fine, but newer
3150 # gold versions also support -Ttext-segment. So just assume that unless
3151 # we can use -Ttext-segment we need to strip the build-id NOTEs.
3152 if test "x${linker_using_t_text}" = "xyes"; then
3153 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
3154 # does the linker support -Wl,--build-id=none ? Note, it's
3155 # important that we test indirectly via whichever C compiler
3156 # is selected, rather than testing /usr/bin/ld or whatever
3158 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
3160 CFLAGS="-Wl,--build-id=none -Werror"
3163 [AC_LANG_PROGRAM([ ], [return 0;])],
3165 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
3166 AC_MSG_RESULT([yes])
3168 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3172 AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.])
3173 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3177 # On s390x, if the linker supports -Wl,--s390-pgste, then we build the
3178 # tools with that flag. This enables running programs that need it, such
3180 if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then
3181 AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste])
3183 CFLAGS="-Wl,--s390-pgste"
3186 [AC_LANG_PROGRAM([ ], [return 0;])],
3188 AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"])
3189 AC_MSG_RESULT([yes])
3191 AC_SUBST([FLAG_S390_PGSTE], [""])
3197 # does the ppc assembler support "mtocrf" et al?
3198 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
3200 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3201 __asm__ __volatile__("mtocrf 4,0");
3202 __asm__ __volatile__("mfocrf 0,4");
3204 ac_have_as_ppc_mftocrf=yes
3205 AC_MSG_RESULT([yes])
3207 ac_have_as_ppc_mftocrf=no
3210 if test x$ac_have_as_ppc_mftocrf = xyes ; then
3211 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
3215 # does the ppc assembler support "lfdp" and other phased out floating point insns?
3216 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
3218 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3219 do { typedef struct {
3223 dbl_pair_t dbl_pair[3];
3224 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
3227 ac_have_as_ppc_fpPO=yes
3228 AC_MSG_RESULT([yes])
3230 ac_have_as_ppc_fpPO=no
3233 if test x$ac_have_as_ppc_fpPO = xyes ; then
3234 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
3238 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
3239 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
3241 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3243 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
3244 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
3246 ac_have_as_amd64_fxsave64=yes
3247 AC_MSG_RESULT([yes])
3249 ac_have_as_amd64_fxsave64=no
3252 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
3253 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
3256 # does the x86/amd64 assembler understand SSE3 instructions?
3257 # Note, this doesn't generate a C-level symbol. It generates a
3258 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
3259 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
3261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3262 do { long long int x;
3263 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
3267 AC_MSG_RESULT([yes])
3273 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
3276 # Ditto for SSSE3 instructions (note extra S)
3277 # Note, this doesn't generate a C-level symbol. It generates a
3278 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
3279 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
3281 save_CFLAGS="$CFLAGS"
3282 CFLAGS="$CFLAGS -msse -Werror"
3283 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3284 do { long long int x;
3285 __asm__ __volatile__(
3286 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
3289 ac_have_as_ssse3=yes
3290 AC_MSG_RESULT([yes])
3295 CFLAGS="$save_CFLAGS"
3297 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
3300 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
3301 # Note, this doesn't generate a C-level symbol. It generates a
3302 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
3303 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
3304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3306 __asm__ __volatile__(
3307 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
3310 ac_have_as_pclmulqdq=yes
3311 AC_MSG_RESULT([yes])
3313 ac_have_as_pclmulqdq=no
3317 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
3320 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
3321 # Note, this doesn't generate a C-level symbol. It generates a
3322 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
3323 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
3324 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3327 * Carry-less multiplication of xmm1 with xmm2 and store the result in
3328 * xmm3. The immediate is used to determine which quadwords of xmm1 and
3329 * xmm2 should be used.
3331 __asm__ __volatile__(
3332 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
3335 ac_have_as_vpclmulqdq=yes
3336 AC_MSG_RESULT([yes])
3338 ac_have_as_vpclmulqdq=no
3342 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
3345 # does the x86/amd64 assembler understand FMA4 instructions?
3346 # Note, this doesn't generate a C-level symbol. It generates a
3347 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
3348 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
3349 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3351 __asm__ __volatile__(
3352 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
3355 ac_have_as_vfmaddpd=yes
3356 AC_MSG_RESULT([yes])
3358 ac_have_as_vfmaddpd=no
3362 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
3365 # does the x86/amd64 assembler understand the LZCNT instruction?
3366 # Note, this doesn't generate a C-level symbol. It generates a
3367 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
3368 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
3370 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3372 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
3375 ac_have_as_lzcnt=yes
3376 AC_MSG_RESULT([yes])
3382 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
3385 # does the x86/amd64 assembler understand the LOOPNEL instruction?
3386 # Note, this doesn't generate a C-level symbol. It generates a
3387 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
3388 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
3390 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3392 __asm__ __volatile__("1: loopnel 1b\n");
3395 ac_have_as_loopnel=yes
3396 AC_MSG_RESULT([yes])
3398 ac_have_as_loopnel=no
3402 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
3405 # does the x86/amd64 assembler understand ADDR32 ?
3406 # Note, this doesn't generate a C-level symbol. It generates a
3407 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
3408 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
3410 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3412 asm volatile ("addr32 rep movsb");
3415 ac_have_as_addr32=yes
3416 AC_MSG_RESULT([yes])
3418 ac_have_as_addr32=no
3422 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
3425 # does the x86/amd64 assembler understand SSE 4.2 instructions?
3426 # Note, this doesn't generate a C-level symbol. It generates a
3427 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
3428 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
3430 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3431 do { long long int x;
3432 __asm__ __volatile__(
3433 "crc32q %%r15,%%r15" : : : "r15" );
3434 __asm__ __volatile__(
3435 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
3436 __asm__ __volatile__(
3437 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
3440 ac_have_as_sse42=yes
3441 AC_MSG_RESULT([yes])
3447 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
3450 # does the x86/amd64 assembler understand AVX instructions?
3451 # Note, this doesn't generate a C-level symbol. It generates a
3452 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
3453 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
3455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3456 do { long long int x;
3457 __asm__ __volatile__(
3458 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
3459 __asm__ __volatile__(
3460 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3464 AC_MSG_RESULT([yes])
3470 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
3473 # does the x86/amd64 assembler understand AVX2 instructions?
3474 # Note, this doesn't generate a C-level symbol. It generates a
3475 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
3476 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
3478 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3479 do { long long int x;
3480 __asm__ __volatile__(
3481 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3482 __asm__ __volatile__(
3483 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3487 AC_MSG_RESULT([yes])
3493 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
3496 # does the x86/amd64 assembler understand TSX instructions and
3497 # the XACQUIRE/XRELEASE prefixes?
3498 # Note, this doesn't generate a C-level symbol. It generates a
3499 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
3500 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
3502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3504 __asm__ __volatile__(
3507 " xacquire lock incq 0(%rsp) \n\t"
3508 " xrelease lock incq 0(%rsp) \n"
3513 AC_MSG_RESULT([yes])
3519 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
3522 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
3523 # Note, this doesn't generate a C-level symbol. It generates a
3524 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
3525 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
3527 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3528 do { unsigned int h, l;
3529 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
3530 __asm__ __volatile__(
3531 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
3532 __asm__ __volatile__(
3533 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
3537 AC_MSG_RESULT([yes])
3543 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
3546 # does the x86/amd64 assembler understand FMA instructions?
3547 # Note, this doesn't generate a C-level symbol. It generates a
3548 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
3549 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
3551 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3552 do { unsigned int h, l;
3553 __asm__ __volatile__(
3554 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3555 __asm__ __volatile__(
3556 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
3557 __asm__ __volatile__(
3558 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
3562 AC_MSG_RESULT([yes])
3568 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
3571 # does the amd64 assembler understand MPX instructions?
3572 # Note, this doesn't generate a C-level symbol. It generates a
3573 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
3574 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
3576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3578 asm ("bndmov %bnd0,(%rsp)");
3579 asm ("bndldx 3(%rbx,%rdx), %bnd2");
3580 asm ("bnd call foo\n"
3587 AC_MSG_RESULT([yes])
3593 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
3596 # does the amd64 assembler understand ADX instructions?
3597 # Note, this doesn't generate a C-level symbol. It generates a
3598 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
3599 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
3601 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3603 asm ("adcxq %r14,%r8");
3607 AC_MSG_RESULT([yes])
3613 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
3616 # does the amd64 assembler understand the RDRAND instruction?
3617 # Note, this doesn't generate a C-level symbol. It generates a
3618 # automake-level symbol (BUILD_RDRAND_TESTS), used in test Makefile.am's
3619 AC_MSG_CHECKING([if amd64 assembler knows the RDRAND instruction])
3621 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3623 asm ("rdrand %r14");
3624 asm ("rdrand %r14d");
3625 asm ("rdrand %r14w");
3628 ac_have_as_rdrand=yes
3629 AC_MSG_RESULT([yes])
3631 ac_have_as_rdrand=no
3635 AM_CONDITIONAL(BUILD_RDRAND_TESTS, test x$ac_have_as_rdrand = xyes)
3637 # does the amd64 assembler understand the RDSEED instruction?
3638 # Note, this doesn't generate a C-level symbol. It generates a
3639 # automake-level symbol (BUILD_RDSEED_TESTS), used in test Makefile.am's
3640 AC_MSG_CHECKING([if amd64 assembler knows the RDSEED instruction])
3642 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3644 asm ("rdseed %r14");
3645 asm ("rdseed %r14d");
3646 asm ("rdseed %r14w");
3649 ac_have_as_rdseed=yes
3650 AC_MSG_RESULT([yes])
3652 ac_have_as_rdseed=no
3656 AM_CONDITIONAL(BUILD_RDSEED_TESTS, test x$ac_have_as_rdseed = xyes)
3658 # does the amd64 assembler understand the F16C instructions (VCVTPH2PS and
3660 # Note, this doesn't generate a C-level symbol. It generates a
3661 # automake-level symbol (BUILD_F16C_TESTS), used in test Makefile.am's
3662 AC_MSG_CHECKING([if amd64 assembler knows the F16C instructions])
3664 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3666 asm ("vcvtph2ps %xmm5, %ymm10");
3667 // If we put the dollar sign and zero together, the shell processing
3668 // this configure.ac script substitutes the command name in. Sigh.
3669 asm ("vcvtps2ph $" "0, %ymm10, %xmm5");
3673 AC_MSG_RESULT([yes])
3679 AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes)
3682 # does the x86/amd64 assembler understand MOVBE?
3683 # Note, this doesn't generate a C-level symbol. It generates a
3684 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
3685 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
3687 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3688 do { long long int x;
3689 __asm__ __volatile__(
3690 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
3693 ac_have_as_movbe=yes
3694 AC_MSG_RESULT([yes])
3700 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
3703 # Does the C compiler support the "ifunc" attribute
3704 # Note, this doesn't generate a C-level symbol. It generates a
3705 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
3706 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
3708 AC_LINK_IFELSE([AC_LANG_SOURCE([[
3709 static void mytest(void) {}
3711 static void (*resolve_test(void))(void)
3713 return (void (*)(void))&mytest;
3716 void test(void) __attribute__((ifunc("resolve_test")));
3724 ac_have_ifunc_attr=yes
3725 AC_MSG_RESULT([yes])
3727 ac_have_ifunc_attr=no
3731 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
3733 # Does the C compiler support the armv8 crc feature flag
3734 # Note, this doesn't generate a C-level symbol. It generates a
3735 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
3736 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
3738 save_CFLAGS="$CFLAGS"
3739 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
3740 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3746 ac_have_armv8_crc_feature=yes
3747 AC_MSG_RESULT([yes])
3749 ac_have_armv8_crc_feature=no
3752 CFLAGS="$save_CFLAGS"
3754 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
3757 # Does the C compiler support the armv81 flag and the assembler v8.1 instructions
3758 # Note, this doesn't generate a C-level symbol. It generates a
3759 # automake-level symbol (BUILD_ARMV81_TESTS), used in test Makefile.am's
3760 AC_MSG_CHECKING([if gcc supports the armv81 feature flag and assembler supports v8.1 instructions])
3762 save_CFLAGS="$CFLAGS"
3763 CFLAGS="$CFLAGS -march=armv8.1-a -Werror"
3764 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3767 __asm__ __volatile__("ldadd x0, x1, [x2]" ::: "memory");
3771 ac_have_armv81_feature=yes
3772 AC_MSG_RESULT([yes])
3774 ac_have_armv81_feature=no
3777 CFLAGS="$save_CFLAGS"
3779 AM_CONDITIONAL(BUILD_ARMV81_TESTS, test x$ac_have_armv81_feature = xyes)
3782 # Does the C compiler support the armv82 flag and the assembler v8.2 instructions
3783 # Note, this doesn't generate a C-level symbol. It generates a
3784 # automake-level symbol (BUILD_ARMV82_TESTS), used in test Makefile.am's
3785 AC_MSG_CHECKING([if gcc supports the armv82 feature flag and assembler supports v8.2 instructions])
3787 save_CFLAGS="$CFLAGS"
3788 CFLAGS="$CFLAGS -march=armv8.2-a+fp16 -Werror"
3789 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3792 __asm__ __volatile__("faddp h0, v1.2h");
3796 ac_have_armv82_feature=yes
3797 AC_MSG_RESULT([yes])
3799 ac_have_armv82_feature=no
3802 CFLAGS="$save_CFLAGS"
3804 AM_CONDITIONAL(BUILD_ARMV82_TESTS, test x$ac_have_armv82_feature = xyes)
3807 # Does the C compiler support the armv82-a+dotprod flag and assembler dotprod instructions
3808 # Note, this doesn't generate a C-level symbol. It generates a
3809 # automake-level symbol (BUILD_ARMV82_DOTPROD_TESTS), used in test Makefile.am's
3810 AC_MSG_CHECKING([if gcc supports the armv82-a+dotprod feature flag and assembler supports dotprod instructions])
3812 save_CFLAGS="$CFLAGS"
3813 CFLAGS="$CFLAGS -march=armv8.2-a+dotprod -Werror"
3814 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3817 __asm__ __volatile__("sdot v1.4s, v2.16b, v3.16b");
3821 ac_have_armv82_dotprod_feature=yes
3822 AC_MSG_RESULT([yes])
3824 ac_have_armv82_dotprod_feature=no
3827 CFLAGS="$save_CFLAGS"
3829 AM_CONDITIONAL(BUILD_ARMV82_DOTPROD_TESTS, test x$ac_have_armv82_dotprod_feature = xyes)
3832 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
3833 # when building the tool executables. I think we should get rid of it.
3835 # Check for TLS support in the compiler and linker
3836 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3838 [vg_cv_linktime_tls=yes],
3839 [vg_cv_linktime_tls=no])
3840 # Native compilation: check whether running a program using TLS succeeds.
3841 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
3842 # succeeds but running programs using TLS fails.
3843 # Cross-compiling: check whether linking a program using TLS succeeds.
3844 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
3845 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
3846 [vg_cv_tls=$enableval],
3847 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3851 [vg_cv_tls=$vg_cv_linktime_tls])])])
3853 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
3854 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
3858 #----------------------------------------------------------------------------
3859 # Solaris-specific checks.
3860 #----------------------------------------------------------------------------
3862 if test "$VGCONF_OS" = "solaris" ; then
3863 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
3865 # Solaris-specific check determining if the Sun Studio Assembler is used to
3866 # build Valgrind. The test checks if the x86/amd64 assembler understands the
3867 # cmovl.l instruction, if yes then it's Sun Assembler.
3869 # C-level symbol: none
3870 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
3872 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
3873 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3875 __asm__ __volatile__("cmovl.l %edx, %eax");
3877 solaris_have_sun_studio_as=yes
3878 AC_MSG_RESULT([yes])
3880 solaris_have_sun_studio_as=no
3883 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
3885 # Solaris-specific check determining if symbols __xpg4 and __xpg6
3886 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
3887 # See solaris/vgpreload-solaris.mapfile for details.
3888 # gcc on older Solaris instructs linker to include these symbols,
3889 # gcc on illumos and newer Solaris does not.
3891 # C-level symbol: none
3892 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
3894 save_CFLAGS="$CFLAGS"
3895 CFLAGS="$CFLAGS -std=gnu99"
3896 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
3897 temp_dir=$( /usr/bin/mktemp -d )
3898 cat <<_ACEOF >${temp_dir}/mylib.c
3900 int myfunc(void) { printf("LaPutyka\n"); }
3902 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
3903 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
3904 if test "x${xpg_present}" = "x" ; then
3905 solaris_xpg_symbols_present=no
3908 solaris_xpg_symbols_present=yes
3909 AC_MSG_RESULT([yes])
3912 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
3913 CFLAGS="$save_CFLAGS"
3916 # Solaris-specific check determining if gcc enables largefile support by
3917 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
3918 # variable with gcc flags which disable it.
3920 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
3921 save_CFLAGS="$CFLAGS"
3922 CFLAGS="$CFLAGS -m32"
3923 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3924 return _LARGEFILE_SOURCE;
3926 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
3927 AC_MSG_RESULT([yes])
3929 SOLARIS_UNDEF_LARGESOURCE=""
3933 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
3936 # Solaris-specific check determining if /proc/self/cmdline
3937 # or /proc/<pid>/cmdline is supported.
3939 # C-level symbol: SOLARIS_PROC_CMDLINE
3940 # Automake-level symbol: SOLARIS_PROC_CMDLINE
3942 AC_CHECK_FILE([/proc/self/cmdline],
3944 solaris_proc_cmdline=yes
3945 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
3946 [Define to 1 if you have /proc/self/cmdline.])
3948 solaris_proc_cmdline=no
3950 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3953 # Solaris-specific check determining default platform for the Valgrind launcher.
3954 # Used in case the launcher cannot select platform by looking at the client
3955 # image (for example because the executable is a shell script).
3957 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3958 # Automake-level symbol: none
3960 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3961 # Get the ELF class of /bin/sh first.
3962 if ! test -f /bin/sh; then
3963 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3965 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3966 case "$elf_class" in
3968 default_arch="$VGCONF_ARCH_PRI";
3971 if test "x$VGCONF_ARCH_SEC" != "x"; then
3972 default_arch="$VGCONF_ARCH_SEC"
3974 default_arch="$VGCONF_ARCH_PRI";
3978 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3981 default_platform="$default_arch-$VGCONF_OS"
3982 AC_MSG_RESULT([$default_platform])
3983 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3984 [Default platform for Valgrind launcher.])
3987 # Solaris-specific check determining if the old syscalls are available.
3989 # C-level symbol: SOLARIS_OLD_SYSCALLS
3990 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3992 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3993 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3994 #include <sys/syscall.h>
3998 solaris_old_syscalls=yes
3999 AC_MSG_RESULT([yes])
4000 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
4001 [Define to 1 if you have the old Solaris syscalls.])
4003 solaris_old_syscalls=no
4006 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
4009 # Solaris-specific check determining if the new accept() syscall is available.
4012 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
4015 # New syscall (available on illumos):
4016 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
4017 # int version, int flags);
4019 # If the old syscall is present then the following syscall will fail with
4020 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
4021 # available then it will fail with EINVAL (because the flags parameter is
4024 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
4025 # Automake-level symbol: none
4027 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
4028 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4029 #include <sys/syscall.h>
4033 syscall(SYS_accept, 0, 0, 0, 0, -1);
4034 return !(errno == EINVAL);
4036 AC_MSG_RESULT([yes])
4037 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
4038 [Define to 1 if you have the new `accept' syscall.])
4044 # Solaris-specific check determining if the new illumos pipe() syscall is
4048 # longlong_t pipe();
4050 # New syscall (available on illumos):
4051 # int pipe(intptr_t arg, int flags);
4053 # If the old syscall is present then the following call will succeed, if the
4054 # new syscall is available then it will fail with EFAULT (because address 0
4055 # cannot be accessed).
4057 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
4058 # Automake-level symbol: none
4060 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
4061 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4062 #include <sys/syscall.h>
4066 syscall(SYS_pipe, 0, 0);
4067 return !(errno == EFAULT);
4069 AC_MSG_RESULT([yes])
4070 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
4071 [Define to 1 if you have the new `pipe' syscall.])
4077 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
4081 # int lwp_kill(id_t lwpid, int sig);
4083 # New syscall (available on Solaris 11):
4084 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
4085 # int si_code, timespec_t *timeout);
4087 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
4088 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
4090 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
4091 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4092 #include <sys/syscall.h>
4094 return !SYS_lwp_sigqueue;
4096 solaris_lwp_sigqueue_syscall=yes
4097 AC_MSG_RESULT([yes])
4098 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
4099 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
4101 solaris_lwp_sigqueue_syscall=no
4104 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
4107 # Solaris-specific check determining if the lwp_sigqueue() syscall
4108 # takes both pid and thread id arguments or just thread id.
4110 # Old syscall (available up to Solaris 11.3):
4111 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
4112 # int si_code, timespec_t *timeout);
4114 # New syscall (available since Solaris 11.4):
4115 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
4116 # int si_code, timespec_t *timeout);
4118 # If the old syscall is present then the following syscall will fail with
4119 # EINVAL (because signal is out of range); if the new syscall is available
4120 # then it will fail with ESRCH (because it would not find such thread in the
4123 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4124 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4126 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
4127 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
4128 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4129 #include <sys/syscall.h>
4133 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
4134 return !(errno == ESRCH);
4136 solaris_lwp_sigqueue_syscall_takes_pid=yes
4137 AC_MSG_RESULT([yes])
4138 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
4139 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
4141 solaris_lwp_sigqueue_syscall_takes_pid=no
4144 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
4145 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
4147 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
4151 # Solaris-specific check determining if the new lwp_name() syscall is
4154 # New syscall (available on Solaris 11):
4155 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
4157 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
4158 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
4160 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
4161 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4162 #include <sys/syscall.h>
4164 return !SYS_lwp_name;
4166 solaris_lwp_name_syscall=yes
4167 AC_MSG_RESULT([yes])
4168 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
4169 [Define to 1 if you have the new `lwp_name' syscall.])
4171 solaris_lwp_name_syscall=no
4174 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
4177 # Solaris-specific check determining if the new getrandom() syscall is
4180 # New syscall (available on Solaris 11):
4181 # int getrandom(void *buf, size_t buflen, uint_t flags);
4183 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
4184 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
4186 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
4187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4188 #include <sys/syscall.h>
4190 return !SYS_getrandom;
4192 solaris_getrandom_syscall=yes
4193 AC_MSG_RESULT([yes])
4194 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
4195 [Define to 1 if you have the new `getrandom' syscall.])
4197 solaris_getrandom_syscall=no
4200 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
4203 # Solaris-specific check determining if the new zone() syscall subcodes
4204 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
4205 # were added in Solaris 11 but are missing on illumos.
4207 # C-level symbol: SOLARIS_ZONE_DEFUNCT
4208 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
4210 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
4211 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4212 #include <sys/zone.h>
4214 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
4216 solaris_zone_defunct=yes
4217 AC_MSG_RESULT([yes])
4218 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
4219 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
4221 solaris_zone_defunct=no
4224 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
4227 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
4228 # for auditon(2) subcode of the auditsys() syscall are available.
4229 # These commands are available in Solaris 11 and illumos but were removed
4232 # C-level symbol: SOLARIS_AUDITON_STAT
4233 # Automake-level symbol: SOLARIS_AUDITON_STAT
4235 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
4236 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4237 #include <bsm/audit.h>
4239 return !(A_GETSTAT && A_SETSTAT);
4241 solaris_auditon_stat=yes
4242 AC_MSG_RESULT([yes])
4243 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
4244 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
4246 solaris_auditon_stat=no
4249 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
4252 # Solaris-specific check determining if the new shmsys() syscall subcodes
4253 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
4254 # These subcodes were added in Solaris 11 but are missing on illumos.
4256 # C-level symbol: SOLARIS_SHM_NEW
4257 # Automake-level symbol: SOLARIS_SHM_NEW
4259 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
4260 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4261 #include <sys/ipc_impl.h>
4262 #include <sys/shm.h>
4263 #include <sys/shm_impl.h>
4265 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
4268 AC_MSG_RESULT([yes])
4269 AC_DEFINE([SOLARIS_SHM_NEW], 1,
4270 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
4275 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
4278 # Solaris-specific check determining if prxregset_t is available. Illumos
4279 # currently does not define it on the x86 platform.
4281 # C-level symbol: SOLARIS_PRXREGSET_T
4282 # Automake-level symbol: SOLARIS_PRXREGSET_T
4284 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
4285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4286 #include <sys/procfs_isa.h>
4288 return !sizeof(prxregset_t);
4290 solaris_prxregset_t=yes
4291 AC_MSG_RESULT([yes])
4292 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
4293 [Define to 1 if you have the `prxregset_t' type.])
4295 solaris_prxregset_t=no
4298 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
4301 # Solaris-specific check determining if the new frealpathat() syscall is
4304 # New syscall (available on Solaris 11.1):
4305 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
4307 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4308 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4310 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
4311 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4312 #include <sys/syscall.h>
4314 return !SYS_frealpathat;
4316 solaris_frealpathat_syscall=yes
4317 AC_MSG_RESULT([yes])
4318 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
4319 [Define to 1 if you have the new `frealpathat' syscall.])
4321 solaris_frealpathat_syscall=no
4324 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
4327 # Solaris-specific check determining if the new uuidsys() syscall is
4330 # New syscall (available on newer Solaris):
4331 # int uuidsys(struct uuid *uuid);
4333 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
4334 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
4336 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
4337 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4338 #include <sys/syscall.h>
4340 return !SYS_uuidsys;
4342 solaris_uuidsys_syscall=yes
4343 AC_MSG_RESULT([yes])
4344 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
4345 [Define to 1 if you have the new `uuidsys' syscall.])
4347 solaris_uuidsys_syscall=no
4350 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
4353 # Solaris-specific check determining if the new labelsys() syscall subcode
4354 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
4355 # missing on illumos.
4357 # C-level symbol: SOLARIS_TNDB_GET_TNIP
4358 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
4360 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
4361 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4362 #include <sys/tsol/tndb.h>
4364 return !TNDB_GET_TNIP;
4366 solaris_tndb_get_tnip=yes
4367 AC_MSG_RESULT([yes])
4368 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
4369 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
4371 solaris_tndb_get_tnip=no
4374 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
4377 # Solaris-specific check determining if the new labelsys() syscall opcodes
4378 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
4379 # added in Solaris 11 but are missing on illumos.
4381 # C-level symbol: SOLARIS_TSOL_CLEARANCE
4382 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
4384 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
4385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4386 #include <sys/tsol/tsyscall.h>
4388 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
4390 solaris_tsol_clearance=yes
4391 AC_MSG_RESULT([yes])
4392 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
4393 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
4395 solaris_tsol_clearance=no
4398 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
4401 # Solaris-specific check determining if the new pset() syscall subcode
4402 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
4403 # is missing on illumos and Solaris 11.3.
4405 # C-level symbol: SOLARIS_PSET_GET_NAME
4406 # Automake-level symbol: SOLARIS_PSET_GET_NAME
4408 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
4409 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4410 #include <sys/pset.h>
4412 return !(PSET_GET_NAME);
4414 solaris_pset_get_name=yes
4415 AC_MSG_RESULT([yes])
4416 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
4417 [Define to 1 if you have the `PSET_GET_NAME' constants.])
4419 solaris_pset_get_name=no
4422 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
4425 # Solaris-specific check determining if the utimesys() syscall is
4426 # available (on illumos and older Solaris).
4428 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
4429 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
4431 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
4432 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4433 #include <sys/syscall.h>
4435 return !SYS_utimesys;
4437 solaris_utimesys_syscall=yes
4438 AC_MSG_RESULT([yes])
4439 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
4440 [Define to 1 if you have the `utimesys' syscall.])
4442 solaris_utimesys_syscall=no
4445 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
4448 # Solaris-specific check determining if the utimensat() syscall is
4449 # available (on newer Solaris).
4451 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4452 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4454 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
4455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4456 #include <sys/syscall.h>
4458 return !SYS_utimensat;
4460 solaris_utimensat_syscall=yes
4461 AC_MSG_RESULT([yes])
4462 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
4463 [Define to 1 if you have the `utimensat' syscall.])
4465 solaris_utimensat_syscall=no
4468 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
4471 # Solaris-specific check determining if the spawn() syscall is available
4472 # (on newer Solaris).
4474 # C-level symbol: SOLARIS_SPAWN_SYSCALL
4475 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
4477 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
4478 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4479 #include <sys/syscall.h>
4483 solaris_spawn_syscall=yes
4484 AC_MSG_RESULT([yes])
4485 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
4486 [Define to 1 if you have the `spawn' syscall.])
4488 solaris_spawn_syscall=no
4491 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
4494 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
4495 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
4497 # C-level symbol: SOLARIS_MODCTL_MODNVL
4498 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
4500 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
4501 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4502 #include <sys/modctl.h>
4504 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
4506 solaris_modctl_modnvl=yes
4507 AC_MSG_RESULT([yes])
4508 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
4509 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
4511 solaris_modctl_modnvl=no
4514 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
4517 # Solaris-specific check determining whether nscd (name switch cache daemon)
4518 # attaches its door at /system/volatile/name_service_door (Solaris)
4519 # or at /var/run/name_service_door (illumos).
4521 # Note that /var/run is a symlink to /system/volatile on Solaris
4522 # but not vice versa on illumos.
4524 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4525 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4527 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
4528 if test -e /system/volatile/name_service_door; then
4529 solaris_nscd_door_system_volatile=yes
4530 AC_MSG_RESULT([/system/volatile/name_service_door])
4531 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
4532 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
4534 solaris_nscd_door_system_volatile=no
4535 AC_MSG_RESULT([/var/run/name_service_door])
4537 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
4540 # Solaris-specific check determining if the new gethrt() fasttrap is available.
4542 # New fasttrap (available on Solaris 11):
4543 # hrt_t *gethrt(void);
4545 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
4546 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
4548 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
4549 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4550 #include <sys/trap.h>
4554 solaris_gethrt_fasttrap=yes
4555 AC_MSG_RESULT([yes])
4556 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
4557 [Define to 1 if you have the new `gethrt' fasttrap.])
4559 solaris_gethrt_fasttrap=no
4562 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
4565 # Solaris-specific check determining if the new get_zone_offset() fasttrap
4568 # New fasttrap (available on Solaris 11):
4569 # zonehrtoffset_t *get_zone_offset(void);
4571 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4572 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4574 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
4575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4576 #include <sys/trap.h>
4578 return !T_GETZONEOFFSET;
4580 solaris_getzoneoffset_fasttrap=yes
4581 AC_MSG_RESULT([yes])
4582 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
4583 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
4585 solaris_getzoneoffset_fasttrap=no
4588 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
4591 # Solaris-specific check determining if the execve() syscall
4592 # takes fourth argument (flags) or not.
4594 # Old syscall (available on illumos):
4595 # int execve(const char *fname, const char **argv, const char **envp);
4597 # New syscall (available on Solaris):
4598 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
4600 # If the new syscall is present then it will fail with EINVAL (because flags
4601 # are invalid); if the old syscall is available then it will fail with ENOENT
4602 # (because the file could not be found).
4604 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4605 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4607 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
4608 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4609 #include <sys/syscall.h>
4613 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
4614 return !(errno == EINVAL);
4616 solaris_execve_syscall_takes_flags=yes
4617 AC_MSG_RESULT([yes])
4618 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
4619 [Define to 1 if you have the new `execve' syscall which accepts flags.])
4621 solaris_execve_syscall_takes_flags=no
4624 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
4625 test x$solaris_execve_syscall_takes_flags = xyes)
4628 # Solaris-specific check determining version of the repository cache protocol.
4629 # Every Solaris version uses a different one, ranging from 21 to current 25.
4630 # The check is very ugly, though.
4632 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
4633 # Automake-level symbol: none
4635 AC_PATH_PROG(DIS_PATH, dis, false)
4636 if test "x$DIS_PATH" = "xfalse"; then
4637 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
4639 # The illumos source is (or was) here
4640 # https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libscf/common/lowlevel.c#L1148
4641 # specifically the line
4643 # request.rdr_version = REPOSITORY_DOOR_VERSION;
4645 # rdr_version is a 32bit unsigned int
4646 # The macro REPOSITORY_DOOR_VERSION contains the ascii letters "Rep" in the top 3
4647 # bytes and the door version in the lowest byte. Hence we look for Rep which is 526570
4648 # in hex and then extrace the following byte.
4649 AC_CHECK_LIB(scf, scf_handle_bind, [], [
4650 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
4651 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4654 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
4655 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
4656 libscf=/usr/lib/64/libscf.so.1
4658 libscf=/usr/lib/libscf.so.1
4660 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q -E '0x(4d01)?526570'; then
4661 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
4662 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4664 hex=$( $DIS_PATH -F scf_handle_bind $libscf | grep 526570 | sed 's/.*526570//;s/,.*//' )
4665 if test -z "$hex"; then
4666 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
4667 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4669 version=$( printf "%d\n" 0x$hex )
4670 AC_MSG_RESULT([$version])
4671 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
4672 [Version number of the repository door cache protocol.])
4675 # Solaris-specific check determining if "sysstat" segment reservation type
4678 # New "sysstat" segment reservation (available on Solaris 11.4):
4679 # - program header type: PT_SUNW_SYSSTAT
4680 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
4682 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4683 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4685 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
4686 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4687 #include <sys/auxv.h>
4689 return !AT_SUN_SYSSTAT_ADDR;
4691 solaris_reserve_sysstat_addr=yes
4692 AC_MSG_RESULT([yes])
4693 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
4694 [Define to 1 if you have the new `sysstat' segment reservation.])
4696 solaris_reserve_sysstat_addr=no
4699 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
4702 # Solaris-specific check determining if "sysstat_zone" segment reservation type
4705 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
4706 # - program header type: PT_SUNW_SYSSTAT_ZONE
4707 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
4709 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4710 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4712 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
4713 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4714 #include <sys/auxv.h>
4716 return !AT_SUN_SYSSTAT_ZONE_ADDR;
4718 solaris_reserve_sysstat_zone_addr=yes
4719 AC_MSG_RESULT([yes])
4720 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
4721 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
4723 solaris_reserve_sysstat_zone_addr=no
4726 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
4729 # Solaris-specific check determining if the system_stats() syscall is available
4730 # (on newer Solaris).
4732 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4733 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4735 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
4736 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4737 #include <sys/syscall.h>
4739 return !SYS_system_stats;
4741 solaris_system_stats_syscall=yes
4742 AC_MSG_RESULT([yes])
4743 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
4744 [Define to 1 if you have the `system_stats' syscall.])
4746 solaris_system_stats_syscall=no
4749 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
4752 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
4753 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
4755 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
4756 # Automake-level symbol: none
4758 AC_CHECK_TYPE([struct _fpchip_state],
4759 [solaris_fpchip_state_takes_underscore=yes],
4760 [solaris_fpchip_state_takes_underscore=no],
4761 [[#include <sys/regset.h>]])
4762 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
4763 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
4764 [Define to 1 if fpregset_t defines struct _fpchip_state])
4768 # Solaris-specific check determining if schedctl page shared between kernel
4769 # and userspace program is executable (illumos, older Solaris) or not (newer
4772 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
4773 # Automake-level symbol: none
4775 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
4776 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4780 #include <schedctl.h>
4784 schedctl_t *scp = schedctl_init();
4788 int fd = open("/proc/self/map", O_RDONLY);
4793 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
4794 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
4795 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
4796 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
4797 return (map.pr_mflags & MA_EXEC);
4803 solaris_schedctl_page_exec=no
4806 solaris_schedctl_page_exec=yes
4807 AC_MSG_RESULT([yes])
4808 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
4809 [Define to 1 if you have the schedctl page executable.])
4813 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
4814 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
4815 # an initial thread pointer for libc (newer Solaris).
4817 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
4818 # Automake-level symbol: none
4820 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
4821 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4822 #include <sys/fasttrap_isa.h>
4824 return !FT_SCRATCHSIZE;
4826 solaris_pt_sunwdtrace_thrp=yes
4827 AC_MSG_RESULT([yes])
4828 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
4829 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
4831 solaris_pt_sunwdtrace_thrp=no
4836 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
4837 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
4838 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
4839 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
4840 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
4841 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
4842 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
4843 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
4844 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
4845 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
4846 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
4847 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
4848 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
4849 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
4850 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
4851 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
4852 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
4853 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
4854 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
4855 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
4856 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
4857 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
4858 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
4859 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
4860 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
4861 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
4862 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
4863 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
4864 fi # test "$VGCONF_OS" = "solaris"
4866 #----------------------------------------------------------------------------
4867 # FreeBSD-specific checks.
4868 #----------------------------------------------------------------------------
4870 # Rather than having a large number of feature test as above with Solaris
4871 # these tests are per-version. This may not be entirely reliable for
4872 # FreeBSD development branches (XX.Y-CURRENT) or pre-release branches
4873 # (XX.Y-STABLE) but it should work for XX-Y-RELEASE
4875 if test "$VGCONF_OS" = "freebsd" ; then
4877 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13_0)
4878 AM_CONDITIONAL(FREEBSD_VERS_15_PLUS, test $freebsd_vers -ge $freebsd_15)
4882 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, false)
4883 AM_CONDITIONAL(FREEBSD_VERS_15_PLUS, false)
4885 fi # test "$VGCONF_OS" = "freebsd"
4888 #----------------------------------------------------------------------------
4889 # Checks for C header files.
4890 #----------------------------------------------------------------------------
4892 AC_CHECK_HEADERS([ \
4910 # Verify whether the <linux/futex.h> header is usable.
4911 AC_MSG_CHECKING([if <linux/futex.h> is usable])
4913 save_CFLAGS="$CFLAGS"
4914 CFLAGS="$CFLAGS -D__user="
4915 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4916 #include <linux/futex.h>
4920 ac_have_usable_linux_futex_h=yes
4921 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
4922 [Define to 1 if you have a usable <linux/futex.h> header file.])
4923 AC_MSG_RESULT([yes])
4925 ac_have_usable_linux_futex_h=no
4928 CFLAGS="$save_CFLAGS"
4931 #----------------------------------------------------------------------------
4932 # Checks for typedefs, structures, and compiler characteristics.
4933 #----------------------------------------------------------------------------
4937 AC_CHECK_HEADERS_ONCE([sys/time.h])
4939 AC_CHECK_TYPE([struct statx], [
4940 AC_DEFINE([HAVE_STRUCT_STATX_IN_SYS_STAT_H], 1,
4941 [Define to 1 if <sys/stat.h> declares struct statx.])
4944 #include <sys/stat.h>
4948 #----------------------------------------------------------------------------
4949 # Checks for library functions.
4950 #----------------------------------------------------------------------------
4954 AC_CHECK_LIB([pthread], [pthread_create])
4955 AC_CHECK_LIB([rt], [clock_gettime])
4977 pthread_barrier_init \
4978 pthread_condattr_setclock \
4979 pthread_mutex_timedlock \
4980 pthread_rwlock_timedrdlock \
4981 pthread_rwlock_timedwrlock \
4982 pthread_setname_np \
5011 free_aligned_sized \
5019 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
5020 # libraries with any shared object and/or executable. This is NOT what we
5021 # want for e.g. vgpreload_core-x86-linux.so
5024 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
5025 [test x$ac_cv_func_pthread_barrier_init = xyes])
5026 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
5027 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
5028 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
5029 [test x$ac_cv_func_pthread_spin_lock = xyes])
5030 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
5031 [test x$ac_cv_func_pthread_setname_np = xyes])
5032 AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
5033 [test x$ac_cv_func_copy_file_range = xyes])
5034 AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
5035 [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
5036 AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
5037 [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes])
5038 AM_CONDITIONAL([HAVE_SETCONTEXT], [test x$ac_cv_func_setcontext = xyes])
5039 AM_CONDITIONAL([HAVE_SWAPCONTEXT], [test x$ac_cv_func_swapcontext = xyes])
5040 AM_CONDITIONAL([HAVE_MEMFD_CREATE],
5041 [test x$ac_cv_func_memfd_create = xyes])
5042 AM_CONDITIONAL([HAVE_GETADDRINFO],
5043 [test x$ac_cv_func_getaddrinfo = xyes])
5044 AM_CONDITIONAL([HAVE_CLOSE_RANGE],
5045 [test x$ac_cv_func_close_range = xyes])
5046 AM_CONDITIONAL([HAVE_REALLOCARRAY],
5047 [test x$ac_cv_func_reallocarray = xyes])
5048 AM_CONDITIONAL([HAVE_WCSNCPY],
5049 [test x$ac_cv_func_wcsncpy = xyes])
5050 AM_CONDITIONAL([HAVE_STRLCAT],
5051 [test x$ac_cv_func_strlcat = xyes])
5052 AM_CONDITIONAL([HAVE_STRLCPY],
5053 [test x$ac_cv_func_strlcpy = xyes])
5054 AM_CONDITIONAL([HAVE_FREE_ALIGNED_SIZED],
5055 [test x$ac_cv_func_free_aligned_sized = xyes])
5056 AM_CONDITIONAL([HAVE_SBRK],
5057 [test x$ac_cv_func_sbrk = xyes])
5058 AM_CONDITIONAL([HAVE_WCPNCPY],
5059 [test x$ac_cv_func_wcpncpy = xyes])
5060 AM_CONDITIONAL([HAVE_WCSXFRM],
5061 [test x$ac_cv_func_wcsxfrm = xyes])
5062 AM_CONDITIONAL([HAVE_SEM_TIMEDWAIT],
5063 [test x$ac_cv_func_sem_timedwait = xyes])
5064 AM_CONDITIONAL([HAVE_SEM_CLOCKWAIT_NP],
5065 [test x$ac_cv_func_sem_clockwait_np = xyes])
5067 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5068 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5069 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX; then
5070 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
5071 [Disable intercept pthread_spin_lock() on MIPS32, MIPS64 and nanoMIPS.])
5074 #----------------------------------------------------------------------------
5076 #----------------------------------------------------------------------------
5077 # Do we have a useable MPI setup on the primary and/or secondary targets?
5078 # On Linux, by default, assumes mpicc and -m32/-m64
5079 # Note: this is a kludge in that it assumes the specified mpicc
5080 # understands -m32/-m64 regardless of what is specified using
5082 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
5083 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
5086 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
5087 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
5088 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
5089 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
5090 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5091 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX \
5092 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
5093 mflag_primary=$FLAG_M32
5094 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
5095 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
5096 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
5097 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
5098 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD \
5099 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5100 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
5101 mflag_primary=$FLAG_M64
5102 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
5103 mflag_primary="$FLAG_M32 -arch i386"
5104 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
5105 mflag_primary="$FLAG_M64 -arch x86_64"
5109 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
5110 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
5111 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
5112 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX \
5113 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD ; then
5114 mflag_secondary=$FLAG_M32
5115 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
5116 mflag_secondary="$FLAG_M32 -arch i386"
5121 [ --with-mpicc= Specify name of MPI2-ised C compiler],
5126 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
5127 ## use these values in the check for a functioning mpicc.
5129 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
5130 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
5131 AM_COND_IF([VGCONF_OS_IS_LINUX],
5132 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5133 LDFLAGS_MPI="-fpic -shared"])
5134 AM_COND_IF([VGCONF_OS_IS_FREEBSD],
5135 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5136 LDFLAGS_MPI="-fpic -shared"])
5137 AM_COND_IF([VGCONF_OS_IS_DARWIN],
5138 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
5139 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
5140 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
5141 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5142 LDFLAGS_MPI="-fpic -shared"])
5144 AC_SUBST([CFLAGS_MPI])
5145 AC_SUBST([LDFLAGS_MPI])
5148 ## See if MPI_CC works for the primary target
5150 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
5152 saved_CFLAGS=$CFLAGS
5154 CFLAGS="$CFLAGS_MPI $mflag_primary"
5155 saved_LDFLAGS="$LDFLAGS"
5156 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
5157 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5161 int ni, na, nd, comb;
5162 int r = MPI_Init(NULL,NULL);
5163 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5164 r |= MPI_Finalize();
5167 ac_have_mpi2_pri=yes
5168 AC_MSG_RESULT([yes, $MPI_CC])
5174 CFLAGS=$saved_CFLAGS
5175 LDFLAGS="$saved_LDFLAGS"
5176 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
5178 ## See if MPI_CC works for the secondary target. Complication: what if
5179 ## there is no secondary target? We need this to then fail.
5180 ## Kludge this by making MPI_CC something which will surely fail in
5183 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
5185 saved_CFLAGS=$CFLAGS
5186 saved_LDFLAGS="$LDFLAGS"
5187 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
5188 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
5189 CC="$MPI_CC this will surely fail"
5193 CFLAGS="$CFLAGS_MPI $mflag_secondary"
5194 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5198 int ni, na, nd, comb;
5199 int r = MPI_Init(NULL,NULL);
5200 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5201 r |= MPI_Finalize();
5204 ac_have_mpi2_sec=yes
5205 AC_MSG_RESULT([yes, $MPI_CC])
5211 CFLAGS=$saved_CFLAGS
5212 LDFLAGS="$saved_LDFLAGS"
5213 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
5215 #----------------------------------------------------------------------------
5217 #----------------------------------------------------------------------------
5218 AC_MSG_CHECKING([if static libc is available])
5220 saved_LDFLAGS="$LDFLAGS"
5221 LDFLAGS="-nostdlib -lc -static"
5222 AC_LINK_IFELSE([AC_LANG_SOURCE([[
5227 ac_have_static_libc=yes
5228 AC_MSG_RESULT([yes])
5230 ac_have_static_libc=no
5233 LDFLAGS="$saved_LDFLAGS"
5234 AM_CONDITIONAL(HAVE_STATIC_LIBC, test x$ac_have_static_libc = xyes)
5237 #----------------------------------------------------------------------------
5238 # Other library checks
5239 #----------------------------------------------------------------------------
5240 # There now follow some tests for Boost, and OpenMP. These
5241 # tests are present because Drd has some regression tests that use
5242 # these packages. All regression test programs all compiled only
5243 # for the primary target. And so it is important that the configure
5244 # checks that follow, use the correct -m32 or -m64 flag for the
5245 # primary target (called $mflag_primary). Otherwise, we can end up
5246 # in a situation (eg) where, on amd64-linux, the test for Boost checks
5247 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
5248 # only build (meaning, the primary target is x86-linux), the build
5249 # of the regtest programs that use Boost fails, because they are
5250 # build as 32-bit (IN THIS EXAMPLE).
5252 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
5253 # NEEDED BY THE REGRESSION TEST PROGRAMS.
5256 # Check whether the boost library 1.35 or later has been installed.
5257 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
5259 AC_MSG_CHECKING([for boost])
5262 safe_CXXFLAGS=$CXXFLAGS
5263 CXXFLAGS="$mflag_primary"
5265 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
5267 AC_LINK_IFELSE([AC_LANG_SOURCE([
5268 #include <boost/thread.hpp>
5269 static void thread_func(void)
5271 int main(int argc, char** argv)
5273 boost::thread t(thread_func);
5278 ac_have_boost_1_35=yes
5279 AC_SUBST([BOOST_CFLAGS], [])
5280 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
5281 AC_MSG_RESULT([yes])
5283 ac_have_boost_1_35=no
5288 CXXFLAGS=$safe_CXXFLAGS
5291 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
5294 # does this compiler support -fopenmp, does it have the include file
5295 # <omp.h> and does it have libgomp ?
5297 AC_MSG_CHECKING([for OpenMP])
5300 CFLAGS="-fopenmp $mflag_primary -Werror"
5302 AC_LINK_IFELSE([AC_LANG_SOURCE([
5304 int main(int argc, char** argv)
5312 AC_MSG_RESULT([yes])
5319 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
5322 # Check for __builtin_popcount
5323 AC_MSG_CHECKING([for __builtin_popcount()])
5324 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5326 __builtin_popcount(2);
5329 AC_MSG_RESULT([yes])
5330 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
5331 [Define to 1 if compiler provides __builtin_popcount().])
5336 # Check for __builtin_clz
5337 AC_MSG_CHECKING([for __builtin_clz()])
5338 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5343 AC_MSG_RESULT([yes])
5344 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
5345 [Define to 1 if compiler provides __builtin_clz().])
5350 # Check for __builtin_ctz
5351 AC_MSG_CHECKING([for __builtin_ctz()])
5352 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5357 AC_MSG_RESULT([yes])
5358 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
5359 [Define to 1 if compiler provides __builtin_ctz().])
5364 # does this compiler have built-in functions for atomic memory access for the
5366 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
5369 CFLAGS="$mflag_primary"
5371 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5373 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5374 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5376 ac_have_builtin_atomic_primary=yes
5377 AC_MSG_RESULT([yes])
5378 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])
5380 ac_have_builtin_atomic_primary=no
5386 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
5387 [test x$ac_have_builtin_atomic_primary = xyes])
5390 # does this compiler have built-in functions for atomic memory access for the
5391 # secondary target ?
5393 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5395 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
5398 CFLAGS="$mflag_secondary"
5400 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5402 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
5404 ac_have_builtin_atomic_secondary=yes
5405 AC_MSG_RESULT([yes])
5407 ac_have_builtin_atomic_secondary=no
5415 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
5416 [test x$ac_have_builtin_atomic_secondary = xyes])
5418 # does this compiler have built-in functions for atomic memory access on
5419 # 64-bit integers for all targets ?
5421 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
5423 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5426 uint64_t variable = 1;
5427 return __sync_add_and_fetch(&variable, 1)
5429 ac_have_builtin_atomic64_primary=yes
5431 ac_have_builtin_atomic64_primary=no
5434 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5437 CFLAGS="$mflag_secondary"
5439 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5442 uint64_t variable = 1;
5443 return __sync_add_and_fetch(&variable, 1)
5445 ac_have_builtin_atomic64_secondary=yes
5447 ac_have_builtin_atomic64_secondary=no
5454 if test x$ac_have_builtin_atomic64_primary = xyes && \
5455 test x$VGCONF_PLATFORM_SEC_CAPS = x \
5456 -o x$ac_have_builtin_atomic64_secondary = xyes; then
5457 AC_MSG_RESULT([yes])
5458 ac_have_builtin_atomic64=yes
5461 ac_have_builtin_atomic64=no
5464 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
5465 [test x$ac_have_builtin_atomic64 = xyes])
5468 AC_MSG_CHECKING([if platform has openat2 syscall])
5470 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5471 #include <sys/syscall.h>
5476 AC_MSG_RESULT([yes])
5482 AM_CONDITIONAL([HAVE_OPENAT2],
5483 [test x$ac_have_openat2 = xyes])
5489 AC_MSG_CHECKING([if platform has openssl crypto])
5491 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5492 #include <openssl/crypto.h>
5494 CRYPTO_secure_malloc_init(1<<20, 8);
5497 AC_MSG_RESULT([yes])
5504 AM_CONDITIONAL([HAVE_OPENSSL],
5505 [test x$ac_have_openssl = xyes])
5507 AC_MSG_CHECKING([if platform has aio_readv])
5509 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5515 ac_have_aio_readv=yes
5516 AC_MSG_RESULT([yes])
5519 ac_have_aio_readv=no
5523 AM_CONDITIONAL([HAVE_AIO_READV],
5524 [test x$ac_have_aio_readv = xyes])
5526 # does g++ have built-in functions for atomic memory access ?
5527 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
5529 safe_CXXFLAGS=$CXXFLAGS
5530 CXXFLAGS="$mflag_primary"
5533 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5535 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5536 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5538 ac_have_builtin_atomic_cxx=yes
5539 AC_MSG_RESULT([yes])
5540 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
5542 ac_have_builtin_atomic_cxx=no
5547 CXXFLAGS=$safe_CXXFLAGS
5549 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
5552 if test x$ac_have_usable_linux_futex_h = xyes \
5553 -a x$ac_have_builtin_atomic_primary = xyes; then
5554 ac_enable_linux_ticket_lock_primary=yes
5556 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
5557 [test x$ac_enable_linux_ticket_lock_primary = xyes])
5559 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
5560 -a x$ac_have_usable_linux_futex_h = xyes \
5561 -a x$ac_have_builtin_atomic_secondary = xyes; then
5562 ac_enable_linux_ticket_lock_secondary=yes
5564 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
5565 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
5568 # does libstdc++ support annotating shared pointers ?
5569 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
5571 safe_CXXFLAGS=$CXXFLAGS
5572 CXXFLAGS="-std=c++0x"
5575 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5578 std::shared_ptr<int> p
5580 ac_have_shared_ptr=yes
5582 ac_have_shared_ptr=no
5584 if test x$ac_have_shared_ptr = xyes; then
5585 # If compilation of the program below fails because of a syntax error
5586 # triggered by substituting one of the annotation macros then that
5587 # means that libstdc++ supports these macros.
5588 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5589 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
5590 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
5593 std::shared_ptr<int> p
5595 ac_have_shared_pointer_annotation=no
5598 ac_have_shared_pointer_annotation=yes
5599 AC_MSG_RESULT([yes])
5600 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
5601 [Define to 1 if libstd++ supports annotating shared pointers])
5604 ac_have_shared_pointer_annotation=no
5609 CXXFLAGS=$safe_CXXFLAGS
5611 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
5612 [test x$ac_have_shared_pointer_annotation = xyes])
5614 # checking for GNU libc C17 aligned_alloc
5615 # just check glibc version rather than trying to muck around
5616 # checking the runtime behaviour or seeing if it is a weak alias
5617 AC_MSG_CHECKING([for AT_GNU_LIBC_C17_ALIGNED_ALLOC])
5618 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5619 #include <features.h>
5621 #if !defined(__GLIBC__) || __GLIBC__ != 2 || !defined(__GLIBC_MINOR__) || __GLIBC_MINOR__ < 38
5622 #error "not GNU libc 2.38 or later"
5625 AC_MSG_RESULT([yes])
5626 AC_DEFINE([HAVE_GNU_LIBC_C17_ALIGNED_ALLOC], 1,
5627 [Define to 1 if you have GNU libc C17 aligned_alloc.])
5633 # Check for C11 thrd_create()
5634 AC_MSG_CHECKING([for thrd_create()])
5635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
5636 #include <threads.h>
5637 int thrd_entry(void *arg) { return 0; }
5638 ], [[thrd_t thr; return thrd_create(&thr, thrd_entry, NULL);]])],
5640 ac_cxx_have_thrd_create=yes
5641 AC_MSG_RESULT([yes])
5643 ac_cxx_have_thrd_create=no
5647 AM_CONDITIONAL(HAVE_THRD_CREATE, test x$ac_cxx_have_thrd_create = xyes)
5652 CFLAGS="${CFLAGS} -march=armv8.2-a+sha3"
5653 AC_MSG_CHECKING([for sha3])
5654 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
5659 AC_MSG_RESULT([yes])
5665 AM_CONDITIONAL(HAVE_SHA3, test x$ac_have_sha3 = xyes)
5668 #----------------------------------------------------------------------------
5669 # Ok. We're done checking.
5670 #----------------------------------------------------------------------------
5672 # Nb: VEX/Makefile is generated from Makefile.vex.in.
5675 VEX/Makefile:Makefile.vex.in
5679 glibc-2.X-helgrind.supp
5683 docs/xml/vg-entities.xml
5688 gdbserver_tests/Makefile
5689 gdbserver_tests/solaris/Makefile
5695 memcheck/tests/Makefile
5696 memcheck/tests/common/Makefile
5697 memcheck/tests/amd64/Makefile
5698 memcheck/tests/arm64/Makefile
5699 memcheck/tests/x86/Makefile
5700 memcheck/tests/linux/Makefile
5701 memcheck/tests/linux/debuginfod-check.vgtest
5702 memcheck/tests/darwin/Makefile
5703 memcheck/tests/solaris/Makefile
5704 memcheck/tests/freebsd/Makefile
5705 memcheck/tests/amd64-linux/Makefile
5706 memcheck/tests/arm64-linux/Makefile
5707 memcheck/tests/x86-linux/Makefile
5708 memcheck/tests/amd64-solaris/Makefile
5709 memcheck/tests/x86-solaris/Makefile
5710 memcheck/tests/amd64-freebsd/Makefile
5711 memcheck/tests/x86-freebsd/Makefile
5712 memcheck/tests/ppc32/Makefile
5713 memcheck/tests/ppc64/Makefile
5714 memcheck/tests/s390x/Makefile
5715 memcheck/tests/mips32/Makefile
5716 memcheck/tests/mips64/Makefile
5717 memcheck/tests/vbit-test/Makefile
5719 cachegrind/tests/Makefile
5720 cachegrind/tests/x86/Makefile
5721 cachegrind/cg_annotate
5725 callgrind/callgrind_annotate
5726 callgrind/callgrind_control
5727 callgrind/tests/Makefile
5729 helgrind/tests/Makefile
5731 drd/scripts/download-and-build-splash2
5734 massif/tests/Makefile
5739 lackey/tests/Makefile
5742 none/tests/scripts/Makefile
5743 none/tests/amd64/Makefile
5744 none/tests/ppc32/Makefile
5745 none/tests/ppc64/Makefile
5746 none/tests/x86/Makefile
5747 none/tests/arm/Makefile
5748 none/tests/arm64/Makefile
5749 none/tests/s390x/Makefile
5750 none/tests/mips32/Makefile
5751 none/tests/mips64/Makefile
5752 none/tests/nanomips/Makefile
5753 none/tests/linux/Makefile
5754 none/tests/darwin/Makefile
5755 none/tests/solaris/Makefile
5756 none/tests/freebsd/Makefile
5757 none/tests/amd64-linux/Makefile
5758 none/tests/x86-linux/Makefile
5759 none/tests/amd64-darwin/Makefile
5760 none/tests/x86-darwin/Makefile
5761 none/tests/amd64-solaris/Makefile
5762 none/tests/x86-solaris/Makefile
5763 none/tests/x86-freebsd/Makefile
5765 exp-bbv/tests/Makefile
5766 exp-bbv/tests/x86/Makefile
5767 exp-bbv/tests/x86-linux/Makefile
5768 exp-bbv/tests/amd64-linux/Makefile
5769 exp-bbv/tests/ppc32-linux/Makefile
5770 exp-bbv/tests/arm-linux/Makefile
5774 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
5775 [chmod +x coregrind/link_tool_exe_linux])
5776 AC_CONFIG_FILES([coregrind/link_tool_exe_freebsd],
5777 [chmod +x coregrind/link_tool_exe_freebsd])
5778 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
5779 [chmod +x coregrind/link_tool_exe_darwin])
5780 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
5781 [chmod +x coregrind/link_tool_exe_solaris])
5782 AC_CONFIG_FILES([tests/filter_stderr_basic],
5783 [chmod +x tests/filter_stderr_basic])
5784 AC_CONFIG_FILES([tests/filter_discards],
5785 [chmod +x tests/filter_discards])
5786 AC_CONFIG_FILES([memcheck/tests/filter_stderr],
5787 [chmod +x memcheck/tests/filter_stderr])
5788 AC_CONFIG_FILES([memcheck/tests/filter_dw4],
5789 [chmod +x memcheck/tests/filter_dw4])
5790 AC_CONFIG_FILES([memcheck/tests/filter_overlaperror],
5791 [chmod +x memcheck/tests/filter_overlaperror])
5792 AC_CONFIG_FILES([memcheck/tests/filter_supp],
5793 [chmod +x memcheck/tests/filter_supp])
5794 AC_CONFIG_FILES([memcheck/tests/x86/filter_pushfpopf],
5795 [chmod +x memcheck/tests/x86/filter_pushfpopf])
5796 AC_CONFIG_FILES([gdbserver_tests/filter_gdb],
5797 [chmod +x gdbserver_tests/filter_gdb])
5798 AC_CONFIG_FILES([gdbserver_tests/filter_memcheck_monitor],
5799 [chmod +x gdbserver_tests/filter_memcheck_monitor])
5800 AC_CONFIG_FILES([gdbserver_tests/filter_stderr],
5801 [chmod +x gdbserver_tests/filter_stderr])
5802 AC_CONFIG_FILES([gdbserver_tests/filter_vgdb],
5803 [chmod +x gdbserver_tests/filter_vgdb])
5804 AC_CONFIG_FILES([drd/tests/filter_stderr],
5805 [chmod +x drd/tests/filter_stderr])
5806 AC_CONFIG_FILES([drd/tests/filter_error_count],
5807 [chmod +x drd/tests/filter_error_count])
5808 AC_CONFIG_FILES([drd/tests/filter_error_summary],
5809 [chmod +x drd/tests/filter_error_summary])
5810 AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
5811 [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
5812 AC_CONFIG_FILES([drd/tests/filter_thread_no],
5813 [chmod +x drd/tests/filter_thread_no])
5814 AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
5815 [chmod +x drd/tests/filter_xml_and_thread_no])
5816 AC_CONFIG_FILES([helgrind/tests/filter_stderr],
5817 [chmod +x helgrind/tests/filter_stderr])
5823 Maximum build arch: ${ARCH_MAX}
5824 Primary build arch: ${VGCONF_ARCH_PRI}
5825 Secondary build arch: ${VGCONF_ARCH_SEC}
5826 Build OS: ${VGCONF_OS}
5827 Link Time Optimisation: ${vg_cv_lto}
5828 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
5829 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
5830 Platform variant: ${VGCONF_PLATVARIANT}
5831 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
5832 Default supp files: ${DEFAULT_SUPP}