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.14.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 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 # provide a very basic definition for AC_PROG_SED if it's not provided by
49 # autoconf (as e.g. in autoconf 2.59).
50 m4_ifndef([AC_PROG_SED],
51 [AC_DEFUN([AC_PROG_SED],
53 AC_CHECK_PROGS([SED],[gsed sed])])])
56 # If no AR variable was specified, look up the name of the archiver. Otherwise
57 # do not touch the AR variable.
58 if test "x$AR" = "x"; then
59 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
61 AC_ARG_VAR([AR],[Archiver command])
63 # Check for the compiler support
64 if test "${GCC}" != "yes" ; then
65 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
68 # figure out where perl lives
69 AC_PATH_PROG(PERL, perl)
71 # figure out where gdb lives
72 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
73 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
75 # some older automake's don't have it so try something on our own
76 ifdef([AM_PROG_AS],[AM_PROG_AS],
86 # Check if 'diff' supports -u (universal diffs) and use it if possible.
88 AC_MSG_CHECKING([for diff -u])
91 # Comparing two identical files results in 0.
92 tmpfile="tmp-xxx-yyy-zzz"
94 if diff -u $tmpfile $tmpfile ; then
103 # Make sure we can compile in C99 mode.
105 if test "$ac_cv_prog_cc_c99" == "no"; then
106 AC_MSG_ERROR([Valgrind relies on a C compiler supporting C99])
109 # We don't want gcc < 3.0
110 AC_MSG_CHECKING([for a supported version of gcc])
112 # Obtain the compiler version.
114 # A few examples of how the ${CC} --version output looks like:
116 # ######## gcc variants ########
117 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
118 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
119 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
120 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
121 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
122 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
123 # 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)
125 # ######## clang variants ########
126 # Clang: clang version 2.9 (tags/RELEASE_29/final)
127 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
128 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
130 # ######## Apple LLVM variants ########
131 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
132 # Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
135 if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
138 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
139 elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
142 # Don't use -dumpversion with clang: it will always produce "4.2.1".
143 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
144 elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
147 gcc_version=`${CC} -dumpversion 2>/dev/null`
150 gcc_version=`${CC} -dumpversion 2>/dev/null`
151 if test "x$gcc_version" = x; then
152 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
156 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
157 AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
159 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
160 # statements have to be quoted.
161 case "${is_clang}-${gcc_version}" in
162 applellvm-5.1|applellvm-[[6-9]].*|applellvm-[[1-9][0-9]]*)
163 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
166 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
168 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
169 AC_MSG_RESULT([ok (${gcc_version})])
171 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
172 AC_MSG_RESULT([ok (clang-${gcc_version})])
175 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
176 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0 or Apple LLVM >= 5.1])
180 #----------------------------------------------------------------------------
181 # Arch/OS/platform tests.
182 #----------------------------------------------------------------------------
183 # We create a number of arch/OS/platform-related variables. We prefix them
184 # all with "VGCONF_" which indicates that they are defined at
185 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
186 # variables used when compiling C files.
190 AC_MSG_CHECKING([for a supported CPU])
192 # ARCH_MAX reflects the most that this CPU can do: for example if it
193 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
194 # Ditto for amd64. It is used for more configuration below, but is not used
197 # Power PC returns powerpc for Big Endian. This was not changed when Little
198 # Endian support was added to the 64-bit architecture. The 64-bit Little
199 # Endian systems explicitly state le in the host_cpu. For clarity in the
200 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianness of
201 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
202 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
203 # Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
204 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
205 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
208 case "${host_cpu}" in
210 AC_MSG_RESULT([ok (${host_cpu})])
215 AC_MSG_RESULT([ok (${host_cpu})])
220 # this only referrs to 64-bit Big Endian
221 AC_MSG_RESULT([ok (${host_cpu})])
226 # this only referrs to 64-bit Little Endian
227 AC_MSG_RESULT([ok (${host_cpu})])
232 # On Linux this means only a 32-bit capable CPU.
233 AC_MSG_RESULT([ok (${host_cpu})])
238 AC_MSG_RESULT([ok (${host_cpu})])
243 AC_MSG_RESULT([ok (${host_cpu})])
248 AC_MSG_RESULT([ok (${host_cpu})])
253 AC_MSG_RESULT([ok (${host_cpu})])
258 AC_MSG_RESULT([ok (${host_cpu})])
263 AC_MSG_RESULT([ok (${host_cpu})])
268 AC_MSG_RESULT([ok (${host_cpu})])
273 AC_MSG_RESULT([ok (${host_cpu})])
278 AC_MSG_RESULT([no (${host_cpu})])
279 AC_MSG_ERROR([Unsupported host architecture. Sorry])
283 #----------------------------------------------------------------------------
285 # Sometimes it's convenient to subvert the bi-arch build system and
286 # just have a single build even though the underlying platform is
287 # capable of both. Hence handle --enable-only64bit and
288 # --enable-only32bit. Complain if both are issued :-)
289 # [Actually, if either of these options are used, I think both get built,
290 # but only one gets installed. So if you use an in-place build, both can be
293 # Check if a 64-bit only build has been requested
294 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
295 [AC_ARG_ENABLE(only64bit,
296 [ --enable-only64bit do a 64-bit only build],
297 [vg_cv_only64bit=$enableval],
298 [vg_cv_only64bit=no])])
300 # Check if a 32-bit only build has been requested
301 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
302 [AC_ARG_ENABLE(only32bit,
303 [ --enable-only32bit do a 32-bit only build],
304 [vg_cv_only32bit=$enableval],
305 [vg_cv_only32bit=no])])
308 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
310 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
313 #----------------------------------------------------------------------------
315 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
316 # compilation of many C files via -VGO_$(VGCONF_OS) and
317 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
318 AC_MSG_CHECKING([for a supported OS])
325 AC_MSG_RESULT([ok (${host_os})])
328 # Ok, this is linux. Check the kernel version
329 AC_MSG_CHECKING([for the kernel version])
334 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
335 AC_MSG_RESULT([unsupported (${kernel})])
336 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
340 AC_MSG_RESULT([2.6 or later (${kernel})])
347 AC_MSG_RESULT([ok (${host_os})])
349 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
350 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
351 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
352 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
353 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
354 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
355 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
356 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
357 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
359 AC_MSG_CHECKING([for the kernel version])
362 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
363 # has only one relevant version, the OS version. The `uname` check
364 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
365 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
366 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
367 # and we don't know of an macros similar to __GLIBC__ to get that info.
369 # XXX: `uname -r` won't do the right thing for cross-compiles, but
370 # that's not a problem yet.
372 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
373 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
374 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
375 # time support for 10.5 (the 9.* pattern just below), I'll leave it
376 # in for now, just in case anybody wants to give it a try. But I'm
377 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
380 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
381 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
382 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
383 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
386 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
387 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
388 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
389 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
392 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
393 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
394 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
395 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
398 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
399 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
400 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
401 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
404 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
405 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
406 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
407 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
410 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
411 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
412 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
413 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
416 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
417 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
418 DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
419 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
422 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
423 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
424 DEFAULT_SUPP="darwin16.supp ${DEFAULT_SUPP}"
425 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
428 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
429 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
430 DEFAULT_SUPP="darwin17.supp ${DEFAULT_SUPP}"
431 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
434 AC_MSG_RESULT([unsupported (${kernel})])
435 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)])
441 AC_MSG_RESULT([ok (${host_os})])
444 uname_v=$( uname -v )
447 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
450 DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
456 AC_MSG_RESULT([ok (${host_os})])
458 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
462 AC_MSG_RESULT([no (${host_os})])
463 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
467 #----------------------------------------------------------------------------
469 # If we are building on a 64 bit platform test to see if the system
470 # supports building 32 bit programs and disable 32 bit support if it
471 # does not support building 32 bit programs
473 case "$ARCH_MAX-$VGCONF_OS" in
474 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
475 AC_MSG_CHECKING([for 32 bit build support])
478 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
483 vg_cv_only64bit="yes"
486 CFLAGS=$safe_CFLAGS;;
488 AC_MSG_CHECKING([for 32 bit build support])
490 CFLAGS="$CFLAGS -mips32 -mabi=32"
491 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
492 #include <sys/prctl.h>
496 vg_cv_only64bit="yes"
499 CFLAGS=$safe_CFLAGS;;
502 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
504 [--enable-only32bit was specified but system does not support 32 bit builds])
507 #----------------------------------------------------------------------------
509 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
510 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
511 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
512 # above) will be "amd64" since that reflects the most that this cpu can do,
513 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
514 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
515 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
516 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
517 AC_SUBST(VGCONF_ARCH_PRI)
519 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
520 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
521 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
522 # It is empty if there is no secondary target.
523 AC_SUBST(VGCONF_ARCH_SEC)
525 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
526 # The entire system, including regression and performance tests, will be
527 # built for this target. The "_CAPS" indicates that the name is in capital
528 # letters, and it also uses '_' rather than '-' as a separator, because it's
529 # used to create various Makefile variables, which are all in caps by
530 # convention and cannot contain '-' characters. This is in contrast to
531 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
532 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
534 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
535 # Valgrind and tools will also be built for this target, but not the
536 # regression or performance tests.
538 # By default, the primary arch is the same as the "max" arch, as commented
539 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
540 # the big case statement just below here, in the case where we're building
541 # on a 64 bit machine but have been requested only to do a 32 bit build.
542 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
544 AC_MSG_CHECKING([for a supported CPU/OS combination])
546 # NB. The load address for a given platform may be specified in more
547 # than one place, in some cases, depending on whether we're doing a biarch,
548 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
549 # Be careful to give consistent values in all subcases. Also, all four
550 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
551 # even if it is to "0xUNSET".
553 case "$ARCH_MAX-$VGCONF_OS" in
555 VGCONF_ARCH_PRI="x86"
557 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
558 VGCONF_PLATFORM_SEC_CAPS=""
559 valt_load_address_pri_norml="0x58000000"
560 valt_load_address_pri_inner="0x38000000"
561 valt_load_address_sec_norml="0xUNSET"
562 valt_load_address_sec_inner="0xUNSET"
563 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
566 valt_load_address_sec_norml="0xUNSET"
567 valt_load_address_sec_inner="0xUNSET"
568 if test x$vg_cv_only64bit = xyes; then
569 VGCONF_ARCH_PRI="amd64"
571 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
572 VGCONF_PLATFORM_SEC_CAPS=""
573 valt_load_address_pri_norml="0x58000000"
574 valt_load_address_pri_inner="0x38000000"
575 elif test x$vg_cv_only32bit = xyes; then
576 VGCONF_ARCH_PRI="x86"
578 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
579 VGCONF_PLATFORM_SEC_CAPS=""
580 valt_load_address_pri_norml="0x58000000"
581 valt_load_address_pri_inner="0x38000000"
583 VGCONF_ARCH_PRI="amd64"
584 VGCONF_ARCH_SEC="x86"
585 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
586 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
587 valt_load_address_pri_norml="0x58000000"
588 valt_load_address_pri_inner="0x38000000"
589 valt_load_address_sec_norml="0x58000000"
590 valt_load_address_sec_inner="0x38000000"
592 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
595 VGCONF_ARCH_PRI="ppc32"
597 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
598 VGCONF_PLATFORM_SEC_CAPS=""
599 valt_load_address_pri_norml="0x58000000"
600 valt_load_address_pri_inner="0x38000000"
601 valt_load_address_sec_norml="0xUNSET"
602 valt_load_address_sec_inner="0xUNSET"
603 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
606 valt_load_address_sec_norml="0xUNSET"
607 valt_load_address_sec_inner="0xUNSET"
608 if test x$vg_cv_only64bit = xyes; then
609 VGCONF_ARCH_PRI="ppc64be"
611 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
612 VGCONF_PLATFORM_SEC_CAPS=""
613 valt_load_address_pri_norml="0x58000000"
614 valt_load_address_pri_inner="0x38000000"
615 elif test x$vg_cv_only32bit = xyes; then
616 VGCONF_ARCH_PRI="ppc32"
618 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
619 VGCONF_PLATFORM_SEC_CAPS=""
620 valt_load_address_pri_norml="0x58000000"
621 valt_load_address_pri_inner="0x38000000"
623 VGCONF_ARCH_PRI="ppc64be"
624 VGCONF_ARCH_SEC="ppc32"
625 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
626 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
627 valt_load_address_pri_norml="0x58000000"
628 valt_load_address_pri_inner="0x38000000"
629 valt_load_address_sec_norml="0x58000000"
630 valt_load_address_sec_inner="0x38000000"
632 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
635 # Little Endian is only supported on PPC64
636 valt_load_address_sec_norml="0xUNSET"
637 valt_load_address_sec_inner="0xUNSET"
638 VGCONF_ARCH_PRI="ppc64le"
640 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
641 VGCONF_PLATFORM_SEC_CAPS=""
642 valt_load_address_pri_norml="0x58000000"
643 valt_load_address_pri_inner="0x38000000"
644 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
646 # Darwin gets identified as 32-bit even when it supports 64-bit.
647 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
648 # all Macs support both 32-bit and 64-bit, so we just build both. If
649 # someone has a really old 32-bit only machine they can (hopefully?)
650 # build with --enable-only32bit. See bug 243362.
651 x86-darwin|amd64-darwin)
653 valt_load_address_sec_norml="0xUNSET"
654 valt_load_address_sec_inner="0xUNSET"
655 if test x$vg_cv_only64bit = xyes; then
656 VGCONF_ARCH_PRI="amd64"
658 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
659 VGCONF_PLATFORM_SEC_CAPS=""
660 valt_load_address_pri_norml="0x158000000"
661 valt_load_address_pri_inner="0x138000000"
662 elif test x$vg_cv_only32bit = xyes; then
663 VGCONF_ARCH_PRI="x86"
665 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
666 VGCONF_PLATFORM_SEC_CAPS=""
667 VGCONF_ARCH_PRI_CAPS="x86"
668 valt_load_address_pri_norml="0x58000000"
669 valt_load_address_pri_inner="0x38000000"
671 VGCONF_ARCH_PRI="amd64"
672 VGCONF_ARCH_SEC="x86"
673 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
674 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
675 valt_load_address_pri_norml="0x158000000"
676 valt_load_address_pri_inner="0x138000000"
677 valt_load_address_sec_norml="0x58000000"
678 valt_load_address_sec_inner="0x38000000"
680 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
683 VGCONF_ARCH_PRI="arm"
684 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
685 VGCONF_PLATFORM_SEC_CAPS=""
686 valt_load_address_pri_norml="0x58000000"
687 valt_load_address_pri_inner="0x38000000"
688 valt_load_address_sec_norml="0xUNSET"
689 valt_load_address_sec_inner="0xUNSET"
690 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
693 valt_load_address_sec_norml="0xUNSET"
694 valt_load_address_sec_inner="0xUNSET"
695 if test x$vg_cv_only64bit = xyes; then
696 VGCONF_ARCH_PRI="arm64"
698 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
699 VGCONF_PLATFORM_SEC_CAPS=""
700 valt_load_address_pri_norml="0x58000000"
701 valt_load_address_pri_inner="0x38000000"
702 elif test x$vg_cv_only32bit = xyes; then
703 VGCONF_ARCH_PRI="arm"
705 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
706 VGCONF_PLATFORM_SEC_CAPS=""
707 valt_load_address_pri_norml="0x58000000"
708 valt_load_address_pri_inner="0x38000000"
710 VGCONF_ARCH_PRI="arm64"
711 VGCONF_ARCH_SEC="arm"
712 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
713 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
714 valt_load_address_pri_norml="0x58000000"
715 valt_load_address_pri_inner="0x38000000"
716 valt_load_address_sec_norml="0x58000000"
717 valt_load_address_sec_inner="0x38000000"
719 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
722 VGCONF_ARCH_PRI="s390x"
724 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
725 VGCONF_PLATFORM_SEC_CAPS=""
726 # To improve branch prediction hit rate we want to have
727 # the generated code close to valgrind (host) code
728 valt_load_address_pri_norml="0x800000000"
729 valt_load_address_pri_inner="0x810000000"
730 valt_load_address_sec_norml="0xUNSET"
731 valt_load_address_sec_inner="0xUNSET"
732 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
735 VGCONF_ARCH_PRI="mips32"
737 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
738 VGCONF_PLATFORM_SEC_CAPS=""
739 valt_load_address_pri_norml="0x58000000"
740 valt_load_address_pri_inner="0x38000000"
741 valt_load_address_sec_norml="0xUNSET"
742 valt_load_address_sec_inner="0xUNSET"
743 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
746 valt_load_address_sec_norml="0xUNSET"
747 valt_load_address_sec_inner="0xUNSET"
748 if test x$vg_cv_only64bit = xyes; then
749 VGCONF_ARCH_PRI="mips64"
750 VGCONF_PLATFORM_SEC_CAPS=""
751 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
752 VGCONF_PLATFORM_SEC_CAPS=""
753 valt_load_address_pri_norml="0x58000000"
754 valt_load_address_pri_inner="0x38000000"
755 elif test x$vg_cv_only32bit = xyes; then
756 VGCONF_ARCH_PRI="mips32"
758 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
759 VGCONF_PLATFORM_SEC_CAPS=""
760 valt_load_address_pri_norml="0x58000000"
761 valt_load_address_pri_inner="0x38000000"
763 VGCONF_ARCH_PRI="mips64"
764 VGCONF_ARCH_SEC="mips32"
765 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
766 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
767 valt_load_address_pri_norml="0x58000000"
768 valt_load_address_pri_inner="0x38000000"
769 valt_load_address_sec_norml="0x58000000"
770 valt_load_address_sec_inner="0x38000000"
772 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
775 VGCONF_ARCH_PRI="x86"
777 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
778 VGCONF_PLATFORM_SEC_CAPS=""
779 valt_load_address_pri_norml="0x58000000"
780 valt_load_address_pri_inner="0x38000000"
781 valt_load_address_sec_norml="0xUNSET"
782 valt_load_address_sec_inner="0xUNSET"
783 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
786 valt_load_address_sec_norml="0xUNSET"
787 valt_load_address_sec_inner="0xUNSET"
788 if test x$vg_cv_only64bit = xyes; then
789 VGCONF_ARCH_PRI="amd64"
791 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
792 VGCONF_PLATFORM_SEC_CAPS=""
793 valt_load_address_pri_norml="0x58000000"
794 valt_load_address_pri_inner="0x38000000"
795 elif test x$vg_cv_only32bit = xyes; then
796 VGCONF_ARCH_PRI="x86"
798 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
799 VGCONF_PLATFORM_SEC_CAPS=""
800 valt_load_address_pri_norml="0x58000000"
801 valt_load_address_pri_inner="0x38000000"
803 VGCONF_ARCH_PRI="amd64"
804 VGCONF_ARCH_SEC="x86"
805 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
806 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
807 valt_load_address_pri_norml="0x58000000"
808 valt_load_address_pri_inner="0x38000000"
809 valt_load_address_sec_norml="0x58000000"
810 valt_load_address_sec_inner="0x38000000"
812 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
815 VGCONF_ARCH_PRI="unknown"
816 VGCONF_ARCH_SEC="unknown"
817 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
818 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
819 valt_load_address_pri_norml="0xUNSET"
820 valt_load_address_pri_inner="0xUNSET"
821 valt_load_address_sec_norml="0xUNSET"
822 valt_load_address_sec_inner="0xUNSET"
823 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
824 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
828 #----------------------------------------------------------------------------
830 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
832 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
833 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
834 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
835 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
836 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
837 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
838 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
839 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
840 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
841 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
842 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
843 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
844 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
845 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
846 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
847 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
848 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
849 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
850 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
851 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
852 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
853 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
854 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
855 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
856 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
857 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
858 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
859 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
860 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
862 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
864 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
865 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
866 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
867 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
868 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
869 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
870 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
871 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
872 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
873 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
874 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
875 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
876 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
877 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
878 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
879 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
880 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
881 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
882 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
883 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
884 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
885 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
886 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
887 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
888 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
889 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
890 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
891 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
892 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
893 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
894 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
895 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
896 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
897 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
898 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
901 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
902 # Relies on the assumption that the primary and secondary targets are
903 # for the same OS, so therefore only necessary to test the primary.
904 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
905 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
906 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
907 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
908 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
909 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
910 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
911 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
912 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
913 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
914 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
915 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
916 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
917 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
918 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
919 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
920 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
923 # Sometimes, in the Makefile.am files, it's useful to know whether or not
924 # there is a secondary target.
925 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
926 test x$VGCONF_PLATFORM_SEC_CAPS != x)
928 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
929 dnl fallback definition
930 dnl The macro is courtesy of Dave Hart:
931 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
932 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
933 if test -z "$$1_TRUE"; then :
942 #----------------------------------------------------------------------------
944 #----------------------------------------------------------------------------
946 # Check if this should be built as an inner Valgrind, to be run within
947 # another Valgrind. Choose the load address accordingly.
948 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
949 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
950 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
951 [AC_ARG_ENABLE(inner,
952 [ --enable-inner enables self-hosting],
953 [vg_cv_inner=$enableval],
955 if test "$vg_cv_inner" = yes; then
956 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
957 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
958 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
960 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
961 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
964 #----------------------------------------------------------------------------
965 # Undefined behaviour sanitiser
966 #----------------------------------------------------------------------------
967 # Check whether we should build with the undefined beahviour sanitiser.
969 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
970 [AC_ARG_ENABLE(ubsan,
971 [ --enable-ubsan enables the undefined behaviour sanitiser],
972 [vg_cv_ubsan=$enableval],
975 #----------------------------------------------------------------------------
976 # Extra fine-tuning of installation directories
977 #----------------------------------------------------------------------------
979 [ --with-tmpdir=PATH Specify path for temporary files],
982 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
983 AC_SUBST(VG_TMPDIR, [$tmpdir])
986 #----------------------------------------------------------------------------
987 # Libc and suppressions
988 #----------------------------------------------------------------------------
989 # This variable will collect the suppression files to be used.
990 AC_SUBST(DEFAULT_SUPP)
992 AC_CHECK_HEADER([features.h])
994 if test x$ac_cv_header_features_h = xyes; then
995 rm -f conftest.$ac_ext
996 cat <<_ACEOF >conftest.$ac_ext
997 #include <features.h>
998 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
999 glibc version is: __GLIBC__ __GLIBC_MINOR__
1002 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1005 # not really a version check
1006 AC_EGREP_CPP([DARWIN_LIBC], [
1007 #include <sys/cdefs.h>
1008 #if defined(__DARWIN_VERS_1050)
1012 GLIBC_VERSION="darwin")
1014 # not really a version check
1015 AC_EGREP_CPP([BIONIC_LIBC], [
1016 #if defined(__ANDROID__)
1020 GLIBC_VERSION="bionic")
1022 # there is only one version of libc on Solaris
1023 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1024 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1025 GLIBC_VERSION="solaris"
1028 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1030 if test x$GLIBC_VERSION = x; then
1031 if $CC -dumpmachine | grep -q musl; then
1036 AC_MSG_CHECKING([the glibc version])
1038 case "${GLIBC_VERSION}" in
1040 AC_MSG_RESULT(${GLIBC_VERSION} family)
1041 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
1042 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1043 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1046 AC_MSG_RESULT(${GLIBC_VERSION} family)
1047 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1048 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1049 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1052 AC_MSG_RESULT(${GLIBC_VERSION} family)
1053 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1054 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1055 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1058 AC_MSG_RESULT(${GLIBC_VERSION} family)
1059 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1060 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1061 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1062 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1063 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1066 AC_MSG_RESULT(${GLIBC_VERSION} family)
1067 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1068 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1069 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1070 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1071 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1072 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1073 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1076 AC_MSG_RESULT(Darwin)
1077 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1078 # DEFAULT_SUPP set by kernel version check above.
1081 AC_MSG_RESULT(Bionic)
1082 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1083 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1086 AC_MSG_RESULT(Solaris)
1087 # DEFAULT_SUPP set in host_os switch-case above.
1088 # No other suppression file is used.
1092 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1093 # no DEFAULT_SUPP file yet for musl libc.
1096 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1097 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1098 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1102 AC_SUBST(GLIBC_VERSION)
1105 if test "$VGCONF_OS" != "solaris"; then
1106 # Add default suppressions for the X client libraries. Make no
1107 # attempt to detect whether such libraries are installed on the
1108 # build machine (or even if any X facilities are present); just
1109 # add the suppressions antidisirregardless.
1110 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1111 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
1113 # Add glibc and X11 suppressions for exp-sgcheck
1114 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1118 #----------------------------------------------------------------------------
1119 # Platform variants?
1120 #----------------------------------------------------------------------------
1122 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1123 # But there are times where we need a bit more control. The motivating
1124 # and currently only case is Android: this is almost identical to
1125 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1126 # platform variant tags, which get passed in the compile as
1127 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1129 # In almost all cases, the <variant> bit is "vanilla". But for Android
1130 # it is "android" instead.
1132 # Consequently (eg), plain arm-linux would build with
1134 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1136 # whilst an Android build would have
1138 # -DVGP_arm_linux -DVGPV_arm_linux_android
1140 # Same for x86. The setup of the platform variant is pushed relatively far
1141 # down this file in order that we can inspect any of the variables set above.
1143 # In the normal case ..
1144 VGCONF_PLATVARIANT="vanilla"
1147 if test "$GLIBC_VERSION" = "bionic";
1149 VGCONF_PLATVARIANT="android"
1152 AC_SUBST(VGCONF_PLATVARIANT)
1155 # FIXME: do we also want to define automake variables
1156 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1157 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1158 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1159 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1160 # that's what we'd need to do to use this, since what we'd want to write
1163 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1165 # Hmm. Can't think of a nice clean solution to this.
1167 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1168 test x$VGCONF_PLATVARIANT = xvanilla)
1169 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1170 test x$VGCONF_PLATVARIANT = xandroid)
1173 #----------------------------------------------------------------------------
1174 # Checking for various library functions and other definitions
1175 #----------------------------------------------------------------------------
1177 # Check for AT_FDCWD
1179 AC_MSG_CHECKING([for AT_FDCWD])
1180 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1187 ac_have_at_fdcwd=yes
1188 AC_MSG_RESULT([yes])
1194 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1196 # Check for stpncpy function definition in string.h
1197 # This explicitly checks with _GNU_SOURCE defined since that is also
1198 # used in the test case (some systems might define it without anyway
1199 # since stpncpy is part of The Open Group Base Specifications Issue 7
1200 # IEEE Std 1003.1-2008.
1201 AC_MSG_CHECKING([for stpncpy])
1202 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1209 char *r = stpncpy(d, s, n);
1211 ac_have_gnu_stpncpy=yes
1212 AC_MSG_RESULT([yes])
1214 ac_have_gnu_stpncpy=no
1218 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1220 # Check for PTRACE_GETREGS
1222 AC_MSG_CHECKING([for PTRACE_GETREGS])
1223 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1226 #include <sys/ptrace.h>
1227 #include <sys/user.h>
1230 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1232 AC_MSG_RESULT([yes])
1233 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1234 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1240 # Check for CLOCK_MONOTONIC
1242 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1244 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1248 clock_gettime(CLOCK_MONOTONIC, &t);
1251 AC_MSG_RESULT([yes])
1252 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1253 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1259 # Check for ELF32/64_CHDR
1261 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1264 # Check for PTHREAD_RWLOCK_T
1266 AC_MSG_CHECKING([for pthread_rwlock_t])
1268 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1270 #include <pthread.h>
1272 pthread_rwlock_t rwl;
1274 AC_MSG_RESULT([yes])
1275 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1276 [Define to 1 if you have the `pthread_rwlock_t' type.])
1282 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1284 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1286 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1288 #include <pthread.h>
1290 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1292 AC_MSG_RESULT([yes])
1293 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1294 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1300 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1302 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1306 #include <pthread.h>
1308 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1310 AC_MSG_RESULT([yes])
1311 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1312 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1318 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1320 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1322 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1324 #include <pthread.h>
1326 return (PTHREAD_MUTEX_RECURSIVE_NP);
1328 AC_MSG_RESULT([yes])
1329 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1330 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1336 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1338 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1340 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1342 #include <pthread.h>
1344 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1347 AC_MSG_RESULT([yes])
1348 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1349 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1355 # Check whether pthread_mutex_t has a member called __m_kind.
1357 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1358 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1360 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1363 [#include <pthread.h>])
1366 # Check whether pthread_mutex_t has a member called __data.__kind.
1368 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1369 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1371 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1374 [#include <pthread.h>])
1376 # Convenience function. Set flags based on the existing HWCAP entries.
1377 # The AT_HWCAP entries are generated by glibc, and are based on
1378 # functions supported by the hardware/system/libc.
1379 # Subsequent support for whether the capability will actually be utilized
1380 # will also be checked against the compiler capabilities.
1382 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1383 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1385 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1386 if LD_SHOW_AUXV=1 `which true` | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1388 AC_MSG_RESULT([yes])
1389 AC_SUBST([$2],[yes])
1396 # gather hardware capabilities. (hardware/kernel/libc)
1397 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1398 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1399 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1400 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1401 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1402 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1403 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1404 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1407 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1408 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1409 # compiler support for isa 2.07 level instructions
1410 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1411 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1413 __asm__ __volatile__("mtvsrd 1,2 ");
1415 ac_asm_have_isa_2_07=yes
1416 AC_MSG_RESULT([yes])
1418 ac_asm_have_isa_2_07=no
1421 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1422 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1424 # altivec (vsx) support.
1425 # does this compiler support -maltivec and does it have the include file
1427 AC_MSG_CHECKING([for Altivec support in the compiler ])
1429 CFLAGS="-maltivec -Werror"
1430 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1431 #include <altivec.h>
1433 vector unsigned int v;
1436 AC_MSG_RESULT([yes])
1442 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1443 -a x$HWCAP_HAS_ALTIVEC = xyes])
1445 # Check that both: the compiler supports -mvsx and that the assembler
1446 # understands VSX instructions. If either of those doesn't work,
1447 # conclude that we can't do VSX.
1448 AC_MSG_CHECKING([for VSX compiler flag support])
1450 CFLAGS="-mvsx -Werror"
1451 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1454 ac_compiler_supports_vsx_flag=yes
1455 AC_MSG_RESULT([yes])
1457 ac_compiler_supports_vsx_flag=no
1462 AC_MSG_CHECKING([for VSX support in the assembler ])
1464 CFLAGS="-mvsx -Werror"
1465 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1466 #include <altivec.h>
1468 vector unsigned int v;
1469 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1471 ac_compiler_supports_vsx=yes
1472 AC_MSG_RESULT([yes])
1474 ac_compiler_supports_vsx=no
1478 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1479 -a x$ac_compiler_supports_vsx = xyes \
1480 -a x$HWCAP_HAS_VSX = xyes ])
1482 # DFP (Decimal Float)
1483 AC_MSG_CHECKING([that assembler knows DFP])
1484 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1487 __asm__ __volatile__("adtr 1, 2, 3")
1489 __asm__ __volatile__("dadd 1, 2, 3");
1490 __asm__ __volatile__("dcffix 1, 2");
1494 AC_MSG_RESULT([yes])
1499 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1501 CFLAGS="-mhard-dfp -Werror"
1502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1505 __asm__ __volatile__("adtr 1, 2, 3")
1507 __asm__ __volatile__("dadd 1, 2, 3");
1508 __asm__ __volatile__("dcffix 1, 2");
1511 ac_compiler_have_dfp=yes
1512 AC_MSG_RESULT([yes])
1514 ac_compiler_have_dfp=no
1518 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1519 -a x$ac_compiler_have_dfp = xyes \
1520 -a x$HWCAP_HAS_DFP = xyes )
1522 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1525 _Decimal64 x = 0.0DD;
1527 ac_compiler_have_dfp_type=yes
1528 AC_MSG_RESULT([yes])
1530 ac_compiler_have_dfp_type=no
1533 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1534 -a x$HWCAP_HAS_DFP = xyes )
1537 # HTM (Hardware Transactional Memory)
1538 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1540 CFLAGS="-mhtm -Werror"
1541 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1545 AC_MSG_RESULT([yes])
1546 ac_compiler_supports_htm=yes
1549 ac_compiler_supports_htm=no
1553 AC_MSG_CHECKING([if compiler can find the htm builtins])
1555 CFLAGS="-mhtm -Werror"
1556 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1558 if (__builtin_tbegin (0))
1561 AC_MSG_RESULT([yes])
1562 ac_compiler_sees_htm_builtins=yes
1565 ac_compiler_sees_htm_builtins=no
1569 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1570 -a x$ac_compiler_sees_htm_builtins = xyes \
1571 -a x$HWCAP_HAS_HTM = xyes )
1574 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1578 __asm__ __volatile__("cnttzw 1,2 ");
1580 ac_asm_have_isa_3_00=yes
1581 AC_MSG_RESULT([yes])
1583 ac_asm_have_isa_3_00=no
1587 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
1588 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1590 # Check for pthread_create@GLIBC2.0
1591 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1594 CFLAGS="-lpthread -Werror"
1595 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1596 extern int pthread_create_glibc_2_0(void*, const void*,
1597 void *(*)(void*), void*);
1598 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1602 * Apparently on PowerPC linking this program succeeds and generates an
1603 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1605 #error This test does not work properly on PowerPC.
1607 pthread_create_glibc_2_0(0, 0, 0, 0);
1611 ac_have_pthread_create_glibc_2_0=yes
1612 AC_MSG_RESULT([yes])
1613 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1614 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1616 ac_have_pthread_create_glibc_2_0=no
1621 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1622 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1625 # Check for dlinfo RTLD_DI_TLS_MODID
1626 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1630 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1637 size_t sizes[10000];
1638 size_t modid_offset;
1639 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1642 ac_have_dlinfo_rtld_di_tls_modid=yes
1643 AC_MSG_RESULT([yes])
1644 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1645 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1647 ac_have_dlinfo_rtld_di_tls_modid=no
1652 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1653 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1656 # Check for eventfd_t, eventfd() and eventfd_read()
1657 AC_MSG_CHECKING([for eventfd()])
1659 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1660 #include <sys/eventfd.h>
1666 eventfd_read(fd, &ev);
1669 AC_MSG_RESULT([yes])
1670 AC_DEFINE([HAVE_EVENTFD], 1,
1671 [Define to 1 if you have the `eventfd' function.])
1672 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1673 [Define to 1 if you have the `eventfd_read' function.])
1678 # Check whether compiler can process #include <thread> without errors
1679 # clang 3.3 cannot process <thread> from e.g.
1680 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1682 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1684 safe_CXXFLAGS=$CXXFLAGS
1687 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1691 ac_cxx_can_include_thread_header=yes
1692 AC_MSG_RESULT([yes])
1694 ac_cxx_can_include_thread_header=no
1697 CXXFLAGS=$safe_CXXFLAGS
1700 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1703 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1704 # of the user_regs_struct from sys/user.h. They are structurally the same
1705 # but we get either one or the other.
1707 AC_CHECK_TYPE([struct user_regs_struct],
1708 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1709 [[#include <sys/ptrace.h>]
1710 [#include <sys/time.h>]
1711 [#include <sys/user.h>]])
1712 if test "$sys_user_has_user_regs" = "yes"; then
1713 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1714 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1718 #----------------------------------------------------------------------------
1719 # Checking for supported compiler flags.
1720 #----------------------------------------------------------------------------
1722 case "${host_cpu}" in
1724 # does this compiler support -march=mips32 (mips32 default) ?
1725 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
1728 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
1730 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1733 FLAG_M32="-mips32 -mabi=32"
1734 AC_MSG_RESULT([yes])
1744 # does this compiler support -march=mips64r2 (mips64r2 default) ?
1745 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
1748 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
1750 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1753 FLAG_M64="-march=mips64r2 -mabi=64"
1754 AC_MSG_RESULT([yes])
1764 # does this compiler support -m32 ?
1765 AC_MSG_CHECKING([if gcc accepts -m32])
1768 CFLAGS="-m32 -Werror"
1770 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1774 AC_MSG_RESULT([yes])
1784 # does this compiler support -m64 ?
1785 AC_MSG_CHECKING([if gcc accepts -m64])
1788 CFLAGS="-m64 -Werror"
1790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1794 AC_MSG_RESULT([yes])
1805 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1806 AC_MSG_CHECKING([if gcc accepts -march=octeon])
1809 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
1811 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1814 FLAG_OCTEON="-march=octeon"
1815 AC_MSG_RESULT([yes])
1822 AC_SUBST(FLAG_OCTEON)
1825 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1826 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1829 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
1831 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1834 FLAG_OCTEON2="-march=octeon2"
1835 AC_MSG_RESULT([yes])
1842 AC_SUBST(FLAG_OCTEON2)
1845 # does this compiler support -mmsa (MIPS MSA ASE) ?
1846 AC_MSG_CHECKING([if gcc accepts -mmsa])
1849 CFLAGS="$CFLAGS -mmsa -Werror"
1851 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1855 AC_MSG_RESULT([yes])
1865 # does this compiler support -mmmx ?
1866 AC_MSG_CHECKING([if gcc accepts -mmmx])
1869 CFLAGS="-mmmx -Werror"
1871 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1875 AC_MSG_RESULT([yes])
1885 # does this compiler support -msse ?
1886 AC_MSG_CHECKING([if gcc accepts -msse])
1889 CFLAGS="-msse -Werror"
1891 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1895 AC_MSG_RESULT([yes])
1905 # does this compiler support -mpreferred-stack-boundary=2 when
1906 # generating code for a 32-bit target? Note that we only care about
1907 # this when generating code for (32-bit) x86, so if the compiler
1908 # doesn't recognise -m32 it's no big deal. We'll just get code for
1909 # the Memcheck and other helper functions, that is a bit slower than
1910 # it could be, on x86; and no difference at all on any other platform.
1911 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
1914 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
1916 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1919 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
1920 AC_MSG_RESULT([yes])
1922 PREFERRED_STACK_BOUNDARY_2=""
1927 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
1930 # does this compiler support -mlong-double-128 ?
1931 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
1933 CFLAGS="-mlong-double-128 -Werror"
1934 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1937 ac_compiler_supports_mlong_double_128=yes
1938 AC_MSG_RESULT([yes])
1940 ac_compiler_supports_mlong_double_128=no
1944 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
1945 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
1946 AC_SUBST(FLAG_MLONG_DOUBLE_128)
1949 # Convenience function to check whether GCC supports a particular
1950 # warning option. Takes two arguments,
1951 # first the warning flag name to check (without -W), then the
1952 # substitution name to set with -Wno-warning-flag if the flag exists,
1953 # or the empty string if the compiler doesn't accept the flag. Note
1954 # that checking is done against the warning flag itself, but the
1955 # substitution is then done to cancel the warning flag.
1956 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
1957 AC_MSG_CHECKING([if gcc accepts -W$1])
1959 CFLAGS="-W$1 -Werror"
1960 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1961 AC_SUBST([$2], [-Wno-$1])
1962 AC_MSG_RESULT([yes])], [
1964 AC_MSG_RESULT([no])])
1968 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
1969 # -W$1 (instead of -Wno-$1).
1970 AC_DEFUN([AC_GCC_WARNING_SUBST],[
1971 AC_MSG_CHECKING([if gcc accepts -W$1])
1973 CFLAGS="-W$1 -Werror"
1974 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1975 AC_SUBST([$2], [-W$1])
1976 AC_MSG_RESULT([yes])], [
1978 AC_MSG_RESULT([no])])
1982 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
1983 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1984 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
1985 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
1986 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
1987 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1988 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
1989 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
1990 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
1991 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
1992 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
1993 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
1994 # Disabled for now until all platforms are clean
1995 format_checking_enabled=no
1996 #format_checking_enabled=yes
1997 if test "$format_checking_enabled" = "yes"; then
1998 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
2000 dumy_assignment_to_avoid_syntax_errors=1
2001 AC_SUBST([FLAG_W_FORMAT_SIGNEDNESS], [])
2003 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
2004 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2005 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2006 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2007 AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
2009 # Does this compiler support -Wformat-security ?
2010 # Special handling is needed, because certain GCC versions require -Wformat
2011 # being present if -Wformat-security is given. Otherwise a warning is issued.
2012 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2013 # And with that the warning will be turned into an error with the result
2014 # that -Wformat-security is believed to be unsupported when in fact it is.
2015 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2017 CFLAGS="-Wformat -Wformat-security -Werror"
2018 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2019 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2020 AC_MSG_RESULT([yes])], [
2021 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2022 AC_MSG_RESULT([no])])
2025 # does this compiler support -Wextra or the older -W ?
2027 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2030 CFLAGS="-Wextra -Werror"
2032 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2035 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2036 AC_MSG_RESULT([-Wextra])
2039 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2042 AC_SUBST([FLAG_W_EXTRA], [-W])
2045 AC_SUBST([FLAG_W_EXTRA], [])
2046 AC_MSG_RESULT([not supported])
2051 # On ARM we do not want to pass -Wcast-align as that produces loads
2052 # of warnings. GCC is just being conservative. See here:
2053 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2054 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2055 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2057 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2060 # does this compiler support -faligned-new ?
2061 AC_MSG_CHECKING([if g++ accepts -faligned-new])
2063 safe_CXXFLAGS=$CXXFLAGS
2064 CXXFLAGS="-faligned-new -Werror"
2067 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2070 FLAG_FALIGNED_NEW="-faligned-new"
2071 AC_MSG_RESULT([yes])
2073 FLAG_FALIGNED_NEW=""
2076 CXXFLAGS=$safe_CXXFLAGS
2079 AC_SUBST(FLAG_FALIGNED_NEW)
2081 # does this compiler support -fno-stack-protector ?
2082 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2085 CFLAGS="-fno-stack-protector -Werror"
2087 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2090 no_stack_protector=yes
2091 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2092 AC_MSG_RESULT([yes])
2094 no_stack_protector=no
2095 FLAG_FNO_STACK_PROTECTOR=""
2100 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2102 # Does GCC support disabling Identical Code Folding?
2103 # We want to disabled Identical Code Folding for the
2104 # tools preload shared objects to get better backraces.
2105 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2106 # "The optimization reduces code size and may disturb
2107 # unwind stacks by replacing a function by equivalent
2108 # one with a different name."
2109 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2112 CFLAGS="-fno-ipa-icf -Werror"
2114 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2118 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2119 AC_MSG_RESULT([yes])
2127 AC_SUBST(FLAG_FNO_IPA_ICF)
2130 # Does this compiler support -fsanitize=undefined. This is true for
2131 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2132 # also checks for alignment violations on memory accesses which the valgrind
2133 # code base is sprinkled (if not littered) with. As those alignment issues
2134 # don't pose a problem we want to suppress warnings about them.
2135 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2136 # GCCs do not support that.
2138 # Only checked for if --enable-ubsan was given.
2139 if test "x${vg_cv_ubsan}" = "xyes"; then
2140 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2142 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2143 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2146 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2147 LIB_UBSAN="-static-libubsan"
2148 AC_MSG_RESULT([yes])
2150 CFLAGS="-fsanitize=undefined -Werror"
2151 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2154 FLAG_FSANITIZE="-fsanitize=undefined"
2155 LIB_UBSAN="-static-libubsan"
2156 AC_MSG_RESULT([yes])
2164 AC_SUBST(FLAG_FSANITIZE)
2167 # does this compiler support --param inline-unit-growth=... ?
2169 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2172 CFLAGS="--param inline-unit-growth=900 -Werror"
2174 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2177 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2178 ["--param inline-unit-growth=900"])
2179 AC_MSG_RESULT([yes])
2181 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2187 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2189 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2192 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2194 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2198 AC_MSG_RESULT([yes])
2203 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2207 # does this compiler support -g -gz=zlib ?
2209 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2212 CFLAGS="-g -gz=zlib"
2214 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2218 AC_MSG_RESULT([yes])
2223 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2227 # does this compiler support -g -gz=zlib-gnu ?
2229 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2232 CFLAGS="-g -gz=zlib-gnu"
2234 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2237 ac_have_gz_zlib_gnu=yes
2238 AC_MSG_RESULT([yes])
2240 ac_have_gz_zlib_gnu=no
2243 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2247 # does this compiler support nested functions ?
2249 AC_MSG_CHECKING([if gcc accepts nested functions])
2251 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2252 int foo() { return 1; }
2255 ac_have_nested_functions=yes
2256 AC_MSG_RESULT([yes])
2258 ac_have_nested_functions=no
2261 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2264 # does this compiler support the 'p' constraint in ASM statements ?
2266 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2268 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2270 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2272 ac_have_asm_constraint_p=yes
2273 AC_MSG_RESULT([yes])
2275 ac_have_asm_constraint_p=no
2278 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2281 # Does this compiler and linker support -pie?
2282 # Some compilers actually do not support -pie and report its usage
2283 # as an error. We need to check if it is safe to use it first.
2285 AC_MSG_CHECKING([if gcc accepts -pie])
2290 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2293 AC_SUBST([FLAG_PIE], ["-pie"])
2294 AC_MSG_RESULT([yes])
2296 AC_SUBST([FLAG_PIE], [""])
2302 # Does this compiler support -no-pie?
2303 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2304 # default. However this gets in the way with some tests, we use -no-pie
2307 AC_MSG_CHECKING([if gcc accepts -no-pie])
2312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2315 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
2316 AC_MSG_RESULT([yes])
2318 AC_SUBST([FLAG_NO_PIE], [""])
2324 # We want to use use the -Ttext-segment option to the linker.
2325 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
2326 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2327 # semantics are NOT what we want (GNU gold -Ttext is fine).
2329 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2330 # will reside. -Ttext aligns just the .text section start (but not any
2333 # So test for -Ttext-segment which is supported by all bfd ld versions
2334 # and use that if it exists. If it doesn't exist it must be an older
2335 # version of gold and we can fall back to using -Ttext which has the
2338 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
2341 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
2344 [AC_LANG_SOURCE([int _start () { return 0; }])],
2346 linker_using_t_text="no"
2347 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
2348 AC_MSG_RESULT([yes])
2350 linker_using_t_text="yes"
2351 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
2356 # If the linker only supports -Ttext (not -Ttext-segment) then we will
2357 # have to strip any build-id ELF NOTEs from the statically linked tools.
2358 # Otherwise the build-id NOTE might end up at the default load address.
2359 # (Pedantically if the linker is gold then -Ttext is fine, but newer
2360 # gold versions also support -Ttext-segment. So just assume that unless
2361 # we can use -Ttext-segment we need to strip the build-id NOTEs.
2362 if test "x${linker_using_t_text}" = "xyes"; then
2363 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
2364 # does the linker support -Wl,--build-id=none ? Note, it's
2365 # important that we test indirectly via whichever C compiler
2366 # is selected, rather than testing /usr/bin/ld or whatever
2368 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
2370 CFLAGS="-Wl,--build-id=none -Werror"
2373 [AC_LANG_PROGRAM([ ], [return 0;])],
2375 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
2376 AC_MSG_RESULT([yes])
2378 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2382 AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
2383 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2387 # does the ppc assembler support "mtocrf" et al?
2388 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
2390 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2391 __asm__ __volatile__("mtocrf 4,0");
2392 __asm__ __volatile__("mfocrf 0,4");
2394 ac_have_as_ppc_mftocrf=yes
2395 AC_MSG_RESULT([yes])
2397 ac_have_as_ppc_mftocrf=no
2400 if test x$ac_have_as_ppc_mftocrf = xyes ; then
2401 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2405 # does the ppc assembler support "lfdp" and other phased out floating point insns?
2406 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2408 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2409 do { typedef struct {
2413 dbl_pair_t dbl_pair[3];
2414 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2417 ac_have_as_ppc_fpPO=yes
2418 AC_MSG_RESULT([yes])
2420 ac_have_as_ppc_fpPO=no
2423 if test x$ac_have_as_ppc_fpPO = xyes ; then
2424 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2428 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
2429 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
2431 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2433 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
2434 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
2436 ac_have_as_amd64_fxsave64=yes
2437 AC_MSG_RESULT([yes])
2439 ac_have_as_amd64_fxsave64=no
2442 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
2443 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
2446 # does the x86/amd64 assembler understand SSE3 instructions?
2447 # Note, this doesn't generate a C-level symbol. It generates a
2448 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
2449 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2451 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2452 do { long long int x;
2453 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2457 AC_MSG_RESULT([yes])
2463 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
2466 # Ditto for SSSE3 instructions (note extra S)
2467 # Note, this doesn't generate a C-level symbol. It generates a
2468 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2469 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2471 save_CFLAGS="$CFLAGS"
2472 CFLAGS="$CFLAGS -msse -Werror"
2473 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2474 do { long long int x;
2475 __asm__ __volatile__(
2476 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2479 ac_have_as_ssse3=yes
2480 AC_MSG_RESULT([yes])
2485 CFLAGS="$save_CFLAGS"
2487 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2490 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2491 # Note, this doesn't generate a C-level symbol. It generates a
2492 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
2493 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
2494 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2496 __asm__ __volatile__(
2497 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2500 ac_have_as_pclmulqdq=yes
2501 AC_MSG_RESULT([yes])
2503 ac_have_as_pclmulqdq=no
2507 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2510 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2511 # Note, this doesn't generate a C-level symbol. It generates a
2512 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2513 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2514 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2517 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2518 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2519 * xmm2 should be used.
2521 __asm__ __volatile__(
2522 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2525 ac_have_as_vpclmulqdq=yes
2526 AC_MSG_RESULT([yes])
2528 ac_have_as_vpclmulqdq=no
2532 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2535 # does the x86/amd64 assembler understand FMA4 instructions?
2536 # Note, this doesn't generate a C-level symbol. It generates a
2537 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
2538 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
2539 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2541 __asm__ __volatile__(
2542 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
2545 ac_have_as_vfmaddpd=yes
2546 AC_MSG_RESULT([yes])
2548 ac_have_as_vfmaddpd=no
2552 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
2555 # does the x86/amd64 assembler understand the LZCNT instruction?
2556 # Note, this doesn't generate a C-level symbol. It generates a
2557 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
2558 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2560 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2562 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
2565 ac_have_as_lzcnt=yes
2566 AC_MSG_RESULT([yes])
2572 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2575 # does the x86/amd64 assembler understand the LOOPNEL instruction?
2576 # Note, this doesn't generate a C-level symbol. It generates a
2577 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2578 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2580 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2582 __asm__ __volatile__("1: loopnel 1b\n");
2585 ac_have_as_loopnel=yes
2586 AC_MSG_RESULT([yes])
2588 ac_have_as_loopnel=no
2592 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2595 # does the x86/amd64 assembler understand ADDR32 ?
2596 # Note, this doesn't generate a C-level symbol. It generates a
2597 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2598 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2600 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2602 asm volatile ("addr32 rep movsb");
2605 ac_have_as_addr32=yes
2606 AC_MSG_RESULT([yes])
2608 ac_have_as_addr32=no
2612 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2615 # does the x86/amd64 assembler understand SSE 4.2 instructions?
2616 # Note, this doesn't generate a C-level symbol. It generates a
2617 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2618 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2620 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2621 do { long long int x;
2622 __asm__ __volatile__(
2623 "crc32q %%r15,%%r15" : : : "r15" );
2624 __asm__ __volatile__(
2625 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2626 __asm__ __volatile__(
2627 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
2630 ac_have_as_sse42=yes
2631 AC_MSG_RESULT([yes])
2637 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2640 # does the x86/amd64 assembler understand AVX instructions?
2641 # Note, this doesn't generate a C-level symbol. It generates a
2642 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2643 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2645 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2646 do { long long int x;
2647 __asm__ __volatile__(
2648 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2649 __asm__ __volatile__(
2650 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2654 AC_MSG_RESULT([yes])
2660 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2663 # does the x86/amd64 assembler understand AVX2 instructions?
2664 # Note, this doesn't generate a C-level symbol. It generates a
2665 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2666 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2668 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2669 do { long long int x;
2670 __asm__ __volatile__(
2671 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2672 __asm__ __volatile__(
2673 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2677 AC_MSG_RESULT([yes])
2683 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2686 # does the x86/amd64 assembler understand TSX instructions and
2687 # the XACQUIRE/XRELEASE prefixes?
2688 # Note, this doesn't generate a C-level symbol. It generates a
2689 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2690 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2692 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2694 __asm__ __volatile__(
2697 " xacquire lock incq 0(%rsp) \n\t"
2698 " xrelease lock incq 0(%rsp) \n"
2703 AC_MSG_RESULT([yes])
2709 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2712 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2713 # Note, this doesn't generate a C-level symbol. It generates a
2714 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2715 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2717 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2718 do { unsigned int h, l;
2719 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
2720 __asm__ __volatile__(
2721 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
2722 __asm__ __volatile__(
2723 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
2727 AC_MSG_RESULT([yes])
2733 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2736 # does the x86/amd64 assembler understand FMA instructions?
2737 # Note, this doesn't generate a C-level symbol. It generates a
2738 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2739 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2741 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2742 do { unsigned int h, l;
2743 __asm__ __volatile__(
2744 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2745 __asm__ __volatile__(
2746 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2747 __asm__ __volatile__(
2748 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2752 AC_MSG_RESULT([yes])
2758 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2761 # does the amd64 assembler understand MPX instructions?
2762 # Note, this doesn't generate a C-level symbol. It generates a
2763 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2764 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2766 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2768 asm ("bndmov %bnd0,(%rsp)");
2769 asm ("bndldx 3(%rbx,%rdx), %bnd2");
2770 asm ("bnd call foo\n"
2777 AC_MSG_RESULT([yes])
2783 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2786 # does the amd64 assembler understand ADX instructions?
2787 # Note, this doesn't generate a C-level symbol. It generates a
2788 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
2789 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
2791 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2793 asm ("adcxq %r14,%r8");
2797 AC_MSG_RESULT([yes])
2803 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
2806 # Does the C compiler support the "ifunc" attribute
2807 # Note, this doesn't generate a C-level symbol. It generates a
2808 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2809 # does the x86/amd64 assembler understand MOVBE?
2810 # Note, this doesn't generate a C-level symbol. It generates a
2811 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2812 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2814 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2815 do { long long int x;
2816 __asm__ __volatile__(
2817 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
2820 ac_have_as_movbe=yes
2821 AC_MSG_RESULT([yes])
2827 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2830 # Does the C compiler support the "ifunc" attribute
2831 # Note, this doesn't generate a C-level symbol. It generates a
2832 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2833 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2835 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2836 static void mytest(void) {}
2838 static void (*resolve_test(void))(void)
2840 return (void (*)(void))&mytest;
2843 void test(void) __attribute__((ifunc("resolve_test")));
2851 ac_have_ifunc_attr=yes
2852 AC_MSG_RESULT([yes])
2854 ac_have_ifunc_attr=no
2858 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2860 # Does the C compiler support the armv8 crc feature flag
2861 # Note, this doesn't generate a C-level symbol. It generates a
2862 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
2863 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
2865 save_CFLAGS="$CFLAGS"
2866 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
2867 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2873 ac_have_armv8_crc_feature=yes
2874 AC_MSG_RESULT([yes])
2876 ac_have_armv8_crc_feature=no
2879 CFLAGS="$save_CFLAGS"
2881 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
2884 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2885 # when building the tool executables. I think we should get rid of it.
2887 # Check for TLS support in the compiler and linker
2888 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2890 [vg_cv_linktime_tls=yes],
2891 [vg_cv_linktime_tls=no])
2892 # Native compilation: check whether running a program using TLS succeeds.
2893 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2894 # succeeds but running programs using TLS fails.
2895 # Cross-compiling: check whether linking a program using TLS succeeds.
2896 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2897 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2898 [vg_cv_tls=$enableval],
2899 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2903 [vg_cv_tls=$vg_cv_linktime_tls])])])
2905 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
2906 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2910 #----------------------------------------------------------------------------
2911 # Solaris-specific checks.
2912 #----------------------------------------------------------------------------
2914 if test "$VGCONF_OS" = "solaris" ; then
2915 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
2917 # Solaris-specific check determining if the Sun Studio Assembler is used to
2918 # build Valgrind. The test checks if the x86/amd64 assembler understands the
2919 # cmovl.l instruction, if yes then it's Sun Assembler.
2921 # C-level symbol: none
2922 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
2924 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
2925 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2927 __asm__ __volatile__("cmovl.l %edx, %eax");
2929 solaris_have_sun_studio_as=yes
2930 AC_MSG_RESULT([yes])
2932 solaris_have_sun_studio_as=no
2935 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
2937 # Solaris-specific check determining if symbols __xpg4 and __xpg6
2938 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
2939 # See solaris/vgpreload-solaris.mapfile for details.
2940 # gcc on older Solaris instructs linker to include these symbols,
2941 # gcc on illumos and newer Solaris does not.
2943 # C-level symbol: none
2944 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
2946 save_CFLAGS="$CFLAGS"
2947 CFLAGS="$CFLAGS -std=gnu99"
2948 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
2949 temp_dir=$( /usr/bin/mktemp -d )
2950 cat <<_ACEOF >${temp_dir}/mylib.c
2952 int myfunc(void) { printf("LaPutyka\n"); }
2954 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
2955 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
2956 if test "x${xpg_present}" = "x" ; then
2957 solaris_xpg_symbols_present=no
2960 solaris_xpg_symbols_present=yes
2961 AC_MSG_RESULT([yes])
2964 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
2965 CFLAGS="$save_CFLAGS"
2968 # Solaris-specific check determining if gcc enables largefile support by
2969 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
2970 # variable with gcc flags which disable it.
2972 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
2973 save_CFLAGS="$CFLAGS"
2974 CFLAGS="$CFLAGS -m32"
2975 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2976 return _LARGEFILE_SOURCE;
2978 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
2979 AC_MSG_RESULT([yes])
2981 SOLARIS_UNDEF_LARGESOURCE=""
2985 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
2988 # Solaris-specific check determining if /proc/self/cmdline
2989 # or /proc/<pid>/cmdline is supported.
2991 # C-level symbol: SOLARIS_PROC_CMDLINE
2992 # Automake-level symbol: SOLARIS_PROC_CMDLINE
2994 AC_CHECK_FILE([/proc/self/cmdline],
2996 solaris_proc_cmdline=yes
2997 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
2998 [Define to 1 if you have /proc/self/cmdline.])
3000 solaris_proc_cmdline=no
3002 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
3005 # Solaris-specific check determining default platform for the Valgrind launcher.
3006 # Used in case the launcher cannot select platform by looking at the client
3007 # image (for example because the executable is a shell script).
3009 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
3010 # Automake-level symbol: none
3012 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
3013 # Get the ELF class of /bin/sh first.
3014 if ! test -f /bin/sh; then
3015 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
3017 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
3018 case "$elf_class" in
3020 default_arch="$VGCONF_ARCH_PRI";
3023 if test "x$VGCONF_ARCH_SEC" != "x"; then
3024 default_arch="$VGCONF_ARCH_SEC"
3026 default_arch="$VGCONF_ARCH_PRI";
3030 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3033 default_platform="$default_arch-$VGCONF_OS"
3034 AC_MSG_RESULT([$default_platform])
3035 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3036 [Default platform for Valgrind launcher.])
3039 # Solaris-specific check determining if the old syscalls are available.
3041 # C-level symbol: SOLARIS_OLD_SYSCALLS
3042 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3044 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3045 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3046 #include <sys/syscall.h>
3050 solaris_old_syscalls=yes
3051 AC_MSG_RESULT([yes])
3052 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3053 [Define to 1 if you have the old Solaris syscalls.])
3055 solaris_old_syscalls=no
3058 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
3061 # Solaris-specific check determining if the new accept() syscall is available.
3064 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3067 # New syscall (available on illumos):
3068 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3069 # int version, int flags);
3071 # If the old syscall is present then the following syscall will fail with
3072 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
3073 # available then it will fail with EINVAL (because the flags parameter is
3076 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
3077 # Automake-level symbol: none
3079 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
3080 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3081 #include <sys/syscall.h>
3085 syscall(SYS_accept, 0, 0, 0, 0, -1);
3086 return !(errno == EINVAL);
3088 AC_MSG_RESULT([yes])
3089 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
3090 [Define to 1 if you have the new `accept' syscall.])
3096 # Solaris-specific check determining if the new illumos pipe() syscall is
3100 # longlong_t pipe();
3102 # New syscall (available on illumos):
3103 # int pipe(intptr_t arg, int flags);
3105 # If the old syscall is present then the following call will succeed, if the
3106 # new syscall is available then it will fail with EFAULT (because address 0
3107 # cannot be accessed).
3109 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
3110 # Automake-level symbol: none
3112 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
3113 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3114 #include <sys/syscall.h>
3118 syscall(SYS_pipe, 0, 0);
3119 return !(errno == EFAULT);
3121 AC_MSG_RESULT([yes])
3122 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3123 [Define to 1 if you have the new `pipe' syscall.])
3129 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
3133 # int lwp_kill(id_t lwpid, int sig);
3135 # New syscall (available on Solaris 11):
3136 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3137 # int si_code, timespec_t *timeout);
3139 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3140 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3142 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3143 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3144 #include <sys/syscall.h>
3146 return !SYS_lwp_sigqueue;
3148 solaris_lwp_sigqueue_syscall=yes
3149 AC_MSG_RESULT([yes])
3150 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
3151 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
3153 solaris_lwp_sigqueue_syscall=no
3156 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3159 # Solaris-specific check determining if the lwp_sigqueue() syscall
3160 # takes both pid and thread id arguments or just thread id.
3162 # Old syscall (available up to Solaris 11.3):
3163 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3164 # int si_code, timespec_t *timeout);
3166 # New syscall (available since Solaris 11.4):
3167 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
3168 # int si_code, timespec_t *timeout);
3170 # If the old syscall is present then the following syscall will fail with
3171 # EINVAL (because signal is out of range); if the new syscall is available
3172 # then it will fail with ESRCH (because it would not find such thread in the
3175 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3176 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3178 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
3179 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
3180 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3181 #include <sys/syscall.h>
3185 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
3186 return !(errno == ESRCH);
3188 solaris_lwp_sigqueue_syscall_takes_pid=yes
3189 AC_MSG_RESULT([yes])
3190 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
3191 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
3193 solaris_lwp_sigqueue_syscall_takes_pid=no
3196 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
3197 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
3199 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
3203 # Solaris-specific check determining if the new lwp_name() syscall is
3206 # New syscall (available on Solaris 11):
3207 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
3209 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
3210 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
3212 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
3213 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3214 #include <sys/syscall.h>
3216 return !SYS_lwp_name;
3218 solaris_lwp_name_syscall=yes
3219 AC_MSG_RESULT([yes])
3220 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
3221 [Define to 1 if you have the new `lwp_name' syscall.])
3223 solaris_lwp_name_syscall=no
3226 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
3229 # Solaris-specific check determining if the new getrandom() syscall is
3232 # New syscall (available on Solaris 11):
3233 # int getrandom(void *buf, size_t buflen, uint_t flags);
3235 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
3236 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
3238 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
3239 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3240 #include <sys/syscall.h>
3242 return !SYS_getrandom;
3244 solaris_getrandom_syscall=yes
3245 AC_MSG_RESULT([yes])
3246 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
3247 [Define to 1 if you have the new `getrandom' syscall.])
3249 solaris_getrandom_syscall=no
3252 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
3255 # Solaris-specific check determining if the new zone() syscall subcodes
3256 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
3257 # were added in Solaris 11 but are missing on illumos.
3259 # C-level symbol: SOLARIS_ZONE_DEFUNCT
3260 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
3262 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
3263 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3264 #include <sys/zone.h>
3266 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
3268 solaris_zone_defunct=yes
3269 AC_MSG_RESULT([yes])
3270 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
3271 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
3273 solaris_zone_defunct=no
3276 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
3279 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
3280 # for auditon(2) subcode of the auditsys() syscall are available.
3281 # These commands are available in Solaris 11 and illumos but were removed
3284 # C-level symbol: SOLARIS_AUDITON_STAT
3285 # Automake-level symbol: SOLARIS_AUDITON_STAT
3287 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
3288 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3289 #include <bsm/audit.h>
3291 return !(A_GETSTAT && A_SETSTAT);
3293 solaris_auditon_stat=yes
3294 AC_MSG_RESULT([yes])
3295 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
3296 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
3298 solaris_auditon_stat=no
3301 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
3304 # Solaris-specific check determining if the new shmsys() syscall subcodes
3305 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
3306 # These subcodes were added in Solaris 11 but are missing on illumos.
3308 # C-level symbol: SOLARIS_SHM_NEW
3309 # Automake-level symbol: SOLARIS_SHM_NEW
3311 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
3312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3313 #include <sys/ipc_impl.h>
3314 #include <sys/shm.h>
3315 #include <sys/shm_impl.h>
3317 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
3320 AC_MSG_RESULT([yes])
3321 AC_DEFINE([SOLARIS_SHM_NEW], 1,
3322 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
3327 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
3330 # Solaris-specific check determining if prxregset_t is available. Illumos
3331 # currently does not define it on the x86 platform.
3333 # C-level symbol: SOLARIS_PRXREGSET_T
3334 # Automake-level symbol: SOLARIS_PRXREGSET_T
3336 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
3337 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3338 #include <sys/procfs_isa.h>
3340 return !sizeof(prxregset_t);
3342 solaris_prxregset_t=yes
3343 AC_MSG_RESULT([yes])
3344 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
3345 [Define to 1 if you have the `prxregset_t' type.])
3347 solaris_prxregset_t=no
3350 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
3353 # Solaris-specific check determining if the new frealpathat() syscall is
3356 # New syscall (available on Solaris 11.1):
3357 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
3359 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3360 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3362 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
3363 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3364 #include <sys/syscall.h>
3366 return !SYS_frealpathat;
3368 solaris_frealpathat_syscall=yes
3369 AC_MSG_RESULT([yes])
3370 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
3371 [Define to 1 if you have the new `frealpathat' syscall.])
3373 solaris_frealpathat_syscall=no
3376 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
3379 # Solaris-specific check determining if the new uuidsys() syscall is
3382 # New syscall (available on newer Solaris):
3383 # int uuidsys(struct uuid *uuid);
3385 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
3386 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
3388 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
3389 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3390 #include <sys/syscall.h>
3392 return !SYS_uuidsys;
3394 solaris_uuidsys_syscall=yes
3395 AC_MSG_RESULT([yes])
3396 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
3397 [Define to 1 if you have the new `uuidsys' syscall.])
3399 solaris_uuidsys_syscall=no
3402 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
3405 # Solaris-specific check determining if the new labelsys() syscall subcode
3406 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
3407 # missing on illumos.
3409 # C-level symbol: SOLARIS_TNDB_GET_TNIP
3410 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
3412 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
3413 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3414 #include <sys/tsol/tndb.h>
3416 return !TNDB_GET_TNIP;
3418 solaris_tndb_get_tnip=yes
3419 AC_MSG_RESULT([yes])
3420 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
3421 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
3423 solaris_tndb_get_tnip=no
3426 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
3429 # Solaris-specific check determining if the new labelsys() syscall opcodes
3430 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
3431 # added in Solaris 11 but are missing on illumos.
3433 # C-level symbol: SOLARIS_TSOL_CLEARANCE
3434 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
3436 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
3437 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3438 #include <sys/tsol/tsyscall.h>
3440 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
3442 solaris_tsol_clearance=yes
3443 AC_MSG_RESULT([yes])
3444 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
3445 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
3447 solaris_tsol_clearance=no
3450 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
3453 # Solaris-specific check determining if the new pset() syscall subcode
3454 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
3455 # is missing on illumos and Solaris 11.3.
3457 # C-level symbol: SOLARIS_PSET_GET_NAME
3458 # Automake-level symbol: SOLARIS_PSET_GET_NAME
3460 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
3461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3462 #include <sys/pset.h>
3464 return !(PSET_GET_NAME);
3466 solaris_pset_get_name=yes
3467 AC_MSG_RESULT([yes])
3468 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
3469 [Define to 1 if you have the `PSET_GET_NAME' constants.])
3471 solaris_pset_get_name=no
3474 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
3477 # Solaris-specific check determining if the utimesys() syscall is
3478 # available (on illumos and older Solaris).
3480 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
3481 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
3483 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
3484 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3485 #include <sys/syscall.h>
3487 return !SYS_utimesys;
3489 solaris_utimesys_syscall=yes
3490 AC_MSG_RESULT([yes])
3491 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
3492 [Define to 1 if you have the `utimesys' syscall.])
3494 solaris_utimesys_syscall=no
3497 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
3500 # Solaris-specific check determining if the utimensat() syscall is
3501 # available (on newer Solaris).
3503 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3504 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3506 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
3507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3508 #include <sys/syscall.h>
3510 return !SYS_utimensat;
3512 solaris_utimensat_syscall=yes
3513 AC_MSG_RESULT([yes])
3514 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
3515 [Define to 1 if you have the `utimensat' syscall.])
3517 solaris_utimensat_syscall=no
3520 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
3523 # Solaris-specific check determining if the spawn() syscall is available
3524 # (on newer Solaris).
3526 # C-level symbol: SOLARIS_SPAWN_SYSCALL
3527 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
3529 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
3530 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3531 #include <sys/syscall.h>
3535 solaris_spawn_syscall=yes
3536 AC_MSG_RESULT([yes])
3537 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
3538 [Define to 1 if you have the `spawn' syscall.])
3540 solaris_spawn_syscall=no
3543 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
3546 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
3547 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
3549 # C-level symbol: SOLARIS_MODCTL_MODNVL
3550 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
3552 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
3553 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3554 #include <sys/modctl.h>
3556 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
3558 solaris_modctl_modnvl=yes
3559 AC_MSG_RESULT([yes])
3560 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
3561 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
3563 solaris_modctl_modnvl=no
3566 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
3569 # Solaris-specific check determining whether nscd (name switch cache daemon)
3570 # attaches its door at /system/volatile/name_service_door (Solaris)
3571 # or at /var/run/name_service_door (illumos).
3573 # Note that /var/run is a symlink to /system/volatile on Solaris
3574 # but not vice versa on illumos.
3576 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3577 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3579 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
3580 if test -e /system/volatile/name_service_door; then
3581 solaris_nscd_door_system_volatile=yes
3582 AC_MSG_RESULT([/system/volatile/name_service_door])
3583 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
3584 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
3586 solaris_nscd_door_system_volatile=no
3587 AC_MSG_RESULT([/var/run/name_service_door])
3589 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
3592 # Solaris-specific check determining if the new gethrt() fasttrap is available.
3594 # New fasttrap (available on Solaris 11):
3595 # hrt_t *gethrt(void);
3597 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
3598 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
3600 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
3601 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3602 #include <sys/trap.h>
3606 solaris_gethrt_fasttrap=yes
3607 AC_MSG_RESULT([yes])
3608 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
3609 [Define to 1 if you have the new `gethrt' fasttrap.])
3611 solaris_gethrt_fasttrap=no
3614 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
3617 # Solaris-specific check determining if the new get_zone_offset() fasttrap
3620 # New fasttrap (available on Solaris 11):
3621 # zonehrtoffset_t *get_zone_offset(void);
3623 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3624 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3626 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
3627 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3628 #include <sys/trap.h>
3630 return !T_GETZONEOFFSET;
3632 solaris_getzoneoffset_fasttrap=yes
3633 AC_MSG_RESULT([yes])
3634 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
3635 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
3637 solaris_getzoneoffset_fasttrap=no
3640 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
3643 # Solaris-specific check determining if the execve() syscall
3644 # takes fourth argument (flags) or not.
3646 # Old syscall (available on illumos):
3647 # int execve(const char *fname, const char **argv, const char **envp);
3649 # New syscall (available on Solaris):
3650 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
3652 # If the new syscall is present then it will fail with EINVAL (because flags
3653 # are invalid); if the old syscall is available then it will fail with ENOENT
3654 # (because the file could not be found).
3656 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3657 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3659 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
3660 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3661 #include <sys/syscall.h>
3665 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
3666 return !(errno == EINVAL);
3668 solaris_execve_syscall_takes_flags=yes
3669 AC_MSG_RESULT([yes])
3670 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
3671 [Define to 1 if you have the new `execve' syscall which accepts flags.])
3673 solaris_execve_syscall_takes_flags=no
3676 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
3677 test x$solaris_execve_syscall_takes_flags = xyes)
3680 # Solaris-specific check determining version of the repository cache protocol.
3681 # Every Solaris version uses a different one, ranging from 21 to current 25.
3682 # The check is very ugly, though.
3684 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
3685 # Automake-level symbol: none
3687 AC_PATH_PROG(DIS_PATH, dis, false)
3688 if test "x$DIS_PATH" = "xfalse"; then
3689 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
3691 AC_CHECK_LIB(scf, scf_handle_bind, [], [
3692 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
3693 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3696 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
3697 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
3698 libscf=/usr/lib/64/libscf.so.1
3700 libscf=/usr/lib/libscf.so.1
3702 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
3703 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
3704 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3706 hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
3707 if test -z "$hex"; then
3708 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
3709 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3711 version=$( printf "%d\n" 0x$hex )
3712 AC_MSG_RESULT([$version])
3713 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
3714 [Version number of the repository door cache protocol.])
3717 # Solaris-specific check determining if "sysstat" segment reservation type
3720 # New "sysstat" segment reservation (available on Solaris 11.4):
3721 # - program header type: PT_SUNW_SYSSTAT
3722 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
3724 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3725 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3727 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
3728 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3729 #include <sys/auxv.h>
3731 return !AT_SUN_SYSSTAT_ADDR;
3733 solaris_reserve_sysstat_addr=yes
3734 AC_MSG_RESULT([yes])
3735 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
3736 [Define to 1 if you have the new `sysstat' segment reservation.])
3738 solaris_reserve_sysstat_addr=no
3741 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
3744 # Solaris-specific check determining if "sysstat_zone" segment reservation type
3747 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
3748 # - program header type: PT_SUNW_SYSSTAT_ZONE
3749 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
3751 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3752 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3754 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
3755 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3756 #include <sys/auxv.h>
3758 return !AT_SUN_SYSSTAT_ZONE_ADDR;
3760 solaris_reserve_sysstat_zone_addr=yes
3761 AC_MSG_RESULT([yes])
3762 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
3763 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
3765 solaris_reserve_sysstat_zone_addr=no
3768 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
3771 # Solaris-specific check determining if the system_stats() syscall is available
3772 # (on newer Solaris).
3774 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3775 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3777 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
3778 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3779 #include <sys/syscall.h>
3781 return !SYS_system_stats;
3783 solaris_system_stats_syscall=yes
3784 AC_MSG_RESULT([yes])
3785 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
3786 [Define to 1 if you have the `system_stats' syscall.])
3788 solaris_system_stats_syscall=no
3791 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
3794 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
3795 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
3797 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
3798 # Automake-level symbol: none
3800 AC_CHECK_TYPE([struct _fpchip_state],
3801 [solaris_fpchip_state_takes_underscore=yes],
3802 [solaris_fpchip_state_takes_underscore=no],
3803 [[#include <sys/regset.h>]])
3804 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
3805 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
3806 [Define to 1 if fpregset_t defines struct _fpchip_state])
3810 # Solaris-specific check determining if schedctl page shared between kernel
3811 # and userspace program is executable (illumos, older Solaris) or not (newer
3814 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
3815 # Automake-level symbol: none
3817 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
3818 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3822 #include <schedctl.h>
3826 schedctl_t *scp = schedctl_init();
3830 int fd = open("/proc/self/map", O_RDONLY);
3835 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
3836 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
3837 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
3838 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
3839 return (map.pr_mflags & MA_EXEC);
3845 solaris_schedctl_page_exec=no
3848 solaris_schedctl_page_exec=yes
3849 AC_MSG_RESULT([yes])
3850 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
3851 [Define to 1 if you have the schedctl page executable.])
3855 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
3856 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
3857 # an initial thread pointer for libc (newer Solaris).
3859 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
3860 # Automake-level symbol: none
3862 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
3863 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3864 #include <sys/fasttrap_isa.h>
3866 return !FT_SCRATCHSIZE;
3868 solaris_pt_sunwdtrace_thrp=yes
3869 AC_MSG_RESULT([yes])
3870 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
3871 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
3873 solaris_pt_sunwdtrace_thrp=no
3878 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
3879 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
3880 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
3881 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
3882 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
3883 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
3884 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
3885 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
3886 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
3887 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
3888 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
3889 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
3890 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
3891 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
3892 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
3893 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
3894 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
3895 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
3896 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
3897 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
3898 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
3899 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
3900 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
3901 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
3902 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
3903 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
3904 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
3905 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
3906 fi # test "$VGCONF_OS" = "solaris"
3909 #----------------------------------------------------------------------------
3910 # Checks for C header files.
3911 #----------------------------------------------------------------------------
3914 AC_CHECK_HEADERS([ \
3932 # Verify whether the <linux/futex.h> header is usable.
3933 AC_MSG_CHECKING([if <linux/futex.h> is usable])
3935 save_CFLAGS="$CFLAGS"
3936 CFLAGS="$CFLAGS -D__user="
3937 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3938 #include <linux/futex.h>
3942 ac_have_usable_linux_futex_h=yes
3943 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
3944 [Define to 1 if you have a usable <linux/futex.h> header file.])
3945 AC_MSG_RESULT([yes])
3947 ac_have_usable_linux_futex_h=no
3950 CFLAGS="$save_CFLAGS"
3953 #----------------------------------------------------------------------------
3954 # Checks for typedefs, structures, and compiler characteristics.
3955 #----------------------------------------------------------------------------
3962 #----------------------------------------------------------------------------
3963 # Checks for library functions.
3964 #----------------------------------------------------------------------------
3968 AC_CHECK_LIB([pthread], [pthread_create])
3969 AC_CHECK_LIB([rt], [clock_gettime])
3982 pthread_barrier_init \
3983 pthread_condattr_setclock \
3984 pthread_mutex_timedlock \
3985 pthread_rwlock_timedrdlock \
3986 pthread_rwlock_timedwrlock \
3989 pthread_setname_np \
4005 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
4006 # libraries with any shared object and/or executable. This is NOT what we
4007 # want for e.g. vgpreload_core-x86-linux.so
4010 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
4011 [test x$ac_cv_func_pthread_barrier_init = xyes])
4012 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
4013 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
4014 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
4015 [test x$ac_cv_func_pthread_spin_lock = xyes])
4016 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
4017 [test x$ac_cv_func_pthread_setname_np = xyes])
4019 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4020 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
4021 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
4022 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
4025 #----------------------------------------------------------------------------
4027 #----------------------------------------------------------------------------
4028 # Do we have a useable MPI setup on the primary and/or secondary targets?
4029 # On Linux, by default, assumes mpicc and -m32/-m64
4030 # Note: this is a kludge in that it assumes the specified mpicc
4031 # understands -m32/-m64 regardless of what is specified using
4033 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
4034 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
4037 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
4038 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
4039 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
4040 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4041 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
4042 mflag_primary=$FLAG_M32
4043 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
4044 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
4045 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
4046 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
4047 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
4048 mflag_primary=$FLAG_M64
4049 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
4050 mflag_primary="$FLAG_M32 -arch i386"
4051 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
4052 mflag_primary="$FLAG_M64 -arch x86_64"
4056 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
4057 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
4058 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
4059 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX ; then
4060 mflag_secondary=$FLAG_M32
4061 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
4062 mflag_secondary="$FLAG_M32 -arch i386"
4067 [ --with-mpicc= Specify name of MPI2-ised C compiler],
4072 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
4073 ## use these values in the check for a functioning mpicc.
4075 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
4076 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
4077 AM_COND_IF([VGCONF_OS_IS_LINUX],
4078 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4079 LDFLAGS_MPI="-fpic -shared"])
4080 AM_COND_IF([VGCONF_OS_IS_DARWIN],
4081 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
4082 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
4083 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
4084 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4085 LDFLAGS_MPI="-fpic -shared"])
4087 AC_SUBST([CFLAGS_MPI])
4088 AC_SUBST([LDFLAGS_MPI])
4091 ## See if MPI_CC works for the primary target
4093 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
4095 saved_CFLAGS=$CFLAGS
4097 CFLAGS="$CFLAGS_MPI $mflag_primary"
4098 saved_LDFLAGS="$LDFLAGS"
4099 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
4100 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4104 int ni, na, nd, comb;
4105 int r = MPI_Init(NULL,NULL);
4106 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4107 r |= MPI_Finalize();
4110 ac_have_mpi2_pri=yes
4111 AC_MSG_RESULT([yes, $MPI_CC])
4117 CFLAGS=$saved_CFLAGS
4118 LDFLAGS="$saved_LDFLAGS"
4119 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
4121 ## See if MPI_CC works for the secondary target. Complication: what if
4122 ## there is no secondary target? We need this to then fail.
4123 ## Kludge this by making MPI_CC something which will surely fail in
4126 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
4128 saved_CFLAGS=$CFLAGS
4129 saved_LDFLAGS="$LDFLAGS"
4130 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
4131 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
4132 CC="$MPI_CC this will surely fail"
4136 CFLAGS="$CFLAGS_MPI $mflag_secondary"
4137 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4141 int ni, na, nd, comb;
4142 int r = MPI_Init(NULL,NULL);
4143 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4144 r |= MPI_Finalize();
4147 ac_have_mpi2_sec=yes
4148 AC_MSG_RESULT([yes, $MPI_CC])
4154 CFLAGS=$saved_CFLAGS
4155 LDFLAGS="$saved_LDFLAGS"
4156 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
4159 #----------------------------------------------------------------------------
4160 # Other library checks
4161 #----------------------------------------------------------------------------
4162 # There now follow some tests for Boost, and OpenMP. These
4163 # tests are present because Drd has some regression tests that use
4164 # these packages. All regression test programs all compiled only
4165 # for the primary target. And so it is important that the configure
4166 # checks that follow, use the correct -m32 or -m64 flag for the
4167 # primary target (called $mflag_primary). Otherwise, we can end up
4168 # in a situation (eg) where, on amd64-linux, the test for Boost checks
4169 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
4170 # only build (meaning, the primary target is x86-linux), the build
4171 # of the regtest programs that use Boost fails, because they are
4172 # build as 32-bit (IN THIS EXAMPLE).
4174 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
4175 # NEEDED BY THE REGRESSION TEST PROGRAMS.
4178 # Check whether the boost library 1.35 or later has been installed.
4179 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
4181 AC_MSG_CHECKING([for boost])
4184 safe_CXXFLAGS=$CXXFLAGS
4185 CXXFLAGS="$mflag_primary"
4187 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
4189 AC_LINK_IFELSE([AC_LANG_SOURCE([
4190 #include <boost/thread.hpp>
4191 static void thread_func(void)
4193 int main(int argc, char** argv)
4195 boost::thread t(thread_func);
4200 ac_have_boost_1_35=yes
4201 AC_SUBST([BOOST_CFLAGS], [])
4202 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
4203 AC_MSG_RESULT([yes])
4205 ac_have_boost_1_35=no
4210 CXXFLAGS=$safe_CXXFLAGS
4213 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
4216 # does this compiler support -fopenmp, does it have the include file
4217 # <omp.h> and does it have libgomp ?
4219 AC_MSG_CHECKING([for OpenMP])
4222 CFLAGS="-fopenmp $mflag_primary -Werror"
4224 AC_LINK_IFELSE([AC_LANG_SOURCE([
4226 int main(int argc, char** argv)
4234 AC_MSG_RESULT([yes])
4241 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
4244 # Check for __builtin_popcount
4245 AC_MSG_CHECKING([for __builtin_popcount()])
4246 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4248 __builtin_popcount(2);
4251 AC_MSG_RESULT([yes])
4252 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
4253 [Define to 1 if compiler provides __builtin_popcount().])
4258 # Check for __builtin_clz
4259 AC_MSG_CHECKING([for __builtin_clz()])
4260 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4265 AC_MSG_RESULT([yes])
4266 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
4267 [Define to 1 if compiler provides __builtin_clz().])
4272 # Check for __builtin_ctz
4273 AC_MSG_CHECKING([for __builtin_ctz()])
4274 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4279 AC_MSG_RESULT([yes])
4280 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
4281 [Define to 1 if compiler provides __builtin_ctz().])
4286 # does this compiler have built-in functions for atomic memory access for the
4288 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
4291 CFLAGS="$mflag_primary"
4293 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4295 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4296 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4298 ac_have_builtin_atomic_primary=yes
4299 AC_MSG_RESULT([yes])
4300 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])
4302 ac_have_builtin_atomic_primary=no
4308 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
4309 [test x$ac_have_builtin_atomic_primary = xyes])
4312 # does this compiler have built-in functions for atomic memory access for the
4313 # secondary target ?
4315 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4317 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
4320 CFLAGS="$mflag_secondary"
4322 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4324 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
4326 ac_have_builtin_atomic_secondary=yes
4327 AC_MSG_RESULT([yes])
4329 ac_have_builtin_atomic_secondary=no
4337 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
4338 [test x$ac_have_builtin_atomic_secondary = xyes])
4340 # does this compiler have built-in functions for atomic memory access on
4341 # 64-bit integers for all targets ?
4343 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
4345 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4348 uint64_t variable = 1;
4349 return __sync_add_and_fetch(&variable, 1)
4351 ac_have_builtin_atomic64_primary=yes
4353 ac_have_builtin_atomic64_primary=no
4356 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4359 CFLAGS="$mflag_secondary"
4361 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4364 uint64_t variable = 1;
4365 return __sync_add_and_fetch(&variable, 1)
4367 ac_have_builtin_atomic64_secondary=yes
4369 ac_have_builtin_atomic64_secondary=no
4376 if test x$ac_have_builtin_atomic64_primary = xyes && \
4377 test x$VGCONF_PLATFORM_SEC_CAPS = x \
4378 -o x$ac_have_builtin_atomic64_secondary = xyes; then
4379 AC_MSG_RESULT([yes])
4380 ac_have_builtin_atomic64=yes
4383 ac_have_builtin_atomic64=no
4386 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
4387 [test x$ac_have_builtin_atomic64 = xyes])
4390 # does g++ have built-in functions for atomic memory access ?
4391 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
4393 safe_CXXFLAGS=$CXXFLAGS
4394 CXXFLAGS="$mflag_primary"
4397 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4399 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4400 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4402 ac_have_builtin_atomic_cxx=yes
4403 AC_MSG_RESULT([yes])
4404 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
4406 ac_have_builtin_atomic_cxx=no
4411 CXXFLAGS=$safe_CXXFLAGS
4413 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
4416 if test x$ac_have_usable_linux_futex_h = xyes \
4417 -a x$ac_have_builtin_atomic_primary = xyes; then
4418 ac_enable_linux_ticket_lock_primary=yes
4420 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
4421 [test x$ac_enable_linux_ticket_lock_primary = xyes])
4423 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
4424 -a x$ac_have_usable_linux_futex_h = xyes \
4425 -a x$ac_have_builtin_atomic_secondary = xyes; then
4426 ac_enable_linux_ticket_lock_secondary=yes
4428 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
4429 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
4432 # does libstdc++ support annotating shared pointers ?
4433 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
4435 safe_CXXFLAGS=$CXXFLAGS
4436 CXXFLAGS="-std=c++0x"
4439 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4442 std::shared_ptr<int> p
4444 ac_have_shared_ptr=yes
4446 ac_have_shared_ptr=no
4448 if test x$ac_have_shared_ptr = xyes; then
4449 # If compilation of the program below fails because of a syntax error
4450 # triggered by substituting one of the annotation macros then that
4451 # means that libstdc++ supports these macros.
4452 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4453 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
4454 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
4457 std::shared_ptr<int> p
4459 ac_have_shared_pointer_annotation=no
4462 ac_have_shared_pointer_annotation=yes
4463 AC_MSG_RESULT([yes])
4464 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
4465 [Define to 1 if libstd++ supports annotating shared pointers])
4468 ac_have_shared_pointer_annotation=no
4473 CXXFLAGS=$safe_CXXFLAGS
4475 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
4476 [test x$ac_have_shared_pointer_annotation = xyes])
4479 #----------------------------------------------------------------------------
4480 # Ok. We're done checking.
4481 #----------------------------------------------------------------------------
4483 # Nb: VEX/Makefile is generated from Makefile.vex.in.
4486 VEX/Makefile:Makefile.vex.in
4495 gdbserver_tests/Makefile
4496 gdbserver_tests/solaris/Makefile
4502 memcheck/tests/Makefile
4503 memcheck/tests/common/Makefile
4504 memcheck/tests/amd64/Makefile
4505 memcheck/tests/x86/Makefile
4506 memcheck/tests/linux/Makefile
4507 memcheck/tests/darwin/Makefile
4508 memcheck/tests/solaris/Makefile
4509 memcheck/tests/amd64-linux/Makefile
4510 memcheck/tests/arm64-linux/Makefile
4511 memcheck/tests/x86-linux/Makefile
4512 memcheck/tests/amd64-solaris/Makefile
4513 memcheck/tests/x86-solaris/Makefile
4514 memcheck/tests/ppc32/Makefile
4515 memcheck/tests/ppc64/Makefile
4516 memcheck/tests/s390x/Makefile
4517 memcheck/tests/mips32/Makefile
4518 memcheck/tests/mips64/Makefile
4519 memcheck/tests/vbit-test/Makefile
4521 cachegrind/tests/Makefile
4522 cachegrind/tests/x86/Makefile
4523 cachegrind/cg_annotate
4526 callgrind/callgrind_annotate
4527 callgrind/callgrind_control
4528 callgrind/tests/Makefile
4530 helgrind/tests/Makefile
4532 massif/tests/Makefile
4535 lackey/tests/Makefile
4538 none/tests/scripts/Makefile
4539 none/tests/amd64/Makefile
4540 none/tests/ppc32/Makefile
4541 none/tests/ppc64/Makefile
4542 none/tests/x86/Makefile
4543 none/tests/arm/Makefile
4544 none/tests/arm64/Makefile
4545 none/tests/s390x/Makefile
4546 none/tests/mips32/Makefile
4547 none/tests/mips64/Makefile
4548 none/tests/linux/Makefile
4549 none/tests/darwin/Makefile
4550 none/tests/solaris/Makefile
4551 none/tests/amd64-linux/Makefile
4552 none/tests/x86-linux/Makefile
4553 none/tests/amd64-darwin/Makefile
4554 none/tests/x86-darwin/Makefile
4555 none/tests/amd64-solaris/Makefile
4556 none/tests/x86-solaris/Makefile
4557 exp-sgcheck/Makefile
4558 exp-sgcheck/tests/Makefile
4560 drd/scripts/download-and-build-splash2
4563 exp-bbv/tests/Makefile
4564 exp-bbv/tests/x86/Makefile
4565 exp-bbv/tests/x86-linux/Makefile
4566 exp-bbv/tests/amd64-linux/Makefile
4567 exp-bbv/tests/ppc32-linux/Makefile
4568 exp-bbv/tests/arm-linux/Makefile
4570 exp-dhat/tests/Makefile
4574 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
4575 [chmod +x coregrind/link_tool_exe_linux])
4576 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
4577 [chmod +x coregrind/link_tool_exe_darwin])
4578 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
4579 [chmod +x coregrind/link_tool_exe_solaris])
4584 Maximum build arch: ${ARCH_MAX}
4585 Primary build arch: ${VGCONF_ARCH_PRI}
4586 Secondary build arch: ${VGCONF_ARCH_SEC}
4587 Build OS: ${VGCONF_OS}
4588 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
4589 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
4590 Platform variant: ${VGCONF_PLATVARIANT}
4591 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
4592 Default supp files: ${DEFAULT_SUPP}