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.
11 AC_INIT([Valgrind],[3.18.0.GIT],[valgrind-users@lists.sourceforge.net])
12 AC_CONFIG_SRCDIR(coregrind/m_main.c)
13 AC_CONFIG_HEADERS([config.h])
14 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
18 #----------------------------------------------------------------------------
19 # Do NOT modify these flags here. Except in feature tests in which case
20 # the original values must be properly restored.
21 #----------------------------------------------------------------------------
25 #----------------------------------------------------------------------------
26 # Checks for various programs.
27 #----------------------------------------------------------------------------
34 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
35 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
36 # base (eg. most likely as Darwin-specific tests) we'll need one of the
38 # - put AC_PROG_OBJC in a Darwin-specific part of this file
39 # - Use AC_PROG_OBJC here and up the minimum autoconf version
40 # - Use the following, which is apparently equivalent:
41 # m4_ifdef([AC_PROG_OBJC],
43 # [AC_CHECK_TOOL([OBJC], [gcc])
45 # AC_SUBST([OBJCFLAGS])
48 # Set LTO_RANLIB variable to an lto enabled ranlib
49 if test "x$LTO_RANLIB" = "x"; then
50 AC_PATH_PROGS([LTO_RANLIB], [gcc-ranlib])
52 AC_ARG_VAR([LTO_RANLIB],[Library indexer command for link time optimisation])
54 # provide a very basic definition for AC_PROG_SED if it's not provided by
55 # autoconf (as e.g. in autoconf 2.59).
56 m4_ifndef([AC_PROG_SED],
57 [AC_DEFUN([AC_PROG_SED],
59 AC_CHECK_PROGS([SED],[gsed sed])])])
62 # If no AR variable was specified, look up the name of the archiver. Otherwise
63 # do not touch the AR variable.
64 if test "x$AR" = "x"; then
65 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
67 AC_ARG_VAR([AR],[Archiver command])
69 # same for LTO_AR variable for lto enabled archiver
70 if test "x$LTO_AR" = "x"; then
71 AC_PATH_PROGS([LTO_AR], [gcc-ar])
73 AC_ARG_VAR([LTO_AR],[Archiver command for link time optimisation])
76 # Check for the compiler support
77 if test "${GCC}" != "yes" ; then
78 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
81 # figure out where perl lives
82 AC_PATH_PROG(PERL, perl)
84 # figure out where gdb lives
85 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
86 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
88 # some older automake's don't have it so try something on our own
89 ifdef([AM_PROG_AS],[AM_PROG_AS],
99 # Check if 'diff' supports -u (universal diffs) and use it if possible.
101 AC_MSG_CHECKING([for diff -u])
104 # Comparing two identical files results in 0.
105 tmpfile="tmp-xxx-yyy-zzz"
107 if diff -u $tmpfile $tmpfile ; then
116 # Make sure we can compile in C99 mode.
118 if test "$ac_cv_prog_cc_c99" = "no"; then
119 AC_MSG_ERROR([Valgrind relies on a C compiler supporting C99])
122 # We don't want gcc < 3.0
123 AC_MSG_CHECKING([for a supported version of gcc])
125 # Obtain the compiler version.
127 # A few examples of how the ${CC} --version output looks like:
129 # ######## gcc variants ########
130 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
131 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
132 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
133 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
134 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
135 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
136 # 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)
138 # ######## clang variants ########
139 # Clang: clang version 2.9 (tags/RELEASE_29/final)
140 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
141 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
143 # ######## Apple LLVM variants ########
144 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
145 # Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
148 if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
151 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
152 elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
155 # Don't use -dumpversion with clang: it will always produce "4.2.1".
156 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
157 elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
160 gcc_version=`${CC} -dumpversion 2>/dev/null`
163 gcc_version=`${CC} -dumpversion 2>/dev/null`
164 if test "x$gcc_version" = x; then
165 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
169 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
170 AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
172 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
173 # statements have to be quoted.
174 case "${is_clang}-${gcc_version}" in
175 applellvm-5.1|applellvm-[[6-9]].*|applellvm-[[1-9][0-9]]*)
176 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
178 icc-1[[3-9]].*|icc-202[[0-9]].*)
179 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
181 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
182 AC_MSG_RESULT([ok (${gcc_version})])
184 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
185 AC_MSG_RESULT([ok (clang-${gcc_version})])
188 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
189 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0 or Apple LLVM >= 5.1])
193 #----------------------------------------------------------------------------
194 # Arch/OS/platform tests.
195 #----------------------------------------------------------------------------
196 # We create a number of arch/OS/platform-related variables. We prefix them
197 # all with "VGCONF_" which indicates that they are defined at
198 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
199 # variables used when compiling C files.
203 AC_MSG_CHECKING([for a supported CPU])
205 # ARCH_MAX reflects the most that this CPU can do: for example if it
206 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
207 # Ditto for amd64. It is used for more configuration below, but is not used
210 # Power PC returns powerpc for Big Endian. This was not changed when Little
211 # Endian support was added to the 64-bit architecture. The 64-bit Little
212 # Endian systems explicitly state le in the host_cpu. For clarity in the
213 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianness of
214 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
215 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
216 # Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
217 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
218 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
221 case "${host_cpu}" in
223 AC_MSG_RESULT([ok (${host_cpu})])
228 AC_MSG_RESULT([ok (${host_cpu})])
233 # this only referrs to 64-bit Big Endian
234 AC_MSG_RESULT([ok (${host_cpu})])
239 # this only referrs to 64-bit Little Endian
240 AC_MSG_RESULT([ok (${host_cpu})])
245 # On Linux this means only a 32-bit capable CPU.
246 AC_MSG_RESULT([ok (${host_cpu})])
251 AC_MSG_RESULT([ok (${host_cpu})])
256 AC_MSG_RESULT([ok (${host_cpu})])
261 AC_MSG_RESULT([ok (${host_cpu})])
266 AC_MSG_RESULT([ok (${host_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})])
290 AC_MSG_RESULT([ok (${host_cpu})])
295 AC_MSG_RESULT([no (${host_cpu})])
296 AC_MSG_ERROR([Unsupported host architecture. Sorry])
300 #----------------------------------------------------------------------------
302 # Sometimes it's convenient to subvert the bi-arch build system and
303 # just have a single build even though the underlying platform is
304 # capable of both. Hence handle --enable-only64bit and
305 # --enable-only32bit. Complain if both are issued :-)
306 # [Actually, if either of these options are used, I think both get built,
307 # but only one gets installed. So if you use an in-place build, both can be
310 # Check if a 64-bit only build has been requested
311 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
312 [AC_ARG_ENABLE(only64bit,
313 [ --enable-only64bit do a 64-bit only build],
314 [vg_cv_only64bit=$enableval],
315 [vg_cv_only64bit=no])])
317 # Check if a 32-bit only build has been requested
318 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
319 [AC_ARG_ENABLE(only32bit,
320 [ --enable-only32bit do a 32-bit only build],
321 [vg_cv_only32bit=$enableval],
322 [vg_cv_only32bit=no])])
325 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
327 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
330 #----------------------------------------------------------------------------
332 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
333 # compilation of many C files via -VGO_$(VGCONF_OS) and
334 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
335 AC_MSG_CHECKING([for a supported OS])
342 AC_MSG_RESULT([ok (${host_os})])
345 # Ok, this is linux. Check the kernel version
346 AC_MSG_CHECKING([for the kernel version])
351 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
352 AC_MSG_RESULT([unsupported (${kernel})])
353 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
357 AC_MSG_RESULT([2.6 or later (${kernel})])
364 AC_MSG_RESULT([ok (${host_os})])
366 AC_DEFINE([FREEBSD_10], 1000, [FREEBSD_VERS value for FreeBSD 10.x])
367 AC_DEFINE([FREEBSD_11], 1100, [FREEBSD_VERS value for FreeBSD 11.x])
368 AC_DEFINE([FREEBSD_12], 1200, [FREEBSD_VERS value for FreeBSD 12.0 to 12.1])
369 AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2])
370 AC_DEFINE([FREEBSD_13], 1300, [FREEBSD_VERS value for FreeBSD 13.x])
371 AC_DEFINE([FREEBSD_14], 1400, [FREEBSD_VERS value for FreeBSD 14.x])
373 AC_MSG_CHECKING([for the kernel version])
378 AC_MSG_RESULT([FreeBSD 10.x (${kernel})])
379 AC_DEFINE([FREEBSD_VERS], FREEBSD_10, [FreeBSD version])
382 AC_MSG_RESULT([FreeBSD 11.x (${kernel})])
383 AC_DEFINE([FREEBSD_VERS], FREEBSD_11, [FreeBSD version])
388 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
389 AC_DEFINE([FREEBSD_VERS], FREEBSD_12, [FreeBSD version])
392 AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
393 AC_DEFINE([FREEBSD_VERS], FREEBSD_12_2, [FreeBSD version])
398 AC_MSG_RESULT([FreeBSD 13.x (${kernel})])
399 AC_DEFINE([FREEBSD_VERS], FREEBSD_13, [FreeBSD version])
402 AC_MSG_RESULT([FreeBSD 14.x (${kernel})])
403 AC_DEFINE([FREEBSD_VERS], FREEBSD_14, [FreeBSD version])
406 AC_MSG_RESULT([unsupported (${kernel})])
407 AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 14.x])
411 DEFAULT_SUPP="freebsd.supp freebsd-helgrind.supp freebsd-drd.supp ${DEFAULT_SUPP}"
415 AC_MSG_RESULT([ok (${host_os})])
417 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
418 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
419 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
420 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
421 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
422 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
423 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
424 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
425 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
427 AC_MSG_CHECKING([for the kernel version])
430 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
431 # has only one relevant version, the OS version. The `uname` check
432 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
433 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
434 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
435 # and we don't know of an macros similar to __GLIBC__ to get that info.
437 # XXX: `uname -r` won't do the right thing for cross-compiles, but
438 # that's not a problem yet.
440 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
441 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
442 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
443 # time support for 10.5 (the 9.* pattern just below), I'll leave it
444 # in for now, just in case anybody wants to give it a try. But I'm
445 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
448 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
449 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
450 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
451 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
454 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
455 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
456 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
457 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
460 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
461 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
462 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
463 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
466 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
467 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
468 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
469 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
472 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
473 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
474 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
475 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
478 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
479 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
480 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
481 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
484 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
485 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
486 DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
487 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
490 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
491 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
492 DEFAULT_SUPP="darwin16.supp ${DEFAULT_SUPP}"
493 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
496 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
497 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
498 DEFAULT_SUPP="darwin17.supp ${DEFAULT_SUPP}"
499 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
502 AC_MSG_RESULT([unsupported (${kernel})])
503 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)])
509 AC_MSG_RESULT([ok (${host_os})])
512 uname_v=$( uname -v )
515 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
518 DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
524 AC_MSG_RESULT([ok (${host_os})])
526 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
530 AC_MSG_RESULT([no (${host_os})])
531 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
535 #----------------------------------------------------------------------------
537 # If we are building on a 64 bit platform test to see if the system
538 # supports building 32 bit programs and disable 32 bit support if it
539 # does not support building 32 bit programs
541 case "$ARCH_MAX-$VGCONF_OS" in
542 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
543 AC_MSG_CHECKING([for 32 bit build support])
546 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
551 vg_cv_only64bit="yes"
554 CFLAGS=$safe_CFLAGS;;
556 AC_MSG_CHECKING([for 32 bit build support])
558 CFLAGS="$CFLAGS -mips32 -mabi=32"
559 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
560 #include <sys/prctl.h>
564 vg_cv_only64bit="yes"
567 CFLAGS=$safe_CFLAGS;;
570 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
572 [--enable-only32bit was specified but system does not support 32 bit builds])
575 #----------------------------------------------------------------------------
577 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
578 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
579 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
580 # above) will be "amd64" since that reflects the most that this cpu can do,
581 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
582 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
583 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
584 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
585 AC_SUBST(VGCONF_ARCH_PRI)
587 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
588 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
589 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
590 # It is empty if there is no secondary target.
591 AC_SUBST(VGCONF_ARCH_SEC)
593 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
594 # The entire system, including regression and performance tests, will be
595 # built for this target. The "_CAPS" indicates that the name is in capital
596 # letters, and it also uses '_' rather than '-' as a separator, because it's
597 # used to create various Makefile variables, which are all in caps by
598 # convention and cannot contain '-' characters. This is in contrast to
599 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
600 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
602 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
603 # Valgrind and tools will also be built for this target, but not the
604 # regression or performance tests.
606 # By default, the primary arch is the same as the "max" arch, as commented
607 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
608 # the big case statement just below here, in the case where we're building
609 # on a 64 bit machine but have been requested only to do a 32 bit build.
610 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
612 AC_MSG_CHECKING([for a supported CPU/OS combination])
614 # NB. The load address for a given platform may be specified in more
615 # than one place, in some cases, depending on whether we're doing a biarch,
616 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
617 # Be careful to give consistent values in all subcases. Also, all four
618 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
619 # even if it is to "0xUNSET".
621 case "$ARCH_MAX-$VGCONF_OS" in
623 VGCONF_ARCH_PRI="x86"
625 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
626 VGCONF_PLATFORM_SEC_CAPS=""
627 valt_load_address_pri_norml="0x58000000"
628 valt_load_address_pri_inner="0x38000000"
629 valt_load_address_sec_norml="0xUNSET"
630 valt_load_address_sec_inner="0xUNSET"
631 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
634 valt_load_address_sec_norml="0xUNSET"
635 valt_load_address_sec_inner="0xUNSET"
636 if test x$vg_cv_only64bit = xyes; then
637 VGCONF_ARCH_PRI="amd64"
639 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
640 VGCONF_PLATFORM_SEC_CAPS=""
641 valt_load_address_pri_norml="0x58000000"
642 valt_load_address_pri_inner="0x38000000"
643 elif test x$vg_cv_only32bit = xyes; then
644 VGCONF_ARCH_PRI="x86"
646 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
647 VGCONF_PLATFORM_SEC_CAPS=""
648 valt_load_address_pri_norml="0x58000000"
649 valt_load_address_pri_inner="0x38000000"
651 VGCONF_ARCH_PRI="amd64"
652 VGCONF_ARCH_SEC="x86"
653 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
654 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
655 valt_load_address_pri_norml="0x58000000"
656 valt_load_address_pri_inner="0x38000000"
657 valt_load_address_sec_norml="0x58000000"
658 valt_load_address_sec_inner="0x38000000"
660 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
663 VGCONF_ARCH_PRI="ppc32"
665 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
666 VGCONF_PLATFORM_SEC_CAPS=""
667 valt_load_address_pri_norml="0x58000000"
668 valt_load_address_pri_inner="0x38000000"
669 valt_load_address_sec_norml="0xUNSET"
670 valt_load_address_sec_inner="0xUNSET"
671 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
674 valt_load_address_sec_norml="0xUNSET"
675 valt_load_address_sec_inner="0xUNSET"
676 if test x$vg_cv_only64bit = xyes; then
677 VGCONF_ARCH_PRI="ppc64be"
679 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
680 VGCONF_PLATFORM_SEC_CAPS=""
681 valt_load_address_pri_norml="0x58000000"
682 valt_load_address_pri_inner="0x38000000"
683 elif test x$vg_cv_only32bit = xyes; then
684 VGCONF_ARCH_PRI="ppc32"
686 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
687 VGCONF_PLATFORM_SEC_CAPS=""
688 valt_load_address_pri_norml="0x58000000"
689 valt_load_address_pri_inner="0x38000000"
691 VGCONF_ARCH_PRI="ppc64be"
692 VGCONF_ARCH_SEC="ppc32"
693 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
694 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
695 valt_load_address_pri_norml="0x58000000"
696 valt_load_address_pri_inner="0x38000000"
697 valt_load_address_sec_norml="0x58000000"
698 valt_load_address_sec_inner="0x38000000"
700 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
703 # Little Endian is only supported on PPC64
704 valt_load_address_sec_norml="0xUNSET"
705 valt_load_address_sec_inner="0xUNSET"
706 VGCONF_ARCH_PRI="ppc64le"
708 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
709 VGCONF_PLATFORM_SEC_CAPS=""
710 valt_load_address_pri_norml="0x58000000"
711 valt_load_address_pri_inner="0x38000000"
712 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
715 VGCONF_ARCH_PRI="x86"
717 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
718 VGCONF_PLATFORM_SEC_CAPS=""
719 valt_load_address_pri_norml="0x38000000"
720 valt_load_address_pri_inner="0x28000000"
721 valt_load_address_sec_norml="0xUNSET"
722 valt_load_address_sec_inner="0xUNSET"
723 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
726 if test x$vg_cv_only64bit = xyes; then
727 VGCONF_ARCH_PRI="amd64"
729 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
730 VGCONF_PLATFORM_SEC_CAPS=""
731 elif test x$vg_cv_only32bit = xyes; then
732 VGCONF_ARCH_PRI="x86"
734 VGCONF_PLATFORM_PRI_CAPS="X86_FREEBSD"
735 VGCONF_PLATFORM_SEC_CAPS=""
737 VGCONF_ARCH_PRI="amd64"
738 VGCONF_ARCH_SEC="x86"
739 VGCONF_PLATFORM_PRI_CAPS="AMD64_FREEBSD"
740 VGCONF_PLATFORM_SEC_CAPS="X86_FREEBSD"
742 # These work with either base clang or ports installed gcc
743 # Hand rolled compilers probably need INSTALL_DIR/lib (at least for gcc)
744 if test x$is_clang = xclang ; then
745 FLAG_32ON64="-B/usr/lib32"
747 GCC_MAJOR_VERSION=`${CC} -dumpversion | $SED 's/\..*//' 2>/dev/null`
748 FLAG_32ON64="-B/usr/local/lib32/gcc${GCC_MAJOR_VERSION} -Wl,-rpath,/usr/local/lib32/gcc${GCC_MAJOR_VERSION}/"
750 valt_load_address_pri_norml="0x38000000"
751 valt_load_address_pri_inner="0x28000000"
752 valt_load_address_sec_norml="0x38000000"
753 valt_load_address_sec_inner="0x28000000"
754 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
756 # Darwin gets identified as 32-bit even when it supports 64-bit.
757 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
758 # all Macs support both 32-bit and 64-bit, so we just build both. If
759 # someone has a really old 32-bit only machine they can (hopefully?)
760 # build with --enable-only32bit. See bug 243362.
761 x86-darwin|amd64-darwin)
763 valt_load_address_sec_norml="0xUNSET"
764 valt_load_address_sec_inner="0xUNSET"
765 if test x$vg_cv_only64bit = xyes; then
766 VGCONF_ARCH_PRI="amd64"
768 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
769 VGCONF_PLATFORM_SEC_CAPS=""
770 valt_load_address_pri_norml="0x158000000"
771 valt_load_address_pri_inner="0x138000000"
772 elif test x$vg_cv_only32bit = xyes; then
773 VGCONF_ARCH_PRI="x86"
775 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
776 VGCONF_PLATFORM_SEC_CAPS=""
777 VGCONF_ARCH_PRI_CAPS="x86"
778 valt_load_address_pri_norml="0x58000000"
779 valt_load_address_pri_inner="0x38000000"
781 VGCONF_ARCH_PRI="amd64"
782 VGCONF_ARCH_SEC="x86"
783 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
784 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
785 valt_load_address_pri_norml="0x158000000"
786 valt_load_address_pri_inner="0x138000000"
787 valt_load_address_sec_norml="0x58000000"
788 valt_load_address_sec_inner="0x38000000"
790 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
793 VGCONF_ARCH_PRI="arm"
794 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
795 VGCONF_PLATFORM_SEC_CAPS=""
796 valt_load_address_pri_norml="0x58000000"
797 valt_load_address_pri_inner="0x38000000"
798 valt_load_address_sec_norml="0xUNSET"
799 valt_load_address_sec_inner="0xUNSET"
800 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
803 valt_load_address_sec_norml="0xUNSET"
804 valt_load_address_sec_inner="0xUNSET"
805 if test x$vg_cv_only64bit = xyes; then
806 VGCONF_ARCH_PRI="arm64"
808 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
809 VGCONF_PLATFORM_SEC_CAPS=""
810 valt_load_address_pri_norml="0x58000000"
811 valt_load_address_pri_inner="0x38000000"
812 elif test x$vg_cv_only32bit = xyes; then
813 VGCONF_ARCH_PRI="arm"
815 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
816 VGCONF_PLATFORM_SEC_CAPS=""
817 valt_load_address_pri_norml="0x58000000"
818 valt_load_address_pri_inner="0x38000000"
820 VGCONF_ARCH_PRI="arm64"
821 VGCONF_ARCH_SEC="arm"
822 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
823 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
824 valt_load_address_pri_norml="0x58000000"
825 valt_load_address_pri_inner="0x38000000"
826 valt_load_address_sec_norml="0x58000000"
827 valt_load_address_sec_inner="0x38000000"
829 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
832 VGCONF_ARCH_PRI="s390x"
834 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
835 VGCONF_PLATFORM_SEC_CAPS=""
836 # To improve branch prediction hit rate we want to have
837 # the generated code close to valgrind (host) code
838 valt_load_address_pri_norml="0x800000000"
839 valt_load_address_pri_inner="0x810000000"
840 valt_load_address_sec_norml="0xUNSET"
841 valt_load_address_sec_inner="0xUNSET"
842 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
845 VGCONF_ARCH_PRI="mips32"
847 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
848 VGCONF_PLATFORM_SEC_CAPS=""
849 valt_load_address_pri_norml="0x58000000"
850 valt_load_address_pri_inner="0x38000000"
851 valt_load_address_sec_norml="0xUNSET"
852 valt_load_address_sec_inner="0xUNSET"
853 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
856 valt_load_address_sec_norml="0xUNSET"
857 valt_load_address_sec_inner="0xUNSET"
858 if test x$vg_cv_only64bit = xyes; then
859 VGCONF_ARCH_PRI="mips64"
860 VGCONF_PLATFORM_SEC_CAPS=""
861 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
862 VGCONF_PLATFORM_SEC_CAPS=""
863 valt_load_address_pri_norml="0x58000000"
864 valt_load_address_pri_inner="0x38000000"
865 elif test x$vg_cv_only32bit = xyes; then
866 VGCONF_ARCH_PRI="mips32"
868 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
869 VGCONF_PLATFORM_SEC_CAPS=""
870 valt_load_address_pri_norml="0x58000000"
871 valt_load_address_pri_inner="0x38000000"
873 VGCONF_ARCH_PRI="mips64"
874 VGCONF_ARCH_SEC="mips32"
875 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
876 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
877 valt_load_address_pri_norml="0x58000000"
878 valt_load_address_pri_inner="0x38000000"
879 valt_load_address_sec_norml="0x58000000"
880 valt_load_address_sec_inner="0x38000000"
882 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
885 VGCONF_ARCH_PRI="nanomips"
887 VGCONF_PLATFORM_PRI_CAPS="NANOMIPS_LINUX"
888 VGCONF_PLATFORM_SEC_CAPS=""
889 valt_load_address_pri_norml="0x58000000"
890 valt_load_address_pri_inner="0x38000000"
891 valt_load_address_sec_norml="0xUNSET"
892 valt_load_address_sec_inner="0xUNSET"
893 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
896 VGCONF_ARCH_PRI="x86"
898 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
899 VGCONF_PLATFORM_SEC_CAPS=""
900 valt_load_address_pri_norml="0x58000000"
901 valt_load_address_pri_inner="0x38000000"
902 valt_load_address_sec_norml="0xUNSET"
903 valt_load_address_sec_inner="0xUNSET"
904 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
907 valt_load_address_sec_norml="0xUNSET"
908 valt_load_address_sec_inner="0xUNSET"
909 if test x$vg_cv_only64bit = xyes; then
910 VGCONF_ARCH_PRI="amd64"
912 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
913 VGCONF_PLATFORM_SEC_CAPS=""
914 valt_load_address_pri_norml="0x58000000"
915 valt_load_address_pri_inner="0x38000000"
916 elif test x$vg_cv_only32bit = xyes; then
917 VGCONF_ARCH_PRI="x86"
919 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
920 VGCONF_PLATFORM_SEC_CAPS=""
921 valt_load_address_pri_norml="0x58000000"
922 valt_load_address_pri_inner="0x38000000"
924 VGCONF_ARCH_PRI="amd64"
925 VGCONF_ARCH_SEC="x86"
926 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
927 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
928 valt_load_address_pri_norml="0x58000000"
929 valt_load_address_pri_inner="0x38000000"
930 valt_load_address_sec_norml="0x58000000"
931 valt_load_address_sec_inner="0x38000000"
933 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
936 VGCONF_ARCH_PRI="unknown"
937 VGCONF_ARCH_SEC="unknown"
938 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
939 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
940 valt_load_address_pri_norml="0xUNSET"
941 valt_load_address_pri_inner="0xUNSET"
942 valt_load_address_sec_norml="0xUNSET"
943 valt_load_address_sec_inner="0xUNSET"
944 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
945 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
949 #----------------------------------------------------------------------------
951 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
953 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
954 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
955 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
956 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
957 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD \
958 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
959 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
960 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
961 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
962 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
963 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
964 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
965 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
966 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
967 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
968 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
969 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
970 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
971 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
972 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
973 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
974 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
975 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
976 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
977 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
978 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
979 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
980 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
981 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
982 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
983 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
984 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
985 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_NANOMIPS,
986 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX )
988 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
990 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
991 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
992 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
993 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
994 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
995 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
996 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
997 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
998 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
999 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
1000 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
1001 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
1002 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
1003 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1004 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
1005 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
1006 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
1007 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
1008 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1009 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
1010 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
1011 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1012 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
1013 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
1014 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
1015 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_NANOMIPS_LINUX,
1016 test x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1017 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_FREEBSD,
1018 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1019 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD)
1020 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_FREEBSD,
1021 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1022 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
1023 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1024 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
1025 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
1026 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1027 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
1028 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1029 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
1030 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
1031 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1034 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
1035 # Relies on the assumption that the primary and secondary targets are
1036 # for the same OS, so therefore only necessary to test the primary.
1037 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
1038 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1039 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1040 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1041 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
1042 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
1043 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
1044 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
1045 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
1046 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
1047 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
1048 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX)
1049 AM_CONDITIONAL(VGCONF_OS_IS_FREEBSD,
1050 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1051 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD)
1052 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
1053 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1054 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1055 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
1056 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1057 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
1058 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN_OR_FREEBSD,
1059 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
1060 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
1061 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
1062 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
1065 # Sometimes, in the Makefile.am files, it's useful to know whether or not
1066 # there is a secondary target.
1067 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
1068 test x$VGCONF_PLATFORM_SEC_CAPS != x)
1070 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
1071 dnl fallback definition
1072 dnl The macro is courtesy of Dave Hart:
1073 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
1074 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
1075 if test -z "$$1_TRUE"; then :
1084 #----------------------------------------------------------------------------
1086 #----------------------------------------------------------------------------
1088 # Check if this should be built as an inner Valgrind, to be run within
1089 # another Valgrind. Choose the load address accordingly.
1090 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
1091 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
1092 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
1093 [AC_ARG_ENABLE(inner,
1094 [ --enable-inner enables self-hosting],
1095 [vg_cv_inner=$enableval],
1097 if test "$vg_cv_inner" = yes; then
1098 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
1099 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
1100 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
1102 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
1103 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
1106 #----------------------------------------------------------------------------
1107 # Undefined behaviour sanitiser
1108 #----------------------------------------------------------------------------
1109 # Check whether we should build with the undefined beahviour sanitiser.
1111 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
1112 [AC_ARG_ENABLE(ubsan,
1113 [ --enable-ubsan enables the undefined behaviour sanitiser],
1114 [vg_cv_ubsan=$enableval],
1117 #----------------------------------------------------------------------------
1118 # Extra fine-tuning of installation directories
1119 #----------------------------------------------------------------------------
1121 [ --with-tmpdir=PATH Specify path for temporary files],
1124 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
1125 AC_SUBST(VG_TMPDIR, [$tmpdir])
1127 #----------------------------------------------------------------------------
1129 #----------------------------------------------------------------------------
1130 AM_COND_IF([VGCONF_OS_IS_DARWIN],
1131 [AC_CHECK_PROG([XCRUN], [xcrun], [yes], [no])
1132 AC_MSG_CHECKING([for xcode sdk include path])
1133 AC_ARG_WITH(xcodedir,
1134 [ --with-xcode-path=PATH Specify path for xcode sdk includes],
1135 [xcodedir="$withval"],
1137 if test "x$XCRUN" != "xno" -a ! -d /usr/include; then
1138 xcrundir=`xcrun --sdk macosx --show-sdk-path`
1139 if test -z "$xcrundir"; then
1140 xcodedir="/usr/include"
1142 xcodedir="$xcrundir/usr/include"
1145 xcodedir="/usr/include"
1148 AC_MSG_RESULT([$xcodedir])
1149 AC_DEFINE_UNQUOTED(XCODE_DIR, "$xcodedir", [xcode sdk include directory])
1150 AC_SUBST(XCODE_DIR, [$xcodedir])])
1152 #----------------------------------------------------------------------------
1153 # Libc and suppressions
1154 #----------------------------------------------------------------------------
1155 # This variable will collect the suppression files to be used.
1156 AC_SUBST(DEFAULT_SUPP)
1158 AC_CHECK_HEADER([features.h])
1160 if test x$ac_cv_header_features_h = xyes; then
1161 rm -f conftest.$ac_ext
1162 cat <<_ACEOF >conftest.$ac_ext
1163 #include <features.h>
1164 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1165 glibc version is: __GLIBC__ __GLIBC_MINOR__
1168 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1171 # not really a version check
1172 AC_EGREP_CPP([DARWIN_LIBC], [
1173 #include <sys/cdefs.h>
1174 #if defined(__DARWIN_VERS_1050)
1178 GLIBC_VERSION="darwin")
1180 AC_EGREP_CPP([FREEBSD_LIBC], [
1181 #include <sys/cdefs.h>
1182 #if defined(__FreeBSD__)
1186 GLIBC_VERSION="freebsd")
1188 # not really a version check
1189 AC_EGREP_CPP([BIONIC_LIBC], [
1190 #if defined(__ANDROID__)
1194 GLIBC_VERSION="bionic")
1196 # there is only one version of libc on Solaris
1197 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1198 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1199 GLIBC_VERSION="solaris"
1202 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1204 if test x$GLIBC_VERSION = x; then
1205 if $CC -dumpmachine | grep -q musl; then
1210 # If this is glibc then figure out the generic (in file) libc.so and
1211 # libpthread.so file paths to use in suppressions. Before 2.34 libpthread
1212 # was a separate library, afterwards it was merged into libc.so and
1213 # the library is called libc.so.6 (before it was libc-2.[0-9]+.so).
1214 # Use this fact to set GLIBC_LIBC_PATH and GLIBC_LIBPTHREAD_PATH.
1215 case ${GLIBC_VERSION} in
1217 AC_MSG_CHECKING([whether pthread_create needs libpthread])
1218 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])],
1221 GLIBC_LIBC_PATH="*/lib*/libc.so.6"
1222 GLIBC_LIBPTHREAD_PATH="$GLIBC_LIBC_PATH"
1224 AC_MSG_RESULT([yes])
1225 GLIBC_LIBC_PATH="*/lib*/libc-2.*so*"
1226 GLIBC_LIBPTHREAD_PATH="*/lib*/libpthread-2.*so*"
1230 AC_MSG_CHECKING([not glibc...])
1231 AC_MSG_RESULT([${GLIBC_VERSION}])
1235 AC_MSG_CHECKING([the glibc version])
1237 case "${GLIBC_VERSION}" in
1239 AC_MSG_RESULT(${GLIBC_VERSION} family)
1240 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
1241 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1242 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1245 AC_MSG_RESULT(${GLIBC_VERSION} family)
1246 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1247 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1248 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1251 AC_MSG_RESULT(${GLIBC_VERSION} family)
1252 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1253 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1254 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1257 AC_MSG_RESULT(${GLIBC_VERSION} family)
1258 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1259 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1260 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1261 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1262 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1265 AC_MSG_RESULT(${GLIBC_VERSION} family)
1266 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1267 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1268 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1269 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1270 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1271 DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}"
1272 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1275 AC_MSG_RESULT(Darwin)
1276 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1277 # DEFAULT_SUPP set by kernel version check above.
1280 AC_MSG_RESULT(FreeBSD)
1281 AC_DEFINE([FREEBSD_LIBC], 1, [Define to 1 if you're using FreeBSD])
1282 # DEFAULT_SUPP set by kernel version check above.
1285 AC_MSG_RESULT(Bionic)
1286 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1287 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1290 AC_MSG_RESULT(Solaris)
1291 # DEFAULT_SUPP set in host_os switch-case above.
1292 # No other suppression file is used.
1296 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1297 DEFAULT_SUPP="musl.supp ${DEFAULT_SUPP}"
1300 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1301 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1302 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1306 AC_SUBST(GLIBC_VERSION)
1307 AC_SUBST(GLIBC_LIBC_PATH)
1308 AC_SUBST(GLIBC_LIBPTHREAD_PATH)
1311 if test "$VGCONF_OS" != "solaris"; then
1312 # Add default suppressions for the X client libraries. Make no
1313 # attempt to detect whether such libraries are installed on the
1314 # build machine (or even if any X facilities are present); just
1315 # add the suppressions antidisirregardless.
1316 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1317 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
1321 #----------------------------------------------------------------------------
1322 # Platform variants?
1323 #----------------------------------------------------------------------------
1325 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1326 # But there are times where we need a bit more control. The motivating
1327 # and currently only case is Android: this is almost identical to
1328 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1329 # platform variant tags, which get passed in the compile as
1330 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1332 # In almost all cases, the <variant> bit is "vanilla". But for Android
1333 # it is "android" instead.
1335 # Consequently (eg), plain arm-linux would build with
1337 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1339 # whilst an Android build would have
1341 # -DVGP_arm_linux -DVGPV_arm_linux_android
1343 # Same for x86. The setup of the platform variant is pushed relatively far
1344 # down this file in order that we can inspect any of the variables set above.
1346 # In the normal case ..
1347 VGCONF_PLATVARIANT="vanilla"
1350 if test "$GLIBC_VERSION" = "bionic";
1352 VGCONF_PLATVARIANT="android"
1355 AC_SUBST(VGCONF_PLATVARIANT)
1358 # FIXME: do we also want to define automake variables
1359 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1360 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1361 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1362 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1363 # that's what we'd need to do to use this, since what we'd want to write
1366 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1368 # Hmm. Can't think of a nice clean solution to this.
1370 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1371 test x$VGCONF_PLATVARIANT = xvanilla)
1372 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1373 test x$VGCONF_PLATVARIANT = xandroid)
1376 #----------------------------------------------------------------------------
1377 # Checking for various library functions and other definitions
1378 #----------------------------------------------------------------------------
1380 # Check for AT_FDCWD
1382 AC_MSG_CHECKING([for AT_FDCWD])
1383 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1390 ac_have_at_fdcwd=yes
1391 AC_MSG_RESULT([yes])
1397 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1399 # Check for stpncpy function definition in string.h
1400 # This explicitly checks with _GNU_SOURCE defined since that is also
1401 # used in the test case (some systems might define it without anyway
1402 # since stpncpy is part of The Open Group Base Specifications Issue 7
1403 # IEEE Std 1003.1-2008.
1404 AC_MSG_CHECKING([for stpncpy])
1405 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1412 char *r = stpncpy(d, s, n);
1414 ac_have_gnu_stpncpy=yes
1415 AC_MSG_RESULT([yes])
1417 ac_have_gnu_stpncpy=no
1421 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1423 # Check for PTRACE_GETREGS
1425 AC_MSG_CHECKING([for PTRACE_GETREGS])
1426 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1429 #include <sys/ptrace.h>
1430 #include <sys/user.h>
1433 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1435 AC_MSG_RESULT([yes])
1436 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1437 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1443 # Check for CLOCK_MONOTONIC
1445 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1447 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1451 clock_gettime(CLOCK_MONOTONIC, &t);
1454 AC_MSG_RESULT([yes])
1455 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1456 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1462 # Check for ELF32/64_CHDR
1464 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1467 # Check for PTHREAD_RWLOCK_T
1469 AC_MSG_CHECKING([for pthread_rwlock_t])
1471 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1473 #include <pthread.h>
1475 pthread_rwlock_t rwl;
1477 AC_MSG_RESULT([yes])
1478 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1479 [Define to 1 if you have the `pthread_rwlock_t' type.])
1485 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1487 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1489 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1491 #include <pthread.h>
1493 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1495 AC_MSG_RESULT([yes])
1496 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1497 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1503 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1505 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1509 #include <pthread.h>
1511 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1513 AC_MSG_RESULT([yes])
1514 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1515 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1521 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1523 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1525 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1527 #include <pthread.h>
1529 return (PTHREAD_MUTEX_RECURSIVE_NP);
1531 AC_MSG_RESULT([yes])
1532 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1533 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1539 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1541 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1543 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1545 #include <pthread.h>
1547 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1550 AC_MSG_RESULT([yes])
1551 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1552 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1558 # Check whether pthread_mutex_t has a member called __m_kind.
1560 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1561 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1563 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1566 [#include <pthread.h>])
1569 # Check whether pthread_mutex_t has a member called __data.__kind.
1571 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1572 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1574 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1577 [#include <pthread.h>])
1579 # Convenience function. Set flags based on the existing HWCAP entries.
1580 # The AT_HWCAP entries are generated by glibc, and are based on
1581 # functions supported by the hardware/system/libc.
1582 # Subsequent support for whether the capability will actually be utilized
1583 # will also be checked against the compiler capabilities.
1585 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1586 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1588 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1589 if env LD_SHOW_AUXV=1 true | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1591 AC_MSG_RESULT([yes])
1592 AC_SUBST([$2],[yes])
1599 # gather hardware capabilities. (hardware/kernel/libc)
1600 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1601 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1602 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1603 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1604 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1605 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1606 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1607 AC_HWCAP_CONTAINS_FLAG([arch_3_1],[HWCAP_HAS_ISA_3_1])
1608 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1609 AC_HWCAP_CONTAINS_FLAG([mma],[HWCAP_HAS_MMA])
1612 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1613 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1614 # compiler support for isa 2.07 level instructions
1615 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1616 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1618 __asm__ __volatile__("mtvsrd 1,2 ");
1620 ac_asm_have_isa_2_07=yes
1621 AC_MSG_RESULT([yes])
1623 ac_asm_have_isa_2_07=no
1626 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1627 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1629 # altivec (vsx) support.
1630 # does this compiler support -maltivec and does it have the include file
1632 AC_MSG_CHECKING([for Altivec support in the compiler ])
1634 CFLAGS="-maltivec -Werror"
1635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1636 #include <altivec.h>
1638 vector unsigned int v;
1641 AC_MSG_RESULT([yes])
1647 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1648 -a x$HWCAP_HAS_ALTIVEC = xyes])
1650 # Check that both: the compiler supports -mvsx and that the assembler
1651 # understands VSX instructions. If either of those doesn't work,
1652 # conclude that we can't do VSX.
1653 AC_MSG_CHECKING([for VSX compiler flag support])
1655 CFLAGS="-mvsx -Werror"
1656 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1659 ac_compiler_supports_vsx_flag=yes
1660 AC_MSG_RESULT([yes])
1662 ac_compiler_supports_vsx_flag=no
1667 AC_MSG_CHECKING([for VSX support in the assembler ])
1669 CFLAGS="-mvsx -Werror"
1670 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1671 #include <altivec.h>
1673 vector unsigned int v;
1674 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1676 ac_compiler_supports_vsx=yes
1677 AC_MSG_RESULT([yes])
1679 ac_compiler_supports_vsx=no
1683 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1684 -a x$ac_compiler_supports_vsx = xyes \
1685 -a x$HWCAP_HAS_VSX = xyes ])
1687 # DFP (Decimal Float)
1688 # The initial DFP support was added in Power 6. The dcffix instruction
1689 # support was added in Power 7.
1690 AC_MSG_CHECKING([that assembler knows DFP])
1691 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1694 __asm__ __volatile__("adtr 1, 2, 3")
1696 __asm__ __volatile__(".machine power7;\n" \
1702 AC_MSG_RESULT([yes])
1707 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1709 CFLAGS="-mhard-dfp -Werror"
1711 # The dcffix instruction is Power 7
1712 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1715 __asm__ __volatile__("adtr 1, 2, 3")
1717 __asm__ __volatile__(".machine power7;\n" \
1722 ac_compiler_have_dfp=yes
1723 AC_MSG_RESULT([yes])
1725 ac_compiler_have_dfp=no
1729 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1730 -a x$ac_compiler_have_dfp = xyes \
1731 -a x$HWCAP_HAS_DFP = xyes )
1733 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1734 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1736 _Decimal64 x = 0.0DD;
1738 ac_compiler_have_dfp_type=yes
1739 AC_MSG_RESULT([yes])
1741 ac_compiler_have_dfp_type=no
1744 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1745 -a x$HWCAP_HAS_DFP = xyes )
1748 # HTM (Hardware Transactional Memory)
1749 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1751 CFLAGS="-mhtm -Werror"
1752 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1756 AC_MSG_RESULT([yes])
1757 ac_compiler_supports_htm=yes
1760 ac_compiler_supports_htm=no
1764 AC_MSG_CHECKING([if compiler can find the htm builtins])
1766 CFLAGS="-mhtm -Werror"
1767 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1769 if (__builtin_tbegin (0))
1772 AC_MSG_RESULT([yes])
1773 ac_compiler_sees_htm_builtins=yes
1776 ac_compiler_sees_htm_builtins=no
1780 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1781 -a x$ac_compiler_sees_htm_builtins = xyes \
1782 -a x$HWCAP_HAS_HTM = xyes )
1784 # isa 3.0 checking. (actually 3.0 or newer)
1785 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1787 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1789 __asm__ __volatile__ (".machine power9;\n" \
1792 # guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste,
1795 CFLAGS="-DHAS_ISA_3_00"
1796 ac_asm_have_isa_3_00=yes
1797 AC_MSG_RESULT([yes])
1799 ac_asm_have_isa_3_00=no
1805 AC_MSG_CHECKING([that assembler knows xscvhpdp ])
1807 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1809 __asm__ __volatile__ (".machine power9;\n" \
1810 "xscvhpdp 1,2;\n" );
1812 ac_asm_have_xscvhpdp=yes
1813 AC_MSG_RESULT([yes])
1815 ac_asm_have_xscvhpdp=no
1819 # darn instruction checking
1820 AC_MSG_CHECKING([that assembler knows darn instruction ])
1822 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1824 __asm__ __volatile__(".machine power9; darn 1,0 ");
1826 ac_asm_have_darn_inst=yes
1827 AC_MSG_RESULT([yes])
1829 ac_asm_have_darn_inst=no
1834 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
1835 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1837 __asm__ __volatile__ (".machine power10;\n" \
1840 ac_asm_have_isa_3_1=yes
1841 AC_MSG_RESULT([yes])
1843 ac_asm_have_isa_3_1=no
1848 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
1849 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1851 AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes])
1852 AM_CONDITIONAL(HAS_DARN, [test x$ac_asm_have_darn_inst = xyes])
1854 AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \
1855 -a x$HWCAP_HAS_ISA_3_1 = xyes])
1857 # Check for pthread_create@GLIBC2.0
1858 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1861 CFLAGS="-lpthread -Werror"
1862 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1863 extern int pthread_create_glibc_2_0(void*, const void*,
1864 void *(*)(void*), void*);
1865 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1869 * Apparently on PowerPC linking this program succeeds and generates an
1870 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1872 #error This test does not work properly on PowerPC.
1874 pthread_create_glibc_2_0(0, 0, 0, 0);
1878 ac_have_pthread_create_glibc_2_0=yes
1879 AC_MSG_RESULT([yes])
1880 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1881 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1883 ac_have_pthread_create_glibc_2_0=no
1888 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1889 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1892 # Check for dlinfo RTLD_DI_TLS_MODID
1893 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1897 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1904 size_t sizes[10000];
1905 size_t modid_offset;
1906 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1909 ac_have_dlinfo_rtld_di_tls_modid=yes
1910 AC_MSG_RESULT([yes])
1911 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1912 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1914 ac_have_dlinfo_rtld_di_tls_modid=no
1919 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1920 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1923 # Check for eventfd_t, eventfd() and eventfd_read()
1924 AC_MSG_CHECKING([for eventfd()])
1926 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1927 #include <sys/eventfd.h>
1933 eventfd_read(fd, &ev);
1936 AC_MSG_RESULT([yes])
1937 AC_DEFINE([HAVE_EVENTFD], 1,
1938 [Define to 1 if you have the `eventfd' function.])
1939 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1940 [Define to 1 if you have the `eventfd_read' function.])
1945 # Check whether compiler can process #include <thread> without errors
1946 # clang 3.3 cannot process <thread> from e.g.
1947 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1949 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1951 safe_CXXFLAGS=$CXXFLAGS
1954 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1958 ac_cxx_can_include_thread_header=yes
1959 AC_MSG_RESULT([yes])
1961 ac_cxx_can_include_thread_header=no
1964 CXXFLAGS=$safe_CXXFLAGS
1967 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1970 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1971 # of the user_regs_struct from sys/user.h. They are structurally the same
1972 # but we get either one or the other.
1974 AC_CHECK_TYPE([struct user_regs_struct],
1975 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1976 [[#include <sys/ptrace.h>]
1977 [#include <sys/time.h>]
1978 [#include <sys/user.h>]])
1979 if test "$sys_user_has_user_regs" = "yes"; then
1980 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1981 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1984 AC_MSG_CHECKING([for __NR_membarrier])
1985 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1986 #include <linux/unistd.h>
1988 return __NR_membarrier
1990 ac_have_nr_membarrier=yes
1991 AC_MSG_RESULT([yes])
1993 ac_have_nr_membarrier=no
1997 AM_CONDITIONAL(HAVE_NR_MEMBARRIER, [test x$ac_have_nr_membarrier = xyes])
1999 #----------------------------------------------------------------------------
2000 # Checking for supported compiler flags.
2001 #----------------------------------------------------------------------------
2003 case "${host_cpu}" in
2005 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2006 if test -z "$ARCH"; then
2007 # does this compiler support -march=mips32 (mips32 default) ?
2008 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
2011 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
2013 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2016 FLAG_M32="-mips32 -mabi=32"
2017 AC_MSG_RESULT([yes])
2027 # does this compiler support -march=mips64r2 (mips64r2 default) ?
2028 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
2031 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
2033 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2036 FLAG_M64="-march=mips64r2 -mabi=64"
2037 AC_MSG_RESULT([yes])
2050 # does this compiler support -m32 ?
2051 AC_MSG_CHECKING([if gcc accepts -m32])
2054 CFLAGS="${FLAG_32ON64} -m32 -Werror"
2056 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2059 FLAG_M32="${FLAG_32ON64} -m32"
2060 AC_MSG_RESULT([yes])
2070 # does this compiler support -m64 ?
2071 AC_MSG_CHECKING([if gcc accepts -m64])
2074 CFLAGS="-m64 -Werror"
2076 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2080 AC_MSG_RESULT([yes])
2092 ARCH=$(echo "$CFLAGS" | grep -E -e '-march=@<:@^ @:>@+' -e '\B-mips@<:@^ +@:>@')
2093 if test -z "$ARCH"; then
2094 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
2095 AC_MSG_CHECKING([if gcc accepts -march=octeon])
2098 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
2100 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2103 FLAG_OCTEON="-march=octeon"
2104 AC_MSG_RESULT([yes])
2111 AC_SUBST(FLAG_OCTEON)
2114 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
2115 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
2118 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
2120 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2123 FLAG_OCTEON2="-march=octeon2"
2124 AC_MSG_RESULT([yes])
2131 AC_SUBST(FLAG_OCTEON2)
2135 # does this compiler support -mmsa (MIPS MSA ASE) ?
2136 AC_MSG_CHECKING([if gcc accepts -mmsa])
2139 CFLAGS="$CFLAGS -mmsa -Werror"
2141 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2145 AC_MSG_RESULT([yes])
2154 # Are we compiling for the MIPS64 n32 ABI?
2155 AC_MSG_CHECKING([if gcc is producing mips n32 binaries])
2156 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2157 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABIN32))
2162 FLAG_M64="-march=mips64r2 -mabi=n32"
2163 AC_MSG_RESULT([yes])
2168 # Are we compiling for the MIPS64 n64 ABI?
2169 AC_MSG_CHECKING([if gcc is producing mips n64 binaries])
2170 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2171 #if !defined(_MIPS_SIM) || (defined(_MIPS_SIM) && (_MIPS_SIM != _ABI64))
2176 AC_MSG_RESULT([yes])
2181 # We enter the code block below in the following case:
2182 # Target architecture is set to mips64, the desired abi
2183 # was not specified and the compiler's default abi setting
2184 # is neither n32 nor n64.
2185 # Probe for and set the abi to either n64 or n32, in that order,
2186 # which is required for a mips64 build of valgrind.
2187 if test "$ARCH_MAX" = "mips64" -a "x$VGCONF_ABI" = "x"; then
2189 CFLAGS="$CFLAGS -mabi=64 -Werror"
2190 AC_MSG_CHECKING([if gcc is n64 capable])
2191 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2195 AC_MSG_RESULT([yes])
2201 if test "x$VGCONF_ABI" = "x"; then
2203 CFLAGS="$CFLAGS -mabi=n32 -Werror"
2204 AC_MSG_CHECKING([if gcc is n32 capable])
2205 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2209 FLAG_M64="-march=mips64r2 -mabi=n32"
2210 AC_MSG_RESULT([yes])
2218 AM_CONDITIONAL([VGCONF_HAVE_ABI],
2219 [test x$VGCONF_ABI != x])
2220 AC_SUBST(VGCONF_ABI)
2223 # does this compiler support -mmmx ?
2224 AC_MSG_CHECKING([if gcc accepts -mmmx])
2227 CFLAGS="-mmmx -Werror"
2229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2233 AC_MSG_RESULT([yes])
2243 # does this compiler support -msse ?
2244 AC_MSG_CHECKING([if gcc accepts -msse])
2247 CFLAGS="-msse -Werror"
2249 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2253 AC_MSG_RESULT([yes])
2263 # does this compiler support -mpreferred-stack-boundary=2 when
2264 # generating code for a 32-bit target? Note that we only care about
2265 # this when generating code for (32-bit) x86, so if the compiler
2266 # doesn't recognise -m32 it's no big deal. We'll just get code for
2267 # the Memcheck and other helper functions, that is a bit slower than
2268 # it could be, on x86; and no difference at all on any other platform.
2269 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
2272 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
2274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2277 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
2278 AC_MSG_RESULT([yes])
2280 PREFERRED_STACK_BOUNDARY_2=""
2285 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
2288 # does this compiler support -mlong-double-128 ?
2289 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
2291 CFLAGS="-mlong-double-128 -Werror"
2292 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2295 ac_compiler_supports_mlong_double_128=yes
2296 AC_MSG_RESULT([yes])
2298 ac_compiler_supports_mlong_double_128=no
2302 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
2303 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
2304 AC_SUBST(FLAG_MLONG_DOUBLE_128)
2306 # does this toolchain support lto ?
2307 # Not checked for if --enable-lto=no was given, or if LTO_AR or LTO_RANLIG
2309 # If not enable-lto=* arg is provided, default to no, as lto builds are
2310 # a lot slower, and so not appropriate for Valgrind developments.
2311 # --enable-lto=yes should be used by distro packagers.
2312 AC_CACHE_CHECK([for using the link time optimisation], vg_cv_lto,
2314 [ --enable-lto enables building with link time optimisation],
2315 [vg_cv_lto=$enableval],
2318 if test "x${vg_cv_lto}" != "xno" -a "x${LTO_AR}" != "x" -a "x${LTO_RANLIB}" != "x"; then
2319 AC_MSG_CHECKING([if toolchain accepts lto])
2321 TEST_LTO_CFLAGS="-flto -flto-partition=one -fuse-linker-plugin"
2322 # Note : using 'one' partition is giving a slightly smaller/faster memcheck
2323 # and ld/lto-trans1 still needs a reasonable memory (about 0.5GB) when linking.
2324 CFLAGS="$TEST_LTO_CFLAGS -Werror"
2326 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2327 extern void somefun(void);
2331 LTO_CFLAGS=$TEST_LTO_CFLAGS
2332 AC_MSG_RESULT([yes])
2340 AC_SUBST(LTO_CFLAGS)
2342 # if we could not compile with lto args, or lto was disabled,
2343 # then set LTO_AR/LTO_RANLIB to the non lto values
2344 # define in config.h ENABLE_LTO (not needed by the code currently, but
2345 # this guarantees we recompile everything if we re-configure and rebuild
2346 # in a build dir previously build with another value of --enable-lto
2347 if test "x${LTO_CFLAGS}" = "x"; then
2349 LTO_RANLIB=${RANLIB}
2353 AC_DEFINE([ENABLE_LTO], 1, [configured to build with lto link time optimisation])
2356 # Convenience function to check whether GCC supports a particular
2357 # warning option. Takes two arguments,
2358 # first the warning flag name to check (without -W), then the
2359 # substitution name to set with -Wno-warning-flag if the flag exists,
2360 # or the empty string if the compiler doesn't accept the flag. Note
2361 # that checking is done against the warning flag itself, but the
2362 # substitution is then done to cancel the warning flag.
2363 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
2364 AC_MSG_CHECKING([if gcc accepts -W$1])
2366 CFLAGS="-W$1 -Werror"
2367 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2368 AC_SUBST([$2], [-Wno-$1])
2369 AC_MSG_RESULT([yes])], [
2371 AC_MSG_RESULT([no])])
2375 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
2376 # -W$1 (instead of -Wno-$1).
2377 AC_DEFUN([AC_GCC_WARNING_SUBST],[
2378 AC_MSG_CHECKING([if gcc accepts -W$1])
2380 CFLAGS="-W$1 -Werror"
2381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2382 AC_SUBST([$2], [-W$1])
2383 AC_MSG_RESULT([yes])], [
2385 AC_MSG_RESULT([no])])
2389 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
2390 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
2391 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
2392 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
2393 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
2394 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
2395 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
2396 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
2397 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
2398 AC_GCC_WARNING_SUBST_NO([expansion-to-defined], [FLAG_W_NO_EXPANSION_TO_DEFINED])
2400 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
2401 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
2402 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
2403 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
2404 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
2405 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2406 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2407 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2408 AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
2409 AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
2410 AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
2412 # Does this compiler support -Wformat-security ?
2413 # Special handling is needed, because certain GCC versions require -Wformat
2414 # being present if -Wformat-security is given. Otherwise a warning is issued.
2415 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2416 # And with that the warning will be turned into an error with the result
2417 # that -Wformat-security is believed to be unsupported when in fact it is.
2418 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2420 CFLAGS="-Wformat -Wformat-security -Werror"
2421 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2422 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2423 AC_MSG_RESULT([yes])], [
2424 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2425 AC_MSG_RESULT([no])])
2428 # does this compiler support -Wextra or the older -W ?
2430 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2433 CFLAGS="-Wextra -Werror"
2435 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2438 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2439 AC_MSG_RESULT([-Wextra])
2442 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2445 AC_SUBST([FLAG_W_EXTRA], [-W])
2448 AC_SUBST([FLAG_W_EXTRA], [])
2449 AC_MSG_RESULT([not supported])
2454 # On ARM we do not want to pass -Wcast-align as that produces loads
2455 # of warnings. GCC is just being conservative. See here:
2456 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2457 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2458 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2460 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2463 # does this compiler support -faligned-new ?
2464 AC_MSG_CHECKING([if g++ accepts -faligned-new])
2466 safe_CXXFLAGS=$CXXFLAGS
2467 CXXFLAGS="-faligned-new -Werror"
2470 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2473 FLAG_FALIGNED_NEW="-faligned-new"
2474 AC_MSG_RESULT([yes])
2476 FLAG_FALIGNED_NEW=""
2479 CXXFLAGS=$safe_CXXFLAGS
2482 AC_SUBST(FLAG_FALIGNED_NEW)
2484 # does this compiler support -fsized-deallocation ?
2485 AC_MSG_CHECKING([if g++ accepts -fsized-deallocation])
2487 safe_CXXFLAGS=$CXXFLAGS
2488 CXXFLAGS="-fsized-deallocation -Werror"
2491 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2494 FLAG_FSIZED_DEALLOCATION="-fsized-deallocation"
2495 ac_have_sized_deallocation=yes
2496 AC_MSG_RESULT([yes])
2498 FLAG_FSIZED_DEALLOCATION=""
2499 ac_have_sized_deallocation=no
2502 CXXFLAGS=$safe_CXXFLAGS
2505 AC_SUBST(FLAG_FSIZED_DEALLOCATION)
2506 AM_CONDITIONAL([HAVE_FSIZED_DEALLOCATION], [test x$ac_have_sized_deallocation = xyes])
2508 # does this compiler support C++17 aligned new/delete?
2509 AC_MSG_CHECKING([if g++ supports aligned new and delete])
2511 safe_CXXFLAGS=$CXXFLAGS
2512 CXXFLAGS="-std=c++17"
2515 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2519 operator delete(nullptr, std::align_val_t(64U));
2521 ac_have_aligned_cxx_alloc=yes
2522 AC_MSG_RESULT([yes])
2524 ac_have_aligned_cxx_alloc=no
2527 CXXFLAGS=$safe_CXXFLAGS
2530 AM_CONDITIONAL([HAVE_ALIGNED_CXX_ALLOC], [test x$ac_have_aligned_cxx_alloc = xyes])
2532 # does this compiler support -fno-stack-protector ?
2533 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2536 CFLAGS="-fno-stack-protector -Werror"
2538 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2541 no_stack_protector=yes
2542 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2543 AC_MSG_RESULT([yes])
2545 no_stack_protector=no
2546 FLAG_FNO_STACK_PROTECTOR=""
2551 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2553 # does this compiler support -finline-functions ?
2554 AC_MSG_CHECKING([if gcc accepts -finline-functions])
2557 CFLAGS="-finline-functions -Werror"
2559 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2562 inline_functions=yes
2563 FLAG_FINLINE_FUNCTIONS="-finline-functions"
2564 AC_MSG_RESULT([yes])
2567 FLAG_FINLINE_FUNCTIONS=""
2572 AC_SUBST(FLAG_FINLINE_FUNCTIONS)
2574 # Does GCC support disabling Identical Code Folding?
2575 # We want to disabled Identical Code Folding for the
2576 # tools preload shared objects to get better backraces.
2577 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2578 # "The optimization reduces code size and may disturb
2579 # unwind stacks by replacing a function by equivalent
2580 # one with a different name."
2581 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2584 CFLAGS="-fno-ipa-icf -Werror"
2586 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2590 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2591 AC_MSG_RESULT([yes])
2599 AC_SUBST(FLAG_FNO_IPA_ICF)
2602 # Does this compiler support -fsanitize=undefined. This is true for
2603 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2604 # also checks for alignment violations on memory accesses which the valgrind
2605 # code base is sprinkled (if not littered) with. As those alignment issues
2606 # don't pose a problem we want to suppress warnings about them.
2607 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2608 # GCCs do not support that.
2610 # Only checked for if --enable-ubsan was given.
2611 if test "x${vg_cv_ubsan}" = "xyes"; then
2612 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2614 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2615 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2618 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2619 LIB_UBSAN="-static-libubsan"
2620 AC_MSG_RESULT([yes])
2622 CFLAGS="-fsanitize=undefined -Werror"
2623 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2626 FLAG_FSANITIZE="-fsanitize=undefined"
2627 LIB_UBSAN="-static-libubsan"
2628 AC_MSG_RESULT([yes])
2636 AC_SUBST(FLAG_FSANITIZE)
2639 # does this compiler support --param inline-unit-growth=... ?
2641 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2644 CFLAGS="--param inline-unit-growth=900 -Werror"
2646 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2649 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2650 ["--param inline-unit-growth=900"])
2651 AC_MSG_RESULT([yes])
2653 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2659 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2661 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2664 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2666 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2670 AC_MSG_RESULT([yes])
2675 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2679 # does this compiler support -g -gz=zlib ?
2681 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2684 CFLAGS="-g -gz=zlib"
2686 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2690 AC_MSG_RESULT([yes])
2695 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2699 # does this compiler support -g -gz=zlib-gnu ?
2701 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2704 CFLAGS="-g -gz=zlib-gnu"
2706 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2709 ac_have_gz_zlib_gnu=yes
2710 AC_MSG_RESULT([yes])
2712 ac_have_gz_zlib_gnu=no
2715 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2719 # does this compiler support nested functions ?
2721 AC_MSG_CHECKING([if gcc accepts nested functions])
2723 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2724 int foo() { return 1; }
2727 ac_have_nested_functions=yes
2728 AC_MSG_RESULT([yes])
2730 ac_have_nested_functions=no
2733 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2736 # does this compiler support the 'p' constraint in ASM statements ?
2738 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2740 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2742 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2744 ac_have_asm_constraint_p=yes
2745 AC_MSG_RESULT([yes])
2747 ac_have_asm_constraint_p=no
2750 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2753 # Does this compiler and linker support -pie?
2754 # Some compilers actually do not support -pie and report its usage
2755 # as an error. We need to check if it is safe to use it first.
2757 AC_MSG_CHECKING([if gcc accepts -pie])
2762 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2765 AC_SUBST([FLAG_PIE], ["-pie"])
2766 AC_MSG_RESULT([yes])
2768 AC_SUBST([FLAG_PIE], [""])
2774 # Does this compiler support -no-pie?
2775 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2776 # default. However this gets in the way with some tests, we use -no-pie
2779 AC_MSG_CHECKING([if gcc accepts -no-pie])
2782 CFLAGS="-no-pie -Werror"
2784 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2787 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
2788 AC_MSG_RESULT([yes])
2790 AC_SUBST([FLAG_NO_PIE], [""])
2796 # We want to use use the -Ttext-segment option to the linker.
2797 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
2798 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2799 # semantics are NOT what we want (GNU gold -Ttext is fine).
2801 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2802 # will reside. -Ttext aligns just the .text section start (but not any
2805 # LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes"
2806 # in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html
2807 # The --image-base option (since version 6.0?) provides the semantics needed.
2808 # -Ttext-segment generates an error, but -Ttext now more closely
2809 # follows the GNU (bfd) ld's -Ttext.
2811 # So test first for --image-base support, and if that fails then
2812 # for -Ttext-segment which is supported by all bfd ld versions
2813 # and use that if it exists. If it doesn't exist it must be an older
2814 # version of gold and we can fall back to using -Ttext which has the
2818 AC_MSG_CHECKING([if the linker accepts -Wl,--image-base])
2820 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror"
2823 [AC_LANG_SOURCE([int _start () { return 0; }])],
2825 linker_using_t_text="no"
2826 AC_SUBST([FLAG_T_TEXT], ["--image-base"])
2827 AC_MSG_RESULT([yes])
2831 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
2833 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
2836 [AC_LANG_SOURCE([int _start () { return 0; }])],
2838 linker_using_t_text="no"
2839 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
2840 AC_MSG_RESULT([yes])
2842 linker_using_t_text="yes"
2843 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
2850 # If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will
2851 # have to strip any build-id ELF NOTEs from the statically linked tools.
2852 # Otherwise the build-id NOTE might end up at the default load address.
2853 # (Pedantically if the linker is gold then -Ttext is fine, but newer
2854 # gold versions also support -Ttext-segment. So just assume that unless
2855 # we can use -Ttext-segment we need to strip the build-id NOTEs.
2856 if test "x${linker_using_t_text}" = "xyes"; then
2857 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
2858 # does the linker support -Wl,--build-id=none ? Note, it's
2859 # important that we test indirectly via whichever C compiler
2860 # is selected, rather than testing /usr/bin/ld or whatever
2862 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
2864 CFLAGS="-Wl,--build-id=none -Werror"
2867 [AC_LANG_PROGRAM([ ], [return 0;])],
2869 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
2870 AC_MSG_RESULT([yes])
2872 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2876 AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.])
2877 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2881 # does the ppc assembler support "mtocrf" et al?
2882 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
2884 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2885 __asm__ __volatile__("mtocrf 4,0");
2886 __asm__ __volatile__("mfocrf 0,4");
2888 ac_have_as_ppc_mftocrf=yes
2889 AC_MSG_RESULT([yes])
2891 ac_have_as_ppc_mftocrf=no
2894 if test x$ac_have_as_ppc_mftocrf = xyes ; then
2895 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2899 # does the ppc assembler support "lfdp" and other phased out floating point insns?
2900 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2902 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2903 do { typedef struct {
2907 dbl_pair_t dbl_pair[3];
2908 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2911 ac_have_as_ppc_fpPO=yes
2912 AC_MSG_RESULT([yes])
2914 ac_have_as_ppc_fpPO=no
2917 if test x$ac_have_as_ppc_fpPO = xyes ; then
2918 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2922 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
2923 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
2925 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2927 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
2928 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
2930 ac_have_as_amd64_fxsave64=yes
2931 AC_MSG_RESULT([yes])
2933 ac_have_as_amd64_fxsave64=no
2936 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
2937 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
2940 # does the x86/amd64 assembler understand SSE3 instructions?
2941 # Note, this doesn't generate a C-level symbol. It generates a
2942 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
2943 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2945 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2946 do { long long int x;
2947 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2951 AC_MSG_RESULT([yes])
2957 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
2960 # Ditto for SSSE3 instructions (note extra S)
2961 # Note, this doesn't generate a C-level symbol. It generates a
2962 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2963 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2965 save_CFLAGS="$CFLAGS"
2966 CFLAGS="$CFLAGS -msse -Werror"
2967 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2968 do { long long int x;
2969 __asm__ __volatile__(
2970 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2973 ac_have_as_ssse3=yes
2974 AC_MSG_RESULT([yes])
2979 CFLAGS="$save_CFLAGS"
2981 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2984 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2985 # Note, this doesn't generate a C-level symbol. It generates a
2986 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
2987 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
2988 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2990 __asm__ __volatile__(
2991 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2994 ac_have_as_pclmulqdq=yes
2995 AC_MSG_RESULT([yes])
2997 ac_have_as_pclmulqdq=no
3001 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
3004 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
3005 # Note, this doesn't generate a C-level symbol. It generates a
3006 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
3007 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
3008 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3011 * Carry-less multiplication of xmm1 with xmm2 and store the result in
3012 * xmm3. The immediate is used to determine which quadwords of xmm1 and
3013 * xmm2 should be used.
3015 __asm__ __volatile__(
3016 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
3019 ac_have_as_vpclmulqdq=yes
3020 AC_MSG_RESULT([yes])
3022 ac_have_as_vpclmulqdq=no
3026 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
3029 # does the x86/amd64 assembler understand FMA4 instructions?
3030 # Note, this doesn't generate a C-level symbol. It generates a
3031 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
3032 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
3033 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3035 __asm__ __volatile__(
3036 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
3039 ac_have_as_vfmaddpd=yes
3040 AC_MSG_RESULT([yes])
3042 ac_have_as_vfmaddpd=no
3046 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
3049 # does the x86/amd64 assembler understand the LZCNT instruction?
3050 # Note, this doesn't generate a C-level symbol. It generates a
3051 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
3052 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
3054 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3056 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
3059 ac_have_as_lzcnt=yes
3060 AC_MSG_RESULT([yes])
3066 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
3069 # does the x86/amd64 assembler understand the LOOPNEL instruction?
3070 # Note, this doesn't generate a C-level symbol. It generates a
3071 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
3072 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
3074 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3076 __asm__ __volatile__("1: loopnel 1b\n");
3079 ac_have_as_loopnel=yes
3080 AC_MSG_RESULT([yes])
3082 ac_have_as_loopnel=no
3086 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
3089 # does the x86/amd64 assembler understand ADDR32 ?
3090 # Note, this doesn't generate a C-level symbol. It generates a
3091 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
3092 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
3094 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3096 asm volatile ("addr32 rep movsb");
3099 ac_have_as_addr32=yes
3100 AC_MSG_RESULT([yes])
3102 ac_have_as_addr32=no
3106 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
3109 # does the x86/amd64 assembler understand SSE 4.2 instructions?
3110 # Note, this doesn't generate a C-level symbol. It generates a
3111 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
3112 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
3114 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3115 do { long long int x;
3116 __asm__ __volatile__(
3117 "crc32q %%r15,%%r15" : : : "r15" );
3118 __asm__ __volatile__(
3119 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
3120 __asm__ __volatile__(
3121 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
3124 ac_have_as_sse42=yes
3125 AC_MSG_RESULT([yes])
3131 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
3134 # does the x86/amd64 assembler understand AVX instructions?
3135 # Note, this doesn't generate a C-level symbol. It generates a
3136 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
3137 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
3139 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3140 do { long long int x;
3141 __asm__ __volatile__(
3142 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
3143 __asm__ __volatile__(
3144 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3148 AC_MSG_RESULT([yes])
3154 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
3157 # does the x86/amd64 assembler understand AVX2 instructions?
3158 # Note, this doesn't generate a C-level symbol. It generates a
3159 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
3160 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
3162 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3163 do { long long int x;
3164 __asm__ __volatile__(
3165 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3166 __asm__ __volatile__(
3167 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
3171 AC_MSG_RESULT([yes])
3177 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
3180 # does the x86/amd64 assembler understand TSX instructions and
3181 # the XACQUIRE/XRELEASE prefixes?
3182 # Note, this doesn't generate a C-level symbol. It generates a
3183 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
3184 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
3186 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3188 __asm__ __volatile__(
3191 " xacquire lock incq 0(%rsp) \n\t"
3192 " xrelease lock incq 0(%rsp) \n"
3197 AC_MSG_RESULT([yes])
3203 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
3206 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
3207 # Note, this doesn't generate a C-level symbol. It generates a
3208 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
3209 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
3211 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3212 do { unsigned int h, l;
3213 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
3214 __asm__ __volatile__(
3215 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
3216 __asm__ __volatile__(
3217 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
3221 AC_MSG_RESULT([yes])
3227 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
3230 # does the x86/amd64 assembler understand FMA instructions?
3231 # Note, this doesn't generate a C-level symbol. It generates a
3232 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
3233 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
3235 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3236 do { unsigned int h, l;
3237 __asm__ __volatile__(
3238 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
3239 __asm__ __volatile__(
3240 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
3241 __asm__ __volatile__(
3242 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
3246 AC_MSG_RESULT([yes])
3252 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
3255 # does the amd64 assembler understand MPX instructions?
3256 # Note, this doesn't generate a C-level symbol. It generates a
3257 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
3258 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
3260 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3262 asm ("bndmov %bnd0,(%rsp)");
3263 asm ("bndldx 3(%rbx,%rdx), %bnd2");
3264 asm ("bnd call foo\n"
3271 AC_MSG_RESULT([yes])
3277 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
3280 # does the amd64 assembler understand ADX instructions?
3281 # Note, this doesn't generate a C-level symbol. It generates a
3282 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
3283 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
3285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3287 asm ("adcxq %r14,%r8");
3291 AC_MSG_RESULT([yes])
3297 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
3300 # does the amd64 assembler understand the RDRAND instruction?
3301 # Note, this doesn't generate a C-level symbol. It generates a
3302 # automake-level symbol (BUILD_RDRAND_TESTS), used in test Makefile.am's
3303 AC_MSG_CHECKING([if amd64 assembler knows the RDRAND instruction])
3305 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3307 asm ("rdrand %r14");
3308 asm ("rdrand %r14d");
3309 asm ("rdrand %r14w");
3312 ac_have_as_rdrand=yes
3313 AC_MSG_RESULT([yes])
3315 ac_have_as_rdrand=no
3319 AM_CONDITIONAL(BUILD_RDRAND_TESTS, test x$ac_have_as_rdrand = xyes)
3321 # does the amd64 assembler understand the RDSEED instruction?
3322 # Note, this doesn't generate a C-level symbol. It generates a
3323 # automake-level symbol (BUILD_RDSEED_TESTS), used in test Makefile.am's
3324 AC_MSG_CHECKING([if amd64 assembler knows the RDSEED instruction])
3326 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3328 asm ("rdseed %r14");
3329 asm ("rdseed %r14d");
3330 asm ("rdseed %r14w");
3333 ac_have_as_rdseed=yes
3334 AC_MSG_RESULT([yes])
3336 ac_have_as_rdseed=no
3340 AM_CONDITIONAL(BUILD_RDSEED_TESTS, test x$ac_have_as_rdseed = xyes)
3342 # does the amd64 assembler understand the F16C instructions (VCVTPH2PS and
3344 # Note, this doesn't generate a C-level symbol. It generates a
3345 # automake-level symbol (BUILD_F16C_TESTS), used in test Makefile.am's
3346 AC_MSG_CHECKING([if amd64 assembler knows the F16C instructions])
3348 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3350 asm ("vcvtph2ps %xmm5, %ymm10");
3351 // If we put the dollar sign and zero together, the shell processing
3352 // this configure.ac script substitutes the command name in. Sigh.
3353 asm ("vcvtps2ph $" "0, %ymm10, %xmm5");
3357 AC_MSG_RESULT([yes])
3363 AM_CONDITIONAL(BUILD_F16C_TESTS, test x$ac_have_as_f16c = xyes)
3366 # does the x86/amd64 assembler understand MOVBE?
3367 # Note, this doesn't generate a C-level symbol. It generates a
3368 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
3369 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
3371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3372 do { long long int x;
3373 __asm__ __volatile__(
3374 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
3377 ac_have_as_movbe=yes
3378 AC_MSG_RESULT([yes])
3384 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
3387 # Does the C compiler support the "ifunc" attribute
3388 # Note, this doesn't generate a C-level symbol. It generates a
3389 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
3390 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
3392 AC_LINK_IFELSE([AC_LANG_SOURCE([[
3393 static void mytest(void) {}
3395 static void (*resolve_test(void))(void)
3397 return (void (*)(void))&mytest;
3400 void test(void) __attribute__((ifunc("resolve_test")));
3408 ac_have_ifunc_attr=yes
3409 AC_MSG_RESULT([yes])
3411 ac_have_ifunc_attr=no
3415 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
3417 # Does the C compiler support the armv8 crc feature flag
3418 # Note, this doesn't generate a C-level symbol. It generates a
3419 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
3420 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
3422 save_CFLAGS="$CFLAGS"
3423 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
3424 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3430 ac_have_armv8_crc_feature=yes
3431 AC_MSG_RESULT([yes])
3433 ac_have_armv8_crc_feature=no
3436 CFLAGS="$save_CFLAGS"
3438 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
3441 # Does the C compiler support the armv81 flag and the assembler v8.1 instructions
3442 # Note, this doesn't generate a C-level symbol. It generates a
3443 # automake-level symbol (BUILD_ARMV81_TESTS), used in test Makefile.am's
3444 AC_MSG_CHECKING([if gcc supports the armv81 feature flag and assembler supports v8.1 instructions])
3446 save_CFLAGS="$CFLAGS"
3447 CFLAGS="$CFLAGS -march=armv8.1-a -Werror"
3448 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3451 __asm__ __volatile__("ldadd x0, x1, [x2]" ::: "memory");
3455 ac_have_armv81_feature=yes
3456 AC_MSG_RESULT([yes])
3458 ac_have_armv81_feature=no
3461 CFLAGS="$save_CFLAGS"
3463 AM_CONDITIONAL(BUILD_ARMV81_TESTS, test x$ac_have_armv81_feature = xyes)
3466 # Does the C compiler support the armv82 flag and the assembler v8.2 instructions
3467 # Note, this doesn't generate a C-level symbol. It generates a
3468 # automake-level symbol (BUILD_ARMV82_TESTS), used in test Makefile.am's
3469 AC_MSG_CHECKING([if gcc supports the armv82 feature flag and assembler supports v8.2 instructions])
3471 save_CFLAGS="$CFLAGS"
3472 CFLAGS="$CFLAGS -march=armv8.2-a+fp16 -Werror"
3473 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3476 __asm__ __volatile__("faddp h0, v1.2h");
3480 ac_have_armv82_feature=yes
3481 AC_MSG_RESULT([yes])
3483 ac_have_armv82_feature=no
3486 CFLAGS="$save_CFLAGS"
3488 AM_CONDITIONAL(BUILD_ARMV82_TESTS, test x$ac_have_armv82_feature = xyes)
3491 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
3492 # when building the tool executables. I think we should get rid of it.
3494 # Check for TLS support in the compiler and linker
3495 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3497 [vg_cv_linktime_tls=yes],
3498 [vg_cv_linktime_tls=no])
3499 # Native compilation: check whether running a program using TLS succeeds.
3500 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
3501 # succeeds but running programs using TLS fails.
3502 # Cross-compiling: check whether linking a program using TLS succeeds.
3503 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
3504 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
3505 [vg_cv_tls=$enableval],
3506 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
3510 [vg_cv_tls=$vg_cv_linktime_tls])])])
3512 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
3513 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
3517 #----------------------------------------------------------------------------
3518 # Solaris-specific checks.
3519 #----------------------------------------------------------------------------
3521 if test "$VGCONF_OS" = "solaris" ; then
3522 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
3524 # Solaris-specific check determining if the Sun Studio Assembler is used to
3525 # build Valgrind. The test checks if the x86/amd64 assembler understands the
3526 # cmovl.l instruction, if yes then it's Sun Assembler.
3528 # C-level symbol: none
3529 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
3531 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
3532 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3534 __asm__ __volatile__("cmovl.l %edx, %eax");
3536 solaris_have_sun_studio_as=yes
3537 AC_MSG_RESULT([yes])
3539 solaris_have_sun_studio_as=no
3542 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
3544 # Solaris-specific check determining if symbols __xpg4 and __xpg6
3545 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
3546 # See solaris/vgpreload-solaris.mapfile for details.
3547 # gcc on older Solaris instructs linker to include these symbols,
3548 # gcc on illumos and newer Solaris does not.
3550 # C-level symbol: none
3551 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
3553 save_CFLAGS="$CFLAGS"
3554 CFLAGS="$CFLAGS -std=gnu99"
3555 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
3556 temp_dir=$( /usr/bin/mktemp -d )
3557 cat <<_ACEOF >${temp_dir}/mylib.c
3559 int myfunc(void) { printf("LaPutyka\n"); }
3561 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
3562 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
3563 if test "x${xpg_present}" = "x" ; then
3564 solaris_xpg_symbols_present=no
3567 solaris_xpg_symbols_present=yes
3568 AC_MSG_RESULT([yes])
3571 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
3572 CFLAGS="$save_CFLAGS"
3575 # Solaris-specific check determining if gcc enables largefile support by
3576 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
3577 # variable with gcc flags which disable it.
3579 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
3580 save_CFLAGS="$CFLAGS"
3581 CFLAGS="$CFLAGS -m32"
3582 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3583 return _LARGEFILE_SOURCE;
3585 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
3586 AC_MSG_RESULT([yes])
3588 SOLARIS_UNDEF_LARGESOURCE=""
3592 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
3595 # Solaris-specific check determining if /proc/self/cmdline
3596 # or /proc/<pid>/cmdline is supported.
3598 # C-level symbol: SOLARIS_PROC_CMDLINE
3599 # Automake-level symbol: SOLARIS_PROC_CMDLINE
3601 AC_CHECK_FILE([/proc/self/cmdline],
3603 solaris_proc_cmdline=yes
3604 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
3605 [Define to 1 if you have /proc/self/cmdline.])
3607 solaris_proc_cmdline=no
3609 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3612 # Solaris-specific check determining default platform for the Valgrind launcher.
3613 # Used in case the launcher cannot select platform by looking at the client
3614 # image (for example because the executable is a shell script).
3616 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3617 # Automake-level symbol: none
3619 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3620 # Get the ELF class of /bin/sh first.
3621 if ! test -f /bin/sh; then
3622 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3624 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3625 case "$elf_class" in
3627 default_arch="$VGCONF_ARCH_PRI";
3630 if test "x$VGCONF_ARCH_SEC" != "x"; then
3631 default_arch="$VGCONF_ARCH_SEC"
3633 default_arch="$VGCONF_ARCH_PRI";
3637 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3640 default_platform="$default_arch-$VGCONF_OS"
3641 AC_MSG_RESULT([$default_platform])
3642 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3643 [Default platform for Valgrind launcher.])
3646 # Solaris-specific check determining if the old syscalls are available.
3648 # C-level symbol: SOLARIS_OLD_SYSCALLS
3649 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3651 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3652 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3653 #include <sys/syscall.h>
3657 solaris_old_syscalls=yes
3658 AC_MSG_RESULT([yes])
3659 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3660 [Define to 1 if you have the old Solaris syscalls.])
3662 solaris_old_syscalls=no
3665 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
3668 # Solaris-specific check determining if the new accept() syscall is available.
3671 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3674 # New syscall (available on illumos):
3675 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3676 # int version, int flags);
3678 # If the old syscall is present then the following syscall will fail with
3679 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
3680 # available then it will fail with EINVAL (because the flags parameter is
3683 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
3684 # Automake-level symbol: none
3686 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
3687 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3688 #include <sys/syscall.h>
3692 syscall(SYS_accept, 0, 0, 0, 0, -1);
3693 return !(errno == EINVAL);
3695 AC_MSG_RESULT([yes])
3696 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
3697 [Define to 1 if you have the new `accept' syscall.])
3703 # Solaris-specific check determining if the new illumos pipe() syscall is
3707 # longlong_t pipe();
3709 # New syscall (available on illumos):
3710 # int pipe(intptr_t arg, int flags);
3712 # If the old syscall is present then the following call will succeed, if the
3713 # new syscall is available then it will fail with EFAULT (because address 0
3714 # cannot be accessed).
3716 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
3717 # Automake-level symbol: none
3719 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
3720 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3721 #include <sys/syscall.h>
3725 syscall(SYS_pipe, 0, 0);
3726 return !(errno == EFAULT);
3728 AC_MSG_RESULT([yes])
3729 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3730 [Define to 1 if you have the new `pipe' syscall.])
3736 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
3740 # int lwp_kill(id_t lwpid, int sig);
3742 # New syscall (available on Solaris 11):
3743 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3744 # int si_code, timespec_t *timeout);
3746 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3747 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3749 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3750 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3751 #include <sys/syscall.h>
3753 return !SYS_lwp_sigqueue;
3755 solaris_lwp_sigqueue_syscall=yes
3756 AC_MSG_RESULT([yes])
3757 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
3758 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
3760 solaris_lwp_sigqueue_syscall=no
3763 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3766 # Solaris-specific check determining if the lwp_sigqueue() syscall
3767 # takes both pid and thread id arguments or just thread id.
3769 # Old syscall (available up to Solaris 11.3):
3770 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3771 # int si_code, timespec_t *timeout);
3773 # New syscall (available since Solaris 11.4):
3774 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
3775 # int si_code, timespec_t *timeout);
3777 # If the old syscall is present then the following syscall will fail with
3778 # EINVAL (because signal is out of range); if the new syscall is available
3779 # then it will fail with ESRCH (because it would not find such thread in the
3782 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3783 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3785 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
3786 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
3787 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3788 #include <sys/syscall.h>
3792 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
3793 return !(errno == ESRCH);
3795 solaris_lwp_sigqueue_syscall_takes_pid=yes
3796 AC_MSG_RESULT([yes])
3797 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
3798 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
3800 solaris_lwp_sigqueue_syscall_takes_pid=no
3803 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
3804 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
3806 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
3810 # Solaris-specific check determining if the new lwp_name() syscall is
3813 # New syscall (available on Solaris 11):
3814 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
3816 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
3817 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
3819 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
3820 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3821 #include <sys/syscall.h>
3823 return !SYS_lwp_name;
3825 solaris_lwp_name_syscall=yes
3826 AC_MSG_RESULT([yes])
3827 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
3828 [Define to 1 if you have the new `lwp_name' syscall.])
3830 solaris_lwp_name_syscall=no
3833 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
3836 # Solaris-specific check determining if the new getrandom() syscall is
3839 # New syscall (available on Solaris 11):
3840 # int getrandom(void *buf, size_t buflen, uint_t flags);
3842 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
3843 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
3845 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
3846 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3847 #include <sys/syscall.h>
3849 return !SYS_getrandom;
3851 solaris_getrandom_syscall=yes
3852 AC_MSG_RESULT([yes])
3853 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
3854 [Define to 1 if you have the new `getrandom' syscall.])
3856 solaris_getrandom_syscall=no
3859 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
3862 # Solaris-specific check determining if the new zone() syscall subcodes
3863 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
3864 # were added in Solaris 11 but are missing on illumos.
3866 # C-level symbol: SOLARIS_ZONE_DEFUNCT
3867 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
3869 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
3870 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3871 #include <sys/zone.h>
3873 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
3875 solaris_zone_defunct=yes
3876 AC_MSG_RESULT([yes])
3877 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
3878 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
3880 solaris_zone_defunct=no
3883 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
3886 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
3887 # for auditon(2) subcode of the auditsys() syscall are available.
3888 # These commands are available in Solaris 11 and illumos but were removed
3891 # C-level symbol: SOLARIS_AUDITON_STAT
3892 # Automake-level symbol: SOLARIS_AUDITON_STAT
3894 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
3895 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3896 #include <bsm/audit.h>
3898 return !(A_GETSTAT && A_SETSTAT);
3900 solaris_auditon_stat=yes
3901 AC_MSG_RESULT([yes])
3902 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
3903 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
3905 solaris_auditon_stat=no
3908 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
3911 # Solaris-specific check determining if the new shmsys() syscall subcodes
3912 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
3913 # These subcodes were added in Solaris 11 but are missing on illumos.
3915 # C-level symbol: SOLARIS_SHM_NEW
3916 # Automake-level symbol: SOLARIS_SHM_NEW
3918 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
3919 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3920 #include <sys/ipc_impl.h>
3921 #include <sys/shm.h>
3922 #include <sys/shm_impl.h>
3924 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
3927 AC_MSG_RESULT([yes])
3928 AC_DEFINE([SOLARIS_SHM_NEW], 1,
3929 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
3934 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
3937 # Solaris-specific check determining if prxregset_t is available. Illumos
3938 # currently does not define it on the x86 platform.
3940 # C-level symbol: SOLARIS_PRXREGSET_T
3941 # Automake-level symbol: SOLARIS_PRXREGSET_T
3943 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
3944 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3945 #include <sys/procfs_isa.h>
3947 return !sizeof(prxregset_t);
3949 solaris_prxregset_t=yes
3950 AC_MSG_RESULT([yes])
3951 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
3952 [Define to 1 if you have the `prxregset_t' type.])
3954 solaris_prxregset_t=no
3957 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
3960 # Solaris-specific check determining if the new frealpathat() syscall is
3963 # New syscall (available on Solaris 11.1):
3964 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
3966 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3967 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3969 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
3970 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3971 #include <sys/syscall.h>
3973 return !SYS_frealpathat;
3975 solaris_frealpathat_syscall=yes
3976 AC_MSG_RESULT([yes])
3977 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
3978 [Define to 1 if you have the new `frealpathat' syscall.])
3980 solaris_frealpathat_syscall=no
3983 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
3986 # Solaris-specific check determining if the new uuidsys() syscall is
3989 # New syscall (available on newer Solaris):
3990 # int uuidsys(struct uuid *uuid);
3992 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
3993 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
3995 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
3996 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3997 #include <sys/syscall.h>
3999 return !SYS_uuidsys;
4001 solaris_uuidsys_syscall=yes
4002 AC_MSG_RESULT([yes])
4003 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
4004 [Define to 1 if you have the new `uuidsys' syscall.])
4006 solaris_uuidsys_syscall=no
4009 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
4012 # Solaris-specific check determining if the new labelsys() syscall subcode
4013 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
4014 # missing on illumos.
4016 # C-level symbol: SOLARIS_TNDB_GET_TNIP
4017 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
4019 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
4020 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4021 #include <sys/tsol/tndb.h>
4023 return !TNDB_GET_TNIP;
4025 solaris_tndb_get_tnip=yes
4026 AC_MSG_RESULT([yes])
4027 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
4028 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
4030 solaris_tndb_get_tnip=no
4033 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
4036 # Solaris-specific check determining if the new labelsys() syscall opcodes
4037 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
4038 # added in Solaris 11 but are missing on illumos.
4040 # C-level symbol: SOLARIS_TSOL_CLEARANCE
4041 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
4043 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
4044 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4045 #include <sys/tsol/tsyscall.h>
4047 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
4049 solaris_tsol_clearance=yes
4050 AC_MSG_RESULT([yes])
4051 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
4052 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
4054 solaris_tsol_clearance=no
4057 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
4060 # Solaris-specific check determining if the new pset() syscall subcode
4061 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
4062 # is missing on illumos and Solaris 11.3.
4064 # C-level symbol: SOLARIS_PSET_GET_NAME
4065 # Automake-level symbol: SOLARIS_PSET_GET_NAME
4067 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
4068 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4069 #include <sys/pset.h>
4071 return !(PSET_GET_NAME);
4073 solaris_pset_get_name=yes
4074 AC_MSG_RESULT([yes])
4075 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
4076 [Define to 1 if you have the `PSET_GET_NAME' constants.])
4078 solaris_pset_get_name=no
4081 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
4084 # Solaris-specific check determining if the utimesys() syscall is
4085 # available (on illumos and older Solaris).
4087 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
4088 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
4090 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
4091 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4092 #include <sys/syscall.h>
4094 return !SYS_utimesys;
4096 solaris_utimesys_syscall=yes
4097 AC_MSG_RESULT([yes])
4098 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
4099 [Define to 1 if you have the `utimesys' syscall.])
4101 solaris_utimesys_syscall=no
4104 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
4107 # Solaris-specific check determining if the utimensat() syscall is
4108 # available (on newer Solaris).
4110 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4111 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
4113 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
4114 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4115 #include <sys/syscall.h>
4117 return !SYS_utimensat;
4119 solaris_utimensat_syscall=yes
4120 AC_MSG_RESULT([yes])
4121 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
4122 [Define to 1 if you have the `utimensat' syscall.])
4124 solaris_utimensat_syscall=no
4127 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
4130 # Solaris-specific check determining if the spawn() syscall is available
4131 # (on newer Solaris).
4133 # C-level symbol: SOLARIS_SPAWN_SYSCALL
4134 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
4136 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
4137 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4138 #include <sys/syscall.h>
4142 solaris_spawn_syscall=yes
4143 AC_MSG_RESULT([yes])
4144 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
4145 [Define to 1 if you have the `spawn' syscall.])
4147 solaris_spawn_syscall=no
4150 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
4153 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
4154 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
4156 # C-level symbol: SOLARIS_MODCTL_MODNVL
4157 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
4159 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
4160 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4161 #include <sys/modctl.h>
4163 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
4165 solaris_modctl_modnvl=yes
4166 AC_MSG_RESULT([yes])
4167 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
4168 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
4170 solaris_modctl_modnvl=no
4173 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
4176 # Solaris-specific check determining whether nscd (name switch cache daemon)
4177 # attaches its door at /system/volatile/name_service_door (Solaris)
4178 # or at /var/run/name_service_door (illumos).
4180 # Note that /var/run is a symlink to /system/volatile on Solaris
4181 # but not vice versa on illumos.
4183 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4184 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
4186 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
4187 if test -e /system/volatile/name_service_door; then
4188 solaris_nscd_door_system_volatile=yes
4189 AC_MSG_RESULT([/system/volatile/name_service_door])
4190 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
4191 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
4193 solaris_nscd_door_system_volatile=no
4194 AC_MSG_RESULT([/var/run/name_service_door])
4196 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
4199 # Solaris-specific check determining if the new gethrt() fasttrap is available.
4201 # New fasttrap (available on Solaris 11):
4202 # hrt_t *gethrt(void);
4204 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
4205 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
4207 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
4208 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4209 #include <sys/trap.h>
4213 solaris_gethrt_fasttrap=yes
4214 AC_MSG_RESULT([yes])
4215 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
4216 [Define to 1 if you have the new `gethrt' fasttrap.])
4218 solaris_gethrt_fasttrap=no
4221 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
4224 # Solaris-specific check determining if the new get_zone_offset() fasttrap
4227 # New fasttrap (available on Solaris 11):
4228 # zonehrtoffset_t *get_zone_offset(void);
4230 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4231 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
4233 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
4234 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4235 #include <sys/trap.h>
4237 return !T_GETZONEOFFSET;
4239 solaris_getzoneoffset_fasttrap=yes
4240 AC_MSG_RESULT([yes])
4241 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
4242 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
4244 solaris_getzoneoffset_fasttrap=no
4247 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
4250 # Solaris-specific check determining if the execve() syscall
4251 # takes fourth argument (flags) or not.
4253 # Old syscall (available on illumos):
4254 # int execve(const char *fname, const char **argv, const char **envp);
4256 # New syscall (available on Solaris):
4257 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
4259 # If the new syscall is present then it will fail with EINVAL (because flags
4260 # are invalid); if the old syscall is available then it will fail with ENOENT
4261 # (because the file could not be found).
4263 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4264 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
4266 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
4267 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4268 #include <sys/syscall.h>
4272 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
4273 return !(errno == EINVAL);
4275 solaris_execve_syscall_takes_flags=yes
4276 AC_MSG_RESULT([yes])
4277 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
4278 [Define to 1 if you have the new `execve' syscall which accepts flags.])
4280 solaris_execve_syscall_takes_flags=no
4283 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
4284 test x$solaris_execve_syscall_takes_flags = xyes)
4287 # Solaris-specific check determining version of the repository cache protocol.
4288 # Every Solaris version uses a different one, ranging from 21 to current 25.
4289 # The check is very ugly, though.
4291 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
4292 # Automake-level symbol: none
4294 AC_PATH_PROG(DIS_PATH, dis, false)
4295 if test "x$DIS_PATH" = "xfalse"; then
4296 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
4298 AC_CHECK_LIB(scf, scf_handle_bind, [], [
4299 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
4300 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4303 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
4304 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
4305 libscf=/usr/lib/64/libscf.so.1
4307 libscf=/usr/lib/libscf.so.1
4309 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
4310 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
4311 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4313 hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
4314 if test -z "$hex"; then
4315 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
4316 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
4318 version=$( printf "%d\n" 0x$hex )
4319 AC_MSG_RESULT([$version])
4320 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
4321 [Version number of the repository door cache protocol.])
4324 # Solaris-specific check determining if "sysstat" segment reservation type
4327 # New "sysstat" segment reservation (available on Solaris 11.4):
4328 # - program header type: PT_SUNW_SYSSTAT
4329 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
4331 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4332 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
4334 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
4335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4336 #include <sys/auxv.h>
4338 return !AT_SUN_SYSSTAT_ADDR;
4340 solaris_reserve_sysstat_addr=yes
4341 AC_MSG_RESULT([yes])
4342 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
4343 [Define to 1 if you have the new `sysstat' segment reservation.])
4345 solaris_reserve_sysstat_addr=no
4348 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
4351 # Solaris-specific check determining if "sysstat_zone" segment reservation type
4354 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
4355 # - program header type: PT_SUNW_SYSSTAT_ZONE
4356 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
4358 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4359 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
4361 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
4362 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4363 #include <sys/auxv.h>
4365 return !AT_SUN_SYSSTAT_ZONE_ADDR;
4367 solaris_reserve_sysstat_zone_addr=yes
4368 AC_MSG_RESULT([yes])
4369 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
4370 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
4372 solaris_reserve_sysstat_zone_addr=no
4375 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
4378 # Solaris-specific check determining if the system_stats() syscall is available
4379 # (on newer Solaris).
4381 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4382 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
4384 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
4385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4386 #include <sys/syscall.h>
4388 return !SYS_system_stats;
4390 solaris_system_stats_syscall=yes
4391 AC_MSG_RESULT([yes])
4392 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
4393 [Define to 1 if you have the `system_stats' syscall.])
4395 solaris_system_stats_syscall=no
4398 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
4401 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
4402 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
4404 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
4405 # Automake-level symbol: none
4407 AC_CHECK_TYPE([struct _fpchip_state],
4408 [solaris_fpchip_state_takes_underscore=yes],
4409 [solaris_fpchip_state_takes_underscore=no],
4410 [[#include <sys/regset.h>]])
4411 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
4412 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
4413 [Define to 1 if fpregset_t defines struct _fpchip_state])
4417 # Solaris-specific check determining if schedctl page shared between kernel
4418 # and userspace program is executable (illumos, older Solaris) or not (newer
4421 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
4422 # Automake-level symbol: none
4424 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
4425 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4429 #include <schedctl.h>
4433 schedctl_t *scp = schedctl_init();
4437 int fd = open("/proc/self/map", O_RDONLY);
4442 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
4443 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
4444 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
4445 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
4446 return (map.pr_mflags & MA_EXEC);
4452 solaris_schedctl_page_exec=no
4455 solaris_schedctl_page_exec=yes
4456 AC_MSG_RESULT([yes])
4457 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
4458 [Define to 1 if you have the schedctl page executable.])
4462 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
4463 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
4464 # an initial thread pointer for libc (newer Solaris).
4466 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
4467 # Automake-level symbol: none
4469 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
4470 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
4471 #include <sys/fasttrap_isa.h>
4473 return !FT_SCRATCHSIZE;
4475 solaris_pt_sunwdtrace_thrp=yes
4476 AC_MSG_RESULT([yes])
4477 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
4478 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
4480 solaris_pt_sunwdtrace_thrp=no
4485 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
4486 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
4487 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
4488 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
4489 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
4490 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
4491 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
4492 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
4493 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
4494 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
4495 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
4496 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
4497 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
4498 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
4499 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
4500 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
4501 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
4502 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
4503 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
4504 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
4505 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
4506 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
4507 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
4508 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
4509 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
4510 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
4511 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
4512 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
4513 fi # test "$VGCONF_OS" = "solaris"
4516 #----------------------------------------------------------------------------
4517 # Checks for C header files.
4518 #----------------------------------------------------------------------------
4520 AC_CHECK_HEADERS([ \
4538 # Verify whether the <linux/futex.h> header is usable.
4539 AC_MSG_CHECKING([if <linux/futex.h> is usable])
4541 save_CFLAGS="$CFLAGS"
4542 CFLAGS="$CFLAGS -D__user="
4543 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4544 #include <linux/futex.h>
4548 ac_have_usable_linux_futex_h=yes
4549 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
4550 [Define to 1 if you have a usable <linux/futex.h> header file.])
4551 AC_MSG_RESULT([yes])
4553 ac_have_usable_linux_futex_h=no
4556 CFLAGS="$save_CFLAGS"
4559 #----------------------------------------------------------------------------
4560 # Checks for typedefs, structures, and compiler characteristics.
4561 #----------------------------------------------------------------------------
4568 #----------------------------------------------------------------------------
4569 # Checks for library functions.
4570 #----------------------------------------------------------------------------
4574 AC_CHECK_LIB([pthread], [pthread_create])
4575 AC_CHECK_LIB([rt], [clock_gettime])
4594 pthread_barrier_init \
4595 pthread_condattr_setclock \
4596 pthread_mutex_timedlock \
4597 pthread_rwlock_timedrdlock \
4598 pthread_rwlock_timedwrlock \
4599 pthread_setname_np \
4619 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
4620 # libraries with any shared object and/or executable. This is NOT what we
4621 # want for e.g. vgpreload_core-x86-linux.so
4624 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
4625 [test x$ac_cv_func_pthread_barrier_init = xyes])
4626 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
4627 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
4628 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
4629 [test x$ac_cv_func_pthread_spin_lock = xyes])
4630 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
4631 [test x$ac_cv_func_pthread_setname_np = xyes])
4632 AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
4633 [test x$ac_cv_func_copy_file_range = xyes])
4634 AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
4635 [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
4636 AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
4637 [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = xyes])
4638 AM_CONDITIONAL([HAVE_SETCONTEXT], [test x$ac_cv_func_setcontext = xyes])
4639 AM_CONDITIONAL([HAVE_SWAPCONTEXT], [test x$ac_cv_func_swapcontext = xyes])
4640 AM_CONDITIONAL([HAVE_MEMFD_CREATE],
4641 [test x$ac_cv_func_memfd_create = xyes])
4643 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4644 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
4645 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX; then
4646 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
4647 [Disable intercept pthread_spin_lock() on MIPS32, MIPS64 and nanoMIPS.])
4650 #----------------------------------------------------------------------------
4652 #----------------------------------------------------------------------------
4653 # Do we have a useable MPI setup on the primary and/or secondary targets?
4654 # On Linux, by default, assumes mpicc and -m32/-m64
4655 # Note: this is a kludge in that it assumes the specified mpicc
4656 # understands -m32/-m64 regardless of what is specified using
4658 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
4659 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
4662 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
4663 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_FREEBSD \
4664 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
4665 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
4666 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4667 -o x$VGCONF_PLATFORM_PRI_CAPS = xNANOMIPS_LINUX \
4668 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
4669 mflag_primary=$FLAG_M32
4670 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
4671 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_FREEBSD \
4672 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
4673 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
4674 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
4675 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
4676 mflag_primary=$FLAG_M64
4677 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
4678 mflag_primary="$FLAG_M32 -arch i386"
4679 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
4680 mflag_primary="$FLAG_M64 -arch x86_64"
4684 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
4685 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
4686 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
4687 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX \
4688 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_FREEBSD ; then
4689 mflag_secondary=$FLAG_M32
4690 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
4691 mflag_secondary="$FLAG_M32 -arch i386"
4696 [ --with-mpicc= Specify name of MPI2-ised C compiler],
4701 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
4702 ## use these values in the check for a functioning mpicc.
4704 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
4705 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
4706 AM_COND_IF([VGCONF_OS_IS_LINUX],
4707 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4708 LDFLAGS_MPI="-fpic -shared"])
4709 AM_COND_IF([VGCONF_OS_IS_FREEBSD],
4710 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4711 LDFLAGS_MPI="-fpic -shared"])
4712 AM_COND_IF([VGCONF_OS_IS_DARWIN],
4713 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
4714 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
4715 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
4716 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4717 LDFLAGS_MPI="-fpic -shared"])
4719 AC_SUBST([CFLAGS_MPI])
4720 AC_SUBST([LDFLAGS_MPI])
4723 ## See if MPI_CC works for the primary target
4725 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
4727 saved_CFLAGS=$CFLAGS
4729 CFLAGS="$CFLAGS_MPI $mflag_primary"
4730 saved_LDFLAGS="$LDFLAGS"
4731 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
4732 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4736 int ni, na, nd, comb;
4737 int r = MPI_Init(NULL,NULL);
4738 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4739 r |= MPI_Finalize();
4742 ac_have_mpi2_pri=yes
4743 AC_MSG_RESULT([yes, $MPI_CC])
4749 CFLAGS=$saved_CFLAGS
4750 LDFLAGS="$saved_LDFLAGS"
4751 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
4753 ## See if MPI_CC works for the secondary target. Complication: what if
4754 ## there is no secondary target? We need this to then fail.
4755 ## Kludge this by making MPI_CC something which will surely fail in
4758 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
4760 saved_CFLAGS=$CFLAGS
4761 saved_LDFLAGS="$LDFLAGS"
4762 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
4763 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
4764 CC="$MPI_CC this will surely fail"
4768 CFLAGS="$CFLAGS_MPI $mflag_secondary"
4769 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4773 int ni, na, nd, comb;
4774 int r = MPI_Init(NULL,NULL);
4775 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4776 r |= MPI_Finalize();
4779 ac_have_mpi2_sec=yes
4780 AC_MSG_RESULT([yes, $MPI_CC])
4786 CFLAGS=$saved_CFLAGS
4787 LDFLAGS="$saved_LDFLAGS"
4788 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
4791 #----------------------------------------------------------------------------
4792 # Other library checks
4793 #----------------------------------------------------------------------------
4794 # There now follow some tests for Boost, and OpenMP. These
4795 # tests are present because Drd has some regression tests that use
4796 # these packages. All regression test programs all compiled only
4797 # for the primary target. And so it is important that the configure
4798 # checks that follow, use the correct -m32 or -m64 flag for the
4799 # primary target (called $mflag_primary). Otherwise, we can end up
4800 # in a situation (eg) where, on amd64-linux, the test for Boost checks
4801 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
4802 # only build (meaning, the primary target is x86-linux), the build
4803 # of the regtest programs that use Boost fails, because they are
4804 # build as 32-bit (IN THIS EXAMPLE).
4806 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
4807 # NEEDED BY THE REGRESSION TEST PROGRAMS.
4810 # Check whether the boost library 1.35 or later has been installed.
4811 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
4813 AC_MSG_CHECKING([for boost])
4816 safe_CXXFLAGS=$CXXFLAGS
4817 CXXFLAGS="$mflag_primary"
4819 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
4821 AC_LINK_IFELSE([AC_LANG_SOURCE([
4822 #include <boost/thread.hpp>
4823 static void thread_func(void)
4825 int main(int argc, char** argv)
4827 boost::thread t(thread_func);
4832 ac_have_boost_1_35=yes
4833 AC_SUBST([BOOST_CFLAGS], [])
4834 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
4835 AC_MSG_RESULT([yes])
4837 ac_have_boost_1_35=no
4842 CXXFLAGS=$safe_CXXFLAGS
4845 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
4848 # does this compiler support -fopenmp, does it have the include file
4849 # <omp.h> and does it have libgomp ?
4851 AC_MSG_CHECKING([for OpenMP])
4854 CFLAGS="-fopenmp $mflag_primary -Werror"
4856 AC_LINK_IFELSE([AC_LANG_SOURCE([
4858 int main(int argc, char** argv)
4866 AC_MSG_RESULT([yes])
4873 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
4876 # Check for __builtin_popcount
4877 AC_MSG_CHECKING([for __builtin_popcount()])
4878 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4880 __builtin_popcount(2);
4883 AC_MSG_RESULT([yes])
4884 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
4885 [Define to 1 if compiler provides __builtin_popcount().])
4890 # Check for __builtin_clz
4891 AC_MSG_CHECKING([for __builtin_clz()])
4892 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4897 AC_MSG_RESULT([yes])
4898 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
4899 [Define to 1 if compiler provides __builtin_clz().])
4904 # Check for __builtin_ctz
4905 AC_MSG_CHECKING([for __builtin_ctz()])
4906 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4911 AC_MSG_RESULT([yes])
4912 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
4913 [Define to 1 if compiler provides __builtin_ctz().])
4918 # does this compiler have built-in functions for atomic memory access for the
4920 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
4923 CFLAGS="$mflag_primary"
4925 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4927 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4928 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4930 ac_have_builtin_atomic_primary=yes
4931 AC_MSG_RESULT([yes])
4932 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])
4934 ac_have_builtin_atomic_primary=no
4940 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
4941 [test x$ac_have_builtin_atomic_primary = xyes])
4944 # does this compiler have built-in functions for atomic memory access for the
4945 # secondary target ?
4947 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4949 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
4952 CFLAGS="$mflag_secondary"
4954 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4956 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
4958 ac_have_builtin_atomic_secondary=yes
4959 AC_MSG_RESULT([yes])
4961 ac_have_builtin_atomic_secondary=no
4969 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
4970 [test x$ac_have_builtin_atomic_secondary = xyes])
4972 # does this compiler have built-in functions for atomic memory access on
4973 # 64-bit integers for all targets ?
4975 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
4977 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4980 uint64_t variable = 1;
4981 return __sync_add_and_fetch(&variable, 1)
4983 ac_have_builtin_atomic64_primary=yes
4985 ac_have_builtin_atomic64_primary=no
4988 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4991 CFLAGS="$mflag_secondary"
4993 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4996 uint64_t variable = 1;
4997 return __sync_add_and_fetch(&variable, 1)
4999 ac_have_builtin_atomic64_secondary=yes
5001 ac_have_builtin_atomic64_secondary=no
5008 if test x$ac_have_builtin_atomic64_primary = xyes && \
5009 test x$VGCONF_PLATFORM_SEC_CAPS = x \
5010 -o x$ac_have_builtin_atomic64_secondary = xyes; then
5011 AC_MSG_RESULT([yes])
5012 ac_have_builtin_atomic64=yes
5015 ac_have_builtin_atomic64=no
5018 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
5019 [test x$ac_have_builtin_atomic64 = xyes])
5022 # does g++ have built-in functions for atomic memory access ?
5023 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
5025 safe_CXXFLAGS=$CXXFLAGS
5026 CXXFLAGS="$mflag_primary"
5029 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5031 return (__sync_bool_compare_and_swap(&variable, 1, 2)
5032 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
5034 ac_have_builtin_atomic_cxx=yes
5035 AC_MSG_RESULT([yes])
5036 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
5038 ac_have_builtin_atomic_cxx=no
5043 CXXFLAGS=$safe_CXXFLAGS
5045 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
5048 if test x$ac_have_usable_linux_futex_h = xyes \
5049 -a x$ac_have_builtin_atomic_primary = xyes; then
5050 ac_enable_linux_ticket_lock_primary=yes
5052 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
5053 [test x$ac_enable_linux_ticket_lock_primary = xyes])
5055 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
5056 -a x$ac_have_usable_linux_futex_h = xyes \
5057 -a x$ac_have_builtin_atomic_secondary = xyes; then
5058 ac_enable_linux_ticket_lock_secondary=yes
5060 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
5061 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
5064 # does libstdc++ support annotating shared pointers ?
5065 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
5067 safe_CXXFLAGS=$CXXFLAGS
5068 CXXFLAGS="-std=c++0x"
5071 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5074 std::shared_ptr<int> p
5076 ac_have_shared_ptr=yes
5078 ac_have_shared_ptr=no
5080 if test x$ac_have_shared_ptr = xyes; then
5081 # If compilation of the program below fails because of a syntax error
5082 # triggered by substituting one of the annotation macros then that
5083 # means that libstdc++ supports these macros.
5084 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5085 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
5086 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
5089 std::shared_ptr<int> p
5091 ac_have_shared_pointer_annotation=no
5094 ac_have_shared_pointer_annotation=yes
5095 AC_MSG_RESULT([yes])
5096 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
5097 [Define to 1 if libstd++ supports annotating shared pointers])
5100 ac_have_shared_pointer_annotation=no
5105 CXXFLAGS=$safe_CXXFLAGS
5107 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
5108 [test x$ac_have_shared_pointer_annotation = xyes])
5111 #----------------------------------------------------------------------------
5112 # Ok. We're done checking.
5113 #----------------------------------------------------------------------------
5115 # Nb: VEX/Makefile is generated from Makefile.vex.in.
5118 VEX/Makefile:Makefile.vex.in
5122 glibc-2.X-helgrind.supp
5129 gdbserver_tests/Makefile
5130 gdbserver_tests/solaris/Makefile
5136 memcheck/tests/Makefile
5137 memcheck/tests/common/Makefile
5138 memcheck/tests/amd64/Makefile
5139 memcheck/tests/x86/Makefile
5140 memcheck/tests/linux/Makefile
5141 memcheck/tests/linux/debuginfod-check.vgtest
5142 memcheck/tests/darwin/Makefile
5143 memcheck/tests/solaris/Makefile
5144 memcheck/tests/freebsd/Makefile
5145 memcheck/tests/amd64-linux/Makefile
5146 memcheck/tests/arm64-linux/Makefile
5147 memcheck/tests/x86-linux/Makefile
5148 memcheck/tests/amd64-solaris/Makefile
5149 memcheck/tests/x86-solaris/Makefile
5150 memcheck/tests/amd64-freebsd/Makefile
5151 memcheck/tests/x86-freebsd/Makefile
5152 memcheck/tests/ppc32/Makefile
5153 memcheck/tests/ppc64/Makefile
5154 memcheck/tests/s390x/Makefile
5155 memcheck/tests/mips32/Makefile
5156 memcheck/tests/mips64/Makefile
5157 memcheck/tests/vbit-test/Makefile
5159 cachegrind/tests/Makefile
5160 cachegrind/tests/x86/Makefile
5161 cachegrind/cg_annotate
5164 callgrind/callgrind_annotate
5165 callgrind/callgrind_control
5166 callgrind/tests/Makefile
5168 helgrind/tests/Makefile
5170 drd/scripts/download-and-build-splash2
5173 massif/tests/Makefile
5178 lackey/tests/Makefile
5181 none/tests/scripts/Makefile
5182 none/tests/amd64/Makefile
5183 none/tests/ppc32/Makefile
5184 none/tests/ppc64/Makefile
5185 none/tests/x86/Makefile
5186 none/tests/arm/Makefile
5187 none/tests/arm64/Makefile
5188 none/tests/s390x/Makefile
5189 none/tests/mips32/Makefile
5190 none/tests/mips64/Makefile
5191 none/tests/nanomips/Makefile
5192 none/tests/linux/Makefile
5193 none/tests/darwin/Makefile
5194 none/tests/solaris/Makefile
5195 none/tests/freebsd/Makefile
5196 none/tests/amd64-linux/Makefile
5197 none/tests/x86-linux/Makefile
5198 none/tests/amd64-darwin/Makefile
5199 none/tests/x86-darwin/Makefile
5200 none/tests/amd64-solaris/Makefile
5201 none/tests/x86-solaris/Makefile
5203 exp-bbv/tests/Makefile
5204 exp-bbv/tests/x86/Makefile
5205 exp-bbv/tests/x86-linux/Makefile
5206 exp-bbv/tests/amd64-linux/Makefile
5207 exp-bbv/tests/ppc32-linux/Makefile
5208 exp-bbv/tests/arm-linux/Makefile
5212 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
5213 [chmod +x coregrind/link_tool_exe_linux])
5214 AC_CONFIG_FILES([coregrind/link_tool_exe_freebsd],
5215 [chmod +x coregrind/link_tool_exe_freebsd])
5216 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
5217 [chmod +x coregrind/link_tool_exe_darwin])
5218 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
5219 [chmod +x coregrind/link_tool_exe_solaris])
5220 AC_CONFIG_FILES([tests/filter_stderr_basic],
5221 [chmod +x tests/filter_stderr_basic])
5222 AC_CONFIG_FILES([tests/filter_discards],
5223 [chmod +x tests/filter_discards])
5224 AC_CONFIG_FILES([memcheck/tests/filter_stderr],
5225 [chmod +x memcheck/tests/filter_stderr])
5226 AC_CONFIG_FILES([memcheck/tests/filter_dw4],
5227 [chmod +x memcheck/tests/filter_dw4])
5228 AC_CONFIG_FILES([memcheck/tests/filter_overlaperror],
5229 [chmod +x memcheck/tests/filter_overlaperror])
5230 AC_CONFIG_FILES([memcheck/tests/x86/filter_pushfpopf],
5231 [chmod +x memcheck/tests/x86/filter_pushfpopf])
5232 AC_CONFIG_FILES([gdbserver_tests/filter_gdb],
5233 [chmod +x gdbserver_tests/filter_gdb])
5234 AC_CONFIG_FILES([gdbserver_tests/filter_memcheck_monitor],
5235 [chmod +x gdbserver_tests/filter_memcheck_monitor])
5236 AC_CONFIG_FILES([gdbserver_tests/filter_stderr],
5237 [chmod +x gdbserver_tests/filter_stderr])
5238 AC_CONFIG_FILES([gdbserver_tests/filter_vgdb],
5239 [chmod +x gdbserver_tests/filter_vgdb])
5240 AC_CONFIG_FILES([drd/tests/filter_stderr],
5241 [chmod +x drd/tests/filter_stderr])
5242 AC_CONFIG_FILES([drd/tests/filter_error_count],
5243 [chmod +x drd/tests/filter_error_count])
5244 AC_CONFIG_FILES([drd/tests/filter_error_summary],
5245 [chmod +x drd/tests/filter_error_summary])
5246 AC_CONFIG_FILES([drd/tests/filter_stderr_and_thread_no_and_offset],
5247 [chmod +x drd/tests/filter_stderr_and_thread_no_and_offset])
5248 AC_CONFIG_FILES([drd/tests/filter_thread_no],
5249 [chmod +x drd/tests/filter_thread_no])
5250 AC_CONFIG_FILES([drd/tests/filter_xml_and_thread_no],
5251 [chmod +x drd/tests/filter_xml_and_thread_no])
5252 AC_CONFIG_FILES([helgrind/tests/filter_stderr],
5253 [chmod +x helgrind/tests/filter_stderr])
5258 Maximum build arch: ${ARCH_MAX}
5259 Primary build arch: ${VGCONF_ARCH_PRI}
5260 Secondary build arch: ${VGCONF_ARCH_SEC}
5261 Build OS: ${VGCONF_OS}
5262 Link Time Optimisation: ${vg_cv_lto}
5263 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
5264 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
5265 Platform variant: ${VGCONF_PLATVARIANT}
5266 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
5267 Default supp files: ${DEFAULT_SUPP}