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_11], 1100, [FREEBSD_VERS value for FreeBSD 11.x])
404 AC_DEFINE([FREEBSD_12], 1200, [FREEBSD_VERS value for FreeBSD 12.0 to 12.1])
406 AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2])
408 AC_DEFINE([FREEBSD_13_0], 1300, [FREEBSD_VERS value for FreeBSD 13.0])
410 AC_DEFINE([FREEBSD_13_1], 1310, [FREEBSD_VERS value for FreeBSD 13.1])
412 AC_DEFINE([FREEBSD_13_2], 1320, [FREEBSD_VERS value for FreeBSD 13.2])
414 AC_DEFINE([FREEBSD_13_3], 1330, [FREEBSD_VERS value for FreeBSD 13.3])
416 AC_DEFINE([FREEBSD_13_4], 1340, [FREEBSD_VERS value for FreeBSD 13.4])
418 AC_DEFINE([FREEBSD_14_0], 1400, [FREEBSD_VERS value for FreeBSD 14.0])
420 AC_DEFINE([FREEBSD_14_1], 1410, [FREEBSD_VERS value for FreeBSD 14.1])
422 AC_DEFINE([FREEBSD_15], 1500, [FREEBSD_VERS value for FreeBSD 15.x])
425 AC_MSG_CHECKING([for the kernel version])
430 AC_MSG_RESULT([FreeBSD 11.x (${kernel})])
431 AC_DEFINE([FREEBSD_VERS], FREEBSD_11, [FreeBSD version])
432 freebsd_vers=$freebsd_11
437 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
438 AC_DEFINE([FREEBSD_VERS], FREEBSD_12, [FreeBSD version])
439 freebsd_vers=$freebsd_12
442 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
443 AC_DEFINE([FREEBSD_VERS], FREEBSD_12_2, [FreeBSD version])
444 freebsd_vers=$freebsd_12_2
451 AC_MSG_RESULT([FreeBSD 13.0 (${kernel})])
452 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_0, [FreeBSD version])
453 freebsd_vers=$freebsd_13_0
456 AC_MSG_RESULT([FreeBSD 13.1 (${kernel})])
457 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_1, [FreeBSD version])
458 freebsd_vers=$freebsd_13_1
461 AC_MSG_RESULT([FreeBSD 13.2 (${kernel})])
462 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_2, [FreeBSD version])
463 freebsd_vers=$freebsd_13_2
466 AC_MSG_RESULT([FreeBSD 13.3 (${kernel})])
467 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_3, [FreeBSD version])
468 freebsd_vers=$freebsd_13_3
471 AC_MSG_RESULT([FreeBSD 13.4 (${kernel})])
472 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_4, [FreeBSD version])
473 freebsd_vers=$freebsd_13_4
476 AC_MSG_RESULT([unsupported (${kernel})])
477 AC_MSG_ERROR([Valgrind works on FreeBSD 11.x to 15.x])
484 AC_MSG_RESULT([FreeBSD 14.0 (${kernel})])
485 AC_DEFINE([FREEBSD_VERS], FREEBSD_14_0, [FreeBSD version])
486 freebsd_vers=$freebsd_14_0
489 AC_MSG_RESULT([FreeBSD 14.1 (${kernel})])
490 AC_DEFINE([FREEBSD_VERS], FREEBSD_14_1, [FreeBSD version])
491 freebsd_vers=$freebsd_14_1
494 AC_MSG_RESULT([unsupported (${kernel})])
495 AC_MSG_ERROR([Valgrind works on FreeBSD 11.x to 15.x])
500 AC_MSG_RESULT([FreeBSD 15.x (${kernel})])
501 AC_DEFINE([FREEBSD_VERS], FREEBSD_15, [FreeBSD version])
502 freebsd_vers=$freebsd_15
505 AC_MSG_RESULT([unsupported (${kernel})])
506 AC_MSG_ERROR([Valgrind works on FreeBSD 11.x to 15.x])
510 DEFAULT_SUPP="$srcdir/freebsd.supp $srcdir/freebsd-helgrind.supp $srcdir/freebsd-drd.supp ${DEFAULT_SUPP}"
514 AC_MSG_RESULT([ok (${host_os})])
516 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
517 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
518 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
519 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
520 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
521 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
522 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
523 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
524 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
526 AC_MSG_CHECKING([for the kernel version])
529 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
530 # has only one relevant version, the OS version. The `uname` check
531 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
532 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
533 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
534 # and we don't know of an macros similar to __GLIBC__ to get that info.
536 # XXX: `uname -r` won't do the right thing for cross-compiles, but
537 # that's not a problem yet.
539 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
540 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
541 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
542 # time support for 10.5 (the 9.* pattern just below), I'll leave it
543 # in for now, just in case anybody wants to give it a try. But I'm
544 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
547 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
548 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
549 DEFAULT_SUPP="$srcdir/darwin9.supp ${DEFAULT_SUPP}"
550 DEFAULT_SUPP="$srcdir/darwin9-drd.supp ${DEFAULT_SUPP}"
553 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
554 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
555 DEFAULT_SUPP="$srcdir/darwin10.supp ${DEFAULT_SUPP}"
556 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
559 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
560 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
561 DEFAULT_SUPP="$srcdir/darwin11.supp ${DEFAULT_SUPP}"
562 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
565 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
566 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
567 DEFAULT_SUPP="$srcdir/darwin12.supp ${DEFAULT_SUPP}"
568 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
571 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
572 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
573 DEFAULT_SUPP="$srcdir/darwin13.supp ${DEFAULT_SUPP}"
574 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
577 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
578 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
579 DEFAULT_SUPP="$srcdir/darwin14.supp ${DEFAULT_SUPP}"
580 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
583 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
584 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
585 DEFAULT_SUPP="$srcdir/darwin15.supp ${DEFAULT_SUPP}"
586 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
589 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
590 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
591 DEFAULT_SUPP="$srcdir/darwin16.supp ${DEFAULT_SUPP}"
592 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
595 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
596 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
597 DEFAULT_SUPP="$srcdir/darwin17.supp ${DEFAULT_SUPP}"
598 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
601 AC_MSG_RESULT([unsupported (${kernel})])
602 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)])
608 AC_MSG_RESULT([ok (${host_os})])
611 uname_v=$( uname -v )
614 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
617 DEFAULT_SUPP="$srcdir/solaris11.supp ${DEFAULT_SUPP}"
623 AC_MSG_RESULT([ok (${host_os})])
625 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
629 AC_MSG_RESULT([no (${host_os})])
630 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
634 #----------------------------------------------------------------------------
636 # If we are building on a 64 bit platform test to see if the system
637 # supports building 32 bit programs and disable 32 bit support if it
638 # does not support building 32 bit programs
640 case "$ARCH_MAX-$VGCONF_OS" in
641 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
642 AC_MSG_CHECKING([for 32 bit build support])
645 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
650 vg_cv_only64bit="yes"
653 CFLAGS=$safe_CFLAGS;;
655 AC_MSG_CHECKING([for 32 bit build support])
657 CFLAGS="$CFLAGS -mips32 -mabi=32"
658 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
659 #include <sys/prctl.h>
663 vg_cv_only64bit="yes"
666 CFLAGS=$safe_CFLAGS;;
669 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
671 [--enable-only32bit was specified but system does not support 32 bit builds])
674 #----------------------------------------------------------------------------
676 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
677 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
678 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
679 # above) will be "amd64" since that reflects the most that this cpu can do,
680 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
681 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
682 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
683 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
684 AC_SUBST(VGCONF_ARCH_PRI)
686 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
687 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
688 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
689 # It is empty if there is no secondary target.
690 AC_SUBST(VGCONF_ARCH_SEC)
692 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
693 # The entire system, including regression and performance tests, will be
694 # built for this target. The "_CAPS" indicates that the name is in capital
695 # letters, and it also uses '_' rather than '-' as a separator, because it's
696 # used to create various Makefile variables, which are all in caps by
697 # convention and cannot contain '-' characters. This is in contrast to
698 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
699 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
701 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
702 # Valgrind and tools will also be built for this target, but not the
703 # regression or performance tests.
705 # By default, the primary arch is the same as the "max" arch, as commented
706 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
707 # the big case statement just below here, in the case where we're building
708 # on a 64 bit machine but have been requested only to do a 32 bit build.
709 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
711 AC_MSG_CHECKING([for a supported CPU/OS combination])
713 # NB. The load address for a given platform may be specified in more
714 # than one place, in some cases, depending on whether we're doing a biarch,
715 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
716 # Be careful to give consistent values in all subcases. Also, all four
717 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
718 # even if it is to "0xUNSET".
720 case "$ARCH_MAX-$VGCONF_OS" in
722 VGCONF_ARCH_PRI="x86"
724 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
725 VGCONF_PLATFORM_SEC_CAPS=""
726 valt_load_address_pri_norml="0x58000000"
727 valt_load_address_pri_inner="0x38000000"
728 valt_load_address_sec_norml="0xUNSET"
729 valt_load_address_sec_inner="0xUNSET"
730 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
733 valt_load_address_sec_norml="0xUNSET"
734 valt_load_address_sec_inner="0xUNSET"
735 if test x$vg_cv_only64bit = xyes; then
736 VGCONF_ARCH_PRI="amd64"
738 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
739 VGCONF_PLATFORM_SEC_CAPS=""
740 valt_load_address_pri_norml="0x58000000"
741 valt_load_address_pri_inner="0x38000000"
742 elif test x$vg_cv_only32bit = xyes; then
743 VGCONF_ARCH_PRI="x86"
745 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
746 VGCONF_PLATFORM_SEC_CAPS=""
747 valt_load_address_pri_norml="0x58000000"
748 valt_load_address_pri_inner="0x38000000"
750 VGCONF_ARCH_PRI="amd64"
751 VGCONF_ARCH_SEC="x86"
752 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
753 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
754 valt_load_address_pri_norml="0x58000000"
755 valt_load_address_pri_inner="0x38000000"
756 valt_load_address_sec_norml="0x58000000"
757 valt_load_address_sec_inner="0x38000000"
759 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
762 VGCONF_ARCH_PRI="ppc32"
764 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
765 VGCONF_PLATFORM_SEC_CAPS=""
766 valt_load_address_pri_norml="0x58000000"
767 valt_load_address_pri_inner="0x38000000"
768 valt_load_address_sec_norml="0xUNSET"
769 valt_load_address_sec_inner="0xUNSET"
770 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
773 valt_load_address_sec_norml="0xUNSET"
774 valt_load_address_sec_inner="0xUNSET"
775 if test x$vg_cv_only64bit = xyes; then
776 VGCONF_ARCH_PRI="ppc64be"
778 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
779 VGCONF_PLATFORM_SEC_CAPS=""
780 valt_load_address_pri_norml="0x58000000"
781 valt_load_address_pri_inner="0x38000000"
782 elif test x$vg_cv_only32bit = xyes; then
783 VGCONF_ARCH_PRI="ppc32"
785 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
786 VGCONF_PLATFORM_SEC_CAPS=""
787 valt_load_address_pri_norml="0x58000000"
788 valt_load_address_pri_inner="0x38000000"
790 VGCONF_ARCH_PRI="ppc64be"
791 VGCONF_ARCH_SEC="ppc32"
792 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
793 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
794 valt_load_address_pri_norml="0x58000000"
795 valt_load_address_pri_inner="0x38000000"
796 valt_load_address_sec_norml="0x58000000"
797 valt_load_address_sec_inner="0x38000000"
799 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
802 # Little Endian is only supported on PPC64
803 valt_load_address_sec_norml="0xUNSET"
804 valt_load_address_sec_inner="0xUNSET"
805 VGCONF_ARCH_PRI="ppc64le"
807 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
808 VGCONF_PLATFORM_SEC_CAPS=""
809 valt_load_address_pri_norml="0x58000000"
810 valt_load_address_pri_inner="0x38000000"
811 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
814 VGCONF_ARCH_PRI="x86"
816 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
817 VGCONF_PLATFORM_SEC_CAPS=""
818 valt_load_address_pri_norml="0x38000000"
819 valt_load_address_pri_inner="0x28000000"
820 valt_load_address_sec_norml="0xUNSET"
821 valt_load_address_sec_inner="0xUNSET"
822 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
825 if test x$vg_cv_only64bit = xyes; then
826 VGCONF_ARCH_PRI="amd64"
828 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
829 VGCONF_PLATFORM_SEC_CAPS=""
830 elif test x$vg_cv_only32bit = xyes; then
831 VGCONF_ARCH_PRI="x86"
833 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
834 VGCONF_PLATFORM_SEC_CAPS=""
836 VGCONF_ARCH_PRI="amd64"
837 VGCONF_ARCH_SEC="x86"
838 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
839 VGCONF_PLATFORM_SEC_CAPS="X86_FREEBSD"
841 # These work with either base clang or ports installed gcc
842 # Hand rolled compilers probably need INSTALL_DIR/lib (at least for gcc)
843 if test x$is_clang = xclang ; then
844 FLAG_32ON64="-B/usr/lib32"
846 GCC_MAJOR_VERSION=`${CC} -dumpversion | $SED 's/\..*//' 2>/dev/null`
847 FLAG_32ON64="-B/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -Wl,-rpath,/usr/local/lib32/gcc${GCC_MAJOR_VERSION}/"
848 FLAG_32ON64_GXX="-L/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -lgcc_s"
849 AC_SUBST(FLAG_32ON64_GXX)
851 valt_load_address_pri_norml="0x38000000"
852 valt_load_address_pri_inner="0x28000000"
853 valt_load_address_sec_norml="0x38000000"
854 valt_load_address_sec_inner="0x28000000"
855 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
858 VGCONF_ARCH_PRI="arm64"
860 VGCONF_PLATFORM_PRI_CAPS="ARM64_FREEBSD"
861 VGCONF_PLATFORM_SEC_CAPS=""
862 valt_load_address_pri_norml="0x38000000"
863 valt_load_address_pri_inner="0x28000000"
864 valt_load_address_sec_norml="0xUNSET"
865 valt_load_address_sec_inner="0xUNSET"
866 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
868 # Darwin gets identified as 32-bit even when it supports 64-bit.
869 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
870 # all Macs support both 32-bit and 64-bit, so we just build both. If
871 # someone has a really old 32-bit only machine they can (hopefully?)
872 # build with --enable-only32bit. See bug 243362.
873 x86-darwin|amd64-darwin)
875 valt_load_address_sec_norml="0xUNSET"
876 valt_load_address_sec_inner="0xUNSET"
877 if test x$vg_cv_only64bit = xyes; then
878 VGCONF_ARCH_PRI="amd64"
880 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
881 VGCONF_PLATFORM_SEC_CAPS=""
882 valt_load_address_pri_norml="0x158000000"
883 valt_load_address_pri_inner="0x138000000"
884 elif test x$vg_cv_only32bit = xyes; then
885 VGCONF_ARCH_PRI="x86"
887 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
888 VGCONF_PLATFORM_SEC_CAPS=""
889 VGCONF_ARCH_PRI_CAPS="x86"
890 valt_load_address_pri_norml="0x58000000"
891 valt_load_address_pri_inner="0x38000000"
893 VGCONF_ARCH_PRI="amd64"
894 VGCONF_ARCH_SEC="x86"
895 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
896 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
897 valt_load_address_pri_norml="0x158000000"
898 valt_load_address_pri_inner="0x138000000"
899 valt_load_address_sec_norml="0x58000000"
900 valt_load_address_sec_inner="0x38000000"
902 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
905 VGCONF_ARCH_PRI="arm"
906 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
907 VGCONF_PLATFORM_SEC_CAPS=""
908 valt_load_address_pri_norml="0x58000000"
909 valt_load_address_pri_inner="0x38000000"
910 valt_load_address_sec_norml="0xUNSET"
911 valt_load_address_sec_inner="0xUNSET"
912 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
915 valt_load_address_sec_norml="0xUNSET"
916 valt_load_address_sec_inner="0xUNSET"
917 if test x$vg_cv_only64bit = xyes; then
918 VGCONF_ARCH_PRI="arm64"
920 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
921 VGCONF_PLATFORM_SEC_CAPS=""
922 valt_load_address_pri_norml="0x58000000"
923 valt_load_address_pri_inner="0x38000000"
924 elif test x$vg_cv_only32bit = xyes; then
925 VGCONF_ARCH_PRI="arm"
927 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
928 VGCONF_PLATFORM_SEC_CAPS=""
929 valt_load_address_pri_norml="0x58000000"
930 valt_load_address_pri_inner="0x38000000"
932 VGCONF_ARCH_PRI="arm64"
933 VGCONF_ARCH_SEC="arm"
934 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
935 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
936 valt_load_address_pri_norml="0x58000000"
937 valt_load_address_pri_inner="0x38000000"
938 valt_load_address_sec_norml="0x58000000"
939 valt_load_address_sec_inner="0x38000000"
941 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
944 VGCONF_ARCH_PRI="s390x"
946 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
947 VGCONF_PLATFORM_SEC_CAPS=""
948 # To improve branch prediction hit rate we want to have
949 # the generated code close to valgrind (host) code
950 valt_load_address_pri_norml="0x800000000"
951 valt_load_address_pri_inner="0x810000000"
952 valt_load_address_sec_norml="0xUNSET"
953 valt_load_address_sec_inner="0xUNSET"
954 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
957 VGCONF_ARCH_PRI="mips32"
959 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
960 VGCONF_PLATFORM_SEC_CAPS=""
961 valt_load_address_pri_norml="0x58000000"
962 valt_load_address_pri_inner="0x38000000"
963 valt_load_address_sec_norml="0xUNSET"
964 valt_load_address_sec_inner="0xUNSET"
965 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
968 valt_load_address_sec_norml="0xUNSET"
969 valt_load_address_sec_inner="0xUNSET"
970 if test x$vg_cv_only64bit = xyes; then
971 VGCONF_ARCH_PRI="mips64"
972 VGCONF_PLATFORM_SEC_CAPS=""
973 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
974 VGCONF_PLATFORM_SEC_CAPS=""
975 valt_load_address_pri_norml="0x58000000"
976 valt_load_address_pri_inner="0x38000000"
977 elif test x$vg_cv_only32bit = xyes; then
978 VGCONF_ARCH_PRI="mips32"
980 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
981 VGCONF_PLATFORM_SEC_CAPS=""
982 valt_load_address_pri_norml="0x58000000"
983 valt_load_address_pri_inner="0x38000000"
985 VGCONF_ARCH_PRI="mips64"
986 VGCONF_ARCH_SEC="mips32"
987 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
988 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
989 valt_load_address_pri_norml="0x58000000"
990 valt_load_address_pri_inner="0x38000000"
991 valt_load_address_sec_norml="0x58000000"
992 valt_load_address_sec_inner="0x38000000"
994 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
997 VGCONF_ARCH_PRI="nanomips"
999 VGCONF_PLATFORM_PRI_CAPS="NANOMIPS_LINUX"
1000 VGCONF_PLATFORM_SEC_CAPS=""
1001 valt_load_address_pri_norml="0x58000000"
1002 valt_load_address_pri_inner="0x38000000"
1003 valt_load_address_sec_norml="0xUNSET"
1004 valt_load_address_sec_inner="0xUNSET"
1005 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
1008 VGCONF_ARCH_PRI="x86"
1010 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
1011 VGCONF_PLATFORM_SEC_CAPS=""
1012 valt_load_address_pri_norml="0x58000000"
1013 valt_load_address_pri_inner="0x38000000"
1014 valt_load_address_sec_norml="0xUNSET"
1015 valt_load_address_sec_inner="0xUNSET"
1016 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
1019 valt_load_address_sec_norml="0xUNSET"
1020 valt_load_address_sec_inner="0xUNSET"
1021 if test x$vg_cv_only64bit = xyes; then
1022 VGCONF_ARCH_PRI="amd64"
1024 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
1025 VGCONF_PLATFORM_SEC_CAPS=""
1026 valt_load_address_pri_norml="0x58000000"
1027 valt_load_address_pri_inner="0x38000000"
1028 elif test x$vg_cv_only32bit = xyes; then
1029 VGCONF_ARCH_PRI="x86"
1031 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
1032 VGCONF_PLATFORM_SEC_CAPS=""
1033 valt_load_address_pri_norml="0x58000000"
1034 valt_load_address_pri_inner="0x38000000"
1036 VGCONF_ARCH_PRI="amd64"
1037 VGCONF_ARCH_SEC="x86"
1038 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
1039 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
1040 valt_load_address_pri_norml="0x58000000"
1041 valt_load_address_pri_inner="0x38000000"
1042 valt_load_address_sec_norml="0x58000000"
1043 valt_load_address_sec_inner="0x38000000"
1045 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
1048 VGCONF_ARCH_PRI="unknown"
1049 VGCONF_ARCH_SEC="unknown"
1050 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
1051 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
1052 valt_load_address_pri_norml="0xUNSET"
1053 valt_load_address_pri_inner="0xUNSET"
1054 valt_load_address_sec_norml="0xUNSET"
1055 valt_load_address_sec_inner="0xUNSET"
1056 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
1057 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
1061 #----------------------------------------------------------------------------
1063 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
1065 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
1066 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1067 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1068 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1069 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD \
1070 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1071 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
1072 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1073 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
1074 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
1075 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1076 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1077 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
1078 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
1079 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
1080 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1081 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
1082 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
1083 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1084 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
1085 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
1086 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1087 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
1088 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
1089 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1090 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD )
1091 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
1092 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
1093 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
1094 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1095 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
1096 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
1097 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
1098 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_NANOMIPS,
1099 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX )
1101 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
1103 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
1104 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1105 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
1106 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
1107 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
1108 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
1109 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1110 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
1111 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
1112 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
1113 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
1114 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
1115 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
1116 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1117 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
1118 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
1119 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
1120 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
1121 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1122 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
1123 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
1124 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1125 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
1126 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
1127 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
1128 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_NANOMIPS_LINUX,
1129 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1130 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD,
1131 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1132 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD)
1133 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD,
1134 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1135 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_FREEBSD,
1136 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD)
1137 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
1138 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1139 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
1140 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
1141 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1142 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
1143 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1144 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
1145 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
1146 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1149 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
1150 # Relies on the assumption that the primary and secondary targets are
1151 # for the same OS, so therefore only necessary to test the primary.
1152 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
1153 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1154 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1155 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1156 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1157 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
1158 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1159 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1160 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1161 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1162 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
1163 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1164 AM_CONDITIONAL(VGCONF_OS_IS_FREEBSD,
1165 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1166 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1167 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD)
1168 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
1169 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1170 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1171 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
1172 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1173 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1174 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN_OR_FREEBSD,
1175 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1176 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1177 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD \
1178 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1179 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1182 # Sometimes, in the Makefile.am files, it's useful to know whether or not
1183 # there is a secondary target.
1184 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
1185 test x$VGCONF_PLATFORM_SEC_CAPS != x)
1187 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
1188 dnl fallback definition
1189 dnl The macro is courtesy of Dave Hart:
1190 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
1191 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
1192 if test -z "$$1_TRUE"; then :
1201 #----------------------------------------------------------------------------
1203 #----------------------------------------------------------------------------
1205 # Check if this should be built as an inner Valgrind, to be run within
1206 # another Valgrind. Choose the load address accordingly.
1207 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
1208 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
1209 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
1210 [AC_ARG_ENABLE(inner,
1211 [ --enable-inner enables self-hosting],
1212 [vg_cv_inner=$enableval],
1214 if test "$vg_cv_inner" = yes; then
1215 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
1216 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
1217 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
1219 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
1220 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
1223 #----------------------------------------------------------------------------
1224 # Undefined behaviour sanitiser
1225 #----------------------------------------------------------------------------
1226 # Check whether we should build with the undefined beahviour sanitiser.
1228 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
1229 [AC_ARG_ENABLE(ubsan,
1230 [ --enable-ubsan enables the undefined behaviour sanitiser],
1231 [vg_cv_ubsan=$enableval],
1234 #----------------------------------------------------------------------------
1235 # Extra fine-tuning of installation directories
1236 #----------------------------------------------------------------------------
1238 [ --with-tmpdir=PATH Specify path for temporary files],
1241 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
1242 AC_SUBST(VG_TMPDIR, [$tmpdir])
1244 #----------------------------------------------------------------------------
1246 #----------------------------------------------------------------------------
1247 AM_COND_IF([VGCONF_OS_IS_DARWIN],
1248 [AC_CHECK_PROG([XCRUN], [xcrun], [yes], [no])
1249 AC_MSG_CHECKING([for xcode sdk include path])
1250 AC_ARG_WITH(xcodedir,
1251 [ --with-xcode-path=PATH Specify path for xcode sdk includes],
1252 [xcodedir="$withval"],
1254 if test "x$XCRUN" != "xno" -a ! -d /usr/include; then
1255 xcrundir=`xcrun --sdk macosx --show-sdk-path`
1256 if test -z "$xcrundir"; then
1257 xcodedir="/usr/include"
1259 xcodedir="$xcrundir/usr/include"
1262 xcodedir="/usr/include"
1265 AC_MSG_RESULT([$xcodedir])
1266 AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
1267 AC_SUBST(XCODE_DIR, [$xcodedir])])
1269 #----------------------------------------------------------------------------
1270 # Where to install gdb scripts, defaults to VG_LIBDIR (pkglibexecdir)
1271 #----------------------------------------------------------------------------
1272 AC_MSG_CHECKING([where gdb scripts are installed])
1273 AC_ARG_WITH(gdbscripts-dir,
1274 [ --with-gdbscripts-dir=PATH Specify path to install gdb scripts],
1275 [gdbscriptsdir=${withval}],
1276 [gdbscriptsdir=${libexecdir}/valgrind])
1277 AC_MSG_RESULT([$gdbscriptsdir])
1278 if test "x$gdbscriptsdir" != "xno"; then
1279 AC_SUBST(VG_GDBSCRIPTS_DIR, [$gdbscriptsdir])
1280 AM_CONDITIONAL(GDBSCRIPTS, true)
1282 AC_SUBST(VG_GDBSCRIPTS_DIR, [])
1283 AM_CONDITIONAL(GDBSCRIPTS, false)
1286 #----------------------------------------------------------------------------
1287 # Libc and suppressions
1288 #----------------------------------------------------------------------------
1289 # This variable will collect the suppression files to be used.
1290 AC_SUBST(DEFAULT_SUPP)
1292 AC_CHECK_HEADER([features.h])
1294 if test x$ac_cv_header_features_h = xyes; then
1295 AC_DEFINE([HAVE_HEADER_FEATURES_H], 1,
1296 [Define to 1 if you have the `features.h' header.])
1297 rm -f conftest.$ac_ext
1298 cat <<_ACEOF >conftest.$ac_ext
1299 #include <features.h>
1300 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1301 glibc version is: __GLIBC__ __GLIBC_MINOR__
1304 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1307 # not really a version check
1308 AC_EGREP_CPP([DARWIN_LIBC], [
1309 #include <sys/cdefs.h>
1310 #if defined(__DARWIN_VERS_1050)
1314 GLIBC_VERSION="darwin")
1316 AC_EGREP_CPP([FREEBSD_LIBC], [
1317 #include <sys/cdefs.h>
1318 #if defined(__FreeBSD__)
1322 GLIBC_VERSION="freebsd")
1324 # not really a version check
1325 AC_EGREP_CPP([BIONIC_LIBC], [
1326 #if defined(__ANDROID__)
1330 GLIBC_VERSION="bionic")
1332 # there is only one version of libc on Solaris
1333 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1334 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1335 GLIBC_VERSION="solaris"
1338 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1340 if test x$GLIBC_VERSION = x; then
1341 if $CC -dumpmachine | grep -q musl; then
1346 # If this is glibc then figure out the generic (in file) libc.so and
1347 # libpthread.so file paths to use in suppressions. Before 2.34 libpthread
1348 # was a separate library, afterwards it was merged into libc.so and
1349 # the library is called libc.so.6 (before it was libc-2.[0-9]+.so).
1350 # Use this fact to set GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH.
1351 case ${GLIBC_VERSION} in
1353 AC_MSG_CHECKING([whether pthread_create needs libpthread])
1354 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])],
1357 GLIBC_LIBC_PATH="*/lib*/libc.so.6"
1358 GLIBC_LIBPTHREAD_PATH="$GLIBC_LIBC_PATH"
1360 AC_MSG_RESULT([yes])
1361 GLIBC_LIBC_PATH="*/lib*/libc-2.*so*"
1362 GLIBC_LIBPTHREAD_PATH="*/lib*/libpthread-2.*so*"
1366 AC_MSG_CHECKING([not glibc...])
1367 AC_MSG_RESULT([${GLIBC_VERSION}])
1371 AC_MSG_CHECKING([the glibc version])
1373 case "${GLIBC_VERSION}" in
1375 AC_MSG_RESULT(${GLIBC_VERSION} family)
1376 DEFAULT_SUPP="$srcdir/glibc-2.2.supp ${DEFAULT_SUPP}"
1377 DEFAULT_SUPP="$srcdir/glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1378 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1381 AC_MSG_RESULT(${GLIBC_VERSION} family)
1382 DEFAULT_SUPP="$srcdir/glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1383 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1384 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1387 AC_MSG_RESULT(${GLIBC_VERSION} family)
1388 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1389 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1390 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1393 AC_MSG_RESULT(${GLIBC_VERSION} family)
1394 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1395 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1396 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1397 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1398 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1401 AC_MSG_RESULT(${GLIBC_VERSION} family)
1402 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1403 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1404 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1405 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1406 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1407 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1408 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1411 AC_MSG_RESULT(Darwin)
1412 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1413 # DEFAULT_SUPP set by kernel version check above.
1416 AC_MSG_RESULT(FreeBSD)
1417 AC_DEFINE([FREEBSD_LIBC], 1, [Define to 1 if you're using FreeBSD])
1418 # DEFAULT_SUPP set by kernel version check above.
1421 AC_MSG_RESULT(Bionic)
1422 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1423 DEFAULT_SUPP="$srcdir/bionic.supp ${DEFAULT_SUPP}"
1426 AC_MSG_RESULT(Solaris)
1427 # DEFAULT_SUPP set in host_os switch-case above.
1428 # No other suppression file is used.
1432 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1433 DEFAULT_SUPP="$srcdir/musl.supp ${DEFAULT_SUPP}"
1436 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1437 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1438 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1442 AC_SUBST(GLIBC_VERSION)
1443 AC_SUBST(GLIBC_LIBC_PATH)
1444 AC_SUBST(GLIBC_LIBPTHREAD_PATH)
1447 if test "$VGCONF_OS" != "solaris"; then
1448 # Add default suppressions for the X client libraries. Make no
1449 # attempt to detect whether such libraries are installed on the
1450 # build machine (or even if any X facilities are present); just
1451 # add the suppressions antidisirregardless.
1452 DEFAULT_SUPP="$srcdir/xfree-4.supp ${DEFAULT_SUPP}"
1453 DEFAULT_SUPP="$srcdir/xfree-3.supp ${DEFAULT_SUPP}"
1457 #----------------------------------------------------------------------------
1458 # Platform variants?
1459 #----------------------------------------------------------------------------
1461 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1462 # But there are times where we need a bit more control. The motivating
1463 # and currently only case is Android: this is almost identical to
1464 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1465 # platform variant tags, which get passed in the compile as
1466 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1468 # In almost all cases, the <variant> bit is "vanilla". But for Android
1469 # it is "android" instead.
1471 # Consequently (eg), plain arm-linux would build with
1473 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1475 # whilst an Android build would have
1477 # -DVGP_arm_linux -DVGPV_arm_linux_android
1479 # Same for x86. The setup of the platform variant is pushed relatively far
1480 # down this file in order that we can inspect any of the variables set above.
1482 # In the normal case ..
1483 VGCONF_PLATVARIANT="vanilla"
1486 if test "$GLIBC_VERSION" = "bionic";
1488 VGCONF_PLATVARIANT="android"
1491 AC_SUBST(VGCONF_PLATVARIANT)
1494 # FIXME: do we also want to define automake variables
1495 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1496 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1497 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1498 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1499 # that's what we'd need to do to use this, since what we'd want to write
1502 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1504 # Hmm. Can't think of a nice clean solution to this.
1506 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1507 test x$VGCONF_PLATVARIANT = xvanilla)
1508 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1509 test x$VGCONF_PLATVARIANT = xandroid)
1512 #----------------------------------------------------------------------------
1513 # Checking for various library functions and other definitions
1514 #----------------------------------------------------------------------------
1516 # Check for AT_FDCWD
1518 AC_MSG_CHECKING([for AT_FDCWD])
1519 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1526 ac_have_at_fdcwd=yes
1527 AC_MSG_RESULT([yes])
1533 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1535 # Check for stpncpy function definition in string.h
1536 # This explicitly checks with _GNU_SOURCE defined since that is also
1537 # used in the test case (some systems might define it without anyway
1538 # since stpncpy is part of The Open Group Base Specifications Issue 7
1539 # IEEE Std 1003.1-2008.
1540 AC_MSG_CHECKING([for stpncpy])
1541 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1548 char *r = stpncpy(d, s, n);
1550 ac_have_gnu_stpncpy=yes
1551 AC_MSG_RESULT([yes])
1553 ac_have_gnu_stpncpy=no
1557 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1559 # Check for PTRACE_GETREGS
1561 AC_MSG_CHECKING([for PTRACE_GETREGS])
1562 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1565 #include <sys/ptrace.h>
1566 #include <sys/user.h>
1569 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1571 AC_MSG_RESULT([yes])
1572 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1573 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1579 # Check for CLOCK_MONOTONIC
1581 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1583 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1587 clock_gettime(CLOCK_MONOTONIC, &t);
1590 AC_MSG_RESULT([yes])
1591 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1592 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1598 # Check for ELF32/64_CHDR
1600 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1603 # Check for PTHREAD_RWLOCK_T
1605 AC_MSG_CHECKING([for pthread_rwlock_t])
1607 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1609 #include <pthread.h>
1611 pthread_rwlock_t rwl;
1613 AC_MSG_RESULT([yes])
1614 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1615 [Define to 1 if you have the `pthread_rwlock_t' type.])
1620 # Check for CLOCKID_T
1622 AC_MSG_CHECKING([for clockid_t])
1624 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1629 AC_MSG_RESULT([yes])
1630 AC_DEFINE([HAVE_CLOCKID_T], 1,
1631 [Define to 1 if you have the `clockid_t' type.])
1636 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1638 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1640 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1642 #include <pthread.h>
1644 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1646 AC_MSG_RESULT([yes])
1647 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1648 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1654 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1656 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1658 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1660 #include <pthread.h>
1662 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1664 AC_MSG_RESULT([yes])
1665 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1666 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1672 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1674 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1676 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1678 #include <pthread.h>
1680 return (PTHREAD_MUTEX_RECURSIVE_NP);
1682 AC_MSG_RESULT([yes])
1683 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1684 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1690 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1692 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1694 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1696 #include <pthread.h>
1698 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1701 AC_MSG_RESULT([yes])
1702 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1703 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1709 # Check whether pthread_mutex_t has a member called __m_kind.
1711 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1712 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1714 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1717 [#include <pthread.h>])
1720 # Check whether pthread_mutex_t has a member called __data.__kind.
1722 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1723 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1725 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1728 [#include <pthread.h>])
1730 # Convenience function. Set flags based on the existing HWCAP entries.
1731 # The AT_HWCAP entries are generated by glibc, and are based on
1732 # functions supported by the hardware/system/libc.
1733 # Subsequent support for whether the capability will actually be utilized
1734 # will also be checked against the compiler capabilities.
1736 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1737 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1739 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1740 if env LD_SHOW_AUXV=1 true | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1742 AC_MSG_RESULT([yes])
1743 AC_SUBST([$2],[yes])
1750 # gather hardware capabilities. (hardware/kernel/libc)
1751 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1752 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1753 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1754 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1755 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1756 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1757 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1758 AC_HWCAP_CONTAINS_FLAG([arch_3_1],[HWCAP_HAS_ISA_3_1])
1759 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1760 AC_HWCAP_CONTAINS_FLAG([mma],[HWCAP_HAS_MMA])
1763 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1764 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1765 # compiler support for isa 2.07 level instructions
1766 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1767 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1769 __asm__ __volatile__("mtvsrd 1,2 ");
1771 ac_asm_have_isa_2_07=yes
1772 AC_MSG_RESULT([yes])
1774 ac_asm_have_isa_2_07=no
1777 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1778 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1780 # altivec (vsx) support.
1781 # does this compiler support -maltivec and does it have the include file
1783 AC_MSG_CHECKING([for Altivec support in the compiler ])
1785 CFLAGS="-maltivec -Werror"
1786 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1787 #include <altivec.h>
1789 vector unsigned int v;
1792 AC_MSG_RESULT([yes])
1798 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1799 -a x$HWCAP_HAS_ALTIVEC = xyes])
1801 # Check that both: the compiler supports -mvsx and that the assembler
1802 # understands VSX instructions. If either of those doesn't work,
1803 # conclude that we can't do VSX.
1804 AC_MSG_CHECKING([for VSX compiler flag support])
1806 CFLAGS="-mvsx -Werror"
1807 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1810 ac_compiler_supports_vsx_flag=yes
1811 AC_MSG_RESULT([yes])
1813 ac_compiler_supports_vsx_flag=no
1818 AC_MSG_CHECKING([for VSX support in the assembler ])
1820 CFLAGS="-mvsx -Werror"
1821 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1822 #include <altivec.h>
1824 vector unsigned int v;
1825 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1827 ac_compiler_supports_vsx=yes
1828 AC_MSG_RESULT([yes])
1830 ac_compiler_supports_vsx=no
1834 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1835 -a x$ac_compiler_supports_vsx = xyes \
1836 -a x$HWCAP_HAS_VSX = xyes ])
1838 # DFP (Decimal Float)
1839 # The initial DFP support was added in Power 6. The dcffix instruction
1840 # support was added in Power 7.
1841 AC_MSG_CHECKING([that assembler knows DFP])
1842 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1845 __asm__ __volatile__("adtr 1, 2, 3")
1847 __asm__ __volatile__(".machine power7;\n" \
1853 AC_MSG_RESULT([yes])
1858 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1860 CFLAGS="-mhard-dfp -Werror"
1862 # The dcffix instruction is Power 7
1863 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1866 __asm__ __volatile__("adtr 1, 2, 3")
1868 __asm__ __volatile__(".machine power7;\n" \
1873 ac_compiler_have_dfp=yes
1874 AC_MSG_RESULT([yes])
1876 ac_compiler_have_dfp=no
1880 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1881 -a x$ac_compiler_have_dfp = xyes \
1882 -a x$HWCAP_HAS_DFP = xyes )
1884 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1885 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1887 _Decimal64 x = 0.0DD;
1889 ac_compiler_have_dfp_type=yes
1890 AC_MSG_RESULT([yes])
1892 ac_compiler_have_dfp_type=no
1895 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1896 -a x$HWCAP_HAS_DFP = xyes )
1899 # HTM (Hardware Transactional Memory)
1900 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1902 CFLAGS="-mhtm -Werror"
1903 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1907 AC_MSG_RESULT([yes])
1908 ac_compiler_supports_htm=yes
1911 ac_compiler_supports_htm=no
1915 AC_MSG_CHECKING([if compiler can find the htm builtins])
1917 CFLAGS="-mhtm -Werror"
1918 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1920 if (__builtin_tbegin (0))
1923 AC_MSG_RESULT([yes])
1924 ac_compiler_sees_htm_builtins=yes
1927 ac_compiler_sees_htm_builtins=no
1931 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1932 -a x$ac_compiler_sees_htm_builtins = xyes \
1933 -a x$HWCAP_HAS_HTM = xyes )
1935 # isa 3.0 checking. (actually 3.0 or newer)
1936 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1938 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1940 __asm__ __volatile__ (".machine power9;\n" \
1943 # guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste,
1946 CFLAGS="-DHAS_ISA_3_00"
1947 ac_asm_have_isa_3_00=yes
1948 AC_MSG_RESULT([yes])
1950 ac_asm_have_isa_3_00=no
1956 AC_MSG_CHECKING([that assembler knows xscvhpdp ])
1958 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1960 __asm__ __volatile__ (".machine power9;\n" \
1961 "xscvhpdp 1,2;\n" );
1963 ac_asm_have_xscvhpdp=yes
1964 AC_MSG_RESULT([yes])
1966 ac_asm_have_xscvhpdp=no
1970 # darn instruction checking
1971 AC_MSG_CHECKING([that assembler knows darn instruction ])
1973 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1975 __asm__ __volatile__(".machine power9; darn 1,0 ");
1977 ac_asm_have_darn_inst=yes
1978 AC_MSG_RESULT([yes])
1980 ac_asm_have_darn_inst=no
1985 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
1986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1988 __asm__ __volatile__ (".machine power10;\n" \
1991 ac_asm_have_isa_3_1=yes
1992 AC_MSG_RESULT([yes])
1994 ac_asm_have_isa_3_1=no
1999 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
2000 -a x$HWCAP_HAS_ISA_3_00 = xyes])
2002 AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes])
2003 AM_CONDITIONAL(HAS_DARN, [test x$ac_asm_have_darn_inst = xyes])
2005 AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \
2006 -a x$HWCAP_HAS_ISA_3_1 = xyes])
2008 # Check for pthread_create@GLIBC2.0
2009 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
2012 CFLAGS="-lpthread -Werror"
2013 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2014 extern int pthread_create_glibc_2_0(void*, const void*,
2015 void *(*)(void*), void*);
2016 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
2020 * Apparently on PowerPC linking this program succeeds and generates an
2021 * executable with the undefined symbol pthread_create@GLIBC_2.0.
2023 #error This test does not work properly on PowerPC.
2025 pthread_create_glibc_2_0(0, 0, 0, 0);
2029 ac_have_pthread_create_glibc_2_0=yes
2030 AC_MSG_RESULT([yes])
2031 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
2032 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
2034 ac_have_pthread_create_glibc_2_0=no
2039 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
2040 test x$ac_have_pthread_create_glibc_2_0 = xyes)
2043 # Check for dlinfo RTLD_DI_TLS_MODID
2044 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
2048 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2055 size_t sizes[10000];
2056 size_t modid_offset;
2057 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
2060 ac_have_dlinfo_rtld_di_tls_modid=yes
2061 AC_MSG_RESULT([yes])
2062 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
2063 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
2065 ac_have_dlinfo_rtld_di_tls_modid=no
2070 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
2071 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
2074 # Check for eventfd_t, eventfd() and eventfd_read()
2075 AC_MSG_CHECKING([for eventfd()])
2077 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2078 #include <sys/eventfd.h>
2084 eventfd_read(fd, &ev);
2087 AC_MSG_RESULT([yes])
2088 AC_DEFINE([HAVE_EVENTFD], 1,
2089 [Define to 1 if you have the `eventfd' function.])
2090 AC_DEFINE([HAVE_EVENTFD_READ], 1,
2091 [Define to 1 if you have the `eventfd_read' function.])
2096 # Check whether compiler can process #include <thread> without errors
2097 # clang 3.3 cannot process <thread> from e.g.
2098 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
2100 AC_MSG_CHECKING([that C++ compiler can compile C++17 code])
2102 safe_CXXFLAGS=$CXXFLAGS
2105 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2110 AC_MSG_RESULT([yes])
2115 CXXFLAGS=$safe_CXXFLAGS
2118 AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes)
2120 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
2122 safe_CXXFLAGS=$CXXFLAGS
2125 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2129 ac_cxx_can_include_thread_header=yes
2130 AC_MSG_RESULT([yes])
2132 ac_cxx_can_include_thread_header=no
2135 CXXFLAGS=$safe_CXXFLAGS
2138 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
2140 # Check whether compiler can process #include <condition_variable> without errors
2142 AC_MSG_CHECKING([that C++ compiler can include <condition_variable> header file])
2144 safe_CXXFLAGS=$CXXFLAGS
2147 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2148 #include <condition_variable>
2151 ac_cxx_can_include_condition_variable_header=yes
2152 AC_MSG_RESULT([yes])
2154 ac_cxx_can_include_condition_variable_header=no
2157 CXXFLAGS=$safe_CXXFLAGS
2160 AM_CONDITIONAL(CXX_CAN_INCLUDE_CONDITION_VARIABLE_HEADER, test x$ac_cxx_can_include_condition_variable_header = xyes)
2162 # check for std::shared_timed_mutex, this is a C++ 14 feature
2164 AC_MSG_CHECKING([that C++ compiler can use std::shared_timed_mutex])
2166 safe_CXXFLAGS=$CXXFLAGS
2167 CXXFLAGS="-std=c++1y -pthread"
2169 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2170 #include <shared_mutex>
2171 std::shared_timed_mutex test_mutex;
2174 ac_cxx_can_use_shared_timed_mutex=yes
2175 AC_MSG_RESULT([yes])
2177 ac_cxx_can_use_shared_timed_mutex=no
2180 CXXFLAGS=$safe_CXXFLAGS
2183 AM_CONDITIONAL(CXX_CAN_USE_SHARED_TIMED_MUTEX, test x$ac_cxx_can_use_shared_timed_mutex = xyes)
2185 # check for std::shared_mutex, this is a C++ 11 feature
2187 AC_MSG_CHECKING([that C++ compiler can use std::timed_mutex])
2189 safe_CXXFLAGS=$CXXFLAGS
2190 CXXFLAGS="-std=c++0x -pthread"
2192 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2194 std::timed_mutex test_mutex;
2197 ac_cxx_can_use_timed_mutex=yes
2198 AC_MSG_RESULT([yes])
2200 ac_cxx_can_use_timed_mutex=no
2203 CXXFLAGS=$safe_CXXFLAGS
2206 AM_CONDITIONAL(CXX_CAN_USE_TIMED_MUTEX, test x$ac_cxx_can_use_timed_mutex = xyes)
2208 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
2209 # of the user_regs_struct from sys/user.h. They are structurally the same
2210 # but we get either one or the other.
2212 AC_CHECK_TYPE([struct user_regs_struct],
2213 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
2214 [[#include <sys/ptrace.h>]
2215 [#include <sys/time.h>]
2216 [#include <sys/user.h>]])
2217 if test "$sys_user_has_user_regs" = "yes"; then
2218 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
2219 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
2222 AC_MSG_CHECKING([for __NR_membarrier])
2223 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2224 #include <linux/unistd.h>
2226 return __NR_membarrier
2228 ac_have_nr_membarrier=yes
2229 AC_MSG_RESULT([yes])
2231 ac_have_nr_membarrier=no
2235 AM_CONDITIONAL(HAVE_NR_MEMBARRIER, [test x$ac_have_nr_membarrier = xyes])
2237 #----------------------------------------------------------------------------
2238 # Checking for supported compiler flags.
2239 #----------------------------------------------------------------------------
2241 case "${host_cpu}" in
2243 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2244 if test -z "$ARCH"; then
2245 # does this compiler support -march=mips32 (mips32 default) ?
2246 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
2249 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
2251 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2254 FLAG_M32="-mips32 -mabi=32"
2255 AC_MSG_RESULT([yes])
2265 # does this compiler support -march=mips64r2 (mips64r2 default) ?
2266 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
2269 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
2271 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2274 FLAG_M64="-march=mips64r2 -mabi=64"
2275 AC_MSG_RESULT([yes])
2288 # does this compiler support -m32 ?
2289 AC_MSG_CHECKING([if gcc accepts -m32])
2292 CFLAGS="${FLAG_32ON64} -m32 -Werror"
2294 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2297 FLAG_M32="${FLAG_32ON64} -m32"
2298 AC_MSG_RESULT([yes])
2308 # does this compiler support -m64 ?
2309 AC_MSG_CHECKING([if gcc accepts -m64])
2312 CFLAGS="-m64 -Werror"
2314 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2318 AC_MSG_RESULT([yes])
2330 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2331 if test -z "$ARCH"; then
2332 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
2333 AC_MSG_CHECKING([if gcc accepts -march=octeon])
2336 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
2338 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2341 FLAG_OCTEON="-march=octeon"
2342 AC_MSG_RESULT([yes])
2349 AC_SUBST(FLAG_OCTEON)
2352 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
2353 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
2356 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
2358 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2361 FLAG_OCTEON2="-march=octeon2"
2362 AC_MSG_RESULT([yes])
2369 AC_SUBST(FLAG_OCTEON2)
2373 # does this compiler support -mmsa (MIPS MSA ASE) ?
2374 AC_MSG_CHECKING([if gcc accepts -mmsa])
2377 CFLAGS="$CFLAGS -mmsa -Werror"
2379 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2383 AC_MSG_RESULT([yes])
2392 # Are we compiling for the MIPS64 n32 ABI?
2393 AC_MSG_CHECKING([if gcc is producing mips n32 binaries])
2394 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2395 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABIN32))
2400 FLAG_M64="-march=mips64r2 -mabi=n32"
2401 AC_MSG_RESULT([yes])
2406 # Are we compiling for the MIPS64 n64 ABI?
2407 AC_MSG_CHECKING([if gcc is producing mips n64 binaries])
2408 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2409 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABI64))
2414 AC_MSG_RESULT([yes])
2419 # We enter the code block below in the following case:
2420 # Target architecture is set to mips64, the desired abi
2421 # was not specified and the compiler's default abi setting
2422 # is neither n32 nor n64.
2423 # Probe for and set the abi to either n64 or n32, in that order,
2424 # which is required for a mips64 build of valgrind.
2425 if test "$ARCH_MAX" = "mips64" -a "x$VGCONF_ABI" = "x"; then
2427 CFLAGS="$CFLAGS -mabi=64 -Werror"
2428 AC_MSG_CHECKING([if gcc is n64 capable])
2429 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2433 AC_MSG_RESULT([yes])
2439 if test "x$VGCONF_ABI" = "x"; then
2441 CFLAGS="$CFLAGS -mabi=n32 -Werror"
2442 AC_MSG_CHECKING([if gcc is n32 capable])
2443 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2447 FLAG_M64="-march=mips64r2 -mabi=n32"
2448 AC_MSG_RESULT([yes])
2456 AM_CONDITIONAL([VGCONF_HAVE_ABI],
2457 [test x$VGCONF_ABI != x])
2458 AC_SUBST(VGCONF_ABI)
2461 # does this compiler support -mmmx ?
2462 AC_MSG_CHECKING([if gcc accepts -mmmx])
2465 CFLAGS="-mmmx -Werror"
2467 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2471 AC_MSG_RESULT([yes])
2481 # does this compiler support -msse ?
2482 AC_MSG_CHECKING([if gcc accepts -msse])
2485 CFLAGS="-msse -Werror"
2487 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2491 AC_MSG_RESULT([yes])
2501 # does this compiler support -mpreferred-stack-boundary=2 when
2502 # generating code for a 32-bit target? Note that we only care about
2503 # this when generating code for (32-bit) x86, so if the compiler
2504 # doesn't recognise -m32 it's no big deal. We'll just get code for
2505 # the Memcheck and other helper functions, that is a bit slower than
2506 # it could be, on x86; and no difference at all on any other platform.
2507 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
2510 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
2512 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2515 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
2516 AC_MSG_RESULT([yes])
2518 PREFERRED_STACK_BOUNDARY_2=""
2523 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
2526 # does this compiler support -mlong-double-128 ?
2527 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
2529 CFLAGS="-mlong-double-128 -Werror"
2530 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2533 ac_compiler_supports_mlong_double_128=yes
2534 AC_MSG_RESULT([yes])
2536 ac_compiler_supports_mlong_double_128=no
2540 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
2541 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
2542 AC_SUBST(FLAG_MLONG_DOUBLE_128)
2544 # does this toolchain support lto ?
2545 # Not checked for if --enable-lto=no was given, or if LTO_AR or LTO_RANLIB
2547 # If not enable-lto=* arg is provided, default to no, as lto builds are
2548 # a lot slower, and so not appropriate for Valgrind developments.
2549 # --enable-lto=yes should be used by distro packagers.
2550 AC_CACHE_CHECK([for using the link time optimisation], vg_cv_lto,
2552 [ --enable-lto enables building with link time optimisation],
2553 [vg_cv_lto=$enableval],
2556 if test "x${vg_cv_lto}" != "xno" -a "x${LTO_AR}" != "x" -a "x${LTO_RANLIB}" != "x"; then
2557 AC_MSG_CHECKING([if toolchain accepts lto])
2559 TEST_LTO_CFLAGS="-flto -fuse-linker-plugin"
2560 CFLAGS="$TEST_LTO_CFLAGS -Werror"
2562 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2563 extern void somefun(void);
2567 LTO_CFLAGS=$TEST_LTO_CFLAGS
2568 AC_MSG_RESULT([yes])
2576 AC_SUBST(LTO_CFLAGS)
2578 # if we could not compile with lto args, or lto was disabled,
2579 # then set LTO_AR/LTO_RANLIB to the non lto values
2580 # define in config.h ENABLE_LTO (not needed by the code currently, but
2581 # this guarantees we recompile everything if we re-configure and rebuild
2582 # in a build dir previously build with another value of --enable-lto
2583 if test "x${LTO_CFLAGS}" = "x"; then
2585 LTO_RANLIB=${RANLIB}
2589 AC_DEFINE([ENABLE_LTO], 1, [configured to build with lto link time optimisation])
2592 # Convenience function to check whether GCC supports a particular
2593 # warning option. Takes two arguments,
2594 # first the warning flag name to check (without -W), then the
2595 # substitution name to set with -Wno-warning-flag if the flag exists,
2596 # or the empty string if the compiler doesn't accept the flag. Note
2597 # that checking is done against the warning flag itself, but the
2598 # substitution is then done to cancel the warning flag.
2599 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
2600 AC_MSG_CHECKING([if gcc accepts -W$1])
2602 CFLAGS="-W$1 -Werror"
2603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2604 AC_SUBST([$2], [-Wno-$1])
2605 AC_MSG_RESULT([yes])], [
2607 AC_MSG_RESULT([no])])
2611 # A variation of the above for arguments that
2613 AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[
2614 AC_MSG_CHECKING([if gcc accepts -W$1=$2])
2616 CFLAGS="-W$1=$2 -Werror"
2617 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2618 AC_SUBST([$3], [-Wno-$1])
2619 AC_MSG_RESULT([yes])], [
2621 AC_MSG_RESULT([no])])
2625 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
2626 # -W$1 (instead of -Wno-$1).
2627 AC_DEFUN([AC_GCC_WARNING_SUBST],[
2628 AC_MSG_CHECKING([if gcc accepts -W$1])
2630 CFLAGS="-W$1 -Werror"
2631 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2632 AC_SUBST([$2], [-W$1])
2633 AC_MSG_RESULT([yes])], [
2635 AC_MSG_RESULT([no])])
2639 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
2640 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
2641 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
2642 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
2643 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
2644 AC_GCC_WARNING_SUBST_NO([maybe-uninitialized], [FLAG_W_NO_MAYBE_UNINITIALIZED])
2645 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
2646 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
2647 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
2648 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2649 AC_GCC_WARNING_SUBST_NO([expansion-to-defined], [FLAG_W_NO_EXPANSION_TO_DEFINED])
2650 AC_GCC_WARNING_SUBST_NO([unused-variable], [FLAG_W_NO_UNUSED_VARIABLE])
2651 AC_GCC_WARNING_SUBST_NO([unused-but-set-variable], [FLAG_W_NO_UNUSED_BUT_SET_VARIABLE])
2652 AC_GCC_WARNING_SUBST_NO([non-power-of-two-alignment], [FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT])
2653 AC_GCC_WARNING_SUBST_NO([sign-compare], [FLAG_W_NO_SIGN_COMPARE])
2654 AC_GCC_WARNING_SUBST_NO([stringop-overflow], [FLAG_W_NO_STRINGOP_OVERFLOW])
2655 AC_GCC_WARNING_SUBST_NO([stringop-overread], [FLAG_W_NO_STRINGOP_OVERREAD])
2656 AC_GCC_WARNING_SUBST_NO([stringop-truncation], [FLAG_W_NO_STRINGOP_TRUNCATION])
2657 AC_GCC_WARNING_SUBST_NO([format-overflow], [FLAG_W_NO_FORMAT_OVERFLOW])
2658 AC_GCC_WARNING_SUBST_NO([use-after-free], [FLAG_W_NO_USE_AFTER_FREE])
2659 AC_GCC_WARNING_SUBST_NO([free-nonheap-object], [FLAG_W_NO_FREE_NONHEAP_OBJECT])
2660 AC_GCC_WARNING_SUBST_NO([fortify-source], [FLAG_W_NO_FORTIFY_SOURCE])
2661 AC_GCC_WARNING_SUBST_NO([builtin-memcpy-chk-size], [FLAG_W_NO_BUILTIN_MEMCPY_CHK_SIZE])
2662 AC_GCC_WARNING_SUBST_NO([incompatible-pointer-types-discards-qualifiers], [FLAG_W_NO_INCOMPATIBLE_POINTER_TYPES_DISCARDS_QUALIFIERS])
2663 AC_GCC_WARNING_SUBST_NO([suspicious-bzero], [FLAG_W_NO_SUSPICIOUS_BZERO])
2664 AC_GCC_WARNING_SUBST_NO([attributes], [FLAG_W_NO_ATTRIBUTES])
2665 AC_GCC_WARNING_SUBST_NO([unused-result], [FLAG_W_NO_UNUSED_RESULT])
2666 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2667 AC_GCC_WARNING_SUBST_NO([deprecated], [FLAG_W_NO_DEPRECATED])
2669 AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
2671 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
2672 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
2673 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
2674 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
2675 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
2676 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2677 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2678 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2679 AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
2680 AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
2681 AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
2683 # Does this compiler support -Wformat-security ?
2684 # Special handling is needed, because certain GCC versions require -Wformat
2685 # being present if -Wformat-security is given. Otherwise a warning is issued.
2686 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2687 # And with that the warning will be turned into an error with the result
2688 # that -Wformat-security is believed to be unsupported when in fact it is.
2689 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2691 CFLAGS="-Wformat -Wformat-security -Werror"
2692 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2693 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2694 AC_MSG_RESULT([yes])], [
2695 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2696 AC_MSG_RESULT([no])])
2699 # does this compiler support -Wextra or the older -W ?
2701 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2704 CFLAGS="-Wextra -Werror"
2706 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2709 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2710 AC_MSG_RESULT([-Wextra])
2713 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2716 AC_SUBST([FLAG_W_EXTRA], [-W])
2719 AC_SUBST([FLAG_W_EXTRA], [])
2720 AC_MSG_RESULT([not supported])
2725 # On ARM we do not want to pass -Wcast-align as that produces loads
2726 # of warnings. GCC is just being conservative. See here:
2727 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2728 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2729 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2731 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2734 # does this compiler support -faligned-new ?
2735 AC_MSG_CHECKING([if g++ accepts -faligned-new])
2737 safe_CXXFLAGS=$CXXFLAGS
2738 CXXFLAGS="-faligned-new -Werror"
2741 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2744 FLAG_FALIGNED_NEW="-faligned-new"
2745 AC_MSG_RESULT([yes])
2747 FLAG_FALIGNED_NEW=""
2750 CXXFLAGS=$safe_CXXFLAGS
2753 AC_SUBST(FLAG_FALIGNED_NEW)
2755 # does this compiler support -fsized-deallocation ?
2756 AC_MSG_CHECKING([if g++ accepts -fsized-deallocation])
2758 safe_CXXFLAGS=$CXXFLAGS
2759 CXXFLAGS="-fsized-deallocation -Werror"
2762 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2765 FLAG_FSIZED_DEALLOCATION="-fsized-deallocation"
2766 ac_have_sized_deallocation=yes
2767 AC_MSG_RESULT([yes])
2769 FLAG_FSIZED_DEALLOCATION=""
2770 ac_have_sized_deallocation=no
2773 CXXFLAGS=$safe_CXXFLAGS
2776 AC_SUBST(FLAG_FSIZED_DEALLOCATION)
2777 AM_CONDITIONAL([HAVE_FSIZED_DEALLOCATION], [test x$ac_have_sized_deallocation = xyes])
2779 # does this compiler support C++17 aligned new/delete?
2780 AC_MSG_CHECKING([if g++ supports aligned new and delete])
2782 safe_CXXFLAGS=$CXXFLAGS
2783 CXXFLAGS="-std=c++17"
2786 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2790 operator delete(nullptr, std::align_val_t(64U));
2792 ac_have_aligned_cxx_alloc=yes
2793 AC_MSG_RESULT([yes])
2795 ac_have_aligned_cxx_alloc=no
2798 CXXFLAGS=$safe_CXXFLAGS
2801 AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes])
2803 # does this compiler support -fno-stack-protector ?
2804 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2807 CFLAGS="-fno-stack-protector -Werror"
2809 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2812 no_stack_protector=yes
2813 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2814 AC_MSG_RESULT([yes])
2816 no_stack_protector=no
2817 FLAG_FNO_STACK_PROTECTOR=""
2822 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2824 # does this compiler support -finline-functions ?
2825 AC_MSG_CHECKING([if gcc accepts -finline-functions])
2828 CFLAGS="-finline-functions -Werror"
2830 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2833 inline_functions=yes
2834 FLAG_FINLINE_FUNCTIONS="-finline-functions"
2835 AC_MSG_RESULT([yes])
2838 FLAG_FINLINE_FUNCTIONS=""
2843 AC_SUBST(FLAG_FINLINE_FUNCTIONS)
2845 # Does GCC support disabling Identical Code Folding?
2846 # We want to disabled Identical Code Folding for the
2847 # tools preload shared objects to get better backraces.
2848 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2849 # "The optimization reduces code size and may disturb
2850 # unwind stacks by replacing a function by equivalent
2851 # one with a different name."
2852 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2855 CFLAGS="-fno-ipa-icf -Werror"
2857 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2861 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2862 AC_MSG_RESULT([yes])
2870 AC_SUBST(FLAG_FNO_IPA_ICF)
2873 # Does this compiler support -fsanitize=undefined. This is true for
2874 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2875 # also checks for alignment violations on memory accesses which the valgrind
2876 # code base is sprinkled (if not littered) with. As those alignment issues
2877 # don't pose a problem we want to suppress warnings about them.
2878 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2879 # GCCs do not support that.
2881 # Only checked for if --enable-ubsan was given.
2882 if test "x${vg_cv_ubsan}" = "xyes"; then
2883 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2885 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2886 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2889 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2890 LIB_UBSAN="-static-libubsan"
2891 AC_MSG_RESULT([yes])
2893 CFLAGS="-fsanitize=undefined -Werror"
2894 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2897 FLAG_FSANITIZE="-fsanitize=undefined"
2898 LIB_UBSAN="-static-libubsan"
2899 AC_MSG_RESULT([yes])
2907 AC_SUBST(FLAG_FSANITIZE)
2910 # does this compiler support --param inline-unit-growth=... ?
2912 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2915 CFLAGS="--param inline-unit-growth=900 -Werror"
2917 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2920 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2921 ["--param inline-unit-growth=900"])
2922 AC_MSG_RESULT([yes])
2924 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2930 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2932 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2935 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2937 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2941 AC_MSG_RESULT([yes])
2946 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2950 # does this compiler support -g -gz=zlib ?
2952 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2955 CFLAGS="-g -gz=zlib"
2957 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2961 AC_MSG_RESULT([yes])
2966 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2970 # does this compiler support -g -gz=zlib-gnu ?
2972 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2975 CFLAGS="-g -gz=zlib-gnu"
2977 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2980 ac_have_gz_zlib_gnu=yes
2981 AC_MSG_RESULT([yes])
2983 ac_have_gz_zlib_gnu=no
2986 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2990 # does this compiler support nested functions ?
2992 AC_MSG_CHECKING([if gcc accepts nested functions])
2994 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2995 int foo() { return 1; }
2998 ac_have_nested_functions=yes
2999 AC_MSG_RESULT([yes])
3001 ac_have_nested_functions=no
3004 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
3007 # does this compiler support the 'p' constraint in ASM statements ?
3009 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
3011 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3013 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
3015 ac_have_asm_constraint_p=yes
3016 AC_MSG_RESULT([yes])
3018 ac_have_asm_constraint_p=no
3021 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
3024 # Does this compiler and linker support -pie?
3025 # Some compilers actually do not support -pie and report its usage
3026 # as an error. We need to check if it is safe to use it first.
3028 AC_MSG_CHECKING([if gcc accepts -pie])
3033 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
3036 AC_SUBST([FLAG_PIE], ["-pie"])
3037 AC_MSG_RESULT([yes])
3039 AC_SUBST([FLAG_PIE], [""])
3044 AC_MSG_CHECKING([if gcc accepts -ansi])
3049 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3053 AC_MSG_RESULT([yes])
3058 AM_CONDITIONAL([HAVE_ANSI], [test x$ac_have_ansi = xyes])
3063 # Does this compiler support -no-pie?
3064 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
3065 # default. However this gets in the way with some tests, we use -no-pie
3068 AC_MSG_CHECKING([if gcc accepts -no-pie])
3071 CFLAGS="-no-pie -Werror"
3073 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
3076 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
3077 AC_MSG_RESULT([yes])
3079 AC_SUBST([FLAG_NO_PIE], [""])
3085 # We want to use use the -Ttext-segment option to the linker.
3086 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
3087 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
3088 # semantics are NOT what we want (GNU gold -Ttext is fine).
3090 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
3091 # will reside. -Ttext aligns just the .text section start (but not any
3094 # LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes"
3095 # in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html
3096 # The --image-base option (since version 6.0?) provides the semantics needed.
3097 # -Ttext-segment generates an error, but -Ttext now more closely
3098 # follows the GNU (bfd) ld's -Ttext.
3100 # So test first for --image-base support, and if that fails then
3101 # for -Ttext-segment which is supported by all bfd ld versions
3102 # and use that if it exists. If it doesn't exist it must be an older
3103 # version of gold and we can fall back to using -Ttext which has the
3107 AC_MSG_CHECKING([if the linker accepts -Wl,--image-base])
3109 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror"
3112 [AC_LANG_SOURCE([int _start () { return 0; }])],
3114 linker_using_t_text="no"
3115 AC_SUBST([FLAG_T_TEXT], ["--image-base"])
3116 AC_MSG_RESULT([yes])
3120 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
3122 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
3125 [AC_LANG_SOURCE([int _start () { return 0; }])],
3127 linker_using_t_text="no"
3128 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
3129 AC_MSG_RESULT([yes])
3131 linker_using_t_text="yes"
3132 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
3139 # If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will
3140 # have to strip any build-id ELF NOTEs from the statically linked tools.
3141 # Otherwise the build-id NOTE might end up at the default load address.
3142 # (Pedantically if the linker is gold then -Ttext is fine, but newer
3143 # gold versions also support -Ttext-segment. So just assume that unless
3144 # we can use -Ttext-segment we need to strip the build-id NOTEs.
3145 if test "x${linker_using_t_text}" = "xyes"; then
3146 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
3147 # does the linker support -Wl,--build-id=none ? Note, it's
3148 # important that we test indirectly via whichever C compiler
3149 # is selected, rather than testing /usr/bin/ld or whatever
3151 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
3153 CFLAGS="-Wl,--build-id=none -Werror"
3156 [AC_LANG_PROGRAM([ ], [return 0;])],
3158 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
3159 AC_MSG_RESULT([yes])
3161 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3165 AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.])
3166 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3170 # On s390x, if the linker supports -Wl,--s390-pgste, then we build the
3171 # tools with that flag. This enables running programs that need it, such
3173 if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then
3174 AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste])
3176 CFLAGS="-Wl,--s390-pgste"
3179 [AC_LANG_PROGRAM([ ], [return 0;])],
3181 AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"])
3182 AC_MSG_RESULT([yes])
3184 AC_SUBST([FLAG_S390_PGSTE], [""])
3190 # does the ppc assembler support "mtocrf" et al?
3191 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
3193 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3194 __asm__ __volatile__("mtocrf 4,0");
3195 __asm__ __volatile__("mfocrf 0,4");
3197 ac_have_as_ppc_mftocrf=yes
3198 AC_MSG_RESULT([yes])
3200 ac_have_as_ppc_mftocrf=no
3203 if test x$ac_have_as_ppc_mftocrf = xyes ; then
3204 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
3208 # does the ppc assembler support "lfdp" and other phased out floating point insns?
3209 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
3211 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3212 do { typedef struct {
3216 dbl_pair_t dbl_pair[3];
3217 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
3220 ac_have_as_ppc_fpPO=yes
3221 AC_MSG_RESULT([yes])
3223 ac_have_as_ppc_fpPO=no
3226 if test x$ac_have_as_ppc_fpPO = xyes ; then
3227 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
3231 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
3232 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
3234 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3236 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
3237 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
3239 ac_have_as_amd64_fxsave64=yes
3240 AC_MSG_RESULT([yes])
3242 ac_have_as_amd64_fxsave64=no
3245 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
3246 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
3249 # does the x86/amd64 assembler understand SSE3 instructions?
3250 # Note, this doesn't generate a C-level symbol. It generates a
3251 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
3252 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
3254 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3255 do { long long int x;
3256 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
3260 AC_MSG_RESULT([yes])
3266 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
3269 # Ditto for SSSE3 instructions (note extra S)
3270 # Note, this doesn't generate a C-level symbol. It generates a
3271 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
3272 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
3274 save_CFLAGS="$CFLAGS"
3275 CFLAGS="$CFLAGS -msse -Werror"
3276 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3277 do { long long int x;
3278 __asm__ __volatile__(
3279 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
3282 ac_have_as_ssse3=yes
3283 AC_MSG_RESULT([yes])
3288 CFLAGS="$save_CFLAGS"
3290 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
3293 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
3294 # Note, this doesn't generate a C-level symbol. It generates a
3295 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
3296 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
3297 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3299 __asm__ __volatile__(
3300 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
3303 ac_have_as_pclmulqdq=yes
3304 AC_MSG_RESULT([yes])
3306 ac_have_as_pclmulqdq=no
3310 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
3313 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
3314 # Note, this doesn't generate a C-level symbol. It generates a
3315 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
3316 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
3317 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3320 * Carry-less multiplication of xmm1 with xmm2 and store the result in
3321 * xmm3. The immediate is used to determine which quadwords of xmm1 and
3322 * xmm2 should be used.
3324 __asm__ __volatile__(
3325 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
3328 ac_have_as_vpclmulqdq=yes
3329 AC_MSG_RESULT([yes])
3331 ac_have_as_vpclmulqdq=no
3335 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
3338 # does the x86/amd64 assembler understand FMA4 instructions?
3339 # Note, this doesn't generate a C-level symbol. It generates a
3340 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
3341 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
3342 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3344 __asm__ __volatile__(
3345 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
3348 ac_have_as_vfmaddpd=yes
3349 AC_MSG_RESULT([yes])
3351 ac_have_as_vfmaddpd=no
3355 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
3358 # does the x86/amd64 assembler understand the LZCNT instruction?
3359 # Note, this doesn't generate a C-level symbol. It generates a
3360 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
3361 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
3363 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3365 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
3368 ac_have_as_lzcnt=yes
3369 AC_MSG_RESULT([yes])
3375 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
3378 # does the x86/amd64 assembler understand the LOOPNEL instruction?
3379 # Note, this doesn't generate a C-level symbol. It generates a
3380 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
3381 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
3383 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3385 __asm__ __volatile__("1: loopnel 1b\n");
3388 ac_have_as_loopnel=yes
3389 AC_MSG_RESULT([yes])
3391 ac_have_as_loopnel=no
3395 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
3398 # does the x86/amd64 assembler understand ADDR32 ?
3399 # Note, this doesn't generate a C-level symbol. It generates a
3400 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
3401 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
3403 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3405 asm volatile ("addr32 rep movsb");
3408 ac_have_as_addr32=yes
3409 AC_MSG_RESULT([yes])
3411 ac_have_as_addr32=no
3415 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
3418 # does the x86/amd64 assembler understand SSE 4.2 instructions?
3419 # Note, this doesn't generate a C-level symbol. It generates a
3420 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
3421 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
3423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3424 do { long long int x;
3425 __asm__ __volatile__(
3426 "crc32q %%r15,%%r15" : : : "r15" );
3427 __asm__ __volatile__(
3428 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
3429 __asm__ __volatile__(
3430 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
3433 ac_have_as_sse42=yes
3434 AC_MSG_RESULT([yes])
3440 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
3443 # does the x86/amd64 assembler understand AVX instructions?
3444 # Note, this doesn't generate a C-level symbol. It generates a
3445 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
3446 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
3448 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3449 do { long long int x;
3450 __asm__ __volatile__(
3451 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
3452 __asm__ __volatile__(
3453 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3457 AC_MSG_RESULT([yes])
3463 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
3466 # does the x86/amd64 assembler understand AVX2 instructions?
3467 # Note, this doesn't generate a C-level symbol. It generates a
3468 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
3469 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
3471 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3472 do { long long int x;
3473 __asm__ __volatile__(
3474 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3475 __asm__ __volatile__(
3476 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3480 AC_MSG_RESULT([yes])
3486 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
3489 # does the x86/amd64 assembler understand TSX instructions and
3490 # the XACQUIRE/XRELEASE prefixes?
3491 # Note, this doesn't generate a C-level symbol. It generates a
3492 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
3493 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
3495 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3497 __asm__ __volatile__(
3500 " xacquire lock incq 0(%rsp) \n\t"
3501 " xrelease lock incq 0(%rsp) \n"
3506 AC_MSG_RESULT([yes])
3512 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
3515 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
3516 # Note, this doesn't generate a C-level symbol. It generates a
3517 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
3518 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
3520 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3521 do { unsigned int h, l;
3522 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
3523 __asm__ __volatile__(
3524 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
3525 __asm__ __volatile__(
3526 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
3530 AC_MSG_RESULT([yes])
3536 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
3539 # does the x86/amd64 assembler understand FMA instructions?
3540 # Note, this doesn't generate a C-level symbol. It generates a
3541 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
3542 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
3544 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3545 do { unsigned int h, l;
3546 __asm__ __volatile__(
3547 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3548 __asm__ __volatile__(
3549 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
3550 __asm__ __volatile__(
3551 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
3555 AC_MSG_RESULT([yes])
3561 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
3564 # does the amd64 assembler understand MPX instructions?
3565 # Note, this doesn't generate a C-level symbol. It generates a
3566 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
3567 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
3569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3571 asm ("bndmov %bnd0,(%rsp)");
3572 asm ("bndldx 3(%rbx,%rdx), %bnd2");
3573 asm ("bnd call foo\n"
3580 AC_MSG_RESULT([yes])
3586 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
3589 # does the amd64 assembler understand ADX instructions?
3590 # Note, this doesn't generate a C-level symbol. It generates a
3591 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
3592 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
3594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3596 asm ("adcxq %r14,%r8");
3600 AC_MSG_RESULT([yes])
3606 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
3609 # does the amd64 assembler understand the RDRAND instruction?
3610 # Note, this doesn't generate a C-level symbol. It generates a
3611 # automake-level symbol (BUILD_RDRAND_TESTS), used in test Makefile.am's
3612 AC_MSG_CHECKING([if amd64 assembler knows the RDRAND instruction])
3614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3616 asm ("rdrand %r14");
3617 asm ("rdrand %r14d");
3618 asm ("rdrand %r14w");
3621 ac_have_as_rdrand=yes
3622 AC_MSG_RESULT([yes])
3624 ac_have_as_rdrand=no
3628 AM_CONDITIONAL(BUILD_RDRAND_TESTS, test x$ac_have_as_rdrand = xyes)
3630 # does the amd64 assembler understand the RDSEED instruction?
3631 # Note, this doesn't generate a C-level symbol. It generates a
3632 # automake-level symbol (BUILD_RDSEED_TESTS), used in test Makefile.am's
3633 AC_MSG_CHECKING([if amd64 assembler knows the RDSEED instruction])
3635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3637 asm ("rdseed %r14");
3638 asm ("rdseed %r14d");
3639 asm ("rdseed %r14w");
3642 ac_have_as_rdseed=yes
3643 AC_MSG_RESULT([yes])
3645 ac_have_as_rdseed=no
3649 AM_CONDITIONAL(BUILD_RDSEED_TESTS, test x$ac_have_as_rdseed = xyes)
3651 # does the amd64 assembler understand the F16C instructions (VCVTPH2PS and
3653 # Note, this doesn't generate a C-level symbol. It generates a
3654 # automake-level symbol (BUILD_F16C_TESTS), used in test Makefile.am's
3655 AC_MSG_CHECKING([if amd64 assembler knows the F16C instructions])
3657 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3659 asm ("vcvtph2ps %xmm5, %ymm10");
3660 // If we put the dollar sign and zero together, the shell processing
3661 // this configure.ac script substitutes the command name in. Sigh.
3662 asm ("vcvtps2ph $" "0, %ymm10, %xmm5");
3666 AC_MSG_RESULT([yes])
3672 AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes)
3675 # does the x86/amd64 assembler understand MOVBE?
3676 # Note, this doesn't generate a C-level symbol. It generates a
3677 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
3678 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
3680 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3681 do { long long int x;
3682 __asm__ __volatile__(
3683 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
3686 ac_have_as_movbe=yes
3687 AC_MSG_RESULT([yes])
3693 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
3696 # Does the C compiler support the "ifunc" attribute
3697 # Note, this doesn't generate a C-level symbol. It generates a
3698 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
3699 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
3701 AC_LINK_IFELSE([AC_LANG_SOURCE([[
3702 static void mytest(void) {}
3704 static void (*resolve_test(void))(void)
3706 return (void (*)(void))&mytest;
3709 void test(void) __attribute__((ifunc("resolve_test")));
3717 ac_have_ifunc_attr=yes
3718 AC_MSG_RESULT([yes])
3720 ac_have_ifunc_attr=no
3724 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
3726 # Does the C compiler support the armv8 crc feature flag
3727 # Note, this doesn't generate a C-level symbol. It generates a
3728 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
3729 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
3731 save_CFLAGS="$CFLAGS"
3732 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
3733 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3739 ac_have_armv8_crc_feature=yes
3740 AC_MSG_RESULT([yes])
3742 ac_have_armv8_crc_feature=no
3745 CFLAGS="$save_CFLAGS"
3747 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
3750 # Does the C compiler support the armv81 flag and the assembler v8.1 instructions
3751 # Note, this doesn't generate a C-level symbol. It generates a
3752 # automake-level symbol (BUILD_ARMV81_TESTS), used in test Makefile.am's
3753 AC_MSG_CHECKING([if gcc supports the armv81 feature flag and assembler supports v8.1 instructions])
3755 save_CFLAGS="$CFLAGS"
3756 CFLAGS="$CFLAGS -march=armv8.1-a -Werror"
3757 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3760 __asm__ __volatile__("ldadd x0, x1, [x2]" ::: "memory");
3764 ac_have_armv81_feature=yes
3765 AC_MSG_RESULT([yes])
3767 ac_have_armv81_feature=no
3770 CFLAGS="$save_CFLAGS"
3772 AM_CONDITIONAL(BUILD_ARMV81_TESTS, test x$ac_have_armv81_feature = xyes)
3775 # Does the C compiler support the armv82 flag and the assembler v8.2 instructions
3776 # Note, this doesn't generate a C-level symbol. It generates a
3777 # automake-level symbol (BUILD_ARMV82_TESTS), used in test Makefile.am's
3778 AC_MSG_CHECKING([if gcc supports the armv82 feature flag and assembler supports v8.2 instructions])
3780 save_CFLAGS="$CFLAGS"
3781 CFLAGS="$CFLAGS -march=armv8.2-a+fp16 -Werror"
3782 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3785 __asm__ __volatile__("faddp h0, v1.2h");
3789 ac_have_armv82_feature=yes
3790 AC_MSG_RESULT([yes])
3792 ac_have_armv82_feature=no
3795 CFLAGS="$save_CFLAGS"
3797 AM_CONDITIONAL(BUILD_ARMV82_TESTS, test x$ac_have_armv82_feature = xyes)
3800 # Does the C compiler support the armv82-a+dotprod flag and assembler dotprod instructions
3801 # Note, this doesn't generate a C-level symbol. It generates a
3802 # automake-level symbol (BUILD_ARMV82_DOTPROD_TESTS), used in test Makefile.am's
3803 AC_MSG_CHECKING([if gcc supports the armv82-a+dotprod feature flag and assembler supports dotprod instructions])
3805 save_CFLAGS="$CFLAGS"
3806 CFLAGS="$CFLAGS -march=armv8.2-a+dotprod -Werror"
3807 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3810 __asm__ __volatile__("sdot v1.4s, v2.16b, v3.16b");
3814 ac_have_armv82_dotprod_feature=yes
3815 AC_MSG_RESULT([yes])
3817 ac_have_armv82_dotprod_feature=no
3820 CFLAGS="$save_CFLAGS"
3822 AM_CONDITIONAL(BUILD_ARMV82_DOTPROD_TESTS, test x$ac_have_armv82_dotprod_feature = xyes)
3825 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
3826 # when building the tool executables. I think we should get rid of it.
3828 # Check for TLS support in the compiler and linker
3829 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3831 [vg_cv_linktime_tls=yes],
3832 [vg_cv_linktime_tls=no])
3833 # Native compilation: check whether running a program using TLS succeeds.
3834 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
3835 # succeeds but running programs using TLS fails.
3836 # Cross-compiling: check whether linking a program using TLS succeeds.
3837 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
3838 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
3839 [vg_cv_tls=$enableval],
3840 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3844 [vg_cv_tls=$vg_cv_linktime_tls])])])
3846 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
3847 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
3851 #----------------------------------------------------------------------------
3852 # Solaris-specific checks.
3853 #----------------------------------------------------------------------------
3855 if test "$VGCONF_OS" = "solaris" ; then
3856 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
3858 # Solaris-specific check determining if the Sun Studio Assembler is used to
3859 # build Valgrind. The test checks if the x86/amd64 assembler understands the
3860 # cmovl.l instruction, if yes then it's Sun Assembler.
3862 # C-level symbol: none
3863 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
3865 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
3866 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3868 __asm__ __volatile__("cmovl.l %edx, %eax");
3870 solaris_have_sun_studio_as=yes
3871 AC_MSG_RESULT([yes])
3873 solaris_have_sun_studio_as=no
3876 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
3878 # Solaris-specific check determining if symbols __xpg4 and __xpg6
3879 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
3880 # See solaris/vgpreload-solaris.mapfile for details.
3881 # gcc on older Solaris instructs linker to include these symbols,
3882 # gcc on illumos and newer Solaris does not.
3884 # C-level symbol: none
3885 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
3887 save_CFLAGS="$CFLAGS"
3888 CFLAGS="$CFLAGS -std=gnu99"
3889 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
3890 temp_dir=$( /usr/bin/mktemp -d )
3891 cat <<_ACEOF >${temp_dir}/mylib.c
3893 int myfunc(void) { printf("LaPutyka\n"); }
3895 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
3896 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
3897 if test "x${xpg_present}" = "x" ; then
3898 solaris_xpg_symbols_present=no
3901 solaris_xpg_symbols_present=yes
3902 AC_MSG_RESULT([yes])
3905 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
3906 CFLAGS="$save_CFLAGS"
3909 # Solaris-specific check determining if gcc enables largefile support by
3910 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
3911 # variable with gcc flags which disable it.
3913 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
3914 save_CFLAGS="$CFLAGS"
3915 CFLAGS="$CFLAGS -m32"
3916 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3917 return _LARGEFILE_SOURCE;
3919 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
3920 AC_MSG_RESULT([yes])
3922 SOLARIS_UNDEF_LARGESOURCE=""
3926 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
3929 # Solaris-specific check determining if /proc/self/cmdline
3930 # or /proc/<pid>/cmdline is supported.
3932 # C-level symbol: SOLARIS_PROC_CMDLINE
3933 # Automake-level symbol: SOLARIS_PROC_CMDLINE
3935 AC_CHECK_FILE([/proc/self/cmdline],
3937 solaris_proc_cmdline=yes
3938 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
3939 [Define to 1 if you have /proc/self/cmdline.])
3941 solaris_proc_cmdline=no
3943 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3946 # Solaris-specific check determining default platform for the Valgrind launcher.
3947 # Used in case the launcher cannot select platform by looking at the client
3948 # image (for example because the executable is a shell script).
3950 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3951 # Automake-level symbol: none
3953 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3954 # Get the ELF class of /bin/sh first.
3955 if ! test -f /bin/sh; then
3956 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3958 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3959 case "$elf_class" in
3961 default_arch="$VGCONF_ARCH_PRI";
3964 if test "x$VGCONF_ARCH_SEC" != "x"; then
3965 default_arch="$VGCONF_ARCH_SEC"
3967 default_arch="$VGCONF_ARCH_PRI";
3971 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3974 default_platform="$default_arch-$VGCONF_OS"
3975 AC_MSG_RESULT([$default_platform])
3976 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3977 [Default platform for Valgrind launcher.])
3980 # Solaris-specific check determining if the old syscalls are available.
3982 # C-level symbol: SOLARIS_OLD_SYSCALLS
3983 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3985 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3987 #include <sys/syscall.h>
3991 solaris_old_syscalls=yes
3992 AC_MSG_RESULT([yes])
3993 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3994 [Define to 1 if you have the old Solaris syscalls.])
3996 solaris_old_syscalls=no
3999 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
4002 # Solaris-specific check determining if the new accept() syscall is available.
4005 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
4008 # New syscall (available on illumos):
4009 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
4010 # int version, int flags);
4012 # If the old syscall is present then the following syscall will fail with
4013 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
4014 # available then it will fail with EINVAL (because the flags parameter is
4017 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
4018 # Automake-level symbol: none
4020 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
4021 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4022 #include <sys/syscall.h>
4026 syscall(SYS_accept, 0, 0, 0, 0, -1);
4027 return !(errno == EINVAL);
4029 AC_MSG_RESULT([yes])
4030 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
4031 [Define to 1 if you have the new `accept' syscall.])
4037 # Solaris-specific check determining if the new illumos pipe() syscall is
4041 # longlong_t pipe();
4043 # New syscall (available on illumos):
4044 # int pipe(intptr_t arg, int flags);
4046 # If the old syscall is present then the following call will succeed, if the
4047 # new syscall is available then it will fail with EFAULT (because address 0
4048 # cannot be accessed).
4050 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
4051 # Automake-level symbol: none
4053 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
4054 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4055 #include <sys/syscall.h>
4059 syscall(SYS_pipe, 0, 0);
4060 return !(errno == EFAULT);
4062 AC_MSG_RESULT([yes])
4063 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
4064 [Define to 1 if you have the new `pipe' syscall.])
4070 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
4074 # int lwp_kill(id_t lwpid, int sig);
4076 # New syscall (available on Solaris 11):
4077 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
4078 # int si_code, timespec_t *timeout);
4080 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
4081 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
4083 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
4084 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4085 #include <sys/syscall.h>
4087 return !SYS_lwp_sigqueue;
4089 solaris_lwp_sigqueue_syscall=yes
4090 AC_MSG_RESULT([yes])
4091 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
4092 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
4094 solaris_lwp_sigqueue_syscall=no
4097 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
4100 # Solaris-specific check determining if the lwp_sigqueue() syscall
4101 # takes both pid and thread id arguments or just thread id.
4103 # Old syscall (available up to Solaris 11.3):
4104 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
4105 # int si_code, timespec_t *timeout);
4107 # New syscall (available since Solaris 11.4):
4108 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
4109 # int si_code, timespec_t *timeout);
4111 # If the old syscall is present then the following syscall will fail with
4112 # EINVAL (because signal is out of range); if the new syscall is available
4113 # then it will fail with ESRCH (because it would not find such thread in the
4116 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4117 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4119 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
4120 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
4121 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4122 #include <sys/syscall.h>
4126 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
4127 return !(errno == ESRCH);
4129 solaris_lwp_sigqueue_syscall_takes_pid=yes
4130 AC_MSG_RESULT([yes])
4131 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
4132 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
4134 solaris_lwp_sigqueue_syscall_takes_pid=no
4137 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
4138 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
4140 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
4144 # Solaris-specific check determining if the new lwp_name() syscall is
4147 # New syscall (available on Solaris 11):
4148 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
4150 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
4151 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
4153 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
4154 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4155 #include <sys/syscall.h>
4157 return !SYS_lwp_name;
4159 solaris_lwp_name_syscall=yes
4160 AC_MSG_RESULT([yes])
4161 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
4162 [Define to 1 if you have the new `lwp_name' syscall.])
4164 solaris_lwp_name_syscall=no
4167 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
4170 # Solaris-specific check determining if the new getrandom() syscall is
4173 # New syscall (available on Solaris 11):
4174 # int getrandom(void *buf, size_t buflen, uint_t flags);
4176 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
4177 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
4179 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
4180 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4181 #include <sys/syscall.h>
4183 return !SYS_getrandom;
4185 solaris_getrandom_syscall=yes
4186 AC_MSG_RESULT([yes])
4187 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
4188 [Define to 1 if you have the new `getrandom' syscall.])
4190 solaris_getrandom_syscall=no
4193 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
4196 # Solaris-specific check determining if the new zone() syscall subcodes
4197 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
4198 # were added in Solaris 11 but are missing on illumos.
4200 # C-level symbol: SOLARIS_ZONE_DEFUNCT
4201 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
4203 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
4204 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4205 #include <sys/zone.h>
4207 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
4209 solaris_zone_defunct=yes
4210 AC_MSG_RESULT([yes])
4211 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
4212 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
4214 solaris_zone_defunct=no
4217 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
4220 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
4221 # for auditon(2) subcode of the auditsys() syscall are available.
4222 # These commands are available in Solaris 11 and illumos but were removed
4225 # C-level symbol: SOLARIS_AUDITON_STAT
4226 # Automake-level symbol: SOLARIS_AUDITON_STAT
4228 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
4229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4230 #include <bsm/audit.h>
4232 return !(A_GETSTAT && A_SETSTAT);
4234 solaris_auditon_stat=yes
4235 AC_MSG_RESULT([yes])
4236 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
4237 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
4239 solaris_auditon_stat=no
4242 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
4245 # Solaris-specific check determining if the new shmsys() syscall subcodes
4246 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
4247 # These subcodes were added in Solaris 11 but are missing on illumos.
4249 # C-level symbol: SOLARIS_SHM_NEW
4250 # Automake-level symbol: SOLARIS_SHM_NEW
4252 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
4253 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4254 #include <sys/ipc_impl.h>
4255 #include <sys/shm.h>
4256 #include <sys/shm_impl.h>
4258 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
4261 AC_MSG_RESULT([yes])
4262 AC_DEFINE([SOLARIS_SHM_NEW], 1,
4263 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
4268 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
4271 # Solaris-specific check determining if prxregset_t is available. Illumos
4272 # currently does not define it on the x86 platform.
4274 # C-level symbol: SOLARIS_PRXREGSET_T
4275 # Automake-level symbol: SOLARIS_PRXREGSET_T
4277 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
4278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4279 #include <sys/procfs_isa.h>
4281 return !sizeof(prxregset_t);
4283 solaris_prxregset_t=yes
4284 AC_MSG_RESULT([yes])
4285 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
4286 [Define to 1 if you have the `prxregset_t' type.])
4288 solaris_prxregset_t=no
4291 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
4294 # Solaris-specific check determining if the new frealpathat() syscall is
4297 # New syscall (available on Solaris 11.1):
4298 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
4300 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4301 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4303 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
4304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4305 #include <sys/syscall.h>
4307 return !SYS_frealpathat;
4309 solaris_frealpathat_syscall=yes
4310 AC_MSG_RESULT([yes])
4311 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
4312 [Define to 1 if you have the new `frealpathat' syscall.])
4314 solaris_frealpathat_syscall=no
4317 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
4320 # Solaris-specific check determining if the new uuidsys() syscall is
4323 # New syscall (available on newer Solaris):
4324 # int uuidsys(struct uuid *uuid);
4326 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
4327 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
4329 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
4330 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4331 #include <sys/syscall.h>
4333 return !SYS_uuidsys;
4335 solaris_uuidsys_syscall=yes
4336 AC_MSG_RESULT([yes])
4337 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
4338 [Define to 1 if you have the new `uuidsys' syscall.])
4340 solaris_uuidsys_syscall=no
4343 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
4346 # Solaris-specific check determining if the new labelsys() syscall subcode
4347 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
4348 # missing on illumos.
4350 # C-level symbol: SOLARIS_TNDB_GET_TNIP
4351 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
4353 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
4354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4355 #include <sys/tsol/tndb.h>
4357 return !TNDB_GET_TNIP;
4359 solaris_tndb_get_tnip=yes
4360 AC_MSG_RESULT([yes])
4361 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
4362 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
4364 solaris_tndb_get_tnip=no
4367 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
4370 # Solaris-specific check determining if the new labelsys() syscall opcodes
4371 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
4372 # added in Solaris 11 but are missing on illumos.
4374 # C-level symbol: SOLARIS_TSOL_CLEARANCE
4375 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
4377 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
4378 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4379 #include <sys/tsol/tsyscall.h>
4381 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
4383 solaris_tsol_clearance=yes
4384 AC_MSG_RESULT([yes])
4385 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
4386 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
4388 solaris_tsol_clearance=no
4391 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
4394 # Solaris-specific check determining if the new pset() syscall subcode
4395 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
4396 # is missing on illumos and Solaris 11.3.
4398 # C-level symbol: SOLARIS_PSET_GET_NAME
4399 # Automake-level symbol: SOLARIS_PSET_GET_NAME
4401 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
4402 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4403 #include <sys/pset.h>
4405 return !(PSET_GET_NAME);
4407 solaris_pset_get_name=yes
4408 AC_MSG_RESULT([yes])
4409 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
4410 [Define to 1 if you have the `PSET_GET_NAME' constants.])
4412 solaris_pset_get_name=no
4415 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
4418 # Solaris-specific check determining if the utimesys() syscall is
4419 # available (on illumos and older Solaris).
4421 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
4422 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
4424 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
4425 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4426 #include <sys/syscall.h>
4428 return !SYS_utimesys;
4430 solaris_utimesys_syscall=yes
4431 AC_MSG_RESULT([yes])
4432 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
4433 [Define to 1 if you have the `utimesys' syscall.])
4435 solaris_utimesys_syscall=no
4438 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
4441 # Solaris-specific check determining if the utimensat() syscall is
4442 # available (on newer Solaris).
4444 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4445 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4447 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
4448 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4449 #include <sys/syscall.h>
4451 return !SYS_utimensat;
4453 solaris_utimensat_syscall=yes
4454 AC_MSG_RESULT([yes])
4455 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
4456 [Define to 1 if you have the `utimensat' syscall.])
4458 solaris_utimensat_syscall=no
4461 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
4464 # Solaris-specific check determining if the spawn() syscall is available
4465 # (on newer Solaris).
4467 # C-level symbol: SOLARIS_SPAWN_SYSCALL
4468 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
4470 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
4471 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4472 #include <sys/syscall.h>
4476 solaris_spawn_syscall=yes
4477 AC_MSG_RESULT([yes])
4478 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
4479 [Define to 1 if you have the `spawn' syscall.])
4481 solaris_spawn_syscall=no
4484 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
4487 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
4488 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
4490 # C-level symbol: SOLARIS_MODCTL_MODNVL
4491 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
4493 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
4494 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4495 #include <sys/modctl.h>
4497 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
4499 solaris_modctl_modnvl=yes
4500 AC_MSG_RESULT([yes])
4501 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
4502 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
4504 solaris_modctl_modnvl=no
4507 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
4510 # Solaris-specific check determining whether nscd (name switch cache daemon)
4511 # attaches its door at /system/volatile/name_service_door (Solaris)
4512 # or at /var/run/name_service_door (illumos).
4514 # Note that /var/run is a symlink to /system/volatile on Solaris
4515 # but not vice versa on illumos.
4517 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4518 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4520 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
4521 if test -e /system/volatile/name_service_door; then
4522 solaris_nscd_door_system_volatile=yes
4523 AC_MSG_RESULT([/system/volatile/name_service_door])
4524 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
4525 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
4527 solaris_nscd_door_system_volatile=no
4528 AC_MSG_RESULT([/var/run/name_service_door])
4530 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
4533 # Solaris-specific check determining if the new gethrt() fasttrap is available.
4535 # New fasttrap (available on Solaris 11):
4536 # hrt_t *gethrt(void);
4538 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
4539 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
4541 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
4542 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4543 #include <sys/trap.h>
4547 solaris_gethrt_fasttrap=yes
4548 AC_MSG_RESULT([yes])
4549 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
4550 [Define to 1 if you have the new `gethrt' fasttrap.])
4552 solaris_gethrt_fasttrap=no
4555 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
4558 # Solaris-specific check determining if the new get_zone_offset() fasttrap
4561 # New fasttrap (available on Solaris 11):
4562 # zonehrtoffset_t *get_zone_offset(void);
4564 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4565 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4567 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
4568 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4569 #include <sys/trap.h>
4571 return !T_GETZONEOFFSET;
4573 solaris_getzoneoffset_fasttrap=yes
4574 AC_MSG_RESULT([yes])
4575 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
4576 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
4578 solaris_getzoneoffset_fasttrap=no
4581 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
4584 # Solaris-specific check determining if the execve() syscall
4585 # takes fourth argument (flags) or not.
4587 # Old syscall (available on illumos):
4588 # int execve(const char *fname, const char **argv, const char **envp);
4590 # New syscall (available on Solaris):
4591 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
4593 # If the new syscall is present then it will fail with EINVAL (because flags
4594 # are invalid); if the old syscall is available then it will fail with ENOENT
4595 # (because the file could not be found).
4597 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4598 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4600 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
4601 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4602 #include <sys/syscall.h>
4606 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
4607 return !(errno == EINVAL);
4609 solaris_execve_syscall_takes_flags=yes
4610 AC_MSG_RESULT([yes])
4611 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
4612 [Define to 1 if you have the new `execve' syscall which accepts flags.])
4614 solaris_execve_syscall_takes_flags=no
4617 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
4618 test x$solaris_execve_syscall_takes_flags = xyes)
4621 # Solaris-specific check determining version of the repository cache protocol.
4622 # Every Solaris version uses a different one, ranging from 21 to current 25.
4623 # The check is very ugly, though.
4625 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
4626 # Automake-level symbol: none
4628 AC_PATH_PROG(DIS_PATH, dis, false)
4629 if test "x$DIS_PATH" = "xfalse"; then
4630 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
4632 # The illumos source is (or was) here
4633 # https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libscf/common/lowlevel.c#L1148
4634 # specifically the line
4636 # request.rdr_version = REPOSITORY_DOOR_VERSION;
4638 # rdr_version is a 32bit unsigned int
4639 # The macro REPOSITORY_DOOR_VERSION contains the ascii letters "Rep" in the top 3
4640 # bytes and the door version in the lowest byte. Hence we look for Rep which is 526570
4641 # in hex and then extrace the following byte.
4642 AC_CHECK_LIB(scf, scf_handle_bind, [], [
4643 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
4644 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4647 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
4648 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
4649 libscf=/usr/lib/64/libscf.so.1
4651 libscf=/usr/lib/libscf.so.1
4653 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q -E '0x(4d01)?526570'; then
4654 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
4655 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4657 hex=$( $DIS_PATH -F scf_handle_bind $libscf | grep 526570 | sed 's/.*526570//;s/,.*//' )
4658 if test -z "$hex"; then
4659 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
4660 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4662 version=$( printf "%d\n" 0x$hex )
4663 AC_MSG_RESULT([$version])
4664 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
4665 [Version number of the repository door cache protocol.])
4668 # Solaris-specific check determining if "sysstat" segment reservation type
4671 # New "sysstat" segment reservation (available on Solaris 11.4):
4672 # - program header type: PT_SUNW_SYSSTAT
4673 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
4675 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4676 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4678 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
4679 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4680 #include <sys/auxv.h>
4682 return !AT_SUN_SYSSTAT_ADDR;
4684 solaris_reserve_sysstat_addr=yes
4685 AC_MSG_RESULT([yes])
4686 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
4687 [Define to 1 if you have the new `sysstat' segment reservation.])
4689 solaris_reserve_sysstat_addr=no
4692 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
4695 # Solaris-specific check determining if "sysstat_zone" segment reservation type
4698 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
4699 # - program header type: PT_SUNW_SYSSTAT_ZONE
4700 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
4702 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4703 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4705 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
4706 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4707 #include <sys/auxv.h>
4709 return !AT_SUN_SYSSTAT_ZONE_ADDR;
4711 solaris_reserve_sysstat_zone_addr=yes
4712 AC_MSG_RESULT([yes])
4713 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
4714 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
4716 solaris_reserve_sysstat_zone_addr=no
4719 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
4722 # Solaris-specific check determining if the system_stats() syscall is available
4723 # (on newer Solaris).
4725 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4726 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4728 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
4729 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4730 #include <sys/syscall.h>
4732 return !SYS_system_stats;
4734 solaris_system_stats_syscall=yes
4735 AC_MSG_RESULT([yes])
4736 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
4737 [Define to 1 if you have the `system_stats' syscall.])
4739 solaris_system_stats_syscall=no
4742 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
4745 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
4746 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
4748 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
4749 # Automake-level symbol: none
4751 AC_CHECK_TYPE([struct _fpchip_state],
4752 [solaris_fpchip_state_takes_underscore=yes],
4753 [solaris_fpchip_state_takes_underscore=no],
4754 [[#include <sys/regset.h>]])
4755 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
4756 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
4757 [Define to 1 if fpregset_t defines struct _fpchip_state])
4761 # Solaris-specific check determining if schedctl page shared between kernel
4762 # and userspace program is executable (illumos, older Solaris) or not (newer
4765 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
4766 # Automake-level symbol: none
4768 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
4769 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4773 #include <schedctl.h>
4777 schedctl_t *scp = schedctl_init();
4781 int fd = open("/proc/self/map", O_RDONLY);
4786 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
4787 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
4788 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
4789 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
4790 return (map.pr_mflags & MA_EXEC);
4796 solaris_schedctl_page_exec=no
4799 solaris_schedctl_page_exec=yes
4800 AC_MSG_RESULT([yes])
4801 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
4802 [Define to 1 if you have the schedctl page executable.])
4806 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
4807 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
4808 # an initial thread pointer for libc (newer Solaris).
4810 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
4811 # Automake-level symbol: none
4813 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
4814 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4815 #include <sys/fasttrap_isa.h>
4817 return !FT_SCRATCHSIZE;
4819 solaris_pt_sunwdtrace_thrp=yes
4820 AC_MSG_RESULT([yes])
4821 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
4822 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
4824 solaris_pt_sunwdtrace_thrp=no
4829 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
4830 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
4831 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
4832 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
4833 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
4834 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
4835 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
4836 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
4837 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
4838 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
4839 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
4840 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
4841 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
4842 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
4843 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
4844 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
4845 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
4846 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
4847 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
4848 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
4849 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
4850 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
4851 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
4852 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
4853 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
4854 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
4855 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
4856 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
4857 fi # test "$VGCONF_OS" = "solaris"
4859 #----------------------------------------------------------------------------
4860 # FreeBSD-specific checks.
4861 #----------------------------------------------------------------------------
4863 # Rather than having a large number of feature test as above with Solaris
4864 # these tests are per-version. This may not be entirely reliable for
4865 # FreeBSD development branches (XX.Y-CURRENT) or pre-release branches
4866 # (XX.Y-STABLE) but it should work for XX-Y-RELEASE
4868 if test "$VGCONF_OS" = "freebsd" ; then
4870 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13_0)
4871 AM_CONDITIONAL(FREEBSD_VERS_15_PLUS, test $freebsd_vers -ge $freebsd_15)
4875 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, false)
4876 AM_CONDITIONAL(FREEBSD_VERS_15_PLUS, false)
4878 fi # test "$VGCONF_OS" = "freebsd"
4881 #----------------------------------------------------------------------------
4882 # Checks for C header files.
4883 #----------------------------------------------------------------------------
4885 AC_CHECK_HEADERS([ \
4903 # Verify whether the <linux/futex.h> header is usable.
4904 AC_MSG_CHECKING([if <linux/futex.h> is usable])
4906 save_CFLAGS="$CFLAGS"
4907 CFLAGS="$CFLAGS -D__user="
4908 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4909 #include <linux/futex.h>
4913 ac_have_usable_linux_futex_h=yes
4914 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
4915 [Define to 1 if you have a usable <linux/futex.h> header file.])
4916 AC_MSG_RESULT([yes])
4918 ac_have_usable_linux_futex_h=no
4921 CFLAGS="$save_CFLAGS"
4924 #----------------------------------------------------------------------------
4925 # Checks for typedefs, structures, and compiler characteristics.
4926 #----------------------------------------------------------------------------
4930 AC_CHECK_HEADERS_ONCE([sys/time.h])
4932 AC_CHECK_TYPE([struct statx], [
4933 AC_DEFINE([HAVE_STRUCT_STATX_IN_SYS_STAT_H], 1,
4934 [Define to 1 if <sys/stat.h> declares struct statx.])
4937 #include <sys/stat.h>
4941 #----------------------------------------------------------------------------
4942 # Checks for library functions.
4943 #----------------------------------------------------------------------------
4947 AC_CHECK_LIB([pthread], [pthread_create])
4948 AC_CHECK_LIB([rt], [clock_gettime])
4970 pthread_barrier_init \
4971 pthread_condattr_setclock \
4972 pthread_mutex_timedlock \
4973 pthread_rwlock_timedrdlock \
4974 pthread_rwlock_timedwrlock \
4975 pthread_setname_np \
5004 free_aligned_sized \
5012 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
5013 # libraries with any shared object and/or executable. This is NOT what we
5014 # want for e.g. vgpreload_core-x86-linux.so
5017 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
5018 [test x$ac_cv_func_pthread_barrier_init = xyes])
5019 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
5020 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
5021 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
5022 [test x$ac_cv_func_pthread_spin_lock = xyes])
5023 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
5024 [test x$ac_cv_func_pthread_setname_np = xyes])
5025 AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
5026 [test x$ac_cv_func_copy_file_range = xyes])
5027 AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
5028 [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
5029 AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
5030 [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes])
5031 AM_CONDITIONAL([HAVE_SETCONTEXT], [test x$ac_cv_func_setcontext = xyes])
5032 AM_CONDITIONAL([HAVE_SWAPCONTEXT], [test x$ac_cv_func_swapcontext = xyes])
5033 AM_CONDITIONAL([HAVE_MEMFD_CREATE],
5034 [test x$ac_cv_func_memfd_create = xyes])
5035 AM_CONDITIONAL([HAVE_GETADDRINFO],
5036 [test x$ac_cv_func_getaddrinfo = xyes])
5037 AM_CONDITIONAL([HAVE_CLOSE_RANGE],
5038 [test x$ac_cv_func_close_range = xyes])
5039 AM_CONDITIONAL([HAVE_REALLOCARRAY],
5040 [test x$ac_cv_func_reallocarray = xyes])
5041 AM_CONDITIONAL([HAVE_WCSNCPY],
5042 [test x$ac_cv_func_wcsncpy = xyes])
5043 AM_CONDITIONAL([HAVE_STRLCAT],
5044 [test x$ac_cv_func_strlcat = xyes])
5045 AM_CONDITIONAL([HAVE_STRLCPY],
5046 [test x$ac_cv_func_strlcpy = xyes])
5047 AM_CONDITIONAL([HAVE_FREE_ALIGNED_SIZED],
5048 [test x$ac_cv_func_free_aligned_sized = xyes])
5049 AM_CONDITIONAL([HAVE_SBRK],
5050 [test x$ac_cv_func_sbrk = xyes])
5051 AM_CONDITIONAL([HAVE_WCPNCPY],
5052 [test x$ac_cv_func_wcpncpy = xyes])
5053 AM_CONDITIONAL([HAVE_WCSXFRM],
5054 [test x$ac_cv_func_wcsxfrm = xyes])
5055 AM_CONDITIONAL([HAVE_SEM_TIMEDWAIT],
5056 [test x$ac_cv_func_sem_timedwait = xyes])
5057 AM_CONDITIONAL([HAVE_SEM_CLOCKWAIT_NP],
5058 [test x$ac_cv_func_sem_clockwait_np = xyes])
5060 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5061 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5062 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX; then
5063 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
5064 [Disable intercept pthread_spin_lock() on MIPS32, MIPS64 and nanoMIPS.])
5067 #----------------------------------------------------------------------------
5069 #----------------------------------------------------------------------------
5070 # Do we have a useable MPI setup on the primary and/or secondary targets?
5071 # On Linux, by default, assumes mpicc and -m32/-m64
5072 # Note: this is a kludge in that it assumes the specified mpicc
5073 # understands -m32/-m64 regardless of what is specified using
5075 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
5076 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
5079 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
5080 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
5081 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
5082 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
5083 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5084 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX \
5085 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
5086 mflag_primary=$FLAG_M32
5087 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
5088 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
5089 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
5090 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
5091 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_FREEBSD \
5092 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5093 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
5094 mflag_primary=$FLAG_M64
5095 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
5096 mflag_primary="$FLAG_M32 -arch i386"
5097 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
5098 mflag_primary="$FLAG_M64 -arch x86_64"
5102 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
5103 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
5104 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
5105 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX \
5106 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD ; then
5107 mflag_secondary=$FLAG_M32
5108 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
5109 mflag_secondary="$FLAG_M32 -arch i386"
5114 [ --with-mpicc= Specify name of MPI2-ised C compiler],
5119 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
5120 ## use these values in the check for a functioning mpicc.
5122 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
5123 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
5124 AM_COND_IF([VGCONF_OS_IS_LINUX],
5125 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5126 LDFLAGS_MPI="-fpic -shared"])
5127 AM_COND_IF([VGCONF_OS_IS_FREEBSD],
5128 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5129 LDFLAGS_MPI="-fpic -shared"])
5130 AM_COND_IF([VGCONF_OS_IS_DARWIN],
5131 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
5132 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
5133 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
5134 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5135 LDFLAGS_MPI="-fpic -shared"])
5137 AC_SUBST([CFLAGS_MPI])
5138 AC_SUBST([LDFLAGS_MPI])
5141 ## See if MPI_CC works for the primary target
5143 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
5145 saved_CFLAGS=$CFLAGS
5147 CFLAGS="$CFLAGS_MPI $mflag_primary"
5148 saved_LDFLAGS="$LDFLAGS"
5149 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
5150 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5154 int ni, na, nd, comb;
5155 int r = MPI_Init(NULL,NULL);
5156 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5157 r |= MPI_Finalize();
5160 ac_have_mpi2_pri=yes
5161 AC_MSG_RESULT([yes, $MPI_CC])
5167 CFLAGS=$saved_CFLAGS
5168 LDFLAGS="$saved_LDFLAGS"
5169 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
5171 ## See if MPI_CC works for the secondary target. Complication: what if
5172 ## there is no secondary target? We need this to then fail.
5173 ## Kludge this by making MPI_CC something which will surely fail in
5176 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
5178 saved_CFLAGS=$CFLAGS
5179 saved_LDFLAGS="$LDFLAGS"
5180 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
5181 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
5182 CC="$MPI_CC this will surely fail"
5186 CFLAGS="$CFLAGS_MPI $mflag_secondary"
5187 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5191 int ni, na, nd, comb;
5192 int r = MPI_Init(NULL,NULL);
5193 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5194 r |= MPI_Finalize();
5197 ac_have_mpi2_sec=yes
5198 AC_MSG_RESULT([yes, $MPI_CC])
5204 CFLAGS=$saved_CFLAGS
5205 LDFLAGS="$saved_LDFLAGS"
5206 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
5208 #----------------------------------------------------------------------------
5210 #----------------------------------------------------------------------------
5211 AC_MSG_CHECKING([if static libc is available])
5213 saved_LDFLAGS="$LDFLAGS"
5214 LDFLAGS="-nostdlib -lc -static"
5215 AC_LINK_IFELSE([AC_LANG_SOURCE([[
5220 ac_have_static_libc=yes
5221 AC_MSG_RESULT([yes])
5223 ac_have_static_libc=no
5226 LDFLAGS="$saved_LDFLAGS"
5227 AM_CONDITIONAL(HAVE_STATIC_LIBC, test x$ac_have_static_libc = xyes)
5230 #----------------------------------------------------------------------------
5231 # Other library checks
5232 #----------------------------------------------------------------------------
5233 # There now follow some tests for Boost, and OpenMP. These
5234 # tests are present because Drd has some regression tests that use
5235 # these packages. All regression test programs all compiled only
5236 # for the primary target. And so it is important that the configure
5237 # checks that follow, use the correct -m32 or -m64 flag for the
5238 # primary target (called $mflag_primary). Otherwise, we can end up
5239 # in a situation (eg) where, on amd64-linux, the test for Boost checks
5240 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
5241 # only build (meaning, the primary target is x86-linux), the build
5242 # of the regtest programs that use Boost fails, because they are
5243 # build as 32-bit (IN THIS EXAMPLE).
5245 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
5246 # NEEDED BY THE REGRESSION TEST PROGRAMS.
5249 # Check whether the boost library 1.35 or later has been installed.
5250 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
5252 AC_MSG_CHECKING([for boost])
5255 safe_CXXFLAGS=$CXXFLAGS
5256 CXXFLAGS="$mflag_primary"
5258 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
5260 AC_LINK_IFELSE([AC_LANG_SOURCE([
5261 #include <boost/thread.hpp>
5262 static void thread_func(void)
5264 int main(int argc, char** argv)
5266 boost::thread t(thread_func);
5271 ac_have_boost_1_35=yes
5272 AC_SUBST([BOOST_CFLAGS], [])
5273 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
5274 AC_MSG_RESULT([yes])
5276 ac_have_boost_1_35=no
5281 CXXFLAGS=$safe_CXXFLAGS
5284 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
5287 # does this compiler support -fopenmp, does it have the include file
5288 # <omp.h> and does it have libgomp ?
5290 AC_MSG_CHECKING([for OpenMP])
5293 CFLAGS="-fopenmp $mflag_primary -Werror"
5295 AC_LINK_IFELSE([AC_LANG_SOURCE([
5297 int main(int argc, char** argv)
5305 AC_MSG_RESULT([yes])
5312 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
5315 # Check for __builtin_popcount
5316 AC_MSG_CHECKING([for __builtin_popcount()])
5317 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5319 __builtin_popcount(2);
5322 AC_MSG_RESULT([yes])
5323 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
5324 [Define to 1 if compiler provides __builtin_popcount().])
5329 # Check for __builtin_clz
5330 AC_MSG_CHECKING([for __builtin_clz()])
5331 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5336 AC_MSG_RESULT([yes])
5337 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
5338 [Define to 1 if compiler provides __builtin_clz().])
5343 # Check for __builtin_ctz
5344 AC_MSG_CHECKING([for __builtin_ctz()])
5345 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5350 AC_MSG_RESULT([yes])
5351 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
5352 [Define to 1 if compiler provides __builtin_ctz().])
5357 # does this compiler have built-in functions for atomic memory access for the
5359 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
5362 CFLAGS="$mflag_primary"
5364 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5366 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5367 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5369 ac_have_builtin_atomic_primary=yes
5370 AC_MSG_RESULT([yes])
5371 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])
5373 ac_have_builtin_atomic_primary=no
5379 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
5380 [test x$ac_have_builtin_atomic_primary = xyes])
5383 # does this compiler have built-in functions for atomic memory access for the
5384 # secondary target ?
5386 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5388 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
5391 CFLAGS="$mflag_secondary"
5393 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5395 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
5397 ac_have_builtin_atomic_secondary=yes
5398 AC_MSG_RESULT([yes])
5400 ac_have_builtin_atomic_secondary=no
5408 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
5409 [test x$ac_have_builtin_atomic_secondary = xyes])
5411 # does this compiler have built-in functions for atomic memory access on
5412 # 64-bit integers for all targets ?
5414 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
5416 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5419 uint64_t variable = 1;
5420 return __sync_add_and_fetch(&variable, 1)
5422 ac_have_builtin_atomic64_primary=yes
5424 ac_have_builtin_atomic64_primary=no
5427 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5430 CFLAGS="$mflag_secondary"
5432 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5435 uint64_t variable = 1;
5436 return __sync_add_and_fetch(&variable, 1)
5438 ac_have_builtin_atomic64_secondary=yes
5440 ac_have_builtin_atomic64_secondary=no
5447 if test x$ac_have_builtin_atomic64_primary = xyes && \
5448 test x$VGCONF_PLATFORM_SEC_CAPS = x \
5449 -o x$ac_have_builtin_atomic64_secondary = xyes; then
5450 AC_MSG_RESULT([yes])
5451 ac_have_builtin_atomic64=yes
5454 ac_have_builtin_atomic64=no
5457 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
5458 [test x$ac_have_builtin_atomic64 = xyes])
5461 AC_MSG_CHECKING([if platform has openat2 syscall])
5463 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5464 #include <sys/syscall.h>
5469 AC_MSG_RESULT([yes])
5475 AM_CONDITIONAL([HAVE_OPENAT2],
5476 [test x$ac_have_openat2 = xyes])
5482 AC_MSG_CHECKING([if platform has openssl crypto])
5484 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5485 #include <openssl/crypto.h>
5487 CRYPTO_secure_malloc_init(1<<20, 8);
5490 AC_MSG_RESULT([yes])
5497 AM_CONDITIONAL([HAVE_OPENSSL],
5498 [test x$ac_have_openssl = xyes])
5500 AC_MSG_CHECKING([if platform has aio_readv])
5502 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5508 ac_have_aio_readv=yes
5509 AC_MSG_RESULT([yes])
5512 ac_have_aio_readv=no
5516 AM_CONDITIONAL([HAVE_AIO_READV],
5517 [test x$ac_have_aio_readv = xyes])
5519 # does g++ have built-in functions for atomic memory access ?
5520 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
5522 safe_CXXFLAGS=$CXXFLAGS
5523 CXXFLAGS="$mflag_primary"
5526 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5528 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5529 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5531 ac_have_builtin_atomic_cxx=yes
5532 AC_MSG_RESULT([yes])
5533 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
5535 ac_have_builtin_atomic_cxx=no
5540 CXXFLAGS=$safe_CXXFLAGS
5542 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
5545 if test x$ac_have_usable_linux_futex_h = xyes \
5546 -a x$ac_have_builtin_atomic_primary = xyes; then
5547 ac_enable_linux_ticket_lock_primary=yes
5549 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
5550 [test x$ac_enable_linux_ticket_lock_primary = xyes])
5552 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
5553 -a x$ac_have_usable_linux_futex_h = xyes \
5554 -a x$ac_have_builtin_atomic_secondary = xyes; then
5555 ac_enable_linux_ticket_lock_secondary=yes
5557 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
5558 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
5561 # does libstdc++ support annotating shared pointers ?
5562 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
5564 safe_CXXFLAGS=$CXXFLAGS
5565 CXXFLAGS="-std=c++0x"
5568 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5571 std::shared_ptr<int> p
5573 ac_have_shared_ptr=yes
5575 ac_have_shared_ptr=no
5577 if test x$ac_have_shared_ptr = xyes; then
5578 # If compilation of the program below fails because of a syntax error
5579 # triggered by substituting one of the annotation macros then that
5580 # means that libstdc++ supports these macros.
5581 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5582 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
5583 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
5586 std::shared_ptr<int> p
5588 ac_have_shared_pointer_annotation=no
5591 ac_have_shared_pointer_annotation=yes
5592 AC_MSG_RESULT([yes])
5593 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
5594 [Define to 1 if libstd++ supports annotating shared pointers])
5597 ac_have_shared_pointer_annotation=no
5602 CXXFLAGS=$safe_CXXFLAGS
5604 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
5605 [test x$ac_have_shared_pointer_annotation = xyes])
5607 # checking for GNU libc C17 aligned_alloc
5608 # just check glibc version rather than trying to muck around
5609 # checking the runtime behaviour or seeing if it is a weak alias
5610 AC_MSG_CHECKING([for AT_GNU_LIBC_C17_ALIGNED_ALLOC])
5611 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5612 #include <features.h>
5614 #if !defined(__GLIBC__) || __GLIBC__ != 2 || !defined(__GLIBC_MINOR__) || __GLIBC_MINOR__ < 38
5615 #error "not GNU libc 2.38 or later"
5618 AC_MSG_RESULT([yes])
5619 AC_DEFINE([HAVE_GNU_LIBC_C17_ALIGNED_ALLOC], 1,
5620 [Define to 1 if you have GNU libc C17 aligned_alloc.])
5626 # Check for C11 thrd_create()
5627 AC_MSG_CHECKING([for thrd_create()])
5628 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
5629 #include <threads.h>
5630 int thrd_entry(void *arg) { return 0; }
5631 ], [[thrd_t thr; return thrd_create(&thr, thrd_entry, NULL);]])],
5633 ac_cxx_have_thrd_create=yes
5634 AC_MSG_RESULT([yes])
5636 ac_cxx_have_thrd_create=no
5640 AM_CONDITIONAL(HAVE_THRD_CREATE, test x$ac_cxx_have_thrd_create = xyes)
5645 CFLAGS="${CFLAGS} -march=armv8.2-a+sha3"
5646 AC_MSG_CHECKING([for sha3])
5647 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
5652 AC_MSG_RESULT([yes])
5658 AM_CONDITIONAL(HAVE_SHA3, test x$ac_have_sha3 = xyes)
5661 #----------------------------------------------------------------------------
5662 # Ok. We're done checking.
5663 #----------------------------------------------------------------------------
5665 # Nb: VEX/Makefile is generated from Makefile.vex.in.
5668 VEX/Makefile:Makefile.vex.in
5672 glibc-2.X-helgrind.supp
5676 docs/xml/vg-entities.xml
5681 gdbserver_tests/Makefile
5682 gdbserver_tests/solaris/Makefile
5688 memcheck/tests/Makefile
5689 memcheck/tests/common/Makefile
5690 memcheck/tests/amd64/Makefile
5691 memcheck/tests/arm64/Makefile
5692 memcheck/tests/x86/Makefile
5693 memcheck/tests/linux/Makefile
5694 memcheck/tests/linux/debuginfod-check.vgtest
5695 memcheck/tests/darwin/Makefile
5696 memcheck/tests/solaris/Makefile
5697 memcheck/tests/freebsd/Makefile
5698 memcheck/tests/amd64-linux/Makefile
5699 memcheck/tests/arm64-linux/Makefile
5700 memcheck/tests/x86-linux/Makefile
5701 memcheck/tests/amd64-solaris/Makefile
5702 memcheck/tests/x86-solaris/Makefile
5703 memcheck/tests/amd64-freebsd/Makefile
5704 memcheck/tests/x86-freebsd/Makefile
5705 memcheck/tests/ppc32/Makefile
5706 memcheck/tests/ppc64/Makefile
5707 memcheck/tests/s390x/Makefile
5708 memcheck/tests/mips32/Makefile
5709 memcheck/tests/mips64/Makefile
5710 memcheck/tests/vbit-test/Makefile
5712 cachegrind/tests/Makefile
5713 cachegrind/tests/x86/Makefile
5714 cachegrind/cg_annotate
5718 callgrind/callgrind_annotate
5719 callgrind/callgrind_control
5720 callgrind/tests/Makefile
5722 helgrind/tests/Makefile
5724 drd/scripts/download-and-build-splash2
5727 massif/tests/Makefile
5732 lackey/tests/Makefile
5735 none/tests/scripts/Makefile
5736 none/tests/amd64/Makefile
5737 none/tests/ppc32/Makefile
5738 none/tests/ppc64/Makefile
5739 none/tests/x86/Makefile
5740 none/tests/arm/Makefile
5741 none/tests/arm64/Makefile
5742 none/tests/s390x/Makefile
5743 none/tests/mips32/Makefile
5744 none/tests/mips64/Makefile
5745 none/tests/nanomips/Makefile
5746 none/tests/linux/Makefile
5747 none/tests/darwin/Makefile
5748 none/tests/solaris/Makefile
5749 none/tests/freebsd/Makefile
5750 none/tests/amd64-linux/Makefile
5751 none/tests/x86-linux/Makefile
5752 none/tests/amd64-darwin/Makefile
5753 none/tests/x86-darwin/Makefile
5754 none/tests/amd64-solaris/Makefile
5755 none/tests/x86-solaris/Makefile
5756 none/tests/x86-freebsd/Makefile
5758 exp-bbv/tests/Makefile
5759 exp-bbv/tests/x86/Makefile
5760 exp-bbv/tests/x86-linux/Makefile
5761 exp-bbv/tests/amd64-linux/Makefile
5762 exp-bbv/tests/ppc32-linux/Makefile
5763 exp-bbv/tests/arm-linux/Makefile
5767 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
5768 [chmod +x coregrind/link_tool_exe_linux])
5769 AC_CONFIG_FILES([coregrind/link_tool_exe_freebsd],
5770 [chmod +x coregrind/link_tool_exe_freebsd])
5771 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
5772 [chmod +x coregrind/link_tool_exe_darwin])
5773 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
5774 [chmod +x coregrind/link_tool_exe_solaris])
5775 AC_CONFIG_FILES([tests/filter_stderr_basic],
5776 [chmod +x tests/filter_stderr_basic])
5777 AC_CONFIG_FILES([tests/filter_discards],
5778 [chmod +x tests/filter_discards])
5779 AC_CONFIG_FILES([memcheck/tests/filter_stderr],
5780 [chmod +x memcheck/tests/filter_stderr])
5781 AC_CONFIG_FILES([memcheck/tests/filter_dw4],
5782 [chmod +x memcheck/tests/filter_dw4])
5783 AC_CONFIG_FILES([memcheck/tests/filter_overlaperror],
5784 [chmod +x memcheck/tests/filter_overlaperror])
5785 AC_CONFIG_FILES([memcheck/tests/filter_supp],
5786 [chmod +x memcheck/tests/filter_supp])
5787 AC_CONFIG_FILES([memcheck/tests/x86/filter_pushfpopf],
5788 [chmod +x memcheck/tests/x86/filter_pushfpopf])
5789 AC_CONFIG_FILES([gdbserver_tests/filter_gdb],
5790 [chmod +x gdbserver_tests/filter_gdb])
5791 AC_CONFIG_FILES([gdbserver_tests/filter_memcheck_monitor],
5792 [chmod +x gdbserver_tests/filter_memcheck_monitor])
5793 AC_CONFIG_FILES([gdbserver_tests/filter_stderr],
5794 [chmod +x gdbserver_tests/filter_stderr])
5795 AC_CONFIG_FILES([gdbserver_tests/filter_vgdb],
5796 [chmod +x gdbserver_tests/filter_vgdb])
5797 AC_CONFIG_FILES([drd/tests/filter_stderr],
5798 [chmod +x drd/tests/filter_stderr])
5799 AC_CONFIG_FILES([drd/tests/filter_error_count],
5800 [chmod +x drd/tests/filter_error_count])
5801 AC_CONFIG_FILES([drd/tests/filter_error_summary],
5802 [chmod +x drd/tests/filter_error_summary])
5803 AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
5804 [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
5805 AC_CONFIG_FILES([drd/tests/filter_thread_no],
5806 [chmod +x drd/tests/filter_thread_no])
5807 AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
5808 [chmod +x drd/tests/filter_xml_and_thread_no])
5809 AC_CONFIG_FILES([helgrind/tests/filter_stderr],
5810 [chmod +x helgrind/tests/filter_stderr])
5816 Maximum build arch: ${ARCH_MAX}
5817 Primary build arch: ${VGCONF_ARCH_PRI}
5818 Secondary build arch: ${VGCONF_ARCH_SEC}
5819 Build OS: ${VGCONF_OS}
5820 Link Time Optimisation: ${vg_cv_lto}
5821 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
5822 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
5823 Platform variant: ${VGCONF_PLATVARIANT}
5824 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
5825 Default supp files: ${DEFAULT_SUPP}