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.13.0.SVN],[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.*|applellvm-7.*|applellvm-8.*)
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])
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 endianess 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 # Endianess. The name PPC64 or ppc64 to 64-bit systems of either Endianess.
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([ok (${host_cpu})])
278 AC_MSG_RESULT([no (${host_cpu})])
279 AC_MSG_ERROR([Unsupported host architecture. Sorry])
283 #----------------------------------------------------------------------------
285 # Sometimes it's convenient to subvert the bi-arch build system and
286 # just have a single build even though the underlying platform is
287 # capable of both. Hence handle --enable-only64bit and
288 # --enable-only32bit. Complain if both are issued :-)
289 # [Actually, if either of these options are used, I think both get built,
290 # but only one gets installed. So if you use an in-place build, both can be
293 # Check if a 64-bit only build has been requested
294 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
295 [AC_ARG_ENABLE(only64bit,
296 [ --enable-only64bit do a 64-bit only build],
297 [vg_cv_only64bit=$enableval],
298 [vg_cv_only64bit=no])])
300 # Check if a 32-bit only build has been requested
301 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
302 [AC_ARG_ENABLE(only32bit,
303 [ --enable-only32bit do a 32-bit only build],
304 [vg_cv_only32bit=$enableval],
305 [vg_cv_only32bit=no])])
308 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
310 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
313 #----------------------------------------------------------------------------
315 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
316 # compilation of many C files via -VGO_$(VGCONF_OS) and
317 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
318 AC_MSG_CHECKING([for a supported OS])
325 AC_MSG_RESULT([ok (${host_os})])
328 # Ok, this is linux. Check the kernel version
329 AC_MSG_CHECKING([for the kernel version])
334 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
335 AC_MSG_RESULT([unsupported (${kernel})])
336 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
340 AC_MSG_RESULT([2.6 or later (${kernel})])
347 AC_MSG_RESULT([ok (${host_os})])
349 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
350 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
351 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
352 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
353 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
354 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
355 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
356 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
358 AC_MSG_CHECKING([for the kernel version])
361 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
362 # has only one relevant version, the OS version. The `uname` check
363 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
364 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
365 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
366 # and we don't know of an macros similar to __GLIBC__ to get that info.
368 # XXX: `uname -r` won't do the right thing for cross-compiles, but
369 # that's not a problem yet.
371 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
372 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
373 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
374 # time support for 10.5 (the 9.* pattern just below), I'll leave it
375 # in for now, just in case anybody wants to give it a try. But I'm
376 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
379 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
380 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
381 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
382 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
385 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
386 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
387 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
388 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
391 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
392 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
393 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
394 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
397 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
398 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
399 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
400 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
403 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
404 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
405 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
406 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
409 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
410 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
411 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
412 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
415 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
416 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
417 DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
418 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
421 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
422 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
423 DEFAULT_SUPP="darwin16.supp ${DEFAULT_SUPP}"
424 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
427 AC_MSG_RESULT([unsupported (${kernel})])
428 AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x and 16.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12)])
434 AC_MSG_RESULT([ok (${host_os})])
436 DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
440 AC_MSG_RESULT([ok (${host_os})])
442 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
446 AC_MSG_RESULT([no (${host_os})])
447 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
451 #----------------------------------------------------------------------------
453 # If we are building on a 64 bit platform test to see if the system
454 # supports building 32 bit programs and disable 32 bit support if it
455 # does not support building 32 bit programs
457 case "$ARCH_MAX-$VGCONF_OS" in
458 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
459 AC_MSG_CHECKING([for 32 bit build support])
462 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
467 vg_cv_only64bit="yes"
470 CFLAGS=$safe_CFLAGS;;
473 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
475 [--enable-only32bit was specified but system does not support 32 bit builds])
478 #----------------------------------------------------------------------------
480 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
481 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
482 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
483 # above) will be "amd64" since that reflects the most that this cpu can do,
484 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
485 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
486 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
487 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
488 AC_SUBST(VGCONF_ARCH_PRI)
490 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
491 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
492 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
493 # It is empty if there is no secondary target.
494 AC_SUBST(VGCONF_ARCH_SEC)
496 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
497 # The entire system, including regression and performance tests, will be
498 # built for this target. The "_CAPS" indicates that the name is in capital
499 # letters, and it also uses '_' rather than '-' as a separator, because it's
500 # used to create various Makefile variables, which are all in caps by
501 # convention and cannot contain '-' characters. This is in contrast to
502 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
503 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
505 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
506 # Valgrind and tools will also be built for this target, but not the
507 # regression or performance tests.
509 # By default, the primary arch is the same as the "max" arch, as commented
510 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
511 # the big case statement just below here, in the case where we're building
512 # on a 64 bit machine but have been requested only to do a 32 bit build.
513 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
515 AC_MSG_CHECKING([for a supported CPU/OS combination])
517 # NB. The load address for a given platform may be specified in more
518 # than one place, in some cases, depending on whether we're doing a biarch,
519 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
520 # Be careful to give consistent values in all subcases. Also, all four
521 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
522 # even if it is to "0xUNSET".
524 case "$ARCH_MAX-$VGCONF_OS" in
526 VGCONF_ARCH_PRI="x86"
528 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
529 VGCONF_PLATFORM_SEC_CAPS=""
530 valt_load_address_pri_norml="0x38000000"
531 valt_load_address_pri_inner="0x28000000"
532 valt_load_address_sec_norml="0xUNSET"
533 valt_load_address_sec_inner="0xUNSET"
534 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
537 valt_load_address_sec_norml="0xUNSET"
538 valt_load_address_sec_inner="0xUNSET"
539 if test x$vg_cv_only64bit = xyes; then
540 VGCONF_ARCH_PRI="amd64"
542 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
543 VGCONF_PLATFORM_SEC_CAPS=""
544 valt_load_address_pri_norml="0x38000000"
545 valt_load_address_pri_inner="0x28000000"
546 elif test x$vg_cv_only32bit = xyes; then
547 VGCONF_ARCH_PRI="x86"
549 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
550 VGCONF_PLATFORM_SEC_CAPS=""
551 valt_load_address_pri_norml="0x38000000"
552 valt_load_address_pri_inner="0x28000000"
554 VGCONF_ARCH_PRI="amd64"
555 VGCONF_ARCH_SEC="x86"
556 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
557 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
558 valt_load_address_pri_norml="0x38000000"
559 valt_load_address_pri_inner="0x28000000"
560 valt_load_address_sec_norml="0x38000000"
561 valt_load_address_sec_inner="0x28000000"
563 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
566 VGCONF_ARCH_PRI="ppc32"
568 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
569 VGCONF_PLATFORM_SEC_CAPS=""
570 valt_load_address_pri_norml="0x38000000"
571 valt_load_address_pri_inner="0x28000000"
572 valt_load_address_sec_norml="0xUNSET"
573 valt_load_address_sec_inner="0xUNSET"
574 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
577 valt_load_address_sec_norml="0xUNSET"
578 valt_load_address_sec_inner="0xUNSET"
579 if test x$vg_cv_only64bit = xyes; then
580 VGCONF_ARCH_PRI="ppc64be"
582 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
583 VGCONF_PLATFORM_SEC_CAPS=""
584 valt_load_address_pri_norml="0x38000000"
585 valt_load_address_pri_inner="0x28000000"
586 elif test x$vg_cv_only32bit = xyes; then
587 VGCONF_ARCH_PRI="ppc32"
589 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
590 VGCONF_PLATFORM_SEC_CAPS=""
591 valt_load_address_pri_norml="0x38000000"
592 valt_load_address_pri_inner="0x28000000"
594 VGCONF_ARCH_PRI="ppc64be"
595 VGCONF_ARCH_SEC="ppc32"
596 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
597 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
598 valt_load_address_pri_norml="0x38000000"
599 valt_load_address_pri_inner="0x28000000"
600 valt_load_address_sec_norml="0x38000000"
601 valt_load_address_sec_inner="0x28000000"
603 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
606 # Little Endian is only supported on PPC64
607 valt_load_address_sec_norml="0xUNSET"
608 valt_load_address_sec_inner="0xUNSET"
609 VGCONF_ARCH_PRI="ppc64le"
611 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
612 VGCONF_PLATFORM_SEC_CAPS=""
613 valt_load_address_pri_norml="0x38000000"
614 valt_load_address_pri_inner="0x28000000"
615 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
617 # Darwin gets identified as 32-bit even when it supports 64-bit.
618 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
619 # all Macs support both 32-bit and 64-bit, so we just build both. If
620 # someone has a really old 32-bit only machine they can (hopefully?)
621 # build with --enable-only32bit. See bug 243362.
622 x86-darwin|amd64-darwin)
624 valt_load_address_sec_norml="0xUNSET"
625 valt_load_address_sec_inner="0xUNSET"
626 if test x$vg_cv_only64bit = xyes; then
627 VGCONF_ARCH_PRI="amd64"
629 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
630 VGCONF_PLATFORM_SEC_CAPS=""
631 valt_load_address_pri_norml="0x138000000"
632 valt_load_address_pri_inner="0x128000000"
633 elif test x$vg_cv_only32bit = xyes; then
634 VGCONF_ARCH_PRI="x86"
636 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
637 VGCONF_PLATFORM_SEC_CAPS=""
638 VGCONF_ARCH_PRI_CAPS="x86"
639 valt_load_address_pri_norml="0x38000000"
640 valt_load_address_pri_inner="0x28000000"
642 VGCONF_ARCH_PRI="amd64"
643 VGCONF_ARCH_SEC="x86"
644 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
645 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
646 valt_load_address_pri_norml="0x138000000"
647 valt_load_address_pri_inner="0x128000000"
648 valt_load_address_sec_norml="0x38000000"
649 valt_load_address_sec_inner="0x28000000"
651 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
654 VGCONF_ARCH_PRI="arm"
655 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
656 VGCONF_PLATFORM_SEC_CAPS=""
657 valt_load_address_pri_norml="0x38000000"
658 valt_load_address_pri_inner="0x28000000"
659 valt_load_address_sec_norml="0xUNSET"
660 valt_load_address_sec_inner="0xUNSET"
661 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
664 valt_load_address_sec_norml="0xUNSET"
665 valt_load_address_sec_inner="0xUNSET"
666 if test x$vg_cv_only64bit = xyes; then
667 VGCONF_ARCH_PRI="arm64"
669 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
670 VGCONF_PLATFORM_SEC_CAPS=""
671 valt_load_address_pri_norml="0x38000000"
672 valt_load_address_pri_inner="0x28000000"
673 elif test x$vg_cv_only32bit = xyes; then
674 VGCONF_ARCH_PRI="arm"
676 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
677 VGCONF_PLATFORM_SEC_CAPS=""
678 valt_load_address_pri_norml="0x38000000"
679 valt_load_address_pri_inner="0x28000000"
681 VGCONF_ARCH_PRI="arm64"
682 VGCONF_ARCH_SEC="arm"
683 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
684 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
685 valt_load_address_pri_norml="0x38000000"
686 valt_load_address_pri_inner="0x28000000"
687 valt_load_address_sec_norml="0x38000000"
688 valt_load_address_sec_inner="0x28000000"
690 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
693 VGCONF_ARCH_PRI="s390x"
695 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
696 VGCONF_PLATFORM_SEC_CAPS=""
697 # To improve branch prediction hit rate we want to have
698 # the generated code close to valgrind (host) code
699 valt_load_address_pri_norml="0x800000000"
700 valt_load_address_pri_inner="0x810000000"
701 valt_load_address_sec_norml="0xUNSET"
702 valt_load_address_sec_inner="0xUNSET"
703 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
706 VGCONF_ARCH_PRI="mips32"
707 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
708 VGCONF_PLATFORM_SEC_CAPS=""
709 valt_load_address_pri_norml="0x38000000"
710 valt_load_address_pri_inner="0x28000000"
711 valt_load_address_sec_norml="0xUNSET"
712 valt_load_address_sec_inner="0xUNSET"
713 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
716 VGCONF_ARCH_PRI="mips64"
717 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
718 VGCONF_PLATFORM_SEC_CAPS=""
719 valt_load_address_pri_norml="0x38000000"
720 valt_load_address_pri_inner="0x28000000"
721 valt_load_address_sec_norml="0xUNSET"
722 valt_load_address_sec_inner="0xUNSET"
723 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
726 VGCONF_ARCH_PRI="tilegx"
728 VGCONF_PLATFORM_PRI_CAPS="TILEGX_LINUX"
729 VGCONF_PLATFORM_SEC_CAPS=""
730 valt_load_address_pri_norml="0x38000000"
731 valt_load_address_pri_inner="0x28000000"
732 valt_load_address_sec_norml="0xUNSET"
733 valt_load_address_sec_inner="0xUNSET"
734 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
737 VGCONF_ARCH_PRI="x86"
739 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
740 VGCONF_PLATFORM_SEC_CAPS=""
741 valt_load_address_pri_norml="0x38000000"
742 valt_load_address_pri_inner="0x28000000"
743 valt_load_address_sec_norml="0xUNSET"
744 valt_load_address_sec_inner="0xUNSET"
745 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
748 valt_load_address_sec_norml="0xUNSET"
749 valt_load_address_sec_inner="0xUNSET"
750 if test x$vg_cv_only64bit = xyes; then
751 VGCONF_ARCH_PRI="amd64"
753 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
754 VGCONF_PLATFORM_SEC_CAPS=""
755 valt_load_address_pri_norml="0x38000000"
756 valt_load_address_pri_inner="0x28000000"
757 elif test x$vg_cv_only32bit = xyes; then
758 VGCONF_ARCH_PRI="x86"
760 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
761 VGCONF_PLATFORM_SEC_CAPS=""
762 valt_load_address_pri_norml="0x38000000"
763 valt_load_address_pri_inner="0x28000000"
765 VGCONF_ARCH_PRI="amd64"
766 VGCONF_ARCH_SEC="x86"
767 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
768 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
769 valt_load_address_pri_norml="0x38000000"
770 valt_load_address_pri_inner="0x28000000"
771 valt_load_address_sec_norml="0x38000000"
772 valt_load_address_sec_inner="0x28000000"
774 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
777 VGCONF_ARCH_PRI="unknown"
778 VGCONF_ARCH_SEC="unknown"
779 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
780 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
781 valt_load_address_pri_norml="0xUNSET"
782 valt_load_address_pri_inner="0xUNSET"
783 valt_load_address_sec_norml="0xUNSET"
784 valt_load_address_sec_inner="0xUNSET"
785 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
786 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
790 #----------------------------------------------------------------------------
792 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
794 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
795 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
796 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
797 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
798 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
799 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
800 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
801 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
802 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
803 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
804 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
805 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
806 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
807 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
808 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
809 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
810 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
811 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
812 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
813 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
814 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
815 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
816 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
817 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
818 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
819 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
820 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
821 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
822 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_TILEGX,
823 test x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX )
825 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
827 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
828 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
829 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
830 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
831 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
832 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
833 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
834 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
835 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
836 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
837 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
838 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
839 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
840 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
841 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
842 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
843 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
844 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
845 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
846 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
847 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
848 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
849 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
850 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
851 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_TILEGX_LINUX,
852 test x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX)
853 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
854 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
855 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
856 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
857 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
858 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
859 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
860 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
861 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
862 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
865 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
866 # Relies on the assumption that the primary and secondary targets are
867 # for the same OS, so therefore only necessary to test the primary.
868 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
869 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
870 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
871 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
872 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
873 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
874 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
875 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
876 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
877 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
878 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
879 -o x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX)
880 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
881 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
882 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
883 AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
884 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
885 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
888 # Sometimes, in the Makefile.am files, it's useful to know whether or not
889 # there is a secondary target.
890 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
891 test x$VGCONF_PLATFORM_SEC_CAPS != x)
893 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
894 dnl fallback definition
895 dnl The macro is courtesy of Dave Hart:
896 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
897 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
898 if test -z "$$1_TRUE"; then :
907 #----------------------------------------------------------------------------
909 #----------------------------------------------------------------------------
911 # Check if this should be built as an inner Valgrind, to be run within
912 # another Valgrind. Choose the load address accordingly.
913 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
914 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
915 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
916 [AC_ARG_ENABLE(inner,
917 [ --enable-inner enables self-hosting],
918 [vg_cv_inner=$enableval],
920 if test "$vg_cv_inner" = yes; then
921 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
922 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
923 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
925 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
926 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
929 #----------------------------------------------------------------------------
930 # Undefined behaviour sanitiser
931 #----------------------------------------------------------------------------
932 # Check whether we should build with the undefined beahviour sanitiser.
934 AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
935 [AC_ARG_ENABLE(ubsan,
936 [ --enable-ubsan enables the undefined behaviour sanitiser],
937 [vg_cv_ubsan=$enableval],
940 #----------------------------------------------------------------------------
941 # Extra fine-tuning of installation directories
942 #----------------------------------------------------------------------------
944 [ --with-tmpdir=PATH Specify path for temporary files],
947 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
948 AC_SUBST(VG_TMPDIR, [$tmpdir])
951 #----------------------------------------------------------------------------
952 # Libc and suppressions
953 #----------------------------------------------------------------------------
954 # This variable will collect the suppression files to be used.
955 AC_SUBST(DEFAULT_SUPP)
957 AC_CHECK_HEADER([features.h])
959 if test x$ac_cv_header_features_h = xyes; then
960 rm -f conftest.$ac_ext
961 cat <<_ACEOF >conftest.$ac_ext
962 #include <features.h>
963 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
964 glibc version is: __GLIBC__ __GLIBC_MINOR__
967 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
970 # not really a version check
971 AC_EGREP_CPP([DARWIN_LIBC], [
972 #include <sys/cdefs.h>
973 #if defined(__DARWIN_VERS_1050)
977 GLIBC_VERSION="darwin")
979 # not really a version check
980 AC_EGREP_CPP([BIONIC_LIBC], [
981 #if defined(__ANDROID__)
985 GLIBC_VERSION="bionic")
987 # there is only one version of libc on Solaris
988 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
989 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
990 GLIBC_VERSION="solaris"
994 AC_MSG_CHECKING([the glibc version])
996 case "${GLIBC_VERSION}" in
998 AC_MSG_RESULT(${GLIBC_VERSION} family)
999 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
1000 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
1001 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1004 AC_MSG_RESULT(${GLIBC_VERSION} family)
1005 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
1006 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1007 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1010 AC_MSG_RESULT(${GLIBC_VERSION} family)
1011 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1012 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1013 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1016 AC_MSG_RESULT(${GLIBC_VERSION} family)
1017 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1018 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1019 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1020 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1021 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1024 AC_MSG_RESULT(${GLIBC_VERSION} family)
1025 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1026 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1027 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1028 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
1029 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1030 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1031 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1034 AC_MSG_RESULT(Darwin)
1035 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1036 # DEFAULT_SUPP set by kernel version check above.
1039 AC_MSG_RESULT(Bionic)
1040 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1041 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1044 AC_MSG_RESULT(Solaris)
1045 # DEFAULT_SUPP set in host_os switch-case above.
1046 # No other suppression file is used.
1049 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
1050 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
1051 AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
1055 AC_SUBST(GLIBC_VERSION)
1058 if test "$VGCONF_OS" != "solaris"; then
1059 # Add default suppressions for the X client libraries. Make no
1060 # attempt to detect whether such libraries are installed on the
1061 # build machine (or even if any X facilities are present); just
1062 # add the suppressions antidisirregardless.
1063 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1064 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
1066 # Add glibc and X11 suppressions for exp-sgcheck
1067 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1071 #----------------------------------------------------------------------------
1072 # Platform variants?
1073 #----------------------------------------------------------------------------
1075 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1076 # But there are times where we need a bit more control. The motivating
1077 # and currently only case is Android: this is almost identical to
1078 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1079 # platform variant tags, which get passed in the compile as
1080 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
1082 # In almost all cases, the <variant> bit is "vanilla". But for Android
1083 # it is "android" instead.
1085 # Consequently (eg), plain arm-linux would build with
1087 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1089 # whilst an Android build would have
1091 # -DVGP_arm_linux -DVGPV_arm_linux_android
1093 # Same for x86. The setup of the platform variant is pushed relatively far
1094 # down this file in order that we can inspect any of the variables set above.
1096 # In the normal case ..
1097 VGCONF_PLATVARIANT="vanilla"
1100 if test "$GLIBC_VERSION" = "bionic";
1102 VGCONF_PLATVARIANT="android"
1105 AC_SUBST(VGCONF_PLATVARIANT)
1108 # FIXME: do we also want to define automake variables
1109 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1110 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1111 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1112 # do that. Problem is that we can't do and-ing in Makefile.am's, but
1113 # that's what we'd need to do to use this, since what we'd want to write
1116 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1118 # Hmm. Can't think of a nice clean solution to this.
1120 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1121 test x$VGCONF_PLATVARIANT = xvanilla)
1122 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1123 test x$VGCONF_PLATVARIANT = xandroid)
1126 #----------------------------------------------------------------------------
1127 # Checking for various library functions and other definitions
1128 #----------------------------------------------------------------------------
1130 # Check for AT_FDCWD
1132 AC_MSG_CHECKING([for AT_FDCWD])
1133 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1140 ac_have_at_fdcwd=yes
1141 AC_MSG_RESULT([yes])
1147 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1149 # Check for stpncpy function definition in string.h
1150 # This explicitly checks with _GNU_SOURCE defined since that is also
1151 # used in the test case (some systems might define it without anyway
1152 # since stpncpy is part of The Open Group Base Specifications Issue 7
1153 # IEEE Std 1003.1-2008.
1154 AC_MSG_CHECKING([for stpncpy])
1155 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1162 char *r = stpncpy(d, s, n);
1164 ac_have_gnu_stpncpy=yes
1165 AC_MSG_RESULT([yes])
1167 ac_have_gnu_stpncpy=no
1171 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1173 # Check for PTRACE_GETREGS
1175 AC_MSG_CHECKING([for PTRACE_GETREGS])
1176 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1179 #include <sys/ptrace.h>
1180 #include <sys/user.h>
1183 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1185 AC_MSG_RESULT([yes])
1186 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1187 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1193 # Check for CLOCK_MONOTONIC
1195 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1197 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1201 clock_gettime(CLOCK_MONOTONIC, &t);
1204 AC_MSG_RESULT([yes])
1205 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1206 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1212 # Check for ELF32/64_CHDR
1214 AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1217 # Check for PTHREAD_RWLOCK_T
1219 AC_MSG_CHECKING([for pthread_rwlock_t])
1221 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1223 #include <pthread.h>
1225 pthread_rwlock_t rwl;
1227 AC_MSG_RESULT([yes])
1228 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1229 [Define to 1 if you have the `pthread_rwlock_t' type.])
1235 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1237 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1239 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1241 #include <pthread.h>
1243 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1245 AC_MSG_RESULT([yes])
1246 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1247 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1253 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1255 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1257 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1259 #include <pthread.h>
1261 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1263 AC_MSG_RESULT([yes])
1264 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1265 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1271 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1273 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1275 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1277 #include <pthread.h>
1279 return (PTHREAD_MUTEX_RECURSIVE_NP);
1281 AC_MSG_RESULT([yes])
1282 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1283 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1289 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1291 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1293 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1295 #include <pthread.h>
1297 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1300 AC_MSG_RESULT([yes])
1301 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1302 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1308 # Check whether pthread_mutex_t has a member called __m_kind.
1310 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1311 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1313 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1316 [#include <pthread.h>])
1319 # Check whether pthread_mutex_t has a member called __data.__kind.
1321 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1322 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1324 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1327 [#include <pthread.h>])
1329 # Convenience function. Set flags based on the existing HWCAP entries.
1330 # The AT_HWCAP entries are generated by glibc, and are based on
1331 # functions supported by the hardware/system/libc.
1332 # Subsequent support for whether the capability will actually be utilized
1333 # will also be checked against the compiler capabilities.
1335 # AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1336 AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1338 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
1339 if LD_SHOW_AUXV=1 `which true` | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
1341 AC_MSG_RESULT([yes])
1342 AC_SUBST([$2],[yes])
1349 # gather hardware capabilities. (hardware/kernel/libc)
1350 AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1351 AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1352 AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1353 AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1354 AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1355 AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
1356 AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
1357 AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
1360 AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1361 AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1362 # compiler support for isa 2.07 level instructions
1363 AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1364 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1366 __asm__ __volatile__("mtvsrd 1,2 ");
1368 ac_asm_have_isa_2_07=yes
1369 AC_MSG_RESULT([yes])
1371 ac_asm_have_isa_2_07=no
1374 AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1375 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1377 # altivec (vsx) support.
1378 # does this compiler support -maltivec and does it have the include file
1380 AC_MSG_CHECKING([for Altivec support in the compiler ])
1382 CFLAGS="-maltivec -Werror"
1383 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1384 #include <altivec.h>
1386 vector unsigned int v;
1389 AC_MSG_RESULT([yes])
1395 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1396 -a x$HWCAP_HAS_ALTIVEC = xyes])
1398 # Check that both: the compiler supports -mvsx and that the assembler
1399 # understands VSX instructions. If either of those doesn't work,
1400 # conclude that we can't do VSX.
1401 AC_MSG_CHECKING([for VSX compiler flag support])
1403 CFLAGS="-mvsx -Werror"
1404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1407 ac_compiler_supports_vsx_flag=yes
1408 AC_MSG_RESULT([yes])
1410 ac_compiler_supports_vsx_flag=no
1415 AC_MSG_CHECKING([for VSX support in the assembler ])
1417 CFLAGS="-mvsx -Werror"
1418 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1419 #include <altivec.h>
1421 vector unsigned int v;
1422 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1424 ac_compiler_supports_vsx=yes
1425 AC_MSG_RESULT([yes])
1427 ac_compiler_supports_vsx=no
1431 AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1432 -a x$ac_compiler_supports_vsx = xyes \
1433 -a x$HWCAP_HAS_VSX = xyes ])
1435 # DFP (Decimal Float)
1436 AC_MSG_CHECKING([that assembler knows DFP])
1437 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1440 __asm__ __volatile__("adtr 1, 2, 3")
1442 __asm__ __volatile__("dadd 1, 2, 3");
1443 __asm__ __volatile__("dcffix 1, 2");
1447 AC_MSG_RESULT([yes])
1452 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1454 CFLAGS="-mhard-dfp -Werror"
1455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1458 __asm__ __volatile__("adtr 1, 2, 3")
1460 __asm__ __volatile__("dadd 1, 2, 3");
1461 __asm__ __volatile__("dcffix 1, 2");
1464 ac_compiler_have_dfp=yes
1465 AC_MSG_RESULT([yes])
1467 ac_compiler_have_dfp=no
1471 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1472 -a x$ac_compiler_have_dfp = xyes \
1473 -a x$HWCAP_HAS_DFP = xyes )
1475 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1476 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1478 _Decimal64 x = 0.0DD;
1480 ac_compiler_have_dfp_type=yes
1481 AC_MSG_RESULT([yes])
1483 ac_compiler_have_dfp_type=no
1486 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1487 -a x$HWCAP_HAS_DFP = xyes )
1490 # HTM (Hardware Transactional Memory)
1491 AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1493 CFLAGS="-mhtm -Werror"
1494 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1498 AC_MSG_RESULT([yes])
1499 ac_compiler_supports_htm=yes
1502 ac_compiler_supports_htm=no
1506 AC_MSG_CHECKING([if compiler can find the htm builtins])
1508 CFLAGS="-mhtm -Werror"
1509 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1511 if (__builtin_tbegin (0))
1514 AC_MSG_RESULT([yes])
1515 ac_compiler_sees_htm_builtins=yes
1518 ac_compiler_sees_htm_builtins=no
1522 AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1523 -a x$ac_compiler_sees_htm_builtins = xyes \
1524 -a x$HWCAP_HAS_HTM = xyes )
1527 AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1529 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1531 __asm__ __volatile__("cnttzw 1,2 ");
1533 ac_asm_have_isa_3_00=yes
1534 AC_MSG_RESULT([yes])
1536 ac_asm_have_isa_3_00=no
1540 AM_CONDITIONAL(HAS_ISA_3_00, test x$ac_asm_have_isa_3_00 = xyes \
1541 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1543 # Check for pthread_create@GLIBC2.0
1544 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1547 CFLAGS="-lpthread -Werror"
1548 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1549 extern int pthread_create_glibc_2_0(void*, const void*,
1550 void *(*)(void*), void*);
1551 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1555 * Apparently on PowerPC linking this program succeeds and generates an
1556 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1558 #error This test does not work properly on PowerPC.
1560 pthread_create_glibc_2_0(0, 0, 0, 0);
1564 ac_have_pthread_create_glibc_2_0=yes
1565 AC_MSG_RESULT([yes])
1566 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1567 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1569 ac_have_pthread_create_glibc_2_0=no
1574 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1575 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1578 # Check for dlinfo RTLD_DI_TLS_MODID
1579 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1583 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1590 size_t sizes[10000];
1591 size_t modid_offset;
1592 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1595 ac_have_dlinfo_rtld_di_tls_modid=yes
1596 AC_MSG_RESULT([yes])
1597 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1598 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1600 ac_have_dlinfo_rtld_di_tls_modid=no
1605 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1606 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1609 # Check for eventfd_t, eventfd() and eventfd_read()
1610 AC_MSG_CHECKING([for eventfd()])
1612 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1613 #include <sys/eventfd.h>
1619 eventfd_read(fd, &ev);
1622 AC_MSG_RESULT([yes])
1623 AC_DEFINE([HAVE_EVENTFD], 1,
1624 [Define to 1 if you have the `eventfd' function.])
1625 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1626 [Define to 1 if you have the `eventfd_read' function.])
1631 # Check whether compiler can process #include <thread> without errors
1632 # clang 3.3 cannot process <thread> from e.g.
1633 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1635 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1637 safe_CXXFLAGS=$CXXFLAGS
1640 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1644 ac_cxx_can_include_thread_header=yes
1645 AC_MSG_RESULT([yes])
1647 ac_cxx_can_include_thread_header=no
1650 CXXFLAGS=$safe_CXXFLAGS
1653 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1656 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1657 # of the user_regs_struct from sys/user.h. They are structurally the same
1658 # but we get either one or the other.
1660 AC_CHECK_TYPE([struct user_regs_struct],
1661 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1662 [[#include <sys/ptrace.h>]
1663 [#include <sys/time.h>]
1664 [#include <sys/user.h>]])
1665 if test "$sys_user_has_user_regs" = "yes"; then
1666 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1667 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1671 #----------------------------------------------------------------------------
1672 # Checking for supported compiler flags.
1673 #----------------------------------------------------------------------------
1675 # does this compiler support -m32 ?
1676 AC_MSG_CHECKING([if gcc accepts -m32])
1679 CFLAGS="-m32 -Werror"
1681 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1685 AC_MSG_RESULT([yes])
1695 # does this compiler support -m64 ?
1696 AC_MSG_CHECKING([if gcc accepts -m64])
1699 CFLAGS="-m64 -Werror"
1701 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1705 AC_MSG_RESULT([yes])
1715 # does this compiler support -march=mips32 (mips32 default) ?
1716 AC_MSG_CHECKING([if gcc accepts -march=mips32])
1719 CFLAGS="$CFLAGS -march=mips32 -Werror"
1721 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1724 FLAG_MIPS32="-march=mips32"
1725 AC_MSG_RESULT([yes])
1732 AC_SUBST(FLAG_MIPS32)
1735 # does this compiler support -march=mips64 (mips64 default) ?
1736 AC_MSG_CHECKING([if gcc accepts -march=mips64])
1739 CFLAGS="$CFLAGS -march=mips64 -Werror"
1741 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1744 FLAG_MIPS64="-march=mips64"
1745 AC_MSG_RESULT([yes])
1752 AC_SUBST(FLAG_MIPS64)
1755 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1756 AC_MSG_CHECKING([if gcc accepts -march=octeon])
1759 CFLAGS="$CFLAGS -march=octeon -Werror"
1761 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1764 FLAG_OCTEON="-march=octeon"
1765 AC_MSG_RESULT([yes])
1772 AC_SUBST(FLAG_OCTEON)
1775 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1776 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1779 CFLAGS="$CFLAGS -march=octeon2 -Werror"
1781 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1784 FLAG_OCTEON2="-march=octeon2"
1785 AC_MSG_RESULT([yes])
1792 AC_SUBST(FLAG_OCTEON2)
1795 # does this compiler support -mmmx ?
1796 AC_MSG_CHECKING([if gcc accepts -mmmx])
1799 CFLAGS="-mmmx -Werror"
1801 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1805 AC_MSG_RESULT([yes])
1815 # does this compiler support -msse ?
1816 AC_MSG_CHECKING([if gcc accepts -msse])
1819 CFLAGS="-msse -Werror"
1821 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1825 AC_MSG_RESULT([yes])
1835 # does this compiler support -mpreferred-stack-boundary=2 when
1836 # generating code for a 32-bit target? Note that we only care about
1837 # this when generating code for (32-bit) x86, so if the compiler
1838 # doesn't recognise -m32 it's no big deal. We'll just get code for
1839 # the Memcheck and other helper functions, that is a bit slower than
1840 # it could be, on x86; and no difference at all on any other platform.
1841 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
1844 CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
1846 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1849 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
1850 AC_MSG_RESULT([yes])
1852 PREFERRED_STACK_BOUNDARY_2=""
1857 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
1860 # does this compiler support -mlong-double-128 ?
1861 AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
1863 CFLAGS="-mlong-double-128 -Werror"
1864 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1867 ac_compiler_supports_mlong_double_128=yes
1868 AC_MSG_RESULT([yes])
1870 ac_compiler_supports_mlong_double_128=no
1874 AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
1875 FLAG_MLONG_DOUBLE_128="-mlong-double-128"
1876 AC_SUBST(FLAG_MLONG_DOUBLE_128)
1879 # Convenience function to check whether GCC supports a particular
1880 # warning option. Takes two arguments,
1881 # first the warning flag name to check (without -W), then the
1882 # substitution name to set with -Wno-warning-flag if the flag exists,
1883 # or the empty string if the compiler doesn't accept the flag. Note
1884 # that checking is done against the warning flag itself, but the
1885 # substitution is then done to cancel the warning flag.
1886 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
1887 AC_MSG_CHECKING([if gcc accepts -W$1])
1889 CFLAGS="-W$1 -Werror"
1890 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1891 AC_SUBST([$2], [-Wno-$1])
1892 AC_MSG_RESULT([yes])], [
1894 AC_MSG_RESULT([no])])
1898 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
1899 # -W$1 (instead of -Wno-$1).
1900 AC_DEFUN([AC_GCC_WARNING_SUBST],[
1901 AC_MSG_CHECKING([if gcc accepts -W$1])
1903 CFLAGS="-W$1 -Werror"
1904 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1905 AC_SUBST([$2], [-W$1])
1906 AC_MSG_RESULT([yes])], [
1908 AC_MSG_RESULT([no])])
1912 AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
1913 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1914 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
1915 AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
1916 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
1917 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1918 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
1919 AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
1920 AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
1921 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
1922 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
1923 AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
1924 # Disabled for now until all platforms are clean
1925 format_checking_enabled=no
1926 #format_checking_enabled=yes
1927 if test "$format_checking_enabled" = "yes"; then
1928 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
1930 dumy_assignment_to_avoid_syntax_errors=1
1931 AC_SUBST([FLAG_W_FORMAT_SIGNEDNESS], [])
1933 AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
1934 AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
1935 AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
1936 AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
1938 # Does this compiler support -Wformat-security ?
1939 # Special handling is needed, because certain GCC versions require -Wformat
1940 # being present if -Wformat-security is given. Otherwise a warning is issued.
1941 # However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
1942 # And with that the warning will be turned into an error with the result
1943 # that -Wformat-security is believed to be unsupported when in fact it is.
1944 AC_MSG_CHECKING([if gcc accepts -Wformat-security])
1946 CFLAGS="-Wformat -Wformat-security -Werror"
1947 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1948 AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
1949 AC_MSG_RESULT([yes])], [
1950 AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
1951 AC_MSG_RESULT([no])])
1954 # does this compiler support -Wextra or the older -W ?
1956 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1959 CFLAGS="-Wextra -Werror"
1961 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1964 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1965 AC_MSG_RESULT([-Wextra])
1968 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1971 AC_SUBST([FLAG_W_EXTRA], [-W])
1974 AC_SUBST([FLAG_W_EXTRA], [])
1975 AC_MSG_RESULT([not supported])
1980 # On ARM we do not want to pass -Wcast-align as that produces loads
1981 # of warnings. GCC is just being conservative. See here:
1982 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
1983 if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
1984 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
1986 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
1989 # does this compiler support -fno-stack-protector ?
1990 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1993 CFLAGS="-fno-stack-protector -Werror"
1995 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1998 no_stack_protector=yes
1999 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2000 AC_MSG_RESULT([yes])
2002 no_stack_protector=no
2003 FLAG_FNO_STACK_PROTECTOR=""
2008 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2010 # Does GCC support disabling Identical Code Folding?
2011 # We want to disabled Identical Code Folding for the
2012 # tools preload shared objects to get better backraces.
2013 # For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2014 # "The optimization reduces code size and may disturb
2015 # unwind stacks by replacing a function by equivalent
2016 # one with a different name."
2017 AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2020 CFLAGS="-fno-ipa-icf -Werror"
2022 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2026 FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2027 AC_MSG_RESULT([yes])
2035 AC_SUBST(FLAG_FNO_IPA_ICF)
2038 # Does this compiler support -fsanitize=undefined. This is true for
2039 # GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2040 # also checks for alignment violations on memory accesses which the valgrind
2041 # code base is sprinkled (if not littered) with. As those alignment issues
2042 # don't pose a problem we want to suppress warnings about them.
2043 # In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2044 # GCCs do not support that.
2046 # Only checked for if --enable-ubsan was given.
2047 if test "x${vg_cv_ubsan}" = "xyes"; then
2048 AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
2050 CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2051 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2054 FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2055 LIB_UBSAN="-static-libubsan"
2056 AC_MSG_RESULT([yes])
2058 CFLAGS="-fsanitize=undefined -Werror"
2059 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2062 FLAG_FSANITIZE="-fsanitize=undefined"
2063 LIB_UBSAN="-static-libubsan"
2064 AC_MSG_RESULT([yes])
2072 AC_SUBST(FLAG_FSANITIZE)
2075 # does this compiler support --param inline-unit-growth=... ?
2077 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2080 CFLAGS="--param inline-unit-growth=900 -Werror"
2082 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2085 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2086 ["--param inline-unit-growth=900"])
2087 AC_MSG_RESULT([yes])
2089 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2095 # does this compiler support -gdwarf-4 -fdebug-types-section ?
2097 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2100 CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
2102 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2106 AC_MSG_RESULT([yes])
2111 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2115 # does this compiler support -g -gz=zlib ?
2117 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2120 CFLAGS="-g -gz=zlib"
2122 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2126 AC_MSG_RESULT([yes])
2131 AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2135 # does this compiler support -g -gz=zlib-gnu ?
2137 AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2140 CFLAGS="-g -gz=zlib-gnu"
2142 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2145 ac_have_gz_zlib_gnu=yes
2146 AC_MSG_RESULT([yes])
2148 ac_have_gz_zlib_gnu=no
2151 AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2155 # does this compiler support nested functions ?
2157 AC_MSG_CHECKING([if gcc accepts nested functions])
2159 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2160 int foo() { return 1; }
2163 ac_have_nested_functions=yes
2164 AC_MSG_RESULT([yes])
2166 ac_have_nested_functions=no
2169 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2172 # does this compiler support the 'p' constraint in ASM statements ?
2174 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2176 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2178 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2180 ac_have_asm_constraint_p=yes
2181 AC_MSG_RESULT([yes])
2183 ac_have_asm_constraint_p=no
2186 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2189 # We want to use use the -Ttext-segment option to the linker.
2190 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
2191 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2192 # semantics are NOT what we want (GNU gold -Ttext is fine).
2194 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2195 # will reside. -Ttext aligns just the .text section start (but not any
2198 # So test for -Ttext-segment which is supported by all bfd ld versions
2199 # and use that if it exists. If it doesn't exist it must be an older
2200 # version of gold and we can fall back to using -Ttext which has the
2203 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
2206 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
2209 [AC_LANG_SOURCE([int _start () { return 0; }])],
2211 linker_using_t_text="no"
2212 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
2213 AC_MSG_RESULT([yes])
2215 linker_using_t_text="yes"
2216 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
2221 # If the linker only supports -Ttext (not -Ttext-segment) then we will
2222 # have to strip any build-id ELF NOTEs from the staticly linked tools.
2223 # Otherwise the build-id NOTE might end up at the default load address.
2224 # (Pedantically if the linker is gold then -Ttext is fine, but newer
2225 # gold versions also support -Ttext-segment. So just assume that unless
2226 # we can use -Ttext-segment we need to strip the build-id NOTEs.
2227 if test "x${linker_using_t_text}" = "xyes"; then
2228 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
2229 # does the linker support -Wl,--build-id=none ? Note, it's
2230 # important that we test indirectly via whichever C compiler
2231 # is selected, rather than testing /usr/bin/ld or whatever
2233 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
2235 CFLAGS="-Wl,--build-id=none -Werror"
2238 [AC_LANG_PROGRAM([ ], [return 0;])],
2240 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
2241 AC_MSG_RESULT([yes])
2243 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2247 AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
2248 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2252 # does the ppc assembler support "mtocrf" et al?
2253 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
2255 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2256 __asm__ __volatile__("mtocrf 4,0");
2257 __asm__ __volatile__("mfocrf 0,4");
2259 ac_have_as_ppc_mftocrf=yes
2260 AC_MSG_RESULT([yes])
2262 ac_have_as_ppc_mftocrf=no
2265 if test x$ac_have_as_ppc_mftocrf = xyes ; then
2266 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2270 # does the ppc assembler support "lfdp" and other phased out floating point insns?
2271 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2273 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2274 do { typedef struct {
2278 dbl_pair_t dbl_pair[3];
2279 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2282 ac_have_as_ppc_fpPO=yes
2283 AC_MSG_RESULT([yes])
2285 ac_have_as_ppc_fpPO=no
2288 if test x$ac_have_as_ppc_fpPO = xyes ; then
2289 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2293 # does the amd64 assembler understand "fxsave64" and "fxrstor64"?
2294 AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
2296 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2298 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
2299 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
2301 ac_have_as_amd64_fxsave64=yes
2302 AC_MSG_RESULT([yes])
2304 ac_have_as_amd64_fxsave64=no
2307 if test x$ac_have_as_amd64_fxsave64 = xyes ; then
2308 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
2311 # does the x86/amd64 assembler understand SSE3 instructions?
2312 # Note, this doesn't generate a C-level symbol. It generates a
2313 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
2314 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2316 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2317 do { long long int x;
2318 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2322 AC_MSG_RESULT([yes])
2328 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
2331 # Ditto for SSSE3 instructions (note extra S)
2332 # Note, this doesn't generate a C-level symbol. It generates a
2333 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2334 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2336 save_CFLAGS="$CFLAGS"
2337 CFLAGS="$CFLAGS -msse -Werror"
2338 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2339 do { long long int x;
2340 __asm__ __volatile__(
2341 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2344 ac_have_as_ssse3=yes
2345 AC_MSG_RESULT([yes])
2350 CFLAGS="$save_CFLAGS"
2352 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2355 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2356 # Note, this doesn't generate a C-level symbol. It generates a
2357 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
2358 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
2359 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2361 __asm__ __volatile__(
2362 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2365 ac_have_as_pclmulqdq=yes
2366 AC_MSG_RESULT([yes])
2368 ac_have_as_pclmulqdq=no
2372 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2375 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2376 # Note, this doesn't generate a C-level symbol. It generates a
2377 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2378 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2379 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2382 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2383 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2384 * xmm2 should be used.
2386 __asm__ __volatile__(
2387 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2390 ac_have_as_vpclmulqdq=yes
2391 AC_MSG_RESULT([yes])
2393 ac_have_as_vpclmulqdq=no
2397 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2400 # does the x86/amd64 assembler understand FMA4 instructions?
2401 # Note, this doesn't generate a C-level symbol. It generates a
2402 # automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
2403 AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
2404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2406 __asm__ __volatile__(
2407 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
2410 ac_have_as_vfmaddpd=yes
2411 AC_MSG_RESULT([yes])
2413 ac_have_as_vfmaddpd=no
2417 AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
2420 # does the x86/amd64 assembler understand the LZCNT instruction?
2421 # Note, this doesn't generate a C-level symbol. It generates a
2422 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
2423 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2425 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2427 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
2430 ac_have_as_lzcnt=yes
2431 AC_MSG_RESULT([yes])
2437 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2440 # does the x86/amd64 assembler understand the LOOPNEL instruction?
2441 # Note, this doesn't generate a C-level symbol. It generates a
2442 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2443 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2445 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2447 __asm__ __volatile__("1: loopnel 1b\n");
2450 ac_have_as_loopnel=yes
2451 AC_MSG_RESULT([yes])
2453 ac_have_as_loopnel=no
2457 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2460 # does the x86/amd64 assembler understand ADDR32 ?
2461 # Note, this doesn't generate a C-level symbol. It generates a
2462 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2463 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2465 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2467 asm volatile ("addr32 rep movsb");
2470 ac_have_as_addr32=yes
2471 AC_MSG_RESULT([yes])
2473 ac_have_as_addr32=no
2477 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2480 # does the x86/amd64 assembler understand SSE 4.2 instructions?
2481 # Note, this doesn't generate a C-level symbol. It generates a
2482 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2483 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2485 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2486 do { long long int x;
2487 __asm__ __volatile__(
2488 "crc32q %%r15,%%r15" : : : "r15" );
2489 __asm__ __volatile__(
2490 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2491 __asm__ __volatile__(
2492 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
2495 ac_have_as_sse42=yes
2496 AC_MSG_RESULT([yes])
2502 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2505 # does the x86/amd64 assembler understand AVX instructions?
2506 # Note, this doesn't generate a C-level symbol. It generates a
2507 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2508 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2510 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2511 do { long long int x;
2512 __asm__ __volatile__(
2513 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2514 __asm__ __volatile__(
2515 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2519 AC_MSG_RESULT([yes])
2525 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2528 # does the x86/amd64 assembler understand AVX2 instructions?
2529 # Note, this doesn't generate a C-level symbol. It generates a
2530 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2531 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2533 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2534 do { long long int x;
2535 __asm__ __volatile__(
2536 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2537 __asm__ __volatile__(
2538 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2542 AC_MSG_RESULT([yes])
2548 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2551 # does the x86/amd64 assembler understand TSX instructions and
2552 # the XACQUIRE/XRELEASE prefixes?
2553 # Note, this doesn't generate a C-level symbol. It generates a
2554 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2555 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2557 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2559 __asm__ __volatile__(
2562 " xacquire lock incq 0(%rsp) \n\t"
2563 " xrelease lock incq 0(%rsp) \n"
2568 AC_MSG_RESULT([yes])
2574 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2577 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2578 # Note, this doesn't generate a C-level symbol. It generates a
2579 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2580 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2582 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2583 do { unsigned int h, l;
2584 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
2585 __asm__ __volatile__(
2586 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
2587 __asm__ __volatile__(
2588 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
2592 AC_MSG_RESULT([yes])
2598 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2601 # does the x86/amd64 assembler understand FMA instructions?
2602 # Note, this doesn't generate a C-level symbol. It generates a
2603 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2604 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2606 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2607 do { unsigned int h, l;
2608 __asm__ __volatile__(
2609 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2610 __asm__ __volatile__(
2611 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2612 __asm__ __volatile__(
2613 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2617 AC_MSG_RESULT([yes])
2623 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2626 # does the amd64 assembler understand MPX instructions?
2627 # Note, this doesn't generate a C-level symbol. It generates a
2628 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2629 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2631 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2633 asm ("bndmov %bnd0,(%rsp)");
2634 asm ("bndldx 3(%rbx,%rdx), %bnd2");
2635 asm ("bnd call foo\n"
2642 AC_MSG_RESULT([yes])
2648 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2651 # Does the C compiler support the "ifunc" attribute
2652 # Note, this doesn't generate a C-level symbol. It generates a
2653 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2654 # does the x86/amd64 assembler understand MOVBE?
2655 # Note, this doesn't generate a C-level symbol. It generates a
2656 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2657 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2659 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2660 do { long long int x;
2661 __asm__ __volatile__(
2662 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
2665 ac_have_as_movbe=yes
2666 AC_MSG_RESULT([yes])
2672 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2675 # Does the C compiler support the "ifunc" attribute
2676 # Note, this doesn't generate a C-level symbol. It generates a
2677 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2678 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2680 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2681 static void mytest(void) {}
2683 static void (*resolve_test(void))(void)
2685 return (void (*)(void))&mytest;
2688 void test(void) __attribute__((ifunc("resolve_test")));
2696 ac_have_ifunc_attr=yes
2697 AC_MSG_RESULT([yes])
2699 ac_have_ifunc_attr=no
2703 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2705 # Does the C compiler support the armv8 crc feature flag
2706 # Note, this doesn't generate a C-level symbol. It generates a
2707 # automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
2708 AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
2710 save_CFLAGS="$CFLAGS"
2711 CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
2712 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2718 ac_have_armv8_crc_feature=yes
2719 AC_MSG_RESULT([yes])
2721 ac_have_armv8_crc_feature=no
2724 CFLAGS="$save_CFLAGS"
2726 AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
2729 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2730 # when building the tool executables. I think we should get rid of it.
2732 # Check for TLS support in the compiler and linker
2733 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2735 [vg_cv_linktime_tls=yes],
2736 [vg_cv_linktime_tls=no])
2737 # Native compilation: check whether running a program using TLS succeeds.
2738 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2739 # succeeds but running programs using TLS fails.
2740 # Cross-compiling: check whether linking a program using TLS succeeds.
2741 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2742 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2743 [vg_cv_tls=$enableval],
2744 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2748 [vg_cv_tls=$vg_cv_linktime_tls])])])
2750 if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
2751 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2755 #----------------------------------------------------------------------------
2756 # Solaris-specific checks.
2757 #----------------------------------------------------------------------------
2759 if test "$VGCONF_OS" = "solaris" ; then
2760 # Solaris-specific check determining if the Sun Studio Assembler is used to
2761 # build Valgrind. The test checks if the x86/amd64 assembler understands the
2762 # cmovl.l instruction, if yes then it's Sun Assembler.
2764 # C-level symbol: none
2765 # Automake-level symbol: SOLARIS_SUN_STUDIO_AS
2767 AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
2768 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2770 __asm__ __volatile__("cmovl.l %edx, %eax");
2772 solaris_have_sun_studio_as=yes
2773 AC_MSG_RESULT([yes])
2775 solaris_have_sun_studio_as=no
2778 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
2780 # Solaris-specific check determining if symbols __xpg4 and __xpg6
2781 # are present in linked shared libraries when gcc is invoked with -std=gnu99.
2782 # See solaris/vgpreload-solaris.mapfile for details.
2783 # gcc on older Solaris instructs linker to include these symbols,
2784 # gcc on illumos and newer Solaris does not.
2786 # C-level symbol: none
2787 # Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
2789 save_CFLAGS="$CFLAGS"
2790 CFLAGS="$CFLAGS -std=gnu99"
2791 AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
2792 temp_dir=$( /usr/bin/mktemp -d )
2793 cat <<_ACEOF >${temp_dir}/mylib.c
2795 int myfunc(void) { printf("LaPutyka\n"); }
2797 ${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
2798 xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
2799 if test "x${xpg_present}" = "x" ; then
2800 solaris_xpg_symbols_present=no
2803 solaris_xpg_symbols_present=yes
2804 AC_MSG_RESULT([yes])
2807 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
2808 CFLAGS="$save_CFLAGS"
2811 # Solaris-specific check determining if gcc enables largefile support by
2812 # default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
2813 # variable with gcc flags which disable it.
2815 AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
2816 save_CFLAGS="$CFLAGS"
2817 CFLAGS="$CFLAGS -m32"
2818 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2819 return _LARGEFILE_SOURCE;
2821 SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
2822 AC_MSG_RESULT([yes])
2824 SOLARIS_UNDEF_LARGESOURCE=""
2828 AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
2831 # Solaris-specific check determining if /proc/self/cmdline
2832 # or /proc/<pid>/cmdline is supported.
2834 # C-level symbol: SOLARIS_PROC_CMDLINE
2835 # Automake-level symbol: SOLARIS_PROC_CMDLINE
2837 AC_CHECK_FILE([/proc/self/cmdline],
2839 solaris_proc_cmdline=yes
2840 AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
2841 [Define to 1 if you have /proc/self/cmdline.])
2843 solaris_proc_cmdline=no
2845 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
2848 # Solaris-specific check determining default platform for the Valgrind launcher.
2849 # Used in case the launcher cannot select platform by looking at the client
2850 # image (for example because the executable is a shell script).
2852 # C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
2853 # Automake-level symbol: none
2855 AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
2856 # Get the ELF class of /bin/sh first.
2857 if ! test -f /bin/sh; then
2858 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
2860 elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
2861 case "$elf_class" in
2863 default_arch="$VGCONF_ARCH_PRI";
2866 if test "x$VGCONF_ARCH_SEC" != "x"; then
2867 default_arch="$VGCONF_ARCH_SEC"
2869 default_arch="$VGCONF_ARCH_PRI";
2873 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
2876 default_platform="$default_arch-$VGCONF_OS"
2877 AC_MSG_RESULT([$default_platform])
2878 AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
2879 [Default platform for Valgrind launcher.])
2882 # Solaris-specific check determining if the old syscalls are available.
2884 # C-level symbol: SOLARIS_OLD_SYSCALLS
2885 # Automake-level symbol: SOLARIS_OLD_SYSCALLS
2887 AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
2888 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2889 #include <sys/syscall.h>
2893 solaris_old_syscalls=yes
2894 AC_MSG_RESULT([yes])
2895 AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
2896 [Define to 1 if you have the old Solaris syscalls.])
2898 solaris_old_syscalls=no
2901 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
2904 # Solaris-specific check determining if the new accept() syscall is available.
2907 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2910 # New syscall (available on illumos):
2911 # int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2912 # int version, int flags);
2914 # If the old syscall is present then the following syscall will fail with
2915 # ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
2916 # available then it will fail with EINVAL (because the flags parameter is
2919 # C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
2920 # Automake-level symbol: none
2922 AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
2923 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2924 #include <sys/syscall.h>
2928 syscall(SYS_accept, 0, 0, 0, 0, -1);
2929 return !(errno == EINVAL);
2931 AC_MSG_RESULT([yes])
2932 AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
2933 [Define to 1 if you have the new `accept' syscall.])
2939 # Solaris-specific check determining if the new illumos pipe() syscall is
2943 # longlong_t pipe();
2945 # New syscall (available on illumos):
2946 # int pipe(intptr_t arg, int flags);
2948 # If the old syscall is present then the following call will succeed, if the
2949 # new syscall is available then it will fail with EFAULT (because address 0
2950 # cannot be accessed).
2952 # C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
2953 # Automake-level symbol: none
2955 AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
2956 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2957 #include <sys/syscall.h>
2961 syscall(SYS_pipe, 0, 0);
2962 return !(errno == EFAULT);
2964 AC_MSG_RESULT([yes])
2965 AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
2966 [Define to 1 if you have the new `pipe' syscall.])
2972 # Solaris-specific check determining if the new lwp_sigqueue() syscall is
2976 # int lwp_kill(id_t lwpid, int sig);
2978 # New syscall (available on Solaris 11):
2979 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
2980 # int si_code, timespec_t *timeout);
2982 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
2983 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
2985 AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
2986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2987 #include <sys/syscall.h>
2989 return !SYS_lwp_sigqueue;
2991 solaris_lwp_sigqueue_syscall=yes
2992 AC_MSG_RESULT([yes])
2993 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
2994 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
2996 solaris_lwp_sigqueue_syscall=no
2999 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3002 # Solaris-specific check determining if the lwp_sigqueue() syscall
3003 # takes both pid and thread id arguments or just thread id.
3005 # Old syscall (available on Solaris 11.x):
3006 # int lwp_sigqueue(id_t lwpid, int sig, void *value,
3007 # int si_code, timespec_t *timeout);
3009 # New syscall (available on Solaris 12):
3010 # int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
3011 # int si_code, timespec_t *timeout);
3013 # If the old syscall is present then the following syscall will fail with
3014 # EINVAL (because signal is out of range); if the new syscall is available
3015 # then it will fail with ESRCH (because it would not find such thread in the
3018 # C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3019 # Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3021 AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
3022 AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
3023 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3024 #include <sys/syscall.h>
3028 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
3029 return !(errno == ESRCH);
3031 solaris_lwp_sigqueue_syscall_takes_pid=yes
3032 AC_MSG_RESULT([yes])
3033 AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
3034 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
3036 solaris_lwp_sigqueue_syscall_takes_pid=no
3039 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
3040 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
3042 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
3046 # Solaris-specific check determining if the new lwp_name() syscall is
3049 # New syscall (available on Solaris 11):
3050 # int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
3052 # C-level symbol: SOLARIS_LWP_NAME_SYSCALL
3053 # Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
3055 AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
3056 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3057 #include <sys/syscall.h>
3059 return !SYS_lwp_name;
3061 solaris_lwp_name_syscall=yes
3062 AC_MSG_RESULT([yes])
3063 AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
3064 [Define to 1 if you have the new `lwp_name' syscall.])
3066 solaris_lwp_name_syscall=no
3069 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
3072 # Solaris-specific check determining if the new getrandom() syscall is
3075 # New syscall (available on Solaris 11):
3076 # int getrandom(void *buf, size_t buflen, uint_t flags);
3078 # C-level symbol: SOLARIS_GETRANDOM_SYSCALL
3079 # Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
3081 AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
3082 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3083 #include <sys/syscall.h>
3085 return !SYS_getrandom;
3087 solaris_getrandom_syscall=yes
3088 AC_MSG_RESULT([yes])
3089 AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
3090 [Define to 1 if you have the new `getrandom' syscall.])
3092 solaris_getrandom_syscall=no
3095 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
3098 # Solaris-specific check determining if the new zone() syscall subcodes
3099 # ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
3100 # were added in Solaris 11 but are missing on illumos.
3102 # C-level symbol: SOLARIS_ZONE_DEFUNCT
3103 # Automake-level symbol: SOLARIS_ZONE_DEFUNCT
3105 AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
3106 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3107 #include <sys/zone.h>
3109 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
3111 solaris_zone_defunct=yes
3112 AC_MSG_RESULT([yes])
3113 AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
3114 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
3116 solaris_zone_defunct=no
3119 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
3122 # Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
3123 # for auditon(2) subcode of the auditsys() syscall are available.
3124 # These commands are available in Solaris 11 and illumos but were removed
3127 # C-level symbol: SOLARIS_AUDITON_STAT
3128 # Automake-level symbol: SOLARIS_AUDITON_STAT
3130 AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
3131 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3132 #include <bsm/audit.h>
3134 return !(A_GETSTAT && A_SETSTAT);
3136 solaris_auditon_stat=yes
3137 AC_MSG_RESULT([yes])
3138 AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
3139 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
3141 solaris_auditon_stat=no
3144 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
3147 # Solaris-specific check determining if the new shmsys() syscall subcodes
3148 # IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
3149 # These subcodes were added in Solaris 11 but are missing on illumos.
3151 # C-level symbol: SOLARIS_SHM_NEW
3152 # Automake-level symbol: SOLARIS_SHM_NEW
3154 AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
3155 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3156 #include <sys/ipc_impl.h>
3157 #include <sys/shm.h>
3158 #include <sys/shm_impl.h>
3160 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
3163 AC_MSG_RESULT([yes])
3164 AC_DEFINE([SOLARIS_SHM_NEW], 1,
3165 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
3170 AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
3173 # Solaris-specific check determining if prxregset_t is available. Illumos
3174 # currently does not define it on the x86 platform.
3176 # C-level symbol: SOLARIS_PRXREGSET_T
3177 # Automake-level symbol: SOLARIS_PRXREGSET_T
3179 AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
3180 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3181 #include <sys/procfs_isa.h>
3183 return !sizeof(prxregset_t);
3185 solaris_prxregset_t=yes
3186 AC_MSG_RESULT([yes])
3187 AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
3188 [Define to 1 if you have the `prxregset_t' type.])
3190 solaris_prxregset_t=no
3193 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
3196 # Solaris-specific check determining if the new frealpathat() syscall is
3199 # New syscall (available on Solaris 11.1):
3200 # int frealpathat(int fd, char *path, char *buf, size_t buflen);
3202 # C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3203 # Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3205 AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
3206 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3207 #include <sys/syscall.h>
3209 return !SYS_frealpathat;
3211 solaris_frealpathat_syscall=yes
3212 AC_MSG_RESULT([yes])
3213 AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
3214 [Define to 1 if you have the new `frealpathat' syscall.])
3216 solaris_frealpathat_syscall=no
3219 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
3222 # Solaris-specific check determining if the new uuidsys() syscall is
3225 # New syscall (available on newer Solaris):
3226 # int uuidsys(struct uuid *uuid);
3228 # C-level symbol: SOLARIS_UUIDSYS_SYSCALL
3229 # Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
3231 AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
3232 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3233 #include <sys/syscall.h>
3235 return !SYS_uuidsys;
3237 solaris_uuidsys_syscall=yes
3238 AC_MSG_RESULT([yes])
3239 AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
3240 [Define to 1 if you have the new `uuidsys' syscall.])
3242 solaris_uuidsys_syscall=no
3245 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
3248 # Solaris-specific check determining if the new labelsys() syscall subcode
3249 # TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
3250 # missing on illumos.
3252 # C-level symbol: SOLARIS_TNDB_GET_TNIP
3253 # Automake-level symbol: SOLARIS_TNDB_GET_TNIP
3255 AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
3256 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3257 #include <sys/tsol/tndb.h>
3259 return !TNDB_GET_TNIP;
3261 solaris_tndb_get_tnip=yes
3262 AC_MSG_RESULT([yes])
3263 AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
3264 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
3266 solaris_tndb_get_tnip=no
3269 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
3272 # Solaris-specific check determining if the new labelsys() syscall opcodes
3273 # TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
3274 # added in Solaris 11 but are missing on illumos.
3276 # C-level symbol: SOLARIS_TSOL_CLEARANCE
3277 # Automake-level symbol: SOLARIS_TSOL_CLEARANCE
3279 AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
3280 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3281 #include <sys/tsol/tsyscall.h>
3283 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
3285 solaris_tsol_clearance=yes
3286 AC_MSG_RESULT([yes])
3287 AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
3288 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
3290 solaris_tsol_clearance=no
3293 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
3296 # Solaris-specific check determining if the new pset() syscall subcode
3297 # PSET_GET_NAME is available. This subcode was added in Solaris 12 but
3298 # is missing on illumos and Solaris 11.
3300 # C-level symbol: SOLARIS_PSET_GET_NAME
3301 # Automake-level symbol: SOLARIS_PSET_GET_NAME
3303 AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
3304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3305 #include <sys/pset.h>
3307 return !(PSET_GET_NAME);
3309 solaris_pset_get_name=yes
3310 AC_MSG_RESULT([yes])
3311 AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
3312 [Define to 1 if you have the `PSET_GET_NAME' constants.])
3314 solaris_pset_get_name=no
3317 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
3320 # Solaris-specific check determining if the utimesys() syscall is
3321 # available (on illumos and older Solaris).
3323 # C-level symbol: SOLARIS_UTIMESYS_SYSCALL
3324 # Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
3326 AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
3327 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3328 #include <sys/syscall.h>
3330 return !SYS_utimesys;
3332 solaris_utimesys_syscall=yes
3333 AC_MSG_RESULT([yes])
3334 AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
3335 [Define to 1 if you have the `utimesys' syscall.])
3337 solaris_utimesys_syscall=no
3340 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
3343 # Solaris-specific check determining if the utimensat() syscall is
3344 # available (on newer Solaris).
3346 # C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3347 # Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3349 AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
3350 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3351 #include <sys/syscall.h>
3353 return !SYS_utimensat;
3355 solaris_utimensat_syscall=yes
3356 AC_MSG_RESULT([yes])
3357 AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
3358 [Define to 1 if you have the `utimensat' syscall.])
3360 solaris_utimensat_syscall=no
3363 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
3366 # Solaris-specific check determining if the spawn() syscall is available
3367 # (on newer Solaris).
3369 # C-level symbol: SOLARIS_SPAWN_SYSCALL
3370 # Automake-level symbol: SOLARIS_SPAWN_SYSCALL
3372 AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
3373 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3374 #include <sys/syscall.h>
3378 solaris_spawn_syscall=yes
3379 AC_MSG_RESULT([yes])
3380 AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
3381 [Define to 1 if you have the `spawn' syscall.])
3383 solaris_spawn_syscall=no
3386 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
3389 # Solaris-specific check determining if commands MODNVL_CTRLMAP through
3390 # MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
3392 # C-level symbol: SOLARIS_MODCTL_MODNVL
3393 # Automake-level symbol: SOLARIS_MODCTL_MODNVL
3395 AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
3396 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3397 #include <sys/modctl.h>
3399 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
3401 solaris_modctl_modnvl=yes
3402 AC_MSG_RESULT([yes])
3403 AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
3404 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
3406 solaris_modctl_modnvl=no
3409 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
3412 # Solaris-specific check determining whether nscd (name switch cache daemon)
3413 # attaches its door at /system/volatile/name_service_door (Solaris)
3414 # or at /var/run/name_service_door (illumos).
3416 # Note that /var/run is a symlink to /system/volatile on Solaris
3417 # but not vice versa on illumos.
3419 # C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3420 # Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3422 AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
3423 if test -e /system/volatile/name_service_door; then
3424 solaris_nscd_door_system_volatile=yes
3425 AC_MSG_RESULT([/system/volatile/name_service_door])
3426 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
3427 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
3429 solaris_nscd_door_system_volatile=no
3430 AC_MSG_RESULT([/var/run/name_service_door])
3432 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
3435 # Solaris-specific check determining if the new gethrt() fasttrap is available.
3437 # New fasttrap (available on Solaris 11):
3438 # hrt_t *gethrt(void);
3440 # C-level symbol: SOLARIS_GETHRT_FASTTRAP
3441 # Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
3443 AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
3444 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3445 #include <sys/trap.h>
3449 solaris_gethrt_fasttrap=yes
3450 AC_MSG_RESULT([yes])
3451 AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
3452 [Define to 1 if you have the new `gethrt' fasttrap.])
3454 solaris_gethrt_fasttrap=no
3457 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
3460 # Solaris-specific check determining if the new get_zone_offset() fasttrap
3463 # New fasttrap (available on Solaris 11):
3464 # zonehrtoffset_t *get_zone_offset(void);
3466 # C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3467 # Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3469 AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
3470 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3471 #include <sys/trap.h>
3473 return !T_GETZONEOFFSET;
3475 solaris_getzoneoffset_fasttrap=yes
3476 AC_MSG_RESULT([yes])
3477 AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
3478 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
3480 solaris_getzoneoffset_fasttrap=no
3483 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
3486 # Solaris-specific check determining if the execve() syscall
3487 # takes fourth argument (flags) or not.
3489 # Old syscall (available on illumos):
3490 # int execve(const char *fname, const char **argv, const char **envp);
3492 # New syscall (available on Solaris):
3493 # int execve(uintptr_t file, const char **argv, const char **envp, int flags);
3495 # If the new syscall is present then it will fail with EINVAL (because flags
3496 # are invalid); if the old syscall is available then it will fail with ENOENT
3497 # (because the file could not be found).
3499 # C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3500 # Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3502 AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
3503 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3504 #include <sys/syscall.h>
3508 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
3509 return !(errno == EINVAL);
3511 solaris_execve_syscall_takes_flags=yes
3512 AC_MSG_RESULT([yes])
3513 AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
3514 [Define to 1 if you have the new `execve' syscall which accepts flags.])
3516 solaris_execve_syscall_takes_flags=no
3519 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
3520 test x$solaris_execve_syscall_takes_flags = xyes)
3523 # Solaris-specific check determining version of the repository cache protocol.
3524 # Every Solaris version uses a different one, ranging from 21 to current 25.
3525 # The check is very ugly, though.
3527 # C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
3528 # Automake-level symbol: none
3530 AC_PATH_PROG(DIS_PATH, dis, false)
3531 if test "x$DIS_PATH" = "xfalse"; then
3532 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
3534 AC_CHECK_LIB(scf, scf_handle_bind, [], [
3535 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
3536 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3539 AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
3540 if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
3541 libscf=/usr/lib/64/libscf.so.1
3543 libscf=/usr/lib/libscf.so.1
3545 if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
3546 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
3547 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3549 hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
3550 if test -z "$hex"; then
3551 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
3552 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3554 version=$( printf "%d\n" 0x$hex )
3555 AC_MSG_RESULT([$version])
3556 AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
3557 [Version number of the repository door cache protocol.])
3560 # Solaris-specific check determining if "sysstat" segment reservation type
3563 # New "sysstat" segment reservation (available on Solaris 12):
3564 # - program header type: PT_SUNW_SYSSTAT
3565 # - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
3567 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3568 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3570 AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
3571 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3572 #include <sys/auxv.h>
3574 return !AT_SUN_SYSSTAT_ADDR;
3576 solaris_reserve_sysstat_addr=yes
3577 AC_MSG_RESULT([yes])
3578 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
3579 [Define to 1 if you have the new `sysstat' segment reservation.])
3581 solaris_reserve_sysstat_addr=no
3584 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
3587 # Solaris-specific check determining if "sysstat_zone" segment reservation type
3590 # New "sysstat_zone" segment reservation (available on Solaris 12):
3591 # - program header type: PT_SUNW_SYSSTAT_ZONE
3592 # - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
3594 # C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3595 # Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3597 AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
3598 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3599 #include <sys/auxv.h>
3601 return !AT_SUN_SYSSTAT_ZONE_ADDR;
3603 solaris_reserve_sysstat_zone_addr=yes
3604 AC_MSG_RESULT([yes])
3605 AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
3606 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
3608 solaris_reserve_sysstat_zone_addr=no
3611 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
3614 # Solaris-specific check determining if the system_stats() syscall is available
3615 # (on newer Solaris).
3617 # C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3618 # Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3620 AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
3621 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3622 #include <sys/syscall.h>
3624 return !SYS_system_stats;
3626 solaris_system_stats_syscall=yes
3627 AC_MSG_RESULT([yes])
3628 AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
3629 [Define to 1 if you have the `system_stats' syscall.])
3631 solaris_system_stats_syscall=no
3634 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
3637 # Solaris-specific check determining if fpregset_t defines struct _fpchip_state
3638 # (on newer illumos) or struct fpchip_state (Solaris, older illumos).
3640 # C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
3641 # Automake-level symbol: none
3643 AC_CHECK_TYPE([struct _fpchip_state],
3644 [solaris_fpchip_state_takes_underscore=yes],
3645 [solaris_fpchip_state_takes_underscore=no],
3646 [[#include <sys/regset.h>]])
3647 if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
3648 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
3649 [Define to 1 if fpregset_t defines struct _fpchip_state])
3653 # Solaris-specific check determining if schedctl page shared between kernel
3654 # and userspace program is executable (illumos, older Solaris) or not (newer
3657 # C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
3658 # Automake-level symbol: none
3660 AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
3661 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3665 #include <schedctl.h>
3669 schedctl_t *scp = schedctl_init();
3673 int fd = open("/proc/self/map", O_RDONLY);
3678 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
3679 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
3680 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
3681 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
3682 return (map.pr_mflags & MA_EXEC);
3688 solaris_schedctl_page_exec=no
3691 solaris_schedctl_page_exec=yes
3692 AC_MSG_RESULT([yes])
3693 AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
3694 [Define to 1 if you have the schedctl page executable.])
3698 # Solaris-specific check determining if PT_SUNWDTRACE program header provides
3699 # scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
3700 # an initial thread pointer for libc (newer Solaris).
3702 # C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
3703 # Automake-level symbol: none
3705 AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
3706 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3707 #include <sys/fasttrap_isa.h>
3709 return !FT_SCRATCHSIZE;
3711 solaris_pt_sunwdtrace_thrp=yes
3712 AC_MSG_RESULT([yes])
3713 AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
3714 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
3716 solaris_pt_sunwdtrace_thrp=no
3721 AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
3722 AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
3723 AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
3724 AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
3725 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
3726 AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
3727 AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
3728 AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
3729 AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
3730 AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
3731 AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
3732 AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
3733 AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
3734 AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
3735 AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
3736 AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
3737 AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
3738 AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
3739 AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
3740 AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
3741 AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
3742 AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
3743 AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
3744 AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
3745 AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
3746 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
3747 AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
3748 AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
3749 fi # test "$VGCONF_OS" = "solaris"
3752 #----------------------------------------------------------------------------
3753 # Checks for C header files.
3754 #----------------------------------------------------------------------------
3757 AC_CHECK_HEADERS([ \
3775 # Verify whether the <linux/futex.h> header is usable.
3776 AC_MSG_CHECKING([if <linux/futex.h> is usable])
3778 save_CFLAGS="$CFLAGS"
3779 CFLAGS="$CFLAGS -D__user="
3780 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3781 #include <linux/futex.h>
3785 ac_have_usable_linux_futex_h=yes
3786 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
3787 [Define to 1 if you have a usable <linux/futex.h> header file.])
3788 AC_MSG_RESULT([yes])
3790 ac_have_usable_linux_futex_h=no
3793 CFLAGS="$save_CFLAGS"
3796 #----------------------------------------------------------------------------
3797 # Checks for typedefs, structures, and compiler characteristics.
3798 #----------------------------------------------------------------------------
3805 #----------------------------------------------------------------------------
3806 # Checks for library functions.
3807 #----------------------------------------------------------------------------
3811 AC_CHECK_LIB([pthread], [pthread_create])
3812 AC_CHECK_LIB([rt], [clock_gettime])
3825 pthread_barrier_init \
3826 pthread_condattr_setclock \
3827 pthread_mutex_timedlock \
3828 pthread_rwlock_timedrdlock \
3829 pthread_rwlock_timedwrlock \
3832 pthread_setname_np \
3848 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
3849 # libraries with any shared object and/or executable. This is NOT what we
3850 # want for e.g. vgpreload_core-x86-linux.so
3853 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
3854 [test x$ac_cv_func_pthread_barrier_init = xyes])
3855 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
3856 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
3857 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
3858 [test x$ac_cv_func_pthread_spin_lock = xyes])
3859 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
3860 [test x$ac_cv_func_pthread_setname_np = xyes])
3862 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3863 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
3864 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
3865 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
3868 #----------------------------------------------------------------------------
3870 #----------------------------------------------------------------------------
3871 # Do we have a useable MPI setup on the primary and/or secondary targets?
3872 # On Linux, by default, assumes mpicc and -m32/-m64
3873 # Note: this is a kludge in that it assumes the specified mpicc
3874 # understands -m32/-m64 regardless of what is specified using
3876 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
3877 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
3880 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
3881 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
3882 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
3883 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3884 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
3885 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
3886 mflag_primary=$FLAG_M32
3887 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
3888 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
3889 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
3890 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
3891 mflag_primary=$FLAG_M64
3892 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
3893 mflag_primary="$FLAG_M32 -arch i386"
3894 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
3895 mflag_primary="$FLAG_M64 -arch x86_64"
3899 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
3900 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
3901 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS ; then
3902 mflag_secondary=$FLAG_M32
3903 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
3904 mflag_secondary="$FLAG_M32 -arch i386"
3909 [ --with-mpicc= Specify name of MPI2-ised C compiler],
3914 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
3915 ## use these values in the check for a functioning mpicc.
3917 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
3918 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
3919 AM_COND_IF([VGCONF_OS_IS_LINUX],
3920 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3921 LDFLAGS_MPI="-fpic -shared"])
3922 AM_COND_IF([VGCONF_OS_IS_DARWIN],
3923 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
3924 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
3925 AM_COND_IF([VGCONF_OS_IS_SOLARIS],
3926 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3927 LDFLAGS_MPI="-fpic -shared"])
3929 AC_SUBST([CFLAGS_MPI])
3930 AC_SUBST([LDFLAGS_MPI])
3933 ## See if MPI_CC works for the primary target
3935 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
3937 saved_CFLAGS=$CFLAGS
3939 CFLAGS="$CFLAGS_MPI $mflag_primary"
3940 saved_LDFLAGS="$LDFLAGS"
3941 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
3942 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3946 int ni, na, nd, comb;
3947 int r = MPI_Init(NULL,NULL);
3948 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
3949 r |= MPI_Finalize();
3952 ac_have_mpi2_pri=yes
3953 AC_MSG_RESULT([yes, $MPI_CC])
3959 CFLAGS=$saved_CFLAGS
3960 LDFLAGS="$saved_LDFLAGS"
3961 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
3963 ## See if MPI_CC works for the secondary target. Complication: what if
3964 ## there is no secondary target? We need this to then fail.
3965 ## Kludge this by making MPI_CC something which will surely fail in
3968 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
3970 saved_CFLAGS=$CFLAGS
3971 saved_LDFLAGS="$LDFLAGS"
3972 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
3973 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
3974 CC="$MPI_CC this will surely fail"
3978 CFLAGS="$CFLAGS_MPI $mflag_secondary"
3979 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3983 int ni, na, nd, comb;
3984 int r = MPI_Init(NULL,NULL);
3985 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
3986 r |= MPI_Finalize();
3989 ac_have_mpi2_sec=yes
3990 AC_MSG_RESULT([yes, $MPI_CC])
3996 CFLAGS=$saved_CFLAGS
3997 LDFLAGS="$saved_LDFLAGS"
3998 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
4001 #----------------------------------------------------------------------------
4002 # Other library checks
4003 #----------------------------------------------------------------------------
4004 # There now follow some tests for Boost, and OpenMP. These
4005 # tests are present because Drd has some regression tests that use
4006 # these packages. All regression test programs all compiled only
4007 # for the primary target. And so it is important that the configure
4008 # checks that follow, use the correct -m32 or -m64 flag for the
4009 # primary target (called $mflag_primary). Otherwise, we can end up
4010 # in a situation (eg) where, on amd64-linux, the test for Boost checks
4011 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
4012 # only build (meaning, the primary target is x86-linux), the build
4013 # of the regtest programs that use Boost fails, because they are
4014 # build as 32-bit (IN THIS EXAMPLE).
4016 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
4017 # NEEDED BY THE REGRESSION TEST PROGRAMS.
4020 # Check whether the boost library 1.35 or later has been installed.
4021 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
4023 AC_MSG_CHECKING([for boost])
4026 safe_CXXFLAGS=$CXXFLAGS
4027 CXXFLAGS="$mflag_primary"
4029 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
4031 AC_LINK_IFELSE([AC_LANG_SOURCE([
4032 #include <boost/thread.hpp>
4033 static void thread_func(void)
4035 int main(int argc, char** argv)
4037 boost::thread t(thread_func);
4042 ac_have_boost_1_35=yes
4043 AC_SUBST([BOOST_CFLAGS], [])
4044 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
4045 AC_MSG_RESULT([yes])
4047 ac_have_boost_1_35=no
4052 CXXFLAGS=$safe_CXXFLAGS
4055 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
4058 # does this compiler support -fopenmp, does it have the include file
4059 # <omp.h> and does it have libgomp ?
4061 AC_MSG_CHECKING([for OpenMP])
4064 CFLAGS="-fopenmp $mflag_primary -Werror"
4066 AC_LINK_IFELSE([AC_LANG_SOURCE([
4068 int main(int argc, char** argv)
4076 AC_MSG_RESULT([yes])
4083 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
4086 # Check for __builtin_popcount
4087 AC_MSG_CHECKING([for __builtin_popcount()])
4088 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4090 __builtin_popcount(2);
4093 AC_MSG_RESULT([yes])
4094 AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
4095 [Define to 1 if compiler provides __builtin_popcount().])
4100 # Check for __builtin_clz
4101 AC_MSG_CHECKING([for __builtin_clz()])
4102 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4107 AC_MSG_RESULT([yes])
4108 AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
4109 [Define to 1 if compiler provides __builtin_clz().])
4114 # Check for __builtin_ctz
4115 AC_MSG_CHECKING([for __builtin_ctz()])
4116 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4121 AC_MSG_RESULT([yes])
4122 AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
4123 [Define to 1 if compiler provides __builtin_ctz().])
4128 # does this compiler have built-in functions for atomic memory access for the
4130 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
4133 CFLAGS="$mflag_primary"
4135 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4137 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4138 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4140 ac_have_builtin_atomic_primary=yes
4141 AC_MSG_RESULT([yes])
4142 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])
4144 ac_have_builtin_atomic_primary=no
4150 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
4151 [test x$ac_have_builtin_atomic_primary = xyes])
4154 # does this compiler have built-in functions for atomic memory access for the
4155 # secondary target ?
4157 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4159 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
4162 CFLAGS="$mflag_secondary"
4164 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4166 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
4168 ac_have_builtin_atomic_secondary=yes
4169 AC_MSG_RESULT([yes])
4171 ac_have_builtin_atomic_secondary=no
4179 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
4180 [test x$ac_have_builtin_atomic_secondary = xyes])
4182 # does this compiler have built-in functions for atomic memory access on
4183 # 64-bit integers for all targets ?
4185 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
4187 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4190 uint64_t variable = 1;
4191 return __sync_add_and_fetch(&variable, 1)
4193 ac_have_builtin_atomic64_primary=yes
4195 ac_have_builtin_atomic64_primary=no
4198 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4201 CFLAGS="$mflag_secondary"
4203 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4206 uint64_t variable = 1;
4207 return __sync_add_and_fetch(&variable, 1)
4209 ac_have_builtin_atomic64_secondary=yes
4211 ac_have_builtin_atomic64_secondary=no
4218 if test x$ac_have_builtin_atomic64_primary = xyes && \
4219 test x$VGCONF_PLATFORM_SEC_CAPS = x \
4220 -o x$ac_have_builtin_atomic64_secondary = xyes; then
4221 AC_MSG_RESULT([yes])
4222 ac_have_builtin_atomic64=yes
4225 ac_have_builtin_atomic64=no
4228 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
4229 [test x$ac_have_builtin_atomic64 = xyes])
4232 # does g++ have built-in functions for atomic memory access ?
4233 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
4235 safe_CXXFLAGS=$CXXFLAGS
4236 CXXFLAGS="$mflag_primary"
4239 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4241 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4242 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
4244 ac_have_builtin_atomic_cxx=yes
4245 AC_MSG_RESULT([yes])
4246 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
4248 ac_have_builtin_atomic_cxx=no
4253 CXXFLAGS=$safe_CXXFLAGS
4255 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
4258 if test x$ac_have_usable_linux_futex_h = xyes \
4259 -a x$ac_have_builtin_atomic_primary = xyes; then
4260 ac_enable_linux_ticket_lock_primary=yes
4262 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
4263 [test x$ac_enable_linux_ticket_lock_primary = xyes])
4265 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
4266 -a x$ac_have_usable_linux_futex_h = xyes \
4267 -a x$ac_have_builtin_atomic_secondary = xyes; then
4268 ac_enable_linux_ticket_lock_secondary=yes
4270 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
4271 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
4274 # does libstdc++ support annotating shared pointers ?
4275 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
4277 safe_CXXFLAGS=$CXXFLAGS
4278 CXXFLAGS="-std=c++0x"
4281 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4284 std::shared_ptr<int> p
4286 ac_have_shared_ptr=yes
4288 ac_have_shared_ptr=no
4290 if test x$ac_have_shared_ptr = xyes; then
4291 # If compilation of the program below fails because of a syntax error
4292 # triggered by substituting one of the annotation macros then that
4293 # means that libstdc++ supports these macros.
4294 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4295 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
4296 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
4299 std::shared_ptr<int> p
4301 ac_have_shared_pointer_annotation=no
4304 ac_have_shared_pointer_annotation=yes
4305 AC_MSG_RESULT([yes])
4306 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
4307 [Define to 1 if libstd++ supports annotating shared pointers])
4310 ac_have_shared_pointer_annotation=no
4315 CXXFLAGS=$safe_CXXFLAGS
4317 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
4318 [test x$ac_have_shared_pointer_annotation = xyes])
4321 #----------------------------------------------------------------------------
4322 # Ok. We're done checking.
4323 #----------------------------------------------------------------------------
4325 # Nb: VEX/Makefile is generated from Makefile.vex.in.
4328 VEX/Makefile:Makefile.vex.in
4337 gdbserver_tests/Makefile
4338 gdbserver_tests/solaris/Makefile
4344 memcheck/tests/Makefile
4345 memcheck/tests/common/Makefile
4346 memcheck/tests/amd64/Makefile
4347 memcheck/tests/x86/Makefile
4348 memcheck/tests/linux/Makefile
4349 memcheck/tests/darwin/Makefile
4350 memcheck/tests/solaris/Makefile
4351 memcheck/tests/amd64-linux/Makefile
4352 memcheck/tests/arm64-linux/Makefile
4353 memcheck/tests/x86-linux/Makefile
4354 memcheck/tests/amd64-solaris/Makefile
4355 memcheck/tests/x86-solaris/Makefile
4356 memcheck/tests/ppc32/Makefile
4357 memcheck/tests/ppc64/Makefile
4358 memcheck/tests/s390x/Makefile
4359 memcheck/tests/vbit-test/Makefile
4361 cachegrind/tests/Makefile
4362 cachegrind/tests/x86/Makefile
4363 cachegrind/cg_annotate
4366 callgrind/callgrind_annotate
4367 callgrind/callgrind_control
4368 callgrind/tests/Makefile
4370 helgrind/tests/Makefile
4372 massif/tests/Makefile
4375 lackey/tests/Makefile
4378 none/tests/scripts/Makefile
4379 none/tests/amd64/Makefile
4380 none/tests/ppc32/Makefile
4381 none/tests/ppc64/Makefile
4382 none/tests/x86/Makefile
4383 none/tests/arm/Makefile
4384 none/tests/arm64/Makefile
4385 none/tests/s390x/Makefile
4386 none/tests/mips32/Makefile
4387 none/tests/mips64/Makefile
4388 none/tests/tilegx/Makefile
4389 none/tests/linux/Makefile
4390 none/tests/darwin/Makefile
4391 none/tests/solaris/Makefile
4392 none/tests/amd64-linux/Makefile
4393 none/tests/x86-linux/Makefile
4394 none/tests/amd64-darwin/Makefile
4395 none/tests/x86-darwin/Makefile
4396 none/tests/amd64-solaris/Makefile
4397 none/tests/x86-solaris/Makefile
4398 exp-sgcheck/Makefile
4399 exp-sgcheck/tests/Makefile
4401 drd/scripts/download-and-build-splash2
4404 exp-bbv/tests/Makefile
4405 exp-bbv/tests/x86/Makefile
4406 exp-bbv/tests/x86-linux/Makefile
4407 exp-bbv/tests/amd64-linux/Makefile
4408 exp-bbv/tests/ppc32-linux/Makefile
4409 exp-bbv/tests/arm-linux/Makefile
4411 exp-dhat/tests/Makefile
4415 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
4416 [chmod +x coregrind/link_tool_exe_linux])
4417 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
4418 [chmod +x coregrind/link_tool_exe_darwin])
4419 AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
4420 [chmod +x coregrind/link_tool_exe_solaris])
4425 Maximum build arch: ${ARCH_MAX}
4426 Primary build arch: ${VGCONF_ARCH_PRI}
4427 Secondary build arch: ${VGCONF_ARCH_SEC}
4428 Build OS: ${VGCONF_OS}
4429 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
4430 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
4431 Platform variant: ${VGCONF_PLATVARIANT}
4432 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
4433 Default supp files: ${DEFAULT_SUPP}