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], [23])
19 m4_define([v_micro_ver], [0])
20 m4_define([v_suffix_ver], [GIT])
21 m4_define([v_rel_date], ["?? Apr 2024"])
22 m4_define([v_version],
23 m4_if(v_suffix_ver, [],
24 [v_major_ver.v_minor_ver.v_micro_ver],
25 [v_major_ver.v_minor_ver.v_micro_ver.v_suffix_ver]))
26 AC_INIT([Valgrind],[v_version],[valgrind-users@lists.sourceforge.net])
29 AC_SUBST(VG_VER_MAJOR, v_major_ver)
30 AC_SUBST(VG_VER_MINOR, v_minor_ver)
32 # For docs/xml/vg-entities.xml
33 AC_SUBST(VG_DATE, v_rel_date)
35 AC_CONFIG_SRCDIR(coregrind/m_main.c)
36 AC_CONFIG_HEADERS([config.h])
37 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
41 #----------------------------------------------------------------------------
42 # Do NOT modify these flags here. Except in feature tests in which case
43 # the original values must be properly restored.
44 #----------------------------------------------------------------------------
48 #----------------------------------------------------------------------------
49 # Checks for various programs.
50 #----------------------------------------------------------------------------
53 m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
54 # Make sure we can compile in C99 mode.
55 if test "$ac_cv_prog_cc_c99" = "no"; then
56 AC_MSG_ERROR([Valgrind relies on a C compiler supporting C99])
60 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
61 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
62 # base (eg. most likely as Darwin-specific tests) we'll need one of the
64 # - put AC_PROG_OBJC in a Darwin-specific part of this file
65 # - Use AC_PROG_OBJC here and up the minimum autoconf version
66 # - Use the following, which is apparently equivalent:
67 # m4_ifdef([AC_PROG_OBJC],
69 # [AC_CHECK_TOOL([OBJC], [gcc])
71 # AC_SUBST([OBJCFLAGS])
74 # Set LTO_RANLIB variable to an lto enabled ranlib
75 if test "x$LTO_RANLIB" = "x"; then
76 AC_PATH_PROGS([LTO_RANLIB], [gcc-ranlib])
78 AC_ARG_VAR([LTO_RANLIB],[Library indexer command for link time optimisation])
80 # provide a very basic definition for AC_PROG_SED if it's not provided by
81 # autoconf (as e.g. in autoconf 2.59).
82 m4_ifndef([AC_PROG_SED],
83 [AC_DEFUN([AC_PROG_SED],
85 AC_CHECK_PROGS([SED],[gsed sed])])])
88 AC_DEFUN([AC_PROG_SHA256SUM],
89 [AC_ARG_VAR([SHA256SUM])
90 AC_CHECK_PROGS([SHA256SUM],[gsha256sum sha256sum])])
93 # If no AR variable was specified, look up the name of the archiver. Otherwise
94 # do not touch the AR variable.
95 if test "x$AR" = "x"; then
96 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
98 AC_ARG_VAR([AR],[Archiver command])
100 # same for LTO_AR variable for lto enabled archiver
101 if test "x$LTO_AR" = "x"; then
102 AC_PATH_PROGS([LTO_AR], [gcc-ar])
104 AC_ARG_VAR([LTO_AR],[Archiver command for link time optimisation])
106 # figure out where perl lives
107 AC_PATH_PROG(PERL, perl)
109 # figure out where gdb lives
110 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
111 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
113 # some older automake's don't have it so try something on our own
114 ifdef([AM_PROG_AS],[AM_PROG_AS],
124 # Check if 'diff' supports -u (universal diffs) and use it if possible.
126 AC_MSG_CHECKING([for diff -u])
129 # Comparing two identical files results in 0.
130 tmpfile="tmp-xxx-yyy-zzz"
132 if diff -u $tmpfile $tmpfile ; then
141 # We don't want gcc < 3.0
142 AC_MSG_CHECKING([for a supported version of gcc])
144 # Obtain the compiler version.
146 # A few examples of how the ${CC} --version output looks like:
148 # ######## gcc variants ########
149 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
150 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
151 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
152 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
153 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
154 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
155 # OS/X 10.7: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
157 # ######## clang variants ########
158 # Clang: clang version 2.9 (tags/RELEASE_29/final)
159 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
160 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
162 # ######## Apple LLVM variants ########
163 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
164 # Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
167 if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
170 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
171 elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
174 # Don't use -dumpversion with clang: it will always produce "4.2.1".
175 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
176 elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
179 gcc_version=`${CC} -dumpversion 2>/dev/null`
182 gcc_version=`${CC} -dumpversion 2>/dev/null`
183 if test "x$gcc_version" = x; then
184 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
188 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
189 AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
191 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
192 # statements have to be quoted.
193 case "${is_clang}-${gcc_version}" in
194 applellvm-5.1|applellvm-[[6-9]].*|applellvm-[[1-9][0-9]]*)
195 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
197 icc-1[[3-9]].*|icc-202[[0-9]].*)
198 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
200 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
201 AC_MSG_RESULT([ok (${gcc_version})])
203 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
204 AC_MSG_RESULT([ok (clang-${gcc_version})])
207 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
208 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0 or Apple LLVM >= 5.1])
212 #----------------------------------------------------------------------------
213 # Arch/OS/platform tests.
214 #----------------------------------------------------------------------------
215 # We create a number of arch/OS/platform-related variables. We prefix them
216 # all with "VGCONF_" which indicates that they are defined at
217 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
218 # variables used when compiling C files.
222 AC_MSG_CHECKING([for a supported CPU])
224 # ARCH_MAX reflects the most that this CPU can do: for example if it
225 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
226 # Ditto for amd64. It is used for more configuration below, but is not used
229 # Power PC returns powerpc for Big Endian. This was not changed when Little
230 # Endian support was added to the 64-bit architecture. The 64-bit Little
231 # Endian systems explicitly state le in the host_cpu. For clarity in the
232 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianness of
233 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
234 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
235 # Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
236 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
237 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
240 VGCONF_PLATFORM_ARM_ARCH=
242 case "${host_cpu}" in
244 AC_MSG_RESULT([ok (${host_cpu})])
249 AC_MSG_RESULT([ok (${host_cpu})])
254 # this only referrs to 64-bit Big Endian
255 AC_MSG_RESULT([ok (${host_cpu})])
260 # this only referrs to 64-bit Little Endian
261 AC_MSG_RESULT([ok (${host_cpu})])
266 # On Linux this means only a 32-bit capable CPU.
267 AC_MSG_RESULT([ok (${host_cpu})])
272 AC_MSG_RESULT([ok (${host_cpu})])
277 AC_MSG_RESULT([ok (${host_cpu})])
278 VGCONF_PLATFORM_ARM_ARCH="-marm -mcpu=cortex-a8"
283 AC_MSG_RESULT([ok (${host_cpu})])
284 VGCONF_PLATFORM_ARM_ARCH="-marm -mcpu=cortex-a8"
289 AC_MSG_RESULT([ok (${host_cpu})])
290 VGCONF_PLATFORM_ARM_ARCH="-march=armv6"
295 AC_MSG_RESULT([ok (${host_cpu})])
300 AC_MSG_RESULT([ok (${host_cpu})])
305 AC_MSG_RESULT([ok (${host_cpu})])
310 AC_MSG_RESULT([ok (${host_cpu})])
315 AC_MSG_RESULT([ok (${host_cpu})])
320 AC_MSG_RESULT([ok (${host_cpu})])
324 AC_MSG_RESULT([ok (${host_cpu})])
329 AC_MSG_RESULT([no (${host_cpu})])
330 AC_MSG_ERROR([Unsupported host architecture. Sorry])
334 AC_SUBST(VGCONF_PLATFORM_ARM_ARCH)
336 #----------------------------------------------------------------------------
338 # Sometimes it's convenient to subvert the bi-arch build system and
339 # just have a single build even though the underlying platform is
340 # capable of both. Hence handle --enable-only64bit and
341 # --enable-only32bit. Complain if both are issued :-)
342 # [Actually, if either of these options are used, I think both get built,
343 # but only one gets installed. So if you use an in-place build, both can be
346 # Check if a 64-bit only build has been requested
347 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
348 [AC_ARG_ENABLE(only64bit,
349 [ --enable-only64bit do a 64-bit only build],
350 [vg_cv_only64bit=$enableval],
351 [vg_cv_only64bit=no])])
353 # Check if a 32-bit only build has been requested
354 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
355 [AC_ARG_ENABLE(only32bit,
356 [ --enable-only32bit do a 32-bit only build],
357 [vg_cv_only32bit=$enableval],
358 [vg_cv_only32bit=no])])
361 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
363 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
366 #----------------------------------------------------------------------------
368 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
369 # compilation of many C files via -VGO_$(VGCONF_OS) and
370 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
371 AC_MSG_CHECKING([for a supported OS])
378 AC_MSG_RESULT([ok (${host_os})])
381 # Ok, this is linux. Check the kernel version
382 AC_MSG_CHECKING([for the kernel version])
387 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
388 AC_MSG_RESULT([unsupported (${kernel})])
389 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
393 AC_MSG_RESULT([2.6 or later (${kernel})])
400 AC_MSG_RESULT([ok (${host_os})])
402 AC_DEFINE([FREEBSD_10], 1000, [FREEBSD_VERS value for FreeBSD 10.x])
404 AC_DEFINE([FREEBSD_11], 1100, [FREEBSD_VERS value for FreeBSD 11.x])
406 AC_DEFINE([FREEBSD_12], 1200, [FREEBSD_VERS value for FreeBSD 12.0 to 12.1])
408 AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2])
410 AC_DEFINE([FREEBSD_13_0], 1300, [FREEBSD_VERS value for FreeBSD 13.0])
412 AC_DEFINE([FREEBSD_13_1], 1310, [FREEBSD_VERS value for FreeBSD 13.1])
414 AC_DEFINE([FREEBSD_13_2], 1320, [FREEBSD_VERS value for FreeBSD 13.2])
416 AC_DEFINE([FREEBSD_13_3], 1330, [FREEBSD_VERS value for FreeBSD 13.3])
418 AC_DEFINE([FREEBSD_14], 1400, [FREEBSD_VERS value for FreeBSD 14.x])
420 AC_DEFINE([FREEBSD_15], 1500, [FREEBSD_VERS value for FreeBSD 15.x])
423 AC_MSG_CHECKING([for the kernel version])
428 AC_MSG_RESULT([FreeBSD 10.x (${kernel})])
429 AC_DEFINE([FREEBSD_VERS], FREEBSD_10, [FreeBSD version])
430 freebsd_vers=$freebsd_10
433 AC_MSG_RESULT([FreeBSD 11.x (${kernel})])
434 AC_DEFINE([FREEBSD_VERS], FREEBSD_11, [FreeBSD version])
435 freebsd_vers=$freebsd_11
440 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
441 AC_DEFINE([FREEBSD_VERS], FREEBSD_12, [FreeBSD version])
442 freebsd_vers=$freebsd_12
445 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
446 AC_DEFINE([FREEBSD_VERS], FREEBSD_12_2, [FreeBSD version])
447 freebsd_vers=$freebsd_12_2
454 AC_MSG_RESULT([FreeBSD 13.0 (${kernel})])
455 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_0, [FreeBSD version])
456 freebsd_vers=$freebsd_13_0
459 AC_MSG_RESULT([FreeBSD 13.1 (${kernel})])
460 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_1, [FreeBSD version])
461 freebsd_vers=$freebsd_13_1
464 AC_MSG_RESULT([FreeBSD 13.2 (${kernel})])
465 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_2, [FreeBSD version])
466 freebsd_vers=$freebsd_13_2
469 AC_MSG_RESULT([FreeBSD 13.3 (${kernel})])
470 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_3, [FreeBSD version])
471 freebsd_vers=$freebsd_13_3
474 AC_MSG_RESULT([unsupported (${kernel})])
475 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 15.x])
480 AC_MSG_RESULT([FreeBSD 14.x (${kernel})])
481 AC_DEFINE([FREEBSD_VERS], FREEBSD_14, [FreeBSD version])
482 freebsd_vers=$freebsd_14
485 AC_MSG_RESULT([FreeBSD 15.x (${kernel})])
486 AC_DEFINE([FREEBSD_VERS], FREEBSD_15, [FreeBSD version])
487 freebsd_vers=$freebsd_15
490 AC_MSG_RESULT([unsupported (${kernel})])
491 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 15.x])
495 DEFAULT_SUPP="$srcdir/freebsd.supp $srcdir/freebsd-helgrind.supp $srcdir/freebsd-drd.supp ${DEFAULT_SUPP}"
499 AC_MSG_RESULT([ok (${host_os})])
501 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
502 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
503 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
504 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
505 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
506 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
507 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
508 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
509 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
511 AC_MSG_CHECKING([for the kernel version])
514 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
515 # has only one relevant version, the OS version. The `uname` check
516 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
517 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
518 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
519 # and we don't know of an macros similar to __GLIBC__ to get that info.
521 # XXX: `uname -r` won't do the right thing for cross-compiles, but
522 # that's not a problem yet.
524 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
525 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
526 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
527 # time support for 10.5 (the 9.* pattern just below), I'll leave it
528 # in for now, just in case anybody wants to give it a try. But I'm
529 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
532 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
533 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
534 DEFAULT_SUPP="$srcdir/darwin9.supp ${DEFAULT_SUPP}"
535 DEFAULT_SUPP="$srcdir/darwin9-drd.supp ${DEFAULT_SUPP}"
538 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
539 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
540 DEFAULT_SUPP="$srcdir/darwin10.supp ${DEFAULT_SUPP}"
541 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
544 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
545 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
546 DEFAULT_SUPP="$srcdir/darwin11.supp ${DEFAULT_SUPP}"
547 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
550 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
551 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
552 DEFAULT_SUPP="$srcdir/darwin12.supp ${DEFAULT_SUPP}"
553 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
556 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
557 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
558 DEFAULT_SUPP="$srcdir/darwin13.supp ${DEFAULT_SUPP}"
559 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
562 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
563 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
564 DEFAULT_SUPP="$srcdir/darwin14.supp ${DEFAULT_SUPP}"
565 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
568 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
569 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
570 DEFAULT_SUPP="$srcdir/darwin15.supp ${DEFAULT_SUPP}"
571 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
574 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
575 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
576 DEFAULT_SUPP="$srcdir/darwin16.supp ${DEFAULT_SUPP}"
577 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
580 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
581 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
582 DEFAULT_SUPP="$srcdir/darwin17.supp ${DEFAULT_SUPP}"
583 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
586 AC_MSG_RESULT([unsupported (${kernel})])
587 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)])
593 AC_MSG_RESULT([ok (${host_os})])
596 uname_v=$( uname -v )
599 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
602 DEFAULT_SUPP="$srcdir/solaris11.supp ${DEFAULT_SUPP}"
608 AC_MSG_RESULT([ok (${host_os})])
610 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
614 AC_MSG_RESULT([no (${host_os})])
615 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
619 #----------------------------------------------------------------------------
621 # If we are building on a 64 bit platform test to see if the system
622 # supports building 32 bit programs and disable 32 bit support if it
623 # does not support building 32 bit programs
625 case "$ARCH_MAX-$VGCONF_OS" in
626 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
627 AC_MSG_CHECKING([for 32 bit build support])
630 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
635 vg_cv_only64bit="yes"
638 CFLAGS=$safe_CFLAGS;;
640 AC_MSG_CHECKING([for 32 bit build support])
642 CFLAGS="$CFLAGS -mips32 -mabi=32"
643 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
644 #include <sys/prctl.h>
648 vg_cv_only64bit="yes"
651 CFLAGS=$safe_CFLAGS;;
654 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
656 [--enable-only32bit was specified but system does not support 32 bit builds])
659 #----------------------------------------------------------------------------
661 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
662 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
663 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
664 # above) will be "amd64" since that reflects the most that this cpu can do,
665 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
666 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
667 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
668 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
669 AC_SUBST(VGCONF_ARCH_PRI)
671 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
672 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
673 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
674 # It is empty if there is no secondary target.
675 AC_SUBST(VGCONF_ARCH_SEC)
677 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
678 # The entire system, including regression and performance tests, will be
679 # built for this target. The "_CAPS" indicates that the name is in capital
680 # letters, and it also uses '_' rather than '-' as a separator, because it's
681 # used to create various Makefile variables, which are all in caps by
682 # convention and cannot contain '-' characters. This is in contrast to
683 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
684 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
686 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
687 # Valgrind and tools will also be built for this target, but not the
688 # regression or performance tests.
690 # By default, the primary arch is the same as the "max" arch, as commented
691 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
692 # the big case statement just below here, in the case where we're building
693 # on a 64 bit machine but have been requested only to do a 32 bit build.
694 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
696 AC_MSG_CHECKING([for a supported CPU/OS combination])
698 # NB. The load address for a given platform may be specified in more
699 # than one place, in some cases, depending on whether we're doing a biarch,
700 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
701 # Be careful to give consistent values in all subcases. Also, all four
702 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
703 # even if it is to "0xUNSET".
705 case "$ARCH_MAX-$VGCONF_OS" in
707 VGCONF_ARCH_PRI="x86"
709 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
710 VGCONF_PLATFORM_SEC_CAPS=""
711 valt_load_address_pri_norml="0x58000000"
712 valt_load_address_pri_inner="0x38000000"
713 valt_load_address_sec_norml="0xUNSET"
714 valt_load_address_sec_inner="0xUNSET"
715 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
718 valt_load_address_sec_norml="0xUNSET"
719 valt_load_address_sec_inner="0xUNSET"
720 if test x$vg_cv_only64bit = xyes; then
721 VGCONF_ARCH_PRI="amd64"
723 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
724 VGCONF_PLATFORM_SEC_CAPS=""
725 valt_load_address_pri_norml="0x58000000"
726 valt_load_address_pri_inner="0x38000000"
727 elif test x$vg_cv_only32bit = xyes; then
728 VGCONF_ARCH_PRI="x86"
730 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
731 VGCONF_PLATFORM_SEC_CAPS=""
732 valt_load_address_pri_norml="0x58000000"
733 valt_load_address_pri_inner="0x38000000"
735 VGCONF_ARCH_PRI="amd64"
736 VGCONF_ARCH_SEC="x86"
737 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
738 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
739 valt_load_address_pri_norml="0x58000000"
740 valt_load_address_pri_inner="0x38000000"
741 valt_load_address_sec_norml="0x58000000"
742 valt_load_address_sec_inner="0x38000000"
744 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
747 VGCONF_ARCH_PRI="ppc32"
749 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
750 VGCONF_PLATFORM_SEC_CAPS=""
751 valt_load_address_pri_norml="0x58000000"
752 valt_load_address_pri_inner="0x38000000"
753 valt_load_address_sec_norml="0xUNSET"
754 valt_load_address_sec_inner="0xUNSET"
755 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
758 valt_load_address_sec_norml="0xUNSET"
759 valt_load_address_sec_inner="0xUNSET"
760 if test x$vg_cv_only64bit = xyes; then
761 VGCONF_ARCH_PRI="ppc64be"
763 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
764 VGCONF_PLATFORM_SEC_CAPS=""
765 valt_load_address_pri_norml="0x58000000"
766 valt_load_address_pri_inner="0x38000000"
767 elif test x$vg_cv_only32bit = xyes; then
768 VGCONF_ARCH_PRI="ppc32"
770 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
771 VGCONF_PLATFORM_SEC_CAPS=""
772 valt_load_address_pri_norml="0x58000000"
773 valt_load_address_pri_inner="0x38000000"
775 VGCONF_ARCH_PRI="ppc64be"
776 VGCONF_ARCH_SEC="ppc32"
777 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
778 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
779 valt_load_address_pri_norml="0x58000000"
780 valt_load_address_pri_inner="0x38000000"
781 valt_load_address_sec_norml="0x58000000"
782 valt_load_address_sec_inner="0x38000000"
784 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
787 # Little Endian is only supported on PPC64
788 valt_load_address_sec_norml="0xUNSET"
789 valt_load_address_sec_inner="0xUNSET"
790 VGCONF_ARCH_PRI="ppc64le"
792 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
793 VGCONF_PLATFORM_SEC_CAPS=""
794 valt_load_address_pri_norml="0x58000000"
795 valt_load_address_pri_inner="0x38000000"
796 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
799 VGCONF_ARCH_PRI="x86"
801 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
802 VGCONF_PLATFORM_SEC_CAPS=""
803 valt_load_address_pri_norml="0x38000000"
804 valt_load_address_pri_inner="0x28000000"
805 valt_load_address_sec_norml="0xUNSET"
806 valt_load_address_sec_inner="0xUNSET"
807 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
810 if test x$vg_cv_only64bit = xyes; then
811 VGCONF_ARCH_PRI="amd64"
813 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
814 VGCONF_PLATFORM_SEC_CAPS=""
815 elif test x$vg_cv_only32bit = xyes; then
816 VGCONF_ARCH_PRI="x86"
818 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
819 VGCONF_PLATFORM_SEC_CAPS=""
821 VGCONF_ARCH_PRI="amd64"
822 VGCONF_ARCH_SEC="x86"
823 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
824 VGCONF_PLATFORM_SEC_CAPS="X86_FREEBSD"
826 # These work with either base clang or ports installed gcc
827 # Hand rolled compilers probably need INSTALL_DIR/lib (at least for gcc)
828 if test x$is_clang = xclang ; then
829 FLAG_32ON64="-B/usr/lib32"
831 GCC_MAJOR_VERSION=`${CC} -dumpversion | $SED 's/\..*//' 2>/dev/null`
832 FLAG_32ON64="-B/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -Wl,-rpath,/usr/local/lib32/gcc${GCC_MAJOR_VERSION}/"
833 FLAG_32ON64_GXX="-L/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -lgcc_s"
834 AC_SUBST(FLAG_32ON64_GXX)
836 valt_load_address_pri_norml="0x38000000"
837 valt_load_address_pri_inner="0x28000000"
838 valt_load_address_sec_norml="0x38000000"
839 valt_load_address_sec_inner="0x28000000"
840 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
842 # Darwin gets identified as 32-bit even when it supports 64-bit.
843 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
844 # all Macs support both 32-bit and 64-bit, so we just build both. If
845 # someone has a really old 32-bit only machine they can (hopefully?)
846 # build with --enable-only32bit. See bug 243362.
847 x86-darwin|amd64-darwin)
849 valt_load_address_sec_norml="0xUNSET"
850 valt_load_address_sec_inner="0xUNSET"
851 if test x$vg_cv_only64bit = xyes; then
852 VGCONF_ARCH_PRI="amd64"
854 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
855 VGCONF_PLATFORM_SEC_CAPS=""
856 valt_load_address_pri_norml="0x158000000"
857 valt_load_address_pri_inner="0x138000000"
858 elif test x$vg_cv_only32bit = xyes; then
859 VGCONF_ARCH_PRI="x86"
861 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
862 VGCONF_PLATFORM_SEC_CAPS=""
863 VGCONF_ARCH_PRI_CAPS="x86"
864 valt_load_address_pri_norml="0x58000000"
865 valt_load_address_pri_inner="0x38000000"
867 VGCONF_ARCH_PRI="amd64"
868 VGCONF_ARCH_SEC="x86"
869 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
870 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
871 valt_load_address_pri_norml="0x158000000"
872 valt_load_address_pri_inner="0x138000000"
873 valt_load_address_sec_norml="0x58000000"
874 valt_load_address_sec_inner="0x38000000"
876 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
879 VGCONF_ARCH_PRI="arm"
880 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
881 VGCONF_PLATFORM_SEC_CAPS=""
882 valt_load_address_pri_norml="0x58000000"
883 valt_load_address_pri_inner="0x38000000"
884 valt_load_address_sec_norml="0xUNSET"
885 valt_load_address_sec_inner="0xUNSET"
886 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
889 valt_load_address_sec_norml="0xUNSET"
890 valt_load_address_sec_inner="0xUNSET"
891 if test x$vg_cv_only64bit = xyes; then
892 VGCONF_ARCH_PRI="arm64"
894 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
895 VGCONF_PLATFORM_SEC_CAPS=""
896 valt_load_address_pri_norml="0x58000000"
897 valt_load_address_pri_inner="0x38000000"
898 elif test x$vg_cv_only32bit = xyes; then
899 VGCONF_ARCH_PRI="arm"
901 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
902 VGCONF_PLATFORM_SEC_CAPS=""
903 valt_load_address_pri_norml="0x58000000"
904 valt_load_address_pri_inner="0x38000000"
906 VGCONF_ARCH_PRI="arm64"
907 VGCONF_ARCH_SEC="arm"
908 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
909 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
910 valt_load_address_pri_norml="0x58000000"
911 valt_load_address_pri_inner="0x38000000"
912 valt_load_address_sec_norml="0x58000000"
913 valt_load_address_sec_inner="0x38000000"
915 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
918 VGCONF_ARCH_PRI="s390x"
920 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
921 VGCONF_PLATFORM_SEC_CAPS=""
922 # To improve branch prediction hit rate we want to have
923 # the generated code close to valgrind (host) code
924 valt_load_address_pri_norml="0x800000000"
925 valt_load_address_pri_inner="0x810000000"
926 valt_load_address_sec_norml="0xUNSET"
927 valt_load_address_sec_inner="0xUNSET"
928 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
931 VGCONF_ARCH_PRI="mips32"
933 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
934 VGCONF_PLATFORM_SEC_CAPS=""
935 valt_load_address_pri_norml="0x58000000"
936 valt_load_address_pri_inner="0x38000000"
937 valt_load_address_sec_norml="0xUNSET"
938 valt_load_address_sec_inner="0xUNSET"
939 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
942 valt_load_address_sec_norml="0xUNSET"
943 valt_load_address_sec_inner="0xUNSET"
944 if test x$vg_cv_only64bit = xyes; then
945 VGCONF_ARCH_PRI="mips64"
946 VGCONF_PLATFORM_SEC_CAPS=""
947 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
948 VGCONF_PLATFORM_SEC_CAPS=""
949 valt_load_address_pri_norml="0x58000000"
950 valt_load_address_pri_inner="0x38000000"
951 elif test x$vg_cv_only32bit = xyes; then
952 VGCONF_ARCH_PRI="mips32"
954 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
955 VGCONF_PLATFORM_SEC_CAPS=""
956 valt_load_address_pri_norml="0x58000000"
957 valt_load_address_pri_inner="0x38000000"
959 VGCONF_ARCH_PRI="mips64"
960 VGCONF_ARCH_SEC="mips32"
961 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
962 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
963 valt_load_address_pri_norml="0x58000000"
964 valt_load_address_pri_inner="0x38000000"
965 valt_load_address_sec_norml="0x58000000"
966 valt_load_address_sec_inner="0x38000000"
968 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
971 VGCONF_ARCH_PRI="nanomips"
973 VGCONF_PLATFORM_PRI_CAPS="NANOMIPS_LINUX"
974 VGCONF_PLATFORM_SEC_CAPS=""
975 valt_load_address_pri_norml="0x58000000"
976 valt_load_address_pri_inner="0x38000000"
977 valt_load_address_sec_norml="0xUNSET"
978 valt_load_address_sec_inner="0xUNSET"
979 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
982 VGCONF_ARCH_PRI="x86"
984 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
985 VGCONF_PLATFORM_SEC_CAPS=""
986 valt_load_address_pri_norml="0x58000000"
987 valt_load_address_pri_inner="0x38000000"
988 valt_load_address_sec_norml="0xUNSET"
989 valt_load_address_sec_inner="0xUNSET"
990 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
993 valt_load_address_sec_norml="0xUNSET"
994 valt_load_address_sec_inner="0xUNSET"
995 if test x$vg_cv_only64bit = xyes; then
996 VGCONF_ARCH_PRI="amd64"
998 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
999 VGCONF_PLATFORM_SEC_CAPS=""
1000 valt_load_address_pri_norml="0x58000000"
1001 valt_load_address_pri_inner="0x38000000"
1002 elif test x$vg_cv_only32bit = xyes; then
1003 VGCONF_ARCH_PRI="x86"
1005 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
1006 VGCONF_PLATFORM_SEC_CAPS=""
1007 valt_load_address_pri_norml="0x58000000"
1008 valt_load_address_pri_inner="0x38000000"
1010 VGCONF_ARCH_PRI="amd64"
1011 VGCONF_ARCH_SEC="x86"
1012 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
1013 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
1014 valt_load_address_pri_norml="0x58000000"
1015 valt_load_address_pri_inner="0x38000000"
1016 valt_load_address_sec_norml="0x58000000"
1017 valt_load_address_sec_inner="0x38000000"
1019 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
1022 VGCONF_ARCH_PRI="unknown"
1023 VGCONF_ARCH_SEC="unknown"
1024 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
1025 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
1026 valt_load_address_pri_norml="0xUNSET"
1027 valt_load_address_pri_inner="0xUNSET"
1028 valt_load_address_sec_norml="0xUNSET"
1029 valt_load_address_sec_inner="0xUNSET"
1030 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
1031 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
1035 #----------------------------------------------------------------------------
1037 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
1039 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
1040 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1041 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1042 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1043 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD \
1044 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1045 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
1046 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1047 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
1048 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
1049 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1050 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1051 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
1052 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
1053 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
1054 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1055 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
1056 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
1057 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1058 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
1059 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
1060 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1061 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
1062 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
1063 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
1064 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
1065 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
1066 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
1067 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1068 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
1069 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
1070 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
1071 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_NANOMIPS,
1072 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX )
1074 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
1076 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
1077 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1078 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
1079 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
1080 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
1081 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
1082 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1083 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
1084 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
1085 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
1086 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
1087 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
1088 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
1089 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1090 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
1091 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
1092 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
1093 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
1094 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1095 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
1096 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
1097 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1098 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
1099 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
1100 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
1101 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_NANOMIPS_LINUX,
1102 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1103 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD,
1104 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1105 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD)
1106 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD,
1107 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1108 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
1109 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1110 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
1111 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
1112 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1113 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
1114 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1115 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
1116 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
1117 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1120 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
1121 # Relies on the assumption that the primary and secondary targets are
1122 # for the same OS, so therefore only necessary to test the primary.
1123 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
1124 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1125 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1126 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1127 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1128 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
1129 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1130 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1131 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1132 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1133 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
1134 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1135 AM_CONDITIONAL(VGCONF_OS_IS_FREEBSD,
1136 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1137 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1138 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
1139 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1140 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1141 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
1142 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1143 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1144 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN_OR_FREEBSD,
1145 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1146 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1147 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1148 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1151 # Sometimes, in the Makefile.am files, it's useful to know whether or not
1152 # there is a secondary target.
1153 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
1154 test x$VGCONF_PLATFORM_SEC_CAPS != x)
1156 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
1157 dnl fallback definition
1158 dnl The macro is courtesy of Dave Hart:
1159 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
1160 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
1161 if test -z "$$1_TRUE"; then :
1170 #----------------------------------------------------------------------------
1172 #----------------------------------------------------------------------------
1174 # Check if this should be built as an inner Valgrind, to be run within
1175 # another Valgrind. Choose the load address accordingly.
1176 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
1177 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
1178 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
1179 [AC_ARG_ENABLE(inner,
1180 [ --enable-inner enables self-hosting],
1181 [vg_cv_inner=$enableval],
1183 if test "$vg_cv_inner" = yes; then
1184 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
1185 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
1186 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
1188 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
1189 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
1192 #----------------------------------------------------------------------------
1193 # Undefined behaviour sanitiser
1194 #----------------------------------------------------------------------------
1195 # Check whether we should build with the undefined beahviour sanitiser.
1197 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
1198 [AC_ARG_ENABLE(ubsan,
1199 [ --enable-ubsan enables the undefined behaviour sanitiser],
1200 [vg_cv_ubsan=$enableval],
1203 #----------------------------------------------------------------------------
1204 # Extra fine-tuning of installation directories
1205 #----------------------------------------------------------------------------
1207 [ --with-tmpdir=PATH Specify path for temporary files],
1210 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
1211 AC_SUBST(VG_TMPDIR, [$tmpdir])
1213 #----------------------------------------------------------------------------
1215 #----------------------------------------------------------------------------
1216 AM_COND_IF([VGCONF_OS_IS_DARWIN],
1217 [AC_CHECK_PROG([XCRUN], [xcrun], [yes], [no])
1218 AC_MSG_CHECKING([for xcode sdk include path])
1219 AC_ARG_WITH(xcodedir,
1220 [ --with-xcode-path=PATH Specify path for xcode sdk includes],
1221 [xcodedir="$withval"],
1223 if test "x$XCRUN" != "xno" -a ! -d /usr/include; then
1224 xcrundir=`xcrun --sdk macosx --show-sdk-path`
1225 if test -z "$xcrundir"; then
1226 xcodedir="/usr/include"
1228 xcodedir="$xcrundir/usr/include"
1231 xcodedir="/usr/include"
1234 AC_MSG_RESULT([$xcodedir])
1235 AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
1236 AC_SUBST(XCODE_DIR, [$xcodedir])])
1238 #----------------------------------------------------------------------------
1239 # Where to install gdb scripts, defaults to VG_LIBDIR (pkglibexecdir)
1240 #----------------------------------------------------------------------------
1241 AC_MSG_CHECKING([where gdb scripts are installed])
1242 AC_ARG_WITH(gdbscripts-dir,
1243 [ --with-gdbscripts-dir=PATH Specify path to install gdb scripts],
1244 [gdbscriptsdir=${withval}],
1245 [gdbscriptsdir=${libexecdir}/valgrind])
1246 AC_MSG_RESULT([$gdbscriptsdir])
1247 if test "x$gdbscriptsdir" != "xno"; then
1248 AC_SUBST(VG_GDBSCRIPTS_DIR, [$gdbscriptsdir])
1249 AM_CONDITIONAL(GDBSCRIPTS, true)
1251 AC_SUBST(VG_GDBSCRIPTS_DIR, [])
1252 AM_CONDITIONAL(GDBSCRIPTS, false)
1255 #----------------------------------------------------------------------------
1256 # Libc and suppressions
1257 #----------------------------------------------------------------------------
1258 # This variable will collect the suppression files to be used.
1259 AC_SUBST(DEFAULT_SUPP)
1261 AC_CHECK_HEADER([features.h])
1263 if test x$ac_cv_header_features_h = xyes; then
1264 AC_DEFINE([HAVE_HEADER_FEATURES_H], 1,
1265 [Define to 1 if you have the `features.h' header.])
1266 rm -f conftest.$ac_ext
1267 cat <<_ACEOF >conftest.$ac_ext
1268 #include <features.h>
1269 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1270 glibc version is: __GLIBC__ __GLIBC_MINOR__
1273 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1276 # not really a version check
1277 AC_EGREP_CPP([DARWIN_LIBC], [
1278 #include <sys/cdefs.h>
1279 #if defined(__DARWIN_VERS_1050)
1283 GLIBC_VERSION="darwin")
1285 AC_EGREP_CPP([FREEBSD_LIBC], [
1286 #include <sys/cdefs.h>
1287 #if defined(__FreeBSD__)
1291 GLIBC_VERSION="freebsd")
1293 # not really a version check
1294 AC_EGREP_CPP([BIONIC_LIBC], [
1295 #if defined(__ANDROID__)
1299 GLIBC_VERSION="bionic")
1301 # there is only one version of libc on Solaris
1302 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1303 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1304 GLIBC_VERSION="solaris"
1307 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1309 if test x$GLIBC_VERSION = x; then
1310 if $CC -dumpmachine | grep -q musl; then
1315 # If this is glibc then figure out the generic (in file) libc.so and
1316 # libpthread.so file paths to use in suppressions. Before 2.34 libpthread
1317 # was a separate library, afterwards it was merged into libc.so and
1318 # the library is called libc.so.6 (before it was libc-2.[0-9]+.so).
1319 # Use this fact to set GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH.
1320 case ${GLIBC_VERSION} in
1322 AC_MSG_CHECKING([whether pthread_create needs libpthread])
1323 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])],
1326 GLIBC_LIBC_PATH="*/lib*/libc.so.6"
1327 GLIBC_LIBPTHREAD_PATH="$GLIBC_LIBC_PATH"
1329 AC_MSG_RESULT([yes])
1330 GLIBC_LIBC_PATH="*/lib*/libc-2.*so*"
1331 GLIBC_LIBPTHREAD_PATH="*/lib*/libpthread-2.*so*"
1335 AC_MSG_CHECKING([not glibc...])
1336 AC_MSG_RESULT([${GLIBC_VERSION}])
1340 AC_MSG_CHECKING([the glibc version])
1342 case "${GLIBC_VERSION}" in
1344 AC_MSG_RESULT(${GLIBC_VERSION} family)
1345 DEFAULT_SUPP="$srcdir/glibc-2.2.supp ${DEFAULT_SUPP}"
1346 DEFAULT_SUPP="$srcdir/glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1347 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1350 AC_MSG_RESULT(${GLIBC_VERSION} family)
1351 DEFAULT_SUPP="$srcdir/glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1352 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1353 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1356 AC_MSG_RESULT(${GLIBC_VERSION} family)
1357 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1358 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1359 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1362 AC_MSG_RESULT(${GLIBC_VERSION} family)
1363 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1364 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1365 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1366 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1367 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1370 AC_MSG_RESULT(${GLIBC_VERSION} family)
1371 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1372 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1373 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1374 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1375 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1376 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1377 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1380 AC_MSG_RESULT(Darwin)
1381 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1382 # DEFAULT_SUPP set by kernel version check above.
1385 AC_MSG_RESULT(FreeBSD)
1386 AC_DEFINE([FREEBSD_LIBC], 1, [Define to 1 if you're using FreeBSD])
1387 # DEFAULT_SUPP set by kernel version check above.
1390 AC_MSG_RESULT(Bionic)
1391 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1392 DEFAULT_SUPP="$srcdir/bionic.supp ${DEFAULT_SUPP}"
1395 AC_MSG_RESULT(Solaris)
1396 # DEFAULT_SUPP set in host_os switch-case above.
1397 # No other suppression file is used.
1401 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1402 DEFAULT_SUPP="$srcdir/musl.supp ${DEFAULT_SUPP}"
1405 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1406 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1407 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1411 AC_SUBST(GLIBC_VERSION)
1412 AC_SUBST(GLIBC_LIBC_PATH)
1413 AC_SUBST(GLIBC_LIBPTHREAD_PATH)
1416 if test "$VGCONF_OS" != "solaris"; then
1417 # Add default suppressions for the X client libraries. Make no
1418 # attempt to detect whether such libraries are installed on the
1419 # build machine (or even if any X facilities are present); just
1420 # add the suppressions antidisirregardless.
1421 DEFAULT_SUPP="$srcdir/xfree-4.supp ${DEFAULT_SUPP}"
1422 DEFAULT_SUPP="$srcdir/xfree-3.supp ${DEFAULT_SUPP}"
1426 #----------------------------------------------------------------------------
1427 # Platform variants?
1428 #----------------------------------------------------------------------------
1430 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1431 # But there are times where we need a bit more control. The motivating
1432 # and currently only case is Android: this is almost identical to
1433 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1434 # platform variant tags, which get passed in the compile as
1435 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1437 # In almost all cases, the <variant> bit is "vanilla". But for Android
1438 # it is "android" instead.
1440 # Consequently (eg), plain arm-linux would build with
1442 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1444 # whilst an Android build would have
1446 # -DVGP_arm_linux -DVGPV_arm_linux_android
1448 # Same for x86. The setup of the platform variant is pushed relatively far
1449 # down this file in order that we can inspect any of the variables set above.
1451 # In the normal case ..
1452 VGCONF_PLATVARIANT="vanilla"
1455 if test "$GLIBC_VERSION" = "bionic";
1457 VGCONF_PLATVARIANT="android"
1460 AC_SUBST(VGCONF_PLATVARIANT)
1463 # FIXME: do we also want to define automake variables
1464 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1465 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1466 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1467 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1468 # that's what we'd need to do to use this, since what we'd want to write
1471 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1473 # Hmm. Can't think of a nice clean solution to this.
1475 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1476 test x$VGCONF_PLATVARIANT = xvanilla)
1477 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1478 test x$VGCONF_PLATVARIANT = xandroid)
1481 #----------------------------------------------------------------------------
1482 # Checking for various library functions and other definitions
1483 #----------------------------------------------------------------------------
1485 # Check for AT_FDCWD
1487 AC_MSG_CHECKING([for AT_FDCWD])
1488 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1495 ac_have_at_fdcwd=yes
1496 AC_MSG_RESULT([yes])
1502 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1504 # Check for stpncpy function definition in string.h
1505 # This explicitly checks with _GNU_SOURCE defined since that is also
1506 # used in the test case (some systems might define it without anyway
1507 # since stpncpy is part of The Open Group Base Specifications Issue 7
1508 # IEEE Std 1003.1-2008.
1509 AC_MSG_CHECKING([for stpncpy])
1510 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1517 char *r = stpncpy(d, s, n);
1519 ac_have_gnu_stpncpy=yes
1520 AC_MSG_RESULT([yes])
1522 ac_have_gnu_stpncpy=no
1526 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1528 # Check for PTRACE_GETREGS
1530 AC_MSG_CHECKING([for PTRACE_GETREGS])
1531 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1534 #include <sys/ptrace.h>
1535 #include <sys/user.h>
1538 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1540 AC_MSG_RESULT([yes])
1541 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1542 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1548 # Check for CLOCK_MONOTONIC
1550 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1552 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1556 clock_gettime(CLOCK_MONOTONIC, &t);
1559 AC_MSG_RESULT([yes])
1560 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1561 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1567 # Check for ELF32/64_CHDR
1569 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1572 # Check for PTHREAD_RWLOCK_T
1574 AC_MSG_CHECKING([for pthread_rwlock_t])
1576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1578 #include <pthread.h>
1580 pthread_rwlock_t rwl;
1582 AC_MSG_RESULT([yes])
1583 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1584 [Define to 1 if you have the `pthread_rwlock_t' type.])
1589 # Check for CLOCKID_T
1591 AC_MSG_CHECKING([for clockid_t])
1593 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1598 AC_MSG_RESULT([yes])
1599 AC_DEFINE([HAVE_CLOCKID_T], 1,
1600 [Define to 1 if you have the `clockid_t' type.])
1605 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1607 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1609 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1611 #include <pthread.h>
1613 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1615 AC_MSG_RESULT([yes])
1616 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1617 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1623 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1625 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1627 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1629 #include <pthread.h>
1631 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1633 AC_MSG_RESULT([yes])
1634 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1635 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1641 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1643 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1645 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1647 #include <pthread.h>
1649 return (PTHREAD_MUTEX_RECURSIVE_NP);
1651 AC_MSG_RESULT([yes])
1652 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1653 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1659 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1661 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1663 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1665 #include <pthread.h>
1667 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1670 AC_MSG_RESULT([yes])
1671 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1672 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1678 # Check whether pthread_mutex_t has a member called __m_kind.
1680 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1681 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1683 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1686 [#include <pthread.h>])
1689 # Check whether pthread_mutex_t has a member called __data.__kind.
1691 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1692 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1694 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1697 [#include <pthread.h>])
1699 # Convenience function. Set flags based on the existing HWCAP entries.
1700 # The AT_HWCAP entries are generated by glibc, and are based on
1701 # functions supported by the hardware/system/libc.
1702 # Subsequent support for whether the capability will actually be utilized
1703 # will also be checked against the compiler capabilities.
1705 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1706 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1708 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1709 if env LD_SHOW_AUXV=1 true | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1711 AC_MSG_RESULT([yes])
1712 AC_SUBST([$2],[yes])
1719 # gather hardware capabilities. (hardware/kernel/libc)
1720 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1721 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1722 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1723 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1724 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1725 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1726 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1727 AC_HWCAP_CONTAINS_FLAG([arch_3_1],[HWCAP_HAS_ISA_3_1])
1728 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1729 AC_HWCAP_CONTAINS_FLAG([mma],[HWCAP_HAS_MMA])
1732 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1733 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1734 # compiler support for isa 2.07 level instructions
1735 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1736 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1738 __asm__ __volatile__("mtvsrd 1,2 ");
1740 ac_asm_have_isa_2_07=yes
1741 AC_MSG_RESULT([yes])
1743 ac_asm_have_isa_2_07=no
1746 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1747 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1749 # altivec (vsx) support.
1750 # does this compiler support -maltivec and does it have the include file
1752 AC_MSG_CHECKING([for Altivec support in the compiler ])
1754 CFLAGS="-maltivec -Werror"
1755 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1756 #include <altivec.h>
1758 vector unsigned int v;
1761 AC_MSG_RESULT([yes])
1767 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1768 -a x$HWCAP_HAS_ALTIVEC = xyes])
1770 # Check that both: the compiler supports -mvsx and that the assembler
1771 # understands VSX instructions. If either of those doesn't work,
1772 # conclude that we can't do VSX.
1773 AC_MSG_CHECKING([for VSX compiler flag support])
1775 CFLAGS="-mvsx -Werror"
1776 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1779 ac_compiler_supports_vsx_flag=yes
1780 AC_MSG_RESULT([yes])
1782 ac_compiler_supports_vsx_flag=no
1787 AC_MSG_CHECKING([for VSX support in the assembler ])
1789 CFLAGS="-mvsx -Werror"
1790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1791 #include <altivec.h>
1793 vector unsigned int v;
1794 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1796 ac_compiler_supports_vsx=yes
1797 AC_MSG_RESULT([yes])
1799 ac_compiler_supports_vsx=no
1803 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1804 -a x$ac_compiler_supports_vsx = xyes \
1805 -a x$HWCAP_HAS_VSX = xyes ])
1807 # DFP (Decimal Float)
1808 # The initial DFP support was added in Power 6. The dcffix instruction
1809 # support was added in Power 7.
1810 AC_MSG_CHECKING([that assembler knows DFP])
1811 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1814 __asm__ __volatile__("adtr 1, 2, 3")
1816 __asm__ __volatile__(".machine power7;\n" \
1822 AC_MSG_RESULT([yes])
1827 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1829 CFLAGS="-mhard-dfp -Werror"
1831 # The dcffix instruction is Power 7
1832 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1835 __asm__ __volatile__("adtr 1, 2, 3")
1837 __asm__ __volatile__(".machine power7;\n" \
1842 ac_compiler_have_dfp=yes
1843 AC_MSG_RESULT([yes])
1845 ac_compiler_have_dfp=no
1849 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1850 -a x$ac_compiler_have_dfp = xyes \
1851 -a x$HWCAP_HAS_DFP = xyes )
1853 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1854 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1856 _Decimal64 x = 0.0DD;
1858 ac_compiler_have_dfp_type=yes
1859 AC_MSG_RESULT([yes])
1861 ac_compiler_have_dfp_type=no
1864 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1865 -a x$HWCAP_HAS_DFP = xyes )
1868 # HTM (Hardware Transactional Memory)
1869 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1871 CFLAGS="-mhtm -Werror"
1872 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1876 AC_MSG_RESULT([yes])
1877 ac_compiler_supports_htm=yes
1880 ac_compiler_supports_htm=no
1884 AC_MSG_CHECKING([if compiler can find the htm builtins])
1886 CFLAGS="-mhtm -Werror"
1887 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1889 if (__builtin_tbegin (0))
1892 AC_MSG_RESULT([yes])
1893 ac_compiler_sees_htm_builtins=yes
1896 ac_compiler_sees_htm_builtins=no
1900 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1901 -a x$ac_compiler_sees_htm_builtins = xyes \
1902 -a x$HWCAP_HAS_HTM = xyes )
1904 # isa 3.0 checking. (actually 3.0 or newer)
1905 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1907 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1909 __asm__ __volatile__ (".machine power9;\n" \
1912 # guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste,
1915 CFLAGS="-DHAS_ISA_3_00"
1916 ac_asm_have_isa_3_00=yes
1917 AC_MSG_RESULT([yes])
1919 ac_asm_have_isa_3_00=no
1925 AC_MSG_CHECKING([that assembler knows xscvhpdp ])
1927 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1929 __asm__ __volatile__ (".machine power9;\n" \
1930 "xscvhpdp 1,2;\n" );
1932 ac_asm_have_xscvhpdp=yes
1933 AC_MSG_RESULT([yes])
1935 ac_asm_have_xscvhpdp=no
1939 # darn instruction checking
1940 AC_MSG_CHECKING([that assembler knows darn instruction ])
1942 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1944 __asm__ __volatile__(".machine power9; darn 1,0 ");
1946 ac_asm_have_darn_inst=yes
1947 AC_MSG_RESULT([yes])
1949 ac_asm_have_darn_inst=no
1954 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
1955 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1957 __asm__ __volatile__ (".machine power10;\n" \
1960 ac_asm_have_isa_3_1=yes
1961 AC_MSG_RESULT([yes])
1963 ac_asm_have_isa_3_1=no
1968 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
1969 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1971 AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes])
1972 AM_CONDITIONAL(HAS_DARN, [test x$ac_asm_have_darn_inst = xyes])
1974 AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \
1975 -a x$HWCAP_HAS_ISA_3_1 = xyes])
1977 # Check for pthread_create@GLIBC2.0
1978 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1981 CFLAGS="-lpthread -Werror"
1982 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1983 extern int pthread_create_glibc_2_0(void*, const void*,
1984 void *(*)(void*), void*);
1985 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1989 * Apparently on PowerPC linking this program succeeds and generates an
1990 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1992 #error This test does not work properly on PowerPC.
1994 pthread_create_glibc_2_0(0, 0, 0, 0);
1998 ac_have_pthread_create_glibc_2_0=yes
1999 AC_MSG_RESULT([yes])
2000 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
2001 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
2003 ac_have_pthread_create_glibc_2_0=no
2008 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
2009 test x$ac_have_pthread_create_glibc_2_0 = xyes)
2012 # Check for dlinfo RTLD_DI_TLS_MODID
2013 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
2017 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2024 size_t sizes[10000];
2025 size_t modid_offset;
2026 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
2029 ac_have_dlinfo_rtld_di_tls_modid=yes
2030 AC_MSG_RESULT([yes])
2031 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
2032 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
2034 ac_have_dlinfo_rtld_di_tls_modid=no
2039 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
2040 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
2043 # Check for eventfd_t, eventfd() and eventfd_read()
2044 AC_MSG_CHECKING([for eventfd()])
2046 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2047 #include <sys/eventfd.h>
2053 eventfd_read(fd, &ev);
2056 AC_MSG_RESULT([yes])
2057 AC_DEFINE([HAVE_EVENTFD], 1,
2058 [Define to 1 if you have the `eventfd' function.])
2059 AC_DEFINE([HAVE_EVENTFD_READ], 1,
2060 [Define to 1 if you have the `eventfd_read' function.])
2065 # Check whether compiler can process #include <thread> without errors
2066 # clang 3.3 cannot process <thread> from e.g.
2067 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
2069 AC_MSG_CHECKING([that C++ compiler can compile C++17 code])
2071 safe_CXXFLAGS=$CXXFLAGS
2074 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2079 AC_MSG_RESULT([yes])
2084 CXXFLAGS=$safe_CXXFLAGS
2087 AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes)
2089 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
2091 safe_CXXFLAGS=$CXXFLAGS
2094 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2098 ac_cxx_can_include_thread_header=yes
2099 AC_MSG_RESULT([yes])
2101 ac_cxx_can_include_thread_header=no
2104 CXXFLAGS=$safe_CXXFLAGS
2107 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
2109 # Check whether compiler can process #include <condition_variable> without errors
2111 AC_MSG_CHECKING([that C++ compiler can include <condition_variable> header file])
2113 safe_CXXFLAGS=$CXXFLAGS
2116 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2117 #include <condition_variable>
2120 ac_cxx_can_include_condition_variable_header=yes
2121 AC_MSG_RESULT([yes])
2123 ac_cxx_can_include_condition_variable_header=no
2126 CXXFLAGS=$safe_CXXFLAGS
2129 AM_CONDITIONAL(CXX_CAN_INCLUDE_CONDITION_VARIABLE_HEADER, test x$ac_cxx_can_include_condition_variable_header = xyes)
2131 # check for std::shared_timed_mutex, this is a C++ 14 feature
2133 AC_MSG_CHECKING([that C++ compiler can use std::shared_timed_mutex])
2135 safe_CXXFLAGS=$CXXFLAGS
2136 CXXFLAGS="-std=c++1y -pthread"
2138 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2139 #include <shared_mutex>
2140 std::shared_timed_mutex test_mutex;
2143 ac_cxx_can_use_shared_timed_mutex=yes
2144 AC_MSG_RESULT([yes])
2146 ac_cxx_can_use_shared_timed_mutex=no
2149 CXXFLAGS=$safe_CXXFLAGS
2152 AM_CONDITIONAL(CXX_CAN_USE_SHARED_TIMED_MUTEX, test x$ac_cxx_can_use_shared_timed_mutex = xyes)
2154 # check for std::shared_mutex, this is a C++ 11 feature
2156 AC_MSG_CHECKING([that C++ compiler can use std::timed_mutex])
2158 safe_CXXFLAGS=$CXXFLAGS
2159 CXXFLAGS="-std=c++0x -pthread"
2161 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2163 std::timed_mutex test_mutex;
2166 ac_cxx_can_use_timed_mutex=yes
2167 AC_MSG_RESULT([yes])
2169 ac_cxx_can_use_timed_mutex=no
2172 CXXFLAGS=$safe_CXXFLAGS
2175 AM_CONDITIONAL(CXX_CAN_USE_TIMED_MUTEX, test x$ac_cxx_can_use_timed_mutex = xyes)
2177 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
2178 # of the user_regs_struct from sys/user.h. They are structurally the same
2179 # but we get either one or the other.
2181 AC_CHECK_TYPE([struct user_regs_struct],
2182 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
2183 [[#include <sys/ptrace.h>]
2184 [#include <sys/time.h>]
2185 [#include <sys/user.h>]])
2186 if test "$sys_user_has_user_regs" = "yes"; then
2187 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
2188 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
2191 AC_MSG_CHECKING([for __NR_membarrier])
2192 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2193 #include <linux/unistd.h>
2195 return __NR_membarrier
2197 ac_have_nr_membarrier=yes
2198 AC_MSG_RESULT([yes])
2200 ac_have_nr_membarrier=no
2204 AM_CONDITIONAL(HAVE_NR_MEMBARRIER, [test x$ac_have_nr_membarrier = xyes])
2206 #----------------------------------------------------------------------------
2207 # Checking for supported compiler flags.
2208 #----------------------------------------------------------------------------
2210 case "${host_cpu}" in
2212 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2213 if test -z "$ARCH"; then
2214 # does this compiler support -march=mips32 (mips32 default) ?
2215 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
2218 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
2220 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2223 FLAG_M32="-mips32 -mabi=32"
2224 AC_MSG_RESULT([yes])
2234 # does this compiler support -march=mips64r2 (mips64r2 default) ?
2235 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
2238 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
2240 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2243 FLAG_M64="-march=mips64r2 -mabi=64"
2244 AC_MSG_RESULT([yes])
2257 # does this compiler support -m32 ?
2258 AC_MSG_CHECKING([if gcc accepts -m32])
2261 CFLAGS="${FLAG_32ON64} -m32 -Werror"
2263 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2266 FLAG_M32="${FLAG_32ON64} -m32"
2267 AC_MSG_RESULT([yes])
2277 # does this compiler support -m64 ?
2278 AC_MSG_CHECKING([if gcc accepts -m64])
2281 CFLAGS="-m64 -Werror"
2283 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2287 AC_MSG_RESULT([yes])
2299 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2300 if test -z "$ARCH"; then
2301 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
2302 AC_MSG_CHECKING([if gcc accepts -march=octeon])
2305 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
2307 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2310 FLAG_OCTEON="-march=octeon"
2311 AC_MSG_RESULT([yes])
2318 AC_SUBST(FLAG_OCTEON)
2321 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
2322 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
2325 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
2327 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2330 FLAG_OCTEON2="-march=octeon2"
2331 AC_MSG_RESULT([yes])
2338 AC_SUBST(FLAG_OCTEON2)
2342 # does this compiler support -mmsa (MIPS MSA ASE) ?
2343 AC_MSG_CHECKING([if gcc accepts -mmsa])
2346 CFLAGS="$CFLAGS -mmsa -Werror"
2348 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2352 AC_MSG_RESULT([yes])
2361 # Are we compiling for the MIPS64 n32 ABI?
2362 AC_MSG_CHECKING([if gcc is producing mips n32 binaries])
2363 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2364 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABIN32))
2369 FLAG_M64="-march=mips64r2 -mabi=n32"
2370 AC_MSG_RESULT([yes])
2375 # Are we compiling for the MIPS64 n64 ABI?
2376 AC_MSG_CHECKING([if gcc is producing mips n64 binaries])
2377 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2378 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABI64))
2383 AC_MSG_RESULT([yes])
2388 # We enter the code block below in the following case:
2389 # Target architecture is set to mips64, the desired abi
2390 # was not specified and the compiler's default abi setting
2391 # is neither n32 nor n64.
2392 # Probe for and set the abi to either n64 or n32, in that order,
2393 # which is required for a mips64 build of valgrind.
2394 if test "$ARCH_MAX" = "mips64" -a "x$VGCONF_ABI" = "x"; then
2396 CFLAGS="$CFLAGS -mabi=64 -Werror"
2397 AC_MSG_CHECKING([if gcc is n64 capable])
2398 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2402 AC_MSG_RESULT([yes])
2408 if test "x$VGCONF_ABI" = "x"; then
2410 CFLAGS="$CFLAGS -mabi=n32 -Werror"
2411 AC_MSG_CHECKING([if gcc is n32 capable])
2412 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2416 FLAG_M64="-march=mips64r2 -mabi=n32"
2417 AC_MSG_RESULT([yes])
2425 AM_CONDITIONAL([VGCONF_HAVE_ABI],
2426 [test x$VGCONF_ABI != x])
2427 AC_SUBST(VGCONF_ABI)
2430 # does this compiler support -mmmx ?
2431 AC_MSG_CHECKING([if gcc accepts -mmmx])
2434 CFLAGS="-mmmx -Werror"
2436 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2440 AC_MSG_RESULT([yes])
2450 # does this compiler support -msse ?
2451 AC_MSG_CHECKING([if gcc accepts -msse])
2454 CFLAGS="-msse -Werror"
2456 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2460 AC_MSG_RESULT([yes])
2470 # does this compiler support -mpreferred-stack-boundary=2 when
2471 # generating code for a 32-bit target? Note that we only care about
2472 # this when generating code for (32-bit) x86, so if the compiler
2473 # doesn't recognise -m32 it's no big deal. We'll just get code for
2474 # the Memcheck and other helper functions, that is a bit slower than
2475 # it could be, on x86; and no difference at all on any other platform.
2476 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
2479 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
2481 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2484 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
2485 AC_MSG_RESULT([yes])
2487 PREFERRED_STACK_BOUNDARY_2=""
2492 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
2495 # does this compiler support -mlong-double-128 ?
2496 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
2498 CFLAGS="-mlong-double-128 -Werror"
2499 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2502 ac_compiler_supports_mlong_double_128=yes
2503 AC_MSG_RESULT([yes])
2505 ac_compiler_supports_mlong_double_128=no
2509 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
2510 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
2511 AC_SUBST(FLAG_MLONG_DOUBLE_128)
2513 # does this toolchain support lto ?
2514 # Not checked for if --enable-lto=no was given, or if LTO_AR or LTO_RANLIG
2516 # If not enable-lto=* arg is provided, default to no, as lto builds are
2517 # a lot slower, and so not appropriate for Valgrind developments.
2518 # --enable-lto=yes should be used by distro packagers.
2519 AC_CACHE_CHECK([for using the link time optimisation], vg_cv_lto,
2521 [ --enable-lto enables building with link time optimisation],
2522 [vg_cv_lto=$enableval],
2525 if test "x${vg_cv_lto}" != "xno" -a "x${LTO_AR}" != "x" -a "x${LTO_RANLIB}" != "x"; then
2526 AC_MSG_CHECKING([if toolchain accepts lto])
2528 TEST_LTO_CFLAGS="-flto -flto-partition=one -fuse-linker-plugin"
2529 # Note : using 'one' partition is giving a slightly smaller/faster memcheck
2530 # and ld/lto-trans1 still needs a reasonable memory (about 0.5GB) when linking.
2531 CFLAGS="$TEST_LTO_CFLAGS -Werror"
2533 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2534 extern void somefun(void);
2538 LTO_CFLAGS=$TEST_LTO_CFLAGS
2539 AC_MSG_RESULT([yes])
2547 AC_SUBST(LTO_CFLAGS)
2549 # if we could not compile with lto args, or lto was disabled,
2550 # then set LTO_AR/LTO_RANLIB to the non lto values
2551 # define in config.h ENABLE_LTO (not needed by the code currently, but
2552 # this guarantees we recompile everything if we re-configure and rebuild
2553 # in a build dir previously build with another value of --enable-lto
2554 if test "x${LTO_CFLAGS}" = "x"; then
2556 LTO_RANLIB=${RANLIB}
2560 AC_DEFINE([ENABLE_LTO], 1, [configured to build with lto link time optimisation])
2563 # Convenience function to check whether GCC supports a particular
2564 # warning option. Takes two arguments,
2565 # first the warning flag name to check (without -W), then the
2566 # substitution name to set with -Wno-warning-flag if the flag exists,
2567 # or the empty string if the compiler doesn't accept the flag. Note
2568 # that checking is done against the warning flag itself, but the
2569 # substitution is then done to cancel the warning flag.
2570 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
2571 AC_MSG_CHECKING([if gcc accepts -W$1])
2573 CFLAGS="-W$1 -Werror"
2574 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2575 AC_SUBST([$2], [-Wno-$1])
2576 AC_MSG_RESULT([yes])], [
2578 AC_MSG_RESULT([no])])
2582 # A variation of the above for arguments that
2584 AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[
2585 AC_MSG_CHECKING([if gcc accepts -W$1=$2])
2587 CFLAGS="-W$1=$2 -Werror"
2588 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2589 AC_SUBST([$3], [-Wno-$1])
2590 AC_MSG_RESULT([yes])], [
2592 AC_MSG_RESULT([no])])
2596 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
2597 # -W$1 (instead of -Wno-$1).
2598 AC_DEFUN([AC_GCC_WARNING_SUBST],[
2599 AC_MSG_CHECKING([if gcc accepts -W$1])
2601 CFLAGS="-W$1 -Werror"
2602 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2603 AC_SUBST([$2], [-W$1])
2604 AC_MSG_RESULT([yes])], [
2606 AC_MSG_RESULT([no])])
2610 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
2611 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
2612 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
2613 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
2614 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
2615 AC_GCC_WARNING_SUBST_NO([maybe-uninitialized], [FLAG_W_NO_MAYBE_UNINITIALIZED])
2616 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
2617 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
2618 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
2619 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2620 AC_GCC_WARNING_SUBST_NO([expansion-to-defined], [FLAG_W_NO_EXPANSION_TO_DEFINED])
2621 AC_GCC_WARNING_SUBST_NO([unused-variable], [FLAG_W_NO_UNUSED_VARIABLE])
2622 AC_GCC_WARNING_SUBST_NO([unused-but-set-variable], [FLAG_W_NO_UNUSED_BUT_SET_VARIABLE])
2623 AC_GCC_WARNING_SUBST_NO([non-power-of-two-alignment], [FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT])
2624 AC_GCC_WARNING_SUBST_NO([sign-compare], [FLAG_W_NO_SIGN_COMPARE])
2625 AC_GCC_WARNING_SUBST_NO([stringop-overflow], [FLAG_W_NO_STRINGOP_OVERFLOW])
2626 AC_GCC_WARNING_SUBST_NO([stringop-overread], [FLAG_W_NO_STRINGOP_OVERREAD])
2627 AC_GCC_WARNING_SUBST_NO([stringop-truncation], [FLAG_W_NO_STRINGOP_TRUNCATION])
2628 AC_GCC_WARNING_SUBST_NO([format-overflow], [FLAG_W_NO_FORMAT_OVERFLOW])
2629 AC_GCC_WARNING_SUBST_NO([use-after-free], [FLAG_W_NO_USE_AFTER_FREE])
2630 AC_GCC_WARNING_SUBST_NO([free-nonheap-object], [FLAG_W_NO_FREE_NONHEAP_OBJECT])
2631 AC_GCC_WARNING_SUBST_NO([fortify-source], [FLAG_W_NO_FORTIFY_SOURCE])
2632 AC_GCC_WARNING_SUBST_NO([builtin-memcpy-chk-size], [FLAG_W_NO_BUILTIN_MEMCPY_CHK_SIZE])
2633 AC_GCC_WARNING_SUBST_NO([incompatible-pointer-types-discards-qualifiers], [FLAG_W_NO_INCOMPATIBLE_POINTER_TYPES_DISCARDS_QUALIFIERS])
2634 AC_GCC_WARNING_SUBST_NO([suspicious-bzero], [FLAG_W_NO_SUSPICIOUS_BZERO])
2635 AC_GCC_WARNING_SUBST_NO([attributes], [FLAG_W_NO_ATTRIBUTES])
2637 AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
2639 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
2640 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
2641 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
2642 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
2643 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
2644 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2645 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2646 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2647 AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
2648 AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
2649 AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
2651 # Does this compiler support -Wformat-security ?
2652 # Special handling is needed, because certain GCC versions require -Wformat
2653 # being present if -Wformat-security is given. Otherwise a warning is issued.
2654 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2655 # And with that the warning will be turned into an error with the result
2656 # that -Wformat-security is believed to be unsupported when in fact it is.
2657 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2659 CFLAGS="-Wformat -Wformat-security -Werror"
2660 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2661 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2662 AC_MSG_RESULT([yes])], [
2663 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2664 AC_MSG_RESULT([no])])
2667 # does this compiler support -Wextra or the older -W ?
2669 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2672 CFLAGS="-Wextra -Werror"
2674 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2677 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2678 AC_MSG_RESULT([-Wextra])
2681 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2684 AC_SUBST([FLAG_W_EXTRA], [-W])
2687 AC_SUBST([FLAG_W_EXTRA], [])
2688 AC_MSG_RESULT([not supported])
2693 # On ARM we do not want to pass -Wcast-align as that produces loads
2694 # of warnings. GCC is just being conservative. See here:
2695 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2696 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2697 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2699 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2702 # does this compiler support -faligned-new ?
2703 AC_MSG_CHECKING([if g++ accepts -faligned-new])
2705 safe_CXXFLAGS=$CXXFLAGS
2706 CXXFLAGS="-faligned-new -Werror"
2709 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2712 FLAG_FALIGNED_NEW="-faligned-new"
2713 AC_MSG_RESULT([yes])
2715 FLAG_FALIGNED_NEW=""
2718 CXXFLAGS=$safe_CXXFLAGS
2721 AC_SUBST(FLAG_FALIGNED_NEW)
2723 # does this compiler support -fsized-deallocation ?
2724 AC_MSG_CHECKING([if g++ accepts -fsized-deallocation])
2726 safe_CXXFLAGS=$CXXFLAGS
2727 CXXFLAGS="-fsized-deallocation -Werror"
2730 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2733 FLAG_FSIZED_DEALLOCATION="-fsized-deallocation"
2734 ac_have_sized_deallocation=yes
2735 AC_MSG_RESULT([yes])
2737 FLAG_FSIZED_DEALLOCATION=""
2738 ac_have_sized_deallocation=no
2741 CXXFLAGS=$safe_CXXFLAGS
2744 AC_SUBST(FLAG_FSIZED_DEALLOCATION)
2745 AM_CONDITIONAL([HAVE_FSIZED_DEALLOCATION], [test x$ac_have_sized_deallocation = xyes])
2747 # does this compiler support C++17 aligned new/delete?
2748 AC_MSG_CHECKING([if g++ supports aligned new and delete])
2750 safe_CXXFLAGS=$CXXFLAGS
2751 CXXFLAGS="-std=c++17"
2754 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2758 operator delete(nullptr, std::align_val_t(64U));
2760 ac_have_aligned_cxx_alloc=yes
2761 AC_MSG_RESULT([yes])
2763 ac_have_aligned_cxx_alloc=no
2766 CXXFLAGS=$safe_CXXFLAGS
2769 AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes])
2771 # does this compiler support -fno-stack-protector ?
2772 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2775 CFLAGS="-fno-stack-protector -Werror"
2777 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2780 no_stack_protector=yes
2781 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2782 AC_MSG_RESULT([yes])
2784 no_stack_protector=no
2785 FLAG_FNO_STACK_PROTECTOR=""
2790 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2792 # does this compiler support -finline-functions ?
2793 AC_MSG_CHECKING([if gcc accepts -finline-functions])
2796 CFLAGS="-finline-functions -Werror"
2798 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2801 inline_functions=yes
2802 FLAG_FINLINE_FUNCTIONS="-finline-functions"
2803 AC_MSG_RESULT([yes])
2806 FLAG_FINLINE_FUNCTIONS=""
2811 AC_SUBST(FLAG_FINLINE_FUNCTIONS)
2813 # Does GCC support disabling Identical Code Folding?
2814 # We want to disabled Identical Code Folding for the
2815 # tools preload shared objects to get better backraces.
2816 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2817 # "The optimization reduces code size and may disturb
2818 # unwind stacks by replacing a function by equivalent
2819 # one with a different name."
2820 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2823 CFLAGS="-fno-ipa-icf -Werror"
2825 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2829 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2830 AC_MSG_RESULT([yes])
2838 AC_SUBST(FLAG_FNO_IPA_ICF)
2841 # Does this compiler support -fsanitize=undefined. This is true for
2842 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2843 # also checks for alignment violations on memory accesses which the valgrind
2844 # code base is sprinkled (if not littered) with. As those alignment issues
2845 # don't pose a problem we want to suppress warnings about them.
2846 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2847 # GCCs do not support that.
2849 # Only checked for if --enable-ubsan was given.
2850 if test "x${vg_cv_ubsan}" = "xyes"; then
2851 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2853 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2854 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2857 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2858 LIB_UBSAN="-static-libubsan"
2859 AC_MSG_RESULT([yes])
2861 CFLAGS="-fsanitize=undefined -Werror"
2862 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2865 FLAG_FSANITIZE="-fsanitize=undefined"
2866 LIB_UBSAN="-static-libubsan"
2867 AC_MSG_RESULT([yes])
2875 AC_SUBST(FLAG_FSANITIZE)
2878 # does this compiler support --param inline-unit-growth=... ?
2880 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2883 CFLAGS="--param inline-unit-growth=900 -Werror"
2885 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2888 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2889 ["--param inline-unit-growth=900"])
2890 AC_MSG_RESULT([yes])
2892 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2898 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2900 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2903 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2905 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2909 AC_MSG_RESULT([yes])
2914 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2918 # does this compiler support -g -gz=zlib ?
2920 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2923 CFLAGS="-g -gz=zlib"
2925 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2929 AC_MSG_RESULT([yes])
2934 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2938 # does this compiler support -g -gz=zlib-gnu ?
2940 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2943 CFLAGS="-g -gz=zlib-gnu"
2945 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2948 ac_have_gz_zlib_gnu=yes
2949 AC_MSG_RESULT([yes])
2951 ac_have_gz_zlib_gnu=no
2954 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2958 # does this compiler support nested functions ?
2960 AC_MSG_CHECKING([if gcc accepts nested functions])
2962 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2963 int foo() { return 1; }
2966 ac_have_nested_functions=yes
2967 AC_MSG_RESULT([yes])
2969 ac_have_nested_functions=no
2972 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2975 # does this compiler support the 'p' constraint in ASM statements ?
2977 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2979 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2981 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2983 ac_have_asm_constraint_p=yes
2984 AC_MSG_RESULT([yes])
2986 ac_have_asm_constraint_p=no
2989 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2992 # Does this compiler and linker support -pie?
2993 # Some compilers actually do not support -pie and report its usage
2994 # as an error. We need to check if it is safe to use it first.
2996 AC_MSG_CHECKING([if gcc accepts -pie])
3001 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
3004 AC_SUBST([FLAG_PIE], ["-pie"])
3005 AC_MSG_RESULT([yes])
3007 AC_SUBST([FLAG_PIE], [""])
3012 AC_MSG_CHECKING([if gcc accepts -ansi])
3017 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3021 AC_MSG_RESULT([yes])
3026 AM_CONDITIONAL([HAVE_ANSI], [test x$ac_have_ansi = xyes])
3031 # Does this compiler support -no-pie?
3032 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
3033 # default. However this gets in the way with some tests, we use -no-pie
3036 AC_MSG_CHECKING([if gcc accepts -no-pie])
3039 CFLAGS="-no-pie -Werror"
3041 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
3044 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
3045 AC_MSG_RESULT([yes])
3047 AC_SUBST([FLAG_NO_PIE], [""])
3053 # We want to use use the -Ttext-segment option to the linker.
3054 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
3055 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
3056 # semantics are NOT what we want (GNU gold -Ttext is fine).
3058 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
3059 # will reside. -Ttext aligns just the .text section start (but not any
3062 # LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes"
3063 # in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html
3064 # The --image-base option (since version 6.0?) provides the semantics needed.
3065 # -Ttext-segment generates an error, but -Ttext now more closely
3066 # follows the GNU (bfd) ld's -Ttext.
3068 # So test first for --image-base support, and if that fails then
3069 # for -Ttext-segment which is supported by all bfd ld versions
3070 # and use that if it exists. If it doesn't exist it must be an older
3071 # version of gold and we can fall back to using -Ttext which has the
3075 AC_MSG_CHECKING([if the linker accepts -Wl,--image-base])
3077 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror"
3080 [AC_LANG_SOURCE([int _start () { return 0; }])],
3082 linker_using_t_text="no"
3083 AC_SUBST([FLAG_T_TEXT], ["--image-base"])
3084 AC_MSG_RESULT([yes])
3088 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
3090 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
3093 [AC_LANG_SOURCE([int _start () { return 0; }])],
3095 linker_using_t_text="no"
3096 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
3097 AC_MSG_RESULT([yes])
3099 linker_using_t_text="yes"
3100 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
3107 # If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will
3108 # have to strip any build-id ELF NOTEs from the statically linked tools.
3109 # Otherwise the build-id NOTE might end up at the default load address.
3110 # (Pedantically if the linker is gold then -Ttext is fine, but newer
3111 # gold versions also support -Ttext-segment. So just assume that unless
3112 # we can use -Ttext-segment we need to strip the build-id NOTEs.
3113 if test "x${linker_using_t_text}" = "xyes"; then
3114 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
3115 # does the linker support -Wl,--build-id=none ? Note, it's
3116 # important that we test indirectly via whichever C compiler
3117 # is selected, rather than testing /usr/bin/ld or whatever
3119 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
3121 CFLAGS="-Wl,--build-id=none -Werror"
3124 [AC_LANG_PROGRAM([ ], [return 0;])],
3126 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
3127 AC_MSG_RESULT([yes])
3129 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3133 AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.])
3134 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3138 # On s390x, if the linker supports -Wl,--s390-pgste, then we build the
3139 # tools with that flag. This enables running programs that need it, such
3141 if test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX; then
3142 AC_MSG_CHECKING([if the linker accepts -Wl,--s390-pgste])
3144 CFLAGS="-Wl,--s390-pgste"
3147 [AC_LANG_PROGRAM([ ], [return 0;])],
3149 AC_SUBST([FLAG_S390_PGSTE], ["-Wl,--s390-pgste"])
3150 AC_MSG_RESULT([yes])
3152 AC_SUBST([FLAG_S390_PGSTE], [""])
3158 # does the ppc assembler support "mtocrf" et al?
3159 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
3161 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3162 __asm__ __volatile__("mtocrf 4,0");
3163 __asm__ __volatile__("mfocrf 0,4");
3165 ac_have_as_ppc_mftocrf=yes
3166 AC_MSG_RESULT([yes])
3168 ac_have_as_ppc_mftocrf=no
3171 if test x$ac_have_as_ppc_mftocrf = xyes ; then
3172 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
3176 # does the ppc assembler support "lfdp" and other phased out floating point insns?
3177 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
3179 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3180 do { typedef struct {
3184 dbl_pair_t dbl_pair[3];
3185 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
3188 ac_have_as_ppc_fpPO=yes
3189 AC_MSG_RESULT([yes])
3191 ac_have_as_ppc_fpPO=no
3194 if test x$ac_have_as_ppc_fpPO = xyes ; then
3195 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
3199 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
3200 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
3202 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3204 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
3205 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
3207 ac_have_as_amd64_fxsave64=yes
3208 AC_MSG_RESULT([yes])
3210 ac_have_as_amd64_fxsave64=no
3213 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
3214 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
3217 # does the x86/amd64 assembler understand SSE3 instructions?
3218 # Note, this doesn't generate a C-level symbol. It generates a
3219 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
3220 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
3222 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3223 do { long long int x;
3224 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
3228 AC_MSG_RESULT([yes])
3234 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
3237 # Ditto for SSSE3 instructions (note extra S)
3238 # Note, this doesn't generate a C-level symbol. It generates a
3239 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
3240 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
3242 save_CFLAGS="$CFLAGS"
3243 CFLAGS="$CFLAGS -msse -Werror"
3244 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3245 do { long long int x;
3246 __asm__ __volatile__(
3247 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
3250 ac_have_as_ssse3=yes
3251 AC_MSG_RESULT([yes])
3256 CFLAGS="$save_CFLAGS"
3258 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
3261 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
3262 # Note, this doesn't generate a C-level symbol. It generates a
3263 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
3264 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
3265 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3267 __asm__ __volatile__(
3268 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
3271 ac_have_as_pclmulqdq=yes
3272 AC_MSG_RESULT([yes])
3274 ac_have_as_pclmulqdq=no
3278 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
3281 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
3282 # Note, this doesn't generate a C-level symbol. It generates a
3283 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
3284 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
3285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3288 * Carry-less multiplication of xmm1 with xmm2 and store the result in
3289 * xmm3. The immediate is used to determine which quadwords of xmm1 and
3290 * xmm2 should be used.
3292 __asm__ __volatile__(
3293 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
3296 ac_have_as_vpclmulqdq=yes
3297 AC_MSG_RESULT([yes])
3299 ac_have_as_vpclmulqdq=no
3303 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
3306 # does the x86/amd64 assembler understand FMA4 instructions?
3307 # Note, this doesn't generate a C-level symbol. It generates a
3308 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
3309 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
3310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3312 __asm__ __volatile__(
3313 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
3316 ac_have_as_vfmaddpd=yes
3317 AC_MSG_RESULT([yes])
3319 ac_have_as_vfmaddpd=no
3323 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
3326 # does the x86/amd64 assembler understand the LZCNT instruction?
3327 # Note, this doesn't generate a C-level symbol. It generates a
3328 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
3329 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
3331 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3333 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
3336 ac_have_as_lzcnt=yes
3337 AC_MSG_RESULT([yes])
3343 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
3346 # does the x86/amd64 assembler understand the LOOPNEL instruction?
3347 # Note, this doesn't generate a C-level symbol. It generates a
3348 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
3349 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
3351 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3353 __asm__ __volatile__("1: loopnel 1b\n");
3356 ac_have_as_loopnel=yes
3357 AC_MSG_RESULT([yes])
3359 ac_have_as_loopnel=no
3363 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
3366 # does the x86/amd64 assembler understand ADDR32 ?
3367 # Note, this doesn't generate a C-level symbol. It generates a
3368 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
3369 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
3371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3373 asm volatile ("addr32 rep movsb");
3376 ac_have_as_addr32=yes
3377 AC_MSG_RESULT([yes])
3379 ac_have_as_addr32=no
3383 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
3386 # does the x86/amd64 assembler understand SSE 4.2 instructions?
3387 # Note, this doesn't generate a C-level symbol. It generates a
3388 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
3389 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
3391 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3392 do { long long int x;
3393 __asm__ __volatile__(
3394 "crc32q %%r15,%%r15" : : : "r15" );
3395 __asm__ __volatile__(
3396 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
3397 __asm__ __volatile__(
3398 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
3401 ac_have_as_sse42=yes
3402 AC_MSG_RESULT([yes])
3408 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
3411 # does the x86/amd64 assembler understand AVX instructions?
3412 # Note, this doesn't generate a C-level symbol. It generates a
3413 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
3414 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
3416 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3417 do { long long int x;
3418 __asm__ __volatile__(
3419 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
3420 __asm__ __volatile__(
3421 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3425 AC_MSG_RESULT([yes])
3431 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
3434 # does the x86/amd64 assembler understand AVX2 instructions?
3435 # Note, this doesn't generate a C-level symbol. It generates a
3436 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
3437 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
3439 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3440 do { long long int x;
3441 __asm__ __volatile__(
3442 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3443 __asm__ __volatile__(
3444 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3448 AC_MSG_RESULT([yes])
3454 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
3457 # does the x86/amd64 assembler understand TSX instructions and
3458 # the XACQUIRE/XRELEASE prefixes?
3459 # Note, this doesn't generate a C-level symbol. It generates a
3460 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
3461 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
3463 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3465 __asm__ __volatile__(
3468 " xacquire lock incq 0(%rsp) \n\t"
3469 " xrelease lock incq 0(%rsp) \n"
3474 AC_MSG_RESULT([yes])
3480 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
3483 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
3484 # Note, this doesn't generate a C-level symbol. It generates a
3485 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
3486 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
3488 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3489 do { unsigned int h, l;
3490 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
3491 __asm__ __volatile__(
3492 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
3493 __asm__ __volatile__(
3494 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
3498 AC_MSG_RESULT([yes])
3504 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
3507 # does the x86/amd64 assembler understand FMA instructions?
3508 # Note, this doesn't generate a C-level symbol. It generates a
3509 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
3510 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
3512 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3513 do { unsigned int h, l;
3514 __asm__ __volatile__(
3515 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3516 __asm__ __volatile__(
3517 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
3518 __asm__ __volatile__(
3519 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
3523 AC_MSG_RESULT([yes])
3529 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
3532 # does the amd64 assembler understand MPX instructions?
3533 # Note, this doesn't generate a C-level symbol. It generates a
3534 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
3535 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
3537 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3539 asm ("bndmov %bnd0,(%rsp)");
3540 asm ("bndldx 3(%rbx,%rdx), %bnd2");
3541 asm ("bnd call foo\n"
3548 AC_MSG_RESULT([yes])
3554 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
3557 # does the amd64 assembler understand ADX instructions?
3558 # Note, this doesn't generate a C-level symbol. It generates a
3559 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
3560 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
3562 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3564 asm ("adcxq %r14,%r8");
3568 AC_MSG_RESULT([yes])
3574 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
3577 # does the amd64 assembler understand the RDRAND instruction?
3578 # Note, this doesn't generate a C-level symbol. It generates a
3579 # automake-level symbol (BUILD_RDRAND_TESTS), used in test Makefile.am's
3580 AC_MSG_CHECKING([if amd64 assembler knows the RDRAND instruction])
3582 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3584 asm ("rdrand %r14");
3585 asm ("rdrand %r14d");
3586 asm ("rdrand %r14w");
3589 ac_have_as_rdrand=yes
3590 AC_MSG_RESULT([yes])
3592 ac_have_as_rdrand=no
3596 AM_CONDITIONAL(BUILD_RDRAND_TESTS, test x$ac_have_as_rdrand = xyes)
3598 # does the amd64 assembler understand the RDSEED instruction?
3599 # Note, this doesn't generate a C-level symbol. It generates a
3600 # automake-level symbol (BUILD_RDSEED_TESTS), used in test Makefile.am's
3601 AC_MSG_CHECKING([if amd64 assembler knows the RDSEED instruction])
3603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3605 asm ("rdseed %r14");
3606 asm ("rdseed %r14d");
3607 asm ("rdseed %r14w");
3610 ac_have_as_rdseed=yes
3611 AC_MSG_RESULT([yes])
3613 ac_have_as_rdseed=no
3617 AM_CONDITIONAL(BUILD_RDSEED_TESTS, test x$ac_have_as_rdseed = xyes)
3619 # does the amd64 assembler understand the F16C instructions (VCVTPH2PS and
3621 # Note, this doesn't generate a C-level symbol. It generates a
3622 # automake-level symbol (BUILD_F16C_TESTS), used in test Makefile.am's
3623 AC_MSG_CHECKING([if amd64 assembler knows the F16C instructions])
3625 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3627 asm ("vcvtph2ps %xmm5, %ymm10");
3628 // If we put the dollar sign and zero together, the shell processing
3629 // this configure.ac script substitutes the command name in. Sigh.
3630 asm ("vcvtps2ph $" "0, %ymm10, %xmm5");
3634 AC_MSG_RESULT([yes])
3640 AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes)
3643 # does the x86/amd64 assembler understand MOVBE?
3644 # Note, this doesn't generate a C-level symbol. It generates a
3645 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
3646 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
3648 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3649 do { long long int x;
3650 __asm__ __volatile__(
3651 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
3654 ac_have_as_movbe=yes
3655 AC_MSG_RESULT([yes])
3661 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
3664 # Does the C compiler support the "ifunc" attribute
3665 # Note, this doesn't generate a C-level symbol. It generates a
3666 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
3667 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
3669 AC_LINK_IFELSE([AC_LANG_SOURCE([[
3670 static void mytest(void) {}
3672 static void (*resolve_test(void))(void)
3674 return (void (*)(void))&mytest;
3677 void test(void) __attribute__((ifunc("resolve_test")));
3685 ac_have_ifunc_attr=yes
3686 AC_MSG_RESULT([yes])
3688 ac_have_ifunc_attr=no
3692 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
3694 # Does the C compiler support the armv8 crc feature flag
3695 # Note, this doesn't generate a C-level symbol. It generates a
3696 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
3697 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
3699 save_CFLAGS="$CFLAGS"
3700 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
3701 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3707 ac_have_armv8_crc_feature=yes
3708 AC_MSG_RESULT([yes])
3710 ac_have_armv8_crc_feature=no
3713 CFLAGS="$save_CFLAGS"
3715 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
3718 # Does the C compiler support the armv81 flag and the assembler v8.1 instructions
3719 # Note, this doesn't generate a C-level symbol. It generates a
3720 # automake-level symbol (BUILD_ARMV81_TESTS), used in test Makefile.am's
3721 AC_MSG_CHECKING([if gcc supports the armv81 feature flag and assembler supports v8.1 instructions])
3723 save_CFLAGS="$CFLAGS"
3724 CFLAGS="$CFLAGS -march=armv8.1-a -Werror"
3725 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3728 __asm__ __volatile__("ldadd x0, x1, [x2]" ::: "memory");
3732 ac_have_armv81_feature=yes
3733 AC_MSG_RESULT([yes])
3735 ac_have_armv81_feature=no
3738 CFLAGS="$save_CFLAGS"
3740 AM_CONDITIONAL(BUILD_ARMV81_TESTS, test x$ac_have_armv81_feature = xyes)
3743 # Does the C compiler support the armv82 flag and the assembler v8.2 instructions
3744 # Note, this doesn't generate a C-level symbol. It generates a
3745 # automake-level symbol (BUILD_ARMV82_TESTS), used in test Makefile.am's
3746 AC_MSG_CHECKING([if gcc supports the armv82 feature flag and assembler supports v8.2 instructions])
3748 save_CFLAGS="$CFLAGS"
3749 CFLAGS="$CFLAGS -march=armv8.2-a+fp16 -Werror"
3750 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3753 __asm__ __volatile__("faddp h0, v1.2h");
3757 ac_have_armv82_feature=yes
3758 AC_MSG_RESULT([yes])
3760 ac_have_armv82_feature=no
3763 CFLAGS="$save_CFLAGS"
3765 AM_CONDITIONAL(BUILD_ARMV82_TESTS, test x$ac_have_armv82_feature = xyes)
3768 # Does the C compiler support the armv82-a+dotprod flag and assembler dotprod instructions
3769 # Note, this doesn't generate a C-level symbol. It generates a
3770 # automake-level symbol (BUILD_ARMV82_DOTPROD_TESTS), used in test Makefile.am's
3771 AC_MSG_CHECKING([if gcc supports the armv82-a+dotprod feature flag and assembler supports dotprod instructions])
3773 save_CFLAGS="$CFLAGS"
3774 CFLAGS="$CFLAGS -march=armv8.2-a+dotprod -Werror"
3775 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3778 __asm__ __volatile__("sdot v1.4s, v2.16b, v3.16b");
3782 ac_have_armv82_dotprod_feature=yes
3783 AC_MSG_RESULT([yes])
3785 ac_have_armv82_dotprod_feature=no
3788 CFLAGS="$save_CFLAGS"
3790 AM_CONDITIONAL(BUILD_ARMV82_DOTPROD_TESTS, test x$ac_have_armv82_dotprod_feature = xyes)
3793 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
3794 # when building the tool executables. I think we should get rid of it.
3796 # Check for TLS support in the compiler and linker
3797 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3799 [vg_cv_linktime_tls=yes],
3800 [vg_cv_linktime_tls=no])
3801 # Native compilation: check whether running a program using TLS succeeds.
3802 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
3803 # succeeds but running programs using TLS fails.
3804 # Cross-compiling: check whether linking a program using TLS succeeds.
3805 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
3806 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
3807 [vg_cv_tls=$enableval],
3808 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3812 [vg_cv_tls=$vg_cv_linktime_tls])])])
3814 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
3815 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
3819 #----------------------------------------------------------------------------
3820 # Solaris-specific checks.
3821 #----------------------------------------------------------------------------
3823 if test "$VGCONF_OS" = "solaris" ; then
3824 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
3826 # Solaris-specific check determining if the Sun Studio Assembler is used to
3827 # build Valgrind. The test checks if the x86/amd64 assembler understands the
3828 # cmovl.l instruction, if yes then it's Sun Assembler.
3830 # C-level symbol: none
3831 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
3833 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
3834 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3836 __asm__ __volatile__("cmovl.l %edx, %eax");
3838 solaris_have_sun_studio_as=yes
3839 AC_MSG_RESULT([yes])
3841 solaris_have_sun_studio_as=no
3844 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
3846 # Solaris-specific check determining if symbols __xpg4 and __xpg6
3847 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
3848 # See solaris/vgpreload-solaris.mapfile for details.
3849 # gcc on older Solaris instructs linker to include these symbols,
3850 # gcc on illumos and newer Solaris does not.
3852 # C-level symbol: none
3853 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
3855 save_CFLAGS="$CFLAGS"
3856 CFLAGS="$CFLAGS -std=gnu99"
3857 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
3858 temp_dir=$( /usr/bin/mktemp -d )
3859 cat <<_ACEOF >${temp_dir}/mylib.c
3861 int myfunc(void) { printf("LaPutyka\n"); }
3863 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
3864 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
3865 if test "x${xpg_present}" = "x" ; then
3866 solaris_xpg_symbols_present=no
3869 solaris_xpg_symbols_present=yes
3870 AC_MSG_RESULT([yes])
3873 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
3874 CFLAGS="$save_CFLAGS"
3877 # Solaris-specific check determining if gcc enables largefile support by
3878 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
3879 # variable with gcc flags which disable it.
3881 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
3882 save_CFLAGS="$CFLAGS"
3883 CFLAGS="$CFLAGS -m32"
3884 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3885 return _LARGEFILE_SOURCE;
3887 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
3888 AC_MSG_RESULT([yes])
3890 SOLARIS_UNDEF_LARGESOURCE=""
3894 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
3897 # Solaris-specific check determining if /proc/self/cmdline
3898 # or /proc/<pid>/cmdline is supported.
3900 # C-level symbol: SOLARIS_PROC_CMDLINE
3901 # Automake-level symbol: SOLARIS_PROC_CMDLINE
3903 AC_CHECK_FILE([/proc/self/cmdline],
3905 solaris_proc_cmdline=yes
3906 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
3907 [Define to 1 if you have /proc/self/cmdline.])
3909 solaris_proc_cmdline=no
3911 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3914 # Solaris-specific check determining default platform for the Valgrind launcher.
3915 # Used in case the launcher cannot select platform by looking at the client
3916 # image (for example because the executable is a shell script).
3918 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3919 # Automake-level symbol: none
3921 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3922 # Get the ELF class of /bin/sh first.
3923 if ! test -f /bin/sh; then
3924 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3926 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3927 case "$elf_class" in
3929 default_arch="$VGCONF_ARCH_PRI";
3932 if test "x$VGCONF_ARCH_SEC" != "x"; then
3933 default_arch="$VGCONF_ARCH_SEC"
3935 default_arch="$VGCONF_ARCH_PRI";
3939 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3942 default_platform="$default_arch-$VGCONF_OS"
3943 AC_MSG_RESULT([$default_platform])
3944 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3945 [Default platform for Valgrind launcher.])
3948 # Solaris-specific check determining if the old syscalls are available.
3950 # C-level symbol: SOLARIS_OLD_SYSCALLS
3951 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3953 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3954 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3955 #include <sys/syscall.h>
3959 solaris_old_syscalls=yes
3960 AC_MSG_RESULT([yes])
3961 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3962 [Define to 1 if you have the old Solaris syscalls.])
3964 solaris_old_syscalls=no
3967 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
3970 # Solaris-specific check determining if the new accept() syscall is available.
3973 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3976 # New syscall (available on illumos):
3977 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3978 # int version, int flags);
3980 # If the old syscall is present then the following syscall will fail with
3981 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
3982 # available then it will fail with EINVAL (because the flags parameter is
3985 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
3986 # Automake-level symbol: none
3988 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
3989 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3990 #include <sys/syscall.h>
3994 syscall(SYS_accept, 0, 0, 0, 0, -1);
3995 return !(errno == EINVAL);
3997 AC_MSG_RESULT([yes])
3998 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
3999 [Define to 1 if you have the new `accept' syscall.])
4005 # Solaris-specific check determining if the new illumos pipe() syscall is
4009 # longlong_t pipe();
4011 # New syscall (available on illumos):
4012 # int pipe(intptr_t arg, int flags);
4014 # If the old syscall is present then the following call will succeed, if the
4015 # new syscall is available then it will fail with EFAULT (because address 0
4016 # cannot be accessed).
4018 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
4019 # Automake-level symbol: none
4021 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
4022 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4023 #include <sys/syscall.h>
4027 syscall(SYS_pipe, 0, 0);
4028 return !(errno == EFAULT);
4030 AC_MSG_RESULT([yes])
4031 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
4032 [Define to 1 if you have the new `pipe' syscall.])
4038 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
4042 # int lwp_kill(id_t lwpid, int sig);
4044 # New syscall (available on Solaris 11):
4045 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
4046 # int si_code, timespec_t *timeout);
4048 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
4049 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
4051 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
4052 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4053 #include <sys/syscall.h>
4055 return !SYS_lwp_sigqueue;
4057 solaris_lwp_sigqueue_syscall=yes
4058 AC_MSG_RESULT([yes])
4059 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
4060 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
4062 solaris_lwp_sigqueue_syscall=no
4065 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
4068 # Solaris-specific check determining if the lwp_sigqueue() syscall
4069 # takes both pid and thread id arguments or just thread id.
4071 # Old syscall (available up to Solaris 11.3):
4072 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
4073 # int si_code, timespec_t *timeout);
4075 # New syscall (available since Solaris 11.4):
4076 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
4077 # int si_code, timespec_t *timeout);
4079 # If the old syscall is present then the following syscall will fail with
4080 # EINVAL (because signal is out of range); if the new syscall is available
4081 # then it will fail with ESRCH (because it would not find such thread in the
4084 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4085 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
4087 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
4088 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
4089 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4090 #include <sys/syscall.h>
4094 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
4095 return !(errno == ESRCH);
4097 solaris_lwp_sigqueue_syscall_takes_pid=yes
4098 AC_MSG_RESULT([yes])
4099 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
4100 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
4102 solaris_lwp_sigqueue_syscall_takes_pid=no
4105 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
4106 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
4108 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
4112 # Solaris-specific check determining if the new lwp_name() syscall is
4115 # New syscall (available on Solaris 11):
4116 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
4118 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
4119 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
4121 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
4122 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4123 #include <sys/syscall.h>
4125 return !SYS_lwp_name;
4127 solaris_lwp_name_syscall=yes
4128 AC_MSG_RESULT([yes])
4129 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
4130 [Define to 1 if you have the new `lwp_name' syscall.])
4132 solaris_lwp_name_syscall=no
4135 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
4138 # Solaris-specific check determining if the new getrandom() syscall is
4141 # New syscall (available on Solaris 11):
4142 # int getrandom(void *buf, size_t buflen, uint_t flags);
4144 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
4145 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
4147 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
4148 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4149 #include <sys/syscall.h>
4151 return !SYS_getrandom;
4153 solaris_getrandom_syscall=yes
4154 AC_MSG_RESULT([yes])
4155 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
4156 [Define to 1 if you have the new `getrandom' syscall.])
4158 solaris_getrandom_syscall=no
4161 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
4164 # Solaris-specific check determining if the new zone() syscall subcodes
4165 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
4166 # were added in Solaris 11 but are missing on illumos.
4168 # C-level symbol: SOLARIS_ZONE_DEFUNCT
4169 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
4171 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
4172 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4173 #include <sys/zone.h>
4175 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
4177 solaris_zone_defunct=yes
4178 AC_MSG_RESULT([yes])
4179 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
4180 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
4182 solaris_zone_defunct=no
4185 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
4188 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
4189 # for auditon(2) subcode of the auditsys() syscall are available.
4190 # These commands are available in Solaris 11 and illumos but were removed
4193 # C-level symbol: SOLARIS_AUDITON_STAT
4194 # Automake-level symbol: SOLARIS_AUDITON_STAT
4196 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
4197 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4198 #include <bsm/audit.h>
4200 return !(A_GETSTAT && A_SETSTAT);
4202 solaris_auditon_stat=yes
4203 AC_MSG_RESULT([yes])
4204 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
4205 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
4207 solaris_auditon_stat=no
4210 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
4213 # Solaris-specific check determining if the new shmsys() syscall subcodes
4214 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
4215 # These subcodes were added in Solaris 11 but are missing on illumos.
4217 # C-level symbol: SOLARIS_SHM_NEW
4218 # Automake-level symbol: SOLARIS_SHM_NEW
4220 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
4221 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4222 #include <sys/ipc_impl.h>
4223 #include <sys/shm.h>
4224 #include <sys/shm_impl.h>
4226 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
4229 AC_MSG_RESULT([yes])
4230 AC_DEFINE([SOLARIS_SHM_NEW], 1,
4231 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
4236 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
4239 # Solaris-specific check determining if prxregset_t is available. Illumos
4240 # currently does not define it on the x86 platform.
4242 # C-level symbol: SOLARIS_PRXREGSET_T
4243 # Automake-level symbol: SOLARIS_PRXREGSET_T
4245 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
4246 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4247 #include <sys/procfs_isa.h>
4249 return !sizeof(prxregset_t);
4251 solaris_prxregset_t=yes
4252 AC_MSG_RESULT([yes])
4253 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
4254 [Define to 1 if you have the `prxregset_t' type.])
4256 solaris_prxregset_t=no
4259 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
4262 # Solaris-specific check determining if the new frealpathat() syscall is
4265 # New syscall (available on Solaris 11.1):
4266 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
4268 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4269 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4271 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
4272 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4273 #include <sys/syscall.h>
4275 return !SYS_frealpathat;
4277 solaris_frealpathat_syscall=yes
4278 AC_MSG_RESULT([yes])
4279 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
4280 [Define to 1 if you have the new `frealpathat' syscall.])
4282 solaris_frealpathat_syscall=no
4285 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
4288 # Solaris-specific check determining if the new uuidsys() syscall is
4291 # New syscall (available on newer Solaris):
4292 # int uuidsys(struct uuid *uuid);
4294 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
4295 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
4297 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
4298 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4299 #include <sys/syscall.h>
4301 return !SYS_uuidsys;
4303 solaris_uuidsys_syscall=yes
4304 AC_MSG_RESULT([yes])
4305 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
4306 [Define to 1 if you have the new `uuidsys' syscall.])
4308 solaris_uuidsys_syscall=no
4311 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
4314 # Solaris-specific check determining if the new labelsys() syscall subcode
4315 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
4316 # missing on illumos.
4318 # C-level symbol: SOLARIS_TNDB_GET_TNIP
4319 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
4321 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
4322 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4323 #include <sys/tsol/tndb.h>
4325 return !TNDB_GET_TNIP;
4327 solaris_tndb_get_tnip=yes
4328 AC_MSG_RESULT([yes])
4329 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
4330 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
4332 solaris_tndb_get_tnip=no
4335 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
4338 # Solaris-specific check determining if the new labelsys() syscall opcodes
4339 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
4340 # added in Solaris 11 but are missing on illumos.
4342 # C-level symbol: SOLARIS_TSOL_CLEARANCE
4343 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
4345 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
4346 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4347 #include <sys/tsol/tsyscall.h>
4349 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
4351 solaris_tsol_clearance=yes
4352 AC_MSG_RESULT([yes])
4353 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
4354 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
4356 solaris_tsol_clearance=no
4359 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
4362 # Solaris-specific check determining if the new pset() syscall subcode
4363 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
4364 # is missing on illumos and Solaris 11.3.
4366 # C-level symbol: SOLARIS_PSET_GET_NAME
4367 # Automake-level symbol: SOLARIS_PSET_GET_NAME
4369 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
4370 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4371 #include <sys/pset.h>
4373 return !(PSET_GET_NAME);
4375 solaris_pset_get_name=yes
4376 AC_MSG_RESULT([yes])
4377 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
4378 [Define to 1 if you have the `PSET_GET_NAME' constants.])
4380 solaris_pset_get_name=no
4383 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
4386 # Solaris-specific check determining if the utimesys() syscall is
4387 # available (on illumos and older Solaris).
4389 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
4390 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
4392 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
4393 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4394 #include <sys/syscall.h>
4396 return !SYS_utimesys;
4398 solaris_utimesys_syscall=yes
4399 AC_MSG_RESULT([yes])
4400 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
4401 [Define to 1 if you have the `utimesys' syscall.])
4403 solaris_utimesys_syscall=no
4406 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
4409 # Solaris-specific check determining if the utimensat() syscall is
4410 # available (on newer Solaris).
4412 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4413 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4415 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
4416 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4417 #include <sys/syscall.h>
4419 return !SYS_utimensat;
4421 solaris_utimensat_syscall=yes
4422 AC_MSG_RESULT([yes])
4423 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
4424 [Define to 1 if you have the `utimensat' syscall.])
4426 solaris_utimensat_syscall=no
4429 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
4432 # Solaris-specific check determining if the spawn() syscall is available
4433 # (on newer Solaris).
4435 # C-level symbol: SOLARIS_SPAWN_SYSCALL
4436 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
4438 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
4439 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4440 #include <sys/syscall.h>
4444 solaris_spawn_syscall=yes
4445 AC_MSG_RESULT([yes])
4446 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
4447 [Define to 1 if you have the `spawn' syscall.])
4449 solaris_spawn_syscall=no
4452 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
4455 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
4456 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
4458 # C-level symbol: SOLARIS_MODCTL_MODNVL
4459 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
4461 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
4462 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4463 #include <sys/modctl.h>
4465 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
4467 solaris_modctl_modnvl=yes
4468 AC_MSG_RESULT([yes])
4469 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
4470 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
4472 solaris_modctl_modnvl=no
4475 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
4478 # Solaris-specific check determining whether nscd (name switch cache daemon)
4479 # attaches its door at /system/volatile/name_service_door (Solaris)
4480 # or at /var/run/name_service_door (illumos).
4482 # Note that /var/run is a symlink to /system/volatile on Solaris
4483 # but not vice versa on illumos.
4485 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4486 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4488 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
4489 if test -e /system/volatile/name_service_door; then
4490 solaris_nscd_door_system_volatile=yes
4491 AC_MSG_RESULT([/system/volatile/name_service_door])
4492 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
4493 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
4495 solaris_nscd_door_system_volatile=no
4496 AC_MSG_RESULT([/var/run/name_service_door])
4498 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
4501 # Solaris-specific check determining if the new gethrt() fasttrap is available.
4503 # New fasttrap (available on Solaris 11):
4504 # hrt_t *gethrt(void);
4506 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
4507 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
4509 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
4510 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4511 #include <sys/trap.h>
4515 solaris_gethrt_fasttrap=yes
4516 AC_MSG_RESULT([yes])
4517 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
4518 [Define to 1 if you have the new `gethrt' fasttrap.])
4520 solaris_gethrt_fasttrap=no
4523 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
4526 # Solaris-specific check determining if the new get_zone_offset() fasttrap
4529 # New fasttrap (available on Solaris 11):
4530 # zonehrtoffset_t *get_zone_offset(void);
4532 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4533 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4535 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
4536 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4537 #include <sys/trap.h>
4539 return !T_GETZONEOFFSET;
4541 solaris_getzoneoffset_fasttrap=yes
4542 AC_MSG_RESULT([yes])
4543 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
4544 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
4546 solaris_getzoneoffset_fasttrap=no
4549 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
4552 # Solaris-specific check determining if the execve() syscall
4553 # takes fourth argument (flags) or not.
4555 # Old syscall (available on illumos):
4556 # int execve(const char *fname, const char **argv, const char **envp);
4558 # New syscall (available on Solaris):
4559 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
4561 # If the new syscall is present then it will fail with EINVAL (because flags
4562 # are invalid); if the old syscall is available then it will fail with ENOENT
4563 # (because the file could not be found).
4565 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4566 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4568 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
4569 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4570 #include <sys/syscall.h>
4574 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
4575 return !(errno == EINVAL);
4577 solaris_execve_syscall_takes_flags=yes
4578 AC_MSG_RESULT([yes])
4579 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
4580 [Define to 1 if you have the new `execve' syscall which accepts flags.])
4582 solaris_execve_syscall_takes_flags=no
4585 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
4586 test x$solaris_execve_syscall_takes_flags = xyes)
4589 # Solaris-specific check determining version of the repository cache protocol.
4590 # Every Solaris version uses a different one, ranging from 21 to current 25.
4591 # The check is very ugly, though.
4593 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
4594 # Automake-level symbol: none
4596 AC_PATH_PROG(DIS_PATH, dis, false)
4597 if test "x$DIS_PATH" = "xfalse"; then
4598 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
4600 # The illumos source is (or was) here
4601 # https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libscf/common/lowlevel.c#L1148
4602 # specifically the line
4604 # request.rdr_version = REPOSITORY_DOOR_VERSION;
4606 # rdr_version is a 32bit unsigned int
4607 # The macro REPOSITORY_DOOR_VERSION contains the ascii letters "Rep" in the top 3
4608 # bytes and the door version in the lowest byte. Hence we look for Rep which is 526570
4609 # in hex and then extrace the following byte.
4610 AC_CHECK_LIB(scf, scf_handle_bind, [], [
4611 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
4612 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4615 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
4616 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
4617 libscf=/usr/lib/64/libscf.so.1
4619 libscf=/usr/lib/libscf.so.1
4621 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q -E '0x(4d01)?526570'; then
4622 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
4623 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4625 hex=$( $DIS_PATH -F scf_handle_bind $libscf | grep 526570 | sed 's/.*526570//;s/,.*//' )
4626 if test -z "$hex"; then
4627 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
4628 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4630 version=$( printf "%d\n" 0x$hex )
4631 AC_MSG_RESULT([$version])
4632 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
4633 [Version number of the repository door cache protocol.])
4636 # Solaris-specific check determining if "sysstat" segment reservation type
4639 # New "sysstat" segment reservation (available on Solaris 11.4):
4640 # - program header type: PT_SUNW_SYSSTAT
4641 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
4643 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4644 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4646 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
4647 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4648 #include <sys/auxv.h>
4650 return !AT_SUN_SYSSTAT_ADDR;
4652 solaris_reserve_sysstat_addr=yes
4653 AC_MSG_RESULT([yes])
4654 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
4655 [Define to 1 if you have the new `sysstat' segment reservation.])
4657 solaris_reserve_sysstat_addr=no
4660 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
4663 # Solaris-specific check determining if "sysstat_zone" segment reservation type
4666 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
4667 # - program header type: PT_SUNW_SYSSTAT_ZONE
4668 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
4670 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4671 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4673 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
4674 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4675 #include <sys/auxv.h>
4677 return !AT_SUN_SYSSTAT_ZONE_ADDR;
4679 solaris_reserve_sysstat_zone_addr=yes
4680 AC_MSG_RESULT([yes])
4681 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
4682 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
4684 solaris_reserve_sysstat_zone_addr=no
4687 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
4690 # Solaris-specific check determining if the system_stats() syscall is available
4691 # (on newer Solaris).
4693 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4694 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4696 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
4697 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4698 #include <sys/syscall.h>
4700 return !SYS_system_stats;
4702 solaris_system_stats_syscall=yes
4703 AC_MSG_RESULT([yes])
4704 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
4705 [Define to 1 if you have the `system_stats' syscall.])
4707 solaris_system_stats_syscall=no
4710 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
4713 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
4714 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
4716 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
4717 # Automake-level symbol: none
4719 AC_CHECK_TYPE([struct _fpchip_state],
4720 [solaris_fpchip_state_takes_underscore=yes],
4721 [solaris_fpchip_state_takes_underscore=no],
4722 [[#include <sys/regset.h>]])
4723 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
4724 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
4725 [Define to 1 if fpregset_t defines struct _fpchip_state])
4729 # Solaris-specific check determining if schedctl page shared between kernel
4730 # and userspace program is executable (illumos, older Solaris) or not (newer
4733 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
4734 # Automake-level symbol: none
4736 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
4737 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4741 #include <schedctl.h>
4745 schedctl_t *scp = schedctl_init();
4749 int fd = open("/proc/self/map", O_RDONLY);
4754 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
4755 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
4756 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
4757 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
4758 return (map.pr_mflags & MA_EXEC);
4764 solaris_schedctl_page_exec=no
4767 solaris_schedctl_page_exec=yes
4768 AC_MSG_RESULT([yes])
4769 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
4770 [Define to 1 if you have the schedctl page executable.])
4774 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
4775 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
4776 # an initial thread pointer for libc (newer Solaris).
4778 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
4779 # Automake-level symbol: none
4781 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
4782 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4783 #include <sys/fasttrap_isa.h>
4785 return !FT_SCRATCHSIZE;
4787 solaris_pt_sunwdtrace_thrp=yes
4788 AC_MSG_RESULT([yes])
4789 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
4790 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
4792 solaris_pt_sunwdtrace_thrp=no
4797 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
4798 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
4799 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
4800 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
4801 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
4802 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
4803 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
4804 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
4805 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
4806 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
4807 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
4808 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
4809 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
4810 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
4811 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
4812 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
4813 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
4814 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
4815 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
4816 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
4817 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
4818 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
4819 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
4820 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
4821 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
4822 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
4823 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
4824 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
4825 fi # test "$VGCONF_OS" = "solaris"
4827 #----------------------------------------------------------------------------
4828 # FreeBSD-specific checks.
4829 #----------------------------------------------------------------------------
4831 # Rather than having a large number of feature test as above with Solaris
4832 # these tests are per-version. This may not be entirely reliable for
4833 # FreeBSD development branches (XX.Y-CURRENT) or pre-release branches
4834 # (XX.Y-STABLE) but it should work for XX-Y-RELEASE
4836 if test "$VGCONF_OS" = "freebsd" ; then
4838 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13_0)
4839 AM_CONDITIONAL(FREEBSD_VERS_15_PLUS, test $freebsd_vers -ge $freebsd_15)
4843 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, false)
4844 AM_CONDITIONAL(FREEBSD_VERS_15_PLUS, false)
4846 fi # test "$VGCONF_OS" = "freebsd"
4849 #----------------------------------------------------------------------------
4850 # Checks for C header files.
4851 #----------------------------------------------------------------------------
4853 AC_CHECK_HEADERS([ \
4871 # Verify whether the <linux/futex.h> header is usable.
4872 AC_MSG_CHECKING([if <linux/futex.h> is usable])
4874 save_CFLAGS="$CFLAGS"
4875 CFLAGS="$CFLAGS -D__user="
4876 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4877 #include <linux/futex.h>
4881 ac_have_usable_linux_futex_h=yes
4882 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
4883 [Define to 1 if you have a usable <linux/futex.h> header file.])
4884 AC_MSG_RESULT([yes])
4886 ac_have_usable_linux_futex_h=no
4889 CFLAGS="$save_CFLAGS"
4892 #----------------------------------------------------------------------------
4893 # Checks for typedefs, structures, and compiler characteristics.
4894 #----------------------------------------------------------------------------
4898 AC_CHECK_HEADERS_ONCE([sys/time.h])
4900 AC_CHECK_TYPE([struct statx], [
4901 AC_DEFINE([HAVE_STRUCT_STATX_IN_SYS_STAT_H], 1,
4902 [Define to 1 if <sys/stat.h> declares struct statx.])
4905 #include <sys/stat.h>
4909 #----------------------------------------------------------------------------
4910 # Checks for library functions.
4911 #----------------------------------------------------------------------------
4915 AC_CHECK_LIB([pthread], [pthread_create])
4916 AC_CHECK_LIB([rt], [clock_gettime])
4938 pthread_barrier_init \
4939 pthread_condattr_setclock \
4940 pthread_mutex_timedlock \
4941 pthread_rwlock_timedrdlock \
4942 pthread_rwlock_timedwrlock \
4943 pthread_setname_np \
4974 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
4975 # libraries with any shared object and/or executable. This is NOT what we
4976 # want for e.g. vgpreload_core-x86-linux.so
4979 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
4980 [test x$ac_cv_func_pthread_barrier_init = xyes])
4981 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
4982 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
4983 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
4984 [test x$ac_cv_func_pthread_spin_lock = xyes])
4985 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
4986 [test x$ac_cv_func_pthread_setname_np = xyes])
4987 AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
4988 [test x$ac_cv_func_copy_file_range = xyes])
4989 AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
4990 [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
4991 AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
4992 [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes])
4993 AM_CONDITIONAL([HAVE_SETCONTEXT], [test x$ac_cv_func_setcontext = xyes])
4994 AM_CONDITIONAL([HAVE_SWAPCONTEXT], [test x$ac_cv_func_swapcontext = xyes])
4995 AM_CONDITIONAL([HAVE_MEMFD_CREATE],
4996 [test x$ac_cv_func_memfd_create = xyes])
4997 AM_CONDITIONAL([HAVE_GETADDRINFO],
4998 [test x$ac_cv_func_getaddrinfo = xyes])
4999 AM_CONDITIONAL([HAVE_CLOSE_RANGE],
5000 [test x$ac_cv_func_close_range = xyes])
5001 AM_CONDITIONAL([HAVE_REALLOCARRAY],
5002 [test x$ac_cv_func_reallocarray = xyes])
5003 AM_CONDITIONAL([HAVE_WCSNCPY],
5004 [test x$ac_cv_func_wcsncpy = xyes])
5005 AM_CONDITIONAL([HAVE_STRLCAT],
5006 [test x$ac_cv_func_strlcat = xyes])
5007 AM_CONDITIONAL([HAVE_STRLCPY],
5008 [test x$ac_cv_func_strlcpy = xyes])
5010 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5011 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5012 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX; then
5013 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
5014 [Disable intercept pthread_spin_lock() on MIPS32, MIPS64 and nanoMIPS.])
5017 #----------------------------------------------------------------------------
5019 #----------------------------------------------------------------------------
5020 # Do we have a useable MPI setup on the primary and/or secondary targets?
5021 # On Linux, by default, assumes mpicc and -m32/-m64
5022 # Note: this is a kludge in that it assumes the specified mpicc
5023 # understands -m32/-m64 regardless of what is specified using
5025 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
5026 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
5029 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
5030 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
5031 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
5032 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
5033 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
5034 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX \
5035 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
5036 mflag_primary=$FLAG_M32
5037 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
5038 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
5039 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
5040 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
5041 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
5042 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
5043 mflag_primary=$FLAG_M64
5044 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
5045 mflag_primary="$FLAG_M32 -arch i386"
5046 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
5047 mflag_primary="$FLAG_M64 -arch x86_64"
5051 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
5052 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
5053 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
5054 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX \
5055 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD ; then
5056 mflag_secondary=$FLAG_M32
5057 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
5058 mflag_secondary="$FLAG_M32 -arch i386"
5063 [ --with-mpicc= Specify name of MPI2-ised C compiler],
5068 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
5069 ## use these values in the check for a functioning mpicc.
5071 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
5072 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
5073 AM_COND_IF([VGCONF_OS_IS_LINUX],
5074 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5075 LDFLAGS_MPI="-fpic -shared"])
5076 AM_COND_IF([VGCONF_OS_IS_FREEBSD],
5077 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5078 LDFLAGS_MPI="-fpic -shared"])
5079 AM_COND_IF([VGCONF_OS_IS_DARWIN],
5080 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
5081 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
5082 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
5083 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
5084 LDFLAGS_MPI="-fpic -shared"])
5086 AC_SUBST([CFLAGS_MPI])
5087 AC_SUBST([LDFLAGS_MPI])
5090 ## See if MPI_CC works for the primary target
5092 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
5094 saved_CFLAGS=$CFLAGS
5096 CFLAGS="$CFLAGS_MPI $mflag_primary"
5097 saved_LDFLAGS="$LDFLAGS"
5098 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
5099 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5103 int ni, na, nd, comb;
5104 int r = MPI_Init(NULL,NULL);
5105 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5106 r |= MPI_Finalize();
5109 ac_have_mpi2_pri=yes
5110 AC_MSG_RESULT([yes, $MPI_CC])
5116 CFLAGS=$saved_CFLAGS
5117 LDFLAGS="$saved_LDFLAGS"
5118 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
5120 ## See if MPI_CC works for the secondary target. Complication: what if
5121 ## there is no secondary target? We need this to then fail.
5122 ## Kludge this by making MPI_CC something which will surely fail in
5125 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
5127 saved_CFLAGS=$CFLAGS
5128 saved_LDFLAGS="$LDFLAGS"
5129 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
5130 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
5131 CC="$MPI_CC this will surely fail"
5135 CFLAGS="$CFLAGS_MPI $mflag_secondary"
5136 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5140 int ni, na, nd, comb;
5141 int r = MPI_Init(NULL,NULL);
5142 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5143 r |= MPI_Finalize();
5146 ac_have_mpi2_sec=yes
5147 AC_MSG_RESULT([yes, $MPI_CC])
5153 CFLAGS=$saved_CFLAGS
5154 LDFLAGS="$saved_LDFLAGS"
5155 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
5158 #----------------------------------------------------------------------------
5159 # Other library checks
5160 #----------------------------------------------------------------------------
5161 # There now follow some tests for Boost, and OpenMP. These
5162 # tests are present because Drd has some regression tests that use
5163 # these packages. All regression test programs all compiled only
5164 # for the primary target. And so it is important that the configure
5165 # checks that follow, use the correct -m32 or -m64 flag for the
5166 # primary target (called $mflag_primary). Otherwise, we can end up
5167 # in a situation (eg) where, on amd64-linux, the test for Boost checks
5168 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
5169 # only build (meaning, the primary target is x86-linux), the build
5170 # of the regtest programs that use Boost fails, because they are
5171 # build as 32-bit (IN THIS EXAMPLE).
5173 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
5174 # NEEDED BY THE REGRESSION TEST PROGRAMS.
5177 # Check whether the boost library 1.35 or later has been installed.
5178 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
5180 AC_MSG_CHECKING([for boost])
5183 safe_CXXFLAGS=$CXXFLAGS
5184 CXXFLAGS="$mflag_primary"
5186 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
5188 AC_LINK_IFELSE([AC_LANG_SOURCE([
5189 #include <boost/thread.hpp>
5190 static void thread_func(void)
5192 int main(int argc, char** argv)
5194 boost::thread t(thread_func);
5199 ac_have_boost_1_35=yes
5200 AC_SUBST([BOOST_CFLAGS], [])
5201 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
5202 AC_MSG_RESULT([yes])
5204 ac_have_boost_1_35=no
5209 CXXFLAGS=$safe_CXXFLAGS
5212 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
5215 # does this compiler support -fopenmp, does it have the include file
5216 # <omp.h> and does it have libgomp ?
5218 AC_MSG_CHECKING([for OpenMP])
5221 CFLAGS="-fopenmp $mflag_primary -Werror"
5223 AC_LINK_IFELSE([AC_LANG_SOURCE([
5225 int main(int argc, char** argv)
5233 AC_MSG_RESULT([yes])
5240 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
5243 # Check for __builtin_popcount
5244 AC_MSG_CHECKING([for __builtin_popcount()])
5245 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5247 __builtin_popcount(2);
5250 AC_MSG_RESULT([yes])
5251 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
5252 [Define to 1 if compiler provides __builtin_popcount().])
5257 # Check for __builtin_clz
5258 AC_MSG_CHECKING([for __builtin_clz()])
5259 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5264 AC_MSG_RESULT([yes])
5265 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
5266 [Define to 1 if compiler provides __builtin_clz().])
5271 # Check for __builtin_ctz
5272 AC_MSG_CHECKING([for __builtin_ctz()])
5273 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5278 AC_MSG_RESULT([yes])
5279 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
5280 [Define to 1 if compiler provides __builtin_ctz().])
5285 # does this compiler have built-in functions for atomic memory access for the
5287 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
5290 CFLAGS="$mflag_primary"
5292 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5294 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5295 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5297 ac_have_builtin_atomic_primary=yes
5298 AC_MSG_RESULT([yes])
5299 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])
5301 ac_have_builtin_atomic_primary=no
5307 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
5308 [test x$ac_have_builtin_atomic_primary = xyes])
5311 # does this compiler have built-in functions for atomic memory access for the
5312 # secondary target ?
5314 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5316 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
5319 CFLAGS="$mflag_secondary"
5321 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5323 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
5325 ac_have_builtin_atomic_secondary=yes
5326 AC_MSG_RESULT([yes])
5328 ac_have_builtin_atomic_secondary=no
5336 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
5337 [test x$ac_have_builtin_atomic_secondary = xyes])
5339 # does this compiler have built-in functions for atomic memory access on
5340 # 64-bit integers for all targets ?
5342 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
5344 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5347 uint64_t variable = 1;
5348 return __sync_add_and_fetch(&variable, 1)
5350 ac_have_builtin_atomic64_primary=yes
5352 ac_have_builtin_atomic64_primary=no
5355 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5358 CFLAGS="$mflag_secondary"
5360 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5363 uint64_t variable = 1;
5364 return __sync_add_and_fetch(&variable, 1)
5366 ac_have_builtin_atomic64_secondary=yes
5368 ac_have_builtin_atomic64_secondary=no
5375 if test x$ac_have_builtin_atomic64_primary = xyes && \
5376 test x$VGCONF_PLATFORM_SEC_CAPS = x \
5377 -o x$ac_have_builtin_atomic64_secondary = xyes; then
5378 AC_MSG_RESULT([yes])
5379 ac_have_builtin_atomic64=yes
5382 ac_have_builtin_atomic64=no
5385 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
5386 [test x$ac_have_builtin_atomic64 = xyes])
5389 AC_MSG_CHECKING([if platform has openat2 syscall])
5391 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5392 #include <sys/syscall.h>
5397 AC_MSG_RESULT([yes])
5403 AM_CONDITIONAL([HAVE_OPENAT2],
5404 [test x$ac_have_openat2 = xyes])
5410 AC_MSG_CHECKING([if platform has openssl crypto])
5412 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5413 #include <openssl/crypto.h>
5415 CRYPTO_secure_malloc_init(1<<20, 8);
5418 AC_MSG_RESULT([yes])
5425 AM_CONDITIONAL([HAVE_OPENSSL],
5426 [test x$ac_have_openssl = xyes])
5428 AC_MSG_CHECKING([if platform has aio_readv])
5430 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5436 ac_have_aio_readv=yes
5437 AC_MSG_RESULT([yes])
5440 ac_have_aio_readv=no
5444 AM_CONDITIONAL([HAVE_AIO_READV],
5445 [test x$ac_have_aio_readv = xyes])
5447 # does g++ have built-in functions for atomic memory access ?
5448 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
5450 safe_CXXFLAGS=$CXXFLAGS
5451 CXXFLAGS="$mflag_primary"
5454 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5456 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5457 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5459 ac_have_builtin_atomic_cxx=yes
5460 AC_MSG_RESULT([yes])
5461 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
5463 ac_have_builtin_atomic_cxx=no
5468 CXXFLAGS=$safe_CXXFLAGS
5470 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
5473 if test x$ac_have_usable_linux_futex_h = xyes \
5474 -a x$ac_have_builtin_atomic_primary = xyes; then
5475 ac_enable_linux_ticket_lock_primary=yes
5477 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
5478 [test x$ac_enable_linux_ticket_lock_primary = xyes])
5480 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
5481 -a x$ac_have_usable_linux_futex_h = xyes \
5482 -a x$ac_have_builtin_atomic_secondary = xyes; then
5483 ac_enable_linux_ticket_lock_secondary=yes
5485 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
5486 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
5489 # does libstdc++ support annotating shared pointers ?
5490 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
5492 safe_CXXFLAGS=$CXXFLAGS
5493 CXXFLAGS="-std=c++0x"
5496 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5499 std::shared_ptr<int> p
5501 ac_have_shared_ptr=yes
5503 ac_have_shared_ptr=no
5505 if test x$ac_have_shared_ptr = xyes; then
5506 # If compilation of the program below fails because of a syntax error
5507 # triggered by substituting one of the annotation macros then that
5508 # means that libstdc++ supports these macros.
5509 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5510 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
5511 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
5514 std::shared_ptr<int> p
5516 ac_have_shared_pointer_annotation=no
5519 ac_have_shared_pointer_annotation=yes
5520 AC_MSG_RESULT([yes])
5521 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
5522 [Define to 1 if libstd++ supports annotating shared pointers])
5525 ac_have_shared_pointer_annotation=no
5530 CXXFLAGS=$safe_CXXFLAGS
5532 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
5533 [test x$ac_have_shared_pointer_annotation = xyes])
5535 # checking for GNU libc C17 aligned_alloc
5536 # just check glibc version rather than trying to muck around
5537 # checking the runtime behaviour or seeing if it is a weak alias
5538 AC_MSG_CHECKING([for AT_GNU_LIBC_C17_ALIGNED_ALLOC])
5539 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5540 #include <features.h>
5542 #if !defined(__GLIBC__) || __GLIBC__ != 2 || !defined(__GLIBC_MINOR__) || __GLIBC_MINOR__ < 38
5543 #error "not GNU libc 2.38 or later"
5546 AC_MSG_RESULT([yes])
5547 AC_DEFINE([HAVE_GNU_LIBC_C17_ALIGNED_ALLOC], 1,
5548 [Define to 1 if you have GNU libc C17 aligned_alloc.])
5554 # Check for C11 thrd_create()
5555 AC_MSG_CHECKING([for thrd_create()])
5556 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
5557 #include <threads.h>
5558 int thrd_entry(void *arg) { return 0; }
5559 ], [[thrd_t thr; return thrd_create(&thr, thrd_entry, NULL);]])],
5561 ac_cxx_have_thrd_create=yes
5562 AC_MSG_RESULT([yes])
5564 ac_cxx_have_thrd_create=no
5568 AM_CONDITIONAL(HAVE_THRD_CREATE, test x$ac_cxx_have_thrd_create = xyes)
5572 #----------------------------------------------------------------------------
5573 # Ok. We're done checking.
5574 #----------------------------------------------------------------------------
5576 # Nb: VEX/Makefile is generated from Makefile.vex.in.
5579 VEX/Makefile:Makefile.vex.in
5583 glibc-2.X-helgrind.supp
5587 docs/xml/vg-entities.xml
5592 gdbserver_tests/Makefile
5593 gdbserver_tests/solaris/Makefile
5599 memcheck/tests/Makefile
5600 memcheck/tests/common/Makefile
5601 memcheck/tests/amd64/Makefile
5602 memcheck/tests/x86/Makefile
5603 memcheck/tests/linux/Makefile
5604 memcheck/tests/linux/debuginfod-check.vgtest
5605 memcheck/tests/darwin/Makefile
5606 memcheck/tests/solaris/Makefile
5607 memcheck/tests/freebsd/Makefile
5608 memcheck/tests/amd64-linux/Makefile
5609 memcheck/tests/arm64-linux/Makefile
5610 memcheck/tests/x86-linux/Makefile
5611 memcheck/tests/amd64-solaris/Makefile
5612 memcheck/tests/x86-solaris/Makefile
5613 memcheck/tests/amd64-freebsd/Makefile
5614 memcheck/tests/x86-freebsd/Makefile
5615 memcheck/tests/ppc32/Makefile
5616 memcheck/tests/ppc64/Makefile
5617 memcheck/tests/s390x/Makefile
5618 memcheck/tests/mips32/Makefile
5619 memcheck/tests/mips64/Makefile
5620 memcheck/tests/vbit-test/Makefile
5622 cachegrind/tests/Makefile
5623 cachegrind/tests/x86/Makefile
5624 cachegrind/cg_annotate
5628 callgrind/callgrind_annotate
5629 callgrind/callgrind_control
5630 callgrind/tests/Makefile
5632 helgrind/tests/Makefile
5634 drd/scripts/download-and-build-splash2
5637 massif/tests/Makefile
5642 lackey/tests/Makefile
5645 none/tests/scripts/Makefile
5646 none/tests/amd64/Makefile
5647 none/tests/ppc32/Makefile
5648 none/tests/ppc64/Makefile
5649 none/tests/x86/Makefile
5650 none/tests/arm/Makefile
5651 none/tests/arm64/Makefile
5652 none/tests/s390x/Makefile
5653 none/tests/mips32/Makefile
5654 none/tests/mips64/Makefile
5655 none/tests/nanomips/Makefile
5656 none/tests/linux/Makefile
5657 none/tests/darwin/Makefile
5658 none/tests/solaris/Makefile
5659 none/tests/freebsd/Makefile
5660 none/tests/amd64-linux/Makefile
5661 none/tests/x86-linux/Makefile
5662 none/tests/amd64-darwin/Makefile
5663 none/tests/x86-darwin/Makefile
5664 none/tests/amd64-solaris/Makefile
5665 none/tests/x86-solaris/Makefile
5666 none/tests/x86-freebsd/Makefile
5668 exp-bbv/tests/Makefile
5669 exp-bbv/tests/x86/Makefile
5670 exp-bbv/tests/x86-linux/Makefile
5671 exp-bbv/tests/amd64-linux/Makefile
5672 exp-bbv/tests/ppc32-linux/Makefile
5673 exp-bbv/tests/arm-linux/Makefile
5677 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
5678 [chmod +x coregrind/link_tool_exe_linux])
5679 AC_CONFIG_FILES([coregrind/link_tool_exe_freebsd],
5680 [chmod +x coregrind/link_tool_exe_freebsd])
5681 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
5682 [chmod +x coregrind/link_tool_exe_darwin])
5683 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
5684 [chmod +x coregrind/link_tool_exe_solaris])
5685 AC_CONFIG_FILES([tests/filter_stderr_basic],
5686 [chmod +x tests/filter_stderr_basic])
5687 AC_CONFIG_FILES([tests/filter_discards],
5688 [chmod +x tests/filter_discards])
5689 AC_CONFIG_FILES([memcheck/tests/filter_stderr],
5690 [chmod +x memcheck/tests/filter_stderr])
5691 AC_CONFIG_FILES([memcheck/tests/filter_dw4],
5692 [chmod +x memcheck/tests/filter_dw4])
5693 AC_CONFIG_FILES([memcheck/tests/filter_overlaperror],
5694 [chmod +x memcheck/tests/filter_overlaperror])
5695 AC_CONFIG_FILES([memcheck/tests/x86/filter_pushfpopf],
5696 [chmod +x memcheck/tests/x86/filter_pushfpopf])
5697 AC_CONFIG_FILES([gdbserver_tests/filter_gdb],
5698 [chmod +x gdbserver_tests/filter_gdb])
5699 AC_CONFIG_FILES([gdbserver_tests/filter_memcheck_monitor],
5700 [chmod +x gdbserver_tests/filter_memcheck_monitor])
5701 AC_CONFIG_FILES([gdbserver_tests/filter_stderr],
5702 [chmod +x gdbserver_tests/filter_stderr])
5703 AC_CONFIG_FILES([gdbserver_tests/filter_vgdb],
5704 [chmod +x gdbserver_tests/filter_vgdb])
5705 AC_CONFIG_FILES([drd/tests/filter_stderr],
5706 [chmod +x drd/tests/filter_stderr])
5707 AC_CONFIG_FILES([drd/tests/filter_error_count],
5708 [chmod +x drd/tests/filter_error_count])
5709 AC_CONFIG_FILES([drd/tests/filter_error_summary],
5710 [chmod +x drd/tests/filter_error_summary])
5711 AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
5712 [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
5713 AC_CONFIG_FILES([drd/tests/filter_thread_no],
5714 [chmod +x drd/tests/filter_thread_no])
5715 AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
5716 [chmod +x drd/tests/filter_xml_and_thread_no])
5717 AC_CONFIG_FILES([helgrind/tests/filter_stderr],
5718 [chmod +x helgrind/tests/filter_stderr])
5724 Maximum build arch: ${ARCH_MAX}
5725 Primary build arch: ${VGCONF_ARCH_PRI}
5726 Secondary build arch: ${VGCONF_ARCH_SEC}
5727 Build OS: ${VGCONF_OS}
5728 Link Time Optimisation: ${vg_cv_lto}
5729 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
5730 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
5731 Platform variant: ${VGCONF_PLATVARIANT}
5732 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
5733 Default supp files: ${DEFAULT_SUPP}