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
104 # We don't want gcc < 3.0
105 AC_MSG_CHECKING([for a supported version of gcc])
107 # Obtain the compiler version.
109 # A few examples of how the ${CC} --version output looks like:
111 # ######## gcc variants ########
112 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
113 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
114 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
115 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
116 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
117 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
118 # 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)
120 # ######## clang variants ########
121 # Clang: clang version 2.9 (tags/RELEASE_29/final)
122 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
123 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
125 # ######## Apple LLVM variants ########
126 # Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
127 # Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
130 if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
133 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
134 elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
137 # Don't use -dumpversion with clang: it will always produce "4.2.1".
138 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
139 elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
142 gcc_version=`${CC} -dumpversion 2>/dev/null`
145 gcc_version=`${CC} -dumpversion 2>/dev/null`
146 if test "x$gcc_version" = x; then
147 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
151 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
152 AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
154 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
155 # statements have to be quoted.
156 case "${is_clang}-${gcc_version}" in
157 applellvm-5.1|applellvm-[[6-9]].*|applellvm-[[1-9][0-9]]*)
158 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
161 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
163 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
164 AC_MSG_RESULT([ok (${gcc_version})])
166 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
167 AC_MSG_RESULT([ok (clang-${gcc_version})])
170 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
171 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0 or Apple LLVM >= 5.1])
175 #----------------------------------------------------------------------------
176 # Arch/OS/platform tests.
177 #----------------------------------------------------------------------------
178 # We create a number of arch/OS/platform-related variables. We prefix them
179 # all with "VGCONF_" which indicates that they are defined at
180 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
181 # variables used when compiling C files.
185 AC_MSG_CHECKING([for a supported CPU])
187 # ARCH_MAX reflects the most that this CPU can do: for example if it
188 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
189 # Ditto for amd64. It is used for more configuration below, but is not used
192 # Power PC returns powerpc for Big Endian. This was not changed when Little
193 # Endian support was added to the 64-bit architecture. The 64-bit Little
194 # Endian systems explicitly state le in the host_cpu. For clarity in the
195 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianness of
196 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
197 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
198 # Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
199 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
200 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
203 case "${host_cpu}" in
205 AC_MSG_RESULT([ok (${host_cpu})])
210 AC_MSG_RESULT([ok (${host_cpu})])
215 # this only referrs to 64-bit Big Endian
216 AC_MSG_RESULT([ok (${host_cpu})])
221 # this only referrs to 64-bit Little Endian
222 AC_MSG_RESULT([ok (${host_cpu})])
227 # On Linux this means only a 32-bit capable CPU.
228 AC_MSG_RESULT([ok (${host_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([no (${host_cpu})])
274 AC_MSG_ERROR([Unsupported host architecture. Sorry])
278 #----------------------------------------------------------------------------
280 # Sometimes it's convenient to subvert the bi-arch build system and
281 # just have a single build even though the underlying platform is
282 # capable of both. Hence handle --enable-only64bit and
283 # --enable-only32bit. Complain if both are issued :-)
284 # [Actually, if either of these options are used, I think both get built,
285 # but only one gets installed. So if you use an in-place build, both can be
288 # Check if a 64-bit only build has been requested
289 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
290 [AC_ARG_ENABLE(only64bit,
291 [ --enable-only64bit do a 64-bit only build],
292 [vg_cv_only64bit=$enableval],
293 [vg_cv_only64bit=no])])
295 # Check if a 32-bit only build has been requested
296 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
297 [AC_ARG_ENABLE(only32bit,
298 [ --enable-only32bit do a 32-bit only build],
299 [vg_cv_only32bit=$enableval],
300 [vg_cv_only32bit=no])])
303 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
305 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
308 #----------------------------------------------------------------------------
310 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
311 # compilation of many C files via -VGO_$(VGCONF_OS) and
312 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
313 AC_MSG_CHECKING([for a supported OS])
320 AC_MSG_RESULT([ok (${host_os})])
323 # Ok, this is linux. Check the kernel version
324 AC_MSG_CHECKING([for the kernel version])
329 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
330 AC_MSG_RESULT([unsupported (${kernel})])
331 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
335 AC_MSG_RESULT([2.6 or later (${kernel})])
342 AC_MSG_RESULT([ok (${host_os})])
344 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
345 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
346 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
347 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
348 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
349 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
350 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
351 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
352 AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13])
354 AC_MSG_CHECKING([for the kernel version])
357 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
358 # has only one relevant version, the OS version. The `uname` check
359 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
360 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
361 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
362 # and we don't know of an macros similar to __GLIBC__ to get that info.
364 # XXX: `uname -r` won't do the right thing for cross-compiles, but
365 # that's not a problem yet.
367 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
368 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
369 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
370 # time support for 10.5 (the 9.* pattern just below), I'll leave it
371 # in for now, just in case anybody wants to give it a try. But I'm
372 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
375 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
376 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
377 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
378 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
381 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
382 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
383 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
384 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
387 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
388 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
389 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
390 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
393 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
394 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
395 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
396 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
399 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
400 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
401 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
402 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
405 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
406 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
407 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
408 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
411 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
412 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
413 DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
414 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
417 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
418 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
419 DEFAULT_SUPP="darwin16.supp ${DEFAULT_SUPP}"
420 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
423 AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra])
424 AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version])
425 DEFAULT_SUPP="darwin17.supp ${DEFAULT_SUPP}"
426 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
429 AC_MSG_RESULT([unsupported (${kernel})])
430 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)])
436 AC_MSG_RESULT([ok (${host_os})])
439 uname_v=$( uname -v )
442 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
445 DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
451 AC_MSG_RESULT([ok (${host_os})])
453 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
457 AC_MSG_RESULT([no (${host_os})])
458 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
462 #----------------------------------------------------------------------------
464 # If we are building on a 64 bit platform test to see if the system
465 # supports building 32 bit programs and disable 32 bit support if it
466 # does not support building 32 bit programs
468 case "$ARCH_MAX-$VGCONF_OS" in
469 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
470 AC_MSG_CHECKING([for 32 bit build support])
473 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
478 vg_cv_only64bit="yes"
481 CFLAGS=$safe_CFLAGS;;
483 AC_MSG_CHECKING([for 32 bit build support])
485 CFLAGS="$CFLAGS -mips32 -mabi=32"
486 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
487 #include <sys/prctl.h>
491 vg_cv_only64bit="yes"
494 CFLAGS=$safe_CFLAGS;;
497 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
499 [--enable-only32bit was specified but system does not support 32 bit builds])
502 #----------------------------------------------------------------------------
504 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
505 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
506 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
507 # above) will be "amd64" since that reflects the most that this cpu can do,
508 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
509 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
510 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
511 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
512 AC_SUBST(VGCONF_ARCH_PRI)
514 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
515 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
516 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
517 # It is empty if there is no secondary target.
518 AC_SUBST(VGCONF_ARCH_SEC)
520 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
521 # The entire system, including regression and performance tests, will be
522 # built for this target. The "_CAPS" indicates that the name is in capital
523 # letters, and it also uses '_' rather than '-' as a separator, because it's
524 # used to create various Makefile variables, which are all in caps by
525 # convention and cannot contain '-' characters. This is in contrast to
526 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
527 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
529 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
530 # Valgrind and tools will also be built for this target, but not the
531 # regression or performance tests.
533 # By default, the primary arch is the same as the "max" arch, as commented
534 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
535 # the big case statement just below here, in the case where we're building
536 # on a 64 bit machine but have been requested only to do a 32 bit build.
537 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
539 AC_MSG_CHECKING([for a supported CPU/OS combination])
541 # NB. The load address for a given platform may be specified in more
542 # than one place, in some cases, depending on whether we're doing a biarch,
543 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
544 # Be careful to give consistent values in all subcases. Also, all four
545 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
546 # even if it is to "0xUNSET".
548 case "$ARCH_MAX-$VGCONF_OS" in
550 VGCONF_ARCH_PRI="x86"
552 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
553 VGCONF_PLATFORM_SEC_CAPS=""
554 valt_load_address_pri_norml="0x58000000"
555 valt_load_address_pri_inner="0x38000000"
556 valt_load_address_sec_norml="0xUNSET"
557 valt_load_address_sec_inner="0xUNSET"
558 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
561 valt_load_address_sec_norml="0xUNSET"
562 valt_load_address_sec_inner="0xUNSET"
563 if test x$vg_cv_only64bit = xyes; then
564 VGCONF_ARCH_PRI="amd64"
566 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
567 VGCONF_PLATFORM_SEC_CAPS=""
568 valt_load_address_pri_norml="0x58000000"
569 valt_load_address_pri_inner="0x38000000"
570 elif test x$vg_cv_only32bit = xyes; then
571 VGCONF_ARCH_PRI="x86"
573 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
574 VGCONF_PLATFORM_SEC_CAPS=""
575 valt_load_address_pri_norml="0x58000000"
576 valt_load_address_pri_inner="0x38000000"
578 VGCONF_ARCH_PRI="amd64"
579 VGCONF_ARCH_SEC="x86"
580 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
581 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
582 valt_load_address_pri_norml="0x58000000"
583 valt_load_address_pri_inner="0x38000000"
584 valt_load_address_sec_norml="0x58000000"
585 valt_load_address_sec_inner="0x38000000"
587 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
590 VGCONF_ARCH_PRI="ppc32"
592 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
593 VGCONF_PLATFORM_SEC_CAPS=""
594 valt_load_address_pri_norml="0x58000000"
595 valt_load_address_pri_inner="0x38000000"
596 valt_load_address_sec_norml="0xUNSET"
597 valt_load_address_sec_inner="0xUNSET"
598 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
601 valt_load_address_sec_norml="0xUNSET"
602 valt_load_address_sec_inner="0xUNSET"
603 if test x$vg_cv_only64bit = xyes; then
604 VGCONF_ARCH_PRI="ppc64be"
606 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
607 VGCONF_PLATFORM_SEC_CAPS=""
608 valt_load_address_pri_norml="0x58000000"
609 valt_load_address_pri_inner="0x38000000"
610 elif test x$vg_cv_only32bit = xyes; then
611 VGCONF_ARCH_PRI="ppc32"
613 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
614 VGCONF_PLATFORM_SEC_CAPS=""
615 valt_load_address_pri_norml="0x58000000"
616 valt_load_address_pri_inner="0x38000000"
618 VGCONF_ARCH_PRI="ppc64be"
619 VGCONF_ARCH_SEC="ppc32"
620 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
621 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
622 valt_load_address_pri_norml="0x58000000"
623 valt_load_address_pri_inner="0x38000000"
624 valt_load_address_sec_norml="0x58000000"
625 valt_load_address_sec_inner="0x38000000"
627 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
630 # Little Endian is only supported on PPC64
631 valt_load_address_sec_norml="0xUNSET"
632 valt_load_address_sec_inner="0xUNSET"
633 VGCONF_ARCH_PRI="ppc64le"
635 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
636 VGCONF_PLATFORM_SEC_CAPS=""
637 valt_load_address_pri_norml="0x58000000"
638 valt_load_address_pri_inner="0x38000000"
639 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
641 # Darwin gets identified as 32-bit even when it supports 64-bit.
642 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
643 # all Macs support both 32-bit and 64-bit, so we just build both. If
644 # someone has a really old 32-bit only machine they can (hopefully?)
645 # build with --enable-only32bit. See bug 243362.
646 x86-darwin|amd64-darwin)
648 valt_load_address_sec_norml="0xUNSET"
649 valt_load_address_sec_inner="0xUNSET"
650 if test x$vg_cv_only64bit = xyes; then
651 VGCONF_ARCH_PRI="amd64"
653 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
654 VGCONF_PLATFORM_SEC_CAPS=""
655 valt_load_address_pri_norml="0x158000000"
656 valt_load_address_pri_inner="0x138000000"
657 elif test x$vg_cv_only32bit = xyes; then
658 VGCONF_ARCH_PRI="x86"
660 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
661 VGCONF_PLATFORM_SEC_CAPS=""
662 VGCONF_ARCH_PRI_CAPS="x86"
663 valt_load_address_pri_norml="0x58000000"
664 valt_load_address_pri_inner="0x38000000"
666 VGCONF_ARCH_PRI="amd64"
667 VGCONF_ARCH_SEC="x86"
668 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
669 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
670 valt_load_address_pri_norml="0x158000000"
671 valt_load_address_pri_inner="0x138000000"
672 valt_load_address_sec_norml="0x58000000"
673 valt_load_address_sec_inner="0x38000000"
675 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
678 VGCONF_ARCH_PRI="arm"
679 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
680 VGCONF_PLATFORM_SEC_CAPS=""
681 valt_load_address_pri_norml="0x58000000"
682 valt_load_address_pri_inner="0x38000000"
683 valt_load_address_sec_norml="0xUNSET"
684 valt_load_address_sec_inner="0xUNSET"
685 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
688 valt_load_address_sec_norml="0xUNSET"
689 valt_load_address_sec_inner="0xUNSET"
690 if test x$vg_cv_only64bit = xyes; then
691 VGCONF_ARCH_PRI="arm64"
693 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
694 VGCONF_PLATFORM_SEC_CAPS=""
695 valt_load_address_pri_norml="0x58000000"
696 valt_load_address_pri_inner="0x38000000"
697 elif test x$vg_cv_only32bit = xyes; then
698 VGCONF_ARCH_PRI="arm"
700 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
701 VGCONF_PLATFORM_SEC_CAPS=""
702 valt_load_address_pri_norml="0x58000000"
703 valt_load_address_pri_inner="0x38000000"
705 VGCONF_ARCH_PRI="arm64"
706 VGCONF_ARCH_SEC="arm"
707 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
708 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
709 valt_load_address_pri_norml="0x58000000"
710 valt_load_address_pri_inner="0x38000000"
711 valt_load_address_sec_norml="0x58000000"
712 valt_load_address_sec_inner="0x38000000"
714 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
717 VGCONF_ARCH_PRI="s390x"
719 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
720 VGCONF_PLATFORM_SEC_CAPS=""
721 # To improve branch prediction hit rate we want to have
722 # the generated code close to valgrind (host) code
723 valt_load_address_pri_norml="0x800000000"
724 valt_load_address_pri_inner="0x810000000"
725 valt_load_address_sec_norml="0xUNSET"
726 valt_load_address_sec_inner="0xUNSET"
727 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
730 VGCONF_ARCH_PRI="mips32"
732 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
733 VGCONF_PLATFORM_SEC_CAPS=""
734 valt_load_address_pri_norml="0x58000000"
735 valt_load_address_pri_inner="0x38000000"
736 valt_load_address_sec_norml="0xUNSET"
737 valt_load_address_sec_inner="0xUNSET"
738 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
741 valt_load_address_sec_norml="0xUNSET"
742 valt_load_address_sec_inner="0xUNSET"
743 if test x$vg_cv_only64bit = xyes; then
744 VGCONF_ARCH_PRI="mips64"
745 VGCONF_PLATFORM_SEC_CAPS=""
746 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
747 VGCONF_PLATFORM_SEC_CAPS=""
748 valt_load_address_pri_norml="0x58000000"
749 valt_load_address_pri_inner="0x38000000"
750 elif test x$vg_cv_only32bit = xyes; then
751 VGCONF_ARCH_PRI="mips32"
753 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
754 VGCONF_PLATFORM_SEC_CAPS=""
755 valt_load_address_pri_norml="0x58000000"
756 valt_load_address_pri_inner="0x38000000"
758 VGCONF_ARCH_PRI="mips64"
759 VGCONF_ARCH_SEC="mips32"
760 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
761 VGCONF_PLATFORM_SEC_CAPS="MIPS32_LINUX"
762 valt_load_address_pri_norml="0x58000000"
763 valt_load_address_pri_inner="0x38000000"
764 valt_load_address_sec_norml="0x58000000"
765 valt_load_address_sec_inner="0x38000000"
767 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
770 VGCONF_ARCH_PRI="x86"
772 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
773 VGCONF_PLATFORM_SEC_CAPS=""
774 valt_load_address_pri_norml="0x58000000"
775 valt_load_address_pri_inner="0x38000000"
776 valt_load_address_sec_norml="0xUNSET"
777 valt_load_address_sec_inner="0xUNSET"
778 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
781 valt_load_address_sec_norml="0xUNSET"
782 valt_load_address_sec_inner="0xUNSET"
783 if test x$vg_cv_only64bit = xyes; then
784 VGCONF_ARCH_PRI="amd64"
786 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
787 VGCONF_PLATFORM_SEC_CAPS=""
788 valt_load_address_pri_norml="0x58000000"
789 valt_load_address_pri_inner="0x38000000"
790 elif test x$vg_cv_only32bit = xyes; then
791 VGCONF_ARCH_PRI="x86"
793 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
794 VGCONF_PLATFORM_SEC_CAPS=""
795 valt_load_address_pri_norml="0x58000000"
796 valt_load_address_pri_inner="0x38000000"
798 VGCONF_ARCH_PRI="amd64"
799 VGCONF_ARCH_SEC="x86"
800 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
801 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
802 valt_load_address_pri_norml="0x58000000"
803 valt_load_address_pri_inner="0x38000000"
804 valt_load_address_sec_norml="0x58000000"
805 valt_load_address_sec_inner="0x38000000"
807 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
810 VGCONF_ARCH_PRI="unknown"
811 VGCONF_ARCH_SEC="unknown"
812 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
813 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
814 valt_load_address_pri_norml="0xUNSET"
815 valt_load_address_pri_inner="0xUNSET"
816 valt_load_address_sec_norml="0xUNSET"
817 valt_load_address_sec_inner="0xUNSET"
818 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
819 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
823 #----------------------------------------------------------------------------
825 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
827 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
828 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
829 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
830 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
831 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
832 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
833 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
834 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
835 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
836 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
837 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
838 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
839 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
840 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
841 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
842 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
843 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
844 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
845 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
846 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
847 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
848 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
849 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
850 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
851 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
852 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
853 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX )
854 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
855 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
857 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
859 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
860 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
861 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
862 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
863 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
864 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
865 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
866 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
867 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
868 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
869 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
870 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
871 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
872 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
873 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
874 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
875 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
876 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
877 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
878 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
879 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
880 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
881 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX)
882 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
883 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
884 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
885 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
886 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
887 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
888 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
889 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
890 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
891 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
892 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
893 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
896 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
897 # Relies on the assumption that the primary and secondary targets are
898 # for the same OS, so therefore only necessary to test the primary.
899 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
900 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
901 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
902 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
903 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
904 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
905 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
906 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
907 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
908 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
909 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
910 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
911 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
912 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
913 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
914 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
915 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
918 # Sometimes, in the Makefile.am files, it's useful to know whether or not
919 # there is a secondary target.
920 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
921 test x$VGCONF_PLATFORM_SEC_CAPS != x)
923 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
924 dnl fallback definition
925 dnl The macro is courtesy of Dave Hart:
926 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
927 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
928 if test -z "$$1_TRUE"; then :
937 #----------------------------------------------------------------------------
939 #----------------------------------------------------------------------------
941 # Check if this should be built as an inner Valgrind, to be run within
942 # another Valgrind. Choose the load address accordingly.
943 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
944 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
945 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
946 [AC_ARG_ENABLE(inner,
947 [ --enable-inner enables self-hosting],
948 [vg_cv_inner=$enableval],
950 if test "$vg_cv_inner" = yes; then
951 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
952 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
953 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
955 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
956 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
959 #----------------------------------------------------------------------------
960 # Undefined behaviour sanitiser
961 #----------------------------------------------------------------------------
962 # Check whether we should build with the undefined beahviour sanitiser.
964 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
965 [AC_ARG_ENABLE(ubsan,
966 [ --enable-ubsan enables the undefined behaviour sanitiser],
967 [vg_cv_ubsan=$enableval],
970 #----------------------------------------------------------------------------
971 # Extra fine-tuning of installation directories
972 #----------------------------------------------------------------------------
974 [ --with-tmpdir=PATH Specify path for temporary files],
977 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
978 AC_SUBST(VG_TMPDIR, [$tmpdir])
981 #----------------------------------------------------------------------------
982 # Libc and suppressions
983 #----------------------------------------------------------------------------
984 # This variable will collect the suppression files to be used.
985 AC_SUBST(DEFAULT_SUPP)
987 AC_CHECK_HEADER([features.h])
989 if test x$ac_cv_header_features_h = xyes; then
990 rm -f conftest.$ac_ext
991 cat <<_ACEOF >conftest.$ac_ext
992 #include <features.h>
993 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
994 glibc version is: __GLIBC__ __GLIBC_MINOR__
997 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
1000 # not really a version check
1001 AC_EGREP_CPP([DARWIN_LIBC], [
1002 #include <sys/cdefs.h>
1003 #if defined(__DARWIN_VERS_1050)
1007 GLIBC_VERSION="darwin")
1009 # not really a version check
1010 AC_EGREP_CPP([BIONIC_LIBC], [
1011 #if defined(__ANDROID__)
1015 GLIBC_VERSION="bionic")
1017 # there is only one version of libc on Solaris
1018 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1019 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1020 GLIBC_VERSION="solaris"
1023 # GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
1025 if test x$GLIBC_VERSION = x; then
1026 if $CC -dumpmachine | grep -q musl; then
1031 AC_MSG_CHECKING([the glibc version])
1033 case "${GLIBC_VERSION}" in
1035 AC_MSG_RESULT(${GLIBC_VERSION} family)
1036 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
1037 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1038 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1041 AC_MSG_RESULT(${GLIBC_VERSION} family)
1042 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1043 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1044 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1047 AC_MSG_RESULT(${GLIBC_VERSION} family)
1048 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1049 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1050 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1053 AC_MSG_RESULT(${GLIBC_VERSION} family)
1054 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1055 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1056 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1057 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1058 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1061 AC_MSG_RESULT(${GLIBC_VERSION} family)
1062 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1063 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1064 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1065 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1066 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1067 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1068 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1071 AC_MSG_RESULT(Darwin)
1072 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1073 # DEFAULT_SUPP set by kernel version check above.
1076 AC_MSG_RESULT(Bionic)
1077 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1078 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1081 AC_MSG_RESULT(Solaris)
1082 # DEFAULT_SUPP set in host_os switch-case above.
1083 # No other suppression file is used.
1087 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1088 # no DEFAULT_SUPP file yet for musl libc.
1091 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1092 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1093 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
1097 AC_SUBST(GLIBC_VERSION)
1100 if test "$VGCONF_OS" != "solaris"; then
1101 # Add default suppressions for the X client libraries. Make no
1102 # attempt to detect whether such libraries are installed on the
1103 # build machine (or even if any X facilities are present); just
1104 # add the suppressions antidisirregardless.
1105 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1106 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
1108 # Add glibc and X11 suppressions for exp-sgcheck
1109 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1113 #----------------------------------------------------------------------------
1114 # Platform variants?
1115 #----------------------------------------------------------------------------
1117 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1118 # But there are times where we need a bit more control. The motivating
1119 # and currently only case is Android: this is almost identical to
1120 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1121 # platform variant tags, which get passed in the compile as
1122 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1124 # In almost all cases, the <variant> bit is "vanilla". But for Android
1125 # it is "android" instead.
1127 # Consequently (eg), plain arm-linux would build with
1129 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1131 # whilst an Android build would have
1133 # -DVGP_arm_linux -DVGPV_arm_linux_android
1135 # Same for x86. The setup of the platform variant is pushed relatively far
1136 # down this file in order that we can inspect any of the variables set above.
1138 # In the normal case ..
1139 VGCONF_PLATVARIANT="vanilla"
1142 if test "$GLIBC_VERSION" = "bionic";
1144 VGCONF_PLATVARIANT="android"
1147 AC_SUBST(VGCONF_PLATVARIANT)
1150 # FIXME: do we also want to define automake variables
1151 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1152 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1153 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1154 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1155 # that's what we'd need to do to use this, since what we'd want to write
1158 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1160 # Hmm. Can't think of a nice clean solution to this.
1162 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1163 test x$VGCONF_PLATVARIANT = xvanilla)
1164 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1165 test x$VGCONF_PLATVARIANT = xandroid)
1168 #----------------------------------------------------------------------------
1169 # Checking for various library functions and other definitions
1170 #----------------------------------------------------------------------------
1172 # Check for AT_FDCWD
1174 AC_MSG_CHECKING([for AT_FDCWD])
1175 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1182 ac_have_at_fdcwd=yes
1183 AC_MSG_RESULT([yes])
1189 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1191 # Check for stpncpy function definition in string.h
1192 # This explicitly checks with _GNU_SOURCE defined since that is also
1193 # used in the test case (some systems might define it without anyway
1194 # since stpncpy is part of The Open Group Base Specifications Issue 7
1195 # IEEE Std 1003.1-2008.
1196 AC_MSG_CHECKING([for stpncpy])
1197 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1204 char *r = stpncpy(d, s, n);
1206 ac_have_gnu_stpncpy=yes
1207 AC_MSG_RESULT([yes])
1209 ac_have_gnu_stpncpy=no
1213 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1215 # Check for PTRACE_GETREGS
1217 AC_MSG_CHECKING([for PTRACE_GETREGS])
1218 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1221 #include <sys/ptrace.h>
1222 #include <sys/user.h>
1225 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1227 AC_MSG_RESULT([yes])
1228 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1229 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1235 # Check for CLOCK_MONOTONIC
1237 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1239 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1243 clock_gettime(CLOCK_MONOTONIC, &t);
1246 AC_MSG_RESULT([yes])
1247 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1248 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1254 # Check for ELF32/64_CHDR
1256 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1259 # Check for PTHREAD_RWLOCK_T
1261 AC_MSG_CHECKING([for pthread_rwlock_t])
1263 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1265 #include <pthread.h>
1267 pthread_rwlock_t rwl;
1269 AC_MSG_RESULT([yes])
1270 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1271 [Define to 1 if you have the `pthread_rwlock_t' type.])
1277 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1279 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1281 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1283 #include <pthread.h>
1285 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1287 AC_MSG_RESULT([yes])
1288 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1289 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1295 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1297 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1299 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1301 #include <pthread.h>
1303 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1305 AC_MSG_RESULT([yes])
1306 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1307 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1313 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1315 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1317 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1319 #include <pthread.h>
1321 return (PTHREAD_MUTEX_RECURSIVE_NP);
1323 AC_MSG_RESULT([yes])
1324 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1325 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1331 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1333 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1337 #include <pthread.h>
1339 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1342 AC_MSG_RESULT([yes])
1343 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1344 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1350 # Check whether pthread_mutex_t has a member called __m_kind.
1352 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1353 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1355 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1358 [#include <pthread.h>])
1361 # Check whether pthread_mutex_t has a member called __data.__kind.
1363 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1364 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1366 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1369 [#include <pthread.h>])
1371 # Convenience function. Set flags based on the existing HWCAP entries.
1372 # The AT_HWCAP entries are generated by glibc, and are based on
1373 # functions supported by the hardware/system/libc.
1374 # Subsequent support for whether the capability will actually be utilized
1375 # will also be checked against the compiler capabilities.
1377 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1378 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1380 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1381 if LD_SHOW_AUXV=1 `which true` | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1383 AC_MSG_RESULT([yes])
1384 AC_SUBST([$2],[yes])
1391 # gather hardware capabilities. (hardware/kernel/libc)
1392 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1393 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1394 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1395 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1396 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1397 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1398 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1399 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1402 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1403 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1404 # compiler support for isa 2.07 level instructions
1405 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1406 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1408 __asm__ __volatile__("mtvsrd 1,2 ");
1410 ac_asm_have_isa_2_07=yes
1411 AC_MSG_RESULT([yes])
1413 ac_asm_have_isa_2_07=no
1416 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1417 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1419 # altivec (vsx) support.
1420 # does this compiler support -maltivec and does it have the include file
1422 AC_MSG_CHECKING([for Altivec support in the compiler ])
1424 CFLAGS="-maltivec -Werror"
1425 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1426 #include <altivec.h>
1428 vector unsigned int v;
1431 AC_MSG_RESULT([yes])
1437 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1438 -a x$HWCAP_HAS_ALTIVEC = xyes])
1440 # Check that both: the compiler supports -mvsx and that the assembler
1441 # understands VSX instructions. If either of those doesn't work,
1442 # conclude that we can't do VSX.
1443 AC_MSG_CHECKING([for VSX compiler flag support])
1445 CFLAGS="-mvsx -Werror"
1446 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1449 ac_compiler_supports_vsx_flag=yes
1450 AC_MSG_RESULT([yes])
1452 ac_compiler_supports_vsx_flag=no
1457 AC_MSG_CHECKING([for VSX support in the assembler ])
1459 CFLAGS="-mvsx -Werror"
1460 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1461 #include <altivec.h>
1463 vector unsigned int v;
1464 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1466 ac_compiler_supports_vsx=yes
1467 AC_MSG_RESULT([yes])
1469 ac_compiler_supports_vsx=no
1473 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1474 -a x$ac_compiler_supports_vsx = xyes \
1475 -a x$HWCAP_HAS_VSX = xyes ])
1477 # DFP (Decimal Float)
1478 AC_MSG_CHECKING([that assembler knows DFP])
1479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1482 __asm__ __volatile__("adtr 1, 2, 3")
1484 __asm__ __volatile__("dadd 1, 2, 3");
1485 __asm__ __volatile__("dcffix 1, 2");
1489 AC_MSG_RESULT([yes])
1494 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1496 CFLAGS="-mhard-dfp -Werror"
1497 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1500 __asm__ __volatile__("adtr 1, 2, 3")
1502 __asm__ __volatile__("dadd 1, 2, 3");
1503 __asm__ __volatile__("dcffix 1, 2");
1506 ac_compiler_have_dfp=yes
1507 AC_MSG_RESULT([yes])
1509 ac_compiler_have_dfp=no
1513 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1514 -a x$ac_compiler_have_dfp = xyes \
1515 -a x$HWCAP_HAS_DFP = xyes )
1517 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1518 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1520 _Decimal64 x = 0.0DD;
1522 ac_compiler_have_dfp_type=yes
1523 AC_MSG_RESULT([yes])
1525 ac_compiler_have_dfp_type=no
1528 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1529 -a x$HWCAP_HAS_DFP = xyes )
1532 # HTM (Hardware Transactional Memory)
1533 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1535 CFLAGS="-mhtm -Werror"
1536 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1540 AC_MSG_RESULT([yes])
1541 ac_compiler_supports_htm=yes
1544 ac_compiler_supports_htm=no
1548 AC_MSG_CHECKING([if compiler can find the htm builtins])
1550 CFLAGS="-mhtm -Werror"
1551 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1553 if (__builtin_tbegin (0))
1556 AC_MSG_RESULT([yes])
1557 ac_compiler_sees_htm_builtins=yes
1560 ac_compiler_sees_htm_builtins=no
1564 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1565 -a x$ac_compiler_sees_htm_builtins = xyes \
1566 -a x$HWCAP_HAS_HTM = xyes )
1569 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1571 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1573 __asm__ __volatile__("cnttzw 1,2 ");
1575 ac_asm_have_isa_3_00=yes
1576 AC_MSG_RESULT([yes])
1578 ac_asm_have_isa_3_00=no
1582 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
1583 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1585 # Check for pthread_create@GLIBC2.0
1586 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1589 CFLAGS="-lpthread -Werror"
1590 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1591 extern int pthread_create_glibc_2_0(void*, const void*,
1592 void *(*)(void*), void*);
1593 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1597 * Apparently on PowerPC linking this program succeeds and generates an
1598 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1600 #error This test does not work properly on PowerPC.
1602 pthread_create_glibc_2_0(0, 0, 0, 0);
1606 ac_have_pthread_create_glibc_2_0=yes
1607 AC_MSG_RESULT([yes])
1608 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1609 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1611 ac_have_pthread_create_glibc_2_0=no
1616 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1617 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1620 # Check for dlinfo RTLD_DI_TLS_MODID
1621 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1625 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1632 size_t sizes[10000];
1633 size_t modid_offset;
1634 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1637 ac_have_dlinfo_rtld_di_tls_modid=yes
1638 AC_MSG_RESULT([yes])
1639 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1640 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1642 ac_have_dlinfo_rtld_di_tls_modid=no
1647 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1648 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1651 # Check for eventfd_t, eventfd() and eventfd_read()
1652 AC_MSG_CHECKING([for eventfd()])
1654 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1655 #include <sys/eventfd.h>
1661 eventfd_read(fd, &ev);
1664 AC_MSG_RESULT([yes])
1665 AC_DEFINE([HAVE_EVENTFD], 1,
1666 [Define to 1 if you have the `eventfd' function.])
1667 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1668 [Define to 1 if you have the `eventfd_read' function.])
1673 # Check whether compiler can process #include <thread> without errors
1674 # clang 3.3 cannot process <thread> from e.g.
1675 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1677 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1679 safe_CXXFLAGS=$CXXFLAGS
1682 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1686 ac_cxx_can_include_thread_header=yes
1687 AC_MSG_RESULT([yes])
1689 ac_cxx_can_include_thread_header=no
1692 CXXFLAGS=$safe_CXXFLAGS
1695 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1698 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1699 # of the user_regs_struct from sys/user.h. They are structurally the same
1700 # but we get either one or the other.
1702 AC_CHECK_TYPE([struct user_regs_struct],
1703 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1704 [[#include <sys/ptrace.h>]
1705 [#include <sys/time.h>]
1706 [#include <sys/user.h>]])
1707 if test "$sys_user_has_user_regs" = "yes"; then
1708 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1709 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1713 #----------------------------------------------------------------------------
1714 # Checking for supported compiler flags.
1715 #----------------------------------------------------------------------------
1717 case "${host_cpu}" in
1719 # does this compiler support -march=mips32 (mips32 default) ?
1720 AC_MSG_CHECKING([if gcc accepts -march=mips32 -mabi=32])
1723 CFLAGS="$CFLAGS -mips32 -mabi=32 -Werror"
1725 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1728 FLAG_M32="-mips32 -mabi=32"
1729 AC_MSG_RESULT([yes])
1739 # does this compiler support -march=mips64r2 (mips64r2 default) ?
1740 AC_MSG_CHECKING([if gcc accepts -march=mips64r2 -mabi=64])
1743 CFLAGS="$CFLAGS -march=mips64r2 -mabi=64 -Werror"
1745 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1748 FLAG_M64="-march=mips64r2 -mabi=64"
1749 AC_MSG_RESULT([yes])
1759 # does this compiler support -m32 ?
1760 AC_MSG_CHECKING([if gcc accepts -m32])
1763 CFLAGS="-m32 -Werror"
1765 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1769 AC_MSG_RESULT([yes])
1779 # does this compiler support -m64 ?
1780 AC_MSG_CHECKING([if gcc accepts -m64])
1783 CFLAGS="-m64 -Werror"
1785 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1789 AC_MSG_RESULT([yes])
1800 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1801 AC_MSG_CHECKING([if gcc accepts -march=octeon])
1804 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon -Werror"
1806 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1809 FLAG_OCTEON="-march=octeon"
1810 AC_MSG_RESULT([yes])
1817 AC_SUBST(FLAG_OCTEON)
1820 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1821 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1824 CFLAGS="$CFLAGS $FLAG_M64 -march=octeon2 -Werror"
1826 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1829 FLAG_OCTEON2="-march=octeon2"
1830 AC_MSG_RESULT([yes])
1837 AC_SUBST(FLAG_OCTEON2)
1840 # does this compiler support -mmsa (MIPS MSA ASE) ?
1841 AC_MSG_CHECKING([if gcc accepts -mmsa])
1844 CFLAGS="$CFLAGS -mmsa -Werror"
1846 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1850 AC_MSG_RESULT([yes])
1860 # does this compiler support -mmmx ?
1861 AC_MSG_CHECKING([if gcc accepts -mmmx])
1864 CFLAGS="-mmmx -Werror"
1866 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1870 AC_MSG_RESULT([yes])
1880 # does this compiler support -msse ?
1881 AC_MSG_CHECKING([if gcc accepts -msse])
1884 CFLAGS="-msse -Werror"
1886 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1890 AC_MSG_RESULT([yes])
1900 # does this compiler support -mpreferred-stack-boundary=2 when
1901 # generating code for a 32-bit target? Note that we only care about
1902 # this when generating code for (32-bit) x86, so if the compiler
1903 # doesn't recognise -m32 it's no big deal. We'll just get code for
1904 # the Memcheck and other helper functions, that is a bit slower than
1905 # it could be, on x86; and no difference at all on any other platform.
1906 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
1909 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
1911 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1914 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
1915 AC_MSG_RESULT([yes])
1917 PREFERRED_STACK_BOUNDARY_2=""
1922 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
1925 # does this compiler support -mlong-double-128 ?
1926 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
1928 CFLAGS="-mlong-double-128 -Werror"
1929 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1932 ac_compiler_supports_mlong_double_128=yes
1933 AC_MSG_RESULT([yes])
1935 ac_compiler_supports_mlong_double_128=no
1939 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
1940 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
1941 AC_SUBST(FLAG_MLONG_DOUBLE_128)
1944 # Convenience function to check whether GCC supports a particular
1945 # warning option. Takes two arguments,
1946 # first the warning flag name to check (without -W), then the
1947 # substitution name to set with -Wno-warning-flag if the flag exists,
1948 # or the empty string if the compiler doesn't accept the flag. Note
1949 # that checking is done against the warning flag itself, but the
1950 # substitution is then done to cancel the warning flag.
1951 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
1952 AC_MSG_CHECKING([if gcc accepts -W$1])
1954 CFLAGS="-W$1 -Werror"
1955 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1956 AC_SUBST([$2], [-Wno-$1])
1957 AC_MSG_RESULT([yes])], [
1959 AC_MSG_RESULT([no])])
1963 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
1964 # -W$1 (instead of -Wno-$1).
1965 AC_DEFUN([AC_GCC_WARNING_SUBST],[
1966 AC_MSG_CHECKING([if gcc accepts -W$1])
1968 CFLAGS="-W$1 -Werror"
1969 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1970 AC_SUBST([$2], [-W$1])
1971 AC_MSG_RESULT([yes])], [
1973 AC_MSG_RESULT([no])])
1977 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
1978 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1979 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
1980 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
1981 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
1982 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1983 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
1984 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
1985 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
1986 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
1987 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
1988 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
1989 # Disabled for now until all platforms are clean
1990 format_checking_enabled=no
1991 #format_checking_enabled=yes
1992 if test "$format_checking_enabled" = "yes"; then
1993 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
1995 dumy_assignment_to_avoid_syntax_errors=1
1996 AC_SUBST([FLAG_W_FORMAT_SIGNEDNESS], [])
1998 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
1999 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
2000 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
2001 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
2003 # Does this compiler support -Wformat-security ?
2004 # Special handling is needed, because certain GCC versions require -Wformat
2005 # being present if -Wformat-security is given. Otherwise a warning is issued.
2006 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
2007 # And with that the warning will be turned into an error with the result
2008 # that -Wformat-security is believed to be unsupported when in fact it is.
2009 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
2011 CFLAGS="-Wformat -Wformat-security -Werror"
2012 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
2013 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
2014 AC_MSG_RESULT([yes])], [
2015 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
2016 AC_MSG_RESULT([no])])
2019 # does this compiler support -Wextra or the older -W ?
2021 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
2024 CFLAGS="-Wextra -Werror"
2026 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2029 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
2030 AC_MSG_RESULT([-Wextra])
2033 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2036 AC_SUBST([FLAG_W_EXTRA], [-W])
2039 AC_SUBST([FLAG_W_EXTRA], [])
2040 AC_MSG_RESULT([not supported])
2045 # On ARM we do not want to pass -Wcast-align as that produces loads
2046 # of warnings. GCC is just being conservative. See here:
2047 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
2048 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
2049 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
2051 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
2054 # does this compiler support -fno-stack-protector ?
2055 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
2058 CFLAGS="-fno-stack-protector -Werror"
2060 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2063 no_stack_protector=yes
2064 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2065 AC_MSG_RESULT([yes])
2067 no_stack_protector=no
2068 FLAG_FNO_STACK_PROTECTOR=""
2073 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2075 # Does GCC support disabling Identical Code Folding?
2076 # We want to disabled Identical Code Folding for the
2077 # tools preload shared objects to get better backraces.
2078 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2079 # "The optimization reduces code size and may disturb
2080 # unwind stacks by replacing a function by equivalent
2081 # one with a different name."
2082 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2085 CFLAGS="-fno-ipa-icf -Werror"
2087 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2091 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2092 AC_MSG_RESULT([yes])
2100 AC_SUBST(FLAG_FNO_IPA_ICF)
2103 # Does this compiler support -fsanitize=undefined. This is true for
2104 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2105 # also checks for alignment violations on memory accesses which the valgrind
2106 # code base is sprinkled (if not littered) with. As those alignment issues
2107 # don't pose a problem we want to suppress warnings about them.
2108 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2109 # GCCs do not support that.
2111 # Only checked for if --enable-ubsan was given.
2112 if test "x${vg_cv_ubsan}" = "xyes"; then
2113 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2115 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2116 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2119 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2120 LIB_UBSAN="-static-libubsan"
2121 AC_MSG_RESULT([yes])
2123 CFLAGS="-fsanitize=undefined -Werror"
2124 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2127 FLAG_FSANITIZE="-fsanitize=undefined"
2128 LIB_UBSAN="-static-libubsan"
2129 AC_MSG_RESULT([yes])
2137 AC_SUBST(FLAG_FSANITIZE)
2140 # does this compiler support --param inline-unit-growth=... ?
2142 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2145 CFLAGS="--param inline-unit-growth=900 -Werror"
2147 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2150 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2151 ["--param inline-unit-growth=900"])
2152 AC_MSG_RESULT([yes])
2154 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2160 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2162 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2165 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2171 AC_MSG_RESULT([yes])
2176 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2180 # does this compiler support -g -gz=zlib ?
2182 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2185 CFLAGS="-g -gz=zlib"
2187 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2191 AC_MSG_RESULT([yes])
2196 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2200 # does this compiler support -g -gz=zlib-gnu ?
2202 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2205 CFLAGS="-g -gz=zlib-gnu"
2207 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2210 ac_have_gz_zlib_gnu=yes
2211 AC_MSG_RESULT([yes])
2213 ac_have_gz_zlib_gnu=no
2216 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2220 # does this compiler support nested functions ?
2222 AC_MSG_CHECKING([if gcc accepts nested functions])
2224 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2225 int foo() { return 1; }
2228 ac_have_nested_functions=yes
2229 AC_MSG_RESULT([yes])
2231 ac_have_nested_functions=no
2234 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2237 # does this compiler support the 'p' constraint in ASM statements ?
2239 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2241 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2243 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2245 ac_have_asm_constraint_p=yes
2246 AC_MSG_RESULT([yes])
2248 ac_have_asm_constraint_p=no
2251 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2254 # Does this compiler and linker support -pie?
2255 # Some compilers actually do not support -pie and report its usage
2256 # as an error. We need to check if it is safe to use it first.
2258 AC_MSG_CHECKING([if gcc accepts -pie])
2263 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2266 AC_SUBST([FLAG_PIE], ["-pie"])
2267 AC_MSG_RESULT([yes])
2269 AC_SUBST([FLAG_PIE], [""])
2275 # Does this compiler support -no-pie?
2276 # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2277 # default. However this gets in the way with some tests, we use -no-pie
2280 AC_MSG_CHECKING([if gcc accepts -no-pie])
2285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2288 AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
2289 AC_MSG_RESULT([yes])
2291 AC_SUBST([FLAG_NO_PIE], [""])
2297 # We want to use use the -Ttext-segment option to the linker.
2298 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
2299 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2300 # semantics are NOT what we want (GNU gold -Ttext is fine).
2302 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2303 # will reside. -Ttext aligns just the .text section start (but not any
2306 # So test for -Ttext-segment which is supported by all bfd ld versions
2307 # and use that if it exists. If it doesn't exist it must be an older
2308 # version of gold and we can fall back to using -Ttext which has the
2311 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
2314 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
2317 [AC_LANG_SOURCE([int _start () { return 0; }])],
2319 linker_using_t_text="no"
2320 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
2321 AC_MSG_RESULT([yes])
2323 linker_using_t_text="yes"
2324 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
2329 # If the linker only supports -Ttext (not -Ttext-segment) then we will
2330 # have to strip any build-id ELF NOTEs from the statically linked tools.
2331 # Otherwise the build-id NOTE might end up at the default load address.
2332 # (Pedantically if the linker is gold then -Ttext is fine, but newer
2333 # gold versions also support -Ttext-segment. So just assume that unless
2334 # we can use -Ttext-segment we need to strip the build-id NOTEs.
2335 if test "x${linker_using_t_text}" = "xyes"; then
2336 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
2337 # does the linker support -Wl,--build-id=none ? Note, it's
2338 # important that we test indirectly via whichever C compiler
2339 # is selected, rather than testing /usr/bin/ld or whatever
2341 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
2343 CFLAGS="-Wl,--build-id=none -Werror"
2346 [AC_LANG_PROGRAM([ ], [return 0;])],
2348 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
2349 AC_MSG_RESULT([yes])
2351 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2355 AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
2356 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2360 # does the ppc assembler support "mtocrf" et al?
2361 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
2363 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2364 __asm__ __volatile__("mtocrf 4,0");
2365 __asm__ __volatile__("mfocrf 0,4");
2367 ac_have_as_ppc_mftocrf=yes
2368 AC_MSG_RESULT([yes])
2370 ac_have_as_ppc_mftocrf=no
2373 if test x$ac_have_as_ppc_mftocrf = xyes ; then
2374 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2378 # does the ppc assembler support "lfdp" and other phased out floating point insns?
2379 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2382 do { typedef struct {
2386 dbl_pair_t dbl_pair[3];
2387 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2390 ac_have_as_ppc_fpPO=yes
2391 AC_MSG_RESULT([yes])
2393 ac_have_as_ppc_fpPO=no
2396 if test x$ac_have_as_ppc_fpPO = xyes ; then
2397 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2401 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
2402 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
2404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2406 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
2407 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
2409 ac_have_as_amd64_fxsave64=yes
2410 AC_MSG_RESULT([yes])
2412 ac_have_as_amd64_fxsave64=no
2415 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
2416 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
2419 # does the x86/amd64 assembler understand SSE3 instructions?
2420 # Note, this doesn't generate a C-level symbol. It generates a
2421 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
2422 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2424 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2425 do { long long int x;
2426 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2430 AC_MSG_RESULT([yes])
2436 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
2439 # Ditto for SSSE3 instructions (note extra S)
2440 # Note, this doesn't generate a C-level symbol. It generates a
2441 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2442 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2444 save_CFLAGS="$CFLAGS"
2445 CFLAGS="$CFLAGS -msse -Werror"
2446 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2447 do { long long int x;
2448 __asm__ __volatile__(
2449 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2452 ac_have_as_ssse3=yes
2453 AC_MSG_RESULT([yes])
2458 CFLAGS="$save_CFLAGS"
2460 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2463 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2464 # Note, this doesn't generate a C-level symbol. It generates a
2465 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
2466 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
2467 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2469 __asm__ __volatile__(
2470 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2473 ac_have_as_pclmulqdq=yes
2474 AC_MSG_RESULT([yes])
2476 ac_have_as_pclmulqdq=no
2480 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2483 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2484 # Note, this doesn't generate a C-level symbol. It generates a
2485 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2486 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2487 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2490 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2491 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2492 * xmm2 should be used.
2494 __asm__ __volatile__(
2495 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2498 ac_have_as_vpclmulqdq=yes
2499 AC_MSG_RESULT([yes])
2501 ac_have_as_vpclmulqdq=no
2505 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2508 # does the x86/amd64 assembler understand FMA4 instructions?
2509 # Note, this doesn't generate a C-level symbol. It generates a
2510 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
2511 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
2512 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2514 __asm__ __volatile__(
2515 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
2518 ac_have_as_vfmaddpd=yes
2519 AC_MSG_RESULT([yes])
2521 ac_have_as_vfmaddpd=no
2525 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
2528 # does the x86/amd64 assembler understand the LZCNT instruction?
2529 # Note, this doesn't generate a C-level symbol. It generates a
2530 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
2531 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2533 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2535 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
2538 ac_have_as_lzcnt=yes
2539 AC_MSG_RESULT([yes])
2545 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2548 # does the x86/amd64 assembler understand the LOOPNEL instruction?
2549 # Note, this doesn't generate a C-level symbol. It generates a
2550 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2551 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2553 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2555 __asm__ __volatile__("1: loopnel 1b\n");
2558 ac_have_as_loopnel=yes
2559 AC_MSG_RESULT([yes])
2561 ac_have_as_loopnel=no
2565 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2568 # does the x86/amd64 assembler understand ADDR32 ?
2569 # Note, this doesn't generate a C-level symbol. It generates a
2570 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2571 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2575 asm volatile ("addr32 rep movsb");
2578 ac_have_as_addr32=yes
2579 AC_MSG_RESULT([yes])
2581 ac_have_as_addr32=no
2585 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2588 # does the x86/amd64 assembler understand SSE 4.2 instructions?
2589 # Note, this doesn't generate a C-level symbol. It generates a
2590 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2591 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2593 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2594 do { long long int x;
2595 __asm__ __volatile__(
2596 "crc32q %%r15,%%r15" : : : "r15" );
2597 __asm__ __volatile__(
2598 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2599 __asm__ __volatile__(
2600 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
2603 ac_have_as_sse42=yes
2604 AC_MSG_RESULT([yes])
2610 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2613 # does the x86/amd64 assembler understand AVX instructions?
2614 # Note, this doesn't generate a C-level symbol. It generates a
2615 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2616 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2618 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2619 do { long long int x;
2620 __asm__ __volatile__(
2621 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2622 __asm__ __volatile__(
2623 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2627 AC_MSG_RESULT([yes])
2633 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2636 # does the x86/amd64 assembler understand AVX2 instructions?
2637 # Note, this doesn't generate a C-level symbol. It generates a
2638 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2639 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2641 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2642 do { long long int x;
2643 __asm__ __volatile__(
2644 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2645 __asm__ __volatile__(
2646 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2650 AC_MSG_RESULT([yes])
2656 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2659 # does the x86/amd64 assembler understand TSX instructions and
2660 # the XACQUIRE/XRELEASE prefixes?
2661 # Note, this doesn't generate a C-level symbol. It generates a
2662 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2663 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2665 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2667 __asm__ __volatile__(
2670 " xacquire lock incq 0(%rsp) \n\t"
2671 " xrelease lock incq 0(%rsp) \n"
2676 AC_MSG_RESULT([yes])
2682 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2685 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2686 # Note, this doesn't generate a C-level symbol. It generates a
2687 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2688 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2690 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2691 do { unsigned int h, l;
2692 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
2693 __asm__ __volatile__(
2694 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
2695 __asm__ __volatile__(
2696 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
2700 AC_MSG_RESULT([yes])
2706 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2709 # does the x86/amd64 assembler understand FMA instructions?
2710 # Note, this doesn't generate a C-level symbol. It generates a
2711 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2712 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2714 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2715 do { unsigned int h, l;
2716 __asm__ __volatile__(
2717 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2718 __asm__ __volatile__(
2719 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2720 __asm__ __volatile__(
2721 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2725 AC_MSG_RESULT([yes])
2731 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2734 # does the amd64 assembler understand MPX instructions?
2735 # Note, this doesn't generate a C-level symbol. It generates a
2736 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2737 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2739 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2741 asm ("bndmov %bnd0,(%rsp)");
2742 asm ("bndldx 3(%rbx,%rdx), %bnd2");
2743 asm ("bnd call foo\n"
2750 AC_MSG_RESULT([yes])
2756 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2759 # does the amd64 assembler understand ADX instructions?
2760 # Note, this doesn't generate a C-level symbol. It generates a
2761 # automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
2762 AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
2764 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2766 asm ("adcxq %r14,%r8");
2770 AC_MSG_RESULT([yes])
2776 AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
2779 # Does the C compiler support the "ifunc" attribute
2780 # Note, this doesn't generate a C-level symbol. It generates a
2781 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2782 # does the x86/amd64 assembler understand MOVBE?
2783 # Note, this doesn't generate a C-level symbol. It generates a
2784 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2785 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2787 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2788 do { long long int x;
2789 __asm__ __volatile__(
2790 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
2793 ac_have_as_movbe=yes
2794 AC_MSG_RESULT([yes])
2800 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2803 # Does the C compiler support the "ifunc" attribute
2804 # Note, this doesn't generate a C-level symbol. It generates a
2805 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2806 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2808 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2809 static void mytest(void) {}
2811 static void (*resolve_test(void))(void)
2813 return (void (*)(void))&mytest;
2816 void test(void) __attribute__((ifunc("resolve_test")));
2824 ac_have_ifunc_attr=yes
2825 AC_MSG_RESULT([yes])
2827 ac_have_ifunc_attr=no
2831 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2833 # Does the C compiler support the armv8 crc feature flag
2834 # Note, this doesn't generate a C-level symbol. It generates a
2835 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
2836 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
2838 save_CFLAGS="$CFLAGS"
2839 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
2840 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2846 ac_have_armv8_crc_feature=yes
2847 AC_MSG_RESULT([yes])
2849 ac_have_armv8_crc_feature=no
2852 CFLAGS="$save_CFLAGS"
2854 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
2857 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2858 # when building the tool executables. I think we should get rid of it.
2860 # Check for TLS support in the compiler and linker
2861 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2863 [vg_cv_linktime_tls=yes],
2864 [vg_cv_linktime_tls=no])
2865 # Native compilation: check whether running a program using TLS succeeds.
2866 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2867 # succeeds but running programs using TLS fails.
2868 # Cross-compiling: check whether linking a program using TLS succeeds.
2869 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2870 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2871 [vg_cv_tls=$enableval],
2872 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2876 [vg_cv_tls=$vg_cv_linktime_tls])])])
2878 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
2879 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2883 #----------------------------------------------------------------------------
2884 # Solaris-specific checks.
2885 #----------------------------------------------------------------------------
2887 if test "$VGCONF_OS" = "solaris" ; then
2888 AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
2890 # Solaris-specific check determining if the Sun Studio Assembler is used to
2891 # build Valgrind. The test checks if the x86/amd64 assembler understands the
2892 # cmovl.l instruction, if yes then it's Sun Assembler.
2894 # C-level symbol: none
2895 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
2897 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
2898 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2900 __asm__ __volatile__("cmovl.l %edx, %eax");
2902 solaris_have_sun_studio_as=yes
2903 AC_MSG_RESULT([yes])
2905 solaris_have_sun_studio_as=no
2908 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
2910 # Solaris-specific check determining if symbols __xpg4 and __xpg6
2911 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
2912 # See solaris/vgpreload-solaris.mapfile for details.
2913 # gcc on older Solaris instructs linker to include these symbols,
2914 # gcc on illumos and newer Solaris does not.
2916 # C-level symbol: none
2917 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
2919 save_CFLAGS="$CFLAGS"
2920 CFLAGS="$CFLAGS -std=gnu99"
2921 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
2922 temp_dir=$( /usr/bin/mktemp -d )
2923 cat <<_ACEOF >${temp_dir}/mylib.c
2925 int myfunc(void) { printf("LaPutyka\n"); }
2927 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
2928 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
2929 if test "x${xpg_present}" = "x" ; then
2930 solaris_xpg_symbols_present=no
2933 solaris_xpg_symbols_present=yes
2934 AC_MSG_RESULT([yes])
2937 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
2938 CFLAGS="$save_CFLAGS"
2941 # Solaris-specific check determining if gcc enables largefile support by
2942 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
2943 # variable with gcc flags which disable it.
2945 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
2946 save_CFLAGS="$CFLAGS"
2947 CFLAGS="$CFLAGS -m32"
2948 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2949 return _LARGEFILE_SOURCE;
2951 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
2952 AC_MSG_RESULT([yes])
2954 SOLARIS_UNDEF_LARGESOURCE=""
2958 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
2961 # Solaris-specific check determining if /proc/self/cmdline
2962 # or /proc/<pid>/cmdline is supported.
2964 # C-level symbol: SOLARIS_PROC_CMDLINE
2965 # Automake-level symbol: SOLARIS_PROC_CMDLINE
2967 AC_CHECK_FILE([/proc/self/cmdline],
2969 solaris_proc_cmdline=yes
2970 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
2971 [Define to 1 if you have /proc/self/cmdline.])
2973 solaris_proc_cmdline=no
2975 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
2978 # Solaris-specific check determining default platform for the Valgrind launcher.
2979 # Used in case the launcher cannot select platform by looking at the client
2980 # image (for example because the executable is a shell script).
2982 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
2983 # Automake-level symbol: none
2985 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
2986 # Get the ELF class of /bin/sh first.
2987 if ! test -f /bin/sh; then
2988 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
2990 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
2991 case "$elf_class" in
2993 default_arch="$VGCONF_ARCH_PRI";
2996 if test "x$VGCONF_ARCH_SEC" != "x"; then
2997 default_arch="$VGCONF_ARCH_SEC"
2999 default_arch="$VGCONF_ARCH_PRI";
3003 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
3006 default_platform="$default_arch-$VGCONF_OS"
3007 AC_MSG_RESULT([$default_platform])
3008 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
3009 [Default platform for Valgrind launcher.])
3012 # Solaris-specific check determining if the old syscalls are available.
3014 # C-level symbol: SOLARIS_OLD_SYSCALLS
3015 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
3017 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
3018 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3019 #include <sys/syscall.h>
3023 solaris_old_syscalls=yes
3024 AC_MSG_RESULT([yes])
3025 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
3026 [Define to 1 if you have the old Solaris syscalls.])
3028 solaris_old_syscalls=no
3031 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
3034 # Solaris-specific check determining if the new accept() syscall is available.
3037 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3040 # New syscall (available on illumos):
3041 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
3042 # int version, int flags);
3044 # If the old syscall is present then the following syscall will fail with
3045 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
3046 # available then it will fail with EINVAL (because the flags parameter is
3049 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
3050 # Automake-level symbol: none
3052 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
3053 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3054 #include <sys/syscall.h>
3058 syscall(SYS_accept, 0, 0, 0, 0, -1);
3059 return !(errno == EINVAL);
3061 AC_MSG_RESULT([yes])
3062 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
3063 [Define to 1 if you have the new `accept' syscall.])
3069 # Solaris-specific check determining if the new illumos pipe() syscall is
3073 # longlong_t pipe();
3075 # New syscall (available on illumos):
3076 # int pipe(intptr_t arg, int flags);
3078 # If the old syscall is present then the following call will succeed, if the
3079 # new syscall is available then it will fail with EFAULT (because address 0
3080 # cannot be accessed).
3082 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
3083 # Automake-level symbol: none
3085 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
3086 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3087 #include <sys/syscall.h>
3091 syscall(SYS_pipe, 0, 0);
3092 return !(errno == EFAULT);
3094 AC_MSG_RESULT([yes])
3095 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3096 [Define to 1 if you have the new `pipe' syscall.])
3102 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
3106 # int lwp_kill(id_t lwpid, int sig);
3108 # New syscall (available on Solaris 11):
3109 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3110 # int si_code, timespec_t *timeout);
3112 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3113 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3115 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3116 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3117 #include <sys/syscall.h>
3119 return !SYS_lwp_sigqueue;
3121 solaris_lwp_sigqueue_syscall=yes
3122 AC_MSG_RESULT([yes])
3123 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
3124 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
3126 solaris_lwp_sigqueue_syscall=no
3129 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3132 # Solaris-specific check determining if the lwp_sigqueue() syscall
3133 # takes both pid and thread id arguments or just thread id.
3135 # Old syscall (available up to Solaris 11.3):
3136 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3137 # int si_code, timespec_t *timeout);
3139 # New syscall (available since Solaris 11.4):
3140 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
3141 # int si_code, timespec_t *timeout);
3143 # If the old syscall is present then the following syscall will fail with
3144 # EINVAL (because signal is out of range); if the new syscall is available
3145 # then it will fail with ESRCH (because it would not find such thread in the
3148 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3149 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3151 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
3152 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
3153 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3154 #include <sys/syscall.h>
3158 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
3159 return !(errno == ESRCH);
3161 solaris_lwp_sigqueue_syscall_takes_pid=yes
3162 AC_MSG_RESULT([yes])
3163 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
3164 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
3166 solaris_lwp_sigqueue_syscall_takes_pid=no
3169 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
3170 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
3172 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
3176 # Solaris-specific check determining if the new lwp_name() syscall is
3179 # New syscall (available on Solaris 11):
3180 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
3182 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
3183 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
3185 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
3186 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3187 #include <sys/syscall.h>
3189 return !SYS_lwp_name;
3191 solaris_lwp_name_syscall=yes
3192 AC_MSG_RESULT([yes])
3193 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
3194 [Define to 1 if you have the new `lwp_name' syscall.])
3196 solaris_lwp_name_syscall=no
3199 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
3202 # Solaris-specific check determining if the new getrandom() syscall is
3205 # New syscall (available on Solaris 11):
3206 # int getrandom(void *buf, size_t buflen, uint_t flags);
3208 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
3209 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
3211 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
3212 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3213 #include <sys/syscall.h>
3215 return !SYS_getrandom;
3217 solaris_getrandom_syscall=yes
3218 AC_MSG_RESULT([yes])
3219 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
3220 [Define to 1 if you have the new `getrandom' syscall.])
3222 solaris_getrandom_syscall=no
3225 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
3228 # Solaris-specific check determining if the new zone() syscall subcodes
3229 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
3230 # were added in Solaris 11 but are missing on illumos.
3232 # C-level symbol: SOLARIS_ZONE_DEFUNCT
3233 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
3235 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
3236 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3237 #include <sys/zone.h>
3239 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
3241 solaris_zone_defunct=yes
3242 AC_MSG_RESULT([yes])
3243 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
3244 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
3246 solaris_zone_defunct=no
3249 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
3252 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
3253 # for auditon(2) subcode of the auditsys() syscall are available.
3254 # These commands are available in Solaris 11 and illumos but were removed
3257 # C-level symbol: SOLARIS_AUDITON_STAT
3258 # Automake-level symbol: SOLARIS_AUDITON_STAT
3260 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
3261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3262 #include <bsm/audit.h>
3264 return !(A_GETSTAT && A_SETSTAT);
3266 solaris_auditon_stat=yes
3267 AC_MSG_RESULT([yes])
3268 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
3269 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
3271 solaris_auditon_stat=no
3274 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
3277 # Solaris-specific check determining if the new shmsys() syscall subcodes
3278 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
3279 # These subcodes were added in Solaris 11 but are missing on illumos.
3281 # C-level symbol: SOLARIS_SHM_NEW
3282 # Automake-level symbol: SOLARIS_SHM_NEW
3284 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
3285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3286 #include <sys/ipc_impl.h>
3287 #include <sys/shm.h>
3288 #include <sys/shm_impl.h>
3290 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
3293 AC_MSG_RESULT([yes])
3294 AC_DEFINE([SOLARIS_SHM_NEW], 1,
3295 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
3300 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
3303 # Solaris-specific check determining if prxregset_t is available. Illumos
3304 # currently does not define it on the x86 platform.
3306 # C-level symbol: SOLARIS_PRXREGSET_T
3307 # Automake-level symbol: SOLARIS_PRXREGSET_T
3309 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
3310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3311 #include <sys/procfs_isa.h>
3313 return !sizeof(prxregset_t);
3315 solaris_prxregset_t=yes
3316 AC_MSG_RESULT([yes])
3317 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
3318 [Define to 1 if you have the `prxregset_t' type.])
3320 solaris_prxregset_t=no
3323 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
3326 # Solaris-specific check determining if the new frealpathat() syscall is
3329 # New syscall (available on Solaris 11.1):
3330 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
3332 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3333 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3335 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
3336 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3337 #include <sys/syscall.h>
3339 return !SYS_frealpathat;
3341 solaris_frealpathat_syscall=yes
3342 AC_MSG_RESULT([yes])
3343 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
3344 [Define to 1 if you have the new `frealpathat' syscall.])
3346 solaris_frealpathat_syscall=no
3349 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
3352 # Solaris-specific check determining if the new uuidsys() syscall is
3355 # New syscall (available on newer Solaris):
3356 # int uuidsys(struct uuid *uuid);
3358 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
3359 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
3361 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
3362 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3363 #include <sys/syscall.h>
3365 return !SYS_uuidsys;
3367 solaris_uuidsys_syscall=yes
3368 AC_MSG_RESULT([yes])
3369 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
3370 [Define to 1 if you have the new `uuidsys' syscall.])
3372 solaris_uuidsys_syscall=no
3375 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
3378 # Solaris-specific check determining if the new labelsys() syscall subcode
3379 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
3380 # missing on illumos.
3382 # C-level symbol: SOLARIS_TNDB_GET_TNIP
3383 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
3385 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
3386 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3387 #include <sys/tsol/tndb.h>
3389 return !TNDB_GET_TNIP;
3391 solaris_tndb_get_tnip=yes
3392 AC_MSG_RESULT([yes])
3393 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
3394 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
3396 solaris_tndb_get_tnip=no
3399 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
3402 # Solaris-specific check determining if the new labelsys() syscall opcodes
3403 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
3404 # added in Solaris 11 but are missing on illumos.
3406 # C-level symbol: SOLARIS_TSOL_CLEARANCE
3407 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
3409 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
3410 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3411 #include <sys/tsol/tsyscall.h>
3413 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
3415 solaris_tsol_clearance=yes
3416 AC_MSG_RESULT([yes])
3417 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
3418 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
3420 solaris_tsol_clearance=no
3423 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
3426 # Solaris-specific check determining if the new pset() syscall subcode
3427 # PSET_GET_NAME is available. This subcode was added in Solaris 11.4 but
3428 # is missing on illumos and Solaris 11.3.
3430 # C-level symbol: SOLARIS_PSET_GET_NAME
3431 # Automake-level symbol: SOLARIS_PSET_GET_NAME
3433 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
3434 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3435 #include <sys/pset.h>
3437 return !(PSET_GET_NAME);
3439 solaris_pset_get_name=yes
3440 AC_MSG_RESULT([yes])
3441 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
3442 [Define to 1 if you have the `PSET_GET_NAME' constants.])
3444 solaris_pset_get_name=no
3447 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
3450 # Solaris-specific check determining if the utimesys() syscall is
3451 # available (on illumos and older Solaris).
3453 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
3454 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
3456 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
3457 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3458 #include <sys/syscall.h>
3460 return !SYS_utimesys;
3462 solaris_utimesys_syscall=yes
3463 AC_MSG_RESULT([yes])
3464 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
3465 [Define to 1 if you have the `utimesys' syscall.])
3467 solaris_utimesys_syscall=no
3470 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
3473 # Solaris-specific check determining if the utimensat() syscall is
3474 # available (on newer Solaris).
3476 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3477 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3479 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
3480 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3481 #include <sys/syscall.h>
3483 return !SYS_utimensat;
3485 solaris_utimensat_syscall=yes
3486 AC_MSG_RESULT([yes])
3487 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
3488 [Define to 1 if you have the `utimensat' syscall.])
3490 solaris_utimensat_syscall=no
3493 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
3496 # Solaris-specific check determining if the spawn() syscall is available
3497 # (on newer Solaris).
3499 # C-level symbol: SOLARIS_SPAWN_SYSCALL
3500 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
3502 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
3503 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3504 #include <sys/syscall.h>
3508 solaris_spawn_syscall=yes
3509 AC_MSG_RESULT([yes])
3510 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
3511 [Define to 1 if you have the `spawn' syscall.])
3513 solaris_spawn_syscall=no
3516 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
3519 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
3520 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
3522 # C-level symbol: SOLARIS_MODCTL_MODNVL
3523 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
3525 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
3526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3527 #include <sys/modctl.h>
3529 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
3531 solaris_modctl_modnvl=yes
3532 AC_MSG_RESULT([yes])
3533 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
3534 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
3536 solaris_modctl_modnvl=no
3539 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
3542 # Solaris-specific check determining whether nscd (name switch cache daemon)
3543 # attaches its door at /system/volatile/name_service_door (Solaris)
3544 # or at /var/run/name_service_door (illumos).
3546 # Note that /var/run is a symlink to /system/volatile on Solaris
3547 # but not vice versa on illumos.
3549 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3550 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3552 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
3553 if test -e /system/volatile/name_service_door; then
3554 solaris_nscd_door_system_volatile=yes
3555 AC_MSG_RESULT([/system/volatile/name_service_door])
3556 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
3557 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
3559 solaris_nscd_door_system_volatile=no
3560 AC_MSG_RESULT([/var/run/name_service_door])
3562 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
3565 # Solaris-specific check determining if the new gethrt() fasttrap is available.
3567 # New fasttrap (available on Solaris 11):
3568 # hrt_t *gethrt(void);
3570 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
3571 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
3573 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
3574 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3575 #include <sys/trap.h>
3579 solaris_gethrt_fasttrap=yes
3580 AC_MSG_RESULT([yes])
3581 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
3582 [Define to 1 if you have the new `gethrt' fasttrap.])
3584 solaris_gethrt_fasttrap=no
3587 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
3590 # Solaris-specific check determining if the new get_zone_offset() fasttrap
3593 # New fasttrap (available on Solaris 11):
3594 # zonehrtoffset_t *get_zone_offset(void);
3596 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3597 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3599 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
3600 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3601 #include <sys/trap.h>
3603 return !T_GETZONEOFFSET;
3605 solaris_getzoneoffset_fasttrap=yes
3606 AC_MSG_RESULT([yes])
3607 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
3608 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
3610 solaris_getzoneoffset_fasttrap=no
3613 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
3616 # Solaris-specific check determining if the execve() syscall
3617 # takes fourth argument (flags) or not.
3619 # Old syscall (available on illumos):
3620 # int execve(const char *fname, const char **argv, const char **envp);
3622 # New syscall (available on Solaris):
3623 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
3625 # If the new syscall is present then it will fail with EINVAL (because flags
3626 # are invalid); if the old syscall is available then it will fail with ENOENT
3627 # (because the file could not be found).
3629 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3630 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3632 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
3633 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3634 #include <sys/syscall.h>
3638 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
3639 return !(errno == EINVAL);
3641 solaris_execve_syscall_takes_flags=yes
3642 AC_MSG_RESULT([yes])
3643 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
3644 [Define to 1 if you have the new `execve' syscall which accepts flags.])
3646 solaris_execve_syscall_takes_flags=no
3649 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
3650 test x$solaris_execve_syscall_takes_flags = xyes)
3653 # Solaris-specific check determining version of the repository cache protocol.
3654 # Every Solaris version uses a different one, ranging from 21 to current 25.
3655 # The check is very ugly, though.
3657 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
3658 # Automake-level symbol: none
3660 AC_PATH_PROG(DIS_PATH, dis, false)
3661 if test "x$DIS_PATH" = "xfalse"; then
3662 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
3664 AC_CHECK_LIB(scf, scf_handle_bind, [], [
3665 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
3666 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3669 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
3670 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
3671 libscf=/usr/lib/64/libscf.so.1
3673 libscf=/usr/lib/libscf.so.1
3675 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
3676 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
3677 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3679 hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
3680 if test -z "$hex"; then
3681 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
3682 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3684 version=$( printf "%d\n" 0x$hex )
3685 AC_MSG_RESULT([$version])
3686 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
3687 [Version number of the repository door cache protocol.])
3690 # Solaris-specific check determining if "sysstat" segment reservation type
3693 # New "sysstat" segment reservation (available on Solaris 11.4):
3694 # - program header type: PT_SUNW_SYSSTAT
3695 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
3697 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3698 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3700 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
3701 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3702 #include <sys/auxv.h>
3704 return !AT_SUN_SYSSTAT_ADDR;
3706 solaris_reserve_sysstat_addr=yes
3707 AC_MSG_RESULT([yes])
3708 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
3709 [Define to 1 if you have the new `sysstat' segment reservation.])
3711 solaris_reserve_sysstat_addr=no
3714 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
3717 # Solaris-specific check determining if "sysstat_zone" segment reservation type
3720 # New "sysstat_zone" segment reservation (available on Solaris 11.4):
3721 # - program header type: PT_SUNW_SYSSTAT_ZONE
3722 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
3724 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3725 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3727 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
3728 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3729 #include <sys/auxv.h>
3731 return !AT_SUN_SYSSTAT_ZONE_ADDR;
3733 solaris_reserve_sysstat_zone_addr=yes
3734 AC_MSG_RESULT([yes])
3735 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
3736 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
3738 solaris_reserve_sysstat_zone_addr=no
3741 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
3744 # Solaris-specific check determining if the system_stats() syscall is available
3745 # (on newer Solaris).
3747 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3748 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3750 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
3751 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3752 #include <sys/syscall.h>
3754 return !SYS_system_stats;
3756 solaris_system_stats_syscall=yes
3757 AC_MSG_RESULT([yes])
3758 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
3759 [Define to 1 if you have the `system_stats' syscall.])
3761 solaris_system_stats_syscall=no
3764 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
3767 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
3768 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
3770 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
3771 # Automake-level symbol: none
3773 AC_CHECK_TYPE([struct _fpchip_state],
3774 [solaris_fpchip_state_takes_underscore=yes],
3775 [solaris_fpchip_state_takes_underscore=no],
3776 [[#include <sys/regset.h>]])
3777 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
3778 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
3779 [Define to 1 if fpregset_t defines struct _fpchip_state])
3783 # Solaris-specific check determining if schedctl page shared between kernel
3784 # and userspace program is executable (illumos, older Solaris) or not (newer
3787 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
3788 # Automake-level symbol: none
3790 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
3791 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3795 #include <schedctl.h>
3799 schedctl_t *scp = schedctl_init();
3803 int fd = open("/proc/self/map", O_RDONLY);
3808 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
3809 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
3810 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
3811 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
3812 return (map.pr_mflags & MA_EXEC);
3818 solaris_schedctl_page_exec=no
3821 solaris_schedctl_page_exec=yes
3822 AC_MSG_RESULT([yes])
3823 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
3824 [Define to 1 if you have the schedctl page executable.])
3828 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
3829 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
3830 # an initial thread pointer for libc (newer Solaris).
3832 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
3833 # Automake-level symbol: none
3835 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
3836 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3837 #include <sys/fasttrap_isa.h>
3839 return !FT_SCRATCHSIZE;
3841 solaris_pt_sunwdtrace_thrp=yes
3842 AC_MSG_RESULT([yes])
3843 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
3844 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
3846 solaris_pt_sunwdtrace_thrp=no
3851 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
3852 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
3853 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
3854 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
3855 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
3856 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
3857 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
3858 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
3859 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
3860 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
3861 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
3862 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
3863 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
3864 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
3865 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
3866 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
3867 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
3868 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
3869 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
3870 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
3871 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
3872 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
3873 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
3874 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
3875 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
3876 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
3877 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
3878 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
3879 fi # test "$VGCONF_OS" = "solaris"
3882 #----------------------------------------------------------------------------
3883 # Checks for C header files.
3884 #----------------------------------------------------------------------------
3887 AC_CHECK_HEADERS([ \
3905 # Verify whether the <linux/futex.h> header is usable.
3906 AC_MSG_CHECKING([if <linux/futex.h> is usable])
3908 save_CFLAGS="$CFLAGS"
3909 CFLAGS="$CFLAGS -D__user="
3910 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3911 #include <linux/futex.h>
3915 ac_have_usable_linux_futex_h=yes
3916 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
3917 [Define to 1 if you have a usable <linux/futex.h> header file.])
3918 AC_MSG_RESULT([yes])
3920 ac_have_usable_linux_futex_h=no
3923 CFLAGS="$save_CFLAGS"
3926 #----------------------------------------------------------------------------
3927 # Checks for typedefs, structures, and compiler characteristics.
3928 #----------------------------------------------------------------------------
3935 #----------------------------------------------------------------------------
3936 # Checks for library functions.
3937 #----------------------------------------------------------------------------
3941 AC_CHECK_LIB([pthread], [pthread_create])
3942 AC_CHECK_LIB([rt], [clock_gettime])
3955 pthread_barrier_init \
3956 pthread_condattr_setclock \
3957 pthread_mutex_timedlock \
3958 pthread_rwlock_timedrdlock \
3959 pthread_rwlock_timedwrlock \
3962 pthread_setname_np \
3978 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
3979 # libraries with any shared object and/or executable. This is NOT what we
3980 # want for e.g. vgpreload_core-x86-linux.so
3983 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
3984 [test x$ac_cv_func_pthread_barrier_init = xyes])
3985 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
3986 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
3987 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
3988 [test x$ac_cv_func_pthread_spin_lock = xyes])
3989 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
3990 [test x$ac_cv_func_pthread_setname_np = xyes])
3992 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3993 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
3994 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
3995 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
3998 #----------------------------------------------------------------------------
4000 #----------------------------------------------------------------------------
4001 # Do we have a useable MPI setup on the primary and/or secondary targets?
4002 # On Linux, by default, assumes mpicc and -m32/-m64
4003 # Note: this is a kludge in that it assumes the specified mpicc
4004 # understands -m32/-m64 regardless of what is specified using
4006 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
4007 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
4010 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
4011 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
4012 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
4013 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
4014 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
4015 mflag_primary=$FLAG_M32
4016 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
4017 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
4018 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
4019 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
4020 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
4021 mflag_primary=$FLAG_M64
4022 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
4023 mflag_primary="$FLAG_M32 -arch i386"
4024 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
4025 mflag_primary="$FLAG_M64 -arch x86_64"
4029 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
4030 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
4031 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS \
4032 -o x$VGCONF_PLATFORM_SEC_CAPS = xMIPS32_LINUX ; then
4033 mflag_secondary=$FLAG_M32
4034 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
4035 mflag_secondary="$FLAG_M32 -arch i386"
4040 [ --with-mpicc= Specify name of MPI2-ised C compiler],
4045 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
4046 ## use these values in the check for a functioning mpicc.
4048 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
4049 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
4050 AM_COND_IF([VGCONF_OS_IS_LINUX],
4051 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4052 LDFLAGS_MPI="-fpic -shared"])
4053 AM_COND_IF([VGCONF_OS_IS_DARWIN],
4054 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
4055 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
4056 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
4057 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
4058 LDFLAGS_MPI="-fpic -shared"])
4060 AC_SUBST([CFLAGS_MPI])
4061 AC_SUBST([LDFLAGS_MPI])
4064 ## See if MPI_CC works for the primary target
4066 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
4068 saved_CFLAGS=$CFLAGS
4070 CFLAGS="$CFLAGS_MPI $mflag_primary"
4071 saved_LDFLAGS="$LDFLAGS"
4072 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
4073 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4077 int ni, na, nd, comb;
4078 int r = MPI_Init(NULL,NULL);
4079 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4080 r |= MPI_Finalize();
4083 ac_have_mpi2_pri=yes
4084 AC_MSG_RESULT([yes, $MPI_CC])
4090 CFLAGS=$saved_CFLAGS
4091 LDFLAGS="$saved_LDFLAGS"
4092 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
4094 ## See if MPI_CC works for the secondary target. Complication: what if
4095 ## there is no secondary target? We need this to then fail.
4096 ## Kludge this by making MPI_CC something which will surely fail in
4099 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
4101 saved_CFLAGS=$CFLAGS
4102 saved_LDFLAGS="$LDFLAGS"
4103 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
4104 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
4105 CC="$MPI_CC this will surely fail"
4109 CFLAGS="$CFLAGS_MPI $mflag_secondary"
4110 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4114 int ni, na, nd, comb;
4115 int r = MPI_Init(NULL,NULL);
4116 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4117 r |= MPI_Finalize();
4120 ac_have_mpi2_sec=yes
4121 AC_MSG_RESULT([yes, $MPI_CC])
4127 CFLAGS=$saved_CFLAGS
4128 LDFLAGS="$saved_LDFLAGS"
4129 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
4132 #----------------------------------------------------------------------------
4133 # Other library checks
4134 #----------------------------------------------------------------------------
4135 # There now follow some tests for Boost, and OpenMP. These
4136 # tests are present because Drd has some regression tests that use
4137 # these packages. All regression test programs all compiled only
4138 # for the primary target. And so it is important that the configure
4139 # checks that follow, use the correct -m32 or -m64 flag for the
4140 # primary target (called $mflag_primary). Otherwise, we can end up
4141 # in a situation (eg) where, on amd64-linux, the test for Boost checks
4142 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
4143 # only build (meaning, the primary target is x86-linux), the build
4144 # of the regtest programs that use Boost fails, because they are
4145 # build as 32-bit (IN THIS EXAMPLE).
4147 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
4148 # NEEDED BY THE REGRESSION TEST PROGRAMS.
4151 # Check whether the boost library 1.35 or later has been installed.
4152 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
4154 AC_MSG_CHECKING([for boost])
4157 safe_CXXFLAGS=$CXXFLAGS
4158 CXXFLAGS="$mflag_primary"
4160 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
4162 AC_LINK_IFELSE([AC_LANG_SOURCE([
4163 #include <boost/thread.hpp>
4164 static void thread_func(void)
4166 int main(int argc, char** argv)
4168 boost::thread t(thread_func);
4173 ac_have_boost_1_35=yes
4174 AC_SUBST([BOOST_CFLAGS], [])
4175 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
4176 AC_MSG_RESULT([yes])
4178 ac_have_boost_1_35=no
4183 CXXFLAGS=$safe_CXXFLAGS
4186 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
4189 # does this compiler support -fopenmp, does it have the include file
4190 # <omp.h> and does it have libgomp ?
4192 AC_MSG_CHECKING([for OpenMP])
4195 CFLAGS="-fopenmp $mflag_primary -Werror"
4197 AC_LINK_IFELSE([AC_LANG_SOURCE([
4199 int main(int argc, char** argv)
4207 AC_MSG_RESULT([yes])
4214 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
4217 # Check for __builtin_popcount
4218 AC_MSG_CHECKING([for __builtin_popcount()])
4219 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4221 __builtin_popcount(2);
4224 AC_MSG_RESULT([yes])
4225 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
4226 [Define to 1 if compiler provides __builtin_popcount().])
4231 # Check for __builtin_clz
4232 AC_MSG_CHECKING([for __builtin_clz()])
4233 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4238 AC_MSG_RESULT([yes])
4239 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
4240 [Define to 1 if compiler provides __builtin_clz().])
4245 # Check for __builtin_ctz
4246 AC_MSG_CHECKING([for __builtin_ctz()])
4247 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4252 AC_MSG_RESULT([yes])
4253 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
4254 [Define to 1 if compiler provides __builtin_ctz().])
4259 # does this compiler have built-in functions for atomic memory access for the
4261 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
4264 CFLAGS="$mflag_primary"
4266 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4268 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4269 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4271 ac_have_builtin_atomic_primary=yes
4272 AC_MSG_RESULT([yes])
4273 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])
4275 ac_have_builtin_atomic_primary=no
4281 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
4282 [test x$ac_have_builtin_atomic_primary = xyes])
4285 # does this compiler have built-in functions for atomic memory access for the
4286 # secondary target ?
4288 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4290 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
4293 CFLAGS="$mflag_secondary"
4295 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4297 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
4299 ac_have_builtin_atomic_secondary=yes
4300 AC_MSG_RESULT([yes])
4302 ac_have_builtin_atomic_secondary=no
4310 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
4311 [test x$ac_have_builtin_atomic_secondary = xyes])
4313 # does this compiler have built-in functions for atomic memory access on
4314 # 64-bit integers for all targets ?
4316 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
4318 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4321 uint64_t variable = 1;
4322 return __sync_add_and_fetch(&variable, 1)
4324 ac_have_builtin_atomic64_primary=yes
4326 ac_have_builtin_atomic64_primary=no
4329 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4332 CFLAGS="$mflag_secondary"
4334 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4337 uint64_t variable = 1;
4338 return __sync_add_and_fetch(&variable, 1)
4340 ac_have_builtin_atomic64_secondary=yes
4342 ac_have_builtin_atomic64_secondary=no
4349 if test x$ac_have_builtin_atomic64_primary = xyes && \
4350 test x$VGCONF_PLATFORM_SEC_CAPS = x \
4351 -o x$ac_have_builtin_atomic64_secondary = xyes; then
4352 AC_MSG_RESULT([yes])
4353 ac_have_builtin_atomic64=yes
4356 ac_have_builtin_atomic64=no
4359 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
4360 [test x$ac_have_builtin_atomic64 = xyes])
4363 # does g++ have built-in functions for atomic memory access ?
4364 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
4366 safe_CXXFLAGS=$CXXFLAGS
4367 CXXFLAGS="$mflag_primary"
4370 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4372 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4373 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4375 ac_have_builtin_atomic_cxx=yes
4376 AC_MSG_RESULT([yes])
4377 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
4379 ac_have_builtin_atomic_cxx=no
4384 CXXFLAGS=$safe_CXXFLAGS
4386 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
4389 if test x$ac_have_usable_linux_futex_h = xyes \
4390 -a x$ac_have_builtin_atomic_primary = xyes; then
4391 ac_enable_linux_ticket_lock_primary=yes
4393 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
4394 [test x$ac_enable_linux_ticket_lock_primary = xyes])
4396 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
4397 -a x$ac_have_usable_linux_futex_h = xyes \
4398 -a x$ac_have_builtin_atomic_secondary = xyes; then
4399 ac_enable_linux_ticket_lock_secondary=yes
4401 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
4402 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
4405 # does libstdc++ support annotating shared pointers ?
4406 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
4408 safe_CXXFLAGS=$CXXFLAGS
4409 CXXFLAGS="-std=c++0x"
4412 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4415 std::shared_ptr<int> p
4417 ac_have_shared_ptr=yes
4419 ac_have_shared_ptr=no
4421 if test x$ac_have_shared_ptr = xyes; then
4422 # If compilation of the program below fails because of a syntax error
4423 # triggered by substituting one of the annotation macros then that
4424 # means that libstdc++ supports these macros.
4425 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4426 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
4427 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
4430 std::shared_ptr<int> p
4432 ac_have_shared_pointer_annotation=no
4435 ac_have_shared_pointer_annotation=yes
4436 AC_MSG_RESULT([yes])
4437 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
4438 [Define to 1 if libstd++ supports annotating shared pointers])
4441 ac_have_shared_pointer_annotation=no
4446 CXXFLAGS=$safe_CXXFLAGS
4448 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
4449 [test x$ac_have_shared_pointer_annotation = xyes])
4452 #----------------------------------------------------------------------------
4453 # Ok. We're done checking.
4454 #----------------------------------------------------------------------------
4456 # Nb: VEX/Makefile is generated from Makefile.vex.in.
4459 VEX/Makefile:Makefile.vex.in
4468 gdbserver_tests/Makefile
4469 gdbserver_tests/solaris/Makefile
4475 memcheck/tests/Makefile
4476 memcheck/tests/common/Makefile
4477 memcheck/tests/amd64/Makefile
4478 memcheck/tests/x86/Makefile
4479 memcheck/tests/linux/Makefile
4480 memcheck/tests/darwin/Makefile
4481 memcheck/tests/solaris/Makefile
4482 memcheck/tests/amd64-linux/Makefile
4483 memcheck/tests/arm64-linux/Makefile
4484 memcheck/tests/x86-linux/Makefile
4485 memcheck/tests/amd64-solaris/Makefile
4486 memcheck/tests/x86-solaris/Makefile
4487 memcheck/tests/ppc32/Makefile
4488 memcheck/tests/ppc64/Makefile
4489 memcheck/tests/s390x/Makefile
4490 memcheck/tests/mips32/Makefile
4491 memcheck/tests/mips64/Makefile
4492 memcheck/tests/vbit-test/Makefile
4494 cachegrind/tests/Makefile
4495 cachegrind/tests/x86/Makefile
4496 cachegrind/cg_annotate
4499 callgrind/callgrind_annotate
4500 callgrind/callgrind_control
4501 callgrind/tests/Makefile
4503 helgrind/tests/Makefile
4505 massif/tests/Makefile
4508 lackey/tests/Makefile
4511 none/tests/scripts/Makefile
4512 none/tests/amd64/Makefile
4513 none/tests/ppc32/Makefile
4514 none/tests/ppc64/Makefile
4515 none/tests/x86/Makefile
4516 none/tests/arm/Makefile
4517 none/tests/arm64/Makefile
4518 none/tests/s390x/Makefile
4519 none/tests/mips32/Makefile
4520 none/tests/mips64/Makefile
4521 none/tests/linux/Makefile
4522 none/tests/darwin/Makefile
4523 none/tests/solaris/Makefile
4524 none/tests/amd64-linux/Makefile
4525 none/tests/x86-linux/Makefile
4526 none/tests/amd64-darwin/Makefile
4527 none/tests/x86-darwin/Makefile
4528 none/tests/amd64-solaris/Makefile
4529 none/tests/x86-solaris/Makefile
4530 exp-sgcheck/Makefile
4531 exp-sgcheck/tests/Makefile
4533 drd/scripts/download-and-build-splash2
4536 exp-bbv/tests/Makefile
4537 exp-bbv/tests/x86/Makefile
4538 exp-bbv/tests/x86-linux/Makefile
4539 exp-bbv/tests/amd64-linux/Makefile
4540 exp-bbv/tests/ppc32-linux/Makefile
4541 exp-bbv/tests/arm-linux/Makefile
4543 exp-dhat/tests/Makefile
4547 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
4548 [chmod +x coregrind/link_tool_exe_linux])
4549 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
4550 [chmod +x coregrind/link_tool_exe_darwin])
4551 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
4552 [chmod +x coregrind/link_tool_exe_solaris])
4557 Maximum build arch: ${ARCH_MAX}
4558 Primary build arch: ${VGCONF_ARCH_PRI}
4559 Secondary build arch: ${VGCONF_ARCH_SEC}
4560 Build OS: ${VGCONF_OS}
4561 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
4562 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
4563 Platform variant: ${VGCONF_PLATVARIANT}
4564 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
4565 Default supp files: ${DEFAULT_SUPP}