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], [21])
19 m4_define([v_micro_ver], [0])
20 m4_define([v_suffix_ver], [GIT])
21 m4_define([v_rel_date], ["?? Apr 2023"])
22 m4_define([v_version],
23 m4_if(v_suffix_ver, [],
24 [v_major_ver.v_minor_ver.v_micro_ver],
25 [v_major_ver.v_minor_ver.v_micro_ver.v_suffix_ver]))
26 AC_INIT([Valgrind],[v_version],[valgrind-users@lists.sourceforge.net])
29 AC_SUBST(VG_VER_MAJOR, v_major_ver)
30 AC_SUBST(VG_VER_MINOR, v_minor_ver)
32 # For docs/xml/vg-entities.xml
33 AC_SUBST(VG_DATE, v_rel_date)
35 AC_CONFIG_SRCDIR(coregrind/m_main.c)
36 AC_CONFIG_HEADERS([config.h])
37 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
41 #----------------------------------------------------------------------------
42 # Do NOT modify these flags here. Except in feature tests in which case
43 # the original values must be properly restored.
44 #----------------------------------------------------------------------------
48 #----------------------------------------------------------------------------
49 # Checks for various programs.
50 #----------------------------------------------------------------------------
53 m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
54 # Make sure we can compile in C99 mode.
55 if test "$ac_cv_prog_cc_c99" = "no"; then
56 AC_MSG_ERROR([Valgrind relies on a C compiler supporting C99])
60 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
61 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
62 # base (eg. most likely as Darwin-specific tests) we'll need one of the
64 # - put AC_PROG_OBJC in a Darwin-specific part of this file
65 # - Use AC_PROG_OBJC here and up the minimum autoconf version
66 # - Use the following, which is apparently equivalent:
67 # m4_ifdef([AC_PROG_OBJC],
69 # [AC_CHECK_TOOL([OBJC], [gcc])
71 # AC_SUBST([OBJCFLAGS])
74 # Set LTO_RANLIB variable to an lto enabled ranlib
75 if test "x$LTO_RANLIB" = "x"; then
76 AC_PATH_PROGS([LTO_RANLIB], [gcc-ranlib])
78 AC_ARG_VAR([LTO_RANLIB],[Library indexer command for link time optimisation])
80 # provide a very basic definition for AC_PROG_SED if it's not provided by
81 # autoconf (as e.g. in autoconf 2.59).
82 m4_ifndef([AC_PROG_SED],
83 [AC_DEFUN([AC_PROG_SED],
85 AC_CHECK_PROGS([SED],[gsed sed])])])
88 AC_DEFUN([AC_PROG_SHA256SUM],
89 [AC_ARG_VAR([SHA256SUM])
90 AC_CHECK_PROGS([SHA256SUM],[gsha256sum sha256sum])])
93 # If no AR variable was specified, look up the name of the archiver. Otherwise
94 # do not touch the AR variable.
95 if test "x$AR" = "x"; then
96 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
98 AC_ARG_VAR([AR],[Archiver command])
100 # same for LTO_AR variable for lto enabled archiver
101 if test "x$LTO_AR" = "x"; then
102 AC_PATH_PROGS([LTO_AR], [gcc-ar])
104 AC_ARG_VAR([LTO_AR],[Archiver command for link time optimisation])
107 # Check for the compiler support
108 if test "${GCC}" != "yes" ; then
109 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
112 # figure out where perl lives
113 AC_PATH_PROG(PERL, perl)
115 # figure out where gdb lives
116 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
117 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
119 # some older automake's don't have it so try something on our own
120 ifdef([AM_PROG_AS],[AM_PROG_AS],
130 # Check if 'diff' supports -u (universal diffs) and use it if possible.
132 AC_MSG_CHECKING([for diff -u])
135 # Comparing two identical files results in 0.
136 tmpfile="tmp-xxx-yyy-zzz"
138 if diff -u $tmpfile $tmpfile ; then
147 # We don't want gcc < 3.0
148 AC_MSG_CHECKING([for a supported version of gcc])
150 # Obtain the compiler version.
152 # A few examples of how the ${CC} --version output looks like:
154 # ######## gcc variants ########
155 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
156 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
157 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
158 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
159 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
160 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
161 # 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)
163 # ######## clang variants ########
164 # Clang: clang version 2.9 (tags/RELEASE_29/final)
165 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
166 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
168 # ######## Apple LLVM variants ########
169 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
170 # Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
173 if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
176 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
177 elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
180 # Don't use -dumpversion with clang: it will always produce "4.2.1".
181 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
182 elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
185 gcc_version=`${CC} -dumpversion 2>/dev/null`
188 gcc_version=`${CC} -dumpversion 2>/dev/null`
189 if test "x$gcc_version" = x; then
190 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
194 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
195 AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
197 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
198 # statements have to be quoted.
199 case "${is_clang}-${gcc_version}" in
200 applellvm-5.1|applellvm-[[6-9]].*|applellvm-[[1-9][0-9]]*)
201 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
203 icc-1[[3-9]].*|icc-202[[0-9]].*)
204 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
206 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
207 AC_MSG_RESULT([ok (${gcc_version})])
209 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
210 AC_MSG_RESULT([ok (clang-${gcc_version})])
213 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
214 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0 or Apple LLVM >= 5.1])
218 #----------------------------------------------------------------------------
219 # Arch/OS/platform tests.
220 #----------------------------------------------------------------------------
221 # We create a number of arch/OS/platform-related variables. We prefix them
222 # all with "VGCONF_" which indicates that they are defined at
223 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
224 # variables used when compiling C files.
228 AC_MSG_CHECKING([for a supported CPU])
230 # ARCH_MAX reflects the most that this CPU can do: for example if it
231 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
232 # Ditto for amd64. It is used for more configuration below, but is not used
235 # Power PC returns powerpc for Big Endian. This was not changed when Little
236 # Endian support was added to the 64-bit architecture. The 64-bit Little
237 # Endian systems explicitly state le in the host_cpu. For clarity in the
238 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianness of
239 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
240 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
241 # Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
242 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
243 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
246 case "${host_cpu}" in
248 AC_MSG_RESULT([ok (${host_cpu})])
253 AC_MSG_RESULT([ok (${host_cpu})])
258 # this only referrs to 64-bit Big Endian
259 AC_MSG_RESULT([ok (${host_cpu})])
264 # this only referrs to 64-bit Little Endian
265 AC_MSG_RESULT([ok (${host_cpu})])
270 # On Linux this means only a 32-bit capable CPU.
271 AC_MSG_RESULT([ok (${host_cpu})])
276 AC_MSG_RESULT([ok (${host_cpu})])
281 AC_MSG_RESULT([ok (${host_cpu})])
286 AC_MSG_RESULT([ok (${host_cpu})])
291 AC_MSG_RESULT([ok (${host_cpu})])
296 AC_MSG_RESULT([ok (${host_cpu})])
301 AC_MSG_RESULT([ok (${host_cpu})])
306 AC_MSG_RESULT([ok (${host_cpu})])
311 AC_MSG_RESULT([ok (${host_cpu})])
315 AC_MSG_RESULT([ok (${host_cpu})])
320 AC_MSG_RESULT([no (${host_cpu})])
321 AC_MSG_ERROR([Unsupported host architecture. Sorry])
325 #----------------------------------------------------------------------------
327 # Sometimes it's convenient to subvert the bi-arch build system and
328 # just have a single build even though the underlying platform is
329 # capable of both. Hence handle --enable-only64bit and
330 # --enable-only32bit. Complain if both are issued :-)
331 # [Actually, if either of these options are used, I think both get built,
332 # but only one gets installed. So if you use an in-place build, both can be
335 # Check if a 64-bit only build has been requested
336 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
337 [AC_ARG_ENABLE(only64bit,
338 [ --enable-only64bit do a 64-bit only build],
339 [vg_cv_only64bit=$enableval],
340 [vg_cv_only64bit=no])])
342 # Check if a 32-bit only build has been requested
343 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
344 [AC_ARG_ENABLE(only32bit,
345 [ --enable-only32bit do a 32-bit only build],
346 [vg_cv_only32bit=$enableval],
347 [vg_cv_only32bit=no])])
350 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
352 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
355 #----------------------------------------------------------------------------
357 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
358 # compilation of many C files via -VGO_$(VGCONF_OS) and
359 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
360 AC_MSG_CHECKING([for a supported OS])
367 AC_MSG_RESULT([ok (${host_os})])
370 # Ok, this is linux. Check the kernel version
371 AC_MSG_CHECKING([for the kernel version])
376 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
377 AC_MSG_RESULT([unsupported (${kernel})])
378 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
382 AC_MSG_RESULT([2.6 or later (${kernel})])
389 AC_MSG_RESULT([ok (${host_os})])
391 AC_DEFINE([FREEBSD_10], 1000, [FREEBSD_VERS value for FreeBSD 10.x])
393 AC_DEFINE([FREEBSD_11], 1100, [FREEBSD_VERS value for FreeBSD 11.x])
395 AC_DEFINE([FREEBSD_12], 1200, [FREEBSD_VERS value for FreeBSD 12.0 to 12.1])
397 AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2])
399 AC_DEFINE([FREEBSD_13_0], 1300, [FREEBSD_VERS value for FreeBSD 13.0])
401 AC_DEFINE([FREEBSD_13_1], 1310, [FREEBSD_VERS value for FreeBSD 13.1+])
403 AC_DEFINE([FREEBSD_14], 1400, [FREEBSD_VERS value for FreeBSD 14.x])
406 AC_MSG_CHECKING([for the kernel version])
411 AC_MSG_RESULT([FreeBSD 10.x (${kernel})])
412 AC_DEFINE([FREEBSD_VERS], FREEBSD_10, [FreeBSD version])
413 freebsd_vers=$freebsd_10
416 AC_MSG_RESULT([FreeBSD 11.x (${kernel})])
417 AC_DEFINE([FREEBSD_VERS], FREEBSD_11, [FreeBSD version])
418 freebsd_vers=$freebsd_11
423 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
424 AC_DEFINE([FREEBSD_VERS], FREEBSD_12, [FreeBSD version])
425 freebsd_vers=$freebsd_12
428 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
429 AC_DEFINE([FREEBSD_VERS], FREEBSD_12_2, [FreeBSD version])
430 freebsd_vers=$freebsd_12_2
437 AC_MSG_RESULT([FreeBSD 13.0 (${kernel})])
438 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_0, [FreeBSD version])
439 freebsd_vers=$freebsd_13_0
442 AC_MSG_RESULT([FreeBSD 13.1+ (${kernel})])
443 AC_DEFINE([FREEBSD_VERS], FREEBSD_13_1, [FreeBSD version])
444 freebsd_vers=$freebsd_13_1
449 AC_MSG_RESULT([FreeBSD 14.x (${kernel})])
450 AC_DEFINE([FREEBSD_VERS], FREEBSD_14, [FreeBSD version])
451 freebsd_vers=$freebsd_14
454 AC_MSG_RESULT([unsupported (${kernel})])
455 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 14.x])
459 DEFAULT_SUPP="$srcdir/freebsd.supp $srcdir/freebsd-helgrind.supp $srcdir/freebsd-drd.supp ${DEFAULT_SUPP}"
463 AC_MSG_RESULT([ok (${host_os})])
465 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
466 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
467 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
468 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
469 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
470 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
471 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
472 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
473 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
475 AC_MSG_CHECKING([for the kernel version])
478 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
479 # has only one relevant version, the OS version. The `uname` check
480 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
481 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
482 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
483 # and we don't know of an macros similar to __GLIBC__ to get that info.
485 # XXX: `uname -r` won't do the right thing for cross-compiles, but
486 # that's not a problem yet.
488 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
489 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
490 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
491 # time support for 10.5 (the 9.* pattern just below), I'll leave it
492 # in for now, just in case anybody wants to give it a try. But I'm
493 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
496 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
497 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
498 DEFAULT_SUPP="$srcdir/darwin9.supp ${DEFAULT_SUPP}"
499 DEFAULT_SUPP="$srcdir/darwin9-drd.supp ${DEFAULT_SUPP}"
502 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
503 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
504 DEFAULT_SUPP="$srcdir/darwin10.supp ${DEFAULT_SUPP}"
505 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
508 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
509 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
510 DEFAULT_SUPP="$srcdir/darwin11.supp ${DEFAULT_SUPP}"
511 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
514 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
515 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
516 DEFAULT_SUPP="$srcdir/darwin12.supp ${DEFAULT_SUPP}"
517 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
520 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
521 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
522 DEFAULT_SUPP="$srcdir/darwin13.supp ${DEFAULT_SUPP}"
523 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
526 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
527 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
528 DEFAULT_SUPP="$srcdir/darwin14.supp ${DEFAULT_SUPP}"
529 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
532 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
533 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
534 DEFAULT_SUPP="$srcdir/darwin15.supp ${DEFAULT_SUPP}"
535 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
538 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
539 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
540 DEFAULT_SUPP="$srcdir/darwin16.supp ${DEFAULT_SUPP}"
541 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
544 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
545 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
546 DEFAULT_SUPP="$srcdir/darwin17.supp ${DEFAULT_SUPP}"
547 DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}"
550 AC_MSG_RESULT([unsupported (${kernel})])
551 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)])
557 AC_MSG_RESULT([ok (${host_os})])
560 uname_v=$( uname -v )
563 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
566 DEFAULT_SUPP="$srcdir/solaris11.supp ${DEFAULT_SUPP}"
572 AC_MSG_RESULT([ok (${host_os})])
574 DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}"
578 AC_MSG_RESULT([no (${host_os})])
579 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
583 #----------------------------------------------------------------------------
585 # If we are building on a 64 bit platform test to see if the system
586 # supports building 32 bit programs and disable 32 bit support if it
587 # does not support building 32 bit programs
589 case "$ARCH_MAX-$VGCONF_OS" in
590 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
591 AC_MSG_CHECKING([for 32 bit build support])
594 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
599 vg_cv_only64bit="yes"
602 CFLAGS=$safe_CFLAGS;;
604 AC_MSG_CHECKING([for 32 bit build support])
606 CFLAGS="$CFLAGS -mips32 -mabi=32"
607 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
608 #include <sys/prctl.h>
612 vg_cv_only64bit="yes"
615 CFLAGS=$safe_CFLAGS;;
618 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
620 [--enable-only32bit was specified but system does not support 32 bit builds])
623 #----------------------------------------------------------------------------
625 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
626 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
627 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
628 # above) will be "amd64" since that reflects the most that this cpu can do,
629 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
630 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
631 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
632 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
633 AC_SUBST(VGCONF_ARCH_PRI)
635 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
636 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
637 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
638 # It is empty if there is no secondary target.
639 AC_SUBST(VGCONF_ARCH_SEC)
641 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
642 # The entire system, including regression and performance tests, will be
643 # built for this target. The "_CAPS" indicates that the name is in capital
644 # letters, and it also uses '_' rather than '-' as a separator, because it's
645 # used to create various Makefile variables, which are all in caps by
646 # convention and cannot contain '-' characters. This is in contrast to
647 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
648 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
650 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
651 # Valgrind and tools will also be built for this target, but not the
652 # regression or performance tests.
654 # By default, the primary arch is the same as the "max" arch, as commented
655 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
656 # the big case statement just below here, in the case where we're building
657 # on a 64 bit machine but have been requested only to do a 32 bit build.
658 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
660 AC_MSG_CHECKING([for a supported CPU/OS combination])
662 # NB. The load address for a given platform may be specified in more
663 # than one place, in some cases, depending on whether we're doing a biarch,
664 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
665 # Be careful to give consistent values in all subcases. Also, all four
666 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
667 # even if it is to "0xUNSET".
669 case "$ARCH_MAX-$VGCONF_OS" in
671 VGCONF_ARCH_PRI="x86"
673 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
674 VGCONF_PLATFORM_SEC_CAPS=""
675 valt_load_address_pri_norml="0x58000000"
676 valt_load_address_pri_inner="0x38000000"
677 valt_load_address_sec_norml="0xUNSET"
678 valt_load_address_sec_inner="0xUNSET"
679 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
682 valt_load_address_sec_norml="0xUNSET"
683 valt_load_address_sec_inner="0xUNSET"
684 if test x$vg_cv_only64bit = xyes; then
685 VGCONF_ARCH_PRI="amd64"
687 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
688 VGCONF_PLATFORM_SEC_CAPS=""
689 valt_load_address_pri_norml="0x58000000"
690 valt_load_address_pri_inner="0x38000000"
691 elif test x$vg_cv_only32bit = xyes; then
692 VGCONF_ARCH_PRI="x86"
694 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
695 VGCONF_PLATFORM_SEC_CAPS=""
696 valt_load_address_pri_norml="0x58000000"
697 valt_load_address_pri_inner="0x38000000"
699 VGCONF_ARCH_PRI="amd64"
700 VGCONF_ARCH_SEC="x86"
701 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
702 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
703 valt_load_address_pri_norml="0x58000000"
704 valt_load_address_pri_inner="0x38000000"
705 valt_load_address_sec_norml="0x58000000"
706 valt_load_address_sec_inner="0x38000000"
708 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
711 VGCONF_ARCH_PRI="ppc32"
713 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
714 VGCONF_PLATFORM_SEC_CAPS=""
715 valt_load_address_pri_norml="0x58000000"
716 valt_load_address_pri_inner="0x38000000"
717 valt_load_address_sec_norml="0xUNSET"
718 valt_load_address_sec_inner="0xUNSET"
719 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
722 valt_load_address_sec_norml="0xUNSET"
723 valt_load_address_sec_inner="0xUNSET"
724 if test x$vg_cv_only64bit = xyes; then
725 VGCONF_ARCH_PRI="ppc64be"
727 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
728 VGCONF_PLATFORM_SEC_CAPS=""
729 valt_load_address_pri_norml="0x58000000"
730 valt_load_address_pri_inner="0x38000000"
731 elif test x$vg_cv_only32bit = xyes; then
732 VGCONF_ARCH_PRI="ppc32"
734 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
735 VGCONF_PLATFORM_SEC_CAPS=""
736 valt_load_address_pri_norml="0x58000000"
737 valt_load_address_pri_inner="0x38000000"
739 VGCONF_ARCH_PRI="ppc64be"
740 VGCONF_ARCH_SEC="ppc32"
741 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
742 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
743 valt_load_address_pri_norml="0x58000000"
744 valt_load_address_pri_inner="0x38000000"
745 valt_load_address_sec_norml="0x58000000"
746 valt_load_address_sec_inner="0x38000000"
748 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
751 # Little Endian is only supported on PPC64
752 valt_load_address_sec_norml="0xUNSET"
753 valt_load_address_sec_inner="0xUNSET"
754 VGCONF_ARCH_PRI="ppc64le"
756 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
757 VGCONF_PLATFORM_SEC_CAPS=""
758 valt_load_address_pri_norml="0x58000000"
759 valt_load_address_pri_inner="0x38000000"
760 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
763 VGCONF_ARCH_PRI="x86"
765 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
766 VGCONF_PLATFORM_SEC_CAPS=""
767 valt_load_address_pri_norml="0x38000000"
768 valt_load_address_pri_inner="0x28000000"
769 valt_load_address_sec_norml="0xUNSET"
770 valt_load_address_sec_inner="0xUNSET"
771 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
774 if test x$vg_cv_only64bit = xyes; then
775 VGCONF_ARCH_PRI="amd64"
777 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
778 VGCONF_PLATFORM_SEC_CAPS=""
779 elif test x$vg_cv_only32bit = xyes; then
780 VGCONF_ARCH_PRI="x86"
782 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
783 VGCONF_PLATFORM_SEC_CAPS=""
785 VGCONF_ARCH_PRI="amd64"
786 VGCONF_ARCH_SEC="x86"
787 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
788 VGCONF_PLATFORM_SEC_CAPS="X86_FREEBSD"
790 # These work with either base clang or ports installed gcc
791 # Hand rolled compilers probably need INSTALL_DIR/lib (at least for gcc)
792 if test x$is_clang = xclang ; then
793 FLAG_32ON64="-B/usr/lib32"
795 GCC_MAJOR_VERSION=`${CC} -dumpversion | $SED 's/\..*//' 2>/dev/null`
796 FLAG_32ON64="-B/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -Wl,-rpath,/usr/local/lib32/gcc${GCC_MAJOR_VERSION}/"
798 valt_load_address_pri_norml="0x38000000"
799 valt_load_address_pri_inner="0x28000000"
800 valt_load_address_sec_norml="0x38000000"
801 valt_load_address_sec_inner="0x28000000"
802 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
804 # Darwin gets identified as 32-bit even when it supports 64-bit.
805 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
806 # all Macs support both 32-bit and 64-bit, so we just build both. If
807 # someone has a really old 32-bit only machine they can (hopefully?)
808 # build with --enable-only32bit. See bug 243362.
809 x86-darwin|amd64-darwin)
811 valt_load_address_sec_norml="0xUNSET"
812 valt_load_address_sec_inner="0xUNSET"
813 if test x$vg_cv_only64bit = xyes; then
814 VGCONF_ARCH_PRI="amd64"
816 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
817 VGCONF_PLATFORM_SEC_CAPS=""
818 valt_load_address_pri_norml="0x158000000"
819 valt_load_address_pri_inner="0x138000000"
820 elif test x$vg_cv_only32bit = xyes; then
821 VGCONF_ARCH_PRI="x86"
823 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
824 VGCONF_PLATFORM_SEC_CAPS=""
825 VGCONF_ARCH_PRI_CAPS="x86"
826 valt_load_address_pri_norml="0x58000000"
827 valt_load_address_pri_inner="0x38000000"
829 VGCONF_ARCH_PRI="amd64"
830 VGCONF_ARCH_SEC="x86"
831 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
832 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
833 valt_load_address_pri_norml="0x158000000"
834 valt_load_address_pri_inner="0x138000000"
835 valt_load_address_sec_norml="0x58000000"
836 valt_load_address_sec_inner="0x38000000"
838 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
841 VGCONF_ARCH_PRI="arm"
842 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
843 VGCONF_PLATFORM_SEC_CAPS=""
844 valt_load_address_pri_norml="0x58000000"
845 valt_load_address_pri_inner="0x38000000"
846 valt_load_address_sec_norml="0xUNSET"
847 valt_load_address_sec_inner="0xUNSET"
848 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
851 valt_load_address_sec_norml="0xUNSET"
852 valt_load_address_sec_inner="0xUNSET"
853 if test x$vg_cv_only64bit = xyes; then
854 VGCONF_ARCH_PRI="arm64"
856 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
857 VGCONF_PLATFORM_SEC_CAPS=""
858 valt_load_address_pri_norml="0x58000000"
859 valt_load_address_pri_inner="0x38000000"
860 elif test x$vg_cv_only32bit = xyes; then
861 VGCONF_ARCH_PRI="arm"
863 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
864 VGCONF_PLATFORM_SEC_CAPS=""
865 valt_load_address_pri_norml="0x58000000"
866 valt_load_address_pri_inner="0x38000000"
868 VGCONF_ARCH_PRI="arm64"
869 VGCONF_ARCH_SEC="arm"
870 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
871 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
872 valt_load_address_pri_norml="0x58000000"
873 valt_load_address_pri_inner="0x38000000"
874 valt_load_address_sec_norml="0x58000000"
875 valt_load_address_sec_inner="0x38000000"
877 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
880 VGCONF_ARCH_PRI="s390x"
882 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
883 VGCONF_PLATFORM_SEC_CAPS=""
884 # To improve branch prediction hit rate we want to have
885 # the generated code close to valgrind (host) code
886 valt_load_address_pri_norml="0x800000000"
887 valt_load_address_pri_inner="0x810000000"
888 valt_load_address_sec_norml="0xUNSET"
889 valt_load_address_sec_inner="0xUNSET"
890 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
893 VGCONF_ARCH_PRI="mips32"
895 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
896 VGCONF_PLATFORM_SEC_CAPS=""
897 valt_load_address_pri_norml="0x58000000"
898 valt_load_address_pri_inner="0x38000000"
899 valt_load_address_sec_norml="0xUNSET"
900 valt_load_address_sec_inner="0xUNSET"
901 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
904 valt_load_address_sec_norml="0xUNSET"
905 valt_load_address_sec_inner="0xUNSET"
906 if test x$vg_cv_only64bit = xyes; then
907 VGCONF_ARCH_PRI="mips64"
908 VGCONF_PLATFORM_SEC_CAPS=""
909 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
910 VGCONF_PLATFORM_SEC_CAPS=""
911 valt_load_address_pri_norml="0x58000000"
912 valt_load_address_pri_inner="0x38000000"
913 elif test x$vg_cv_only32bit = xyes; then
914 VGCONF_ARCH_PRI="mips32"
916 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
917 VGCONF_PLATFORM_SEC_CAPS=""
918 valt_load_address_pri_norml="0x58000000"
919 valt_load_address_pri_inner="0x38000000"
921 VGCONF_ARCH_PRI="mips64"
922 VGCONF_ARCH_SEC="mips32"
923 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
924 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
925 valt_load_address_pri_norml="0x58000000"
926 valt_load_address_pri_inner="0x38000000"
927 valt_load_address_sec_norml="0x58000000"
928 valt_load_address_sec_inner="0x38000000"
930 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
933 VGCONF_ARCH_PRI="nanomips"
935 VGCONF_PLATFORM_PRI_CAPS="NANOMIPS_LINUX"
936 VGCONF_PLATFORM_SEC_CAPS=""
937 valt_load_address_pri_norml="0x58000000"
938 valt_load_address_pri_inner="0x38000000"
939 valt_load_address_sec_norml="0xUNSET"
940 valt_load_address_sec_inner="0xUNSET"
941 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
944 VGCONF_ARCH_PRI="x86"
946 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
947 VGCONF_PLATFORM_SEC_CAPS=""
948 valt_load_address_pri_norml="0x58000000"
949 valt_load_address_pri_inner="0x38000000"
950 valt_load_address_sec_norml="0xUNSET"
951 valt_load_address_sec_inner="0xUNSET"
952 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
955 valt_load_address_sec_norml="0xUNSET"
956 valt_load_address_sec_inner="0xUNSET"
957 if test x$vg_cv_only64bit = xyes; then
958 VGCONF_ARCH_PRI="amd64"
960 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
961 VGCONF_PLATFORM_SEC_CAPS=""
962 valt_load_address_pri_norml="0x58000000"
963 valt_load_address_pri_inner="0x38000000"
964 elif test x$vg_cv_only32bit = xyes; then
965 VGCONF_ARCH_PRI="x86"
967 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
968 VGCONF_PLATFORM_SEC_CAPS=""
969 valt_load_address_pri_norml="0x58000000"
970 valt_load_address_pri_inner="0x38000000"
972 VGCONF_ARCH_PRI="amd64"
973 VGCONF_ARCH_SEC="x86"
974 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
975 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
976 valt_load_address_pri_norml="0x58000000"
977 valt_load_address_pri_inner="0x38000000"
978 valt_load_address_sec_norml="0x58000000"
979 valt_load_address_sec_inner="0x38000000"
981 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
984 VGCONF_ARCH_PRI="unknown"
985 VGCONF_ARCH_SEC="unknown"
986 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
987 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
988 valt_load_address_pri_norml="0xUNSET"
989 valt_load_address_pri_inner="0xUNSET"
990 valt_load_address_sec_norml="0xUNSET"
991 valt_load_address_sec_inner="0xUNSET"
992 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
993 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
997 #----------------------------------------------------------------------------
999 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
1001 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
1002 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1003 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1004 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1005 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD \
1006 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1007 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
1008 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1009 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
1010 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
1011 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1012 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1013 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
1014 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
1015 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
1016 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1017 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
1018 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
1019 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1020 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
1021 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
1022 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1023 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
1024 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
1025 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
1026 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
1027 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
1028 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
1029 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1030 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
1031 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
1032 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
1033 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_NANOMIPS,
1034 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX )
1036 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
1038 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
1039 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1040 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
1041 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
1042 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
1043 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
1044 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1045 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
1046 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
1047 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
1048 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
1049 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
1050 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
1051 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1052 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
1053 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
1054 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
1055 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
1056 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1057 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
1058 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
1059 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1060 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
1061 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
1062 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
1063 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_NANOMIPS_LINUX,
1064 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1065 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD,
1066 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1067 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD)
1068 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD,
1069 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1070 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
1071 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1072 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
1073 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
1074 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1075 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
1076 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1077 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
1078 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
1079 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1082 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
1083 # Relies on the assumption that the primary and secondary targets are
1084 # for the same OS, so therefore only necessary to test the primary.
1085 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
1086 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1087 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1088 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1089 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1090 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
1091 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1092 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1093 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1094 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1095 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
1096 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1097 AM_CONDITIONAL(VGCONF_OS_IS_FREEBSD,
1098 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1099 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1100 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
1101 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1102 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1103 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
1104 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1105 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1106 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN_OR_FREEBSD,
1107 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1108 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1109 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1110 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1113 # Sometimes, in the Makefile.am files, it's useful to know whether or not
1114 # there is a secondary target.
1115 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
1116 test x$VGCONF_PLATFORM_SEC_CAPS != x)
1118 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
1119 dnl fallback definition
1120 dnl The macro is courtesy of Dave Hart:
1121 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
1122 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
1123 if test -z "$$1_TRUE"; then :
1132 #----------------------------------------------------------------------------
1134 #----------------------------------------------------------------------------
1136 # Check if this should be built as an inner Valgrind, to be run within
1137 # another Valgrind. Choose the load address accordingly.
1138 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
1139 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
1140 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
1141 [AC_ARG_ENABLE(inner,
1142 [ --enable-inner enables self-hosting],
1143 [vg_cv_inner=$enableval],
1145 if test "$vg_cv_inner" = yes; then
1146 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
1147 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
1148 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
1150 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
1151 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
1154 #----------------------------------------------------------------------------
1155 # Undefined behaviour sanitiser
1156 #----------------------------------------------------------------------------
1157 # Check whether we should build with the undefined beahviour sanitiser.
1159 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
1160 [AC_ARG_ENABLE(ubsan,
1161 [ --enable-ubsan enables the undefined behaviour sanitiser],
1162 [vg_cv_ubsan=$enableval],
1165 #----------------------------------------------------------------------------
1166 # Extra fine-tuning of installation directories
1167 #----------------------------------------------------------------------------
1169 [ --with-tmpdir=PATH Specify path for temporary files],
1172 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
1173 AC_SUBST(VG_TMPDIR, [$tmpdir])
1175 #----------------------------------------------------------------------------
1177 #----------------------------------------------------------------------------
1178 AM_COND_IF([VGCONF_OS_IS_DARWIN],
1179 [AC_CHECK_PROG([XCRUN], [xcrun], [yes], [no])
1180 AC_MSG_CHECKING([for xcode sdk include path])
1181 AC_ARG_WITH(xcodedir,
1182 [ --with-xcode-path=PATH Specify path for xcode sdk includes],
1183 [xcodedir="$withval"],
1185 if test "x$XCRUN" != "xno" -a ! -d /usr/include; then
1186 xcrundir=`xcrun --sdk macosx --show-sdk-path`
1187 if test -z "$xcrundir"; then
1188 xcodedir="/usr/include"
1190 xcodedir="$xcrundir/usr/include"
1193 xcodedir="/usr/include"
1196 AC_MSG_RESULT([$xcodedir])
1197 AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
1198 AC_SUBST(XCODE_DIR, [$xcodedir])])
1200 #----------------------------------------------------------------------------
1201 # Libc and suppressions
1202 #----------------------------------------------------------------------------
1203 # This variable will collect the suppression files to be used.
1204 AC_SUBST(DEFAULT_SUPP)
1206 AC_CHECK_HEADER([features.h])
1208 if test x$ac_cv_header_features_h = xyes; then
1209 AC_DEFINE([HAVE_HEADER_FEATURES_H], 1,
1210 [Define to 1 if you have the `features.h' header.])
1211 rm -f conftest.$ac_ext
1212 cat <<_ACEOF >conftest.$ac_ext
1213 #include <features.h>
1214 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1215 glibc version is: __GLIBC__ __GLIBC_MINOR__
1218 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1221 # not really a version check
1222 AC_EGREP_CPP([DARWIN_LIBC], [
1223 #include <sys/cdefs.h>
1224 #if defined(__DARWIN_VERS_1050)
1228 GLIBC_VERSION="darwin")
1230 AC_EGREP_CPP([FREEBSD_LIBC], [
1231 #include <sys/cdefs.h>
1232 #if defined(__FreeBSD__)
1236 GLIBC_VERSION="freebsd")
1238 # not really a version check
1239 AC_EGREP_CPP([BIONIC_LIBC], [
1240 #if defined(__ANDROID__)
1244 GLIBC_VERSION="bionic")
1246 # there is only one version of libc on Solaris
1247 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1248 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1249 GLIBC_VERSION="solaris"
1252 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1254 if test x$GLIBC_VERSION = x; then
1255 if $CC -dumpmachine | grep -q musl; then
1260 # If this is glibc then figure out the generic (in file) libc.so and
1261 # libpthread.so file paths to use in suppressions. Before 2.34 libpthread
1262 # was a separate library, afterwards it was merged into libc.so and
1263 # the library is called libc.so.6 (before it was libc-2.[0-9]+.so).
1264 # Use this fact to set GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH.
1265 case ${GLIBC_VERSION} in
1267 AC_MSG_CHECKING([whether pthread_create needs libpthread])
1268 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])],
1271 GLIBC_LIBC_PATH="*/lib*/libc.so.6"
1272 GLIBC_LIBPTHREAD_PATH="$GLIBC_LIBC_PATH"
1274 AC_MSG_RESULT([yes])
1275 GLIBC_LIBC_PATH="*/lib*/libc-2.*so*"
1276 GLIBC_LIBPTHREAD_PATH="*/lib*/libpthread-2.*so*"
1280 AC_MSG_CHECKING([not glibc...])
1281 AC_MSG_RESULT([${GLIBC_VERSION}])
1285 AC_MSG_CHECKING([the glibc version])
1287 case "${GLIBC_VERSION}" in
1289 AC_MSG_RESULT(${GLIBC_VERSION} family)
1290 DEFAULT_SUPP="$srcdir/glibc-2.2.supp ${DEFAULT_SUPP}"
1291 DEFAULT_SUPP="$srcdir/glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1292 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1295 AC_MSG_RESULT(${GLIBC_VERSION} family)
1296 DEFAULT_SUPP="$srcdir/glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1297 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1298 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1301 AC_MSG_RESULT(${GLIBC_VERSION} family)
1302 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1303 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1304 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1307 AC_MSG_RESULT(${GLIBC_VERSION} family)
1308 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1309 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1310 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1311 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1312 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1315 AC_MSG_RESULT(${GLIBC_VERSION} family)
1316 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1317 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1318 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1319 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1320 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1321 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1322 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1325 AC_MSG_RESULT(Darwin)
1326 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1327 # DEFAULT_SUPP set by kernel version check above.
1330 AC_MSG_RESULT(FreeBSD)
1331 AC_DEFINE([FREEBSD_LIBC], 1, [Define to 1 if you're using FreeBSD])
1332 # DEFAULT_SUPP set by kernel version check above.
1335 AC_MSG_RESULT(Bionic)
1336 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1337 DEFAULT_SUPP="$srcdir/bionic.supp ${DEFAULT_SUPP}"
1340 AC_MSG_RESULT(Solaris)
1341 # DEFAULT_SUPP set in host_os switch-case above.
1342 # No other suppression file is used.
1346 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1347 DEFAULT_SUPP="$srcdir/musl.supp ${DEFAULT_SUPP}"
1350 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1351 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1352 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1356 AC_SUBST(GLIBC_VERSION)
1357 AC_SUBST(GLIBC_LIBC_PATH)
1358 AC_SUBST(GLIBC_LIBPTHREAD_PATH)
1361 if test "$VGCONF_OS" != "solaris"; then
1362 # Add default suppressions for the X client libraries. Make no
1363 # attempt to detect whether such libraries are installed on the
1364 # build machine (or even if any X facilities are present); just
1365 # add the suppressions antidisirregardless.
1366 DEFAULT_SUPP="$srcdir/xfree-4.supp ${DEFAULT_SUPP}"
1367 DEFAULT_SUPP="$srcdir/xfree-3.supp ${DEFAULT_SUPP}"
1371 #----------------------------------------------------------------------------
1372 # Platform variants?
1373 #----------------------------------------------------------------------------
1375 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1376 # But there are times where we need a bit more control. The motivating
1377 # and currently only case is Android: this is almost identical to
1378 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1379 # platform variant tags, which get passed in the compile as
1380 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1382 # In almost all cases, the <variant> bit is "vanilla". But for Android
1383 # it is "android" instead.
1385 # Consequently (eg), plain arm-linux would build with
1387 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1389 # whilst an Android build would have
1391 # -DVGP_arm_linux -DVGPV_arm_linux_android
1393 # Same for x86. The setup of the platform variant is pushed relatively far
1394 # down this file in order that we can inspect any of the variables set above.
1396 # In the normal case ..
1397 VGCONF_PLATVARIANT="vanilla"
1400 if test "$GLIBC_VERSION" = "bionic";
1402 VGCONF_PLATVARIANT="android"
1405 AC_SUBST(VGCONF_PLATVARIANT)
1408 # FIXME: do we also want to define automake variables
1409 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1410 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1411 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1412 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1413 # that's what we'd need to do to use this, since what we'd want to write
1416 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1418 # Hmm. Can't think of a nice clean solution to this.
1420 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1421 test x$VGCONF_PLATVARIANT = xvanilla)
1422 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1423 test x$VGCONF_PLATVARIANT = xandroid)
1426 #----------------------------------------------------------------------------
1427 # Checking for various library functions and other definitions
1428 #----------------------------------------------------------------------------
1430 # Check for AT_FDCWD
1432 AC_MSG_CHECKING([for AT_FDCWD])
1433 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1440 ac_have_at_fdcwd=yes
1441 AC_MSG_RESULT([yes])
1447 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1449 # Check for stpncpy function definition in string.h
1450 # This explicitly checks with _GNU_SOURCE defined since that is also
1451 # used in the test case (some systems might define it without anyway
1452 # since stpncpy is part of The Open Group Base Specifications Issue 7
1453 # IEEE Std 1003.1-2008.
1454 AC_MSG_CHECKING([for stpncpy])
1455 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1462 char *r = stpncpy(d, s, n);
1464 ac_have_gnu_stpncpy=yes
1465 AC_MSG_RESULT([yes])
1467 ac_have_gnu_stpncpy=no
1471 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1473 # Check for PTRACE_GETREGS
1475 AC_MSG_CHECKING([for PTRACE_GETREGS])
1476 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1479 #include <sys/ptrace.h>
1480 #include <sys/user.h>
1483 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1485 AC_MSG_RESULT([yes])
1486 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1487 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1493 # Check for CLOCK_MONOTONIC
1495 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1497 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1501 clock_gettime(CLOCK_MONOTONIC, &t);
1504 AC_MSG_RESULT([yes])
1505 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1506 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1512 # Check for ELF32/64_CHDR
1514 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1517 # Check for PTHREAD_RWLOCK_T
1519 AC_MSG_CHECKING([for pthread_rwlock_t])
1521 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1523 #include <pthread.h>
1525 pthread_rwlock_t rwl;
1527 AC_MSG_RESULT([yes])
1528 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1529 [Define to 1 if you have the `pthread_rwlock_t' type.])
1534 # Check for CLOCKID_T
1536 AC_MSG_CHECKING([for clockid_t])
1538 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1543 AC_MSG_RESULT([yes])
1544 AC_DEFINE([HAVE_CLOCKID_T], 1,
1545 [Define to 1 if you have the `clockid_t' type.])
1550 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1552 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1554 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1556 #include <pthread.h>
1558 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1560 AC_MSG_RESULT([yes])
1561 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1562 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1568 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1570 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1572 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1574 #include <pthread.h>
1576 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1578 AC_MSG_RESULT([yes])
1579 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1580 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1586 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1588 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1590 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1592 #include <pthread.h>
1594 return (PTHREAD_MUTEX_RECURSIVE_NP);
1596 AC_MSG_RESULT([yes])
1597 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1598 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1604 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1606 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1608 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1610 #include <pthread.h>
1612 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1615 AC_MSG_RESULT([yes])
1616 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1617 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1623 # Check whether pthread_mutex_t has a member called __m_kind.
1625 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1626 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1628 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1631 [#include <pthread.h>])
1634 # Check whether pthread_mutex_t has a member called __data.__kind.
1636 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1637 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1639 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1642 [#include <pthread.h>])
1644 # Convenience function. Set flags based on the existing HWCAP entries.
1645 # The AT_HWCAP entries are generated by glibc, and are based on
1646 # functions supported by the hardware/system/libc.
1647 # Subsequent support for whether the capability will actually be utilized
1648 # will also be checked against the compiler capabilities.
1650 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1651 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1653 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1654 if env LD_SHOW_AUXV=1 true | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1656 AC_MSG_RESULT([yes])
1657 AC_SUBST([$2],[yes])
1664 # gather hardware capabilities. (hardware/kernel/libc)
1665 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1666 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1667 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1668 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1669 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1670 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1671 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1672 AC_HWCAP_CONTAINS_FLAG([arch_3_1],[HWCAP_HAS_ISA_3_1])
1673 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1674 AC_HWCAP_CONTAINS_FLAG([mma],[HWCAP_HAS_MMA])
1677 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1678 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1679 # compiler support for isa 2.07 level instructions
1680 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1681 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1683 __asm__ __volatile__("mtvsrd 1,2 ");
1685 ac_asm_have_isa_2_07=yes
1686 AC_MSG_RESULT([yes])
1688 ac_asm_have_isa_2_07=no
1691 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1692 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1694 # altivec (vsx) support.
1695 # does this compiler support -maltivec and does it have the include file
1697 AC_MSG_CHECKING([for Altivec support in the compiler ])
1699 CFLAGS="-maltivec -Werror"
1700 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1701 #include <altivec.h>
1703 vector unsigned int v;
1706 AC_MSG_RESULT([yes])
1712 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1713 -a x$HWCAP_HAS_ALTIVEC = xyes])
1715 # Check that both: the compiler supports -mvsx and that the assembler
1716 # understands VSX instructions. If either of those doesn't work,
1717 # conclude that we can't do VSX.
1718 AC_MSG_CHECKING([for VSX compiler flag support])
1720 CFLAGS="-mvsx -Werror"
1721 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1724 ac_compiler_supports_vsx_flag=yes
1725 AC_MSG_RESULT([yes])
1727 ac_compiler_supports_vsx_flag=no
1732 AC_MSG_CHECKING([for VSX support in the assembler ])
1734 CFLAGS="-mvsx -Werror"
1735 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1736 #include <altivec.h>
1738 vector unsigned int v;
1739 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1741 ac_compiler_supports_vsx=yes
1742 AC_MSG_RESULT([yes])
1744 ac_compiler_supports_vsx=no
1748 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1749 -a x$ac_compiler_supports_vsx = xyes \
1750 -a x$HWCAP_HAS_VSX = xyes ])
1752 # DFP (Decimal Float)
1753 # The initial DFP support was added in Power 6. The dcffix instruction
1754 # support was added in Power 7.
1755 AC_MSG_CHECKING([that assembler knows DFP])
1756 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1759 __asm__ __volatile__("adtr 1, 2, 3")
1761 __asm__ __volatile__(".machine power7;\n" \
1767 AC_MSG_RESULT([yes])
1772 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1774 CFLAGS="-mhard-dfp -Werror"
1776 # The dcffix instruction is Power 7
1777 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1780 __asm__ __volatile__("adtr 1, 2, 3")
1782 __asm__ __volatile__(".machine power7;\n" \
1787 ac_compiler_have_dfp=yes
1788 AC_MSG_RESULT([yes])
1790 ac_compiler_have_dfp=no
1794 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1795 -a x$ac_compiler_have_dfp = xyes \
1796 -a x$HWCAP_HAS_DFP = xyes )
1798 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1799 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1801 _Decimal64 x = 0.0DD;
1803 ac_compiler_have_dfp_type=yes
1804 AC_MSG_RESULT([yes])
1806 ac_compiler_have_dfp_type=no
1809 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1810 -a x$HWCAP_HAS_DFP = xyes )
1813 # HTM (Hardware Transactional Memory)
1814 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1816 CFLAGS="-mhtm -Werror"
1817 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1821 AC_MSG_RESULT([yes])
1822 ac_compiler_supports_htm=yes
1825 ac_compiler_supports_htm=no
1829 AC_MSG_CHECKING([if compiler can find the htm builtins])
1831 CFLAGS="-mhtm -Werror"
1832 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1834 if (__builtin_tbegin (0))
1837 AC_MSG_RESULT([yes])
1838 ac_compiler_sees_htm_builtins=yes
1841 ac_compiler_sees_htm_builtins=no
1845 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1846 -a x$ac_compiler_sees_htm_builtins = xyes \
1847 -a x$HWCAP_HAS_HTM = xyes )
1849 # isa 3.0 checking. (actually 3.0 or newer)
1850 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1852 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1854 __asm__ __volatile__ (".machine power9;\n" \
1857 # guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste,
1860 CFLAGS="-DHAS_ISA_3_00"
1861 ac_asm_have_isa_3_00=yes
1862 AC_MSG_RESULT([yes])
1864 ac_asm_have_isa_3_00=no
1870 AC_MSG_CHECKING([that assembler knows xscvhpdp ])
1872 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1874 __asm__ __volatile__ (".machine power9;\n" \
1875 "xscvhpdp 1,2;\n" );
1877 ac_asm_have_xscvhpdp=yes
1878 AC_MSG_RESULT([yes])
1880 ac_asm_have_xscvhpdp=no
1884 # darn instruction checking
1885 AC_MSG_CHECKING([that assembler knows darn instruction ])
1887 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1889 __asm__ __volatile__(".machine power9; darn 1,0 ");
1891 ac_asm_have_darn_inst=yes
1892 AC_MSG_RESULT([yes])
1894 ac_asm_have_darn_inst=no
1899 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
1900 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1902 __asm__ __volatile__ (".machine power10;\n" \
1905 ac_asm_have_isa_3_1=yes
1906 AC_MSG_RESULT([yes])
1908 ac_asm_have_isa_3_1=no
1913 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
1914 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1916 AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes])
1917 AM_CONDITIONAL(HAS_DARN, [test x$ac_asm_have_darn_inst = xyes])
1919 AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \
1920 -a x$HWCAP_HAS_ISA_3_1 = xyes])
1922 # Check for pthread_create@GLIBC2.0
1923 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1926 CFLAGS="-lpthread -Werror"
1927 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1928 extern int pthread_create_glibc_2_0(void*, const void*,
1929 void *(*)(void*), void*);
1930 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1934 * Apparently on PowerPC linking this program succeeds and generates an
1935 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1937 #error This test does not work properly on PowerPC.
1939 pthread_create_glibc_2_0(0, 0, 0, 0);
1943 ac_have_pthread_create_glibc_2_0=yes
1944 AC_MSG_RESULT([yes])
1945 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1946 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1948 ac_have_pthread_create_glibc_2_0=no
1953 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1954 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1957 # Check for dlinfo RTLD_DI_TLS_MODID
1958 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1962 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1969 size_t sizes[10000];
1970 size_t modid_offset;
1971 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1974 ac_have_dlinfo_rtld_di_tls_modid=yes
1975 AC_MSG_RESULT([yes])
1976 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1977 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1979 ac_have_dlinfo_rtld_di_tls_modid=no
1984 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1985 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1988 # Check for eventfd_t, eventfd() and eventfd_read()
1989 AC_MSG_CHECKING([for eventfd()])
1991 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1992 #include <sys/eventfd.h>
1998 eventfd_read(fd, &ev);
2001 AC_MSG_RESULT([yes])
2002 AC_DEFINE([HAVE_EVENTFD], 1,
2003 [Define to 1 if you have the `eventfd' function.])
2004 AC_DEFINE([HAVE_EVENTFD_READ], 1,
2005 [Define to 1 if you have the `eventfd_read' function.])
2010 # Check whether compiler can process #include <thread> without errors
2011 # clang 3.3 cannot process <thread> from e.g.
2012 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
2014 AC_MSG_CHECKING([that C++ compiler can compile C++17 code])
2016 safe_CXXFLAGS=$CXXFLAGS
2019 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2024 AC_MSG_RESULT([yes])
2029 CXXFLAGS=$safe_CXXFLAGS
2032 AM_CONDITIONAL(HAVE_CXX17, test x$ac_have_cxx_17 = xyes)
2034 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
2036 safe_CXXFLAGS=$CXXFLAGS
2039 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2043 ac_cxx_can_include_thread_header=yes
2044 AC_MSG_RESULT([yes])
2046 ac_cxx_can_include_thread_header=no
2049 CXXFLAGS=$safe_CXXFLAGS
2052 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
2054 # Check whether compiler can process #include <condition_variable> without errors
2056 AC_MSG_CHECKING([that C++ compiler can include <condition_variable> header file])
2058 safe_CXXFLAGS=$CXXFLAGS
2061 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2062 #include <condition_variable>
2065 ac_cxx_can_include_condition_variable_header=yes
2066 AC_MSG_RESULT([yes])
2068 ac_cxx_can_include_condition_variable_header=no
2071 CXXFLAGS=$safe_CXXFLAGS
2074 AM_CONDITIONAL(CXX_CAN_INCLUDE_CONDITION_VARIABLE_HEADER, test x$ac_cxx_can_include_condition_variable_header = xyes)
2076 # check for std::shared_timed_mutex, this is a C++ 14 feature
2078 AC_MSG_CHECKING([that C++ compiler can use std::shared_timed_mutex])
2080 safe_CXXFLAGS=$CXXFLAGS
2081 CXXFLAGS="-std=c++1y -pthread"
2083 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2084 #include <shared_mutex>
2085 std::shared_timed_mutex test_mutex;
2088 ac_cxx_can_use_shared_timed_mutex=yes
2089 AC_MSG_RESULT([yes])
2091 ac_cxx_can_use_shared_timed_mutex=no
2094 CXXFLAGS=$safe_CXXFLAGS
2097 AM_CONDITIONAL(CXX_CAN_USE_SHARED_TIMED_MUTEX, test x$ac_cxx_can_use_shared_timed_mutex = xyes)
2099 # check for std::shared_mutex, this is a C++ 11 feature
2101 AC_MSG_CHECKING([that C++ compiler can use std::timed_mutex])
2103 safe_CXXFLAGS=$CXXFLAGS
2104 CXXFLAGS="-std=c++0x -pthread"
2106 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2108 std::timed_mutex test_mutex;
2111 ac_cxx_can_use_timed_mutex=yes
2112 AC_MSG_RESULT([yes])
2114 ac_cxx_can_use_timed_mutex=no
2117 CXXFLAGS=$safe_CXXFLAGS
2120 AM_CONDITIONAL(CXX_CAN_USE_TIMED_MUTEX, test x$ac_cxx_can_use_timed_mutex = xyes)
2122 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
2123 # of the user_regs_struct from sys/user.h. They are structurally the same
2124 # but we get either one or the other.
2126 AC_CHECK_TYPE([struct user_regs_struct],
2127 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
2128 [[#include <sys/ptrace.h>]
2129 [#include <sys/time.h>]
2130 [#include <sys/user.h>]])
2131 if test "$sys_user_has_user_regs" = "yes"; then
2132 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
2133 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
2136 AC_MSG_CHECKING([for __NR_membarrier])
2137 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2138 #include <linux/unistd.h>
2140 return __NR_membarrier
2142 ac_have_nr_membarrier=yes
2143 AC_MSG_RESULT([yes])
2145 ac_have_nr_membarrier=no
2149 AM_CONDITIONAL(HAVE_NR_MEMBARRIER, [test x$ac_have_nr_membarrier = xyes])
2151 #----------------------------------------------------------------------------
2152 # Checking for supported compiler flags.
2153 #----------------------------------------------------------------------------
2155 case "${host_cpu}" in
2157 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2158 if test -z "$ARCH"; then
2159 # does this compiler support -march=mips32 (mips32 default) ?
2160 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
2163 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
2165 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2168 FLAG_M32="-mips32 -mabi=32"
2169 AC_MSG_RESULT([yes])
2179 # does this compiler support -march=mips64r2 (mips64r2 default) ?
2180 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
2183 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
2185 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2188 FLAG_M64="-march=mips64r2 -mabi=64"
2189 AC_MSG_RESULT([yes])
2202 # does this compiler support -m32 ?
2203 AC_MSG_CHECKING([if gcc accepts -m32])
2206 CFLAGS="${FLAG_32ON64} -m32 -Werror"
2208 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2211 FLAG_M32="${FLAG_32ON64} -m32"
2212 AC_MSG_RESULT([yes])
2222 # does this compiler support -m64 ?
2223 AC_MSG_CHECKING([if gcc accepts -m64])
2226 CFLAGS="-m64 -Werror"
2228 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2232 AC_MSG_RESULT([yes])
2244 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2245 if test -z "$ARCH"; then
2246 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
2247 AC_MSG_CHECKING([if gcc accepts -march=octeon])
2250 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
2252 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2255 FLAG_OCTEON="-march=octeon"
2256 AC_MSG_RESULT([yes])
2263 AC_SUBST(FLAG_OCTEON)
2266 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
2267 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
2270 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
2272 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2275 FLAG_OCTEON2="-march=octeon2"
2276 AC_MSG_RESULT([yes])
2283 AC_SUBST(FLAG_OCTEON2)
2287 # does this compiler support -mmsa (MIPS MSA ASE) ?
2288 AC_MSG_CHECKING([if gcc accepts -mmsa])
2291 CFLAGS="$CFLAGS -mmsa -Werror"
2293 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2297 AC_MSG_RESULT([yes])
2306 # Are we compiling for the MIPS64 n32 ABI?
2307 AC_MSG_CHECKING([if gcc is producing mips n32 binaries])
2308 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2309 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABIN32))
2314 FLAG_M64="-march=mips64r2 -mabi=n32"
2315 AC_MSG_RESULT([yes])
2320 # Are we compiling for the MIPS64 n64 ABI?
2321 AC_MSG_CHECKING([if gcc is producing mips n64 binaries])
2322 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2323 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABI64))
2328 AC_MSG_RESULT([yes])
2333 # We enter the code block below in the following case:
2334 # Target architecture is set to mips64, the desired abi
2335 # was not specified and the compiler's default abi setting
2336 # is neither n32 nor n64.
2337 # Probe for and set the abi to either n64 or n32, in that order,
2338 # which is required for a mips64 build of valgrind.
2339 if test "$ARCH_MAX" = "mips64" -a "x$VGCONF_ABI" = "x"; then
2341 CFLAGS="$CFLAGS -mabi=64 -Werror"
2342 AC_MSG_CHECKING([if gcc is n64 capable])
2343 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2347 AC_MSG_RESULT([yes])
2353 if test "x$VGCONF_ABI" = "x"; then
2355 CFLAGS="$CFLAGS -mabi=n32 -Werror"
2356 AC_MSG_CHECKING([if gcc is n32 capable])
2357 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2361 FLAG_M64="-march=mips64r2 -mabi=n32"
2362 AC_MSG_RESULT([yes])
2370 AM_CONDITIONAL([VGCONF_HAVE_ABI],
2371 [test x$VGCONF_ABI != x])
2372 AC_SUBST(VGCONF_ABI)
2375 # does this compiler support -mmmx ?
2376 AC_MSG_CHECKING([if gcc accepts -mmmx])
2379 CFLAGS="-mmmx -Werror"
2381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2385 AC_MSG_RESULT([yes])
2395 # does this compiler support -msse ?
2396 AC_MSG_CHECKING([if gcc accepts -msse])
2399 CFLAGS="-msse -Werror"
2401 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2405 AC_MSG_RESULT([yes])
2415 # does this compiler support -mpreferred-stack-boundary=2 when
2416 # generating code for a 32-bit target? Note that we only care about
2417 # this when generating code for (32-bit) x86, so if the compiler
2418 # doesn't recognise -m32 it's no big deal. We'll just get code for
2419 # the Memcheck and other helper functions, that is a bit slower than
2420 # it could be, on x86; and no difference at all on any other platform.
2421 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
2424 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
2426 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2429 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
2430 AC_MSG_RESULT([yes])
2432 PREFERRED_STACK_BOUNDARY_2=""
2437 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
2440 # does this compiler support -mlong-double-128 ?
2441 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
2443 CFLAGS="-mlong-double-128 -Werror"
2444 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2447 ac_compiler_supports_mlong_double_128=yes
2448 AC_MSG_RESULT([yes])
2450 ac_compiler_supports_mlong_double_128=no
2454 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
2455 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
2456 AC_SUBST(FLAG_MLONG_DOUBLE_128)
2458 # does this toolchain support lto ?
2459 # Not checked for if --enable-lto=no was given, or if LTO_AR or LTO_RANLIG
2461 # If not enable-lto=* arg is provided, default to no, as lto builds are
2462 # a lot slower, and so not appropriate for Valgrind developments.
2463 # --enable-lto=yes should be used by distro packagers.
2464 AC_CACHE_CHECK([for using the link time optimisation], vg_cv_lto,
2466 [ --enable-lto enables building with link time optimisation],
2467 [vg_cv_lto=$enableval],
2470 if test "x${vg_cv_lto}" != "xno" -a "x${LTO_AR}" != "x" -a "x${LTO_RANLIB}" != "x"; then
2471 AC_MSG_CHECKING([if toolchain accepts lto])
2473 TEST_LTO_CFLAGS="-flto -flto-partition=one -fuse-linker-plugin"
2474 # Note : using 'one' partition is giving a slightly smaller/faster memcheck
2475 # and ld/lto-trans1 still needs a reasonable memory (about 0.5GB) when linking.
2476 CFLAGS="$TEST_LTO_CFLAGS -Werror"
2478 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2479 extern void somefun(void);
2483 LTO_CFLAGS=$TEST_LTO_CFLAGS
2484 AC_MSG_RESULT([yes])
2492 AC_SUBST(LTO_CFLAGS)
2494 # if we could not compile with lto args, or lto was disabled,
2495 # then set LTO_AR/LTO_RANLIB to the non lto values
2496 # define in config.h ENABLE_LTO (not needed by the code currently, but
2497 # this guarantees we recompile everything if we re-configure and rebuild
2498 # in a build dir previously build with another value of --enable-lto
2499 if test "x${LTO_CFLAGS}" = "x"; then
2501 LTO_RANLIB=${RANLIB}
2505 AC_DEFINE([ENABLE_LTO], 1, [configured to build with lto link time optimisation])
2508 # Convenience function to check whether GCC supports a particular
2509 # warning option. Takes two arguments,
2510 # first the warning flag name to check (without -W), then the
2511 # substitution name to set with -Wno-warning-flag if the flag exists,
2512 # or the empty string if the compiler doesn't accept the flag. Note
2513 # that checking is done against the warning flag itself, but the
2514 # substitution is then done to cancel the warning flag.
2515 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
2516 AC_MSG_CHECKING([if gcc accepts -W$1])
2518 CFLAGS="-W$1 -Werror"
2519 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2520 AC_SUBST([$2], [-Wno-$1])
2521 AC_MSG_RESULT([yes])], [
2523 AC_MSG_RESULT([no])])
2527 # A variation of the above for arguments that
2529 AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[
2530 AC_MSG_CHECKING([if gcc accepts -W$1=$2])
2532 CFLAGS="-W$1=$2 -Werror"
2533 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2534 AC_SUBST([$3], [-Wno-$1])
2535 AC_MSG_RESULT([yes])], [
2537 AC_MSG_RESULT([no])])
2541 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
2542 # -W$1 (instead of -Wno-$1).
2543 AC_DEFUN([AC_GCC_WARNING_SUBST],[
2544 AC_MSG_CHECKING([if gcc accepts -W$1])
2546 CFLAGS="-W$1 -Werror"
2547 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2548 AC_SUBST([$2], [-W$1])
2549 AC_MSG_RESULT([yes])], [
2551 AC_MSG_RESULT([no])])
2555 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
2556 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
2557 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
2558 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
2559 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
2560 AC_GCC_WARNING_SUBST_NO([maybe-uninitialized], [FLAG_W_NO_MAYBE_UNINITIALIZED])
2561 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
2562 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
2563 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
2564 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2565 AC_GCC_WARNING_SUBST_NO([expansion-to-defined], [FLAG_W_NO_EXPANSION_TO_DEFINED])
2566 AC_GCC_WARNING_SUBST_NO([unused-but-set-variable], [FLAG_W_NO_UNUSED_BUT_SET_VARIABLE])
2567 AC_GCC_WARNING_SUBST_NO([non-power-of-two-alignment], [FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT])
2568 AC_GCC_WARNING_SUBST_NO([sign-compare], [FLAG_W_NO_SIGN_COMPARE])
2569 AC_GCC_WARNING_SUBST_NO([stringop-overflow], [FLAG_W_NO_STRINGOP_OVERFLOW])
2570 AC_GCC_WARNING_SUBST_NO([stringop-overread], [FLAG_W_NO_STRINGOP_OVERREAD])
2571 AC_GCC_WARNING_SUBST_NO([stringop-truncation], [FLAG_W_NO_STRINGOP_TRUNCATION])
2572 AC_GCC_WARNING_SUBST_NO([format-overflow], [FLAG_W_NO_FORMAT_OVERFLOW])
2573 AC_GCC_WARNING_SUBST_NO([use-after-free], [FLAG_W_NO_USE_AFTER_FREE])
2574 AC_GCC_WARNING_SUBST_NO([free-nonheap-object], [FLAG_W_NO_FREE_NONHEAP_OBJECT])
2576 AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
2578 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
2579 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
2580 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
2581 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
2582 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
2583 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2584 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2585 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2586 AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
2587 AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
2588 AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
2590 # Does this compiler support -Wformat-security ?
2591 # Special handling is needed, because certain GCC versions require -Wformat
2592 # being present if -Wformat-security is given. Otherwise a warning is issued.
2593 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2594 # And with that the warning will be turned into an error with the result
2595 # that -Wformat-security is believed to be unsupported when in fact it is.
2596 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2598 CFLAGS="-Wformat -Wformat-security -Werror"
2599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2600 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2601 AC_MSG_RESULT([yes])], [
2602 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2603 AC_MSG_RESULT([no])])
2606 # does this compiler support -Wextra or the older -W ?
2608 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2611 CFLAGS="-Wextra -Werror"
2613 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2616 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2617 AC_MSG_RESULT([-Wextra])
2620 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2623 AC_SUBST([FLAG_W_EXTRA], [-W])
2626 AC_SUBST([FLAG_W_EXTRA], [])
2627 AC_MSG_RESULT([not supported])
2632 # On ARM we do not want to pass -Wcast-align as that produces loads
2633 # of warnings. GCC is just being conservative. See here:
2634 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2635 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2636 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2638 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2641 # does this compiler support -faligned-new ?
2642 AC_MSG_CHECKING([if g++ accepts -faligned-new])
2644 safe_CXXFLAGS=$CXXFLAGS
2645 CXXFLAGS="-faligned-new -Werror"
2648 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2651 FLAG_FALIGNED_NEW="-faligned-new"
2652 AC_MSG_RESULT([yes])
2654 FLAG_FALIGNED_NEW=""
2657 CXXFLAGS=$safe_CXXFLAGS
2660 AC_SUBST(FLAG_FALIGNED_NEW)
2662 # does this compiler support -fsized-deallocation ?
2663 AC_MSG_CHECKING([if g++ accepts -fsized-deallocation])
2665 safe_CXXFLAGS=$CXXFLAGS
2666 CXXFLAGS="-fsized-deallocation -Werror"
2669 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2672 FLAG_FSIZED_DEALLOCATION="-fsized-deallocation"
2673 ac_have_sized_deallocation=yes
2674 AC_MSG_RESULT([yes])
2676 FLAG_FSIZED_DEALLOCATION=""
2677 ac_have_sized_deallocation=no
2680 CXXFLAGS=$safe_CXXFLAGS
2683 AC_SUBST(FLAG_FSIZED_DEALLOCATION)
2684 AM_CONDITIONAL([HAVE_FSIZED_DEALLOCATION], [test x$ac_have_sized_deallocation = xyes])
2686 # does this compiler support C++17 aligned new/delete?
2687 AC_MSG_CHECKING([if g++ supports aligned new and delete])
2689 safe_CXXFLAGS=$CXXFLAGS
2690 CXXFLAGS="-std=c++17"
2693 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2697 operator delete(nullptr, std::align_val_t(64U));
2699 ac_have_aligned_cxx_alloc=yes
2700 AC_MSG_RESULT([yes])
2702 ac_have_aligned_cxx_alloc=no
2705 CXXFLAGS=$safe_CXXFLAGS
2708 AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes])
2710 # does this compiler support -fno-stack-protector ?
2711 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2714 CFLAGS="-fno-stack-protector -Werror"
2716 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2719 no_stack_protector=yes
2720 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2721 AC_MSG_RESULT([yes])
2723 no_stack_protector=no
2724 FLAG_FNO_STACK_PROTECTOR=""
2729 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2731 # does this compiler support -finline-functions ?
2732 AC_MSG_CHECKING([if gcc accepts -finline-functions])
2735 CFLAGS="-finline-functions -Werror"
2737 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2740 inline_functions=yes
2741 FLAG_FINLINE_FUNCTIONS="-finline-functions"
2742 AC_MSG_RESULT([yes])
2745 FLAG_FINLINE_FUNCTIONS=""
2750 AC_SUBST(FLAG_FINLINE_FUNCTIONS)
2752 # Does GCC support disabling Identical Code Folding?
2753 # We want to disabled Identical Code Folding for the
2754 # tools preload shared objects to get better backraces.
2755 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2756 # "The optimization reduces code size and may disturb
2757 # unwind stacks by replacing a function by equivalent
2758 # one with a different name."
2759 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2762 CFLAGS="-fno-ipa-icf -Werror"
2764 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2768 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2769 AC_MSG_RESULT([yes])
2777 AC_SUBST(FLAG_FNO_IPA_ICF)
2780 # Does this compiler support -fsanitize=undefined. This is true for
2781 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2782 # also checks for alignment violations on memory accesses which the valgrind
2783 # code base is sprinkled (if not littered) with. As those alignment issues
2784 # don't pose a problem we want to suppress warnings about them.
2785 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2786 # GCCs do not support that.
2788 # Only checked for if --enable-ubsan was given.
2789 if test "x${vg_cv_ubsan}" = "xyes"; then
2790 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2792 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2793 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2796 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2797 LIB_UBSAN="-static-libubsan"
2798 AC_MSG_RESULT([yes])
2800 CFLAGS="-fsanitize=undefined -Werror"
2801 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2804 FLAG_FSANITIZE="-fsanitize=undefined"
2805 LIB_UBSAN="-static-libubsan"
2806 AC_MSG_RESULT([yes])
2814 AC_SUBST(FLAG_FSANITIZE)
2817 # does this compiler support --param inline-unit-growth=... ?
2819 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2822 CFLAGS="--param inline-unit-growth=900 -Werror"
2824 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2827 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2828 ["--param inline-unit-growth=900"])
2829 AC_MSG_RESULT([yes])
2831 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2837 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2839 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2842 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2844 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2848 AC_MSG_RESULT([yes])
2853 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2857 # does this compiler support -g -gz=zlib ?
2859 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2862 CFLAGS="-g -gz=zlib"
2864 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2868 AC_MSG_RESULT([yes])
2873 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2877 # does this compiler support -g -gz=zlib-gnu ?
2879 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2882 CFLAGS="-g -gz=zlib-gnu"
2884 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2887 ac_have_gz_zlib_gnu=yes
2888 AC_MSG_RESULT([yes])
2890 ac_have_gz_zlib_gnu=no
2893 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2897 # does this compiler support nested functions ?
2899 AC_MSG_CHECKING([if gcc accepts nested functions])
2901 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2902 int foo() { return 1; }
2905 ac_have_nested_functions=yes
2906 AC_MSG_RESULT([yes])
2908 ac_have_nested_functions=no
2911 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2914 # does this compiler support the 'p' constraint in ASM statements ?
2916 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2918 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2920 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2922 ac_have_asm_constraint_p=yes
2923 AC_MSG_RESULT([yes])
2925 ac_have_asm_constraint_p=no
2928 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2931 # Does this compiler and linker support -pie?
2932 # Some compilers actually do not support -pie and report its usage
2933 # as an error. We need to check if it is safe to use it first.
2935 AC_MSG_CHECKING([if gcc accepts -pie])
2940 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2943 AC_SUBST([FLAG_PIE], ["-pie"])
2944 AC_MSG_RESULT([yes])
2946 AC_SUBST([FLAG_PIE], [""])
2951 AC_MSG_CHECKING([if gcc accepts -ansi])
2956 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2960 AC_MSG_RESULT([yes])
2965 AM_CONDITIONAL([HAVE_ANSI], [test x$ac_have_ansi = xyes])
2970 # Does this compiler support -no-pie?
2971 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2972 # default. However this gets in the way with some tests, we use -no-pie
2975 AC_MSG_CHECKING([if gcc accepts -no-pie])
2978 CFLAGS="-no-pie -Werror"
2980 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2983 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
2984 AC_MSG_RESULT([yes])
2986 AC_SUBST([FLAG_NO_PIE], [""])
2992 # We want to use use the -Ttext-segment option to the linker.
2993 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
2994 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2995 # semantics are NOT what we want (GNU gold -Ttext is fine).
2997 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2998 # will reside. -Ttext aligns just the .text section start (but not any
3001 # LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes"
3002 # in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html
3003 # The --image-base option (since version 6.0?) provides the semantics needed.
3004 # -Ttext-segment generates an error, but -Ttext now more closely
3005 # follows the GNU (bfd) ld's -Ttext.
3007 # So test first for --image-base support, and if that fails then
3008 # for -Ttext-segment which is supported by all bfd ld versions
3009 # and use that if it exists. If it doesn't exist it must be an older
3010 # version of gold and we can fall back to using -Ttext which has the
3014 AC_MSG_CHECKING([if the linker accepts -Wl,--image-base])
3016 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror"
3019 [AC_LANG_SOURCE([int _start () { return 0; }])],
3021 linker_using_t_text="no"
3022 AC_SUBST([FLAG_T_TEXT], ["--image-base"])
3023 AC_MSG_RESULT([yes])
3027 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
3029 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
3032 [AC_LANG_SOURCE([int _start () { return 0; }])],
3034 linker_using_t_text="no"
3035 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
3036 AC_MSG_RESULT([yes])
3038 linker_using_t_text="yes"
3039 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
3046 # If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will
3047 # have to strip any build-id ELF NOTEs from the statically linked tools.
3048 # Otherwise the build-id NOTE might end up at the default load address.
3049 # (Pedantically if the linker is gold then -Ttext is fine, but newer
3050 # gold versions also support -Ttext-segment. So just assume that unless
3051 # we can use -Ttext-segment we need to strip the build-id NOTEs.
3052 if test "x${linker_using_t_text}" = "xyes"; then
3053 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
3054 # does the linker support -Wl,--build-id=none ? Note, it's
3055 # important that we test indirectly via whichever C compiler
3056 # is selected, rather than testing /usr/bin/ld or whatever
3058 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
3060 CFLAGS="-Wl,--build-id=none -Werror"
3063 [AC_LANG_PROGRAM([ ], [return 0;])],
3065 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
3066 AC_MSG_RESULT([yes])
3068 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3072 AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.])
3073 AC_SUBST([FLAG_NO_BUILD_ID], [""])
3077 # does the ppc assembler support "mtocrf" et al?
3078 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
3080 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3081 __asm__ __volatile__("mtocrf 4,0");
3082 __asm__ __volatile__("mfocrf 0,4");
3084 ac_have_as_ppc_mftocrf=yes
3085 AC_MSG_RESULT([yes])
3087 ac_have_as_ppc_mftocrf=no
3090 if test x$ac_have_as_ppc_mftocrf = xyes ; then
3091 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
3095 # does the ppc assembler support "lfdp" and other phased out floating point insns?
3096 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
3098 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3099 do { typedef struct {
3103 dbl_pair_t dbl_pair[3];
3104 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
3107 ac_have_as_ppc_fpPO=yes
3108 AC_MSG_RESULT([yes])
3110 ac_have_as_ppc_fpPO=no
3113 if test x$ac_have_as_ppc_fpPO = xyes ; then
3114 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
3118 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
3119 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
3121 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3123 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
3124 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
3126 ac_have_as_amd64_fxsave64=yes
3127 AC_MSG_RESULT([yes])
3129 ac_have_as_amd64_fxsave64=no
3132 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
3133 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
3136 # does the x86/amd64 assembler understand SSE3 instructions?
3137 # Note, this doesn't generate a C-level symbol. It generates a
3138 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
3139 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
3141 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3142 do { long long int x;
3143 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
3147 AC_MSG_RESULT([yes])
3153 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
3156 # Ditto for SSSE3 instructions (note extra S)
3157 # Note, this doesn't generate a C-level symbol. It generates a
3158 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
3159 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
3161 save_CFLAGS="$CFLAGS"
3162 CFLAGS="$CFLAGS -msse -Werror"
3163 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3164 do { long long int x;
3165 __asm__ __volatile__(
3166 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
3169 ac_have_as_ssse3=yes
3170 AC_MSG_RESULT([yes])
3175 CFLAGS="$save_CFLAGS"
3177 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
3180 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
3181 # Note, this doesn't generate a C-level symbol. It generates a
3182 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
3183 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
3184 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3186 __asm__ __volatile__(
3187 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
3190 ac_have_as_pclmulqdq=yes
3191 AC_MSG_RESULT([yes])
3193 ac_have_as_pclmulqdq=no
3197 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
3200 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
3201 # Note, this doesn't generate a C-level symbol. It generates a
3202 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
3203 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
3204 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3207 * Carry-less multiplication of xmm1 with xmm2 and store the result in
3208 * xmm3. The immediate is used to determine which quadwords of xmm1 and
3209 * xmm2 should be used.
3211 __asm__ __volatile__(
3212 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
3215 ac_have_as_vpclmulqdq=yes
3216 AC_MSG_RESULT([yes])
3218 ac_have_as_vpclmulqdq=no
3222 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
3225 # does the x86/amd64 assembler understand FMA4 instructions?
3226 # Note, this doesn't generate a C-level symbol. It generates a
3227 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
3228 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
3229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3231 __asm__ __volatile__(
3232 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
3235 ac_have_as_vfmaddpd=yes
3236 AC_MSG_RESULT([yes])
3238 ac_have_as_vfmaddpd=no
3242 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
3245 # does the x86/amd64 assembler understand the LZCNT instruction?
3246 # Note, this doesn't generate a C-level symbol. It generates a
3247 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
3248 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
3250 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3252 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
3255 ac_have_as_lzcnt=yes
3256 AC_MSG_RESULT([yes])
3262 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
3265 # does the x86/amd64 assembler understand the LOOPNEL instruction?
3266 # Note, this doesn't generate a C-level symbol. It generates a
3267 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
3268 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
3270 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3272 __asm__ __volatile__("1: loopnel 1b\n");
3275 ac_have_as_loopnel=yes
3276 AC_MSG_RESULT([yes])
3278 ac_have_as_loopnel=no
3282 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
3285 # does the x86/amd64 assembler understand ADDR32 ?
3286 # Note, this doesn't generate a C-level symbol. It generates a
3287 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
3288 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
3290 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3292 asm volatile ("addr32 rep movsb");
3295 ac_have_as_addr32=yes
3296 AC_MSG_RESULT([yes])
3298 ac_have_as_addr32=no
3302 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
3305 # does the x86/amd64 assembler understand SSE 4.2 instructions?
3306 # Note, this doesn't generate a C-level symbol. It generates a
3307 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
3308 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
3310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3311 do { long long int x;
3312 __asm__ __volatile__(
3313 "crc32q %%r15,%%r15" : : : "r15" );
3314 __asm__ __volatile__(
3315 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
3316 __asm__ __volatile__(
3317 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
3320 ac_have_as_sse42=yes
3321 AC_MSG_RESULT([yes])
3327 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
3330 # does the x86/amd64 assembler understand AVX instructions?
3331 # Note, this doesn't generate a C-level symbol. It generates a
3332 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
3333 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
3335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3336 do { long long int x;
3337 __asm__ __volatile__(
3338 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
3339 __asm__ __volatile__(
3340 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3344 AC_MSG_RESULT([yes])
3350 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
3353 # does the x86/amd64 assembler understand AVX2 instructions?
3354 # Note, this doesn't generate a C-level symbol. It generates a
3355 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
3356 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
3358 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3359 do { long long int x;
3360 __asm__ __volatile__(
3361 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3362 __asm__ __volatile__(
3363 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3367 AC_MSG_RESULT([yes])
3373 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
3376 # does the x86/amd64 assembler understand TSX instructions and
3377 # the XACQUIRE/XRELEASE prefixes?
3378 # Note, this doesn't generate a C-level symbol. It generates a
3379 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
3380 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
3382 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3384 __asm__ __volatile__(
3387 " xacquire lock incq 0(%rsp) \n\t"
3388 " xrelease lock incq 0(%rsp) \n"
3393 AC_MSG_RESULT([yes])
3399 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
3402 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
3403 # Note, this doesn't generate a C-level symbol. It generates a
3404 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
3405 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
3407 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3408 do { unsigned int h, l;
3409 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
3410 __asm__ __volatile__(
3411 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
3412 __asm__ __volatile__(
3413 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
3417 AC_MSG_RESULT([yes])
3423 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
3426 # does the x86/amd64 assembler understand FMA instructions?
3427 # Note, this doesn't generate a C-level symbol. It generates a
3428 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
3429 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
3431 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3432 do { unsigned int h, l;
3433 __asm__ __volatile__(
3434 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3435 __asm__ __volatile__(
3436 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
3437 __asm__ __volatile__(
3438 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
3442 AC_MSG_RESULT([yes])
3448 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
3451 # does the amd64 assembler understand MPX instructions?
3452 # Note, this doesn't generate a C-level symbol. It generates a
3453 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
3454 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
3456 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3458 asm ("bndmov %bnd0,(%rsp)");
3459 asm ("bndldx 3(%rbx,%rdx), %bnd2");
3460 asm ("bnd call foo\n"
3467 AC_MSG_RESULT([yes])
3473 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
3476 # does the amd64 assembler understand ADX instructions?
3477 # Note, this doesn't generate a C-level symbol. It generates a
3478 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
3479 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
3481 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3483 asm ("adcxq %r14,%r8");
3487 AC_MSG_RESULT([yes])
3493 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
3496 # does the amd64 assembler understand the RDRAND instruction?
3497 # Note, this doesn't generate a C-level symbol. It generates a
3498 # automake-level symbol (BUILD_RDRAND_TESTS), used in test Makefile.am's
3499 AC_MSG_CHECKING([if amd64 assembler knows the RDRAND instruction])
3501 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3503 asm ("rdrand %r14");
3504 asm ("rdrand %r14d");
3505 asm ("rdrand %r14w");
3508 ac_have_as_rdrand=yes
3509 AC_MSG_RESULT([yes])
3511 ac_have_as_rdrand=no
3515 AM_CONDITIONAL(BUILD_RDRAND_TESTS, test x$ac_have_as_rdrand = xyes)
3517 # does the amd64 assembler understand the RDSEED instruction?
3518 # Note, this doesn't generate a C-level symbol. It generates a
3519 # automake-level symbol (BUILD_RDSEED_TESTS), used in test Makefile.am's
3520 AC_MSG_CHECKING([if amd64 assembler knows the RDSEED instruction])
3522 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3524 asm ("rdseed %r14");
3525 asm ("rdseed %r14d");
3526 asm ("rdseed %r14w");
3529 ac_have_as_rdseed=yes
3530 AC_MSG_RESULT([yes])
3532 ac_have_as_rdseed=no
3536 AM_CONDITIONAL(BUILD_RDSEED_TESTS, test x$ac_have_as_rdseed = xyes)
3538 # does the amd64 assembler understand the F16C instructions (VCVTPH2PS and
3540 # Note, this doesn't generate a C-level symbol. It generates a
3541 # automake-level symbol (BUILD_F16C_TESTS), used in test Makefile.am's
3542 AC_MSG_CHECKING([if amd64 assembler knows the F16C instructions])
3544 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3546 asm ("vcvtph2ps %xmm5, %ymm10");
3547 // If we put the dollar sign and zero together, the shell processing
3548 // this configure.ac script substitutes the command name in. Sigh.
3549 asm ("vcvtps2ph $" "0, %ymm10, %xmm5");
3553 AC_MSG_RESULT([yes])
3559 AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes)
3562 # does the x86/amd64 assembler understand MOVBE?
3563 # Note, this doesn't generate a C-level symbol. It generates a
3564 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
3565 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
3567 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3568 do { long long int x;
3569 __asm__ __volatile__(
3570 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
3573 ac_have_as_movbe=yes
3574 AC_MSG_RESULT([yes])
3580 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
3583 # Does the C compiler support the "ifunc" attribute
3584 # Note, this doesn't generate a C-level symbol. It generates a
3585 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
3586 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
3588 AC_LINK_IFELSE([AC_LANG_SOURCE([[
3589 static void mytest(void) {}
3591 static void (*resolve_test(void))(void)
3593 return (void (*)(void))&mytest;
3596 void test(void) __attribute__((ifunc("resolve_test")));
3604 ac_have_ifunc_attr=yes
3605 AC_MSG_RESULT([yes])
3607 ac_have_ifunc_attr=no
3611 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
3613 # Does the C compiler support the armv8 crc feature flag
3614 # Note, this doesn't generate a C-level symbol. It generates a
3615 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
3616 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
3618 save_CFLAGS="$CFLAGS"
3619 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
3620 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3626 ac_have_armv8_crc_feature=yes
3627 AC_MSG_RESULT([yes])
3629 ac_have_armv8_crc_feature=no
3632 CFLAGS="$save_CFLAGS"
3634 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
3637 # Does the C compiler support the armv81 flag and the assembler v8.1 instructions
3638 # Note, this doesn't generate a C-level symbol. It generates a
3639 # automake-level symbol (BUILD_ARMV81_TESTS), used in test Makefile.am's
3640 AC_MSG_CHECKING([if gcc supports the armv81 feature flag and assembler supports v8.1 instructions])
3642 save_CFLAGS="$CFLAGS"
3643 CFLAGS="$CFLAGS -march=armv8.1-a -Werror"
3644 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3647 __asm__ __volatile__("ldadd x0, x1, [x2]" ::: "memory");
3651 ac_have_armv81_feature=yes
3652 AC_MSG_RESULT([yes])
3654 ac_have_armv81_feature=no
3657 CFLAGS="$save_CFLAGS"
3659 AM_CONDITIONAL(BUILD_ARMV81_TESTS, test x$ac_have_armv81_feature = xyes)
3662 # Does the C compiler support the armv82 flag and the assembler v8.2 instructions
3663 # Note, this doesn't generate a C-level symbol. It generates a
3664 # automake-level symbol (BUILD_ARMV82_TESTS), used in test Makefile.am's
3665 AC_MSG_CHECKING([if gcc supports the armv82 feature flag and assembler supports v8.2 instructions])
3667 save_CFLAGS="$CFLAGS"
3668 CFLAGS="$CFLAGS -march=armv8.2-a+fp16 -Werror"
3669 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3672 __asm__ __volatile__("faddp h0, v1.2h");
3676 ac_have_armv82_feature=yes
3677 AC_MSG_RESULT([yes])
3679 ac_have_armv82_feature=no
3682 CFLAGS="$save_CFLAGS"
3684 AM_CONDITIONAL(BUILD_ARMV82_TESTS, test x$ac_have_armv82_feature = xyes)
3687 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
3688 # when building the tool executables. I think we should get rid of it.
3690 # Check for TLS support in the compiler and linker
3691 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3693 [vg_cv_linktime_tls=yes],
3694 [vg_cv_linktime_tls=no])
3695 # Native compilation: check whether running a program using TLS succeeds.
3696 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
3697 # succeeds but running programs using TLS fails.
3698 # Cross-compiling: check whether linking a program using TLS succeeds.
3699 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
3700 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
3701 [vg_cv_tls=$enableval],
3702 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3706 [vg_cv_tls=$vg_cv_linktime_tls])])])
3708 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
3709 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
3713 #----------------------------------------------------------------------------
3714 # Solaris-specific checks.
3715 #----------------------------------------------------------------------------
3717 if test "$VGCONF_OS" = "solaris" ; then
3718 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
3720 # Solaris-specific check determining if the Sun Studio Assembler is used to
3721 # build Valgrind. The test checks if the x86/amd64 assembler understands the
3722 # cmovl.l instruction, if yes then it's Sun Assembler.
3724 # C-level symbol: none
3725 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
3727 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
3728 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3730 __asm__ __volatile__("cmovl.l %edx, %eax");
3732 solaris_have_sun_studio_as=yes
3733 AC_MSG_RESULT([yes])
3735 solaris_have_sun_studio_as=no
3738 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
3740 # Solaris-specific check determining if symbols __xpg4 and __xpg6
3741 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
3742 # See solaris/vgpreload-solaris.mapfile for details.
3743 # gcc on older Solaris instructs linker to include these symbols,
3744 # gcc on illumos and newer Solaris does not.
3746 # C-level symbol: none
3747 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
3749 save_CFLAGS="$CFLAGS"
3750 CFLAGS="$CFLAGS -std=gnu99"
3751 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
3752 temp_dir=$( /usr/bin/mktemp -d )
3753 cat <<_ACEOF >${temp_dir}/mylib.c
3755 int myfunc(void) { printf("LaPutyka\n"); }
3757 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
3758 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
3759 if test "x${xpg_present}" = "x" ; then
3760 solaris_xpg_symbols_present=no
3763 solaris_xpg_symbols_present=yes
3764 AC_MSG_RESULT([yes])
3767 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
3768 CFLAGS="$save_CFLAGS"
3771 # Solaris-specific check determining if gcc enables largefile support by
3772 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
3773 # variable with gcc flags which disable it.
3775 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
3776 save_CFLAGS="$CFLAGS"
3777 CFLAGS="$CFLAGS -m32"
3778 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3779 return _LARGEFILE_SOURCE;
3781 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
3782 AC_MSG_RESULT([yes])
3784 SOLARIS_UNDEF_LARGESOURCE=""
3788 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
3791 # Solaris-specific check determining if /proc/self/cmdline
3792 # or /proc/<pid>/cmdline is supported.
3794 # C-level symbol: SOLARIS_PROC_CMDLINE
3795 # Automake-level symbol: SOLARIS_PROC_CMDLINE
3797 AC_CHECK_FILE([/proc/self/cmdline],
3799 solaris_proc_cmdline=yes
3800 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
3801 [Define to 1 if you have /proc/self/cmdline.])
3803 solaris_proc_cmdline=no
3805 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3808 # Solaris-specific check determining default platform for the Valgrind launcher.
3809 # Used in case the launcher cannot select platform by looking at the client
3810 # image (for example because the executable is a shell script).
3812 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3813 # Automake-level symbol: none
3815 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3816 # Get the ELF class of /bin/sh first.
3817 if ! test -f /bin/sh; then
3818 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3820 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3821 case "$elf_class" in
3823 default_arch="$VGCONF_ARCH_PRI";
3826 if test "x$VGCONF_ARCH_SEC" != "x"; then
3827 default_arch="$VGCONF_ARCH_SEC"
3829 default_arch="$VGCONF_ARCH_PRI";
3833 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3836 default_platform="$default_arch-$VGCONF_OS"
3837 AC_MSG_RESULT([$default_platform])
3838 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3839 [Default platform for Valgrind launcher.])
3842 # Solaris-specific check determining if the old syscalls are available.
3844 # C-level symbol: SOLARIS_OLD_SYSCALLS
3845 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3847 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3848 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3849 #include <sys/syscall.h>
3853 solaris_old_syscalls=yes
3854 AC_MSG_RESULT([yes])
3855 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3856 [Define to 1 if you have the old Solaris syscalls.])
3858 solaris_old_syscalls=no
3861 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
3864 # Solaris-specific check determining if the new accept() syscall is available.
3867 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3870 # New syscall (available on illumos):
3871 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3872 # int version, int flags);
3874 # If the old syscall is present then the following syscall will fail with
3875 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
3876 # available then it will fail with EINVAL (because the flags parameter is
3879 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
3880 # Automake-level symbol: none
3882 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
3883 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3884 #include <sys/syscall.h>
3888 syscall(SYS_accept, 0, 0, 0, 0, -1);
3889 return !(errno == EINVAL);
3891 AC_MSG_RESULT([yes])
3892 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
3893 [Define to 1 if you have the new `accept' syscall.])
3899 # Solaris-specific check determining if the new illumos pipe() syscall is
3903 # longlong_t pipe();
3905 # New syscall (available on illumos):
3906 # int pipe(intptr_t arg, int flags);
3908 # If the old syscall is present then the following call will succeed, if the
3909 # new syscall is available then it will fail with EFAULT (because address 0
3910 # cannot be accessed).
3912 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
3913 # Automake-level symbol: none
3915 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
3916 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3917 #include <sys/syscall.h>
3921 syscall(SYS_pipe, 0, 0);
3922 return !(errno == EFAULT);
3924 AC_MSG_RESULT([yes])
3925 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3926 [Define to 1 if you have the new `pipe' syscall.])
3932 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
3936 # int lwp_kill(id_t lwpid, int sig);
3938 # New syscall (available on Solaris 11):
3939 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3940 # int si_code, timespec_t *timeout);
3942 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3943 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3945 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3946 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3947 #include <sys/syscall.h>
3949 return !SYS_lwp_sigqueue;
3951 solaris_lwp_sigqueue_syscall=yes
3952 AC_MSG_RESULT([yes])
3953 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
3954 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
3956 solaris_lwp_sigqueue_syscall=no
3959 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3962 # Solaris-specific check determining if the lwp_sigqueue() syscall
3963 # takes both pid and thread id arguments or just thread id.
3965 # Old syscall (available up to Solaris 11.3):
3966 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3967 # int si_code, timespec_t *timeout);
3969 # New syscall (available since Solaris 11.4):
3970 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
3971 # int si_code, timespec_t *timeout);
3973 # If the old syscall is present then the following syscall will fail with
3974 # EINVAL (because signal is out of range); if the new syscall is available
3975 # then it will fail with ESRCH (because it would not find such thread in the
3978 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3979 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3981 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
3982 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
3983 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3984 #include <sys/syscall.h>
3988 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
3989 return !(errno == ESRCH);
3991 solaris_lwp_sigqueue_syscall_takes_pid=yes
3992 AC_MSG_RESULT([yes])
3993 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
3994 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
3996 solaris_lwp_sigqueue_syscall_takes_pid=no
3999 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
4000 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
4002 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
4006 # Solaris-specific check determining if the new lwp_name() syscall is
4009 # New syscall (available on Solaris 11):
4010 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
4012 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
4013 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
4015 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
4016 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4017 #include <sys/syscall.h>
4019 return !SYS_lwp_name;
4021 solaris_lwp_name_syscall=yes
4022 AC_MSG_RESULT([yes])
4023 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
4024 [Define to 1 if you have the new `lwp_name' syscall.])
4026 solaris_lwp_name_syscall=no
4029 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
4032 # Solaris-specific check determining if the new getrandom() syscall is
4035 # New syscall (available on Solaris 11):
4036 # int getrandom(void *buf, size_t buflen, uint_t flags);
4038 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
4039 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
4041 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
4042 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4043 #include <sys/syscall.h>
4045 return !SYS_getrandom;
4047 solaris_getrandom_syscall=yes
4048 AC_MSG_RESULT([yes])
4049 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
4050 [Define to 1 if you have the new `getrandom' syscall.])
4052 solaris_getrandom_syscall=no
4055 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
4058 # Solaris-specific check determining if the new zone() syscall subcodes
4059 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
4060 # were added in Solaris 11 but are missing on illumos.
4062 # C-level symbol: SOLARIS_ZONE_DEFUNCT
4063 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
4065 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
4066 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4067 #include <sys/zone.h>
4069 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
4071 solaris_zone_defunct=yes
4072 AC_MSG_RESULT([yes])
4073 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
4074 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
4076 solaris_zone_defunct=no
4079 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
4082 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
4083 # for auditon(2) subcode of the auditsys() syscall are available.
4084 # These commands are available in Solaris 11 and illumos but were removed
4087 # C-level symbol: SOLARIS_AUDITON_STAT
4088 # Automake-level symbol: SOLARIS_AUDITON_STAT
4090 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
4091 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4092 #include <bsm/audit.h>
4094 return !(A_GETSTAT && A_SETSTAT);
4096 solaris_auditon_stat=yes
4097 AC_MSG_RESULT([yes])
4098 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
4099 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
4101 solaris_auditon_stat=no
4104 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
4107 # Solaris-specific check determining if the new shmsys() syscall subcodes
4108 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
4109 # These subcodes were added in Solaris 11 but are missing on illumos.
4111 # C-level symbol: SOLARIS_SHM_NEW
4112 # Automake-level symbol: SOLARIS_SHM_NEW
4114 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
4115 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4116 #include <sys/ipc_impl.h>
4117 #include <sys/shm.h>
4118 #include <sys/shm_impl.h>
4120 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
4123 AC_MSG_RESULT([yes])
4124 AC_DEFINE([SOLARIS_SHM_NEW], 1,
4125 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
4130 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
4133 # Solaris-specific check determining if prxregset_t is available. Illumos
4134 # currently does not define it on the x86 platform.
4136 # C-level symbol: SOLARIS_PRXREGSET_T
4137 # Automake-level symbol: SOLARIS_PRXREGSET_T
4139 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
4140 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4141 #include <sys/procfs_isa.h>
4143 return !sizeof(prxregset_t);
4145 solaris_prxregset_t=yes
4146 AC_MSG_RESULT([yes])
4147 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
4148 [Define to 1 if you have the `prxregset_t' type.])
4150 solaris_prxregset_t=no
4153 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
4156 # Solaris-specific check determining if the new frealpathat() syscall is
4159 # New syscall (available on Solaris 11.1):
4160 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
4162 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4163 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
4165 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
4166 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4167 #include <sys/syscall.h>
4169 return !SYS_frealpathat;
4171 solaris_frealpathat_syscall=yes
4172 AC_MSG_RESULT([yes])
4173 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
4174 [Define to 1 if you have the new `frealpathat' syscall.])
4176 solaris_frealpathat_syscall=no
4179 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
4182 # Solaris-specific check determining if the new uuidsys() syscall is
4185 # New syscall (available on newer Solaris):
4186 # int uuidsys(struct uuid *uuid);
4188 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
4189 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
4191 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
4192 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4193 #include <sys/syscall.h>
4195 return !SYS_uuidsys;
4197 solaris_uuidsys_syscall=yes
4198 AC_MSG_RESULT([yes])
4199 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
4200 [Define to 1 if you have the new `uuidsys' syscall.])
4202 solaris_uuidsys_syscall=no
4205 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
4208 # Solaris-specific check determining if the new labelsys() syscall subcode
4209 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
4210 # missing on illumos.
4212 # C-level symbol: SOLARIS_TNDB_GET_TNIP
4213 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
4215 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
4216 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4217 #include <sys/tsol/tndb.h>
4219 return !TNDB_GET_TNIP;
4221 solaris_tndb_get_tnip=yes
4222 AC_MSG_RESULT([yes])
4223 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
4224 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
4226 solaris_tndb_get_tnip=no
4229 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
4232 # Solaris-specific check determining if the new labelsys() syscall opcodes
4233 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
4234 # added in Solaris 11 but are missing on illumos.
4236 # C-level symbol: SOLARIS_TSOL_CLEARANCE
4237 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
4239 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
4240 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4241 #include <sys/tsol/tsyscall.h>
4243 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
4245 solaris_tsol_clearance=yes
4246 AC_MSG_RESULT([yes])
4247 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
4248 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
4250 solaris_tsol_clearance=no
4253 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
4256 # Solaris-specific check determining if the new pset() syscall subcode
4257 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
4258 # is missing on illumos and Solaris 11.3.
4260 # C-level symbol: SOLARIS_PSET_GET_NAME
4261 # Automake-level symbol: SOLARIS_PSET_GET_NAME
4263 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
4264 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4265 #include <sys/pset.h>
4267 return !(PSET_GET_NAME);
4269 solaris_pset_get_name=yes
4270 AC_MSG_RESULT([yes])
4271 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
4272 [Define to 1 if you have the `PSET_GET_NAME' constants.])
4274 solaris_pset_get_name=no
4277 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
4280 # Solaris-specific check determining if the utimesys() syscall is
4281 # available (on illumos and older Solaris).
4283 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
4284 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
4286 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
4287 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4288 #include <sys/syscall.h>
4290 return !SYS_utimesys;
4292 solaris_utimesys_syscall=yes
4293 AC_MSG_RESULT([yes])
4294 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
4295 [Define to 1 if you have the `utimesys' syscall.])
4297 solaris_utimesys_syscall=no
4300 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
4303 # Solaris-specific check determining if the utimensat() syscall is
4304 # available (on newer Solaris).
4306 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4307 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4309 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
4310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4311 #include <sys/syscall.h>
4313 return !SYS_utimensat;
4315 solaris_utimensat_syscall=yes
4316 AC_MSG_RESULT([yes])
4317 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
4318 [Define to 1 if you have the `utimensat' syscall.])
4320 solaris_utimensat_syscall=no
4323 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
4326 # Solaris-specific check determining if the spawn() syscall is available
4327 # (on newer Solaris).
4329 # C-level symbol: SOLARIS_SPAWN_SYSCALL
4330 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
4332 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
4333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4334 #include <sys/syscall.h>
4338 solaris_spawn_syscall=yes
4339 AC_MSG_RESULT([yes])
4340 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
4341 [Define to 1 if you have the `spawn' syscall.])
4343 solaris_spawn_syscall=no
4346 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
4349 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
4350 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
4352 # C-level symbol: SOLARIS_MODCTL_MODNVL
4353 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
4355 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
4356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4357 #include <sys/modctl.h>
4359 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
4361 solaris_modctl_modnvl=yes
4362 AC_MSG_RESULT([yes])
4363 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
4364 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
4366 solaris_modctl_modnvl=no
4369 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
4372 # Solaris-specific check determining whether nscd (name switch cache daemon)
4373 # attaches its door at /system/volatile/name_service_door (Solaris)
4374 # or at /var/run/name_service_door (illumos).
4376 # Note that /var/run is a symlink to /system/volatile on Solaris
4377 # but not vice versa on illumos.
4379 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4380 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4382 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
4383 if test -e /system/volatile/name_service_door; then
4384 solaris_nscd_door_system_volatile=yes
4385 AC_MSG_RESULT([/system/volatile/name_service_door])
4386 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
4387 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
4389 solaris_nscd_door_system_volatile=no
4390 AC_MSG_RESULT([/var/run/name_service_door])
4392 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
4395 # Solaris-specific check determining if the new gethrt() fasttrap is available.
4397 # New fasttrap (available on Solaris 11):
4398 # hrt_t *gethrt(void);
4400 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
4401 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
4403 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
4404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4405 #include <sys/trap.h>
4409 solaris_gethrt_fasttrap=yes
4410 AC_MSG_RESULT([yes])
4411 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
4412 [Define to 1 if you have the new `gethrt' fasttrap.])
4414 solaris_gethrt_fasttrap=no
4417 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
4420 # Solaris-specific check determining if the new get_zone_offset() fasttrap
4423 # New fasttrap (available on Solaris 11):
4424 # zonehrtoffset_t *get_zone_offset(void);
4426 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4427 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4429 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
4430 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4431 #include <sys/trap.h>
4433 return !T_GETZONEOFFSET;
4435 solaris_getzoneoffset_fasttrap=yes
4436 AC_MSG_RESULT([yes])
4437 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
4438 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
4440 solaris_getzoneoffset_fasttrap=no
4443 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
4446 # Solaris-specific check determining if the execve() syscall
4447 # takes fourth argument (flags) or not.
4449 # Old syscall (available on illumos):
4450 # int execve(const char *fname, const char **argv, const char **envp);
4452 # New syscall (available on Solaris):
4453 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
4455 # If the new syscall is present then it will fail with EINVAL (because flags
4456 # are invalid); if the old syscall is available then it will fail with ENOENT
4457 # (because the file could not be found).
4459 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4460 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4462 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
4463 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4464 #include <sys/syscall.h>
4468 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
4469 return !(errno == EINVAL);
4471 solaris_execve_syscall_takes_flags=yes
4472 AC_MSG_RESULT([yes])
4473 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
4474 [Define to 1 if you have the new `execve' syscall which accepts flags.])
4476 solaris_execve_syscall_takes_flags=no
4479 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
4480 test x$solaris_execve_syscall_takes_flags = xyes)
4483 # Solaris-specific check determining version of the repository cache protocol.
4484 # Every Solaris version uses a different one, ranging from 21 to current 25.
4485 # The check is very ugly, though.
4487 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
4488 # Automake-level symbol: none
4490 AC_PATH_PROG(DIS_PATH, dis, false)
4491 if test "x$DIS_PATH" = "xfalse"; then
4492 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
4494 AC_CHECK_LIB(scf, scf_handle_bind, [], [
4495 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
4496 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4499 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
4500 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
4501 libscf=/usr/lib/64/libscf.so.1
4503 libscf=/usr/lib/libscf.so.1
4505 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
4506 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
4507 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4509 hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
4510 if test -z "$hex"; then
4511 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
4512 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4514 version=$( printf "%d\n" 0x$hex )
4515 AC_MSG_RESULT([$version])
4516 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
4517 [Version number of the repository door cache protocol.])
4520 # Solaris-specific check determining if "sysstat" segment reservation type
4523 # New "sysstat" segment reservation (available on Solaris 11.4):
4524 # - program header type: PT_SUNW_SYSSTAT
4525 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
4527 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4528 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4530 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
4531 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4532 #include <sys/auxv.h>
4534 return !AT_SUN_SYSSTAT_ADDR;
4536 solaris_reserve_sysstat_addr=yes
4537 AC_MSG_RESULT([yes])
4538 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
4539 [Define to 1 if you have the new `sysstat' segment reservation.])
4541 solaris_reserve_sysstat_addr=no
4544 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
4547 # Solaris-specific check determining if "sysstat_zone" segment reservation type
4550 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
4551 # - program header type: PT_SUNW_SYSSTAT_ZONE
4552 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
4554 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4555 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4557 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
4558 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4559 #include <sys/auxv.h>
4561 return !AT_SUN_SYSSTAT_ZONE_ADDR;
4563 solaris_reserve_sysstat_zone_addr=yes
4564 AC_MSG_RESULT([yes])
4565 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
4566 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
4568 solaris_reserve_sysstat_zone_addr=no
4571 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
4574 # Solaris-specific check determining if the system_stats() syscall is available
4575 # (on newer Solaris).
4577 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4578 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4580 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
4581 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4582 #include <sys/syscall.h>
4584 return !SYS_system_stats;
4586 solaris_system_stats_syscall=yes
4587 AC_MSG_RESULT([yes])
4588 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
4589 [Define to 1 if you have the `system_stats' syscall.])
4591 solaris_system_stats_syscall=no
4594 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
4597 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
4598 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
4600 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
4601 # Automake-level symbol: none
4603 AC_CHECK_TYPE([struct _fpchip_state],
4604 [solaris_fpchip_state_takes_underscore=yes],
4605 [solaris_fpchip_state_takes_underscore=no],
4606 [[#include <sys/regset.h>]])
4607 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
4608 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
4609 [Define to 1 if fpregset_t defines struct _fpchip_state])
4613 # Solaris-specific check determining if schedctl page shared between kernel
4614 # and userspace program is executable (illumos, older Solaris) or not (newer
4617 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
4618 # Automake-level symbol: none
4620 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
4621 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4625 #include <schedctl.h>
4629 schedctl_t *scp = schedctl_init();
4633 int fd = open("/proc/self/map", O_RDONLY);
4638 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
4639 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
4640 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
4641 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
4642 return (map.pr_mflags & MA_EXEC);
4648 solaris_schedctl_page_exec=no
4651 solaris_schedctl_page_exec=yes
4652 AC_MSG_RESULT([yes])
4653 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
4654 [Define to 1 if you have the schedctl page executable.])
4658 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
4659 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
4660 # an initial thread pointer for libc (newer Solaris).
4662 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
4663 # Automake-level symbol: none
4665 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
4666 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4667 #include <sys/fasttrap_isa.h>
4669 return !FT_SCRATCHSIZE;
4671 solaris_pt_sunwdtrace_thrp=yes
4672 AC_MSG_RESULT([yes])
4673 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
4674 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
4676 solaris_pt_sunwdtrace_thrp=no
4681 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
4682 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
4683 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
4684 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
4685 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
4686 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
4687 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
4688 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
4689 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
4690 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
4691 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
4692 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
4693 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
4694 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
4695 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
4696 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
4697 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
4698 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
4699 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
4700 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
4701 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
4702 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
4703 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
4704 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
4705 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
4706 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
4707 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
4708 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
4709 fi # test "$VGCONF_OS" = "solaris"
4711 #----------------------------------------------------------------------------
4712 # FreeBSD-specific checks.
4713 #----------------------------------------------------------------------------
4715 # Rather than having a large number of feature test as above with Solaris
4716 # these tests are per-version. This may not be entirely relialable for
4717 # FreeBSD development branches (XX.Y-CURRENT) or pre-release branches
4718 # (XX.Y-STABLE) but it should work for XX-Y-RELEASE
4720 if test "$VGCONF_OS" = "freebsd" ; then
4722 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13_0)
4726 AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, false)
4728 fi # test "$VGCONF_OS" = "freebsd"
4731 #----------------------------------------------------------------------------
4732 # Checks for C header files.
4733 #----------------------------------------------------------------------------
4735 AC_CHECK_HEADERS([ \
4753 # Verify whether the <linux/futex.h> header is usable.
4754 AC_MSG_CHECKING([if <linux/futex.h> is usable])
4756 save_CFLAGS="$CFLAGS"
4757 CFLAGS="$CFLAGS -D__user="
4758 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4759 #include <linux/futex.h>
4763 ac_have_usable_linux_futex_h=yes
4764 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
4765 [Define to 1 if you have a usable <linux/futex.h> header file.])
4766 AC_MSG_RESULT([yes])
4768 ac_have_usable_linux_futex_h=no
4771 CFLAGS="$save_CFLAGS"
4774 #----------------------------------------------------------------------------
4775 # Checks for typedefs, structures, and compiler characteristics.
4776 #----------------------------------------------------------------------------
4780 AC_CHECK_HEADERS_ONCE([sys/time.h])
4782 AC_CHECK_TYPE([struct statx], [
4783 AC_DEFINE([HAVE_STRUCT_STATX_IN_SYS_STAT_H], 1,
4784 [Define to 1 if <sys/stat.h> declares struct statx.])
4787 #include <sys/stat.h>
4791 #----------------------------------------------------------------------------
4792 # Checks for library functions.
4793 #----------------------------------------------------------------------------
4797 AC_CHECK_LIB([pthread], [pthread_create])
4798 AC_CHECK_LIB([rt], [clock_gettime])
4817 pthread_barrier_init \
4818 pthread_condattr_setclock \
4819 pthread_mutex_timedlock \
4820 pthread_rwlock_timedrdlock \
4821 pthread_rwlock_timedwrlock \
4822 pthread_setname_np \
4848 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
4849 # libraries with any shared object and/or executable. This is NOT what we
4850 # want for e.g. vgpreload_core-x86-linux.so
4853 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
4854 [test x$ac_cv_func_pthread_barrier_init = xyes])
4855 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
4856 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
4857 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
4858 [test x$ac_cv_func_pthread_spin_lock = xyes])
4859 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
4860 [test x$ac_cv_func_pthread_setname_np = xyes])
4861 AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
4862 [test x$ac_cv_func_copy_file_range = xyes])
4863 AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
4864 [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
4865 AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
4866 [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes])
4867 AM_CONDITIONAL([HAVE_SETCONTEXT], [test x$ac_cv_func_setcontext = xyes])
4868 AM_CONDITIONAL([HAVE_SWAPCONTEXT], [test x$ac_cv_func_swapcontext = xyes])
4869 AM_CONDITIONAL([HAVE_MEMFD_CREATE],
4870 [test x$ac_cv_func_memfd_create = xyes])
4872 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4873 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
4874 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX; then
4875 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
4876 [Disable intercept pthread_spin_lock() on MIPS32, MIPS64 and nanoMIPS.])
4879 #----------------------------------------------------------------------------
4881 #----------------------------------------------------------------------------
4882 # Do we have a useable MPI setup on the primary and/or secondary targets?
4883 # On Linux, by default, assumes mpicc and -m32/-m64
4884 # Note: this is a kludge in that it assumes the specified mpicc
4885 # understands -m32/-m64 regardless of what is specified using
4887 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
4888 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
4891 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
4892 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
4893 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
4894 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
4895 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4896 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX \
4897 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
4898 mflag_primary=$FLAG_M32
4899 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
4900 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
4901 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
4902 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
4903 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
4904 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
4905 mflag_primary=$FLAG_M64
4906 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
4907 mflag_primary="$FLAG_M32 -arch i386"
4908 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
4909 mflag_primary="$FLAG_M64 -arch x86_64"
4913 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
4914 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
4915 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
4916 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX \
4917 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD ; then
4918 mflag_secondary=$FLAG_M32
4919 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
4920 mflag_secondary="$FLAG_M32 -arch i386"
4925 [ --with-mpicc= Specify name of MPI2-ised C compiler],
4930 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
4931 ## use these values in the check for a functioning mpicc.
4933 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
4934 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
4935 AM_COND_IF([VGCONF_OS_IS_LINUX],
4936 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4937 LDFLAGS_MPI="-fpic -shared"])
4938 AM_COND_IF([VGCONF_OS_IS_FREEBSD],
4939 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4940 LDFLAGS_MPI="-fpic -shared"])
4941 AM_COND_IF([VGCONF_OS_IS_DARWIN],
4942 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
4943 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
4944 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
4945 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4946 LDFLAGS_MPI="-fpic -shared"])
4948 AC_SUBST([CFLAGS_MPI])
4949 AC_SUBST([LDFLAGS_MPI])
4952 ## See if MPI_CC works for the primary target
4954 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
4956 saved_CFLAGS=$CFLAGS
4958 CFLAGS="$CFLAGS_MPI $mflag_primary"
4959 saved_LDFLAGS="$LDFLAGS"
4960 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
4961 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4965 int ni, na, nd, comb;
4966 int r = MPI_Init(NULL,NULL);
4967 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4968 r |= MPI_Finalize();
4971 ac_have_mpi2_pri=yes
4972 AC_MSG_RESULT([yes, $MPI_CC])
4978 CFLAGS=$saved_CFLAGS
4979 LDFLAGS="$saved_LDFLAGS"
4980 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
4982 ## See if MPI_CC works for the secondary target. Complication: what if
4983 ## there is no secondary target? We need this to then fail.
4984 ## Kludge this by making MPI_CC something which will surely fail in
4987 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
4989 saved_CFLAGS=$CFLAGS
4990 saved_LDFLAGS="$LDFLAGS"
4991 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
4992 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
4993 CC="$MPI_CC this will surely fail"
4997 CFLAGS="$CFLAGS_MPI $mflag_secondary"
4998 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5002 int ni, na, nd, comb;
5003 int r = MPI_Init(NULL,NULL);
5004 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
5005 r |= MPI_Finalize();
5008 ac_have_mpi2_sec=yes
5009 AC_MSG_RESULT([yes, $MPI_CC])
5015 CFLAGS=$saved_CFLAGS
5016 LDFLAGS="$saved_LDFLAGS"
5017 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
5020 #----------------------------------------------------------------------------
5021 # Other library checks
5022 #----------------------------------------------------------------------------
5023 # There now follow some tests for Boost, and OpenMP. These
5024 # tests are present because Drd has some regression tests that use
5025 # these packages. All regression test programs all compiled only
5026 # for the primary target. And so it is important that the configure
5027 # checks that follow, use the correct -m32 or -m64 flag for the
5028 # primary target (called $mflag_primary). Otherwise, we can end up
5029 # in a situation (eg) where, on amd64-linux, the test for Boost checks
5030 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
5031 # only build (meaning, the primary target is x86-linux), the build
5032 # of the regtest programs that use Boost fails, because they are
5033 # build as 32-bit (IN THIS EXAMPLE).
5035 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
5036 # NEEDED BY THE REGRESSION TEST PROGRAMS.
5039 # Check whether the boost library 1.35 or later has been installed.
5040 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
5042 AC_MSG_CHECKING([for boost])
5045 safe_CXXFLAGS=$CXXFLAGS
5046 CXXFLAGS="$mflag_primary"
5048 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
5050 AC_LINK_IFELSE([AC_LANG_SOURCE([
5051 #include <boost/thread.hpp>
5052 static void thread_func(void)
5054 int main(int argc, char** argv)
5056 boost::thread t(thread_func);
5061 ac_have_boost_1_35=yes
5062 AC_SUBST([BOOST_CFLAGS], [])
5063 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
5064 AC_MSG_RESULT([yes])
5066 ac_have_boost_1_35=no
5071 CXXFLAGS=$safe_CXXFLAGS
5074 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
5077 # does this compiler support -fopenmp, does it have the include file
5078 # <omp.h> and does it have libgomp ?
5080 AC_MSG_CHECKING([for OpenMP])
5083 CFLAGS="-fopenmp $mflag_primary -Werror"
5085 AC_LINK_IFELSE([AC_LANG_SOURCE([
5087 int main(int argc, char** argv)
5095 AC_MSG_RESULT([yes])
5102 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
5105 # Check for __builtin_popcount
5106 AC_MSG_CHECKING([for __builtin_popcount()])
5107 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5109 __builtin_popcount(2);
5112 AC_MSG_RESULT([yes])
5113 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
5114 [Define to 1 if compiler provides __builtin_popcount().])
5119 # Check for __builtin_clz
5120 AC_MSG_CHECKING([for __builtin_clz()])
5121 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5126 AC_MSG_RESULT([yes])
5127 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
5128 [Define to 1 if compiler provides __builtin_clz().])
5133 # Check for __builtin_ctz
5134 AC_MSG_CHECKING([for __builtin_ctz()])
5135 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5140 AC_MSG_RESULT([yes])
5141 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
5142 [Define to 1 if compiler provides __builtin_ctz().])
5147 # does this compiler have built-in functions for atomic memory access for the
5149 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
5152 CFLAGS="$mflag_primary"
5154 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5156 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5157 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5159 ac_have_builtin_atomic_primary=yes
5160 AC_MSG_RESULT([yes])
5161 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])
5163 ac_have_builtin_atomic_primary=no
5169 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
5170 [test x$ac_have_builtin_atomic_primary = xyes])
5173 # does this compiler have built-in functions for atomic memory access for the
5174 # secondary target ?
5176 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5178 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
5181 CFLAGS="$mflag_secondary"
5183 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5185 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
5187 ac_have_builtin_atomic_secondary=yes
5188 AC_MSG_RESULT([yes])
5190 ac_have_builtin_atomic_secondary=no
5198 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
5199 [test x$ac_have_builtin_atomic_secondary = xyes])
5201 # does this compiler have built-in functions for atomic memory access on
5202 # 64-bit integers for all targets ?
5204 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
5206 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5209 uint64_t variable = 1;
5210 return __sync_add_and_fetch(&variable, 1)
5212 ac_have_builtin_atomic64_primary=yes
5214 ac_have_builtin_atomic64_primary=no
5217 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
5220 CFLAGS="$mflag_secondary"
5222 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5225 uint64_t variable = 1;
5226 return __sync_add_and_fetch(&variable, 1)
5228 ac_have_builtin_atomic64_secondary=yes
5230 ac_have_builtin_atomic64_secondary=no
5237 if test x$ac_have_builtin_atomic64_primary = xyes && \
5238 test x$VGCONF_PLATFORM_SEC_CAPS = x \
5239 -o x$ac_have_builtin_atomic64_secondary = xyes; then
5240 AC_MSG_RESULT([yes])
5241 ac_have_builtin_atomic64=yes
5244 ac_have_builtin_atomic64=no
5247 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
5248 [test x$ac_have_builtin_atomic64 = xyes])
5251 AC_MSG_CHECKING([if platform has openat2 syscall])
5253 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5254 #include <sys/syscall.h>
5263 AM_CONDITIONAL([HAVE_OPENAT2],
5264 [test x$ac_have_openat2 = xyes])
5266 # does g++ have built-in functions for atomic memory access ?
5267 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
5269 safe_CXXFLAGS=$CXXFLAGS
5270 CXXFLAGS="$mflag_primary"
5273 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5275 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5276 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5278 ac_have_builtin_atomic_cxx=yes
5279 AC_MSG_RESULT([yes])
5280 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
5282 ac_have_builtin_atomic_cxx=no
5287 CXXFLAGS=$safe_CXXFLAGS
5289 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
5292 if test x$ac_have_usable_linux_futex_h = xyes \
5293 -a x$ac_have_builtin_atomic_primary = xyes; then
5294 ac_enable_linux_ticket_lock_primary=yes
5296 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
5297 [test x$ac_enable_linux_ticket_lock_primary = xyes])
5299 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
5300 -a x$ac_have_usable_linux_futex_h = xyes \
5301 -a x$ac_have_builtin_atomic_secondary = xyes; then
5302 ac_enable_linux_ticket_lock_secondary=yes
5304 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
5305 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
5308 # does libstdc++ support annotating shared pointers ?
5309 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
5311 safe_CXXFLAGS=$CXXFLAGS
5312 CXXFLAGS="-std=c++0x"
5315 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5318 std::shared_ptr<int> p
5320 ac_have_shared_ptr=yes
5322 ac_have_shared_ptr=no
5324 if test x$ac_have_shared_ptr = xyes; then
5325 # If compilation of the program below fails because of a syntax error
5326 # triggered by substituting one of the annotation macros then that
5327 # means that libstdc++ supports these macros.
5328 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5329 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
5330 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
5333 std::shared_ptr<int> p
5335 ac_have_shared_pointer_annotation=no
5338 ac_have_shared_pointer_annotation=yes
5339 AC_MSG_RESULT([yes])
5340 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
5341 [Define to 1 if libstd++ supports annotating shared pointers])
5344 ac_have_shared_pointer_annotation=no
5349 CXXFLAGS=$safe_CXXFLAGS
5351 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
5352 [test x$ac_have_shared_pointer_annotation = xyes])
5355 #----------------------------------------------------------------------------
5356 # Ok. We're done checking.
5357 #----------------------------------------------------------------------------
5359 # Nb: VEX/Makefile is generated from Makefile.vex.in.
5362 VEX/Makefile:Makefile.vex.in
5366 glibc-2.X-helgrind.supp
5370 docs/xml/vg-entities.xml
5375 gdbserver_tests/Makefile
5376 gdbserver_tests/solaris/Makefile
5382 memcheck/tests/Makefile
5383 memcheck/tests/common/Makefile
5384 memcheck/tests/amd64/Makefile
5385 memcheck/tests/x86/Makefile
5386 memcheck/tests/linux/Makefile
5387 memcheck/tests/linux/debuginfod-check.vgtest
5388 memcheck/tests/darwin/Makefile
5389 memcheck/tests/solaris/Makefile
5390 memcheck/tests/freebsd/Makefile
5391 memcheck/tests/amd64-linux/Makefile
5392 memcheck/tests/arm64-linux/Makefile
5393 memcheck/tests/x86-linux/Makefile
5394 memcheck/tests/amd64-solaris/Makefile
5395 memcheck/tests/x86-solaris/Makefile
5396 memcheck/tests/amd64-freebsd/Makefile
5397 memcheck/tests/x86-freebsd/Makefile
5398 memcheck/tests/ppc32/Makefile
5399 memcheck/tests/ppc64/Makefile
5400 memcheck/tests/s390x/Makefile
5401 memcheck/tests/mips32/Makefile
5402 memcheck/tests/mips64/Makefile
5403 memcheck/tests/vbit-test/Makefile
5405 cachegrind/tests/Makefile
5406 cachegrind/tests/x86/Makefile
5407 cachegrind/cg_annotate
5410 callgrind/callgrind_annotate
5411 callgrind/callgrind_control
5412 callgrind/tests/Makefile
5414 helgrind/tests/Makefile
5416 drd/scripts/download-and-build-splash2
5419 massif/tests/Makefile
5424 lackey/tests/Makefile
5427 none/tests/scripts/Makefile
5428 none/tests/amd64/Makefile
5429 none/tests/ppc32/Makefile
5430 none/tests/ppc64/Makefile
5431 none/tests/x86/Makefile
5432 none/tests/arm/Makefile
5433 none/tests/arm64/Makefile
5434 none/tests/s390x/Makefile
5435 none/tests/mips32/Makefile
5436 none/tests/mips64/Makefile
5437 none/tests/nanomips/Makefile
5438 none/tests/linux/Makefile
5439 none/tests/darwin/Makefile
5440 none/tests/solaris/Makefile
5441 none/tests/freebsd/Makefile
5442 none/tests/amd64-linux/Makefile
5443 none/tests/x86-linux/Makefile
5444 none/tests/amd64-darwin/Makefile
5445 none/tests/x86-darwin/Makefile
5446 none/tests/amd64-solaris/Makefile
5447 none/tests/x86-solaris/Makefile
5448 none/tests/x86-freebsd/Makefile
5450 exp-bbv/tests/Makefile
5451 exp-bbv/tests/x86/Makefile
5452 exp-bbv/tests/x86-linux/Makefile
5453 exp-bbv/tests/amd64-linux/Makefile
5454 exp-bbv/tests/ppc32-linux/Makefile
5455 exp-bbv/tests/arm-linux/Makefile
5459 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
5460 [chmod +x coregrind/link_tool_exe_linux])
5461 AC_CONFIG_FILES([coregrind/link_tool_exe_freebsd],
5462 [chmod +x coregrind/link_tool_exe_freebsd])
5463 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
5464 [chmod +x coregrind/link_tool_exe_darwin])
5465 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
5466 [chmod +x coregrind/link_tool_exe_solaris])
5467 AC_CONFIG_FILES([tests/filter_stderr_basic],
5468 [chmod +x tests/filter_stderr_basic])
5469 AC_CONFIG_FILES([tests/filter_discards],
5470 [chmod +x tests/filter_discards])
5471 AC_CONFIG_FILES([memcheck/tests/filter_stderr],
5472 [chmod +x memcheck/tests/filter_stderr])
5473 AC_CONFIG_FILES([memcheck/tests/filter_dw4],
5474 [chmod +x memcheck/tests/filter_dw4])
5475 AC_CONFIG_FILES([memcheck/tests/filter_overlaperror],
5476 [chmod +x memcheck/tests/filter_overlaperror])
5477 AC_CONFIG_FILES([memcheck/tests/x86/filter_pushfpopf],
5478 [chmod +x memcheck/tests/x86/filter_pushfpopf])
5479 AC_CONFIG_FILES([gdbserver_tests/filter_gdb],
5480 [chmod +x gdbserver_tests/filter_gdb])
5481 AC_CONFIG_FILES([gdbserver_tests/filter_memcheck_monitor],
5482 [chmod +x gdbserver_tests/filter_memcheck_monitor])
5483 AC_CONFIG_FILES([gdbserver_tests/filter_stderr],
5484 [chmod +x gdbserver_tests/filter_stderr])
5485 AC_CONFIG_FILES([gdbserver_tests/filter_vgdb],
5486 [chmod +x gdbserver_tests/filter_vgdb])
5487 AC_CONFIG_FILES([drd/tests/filter_stderr],
5488 [chmod +x drd/tests/filter_stderr])
5489 AC_CONFIG_FILES([drd/tests/filter_error_count],
5490 [chmod +x drd/tests/filter_error_count])
5491 AC_CONFIG_FILES([drd/tests/filter_error_summary],
5492 [chmod +x drd/tests/filter_error_summary])
5493 AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
5494 [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
5495 AC_CONFIG_FILES([drd/tests/filter_thread_no],
5496 [chmod +x drd/tests/filter_thread_no])
5497 AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
5498 [chmod +x drd/tests/filter_xml_and_thread_no])
5499 AC_CONFIG_FILES([helgrind/tests/filter_stderr],
5500 [chmod +x helgrind/tests/filter_stderr])
5506 Maximum build arch: ${ARCH_MAX}
5507 Primary build arch: ${VGCONF_ARCH_PRI}
5508 Secondary build arch: ${VGCONF_ARCH_SEC}
5509 Build OS: ${VGCONF_OS}
5510 Link Time Optimisation: ${vg_cv_lto}
5511 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
5512 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
5513 Platform variant: ${VGCONF_PLATVARIANT}
5514 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
5515 Default supp files: ${DEFAULT_SUPP}