blob: 3874296fde0b688cbb15c28bad92600dad5b208d [file] [log] [blame]
sewardj01262142006-01-04 01:20:28 +00001
2##------------------------------------------------------------##
3#
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.
7#
8##------------------------------------------------------------##
9
sewardjde4a1d02002-03-22 01:27:54 +000010# Process this file with autoconf to produce a configure script.
Elliott Hughesed398002017-06-21 14:41:24 -070011AC_INIT([Valgrind],[3.13.0],[valgrind-users@lists.sourceforge.net])
njn04e16982005-05-31 00:23:43 +000012AC_CONFIG_SRCDIR(coregrind/m_main.c)
bart417cf3e2011-10-22 09:21:24 +000013AC_CONFIG_HEADERS([config.h])
sewardjf9a698e2013-09-02 12:44:52 +000014AM_INIT_AUTOMAKE([foreign subdir-objects])
sewardjde4a1d02002-03-22 01:27:54 +000015
gobryb0ed4672002-03-27 20:58:58 +000016AM_MAINTAINER_MODE
17
njn7fd6d382009-01-22 21:56:32 +000018#----------------------------------------------------------------------------
florian26a790a2014-12-03 22:53:00 +000019# Do NOT modify these flags here. Except in feature tests in which case
20# the original values must be properly restored.
21#----------------------------------------------------------------------------
22CFLAGS="$CFLAGS"
23CXXFLAGS="$CXXFLAGS"
24
25#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +000026# Checks for various programs.
27#----------------------------------------------------------------------------
gobrye721a522002-03-22 13:38:30 +000028
sewardjde4a1d02002-03-22 01:27:54 +000029AC_PROG_LN_S
30AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000031AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000032AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000033AC_PROG_CXX
njn629a5ec2009-07-14 01:29:39 +000034# 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
37# following:
njn0cd26892009-07-12 23:07:13 +000038# - 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],
42# [AC_PROG_OBJC],
43# [AC_CHECK_TOOL([OBJC], [gcc])
44# AC_SUBST([OBJC])
45# AC_SUBST([OBJCFLAGS])
46# ])
sewardjde4a1d02002-03-22 01:27:54 +000047AC_PROG_RANLIB
bart07de2c92010-05-29 06:44:28 +000048# provide a very basic definition for AC_PROG_SED if it's not provided by
49# autoconf (as e.g. in autoconf 2.59).
50m4_ifndef([AC_PROG_SED],
51 [AC_DEFUN([AC_PROG_SED],
52 [AC_ARG_VAR([SED])
53 AC_CHECK_PROGS([SED],[gsed sed])])])
bart12e91122010-05-15 08:37:24 +000054AC_PROG_SED
sewardjde4a1d02002-03-22 01:27:54 +000055
bartcddeaf52008-05-25 15:58:11 +000056# If no AR variable was specified, look up the name of the archiver. Otherwise
57# do not touch the AR variable.
58if test "x$AR" = "x"; then
bart07de2c92010-05-29 06:44:28 +000059 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000060fi
61AC_ARG_VAR([AR],[Archiver command])
62
gobrye721a522002-03-22 13:38:30 +000063# Check for the compiler support
64if test "${GCC}" != "yes" ; then
65 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
66fi
67
sewardj2f685952002-12-22 19:32:23 +000068# figure out where perl lives
69AC_PATH_PROG(PERL, perl)
70
njn9315df32003-04-16 20:50:50 +000071# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000072AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000073AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000074
daywalker48ccca52002-04-15 00:31:58 +000075# some older automake's don't have it so try something on our own
76ifdef([AM_PROG_AS],[AM_PROG_AS],
77[
gobry1be19852002-03-26 20:44:55 +000078AS="${CC}"
79AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000080
gobry1be19852002-03-26 20:44:55 +000081ASFLAGS=""
82AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000083])
gobry3b777892002-04-04 09:18:39 +000084
gobry3b777892002-04-04 09:18:39 +000085
njn0d2e58f2009-02-25 04:57:56 +000086# Check if 'diff' supports -u (universal diffs) and use it if possible.
87
88AC_MSG_CHECKING([for diff -u])
89AC_SUBST(DIFF)
90
sewardj6e9de462011-06-28 07:25:29 +000091# Comparing two identical files results in 0.
njn31f665e2009-02-26 21:25:50 +000092tmpfile="tmp-xxx-yyy-zzz"
93touch $tmpfile;
94if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000095 AC_MSG_RESULT([yes])
96 DIFF="diff -u"
97else
98 AC_MSG_RESULT([no])
99 DIFF="diff"
100fi
njn31f665e2009-02-26 21:25:50 +0000101rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +0000102
103
sewardj535c50f2005-06-04 23:14:53 +0000104# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +0000105AC_MSG_CHECKING([for a supported version of gcc])
106
bart85037442011-11-22 14:41:31 +0000107# Obtain the compiler version.
sewardja8ca2c52011-09-29 18:18:37 +0000108#
bart85037442011-11-22 14:41:31 +0000109# A few examples of how the ${CC} --version output looks like:
110#
sewardjc754e682014-10-13 13:03:50 +0000111# ######## gcc variants ########
bart85037442011-11-22 14:41:31 +0000112# 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
bartc5214062012-01-11 11:34:23 +0000116# MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
bart85037442011-11-22 14:41:31 +0000117# 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)
sewardjc754e682014-10-13 13:03:50 +0000119#
120# ######## clang variants ########
bart85037442011-11-22 14:41:31 +0000121# Clang: clang version 2.9 (tags/RELEASE_29/final)
bart048081f2012-06-17 05:53:02 +0000122# 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
sewardja8ca2c52011-09-29 18:18:37 +0000124#
sewardjc754e682014-10-13 13:03:50 +0000125# ######## 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)
128#
bartc5214062012-01-11 11:34:23 +0000129[
sewardjc754e682014-10-13 13:03:50 +0000130if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
131then
132 is_clang="applellvm"
133 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
134elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
135then
bart048081f2012-06-17 05:53:02 +0000136 is_clang="clang"
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'`
florian31556c32015-01-05 14:28:46 +0000139elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
140then
florian4e94bda2014-10-29 13:57:49 +0000141 is_clang="icc"
florian31556c32015-01-05 14:28:46 +0000142 gcc_version=`${CC} -dumpversion 2>/dev/null`
bart048081f2012-06-17 05:53:02 +0000143else
144 is_clang="notclang"
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'`
148 fi
sewardj3ab7b662011-09-29 17:30:13 +0000149fi
bart048081f2012-06-17 05:53:02 +0000150]
sewardjc754e682014-10-13 13:03:50 +0000151AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
florian4e94bda2014-10-29 13:57:49 +0000152AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
sewardjc754e682014-10-13 13:03:50 +0000153
bartfec24472014-09-13 09:42:29 +0000154# Note: m4 arguments are quoted with [ and ] so square brackets in shell
155# statements have to be quoted.
sewardj3ab7b662011-09-29 17:30:13 +0000156case "${is_clang}-${gcc_version}" in
Elliott Hughesa0664b92017-04-18 17:46:52 -0700157 applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-8.*)
sewardjc754e682014-10-13 13:03:50 +0000158 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
159 ;;
florian31556c32015-01-05 14:28:46 +0000160 icc-1[[3-9]].*)
florian4e94bda2014-10-29 13:57:49 +0000161 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
162 ;;
Elliott Hughesa0664b92017-04-18 17:46:52 -0700163 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
sewardj3ab7b662011-09-29 17:30:13 +0000164 AC_MSG_RESULT([ok (${gcc_version})])
165 ;;
bartfec24472014-09-13 09:42:29 +0000166 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
sewardj3ab7b662011-09-29 17:30:13 +0000167 AC_MSG_RESULT([ok (clang-${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000168 ;;
gobrye721a522002-03-22 13:38:30 +0000169 *)
Elliott Hughesa0664b92017-04-18 17:46:52 -0700170 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
florian4e94bda2014-10-29 13:57:49 +0000171 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0])
gobrye721a522002-03-22 13:38:30 +0000172 ;;
173esac
174
njn7fd6d382009-01-22 21:56:32 +0000175#----------------------------------------------------------------------------
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.
sewardj03d86f22006-10-17 00:57:24 +0000182
sewardjde4a1d02002-03-22 01:27:54 +0000183AC_CANONICAL_HOST
184
185AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000186
njn7fd6d382009-01-22 21:56:32 +0000187# 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
190# outside this file.
carllcae0cc22014-08-07 23:17:29 +0000191#
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
Elliott Hughesed398002017-06-21 14:41:24 -0700195# Valgrind code, the ARCH_MAX name will state LE or BE for the endianness of
carllcae0cc22014-08-07 23:17:29 +0000196# 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
Elliott Hughesed398002017-06-21 14:41:24 -0700198# Endianness. The name PPC64 or ppc64 to 64-bit systems of either Endianness.
carllcae0cc22014-08-07 23:17:29 +0000199# 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
201# Little Endian.
202
gobrye721a522002-03-22 13:38:30 +0000203case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000204 i?86)
205 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000206 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000207 ;;
208
njnfe408942004-11-23 17:52:24 +0000209 x86_64)
210 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000211 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000212 ;;
213
sewardj2c48c7b2005-11-29 13:05:56 +0000214 powerpc64)
carllcae0cc22014-08-07 23:17:29 +0000215 # this only referrs to 64-bit Big Endian
sewardj2c48c7b2005-11-29 13:05:56 +0000216 AC_MSG_RESULT([ok (${host_cpu})])
carllcae0cc22014-08-07 23:17:29 +0000217 ARCH_MAX="ppc64be"
218 ;;
219
220 powerpc64le)
221 # this only referrs to 64-bit Little Endian
222 AC_MSG_RESULT([ok (${host_cpu})])
223 ARCH_MAX="ppc64le"
sewardj2c48c7b2005-11-29 13:05:56 +0000224 ;;
225
226 powerpc)
sewardj6e9de462011-06-28 07:25:29 +0000227 # On Linux this means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000228 AC_MSG_RESULT([ok (${host_cpu})])
sewardj6e9de462011-06-28 07:25:29 +0000229 ARCH_MAX="ppc32"
nethercote9bcc9062004-10-13 13:50:01 +0000230 ;;
231
sewardjb5b87402011-03-07 16:05:35 +0000232 s390x)
233 AC_MSG_RESULT([ok (${host_cpu})])
234 ARCH_MAX="s390x"
235 ;;
236
sewardj59570ff2010-01-01 11:59:33 +0000237 armv7*)
238 AC_MSG_RESULT([ok (${host_cpu})])
239 ARCH_MAX="arm"
240 ;;
241
sewardjf0c12502014-01-12 12:54:00 +0000242 aarch64*)
243 AC_MSG_RESULT([ok (${host_cpu})])
244 ARCH_MAX="arm64"
245 ;;
246
sewardj5db15402012-06-07 09:13:21 +0000247 mips)
petarj4df0bfc2013-02-27 23:17:33 +0000248 AC_MSG_RESULT([ok (${host_cpu})])
249 ARCH_MAX="mips32"
250 ;;
sewardj5db15402012-06-07 09:13:21 +0000251
252 mipsel)
petarj4df0bfc2013-02-27 23:17:33 +0000253 AC_MSG_RESULT([ok (${host_cpu})])
254 ARCH_MAX="mips32"
255 ;;
sewardj5db15402012-06-07 09:13:21 +0000256
257 mipsisa32r2)
petarj4df0bfc2013-02-27 23:17:33 +0000258 AC_MSG_RESULT([ok (${host_cpu})])
259 ARCH_MAX="mips32"
260 ;;
sewardj5db15402012-06-07 09:13:21 +0000261
petarj4df0bfc2013-02-27 23:17:33 +0000262 mips64*)
263 AC_MSG_RESULT([ok (${host_cpu})])
264 ARCH_MAX="mips64"
265 ;;
266
267 mipsisa64*)
268 AC_MSG_RESULT([ok (${host_cpu})])
269 ARCH_MAX="mips64"
270 ;;
sewardj112711a2015-04-10 12:30:09 +0000271
sewardjde4a1d02002-03-22 01:27:54 +0000272 *)
273 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000274 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000275 ;;
276esac
277
njn7fd6d382009-01-22 21:56:32 +0000278#----------------------------------------------------------------------------
279
sewardj86e992f2006-01-28 18:39:09 +0000280# Sometimes it's convenient to subvert the bi-arch build system and
281# just have a single build even though the underlying platform is
282# capable of both. Hence handle --enable-only64bit and
283# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000284# [Actually, if either of these options are used, I think both get built,
285# but only one gets installed. So if you use an in-place build, both can be
286# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000287
288# Check if a 64-bit only build has been requested
289AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
290 [AC_ARG_ENABLE(only64bit,
291 [ --enable-only64bit do a 64-bit only build],
292 [vg_cv_only64bit=$enableval],
293 [vg_cv_only64bit=no])])
294
295# Check if a 32-bit only build has been requested
296AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
297 [AC_ARG_ENABLE(only32bit,
298 [ --enable-only32bit do a 32-bit only build],
299 [vg_cv_only32bit=$enableval],
300 [vg_cv_only32bit=no])])
301
302# Stay sane
303if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
304 AC_MSG_ERROR(
305 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
306fi
307
njn7fd6d382009-01-22 21:56:32 +0000308#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000309
njn311303f2009-02-06 03:46:50 +0000310# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
311# compilation of many C files via -VGO_$(VGCONF_OS) and
312# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000313AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000314AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000315
njnf76d27a2009-05-28 01:53:07 +0000316DEFAULT_SUPP=""
317
gobrye721a522002-03-22 13:38:30 +0000318case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000319 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000320 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000321 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000322
323 # Ok, this is linux. Check the kernel version
324 AC_MSG_CHECKING([for the kernel version])
325
326 kernel=`uname -r`
327
328 case "${kernel}" in
cborntra0e8dd912015-02-23 20:19:03 +0000329 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
mueller8c68e042004-01-03 15:21:14 +0000330 AC_MSG_RESULT([unsupported (${kernel})])
cborntra0e8dd912015-02-23 20:19:03 +0000331 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
mueller8c68e042004-01-03 15:21:14 +0000332 ;;
cborntra0e8dd912015-02-23 20:19:03 +0000333
334 *)
335 AC_MSG_RESULT([2.6 or later (${kernel})])
336 ;;
mueller8c68e042004-01-03 15:21:14 +0000337 esac
338
339 ;;
340
njnf76d27a2009-05-28 01:53:07 +0000341 *darwin*)
342 AC_MSG_RESULT([ok (${host_os})])
343 VGCONF_OS="darwin"
njnea2d6fd2010-07-01 00:20:20 +0000344 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
345 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
346 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
sewardjae284e52012-08-02 18:25:04 +0000347 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
sewardjec66ad52014-06-20 11:48:38 +0000348 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
sewardjac3afbd2014-11-06 20:16:05 +0000349 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
rhyskidd9090d2f2015-07-08 13:46:57 +0000350 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
Elliott Hughesa0664b92017-04-18 17:46:52 -0700351 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
njnf76d27a2009-05-28 01:53:07 +0000352
353 AC_MSG_CHECKING([for the kernel version])
354 kernel=`uname -r`
355
356 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
357 # has only one relevant version, the OS version. The `uname` check
358 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
sewardj731f9cf2011-09-21 08:43:08 +0000359 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
360 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
njnea2d6fd2010-07-01 00:20:20 +0000361 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000362 #
363 # XXX: `uname -r` won't do the right thing for cross-compiles, but
364 # that's not a problem yet.
sewardj731f9cf2011-09-21 08:43:08 +0000365 #
366 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
367 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
368 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
369 # time support for 10.5 (the 9.* pattern just below), I'll leave it
370 # in for now, just in case anybody wants to give it a try. But I'm
371 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
njnf76d27a2009-05-28 01:53:07 +0000372 case "${kernel}" in
373 9.*)
374 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000375 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000376 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000377 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000378 ;;
njnea2d6fd2010-07-01 00:20:20 +0000379 10.*)
380 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
381 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
382 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
383 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
384 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000385 11.*)
386 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
387 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
sewardj731f9cf2011-09-21 08:43:08 +0000388 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
389 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
390 ;;
sewardjae284e52012-08-02 18:25:04 +0000391 12.*)
392 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
393 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
394 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
395 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
396 ;;
sewardjec66ad52014-06-20 11:48:38 +0000397 13.*)
398 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
399 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
400 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
401 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
402 ;;
sewardjac3afbd2014-11-06 20:16:05 +0000403 14.*)
404 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
405 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
406 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
407 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
408 ;;
rhyskidd9090d2f2015-07-08 13:46:57 +0000409 15.*)
410 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
411 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
412 DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
413 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
414 ;;
Elliott Hughesa0664b92017-04-18 17:46:52 -0700415 16.*)
416 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
417 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
418 DEFAULT_SUPP="darwin16.supp ${DEFAULT_SUPP}"
419 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
420 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000421 *)
njnf76d27a2009-05-28 01:53:07 +0000422 AC_MSG_RESULT([unsupported (${kernel})])
Elliott Hughesa0664b92017-04-18 17:46:52 -0700423 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)])
njnf76d27a2009-05-28 01:53:07 +0000424 ;;
425 esac
426 ;;
427
sewardj8eb8bab2015-07-21 14:44:28 +0000428 solaris2.11*)
429 AC_MSG_RESULT([ok (${host_os})])
430 VGCONF_OS="solaris"
431 DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
432 ;;
433
434 solaris2.12*)
435 AC_MSG_RESULT([ok (${host_os})])
436 VGCONF_OS="solaris"
437 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
438 ;;
439
sewardjde4a1d02002-03-22 01:27:54 +0000440 *)
441 AC_MSG_RESULT([no (${host_os})])
njncc58cea2010-07-05 07:21:22 +0000442 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
sewardjde4a1d02002-03-22 01:27:54 +0000443 ;;
444esac
445
njn7fd6d382009-01-22 21:56:32 +0000446#----------------------------------------------------------------------------
447
tomd6398392006-06-07 17:44:36 +0000448# If we are building on a 64 bit platform test to see if the system
449# supports building 32 bit programs and disable 32 bit support if it
450# does not support building 32 bit programs
451
njn7fd6d382009-01-22 21:56:32 +0000452case "$ARCH_MAX-$VGCONF_OS" in
sewardj8eb8bab2015-07-21 14:44:28 +0000453 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
tomd6398392006-06-07 17:44:36 +0000454 AC_MSG_CHECKING([for 32 bit build support])
455 safe_CFLAGS=$CFLAGS
456 CFLAGS="-m32"
bart417cf3e2011-10-22 09:21:24 +0000457 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +0000458 return 0;
bart417cf3e2011-10-22 09:21:24 +0000459 ]])], [
tomd6398392006-06-07 17:44:36 +0000460 AC_MSG_RESULT([yes])
461 ], [
462 vg_cv_only64bit="yes"
463 AC_MSG_RESULT([no])
464 ])
465 CFLAGS=$safe_CFLAGS;;
466esac
467
468if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
469 AC_MSG_ERROR(
470 [--enable-only32bit was specified but system does not support 32 bit builds])
471fi
nethercote888ecb72004-08-23 14:54:40 +0000472
njn7fd6d382009-01-22 21:56:32 +0000473#----------------------------------------------------------------------------
474
njn311303f2009-02-06 03:46:50 +0000475# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
476# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
477# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
478# above) will be "amd64" since that reflects the most that this cpu can do,
479# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
480# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000481# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
482# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
483AC_SUBST(VGCONF_ARCH_PRI)
484
njn3f8a6e92009-06-02 00:20:47 +0000485# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
486# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
487# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
488# It is empty if there is no secondary target.
489AC_SUBST(VGCONF_ARCH_SEC)
490
njn311303f2009-02-06 03:46:50 +0000491# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
492# The entire system, including regression and performance tests, will be
493# built for this target. The "_CAPS" indicates that the name is in capital
494# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000495# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000496# convention and cannot contain '-' characters. This is in contrast to
497# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000498AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
499
500# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
501# Valgrind and tools will also be built for this target, but not the
502# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000503#
njn7fd6d382009-01-22 21:56:32 +0000504# By default, the primary arch is the same as the "max" arch, as commented
505# above (at the definition of ARCH_MAX). We may choose to downgrade it in
506# the big case statement just below here, in the case where we're building
507# on a 64 bit machine but have been requested only to do a 32 bit build.
508AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
509
sewardj01262142006-01-04 01:20:28 +0000510AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000511
njnea2d6fd2010-07-01 00:20:20 +0000512# NB. The load address for a given platform may be specified in more
513# than one place, in some cases, depending on whether we're doing a biarch,
514# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
515# Be careful to give consistent values in all subcases. Also, all four
516# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
517# even if it is to "0xUNSET".
518#
njn7fd6d382009-01-22 21:56:32 +0000519case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000520 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000521 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000522 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000523 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
524 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700525 valt_load_address_pri_norml="0x58000000"
526 valt_load_address_pri_inner="0x38000000"
njnea2d6fd2010-07-01 00:20:20 +0000527 valt_load_address_sec_norml="0xUNSET"
528 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000529 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000530 ;;
531 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000532 valt_load_address_sec_norml="0xUNSET"
533 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000534 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000535 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000536 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000537 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
538 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700539 valt_load_address_pri_norml="0x58000000"
540 valt_load_address_pri_inner="0x38000000"
sewardj86e992f2006-01-28 18:39:09 +0000541 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000542 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000543 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000544 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
545 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700546 valt_load_address_pri_norml="0x58000000"
547 valt_load_address_pri_inner="0x38000000"
sewardj86e992f2006-01-28 18:39:09 +0000548 else
njn7fd6d382009-01-22 21:56:32 +0000549 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000550 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000551 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
552 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
Elliott Hughesed398002017-06-21 14:41:24 -0700553 valt_load_address_pri_norml="0x58000000"
554 valt_load_address_pri_inner="0x38000000"
555 valt_load_address_sec_norml="0x58000000"
556 valt_load_address_sec_inner="0x38000000"
sewardj86e992f2006-01-28 18:39:09 +0000557 fi
njn377c43f2009-05-19 07:39:22 +0000558 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000559 ;;
560 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000561 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000562 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000563 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
564 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700565 valt_load_address_pri_norml="0x58000000"
566 valt_load_address_pri_inner="0x38000000"
njnea2d6fd2010-07-01 00:20:20 +0000567 valt_load_address_sec_norml="0xUNSET"
568 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000569 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000570 ;;
carllcae0cc22014-08-07 23:17:29 +0000571 ppc64be-linux)
njnea2d6fd2010-07-01 00:20:20 +0000572 valt_load_address_sec_norml="0xUNSET"
573 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000574 if test x$vg_cv_only64bit = xyes; then
carllcae0cc22014-08-07 23:17:29 +0000575 VGCONF_ARCH_PRI="ppc64be"
njn3f8a6e92009-06-02 00:20:47 +0000576 VGCONF_ARCH_SEC=""
carllcae0cc22014-08-07 23:17:29 +0000577 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
njn7fd6d382009-01-22 21:56:32 +0000578 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700579 valt_load_address_pri_norml="0x58000000"
580 valt_load_address_pri_inner="0x38000000"
sewardj86e992f2006-01-28 18:39:09 +0000581 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000582 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000583 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000584 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
585 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700586 valt_load_address_pri_norml="0x58000000"
587 valt_load_address_pri_inner="0x38000000"
sewardj86e992f2006-01-28 18:39:09 +0000588 else
carllcae0cc22014-08-07 23:17:29 +0000589 VGCONF_ARCH_PRI="ppc64be"
njn3f8a6e92009-06-02 00:20:47 +0000590 VGCONF_ARCH_SEC="ppc32"
carllcae0cc22014-08-07 23:17:29 +0000591 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
njn7fd6d382009-01-22 21:56:32 +0000592 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
Elliott Hughesed398002017-06-21 14:41:24 -0700593 valt_load_address_pri_norml="0x58000000"
594 valt_load_address_pri_inner="0x38000000"
595 valt_load_address_sec_norml="0x58000000"
596 valt_load_address_sec_inner="0x38000000"
sewardj86e992f2006-01-28 18:39:09 +0000597 fi
njn377c43f2009-05-19 07:39:22 +0000598 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000599 ;;
carllcae0cc22014-08-07 23:17:29 +0000600 ppc64le-linux)
601 # Little Endian is only supported on PPC64
602 valt_load_address_sec_norml="0xUNSET"
603 valt_load_address_sec_inner="0xUNSET"
604 VGCONF_ARCH_PRI="ppc64le"
605 VGCONF_ARCH_SEC=""
606 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
607 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700608 valt_load_address_pri_norml="0x58000000"
609 valt_load_address_pri_inner="0x38000000"
carllcae0cc22014-08-07 23:17:29 +0000610 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
611 ;;
njncc58cea2010-07-05 07:21:22 +0000612 # Darwin gets identified as 32-bit even when it supports 64-bit.
613 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
614 # all Macs support both 32-bit and 64-bit, so we just build both. If
615 # someone has a really old 32-bit only machine they can (hopefully?)
616 # build with --enable-only32bit. See bug 243362.
617 x86-darwin|amd64-darwin)
618 ARCH_MAX="amd64"
njnea2d6fd2010-07-01 00:20:20 +0000619 valt_load_address_sec_norml="0xUNSET"
620 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000621 if test x$vg_cv_only64bit = xyes; then
622 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000623 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000624 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
625 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700626 valt_load_address_pri_norml="0x158000000"
627 valt_load_address_pri_inner="0x138000000"
njnf76d27a2009-05-28 01:53:07 +0000628 elif test x$vg_cv_only32bit = xyes; then
629 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000630 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000631 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
632 VGCONF_PLATFORM_SEC_CAPS=""
633 VGCONF_ARCH_PRI_CAPS="x86"
Elliott Hughesed398002017-06-21 14:41:24 -0700634 valt_load_address_pri_norml="0x58000000"
635 valt_load_address_pri_inner="0x38000000"
njnf76d27a2009-05-28 01:53:07 +0000636 else
637 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000638 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000639 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
640 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
Elliott Hughesed398002017-06-21 14:41:24 -0700641 valt_load_address_pri_norml="0x158000000"
642 valt_load_address_pri_inner="0x138000000"
643 valt_load_address_sec_norml="0x58000000"
644 valt_load_address_sec_inner="0x38000000"
njnf76d27a2009-05-28 01:53:07 +0000645 fi
njnf76d27a2009-05-28 01:53:07 +0000646 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
647 ;;
sewardj59570ff2010-01-01 11:59:33 +0000648 arm-linux)
649 VGCONF_ARCH_PRI="arm"
650 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
651 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700652 valt_load_address_pri_norml="0x58000000"
653 valt_load_address_pri_inner="0x38000000"
njnea2d6fd2010-07-01 00:20:20 +0000654 valt_load_address_sec_norml="0xUNSET"
655 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000656 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
657 ;;
sewardjf0c12502014-01-12 12:54:00 +0000658 arm64-linux)
659 valt_load_address_sec_norml="0xUNSET"
660 valt_load_address_sec_inner="0xUNSET"
661 if test x$vg_cv_only64bit = xyes; then
662 VGCONF_ARCH_PRI="arm64"
663 VGCONF_ARCH_SEC=""
664 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
665 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700666 valt_load_address_pri_norml="0x58000000"
667 valt_load_address_pri_inner="0x38000000"
sewardjf0c12502014-01-12 12:54:00 +0000668 elif test x$vg_cv_only32bit = xyes; then
669 VGCONF_ARCH_PRI="arm"
670 VGCONF_ARCH_SEC=""
671 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
672 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700673 valt_load_address_pri_norml="0x58000000"
674 valt_load_address_pri_inner="0x38000000"
sewardjf0c12502014-01-12 12:54:00 +0000675 else
676 VGCONF_ARCH_PRI="arm64"
677 VGCONF_ARCH_SEC="arm"
678 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
679 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
Elliott Hughesed398002017-06-21 14:41:24 -0700680 valt_load_address_pri_norml="0x58000000"
681 valt_load_address_pri_inner="0x38000000"
682 valt_load_address_sec_norml="0x58000000"
683 valt_load_address_sec_inner="0x38000000"
sewardjf0c12502014-01-12 12:54:00 +0000684 fi
685 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
686 ;;
sewardjb5b87402011-03-07 16:05:35 +0000687 s390x-linux)
688 VGCONF_ARCH_PRI="s390x"
689 VGCONF_ARCH_SEC=""
690 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
691 VGCONF_PLATFORM_SEC_CAPS=""
cborntraf4c46902013-10-23 16:23:30 +0000692 # To improve branch prediction hit rate we want to have
693 # the generated code close to valgrind (host) code
694 valt_load_address_pri_norml="0x800000000"
695 valt_load_address_pri_inner="0x810000000"
sewardjb5b87402011-03-07 16:05:35 +0000696 valt_load_address_sec_norml="0xUNSET"
697 valt_load_address_sec_inner="0xUNSET"
698 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
699 ;;
sewardj5db15402012-06-07 09:13:21 +0000700 mips32-linux)
701 VGCONF_ARCH_PRI="mips32"
702 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
703 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700704 valt_load_address_pri_norml="0x58000000"
705 valt_load_address_pri_inner="0x38000000"
sewardj5db15402012-06-07 09:13:21 +0000706 valt_load_address_sec_norml="0xUNSET"
707 valt_load_address_sec_inner="0xUNSET"
708 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
petarj4df0bfc2013-02-27 23:17:33 +0000709 ;;
710 mips64-linux)
711 VGCONF_ARCH_PRI="mips64"
712 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
713 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700714 valt_load_address_pri_norml="0x58000000"
715 valt_load_address_pri_inner="0x38000000"
sewardj112711a2015-04-10 12:30:09 +0000716 valt_load_address_sec_norml="0xUNSET"
717 valt_load_address_sec_inner="0xUNSET"
718 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
719 ;;
sewardj8eb8bab2015-07-21 14:44:28 +0000720 x86-solaris)
721 VGCONF_ARCH_PRI="x86"
722 VGCONF_ARCH_SEC=""
723 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
724 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700725 valt_load_address_pri_norml="0x58000000"
726 valt_load_address_pri_inner="0x38000000"
sewardj8eb8bab2015-07-21 14:44:28 +0000727 valt_load_address_sec_norml="0xUNSET"
728 valt_load_address_sec_inner="0xUNSET"
729 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
730 ;;
731 amd64-solaris)
732 valt_load_address_sec_norml="0xUNSET"
733 valt_load_address_sec_inner="0xUNSET"
734 if test x$vg_cv_only64bit = xyes; then
735 VGCONF_ARCH_PRI="amd64"
736 VGCONF_ARCH_SEC=""
737 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
738 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700739 valt_load_address_pri_norml="0x58000000"
740 valt_load_address_pri_inner="0x38000000"
sewardj8eb8bab2015-07-21 14:44:28 +0000741 elif test x$vg_cv_only32bit = xyes; then
742 VGCONF_ARCH_PRI="x86"
743 VGCONF_ARCH_SEC=""
744 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
745 VGCONF_PLATFORM_SEC_CAPS=""
Elliott Hughesed398002017-06-21 14:41:24 -0700746 valt_load_address_pri_norml="0x58000000"
747 valt_load_address_pri_inner="0x38000000"
sewardj8eb8bab2015-07-21 14:44:28 +0000748 else
749 VGCONF_ARCH_PRI="amd64"
750 VGCONF_ARCH_SEC="x86"
751 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
752 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
Elliott Hughesed398002017-06-21 14:41:24 -0700753 valt_load_address_pri_norml="0x58000000"
754 valt_load_address_pri_inner="0x38000000"
755 valt_load_address_sec_norml="0x58000000"
756 valt_load_address_sec_inner="0x38000000"
sewardj8eb8bab2015-07-21 14:44:28 +0000757 fi
758 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
759 ;;
nethercote888ecb72004-08-23 14:54:40 +0000760 *)
njn7fd6d382009-01-22 21:56:32 +0000761 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000762 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000763 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
764 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000765 valt_load_address_pri_norml="0xUNSET"
766 valt_load_address_pri_inner="0xUNSET"
767 valt_load_address_sec_norml="0xUNSET"
768 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000769 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000770 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000771 ;;
772esac
sewardjde4a1d02002-03-22 01:27:54 +0000773
njn7fd6d382009-01-22 21:56:32 +0000774#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000775
njn7fd6d382009-01-22 21:56:32 +0000776# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
777# defined.
778AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
779 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000780 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
781 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
sewardj8eb8bab2015-07-21 14:44:28 +0000782 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
783 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
784 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
njn7fd6d382009-01-22 21:56:32 +0000785AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000786 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +0000787 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
788 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
njn7fd6d382009-01-22 21:56:32 +0000789AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
790 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj6e9de462011-06-28 07:25:29 +0000791 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000792AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
carllcae0cc22014-08-07 23:17:29 +0000793 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
794 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
sewardj59570ff2010-01-01 11:59:33 +0000795AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
sewardjf0c12502014-01-12 12:54:00 +0000796 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
797 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
798AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
799 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
sewardjb5b87402011-03-07 16:05:35 +0000800AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
801 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
sewardj5db15402012-06-07 09:13:21 +0000802AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
803 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
petarj4df0bfc2013-02-27 23:17:33 +0000804AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
805 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000806
njn7fd6d382009-01-22 21:56:32 +0000807# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
808# become defined.
809AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
810 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
811 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
812AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
813 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
814AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
815 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
816 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
carllcae0cc22014-08-07 23:17:29 +0000817AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
818 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
819AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
820 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000821AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
sewardjf0c12502014-01-12 12:54:00 +0000822 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
823 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
824AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
825 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
sewardjb5b87402011-03-07 16:05:35 +0000826AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
827 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
828 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
sewardj5db15402012-06-07 09:13:21 +0000829AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
830 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
petarj4df0bfc2013-02-27 23:17:33 +0000831AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
832 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000833AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
834 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
835 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
836AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
837 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj8eb8bab2015-07-21 14:44:28 +0000838AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
839 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
840 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
841AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
842 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
njnf76d27a2009-05-28 01:53:07 +0000843
844
sewardj72a2d802010-07-29 05:24:20 +0000845# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000846# Relies on the assumption that the primary and secondary targets are
847# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000848AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
849 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
850 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
851 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
carllcae0cc22014-08-07 23:17:29 +0000852 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
853 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
sewardjb5b87402011-03-07 16:05:35 +0000854 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
sewardjf0c12502014-01-12 12:54:00 +0000855 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
sewardj5db15402012-06-07 09:13:21 +0000856 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +0000857 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
Elliott Hughesed398002017-06-21 14:41:24 -0700858 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000859AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
860 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
861 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj8eb8bab2015-07-21 14:44:28 +0000862AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
863 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
864 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
sewardj03d86f22006-10-17 00:57:24 +0000865
866
njn7fd6d382009-01-22 21:56:32 +0000867# Sometimes, in the Makefile.am files, it's useful to know whether or not
868# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000869AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000870 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000871
philippef32cbe82012-05-18 16:48:20 +0000872dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
873dnl fallback definition
874dnl The macro is courtesy of Dave Hart:
875dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
876m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
877if test -z "$$1_TRUE"; then :
878 m4_n([$2])[]dnl
879m4_ifval([$3],
880[else
881 $3
882])dnl
883fi[]dnl
884])])
tomb637bad2005-11-08 12:28:35 +0000885
njn7fd6d382009-01-22 21:56:32 +0000886#----------------------------------------------------------------------------
887# Inner Valgrind?
888#----------------------------------------------------------------------------
889
njnd74b0ef2009-01-20 06:06:52 +0000890# Check if this should be built as an inner Valgrind, to be run within
891# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000892AC_SUBST(VALT_LOAD_ADDRESS_PRI)
893AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000894AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
895 [AC_ARG_ENABLE(inner,
896 [ --enable-inner enables self-hosting],
897 [vg_cv_inner=$enableval],
898 [vg_cv_inner=no])])
899if test "$vg_cv_inner" = yes; then
900 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000901 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
902 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000903else
njnea2d6fd2010-07-01 00:20:20 +0000904 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
905 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000906fi
907
florianbb1a7872015-03-10 16:13:59 +0000908#----------------------------------------------------------------------------
909# Undefined behaviour sanitiser
910#----------------------------------------------------------------------------
911# Check whether we should build with the undefined beahviour sanitiser.
912
913AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
914 [AC_ARG_ENABLE(ubsan,
915 [ --enable-ubsan enables the undefined behaviour sanitiser],
916 [vg_cv_ubsan=$enableval],
917 [vg_cv_ubsan=no])])
njnd74b0ef2009-01-20 06:06:52 +0000918
njn7fd6d382009-01-22 21:56:32 +0000919#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000920# Extra fine-tuning of installation directories
921#----------------------------------------------------------------------------
922AC_ARG_WITH(tmpdir,
923 [ --with-tmpdir=PATH Specify path for temporary files],
924 tmpdir="$withval",
925 tmpdir="/tmp")
926AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
florian7fd2ec32014-06-21 20:25:30 +0000927AC_SUBST(VG_TMPDIR, [$tmpdir])
sewardjcb495c82011-07-11 20:42:34 +0000928
sewardj0ba37c92011-07-12 11:46:24 +0000929
sewardjcb495c82011-07-11 20:42:34 +0000930#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000931# Libc and suppressions
932#----------------------------------------------------------------------------
933# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000934AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000935
bart12e91122010-05-15 08:37:24 +0000936AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000937
bart12e91122010-05-15 08:37:24 +0000938if test x$ac_cv_header_features_h = xyes; then
939 rm -f conftest.$ac_ext
940 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000941#include <features.h>
bart12e91122010-05-15 08:37:24 +0000942#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
943glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000944#endif
bart12e91122010-05-15 08:37:24 +0000945_ACEOF
mjwa384c3f2014-09-10 00:52:30 +0000946 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
bart12e91122010-05-15 08:37:24 +0000947fi
bartb7c3f082010-05-13 06:32:36 +0000948
njnf76d27a2009-05-28 01:53:07 +0000949# not really a version check
950AC_EGREP_CPP([DARWIN_LIBC], [
951#include <sys/cdefs.h>
952#if defined(__DARWIN_VERS_1050)
953 DARWIN_LIBC
954#endif
955],
956GLIBC_VERSION="darwin")
957
sewardjcb495c82011-07-11 20:42:34 +0000958# not really a version check
959AC_EGREP_CPP([BIONIC_LIBC], [
960#if defined(__ANDROID__)
961 BIONIC_LIBC
962#endif
963],
964GLIBC_VERSION="bionic")
965
sewardj8eb8bab2015-07-21 14:44:28 +0000966# there is only one version of libc on Solaris
967if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
968 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
969 GLIBC_VERSION="solaris"
970fi
971
Elliott Hughesed398002017-06-21 14:41:24 -0700972# GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
973# in this case.
974if test x$GLIBC_VERSION = x; then
975 if $CC -dumpmachine | grep -q musl; then
976 GLIBC_VERSION=musl
977 fi
978fi
sewardjcb495c82011-07-11 20:42:34 +0000979
bart8219bff2014-09-13 10:53:00 +0000980AC_MSG_CHECKING([the glibc version])
sewardj03d86f22006-10-17 00:57:24 +0000981
dirk07596a22008-04-25 11:33:30 +0000982case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000983 2.2)
bart8219bff2014-09-13 10:53:00 +0000984 AC_MSG_RESULT(${GLIBC_VERSION} family)
sewardj2c4f3dd2007-11-11 06:13:01 +0000985 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
986 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000987 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000988 ;;
bart8219bff2014-09-13 10:53:00 +0000989 2.[[3-6]])
990 AC_MSG_RESULT(${GLIBC_VERSION} family)
991 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000992 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000993 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000994 ;;
bart8219bff2014-09-13 10:53:00 +0000995 2.[[7-9]])
996 AC_MSG_RESULT(${GLIBC_VERSION} family)
dirk07596a22008-04-25 11:33:30 +0000997 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000998 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000999 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +00001000 ;;
bart8219bff2014-09-13 10:53:00 +00001001 2.10|2.11)
1002 AC_MSG_RESULT(${GLIBC_VERSION} family)
1003 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1004 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
dirk07596a22008-04-25 11:33:30 +00001005 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1006 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1007 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1008 ;;
bart8219bff2014-09-13 10:53:00 +00001009 2.*)
1010 AC_MSG_RESULT(${GLIBC_VERSION} family)
1011 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1012 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1013 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1014 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
mjwedd30332014-09-08 23:41:31 +00001015 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1016 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1017 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1018 ;;
njnf76d27a2009-05-28 01:53:07 +00001019 darwin)
1020 AC_MSG_RESULT(Darwin)
1021 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1022 # DEFAULT_SUPP set by kernel version check above.
1023 ;;
sewardjcb495c82011-07-11 20:42:34 +00001024 bionic)
1025 AC_MSG_RESULT(Bionic)
1026 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1027 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1028 ;;
sewardj8eb8bab2015-07-21 14:44:28 +00001029 solaris)
1030 AC_MSG_RESULT(Solaris)
1031 # DEFAULT_SUPP set in host_os switch-case above.
1032 # No other suppression file is used.
1033 ;;
Elliott Hughesed398002017-06-21 14:41:24 -07001034 musl)
1035 AC_MSG_RESULT(Musl)
1036 AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
1037 # no DEFAULT_SUPP file yet for musl libc.
1038 ;;
bart8219bff2014-09-13 10:53:00 +00001039 2.0|2.1|*)
bart12e91122010-05-15 08:37:24 +00001040 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
Elliott Hughesed398002017-06-21 14:41:24 -07001041 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
1042 AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
sewardjde4a1d02002-03-22 01:27:54 +00001043 ;;
1044esac
1045
dirk07596a22008-04-25 11:33:30 +00001046AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +00001047
sewardj414f3582008-07-18 20:46:00 +00001048
sewardj8eb8bab2015-07-21 14:44:28 +00001049if test "$VGCONF_OS" != "solaris"; then
1050 # Add default suppressions for the X client libraries. Make no
1051 # attempt to detect whether such libraries are installed on the
1052 # build machine (or even if any X facilities are present); just
1053 # add the suppressions antidisirregardless.
1054 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1055 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +00001056
sewardj8eb8bab2015-07-21 14:44:28 +00001057 # Add glibc and X11 suppressions for exp-sgcheck
1058 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1059fi
sewardj5744c022008-10-19 18:58:13 +00001060
sewardj2e10a682003-04-07 19:36:41 +00001061
njn7fd6d382009-01-22 21:56:32 +00001062#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +00001063# Platform variants?
1064#----------------------------------------------------------------------------
1065
1066# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1067# But there are times where we need a bit more control. The motivating
philippe5d5dd8e2012-08-05 00:08:25 +00001068# and currently only case is Android: this is almost identical to
dejanj9c6b05d2013-12-27 09:06:55 +00001069# {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1070# platform variant tags, which get passed in the compile as
1071# -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
sewardjcb495c82011-07-11 20:42:34 +00001072#
1073# In almost all cases, the <variant> bit is "vanilla". But for Android
1074# it is "android" instead.
1075#
1076# Consequently (eg), plain arm-linux would build with
1077#
1078# -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1079#
1080# whilst an Android build would have
1081#
1082# -DVGP_arm_linux -DVGPV_arm_linux_android
1083#
philippe5d5dd8e2012-08-05 00:08:25 +00001084# Same for x86. The setup of the platform variant is pushed relatively far
1085# down this file in order that we can inspect any of the variables set above.
sewardjcb495c82011-07-11 20:42:34 +00001086
1087# In the normal case ..
1088VGCONF_PLATVARIANT="vanilla"
1089
philippe5d5dd8e2012-08-05 00:08:25 +00001090# Android ?
1091if test "$GLIBC_VERSION" = "bionic";
sewardjcb495c82011-07-11 20:42:34 +00001092then
1093 VGCONF_PLATVARIANT="android"
1094fi
1095
1096AC_SUBST(VGCONF_PLATVARIANT)
1097
1098
1099# FIXME: do we also want to define automake variables
1100# VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1101# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1102# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1103# do that. Problem is that we can't do and-ing in Makefile.am's, but
1104# that's what we'd need to do to use this, since what we'd want to write
1105# is something like
1106#
1107# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1108#
sewardj0ba37c92011-07-12 11:46:24 +00001109# Hmm. Can't think of a nice clean solution to this.
1110
1111AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1112 test x$VGCONF_PLATVARIANT = xvanilla)
1113AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1114 test x$VGCONF_PLATVARIANT = xandroid)
sewardjcb495c82011-07-11 20:42:34 +00001115
1116
1117#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +00001118# Checking for various library functions and other definitions
1119#----------------------------------------------------------------------------
1120
florian28db75c2012-12-08 19:26:03 +00001121# Check for AT_FDCWD
1122
1123AC_MSG_CHECKING([for AT_FDCWD])
1124AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1125#define _GNU_SOURCE
1126#include <fcntl.h>
1127#include <unistd.h>
1128]], [[
1129 int a = AT_FDCWD;
1130]])], [
1131ac_have_at_fdcwd=yes
1132AC_MSG_RESULT([yes])
1133], [
1134ac_have_at_fdcwd=no
florian28db75c2012-12-08 19:26:03 +00001135AC_MSG_RESULT([no])
1136])
1137
1138AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1139
sewardj24cf8df2012-12-14 10:30:57 +00001140# Check for stpncpy function definition in string.h
1141# This explicitly checks with _GNU_SOURCE defined since that is also
1142# used in the test case (some systems might define it without anyway
1143# since stpncpy is part of The Open Group Base Specifications Issue 7
1144# IEEE Std 1003.1-2008.
1145AC_MSG_CHECKING([for stpncpy])
1146AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1147#define _GNU_SOURCE
1148#include <string.h>
1149]], [[
1150 char *d;
1151 char *s;
1152 size_t n = 0;
1153 char *r = stpncpy(d, s, n);
1154]])], [
1155ac_have_gnu_stpncpy=yes
1156AC_MSG_RESULT([yes])
1157], [
1158ac_have_gnu_stpncpy=no
1159AC_MSG_RESULT([no])
1160])
1161
1162AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
florian28db75c2012-12-08 19:26:03 +00001163
philippe4e98f7c2013-08-03 20:34:58 +00001164# Check for PTRACE_GETREGS
1165
1166AC_MSG_CHECKING([for PTRACE_GETREGS])
1167AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
philippedc1757e2015-02-02 22:40:54 +00001168#include <stdlib.h>
philippe4e98f7c2013-08-03 20:34:58 +00001169#include <stddef.h>
1170#include <sys/ptrace.h>
1171#include <sys/user.h>
1172]], [[
1173 void *p;
1174 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1175]])], [
1176AC_MSG_RESULT([yes])
1177AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1178 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1179], [
1180AC_MSG_RESULT([no])
1181])
1182
1183
bart59e2f182008-04-28 16:22:53 +00001184# Check for CLOCK_MONOTONIC
1185
1186AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1187
bart417cf3e2011-10-22 09:21:24 +00001188AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart59e2f182008-04-28 16:22:53 +00001189#include <time.h>
bart417cf3e2011-10-22 09:21:24 +00001190]], [[
bart59e2f182008-04-28 16:22:53 +00001191 struct timespec t;
1192 clock_gettime(CLOCK_MONOTONIC, &t);
1193 return 0;
bart417cf3e2011-10-22 09:21:24 +00001194]])], [
bart59e2f182008-04-28 16:22:53 +00001195AC_MSG_RESULT([yes])
1196AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1197 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1198], [
1199AC_MSG_RESULT([no])
1200])
1201
bartfea06922008-05-03 09:12:15 +00001202
Elliott Hughesa0664b92017-04-18 17:46:52 -07001203# Check for ELF32/64_CHDR
1204
1205AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1206
1207
sewardj0c09bf02011-07-11 22:11:58 +00001208# Check for PTHREAD_RWLOCK_T
1209
1210AC_MSG_CHECKING([for pthread_rwlock_t])
1211
bart417cf3e2011-10-22 09:21:24 +00001212AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardj0c09bf02011-07-11 22:11:58 +00001213#define _GNU_SOURCE
1214#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001215]], [[
sewardj0c09bf02011-07-11 22:11:58 +00001216 pthread_rwlock_t rwl;
bart417cf3e2011-10-22 09:21:24 +00001217]])], [
sewardj0c09bf02011-07-11 22:11:58 +00001218AC_MSG_RESULT([yes])
1219AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1220 [Define to 1 if you have the `pthread_rwlock_t' type.])
1221], [
1222AC_MSG_RESULT([no])
1223])
1224
1225
bartfea06922008-05-03 09:12:15 +00001226# Check for PTHREAD_MUTEX_ADAPTIVE_NP
1227
1228AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1229
bart417cf3e2011-10-22 09:21:24 +00001230AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001231#define _GNU_SOURCE
1232#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001233]], [[
bartfea06922008-05-03 09:12:15 +00001234 return (PTHREAD_MUTEX_ADAPTIVE_NP);
bart417cf3e2011-10-22 09:21:24 +00001235]])], [
bartfea06922008-05-03 09:12:15 +00001236AC_MSG_RESULT([yes])
1237AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1238 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1239], [
1240AC_MSG_RESULT([no])
1241])
1242
1243
1244# Check for PTHREAD_MUTEX_ERRORCHECK_NP
1245
1246AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1247
bart417cf3e2011-10-22 09:21:24 +00001248AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001249#define _GNU_SOURCE
1250#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001251]], [[
bartfea06922008-05-03 09:12:15 +00001252 return (PTHREAD_MUTEX_ERRORCHECK_NP);
bart417cf3e2011-10-22 09:21:24 +00001253]])], [
bartfea06922008-05-03 09:12:15 +00001254AC_MSG_RESULT([yes])
1255AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1256 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1257], [
1258AC_MSG_RESULT([no])
1259])
1260
1261
1262# Check for PTHREAD_MUTEX_RECURSIVE_NP
1263
1264AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1265
bart417cf3e2011-10-22 09:21:24 +00001266AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001267#define _GNU_SOURCE
1268#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001269]], [[
bartfea06922008-05-03 09:12:15 +00001270 return (PTHREAD_MUTEX_RECURSIVE_NP);
bart417cf3e2011-10-22 09:21:24 +00001271]])], [
bartfea06922008-05-03 09:12:15 +00001272AC_MSG_RESULT([yes])
1273AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1274 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1275], [
1276AC_MSG_RESULT([no])
1277])
1278
1279
1280# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1281
1282AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1283
bart417cf3e2011-10-22 09:21:24 +00001284AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001285#define _GNU_SOURCE
1286#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001287]], [[
bartfea06922008-05-03 09:12:15 +00001288 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1289 return 0;
bart417cf3e2011-10-22 09:21:24 +00001290]])], [
bartfea06922008-05-03 09:12:15 +00001291AC_MSG_RESULT([yes])
1292AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1293 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1294], [
1295AC_MSG_RESULT([no])
1296])
1297
1298
bart5e389f12008-04-05 12:53:15 +00001299# Check whether pthread_mutex_t has a member called __m_kind.
1300
bartb11355c2010-04-29 16:37:26 +00001301AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1302 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1303 1,
1304 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1305 ],
1306 [],
1307 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001308
1309
1310# Check whether pthread_mutex_t has a member called __data.__kind.
1311
bartb11355c2010-04-29 16:37:26 +00001312AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1313 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1314 1,
1315 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1316 ],
1317 [],
1318 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001319
carll5bd4f6d2015-07-20 21:25:32 +00001320# Convenience function. Set flags based on the existing HWCAP entries.
1321# The AT_HWCAP entries are generated by glibc, and are based on
1322# functions supported by the hardware/system/libc.
1323# Subsequent support for whether the capability will actually be utilized
1324# will also be checked against the compiler capabilities.
1325# called as
1326# AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1327AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1328 AUXV_CHECK_FOR=$1
1329 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
bart9983eca2015-07-25 14:31:02 +00001330 if LD_SHOW_AUXV=1 `which true` | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
carll5bd4f6d2015-07-20 21:25:32 +00001331 then
1332 AC_MSG_RESULT([yes])
1333 AC_SUBST([$2],[yes])
1334 else
1335 AC_MSG_RESULT([no])
1336 AC_SUBST([$2],[])
1337 fi
1338])
1339
1340# gather hardware capabilities. (hardware/kernel/libc)
carll56f79892015-07-20 21:57:21 +00001341AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1342AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1343AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1344AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1345AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1346AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
Elliott Hughesa0664b92017-04-18 17:46:52 -07001347AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
carll5bd4f6d2015-07-20 21:25:32 +00001348AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
bart5e389f12008-04-05 12:53:15 +00001349
carll56f79892015-07-20 21:57:21 +00001350# ISA Levels
1351AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1352AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1353# compiler support for isa 2.07 level instructions
1354AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1355AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1356]], [[
1357 __asm__ __volatile__("mtvsrd 1,2 ");
1358]])], [
1359ac_asm_have_isa_2_07=yes
1360AC_MSG_RESULT([yes])
1361], [
1362ac_asm_have_isa_2_07=no
1363AC_MSG_RESULT([no])
1364])
1365AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1366 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1367
1368# altivec (vsx) support.
bart62c370e2008-05-12 18:50:51 +00001369# does this compiler support -maltivec and does it have the include file
1370# <altivec.h> ?
carll56f79892015-07-20 21:57:21 +00001371AC_MSG_CHECKING([for Altivec support in the compiler ])
bart62c370e2008-05-12 18:50:51 +00001372safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001373CFLAGS="-maltivec -Werror"
bart417cf3e2011-10-22 09:21:24 +00001374AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart62c370e2008-05-12 18:50:51 +00001375#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001376]], [[
bart62c370e2008-05-12 18:50:51 +00001377 vector unsigned int v;
bart417cf3e2011-10-22 09:21:24 +00001378]])], [
bart62c370e2008-05-12 18:50:51 +00001379ac_have_altivec=yes
1380AC_MSG_RESULT([yes])
1381], [
1382ac_have_altivec=no
1383AC_MSG_RESULT([no])
1384])
1385CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001386AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1387 -a x$HWCAP_HAS_ALTIVEC = xyes])
bart62c370e2008-05-12 18:50:51 +00001388
sewardjf34eb492011-04-15 11:57:05 +00001389# Check that both: the compiler supports -mvsx and that the assembler
1390# understands VSX instructions. If either of those doesn't work,
carll56f79892015-07-20 21:57:21 +00001391# conclude that we can't do VSX.
1392AC_MSG_CHECKING([for VSX compiler flag support])
sewardjf34eb492011-04-15 11:57:05 +00001393safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001394CFLAGS="-mvsx -Werror"
carll56f79892015-07-20 21:57:21 +00001395AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1396]], [[
1397]])], [
1398ac_compiler_supports_vsx_flag=yes
1399AC_MSG_RESULT([yes])
1400], [
1401ac_compiler_supports_vsx_flag=no
1402AC_MSG_RESULT([no])
1403])
1404CFLAGS=$safe_CFLAGS
sewardjf34eb492011-04-15 11:57:05 +00001405
carll56f79892015-07-20 21:57:21 +00001406AC_MSG_CHECKING([for VSX support in the assembler ])
1407safe_CFLAGS=$CFLAGS
1408CFLAGS="-mvsx -Werror"
bart417cf3e2011-10-22 09:21:24 +00001409AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardjf34eb492011-04-15 11:57:05 +00001410#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001411]], [[
sewardjf34eb492011-04-15 11:57:05 +00001412 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +00001413 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
bart417cf3e2011-10-22 09:21:24 +00001414]])], [
carll56f79892015-07-20 21:57:21 +00001415ac_compiler_supports_vsx=yes
sewardjf34eb492011-04-15 11:57:05 +00001416AC_MSG_RESULT([yes])
1417], [
carll56f79892015-07-20 21:57:21 +00001418ac_compiler_supports_vsx=no
sewardjf34eb492011-04-15 11:57:05 +00001419AC_MSG_RESULT([no])
1420])
1421CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001422AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1423 -a x$ac_compiler_supports_vsx = xyes \
1424 -a x$HWCAP_HAS_VSX = xyes ])
sewardjf34eb492011-04-15 11:57:05 +00001425
carll56f79892015-07-20 21:57:21 +00001426# DFP (Decimal Float)
sewardjb0ccb4d2012-04-02 10:22:05 +00001427AC_MSG_CHECKING([that assembler knows DFP])
sewardjb0ccb4d2012-04-02 10:22:05 +00001428AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1429]], [[
Elliott Hughesa0664b92017-04-18 17:46:52 -07001430 #ifdef __s390__
1431 __asm__ __volatile__("adtr 1, 2, 3")
1432 #else
sewardjb0ccb4d2012-04-02 10:22:05 +00001433 __asm__ __volatile__("dadd 1, 2, 3");
sewardj4e1c1912012-08-08 22:22:26 +00001434 __asm__ __volatile__("dcffix 1, 2");
Elliott Hughesa0664b92017-04-18 17:46:52 -07001435 #endif
sewardjb0ccb4d2012-04-02 10:22:05 +00001436]])], [
1437ac_asm_have_dfp=yes
1438AC_MSG_RESULT([yes])
1439], [
1440ac_asm_have_dfp=no
1441AC_MSG_RESULT([no])
1442])
sewardjb0ccb4d2012-04-02 10:22:05 +00001443AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1444safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001445CFLAGS="-mhard-dfp -Werror"
sewardjb0ccb4d2012-04-02 10:22:05 +00001446AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1447]], [[
Elliott Hughesa0664b92017-04-18 17:46:52 -07001448 #ifdef __s390__
1449 __asm__ __volatile__("adtr 1, 2, 3")
1450 #else
sewardjb0ccb4d2012-04-02 10:22:05 +00001451 __asm__ __volatile__("dadd 1, 2, 3");
sewardj4e1c1912012-08-08 22:22:26 +00001452 __asm__ __volatile__("dcffix 1, 2");
Elliott Hughesa0664b92017-04-18 17:46:52 -07001453 #endif
sewardjb0ccb4d2012-04-02 10:22:05 +00001454]])], [
carll56f79892015-07-20 21:57:21 +00001455ac_compiler_have_dfp=yes
sewardjb0ccb4d2012-04-02 10:22:05 +00001456AC_MSG_RESULT([yes])
1457], [
carll56f79892015-07-20 21:57:21 +00001458ac_compiler_have_dfp=no
sewardjb0ccb4d2012-04-02 10:22:05 +00001459AC_MSG_RESULT([no])
1460])
sewardjb0ccb4d2012-04-02 10:22:05 +00001461CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001462AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1463 -a x$ac_compiler_have_dfp = xyes \
1464 -a x$HWCAP_HAS_DFP = xyes )
sewardj4e1c1912012-08-08 22:22:26 +00001465
florian46825982012-11-10 22:35:24 +00001466AC_MSG_CHECKING([that compiler knows DFP datatypes])
1467AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1468]], [[
1469 _Decimal64 x = 0.0DD;
1470]])], [
carll56f79892015-07-20 21:57:21 +00001471ac_compiler_have_dfp_type=yes
florian46825982012-11-10 22:35:24 +00001472AC_MSG_RESULT([yes])
1473], [
carll56f79892015-07-20 21:57:21 +00001474ac_compiler_have_dfp_type=no
florian46825982012-11-10 22:35:24 +00001475AC_MSG_RESULT([no])
1476])
carll56f79892015-07-20 21:57:21 +00001477AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
Elliott Hughesa0664b92017-04-18 17:46:52 -07001478 -a x$HWCAP_HAS_DFP = xyes )
florian46825982012-11-10 22:35:24 +00001479
florian46825982012-11-10 22:35:24 +00001480
carll5bd4f6d2015-07-20 21:25:32 +00001481# HTM (Hardware Transactional Memory)
1482AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1483safe_CFLAGS=$CFLAGS
1484CFLAGS="-mhtm -Werror"
1485AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1486]], [[
1487 return 0;
1488]])], [
1489AC_MSG_RESULT([yes])
1490ac_compiler_supports_htm=yes
1491], [
1492AC_MSG_RESULT([no])
1493ac_compiler_supports_htm=no
1494])
1495CFLAGS=$safe_CFLAGS
1496
1497AC_MSG_CHECKING([if compiler can find the htm builtins])
1498safe_CFLAGS=$CFLAGS
1499CFLAGS="-mhtm -Werror"
1500 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1501 ]], [[
1502 if (__builtin_tbegin (0))
1503 __builtin_tend (0);
1504 ]])], [
1505 AC_MSG_RESULT([yes])
1506ac_compiler_sees_htm_builtins=yes
1507 ], [
1508 AC_MSG_RESULT([no])
1509ac_compiler_sees_htm_builtins=no
1510 ])
1511CFLAGS=$safe_CFLAGS
1512
1513AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1514 -a x$ac_compiler_sees_htm_builtins = xyes \
1515 -a x$HWCAP_HAS_HTM = xyes )
1516
Elliott Hughesa0664b92017-04-18 17:46:52 -07001517# isa 3.0 checking
1518AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1519
1520AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1521]], [[
1522 __asm__ __volatile__("cnttzw 1,2 ");
1523]])], [
1524ac_asm_have_isa_3_00=yes
1525AC_MSG_RESULT([yes])
1526], [
1527ac_asm_have_isa_3_00=no
1528AC_MSG_RESULT([no])
1529])
1530
Elliott Hughesed398002017-06-21 14:41:24 -07001531AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
Elliott Hughesa0664b92017-04-18 17:46:52 -07001532 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1533
bart36dd85a2009-04-26 07:11:48 +00001534# Check for pthread_create@GLIBC2.0
1535AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1536
bart16e1c5a2009-04-26 07:38:53 +00001537safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001538CFLAGS="-lpthread -Werror"
bart417cf3e2011-10-22 09:21:24 +00001539AC_LINK_IFELSE([AC_LANG_PROGRAM([[
bart36dd85a2009-04-26 07:11:48 +00001540extern int pthread_create_glibc_2_0(void*, const void*,
1541 void *(*)(void*), void*);
1542__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
bart417cf3e2011-10-22 09:21:24 +00001543]], [[
bart276ed3a2009-05-10 15:41:45 +00001544#ifdef __powerpc__
1545/*
1546 * Apparently on PowerPC linking this program succeeds and generates an
1547 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1548 */
1549#error This test does not work properly on PowerPC.
1550#else
bart16e1c5a2009-04-26 07:38:53 +00001551 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001552#endif
bart16e1c5a2009-04-26 07:38:53 +00001553 return 0;
bart417cf3e2011-10-22 09:21:24 +00001554]])], [
bart36dd85a2009-04-26 07:11:48 +00001555ac_have_pthread_create_glibc_2_0=yes
1556AC_MSG_RESULT([yes])
1557AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1558 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1559], [
1560ac_have_pthread_create_glibc_2_0=no
1561AC_MSG_RESULT([no])
1562])
bart16e1c5a2009-04-26 07:38:53 +00001563CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001564
1565AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001566 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001567
1568
philippe1670b052014-08-15 10:27:52 +00001569# Check for dlinfo RTLD_DI_TLS_MODID
1570AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1571
1572safe_LIBS="$LIBS"
1573LIBS="-ldl"
1574AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1575#ifndef _GNU_SOURCE
1576#define _GNU_SOURCE
1577#endif
1578#include <link.h>
1579#include <dlfcn.h>
1580]], [[
1581 size_t sizes[10000];
1582 size_t modid_offset;
1583 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1584 return 0;
1585]])], [
1586ac_have_dlinfo_rtld_di_tls_modid=yes
1587AC_MSG_RESULT([yes])
1588AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1589 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1590], [
1591ac_have_dlinfo_rtld_di_tls_modid=no
1592AC_MSG_RESULT([no])
1593])
1594LIBS=$safe_LIBS
1595
1596AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1597 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1598
1599
barta50aa8a2008-04-27 06:06:57 +00001600# Check for eventfd_t, eventfd() and eventfd_read()
1601AC_MSG_CHECKING([for eventfd()])
1602
bart417cf3e2011-10-22 09:21:24 +00001603AC_LINK_IFELSE([AC_LANG_PROGRAM([[
barta50aa8a2008-04-27 06:06:57 +00001604#include <sys/eventfd.h>
bart417cf3e2011-10-22 09:21:24 +00001605]], [[
barta50aa8a2008-04-27 06:06:57 +00001606 eventfd_t ev;
1607 int fd;
1608
1609 fd = eventfd(5, 0);
1610 eventfd_read(fd, &ev);
1611 return 0;
bart417cf3e2011-10-22 09:21:24 +00001612]])], [
barta50aa8a2008-04-27 06:06:57 +00001613AC_MSG_RESULT([yes])
1614AC_DEFINE([HAVE_EVENTFD], 1,
1615 [Define to 1 if you have the `eventfd' function.])
1616AC_DEFINE([HAVE_EVENTFD_READ], 1,
1617 [Define to 1 if you have the `eventfd_read' function.])
1618], [
1619AC_MSG_RESULT([no])
1620])
1621
florian24fefb62013-10-08 13:04:00 +00001622# Check whether compiler can process #include <thread> without errors
1623# clang 3.3 cannot process <thread> from e.g.
1624# gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1625
1626AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1627AC_LANG(C++)
1628safe_CXXFLAGS=$CXXFLAGS
1629CXXFLAGS=-std=c++0x
1630
1631AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1632#include <thread>
1633])],
1634[
1635ac_cxx_can_include_thread_header=yes
1636AC_MSG_RESULT([yes])
1637], [
1638ac_cxx_can_include_thread_header=no
1639AC_MSG_RESULT([no])
1640])
1641CXXFLAGS=$safe_CXXFLAGS
1642AC_LANG(C)
1643
1644AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1645
mjw2a429f52014-07-18 20:45:37 +00001646
1647# On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1648# of the user_regs_struct from sys/user.h. They are structurally the same
1649# but we get either one or the other.
1650
1651AC_CHECK_TYPE([struct user_regs_struct],
1652 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1653 [[#include <sys/ptrace.h>]
1654 [#include <sys/time.h>]
1655 [#include <sys/user.h>]])
1656if test "$sys_user_has_user_regs" = "yes"; then
1657 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1658 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1659fi
1660
1661
njn7fd6d382009-01-22 21:56:32 +00001662#----------------------------------------------------------------------------
1663# Checking for supported compiler flags.
1664#----------------------------------------------------------------------------
1665
sewardj535c50f2005-06-04 23:14:53 +00001666# does this compiler support -m32 ?
1667AC_MSG_CHECKING([if gcc accepts -m32])
1668
1669safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001670CFLAGS="-m32 -Werror"
sewardj535c50f2005-06-04 23:14:53 +00001671
bart417cf3e2011-10-22 09:21:24 +00001672AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001673 return 0;
bart417cf3e2011-10-22 09:21:24 +00001674]])], [
sewardj535c50f2005-06-04 23:14:53 +00001675FLAG_M32="-m32"
1676AC_MSG_RESULT([yes])
1677], [
1678FLAG_M32=""
1679AC_MSG_RESULT([no])
1680])
1681CFLAGS=$safe_CFLAGS
1682
1683AC_SUBST(FLAG_M32)
1684
1685
sewardj01262142006-01-04 01:20:28 +00001686# does this compiler support -m64 ?
1687AC_MSG_CHECKING([if gcc accepts -m64])
1688
1689safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001690CFLAGS="-m64 -Werror"
sewardj01262142006-01-04 01:20:28 +00001691
bart417cf3e2011-10-22 09:21:24 +00001692AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001693 return 0;
bart417cf3e2011-10-22 09:21:24 +00001694]])], [
sewardj01262142006-01-04 01:20:28 +00001695FLAG_M64="-m64"
1696AC_MSG_RESULT([yes])
1697], [
1698FLAG_M64=""
1699AC_MSG_RESULT([no])
1700])
1701CFLAGS=$safe_CFLAGS
1702
1703AC_SUBST(FLAG_M64)
1704
1705
dejanjf674e382014-02-18 16:40:25 +00001706# does this compiler support -march=mips32 (mips32 default) ?
1707AC_MSG_CHECKING([if gcc accepts -march=mips32])
1708
1709safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001710CFLAGS="$CFLAGS -march=mips32 -Werror"
dejanjf674e382014-02-18 16:40:25 +00001711
1712AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1713 return 0;
1714]])], [
1715FLAG_MIPS32="-march=mips32"
1716AC_MSG_RESULT([yes])
1717], [
1718FLAG_MIPS32=""
1719AC_MSG_RESULT([no])
1720])
1721CFLAGS=$safe_CFLAGS
1722
1723AC_SUBST(FLAG_MIPS32)
1724
1725
1726# does this compiler support -march=mips64 (mips64 default) ?
1727AC_MSG_CHECKING([if gcc accepts -march=mips64])
1728
1729safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001730CFLAGS="$CFLAGS -march=mips64 -Werror"
dejanjf674e382014-02-18 16:40:25 +00001731
1732AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1733 return 0;
1734]])], [
1735FLAG_MIPS64="-march=mips64"
1736AC_MSG_RESULT([yes])
1737], [
1738FLAG_MIPS64=""
1739AC_MSG_RESULT([no])
1740])
1741CFLAGS=$safe_CFLAGS
1742
1743AC_SUBST(FLAG_MIPS64)
1744
1745
petarj1546c7a2014-01-29 18:08:50 +00001746# does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1747AC_MSG_CHECKING([if gcc accepts -march=octeon])
1748
1749safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001750CFLAGS="$CFLAGS -march=octeon -Werror"
petarj1546c7a2014-01-29 18:08:50 +00001751
1752AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1753 return 0;
1754]])], [
1755FLAG_OCTEON="-march=octeon"
1756AC_MSG_RESULT([yes])
1757], [
1758FLAG_OCTEON=""
1759AC_MSG_RESULT([no])
1760])
1761CFLAGS=$safe_CFLAGS
1762
1763AC_SUBST(FLAG_OCTEON)
1764
dejanjf674e382014-02-18 16:40:25 +00001765
petarj1546c7a2014-01-29 18:08:50 +00001766# does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1767AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1768
1769safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001770CFLAGS="$CFLAGS -march=octeon2 -Werror"
petarj1546c7a2014-01-29 18:08:50 +00001771
1772AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1773 return 0;
1774]])], [
1775FLAG_OCTEON2="-march=octeon2"
1776AC_MSG_RESULT([yes])
1777], [
1778FLAG_OCTEON2=""
1779AC_MSG_RESULT([no])
1780])
1781CFLAGS=$safe_CFLAGS
1782
1783AC_SUBST(FLAG_OCTEON2)
1784
1785
sewardj67f1fcc2005-07-03 10:41:02 +00001786# does this compiler support -mmmx ?
1787AC_MSG_CHECKING([if gcc accepts -mmmx])
1788
1789safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001790CFLAGS="-mmmx -Werror"
sewardj67f1fcc2005-07-03 10:41:02 +00001791
bart417cf3e2011-10-22 09:21:24 +00001792AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001793 return 0;
bart417cf3e2011-10-22 09:21:24 +00001794]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001795FLAG_MMMX="-mmmx"
1796AC_MSG_RESULT([yes])
1797], [
1798FLAG_MMMX=""
1799AC_MSG_RESULT([no])
1800])
1801CFLAGS=$safe_CFLAGS
1802
1803AC_SUBST(FLAG_MMMX)
1804
1805
1806# does this compiler support -msse ?
1807AC_MSG_CHECKING([if gcc accepts -msse])
1808
1809safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001810CFLAGS="-msse -Werror"
sewardj67f1fcc2005-07-03 10:41:02 +00001811
bart417cf3e2011-10-22 09:21:24 +00001812AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001813 return 0;
bart417cf3e2011-10-22 09:21:24 +00001814]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001815FLAG_MSSE="-msse"
1816AC_MSG_RESULT([yes])
1817], [
1818FLAG_MSSE=""
1819AC_MSG_RESULT([no])
1820])
1821CFLAGS=$safe_CFLAGS
1822
1823AC_SUBST(FLAG_MSSE)
1824
1825
sewardj98977e02014-09-05 20:00:22 +00001826# does this compiler support -mpreferred-stack-boundary=2 when
1827# generating code for a 32-bit target? Note that we only care about
1828# this when generating code for (32-bit) x86, so if the compiler
1829# doesn't recognise -m32 it's no big deal. We'll just get code for
1830# the Memcheck and other helper functions, that is a bit slower than
1831# it could be, on x86; and no difference at all on any other platform.
1832AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
sewardj5b754b42002-06-03 22:53:35 +00001833
daywalker3664f562003-10-17 13:43:46 +00001834safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001835CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
sewardj5b754b42002-06-03 22:53:35 +00001836
bart417cf3e2011-10-22 09:21:24 +00001837AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001838 return 0;
bart417cf3e2011-10-22 09:21:24 +00001839]])], [
sewardj98977e02014-09-05 20:00:22 +00001840PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001841AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001842], [
sewardj98977e02014-09-05 20:00:22 +00001843PREFERRED_STACK_BOUNDARY_2=""
sewardj5b754b42002-06-03 22:53:35 +00001844AC_MSG_RESULT([no])
1845])
daywalker3664f562003-10-17 13:43:46 +00001846CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001847
sewardj98977e02014-09-05 20:00:22 +00001848AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
sewardj5b754b42002-06-03 22:53:35 +00001849
sewardj535c50f2005-06-04 23:14:53 +00001850
florian743515c2015-09-04 20:52:20 +00001851# does this compiler support -mlong-double-128 ?
1852AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
1853safe_CFLAGS=$CFLAGS
1854CFLAGS="-mlong-double-128 -Werror"
1855AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1856 return 0;
1857]])], [
1858ac_compiler_supports_mlong_double_128=yes
1859AC_MSG_RESULT([yes])
1860], [
1861ac_compiler_supports_mlong_double_128=no
1862AC_MSG_RESULT([no])
1863])
1864CFLAGS=$safe_CFLAGS
1865AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
1866FLAG_MLONG_DOUBLE_128="-mlong-double-128"
1867AC_SUBST(FLAG_MLONG_DOUBLE_128)
1868
1869
mjwab69b4a2014-08-20 16:11:53 +00001870# Convenience function to check whether GCC supports a particular
florian3d53d082015-06-05 17:09:57 +00001871# warning option. Takes two arguments,
mjwab69b4a2014-08-20 16:11:53 +00001872# first the warning flag name to check (without -W), then the
1873# substitution name to set with -Wno-warning-flag if the flag exists,
1874# or the empty string if the compiler doesn't accept the flag. Note
1875# that checking is done against the warning flag itself, but the
1876# substitution is then done to cancel the warning flag.
1877AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
sewardja3a27fe2014-09-01 21:16:02 +00001878 AC_MSG_CHECKING([if gcc accepts -W$1])
1879 safe_CFLAGS=$CFLAGS
florian02ffb772015-06-05 21:19:06 +00001880 CFLAGS="-W$1 -Werror"
sewardja3a27fe2014-09-01 21:16:02 +00001881 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1882 AC_SUBST([$2], [-Wno-$1])
1883 AC_MSG_RESULT([yes])], [
1884 AC_SUBST([$2], [])
1885 AC_MSG_RESULT([no])])
1886 CFLAGS=$safe_CFLAGS
barte026bd22009-07-04 12:17:07 +00001887])
barte026bd22009-07-04 12:17:07 +00001888
florian26a790a2014-12-03 22:53:00 +00001889# Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
1890# -W$1 (instead of -Wno-$1).
1891AC_DEFUN([AC_GCC_WARNING_SUBST],[
1892 AC_MSG_CHECKING([if gcc accepts -W$1])
1893 safe_CFLAGS=$CFLAGS
florian02ffb772015-06-05 21:19:06 +00001894 CFLAGS="-W$1 -Werror"
florian26a790a2014-12-03 22:53:00 +00001895 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1896 AC_SUBST([$2], [-W$1])
1897 AC_MSG_RESULT([yes])], [
1898 AC_SUBST([$2], [])
1899 AC_MSG_RESULT([no])])
1900 CFLAGS=$safe_CFLAGS
1901])
1902
florian4f9b7c72015-08-02 19:45:58 +00001903AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
mjwab69b4a2014-08-20 16:11:53 +00001904AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1905AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
florian3d53d082015-06-05 17:09:57 +00001906AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
mjwab69b4a2014-08-20 16:11:53 +00001907AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
florian807c4542014-09-05 18:30:05 +00001908AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1909AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
florian7161e332015-09-02 15:47:33 +00001910AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
1911AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
florian26a790a2014-12-03 22:53:00 +00001912AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
florian54681bf2015-06-05 16:26:14 +00001913AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
florian26a790a2014-12-03 22:53:00 +00001914AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
florianb26101c2015-08-08 21:45:33 +00001915# Disabled for now until all platforms are clean
florian42c2a5b2015-08-09 08:16:54 +00001916format_checking_enabled=no
1917#format_checking_enabled=yes
1918if test "$format_checking_enabled" = "yes"; then
1919 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
1920else
1921 dumy_assignment_to_avoid_syntax_errors=1
1922 AC_SUBST([FLAG_W_FORMAT_SIGNEDNESS], [])
1923fi
florian26a790a2014-12-03 22:53:00 +00001924AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
florian90694062015-05-16 16:17:52 +00001925AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
1926AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
1927AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
sewardja3a27fe2014-09-01 21:16:02 +00001928
floriane1988aa2015-06-09 21:44:58 +00001929# Does this compiler support -Wformat-security ?
1930# Special handling is needed, because certain GCC versions require -Wformat
1931# being present if -Wformat-security is given. Otherwise a warning is issued.
1932# However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
1933# And with that the warning will be turned into an error with the result
1934# that -Wformat-security is believed to be unsupported when in fact it is.
1935AC_MSG_CHECKING([if gcc accepts -Wformat-security])
1936safe_CFLAGS=$CFLAGS
1937CFLAGS="-Wformat -Wformat-security -Werror"
1938AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1939AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
1940AC_MSG_RESULT([yes])], [
1941AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
1942AC_MSG_RESULT([no])])
1943CFLAGS=$safe_CFLAGS
1944
bart56730cd2008-05-11 06:41:46 +00001945# does this compiler support -Wextra or the older -W ?
1946
1947AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1948
1949safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001950CFLAGS="-Wextra -Werror"
bart56730cd2008-05-11 06:41:46 +00001951
bart417cf3e2011-10-22 09:21:24 +00001952AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001953 return 0;
bart417cf3e2011-10-22 09:21:24 +00001954]])], [
bart56730cd2008-05-11 06:41:46 +00001955AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1956AC_MSG_RESULT([-Wextra])
1957], [
florian538cf302015-06-09 21:53:48 +00001958 CFLAGS="-W -Werror"
sewardj9bdf2a62011-10-27 06:22:23 +00001959 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001960 return 0;
sewardj9bdf2a62011-10-27 06:22:23 +00001961 ]])], [
bart56730cd2008-05-11 06:41:46 +00001962 AC_SUBST([FLAG_W_EXTRA], [-W])
1963 AC_MSG_RESULT([-W])
1964 ], [
1965 AC_SUBST([FLAG_W_EXTRA], [])
1966 AC_MSG_RESULT([not supported])
1967 ])
1968])
1969CFLAGS=$safe_CFLAGS
1970
florian1537bb42015-09-14 21:11:32 +00001971# On ARM we do not want to pass -Wcast-align as that produces loads
1972# of warnings. GCC is just being conservative. See here:
1973# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
1974if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
1975 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
1976else
1977 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
1978fi
1979
sewardja72c26d2007-05-01 13:44:08 +00001980# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001981AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001982
1983safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001984CFLAGS="-fno-stack-protector -Werror"
sewardja72c26d2007-05-01 13:44:08 +00001985
bart417cf3e2011-10-22 09:21:24 +00001986AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001987 return 0;
bart417cf3e2011-10-22 09:21:24 +00001988]])], [
sewardja72c26d2007-05-01 13:44:08 +00001989no_stack_protector=yes
1990FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1991AC_MSG_RESULT([yes])
1992], [
1993no_stack_protector=no
1994FLAG_FNO_STACK_PROTECTOR=""
1995AC_MSG_RESULT([no])
1996])
1997CFLAGS=$safe_CFLAGS
1998
1999AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2000
mjw37915072015-06-02 20:23:06 +00002001# Does GCC support disabling Identical Code Folding?
2002# We want to disabled Identical Code Folding for the
2003# tools preload shared objects to get better backraces.
2004# For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2005# "The optimization reduces code size and may disturb
2006# unwind stacks by replacing a function by equivalent
2007# one with a different name."
2008AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2009
2010safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002011CFLAGS="-fno-ipa-icf -Werror"
mjw37915072015-06-02 20:23:06 +00002012
2013AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2014 return 0;
2015]])], [
2016no_ipa_icf=yes
2017FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2018AC_MSG_RESULT([yes])
2019], [
2020no_ipa_icf=no
2021FLAG_FNO_IPA_ICF=""
2022AC_MSG_RESULT([no])
2023])
2024CFLAGS=$safe_CFLAGS
2025
2026AC_SUBST(FLAG_FNO_IPA_ICF)
2027
florianbb1a7872015-03-10 16:13:59 +00002028
florian3878e162015-06-23 20:31:52 +00002029# Does this compiler support -fsanitize=undefined. This is true for
2030# GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2031# also checks for alignment violations on memory accesses which the valgrind
2032# code base is sprinkled (if not littered) with. As those alignment issues
2033# don't pose a problem we want to suppress warnings about them.
2034# In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2035# GCCs do not support that.
2036#
florianbb1a7872015-03-10 16:13:59 +00002037# Only checked for if --enable-ubsan was given.
2038if test "x${vg_cv_ubsan}" = "xyes"; then
florian3878e162015-06-23 20:31:52 +00002039AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
florianbb1a7872015-03-10 16:13:59 +00002040safe_CFLAGS=$CFLAGS
florian3878e162015-06-23 20:31:52 +00002041CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2042AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2043 return 0;
2044]])], [
2045FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2046LIB_UBSAN="-static-libubsan"
2047AC_MSG_RESULT([yes])
2048], [
florian538cf302015-06-09 21:53:48 +00002049CFLAGS="-fsanitize=undefined -Werror"
florianbb1a7872015-03-10 16:13:59 +00002050AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2051 return 0;
2052]])], [
2053FLAG_FSANITIZE="-fsanitize=undefined"
2054LIB_UBSAN="-static-libubsan"
2055AC_MSG_RESULT([yes])
2056], [
2057FLAG_FSANITIZE=""
2058LIB_UBSAN=""
2059AC_MSG_RESULT([no])
2060])
florian3878e162015-06-23 20:31:52 +00002061])
florianbb1a7872015-03-10 16:13:59 +00002062CFLAGS=$safe_CFLAGS
2063AC_SUBST(FLAG_FSANITIZE)
2064AC_SUBST(LIB_UBSAN)
2065fi
bart56730cd2008-05-11 06:41:46 +00002066# does this compiler support --param inline-unit-growth=... ?
2067
2068AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2069
2070safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002071CFLAGS="--param inline-unit-growth=900 -Werror"
bart56730cd2008-05-11 06:41:46 +00002072
bart417cf3e2011-10-22 09:21:24 +00002073AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00002074 return 0;
bart417cf3e2011-10-22 09:21:24 +00002075]])], [
bart56730cd2008-05-11 06:41:46 +00002076AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2077 ["--param inline-unit-growth=900"])
2078AC_MSG_RESULT([yes])
2079], [
2080AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2081AC_MSG_RESULT([no])
2082])
2083CFLAGS=$safe_CFLAGS
2084
2085
sewardjd9350682012-04-05 07:55:47 +00002086# does this compiler support -gdwarf-4 -fdebug-types-section ?
2087
2088AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2089
2090safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002091CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
sewardjd9350682012-04-05 07:55:47 +00002092
2093AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2094 return 0;
2095]])], [
2096ac_have_dwarf4=yes
2097AC_MSG_RESULT([yes])
2098], [
2099ac_have_dwarf4=no
2100AC_MSG_RESULT([no])
2101])
2102AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2103CFLAGS=$safe_CFLAGS
2104
2105
Elliott Hughesa0664b92017-04-18 17:46:52 -07002106# does this compiler support -g -gz=zlib ?
2107
2108AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2109
2110safe_CFLAGS=$CFLAGS
2111CFLAGS="-g -gz=zlib"
2112
2113AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2114 return 0;
2115]])], [
2116ac_have_gz_zlib=yes
2117AC_MSG_RESULT([yes])
2118], [
2119ac_have_gz_zlib=no
2120AC_MSG_RESULT([no])
2121])
2122AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2123CFLAGS=$safe_CFLAGS
2124
2125
2126# does this compiler support -g -gz=zlib-gnu ?
2127
2128AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2129
2130safe_CFLAGS=$CFLAGS
2131CFLAGS="-g -gz=zlib-gnu"
2132
2133AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2134 return 0;
2135]])], [
2136ac_have_gz_zlib_gnu=yes
2137AC_MSG_RESULT([yes])
2138], [
2139ac_have_gz_zlib_gnu=no
2140AC_MSG_RESULT([no])
2141])
2142AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2143CFLAGS=$safe_CFLAGS
2144
2145
florian3df02112013-10-04 11:35:50 +00002146# does this compiler support nested functions ?
2147
2148AC_MSG_CHECKING([if gcc accepts nested functions])
2149
2150AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2151 int foo() { return 1; }
2152 return foo();
2153]])], [
2154ac_have_nested_functions=yes
2155AC_MSG_RESULT([yes])
2156], [
2157ac_have_nested_functions=no
2158AC_MSG_RESULT([no])
2159])
2160AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2161
2162
2163# does this compiler support the 'p' constraint in ASM statements ?
2164
2165AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2166
2167AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2168 char *p;
2169 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2170]])], [
2171ac_have_asm_constraint_p=yes
2172AC_MSG_RESULT([yes])
2173], [
2174ac_have_asm_constraint_p=no
2175AC_MSG_RESULT([no])
2176])
2177AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2178
2179
Elliott Hughesed398002017-06-21 14:41:24 -07002180# Does this compiler support -no-pie?
2181# On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
2182# default. However this gets in the way with some tests, we use -no-pie
2183# for these.
2184
2185AC_MSG_CHECKING([if gcc accepts -no-pie])
2186
2187safe_CFLAGS=$CFLAGS
2188CFLAGS="-no-pie"
2189
2190AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2191 return 0;
2192]])], [
2193AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
2194AC_MSG_RESULT([yes])
2195], [
2196AC_SUBST([FLAG_NO_PIE], [""])
2197AC_MSG_RESULT([no])
2198])
2199CFLAGS=$safe_CFLAGS
2200
2201
sewardje4bc7032013-03-22 11:49:46 +00002202# We want to use use the -Ttext-segment option to the linker.
2203# GNU (bfd) ld supports this directly. Newer GNU gold linkers
2204# support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2205# semantics are NOT what we want (GNU gold -Ttext is fine).
2206#
2207# For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2208# will reside. -Ttext aligns just the .text section start (but not any
2209# other section).
2210#
2211# So test for -Ttext-segment which is supported by all bfd ld versions
2212# and use that if it exists. If it doesn't exist it must be an older
2213# version of gold and we can fall back to using -Ttext which has the
2214# right semantics.
bart699fbac2010-06-08 18:23:59 +00002215
sewardje4bc7032013-03-22 11:49:46 +00002216AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
bart699fbac2010-06-08 18:23:59 +00002217
2218safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002219CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
bart699fbac2010-06-08 18:23:59 +00002220
bart8508c752010-06-10 06:26:21 +00002221AC_LINK_IFELSE(
mjw941277a2013-04-17 19:11:05 +00002222[AC_LANG_SOURCE([int _start () { return 0; }])],
bart699fbac2010-06-08 18:23:59 +00002223[
tom04ce9f52013-03-28 15:53:21 +00002224 linker_using_t_text="no"
sewardje4bc7032013-03-22 11:49:46 +00002225 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
bart699fbac2010-06-08 18:23:59 +00002226 AC_MSG_RESULT([yes])
2227], [
tom04ce9f52013-03-28 15:53:21 +00002228 linker_using_t_text="yes"
sewardje4bc7032013-03-22 11:49:46 +00002229 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
bart699fbac2010-06-08 18:23:59 +00002230 AC_MSG_RESULT([no])
2231])
2232CFLAGS=$safe_CFLAGS
2233
tom04ce9f52013-03-28 15:53:21 +00002234# If the linker only supports -Ttext (not -Ttext-segment) then we will
Elliott Hughesed398002017-06-21 14:41:24 -07002235# have to strip any build-id ELF NOTEs from the statically linked tools.
tom04ce9f52013-03-28 15:53:21 +00002236# Otherwise the build-id NOTE might end up at the default load address.
2237# (Pedantically if the linker is gold then -Ttext is fine, but newer
2238# gold versions also support -Ttext-segment. So just assume that unless
2239# we can use -Ttext-segment we need to strip the build-id NOTEs.
florian51b14ee2014-02-22 18:38:32 +00002240if test "x${linker_using_t_text}" = "xyes"; then
tom04ce9f52013-03-28 15:53:21 +00002241AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
2242# does the linker support -Wl,--build-id=none ? Note, it's
2243# important that we test indirectly via whichever C compiler
2244# is selected, rather than testing /usr/bin/ld or whatever
2245# directly.
2246AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
2247safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002248CFLAGS="-Wl,--build-id=none -Werror"
tom04ce9f52013-03-28 15:53:21 +00002249
2250AC_LINK_IFELSE(
2251[AC_LANG_PROGRAM([ ], [return 0;])],
2252[
2253 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
2254 AC_MSG_RESULT([yes])
2255], [
2256 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2257 AC_MSG_RESULT([no])
2258])
2259else
2260AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
2261AC_SUBST([FLAG_NO_BUILD_ID], [""])
2262fi
2263CFLAGS=$safe_CFLAGS
bart699fbac2010-06-08 18:23:59 +00002264
sewardj00f1e622006-03-12 16:47:10 +00002265# does the ppc assembler support "mtocrf" et al?
2266AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
2267
bart417cf3e2011-10-22 09:21:24 +00002268AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjdd4cbe12006-03-12 17:27:44 +00002269__asm__ __volatile__("mtocrf 4,0");
2270__asm__ __volatile__("mfocrf 0,4");
bart417cf3e2011-10-22 09:21:24 +00002271]])], [
sewardj00f1e622006-03-12 16:47:10 +00002272ac_have_as_ppc_mftocrf=yes
2273AC_MSG_RESULT([yes])
2274], [
2275ac_have_as_ppc_mftocrf=no
2276AC_MSG_RESULT([no])
2277])
2278if test x$ac_have_as_ppc_mftocrf = xyes ; then
2279 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2280fi
2281
2282
carll1e5fa2f2013-08-09 21:55:45 +00002283# does the ppc assembler support "lfdp" and other phased out floating point insns?
2284AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2285
2286AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2287 do { typedef struct {
2288 double hi;
2289 double lo;
2290 } dbl_pair_t;
2291 dbl_pair_t dbl_pair[3];
2292 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2293 } while (0)
2294]])], [
2295ac_have_as_ppc_fpPO=yes
2296AC_MSG_RESULT([yes])
2297], [
2298ac_have_as_ppc_fpPO=no
2299AC_MSG_RESULT([no])
2300])
2301if test x$ac_have_as_ppc_fpPO = xyes ; then
2302 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2303fi
2304
sewardjb5b87402011-03-07 16:05:35 +00002305
mjw70bbba02015-09-04 21:52:52 +00002306# does the amd64 assembler understand "fxsave64" and "fxrstor64"?
2307AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
2308
2309AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2310void* p;
2311asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
2312asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
2313]])], [
2314ac_have_as_amd64_fxsave64=yes
2315AC_MSG_RESULT([yes])
2316], [
2317ac_have_as_amd64_fxsave64=no
2318AC_MSG_RESULT([no])
2319])
2320if test x$ac_have_as_amd64_fxsave64 = xyes ; then
2321 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
2322fi
2323
sewardjf0aabf82007-03-22 00:24:21 +00002324# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00002325# Note, this doesn't generate a C-level symbol. It generates a
2326# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00002327AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2328
bart417cf3e2011-10-22 09:21:24 +00002329AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjf0aabf82007-03-22 00:24:21 +00002330 do { long long int x;
2331 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2332 while (0)
bart417cf3e2011-10-22 09:21:24 +00002333]])], [
sewardjf0aabf82007-03-22 00:24:21 +00002334ac_have_as_sse3=yes
2335AC_MSG_RESULT([yes])
2336], [
2337ac_have_as_sse3=no
2338AC_MSG_RESULT([no])
2339])
sewardjfa18a262007-03-22 12:13:13 +00002340
2341AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00002342
2343
sewardj6d6da5b2008-02-09 12:07:40 +00002344# Ditto for SSSE3 instructions (note extra S)
2345# Note, this doesn't generate a C-level symbol. It generates a
2346# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2347AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2348
florianc443b962011-10-28 21:37:19 +00002349save_CFLAGS="$CFLAGS"
florian538cf302015-06-09 21:53:48 +00002350CFLAGS="$CFLAGS -msse -Werror"
bart417cf3e2011-10-22 09:21:24 +00002351AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj6d6da5b2008-02-09 12:07:40 +00002352 do { long long int x;
2353 __asm__ __volatile__(
2354 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2355 while (0)
bart417cf3e2011-10-22 09:21:24 +00002356]])], [
sewardj6d6da5b2008-02-09 12:07:40 +00002357ac_have_as_ssse3=yes
2358AC_MSG_RESULT([yes])
2359], [
2360ac_have_as_ssse3=no
2361AC_MSG_RESULT([no])
2362])
florianc443b962011-10-28 21:37:19 +00002363CFLAGS="$save_CFLAGS"
sewardj6d6da5b2008-02-09 12:07:40 +00002364
2365AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2366
2367
sewardj27d176a2011-01-17 11:15:48 +00002368# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2369# Note, this doesn't generate a C-level symbol. It generates a
2370# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00002371AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
bart417cf3e2011-10-22 09:21:24 +00002372AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardje3ae8a32010-09-28 19:59:47 +00002373 do {
2374 __asm__ __volatile__(
2375 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2376 while (0)
bart417cf3e2011-10-22 09:21:24 +00002377]])], [
sewardje3ae8a32010-09-28 19:59:47 +00002378ac_have_as_pclmulqdq=yes
2379AC_MSG_RESULT([yes])
2380], [
2381ac_have_as_pclmulqdq=no
2382AC_MSG_RESULT([no])
2383])
2384
2385AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2386
2387
bart9bbe2bb2012-08-03 19:37:02 +00002388# does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2389# Note, this doesn't generate a C-level symbol. It generates a
2390# automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2391AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2392AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2393 do {
2394 /*
2395 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2396 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2397 * xmm2 should be used.
2398 */
2399 __asm__ __volatile__(
2400 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2401 } while (0)
2402]])], [
2403ac_have_as_vpclmulqdq=yes
2404AC_MSG_RESULT([yes])
2405], [
2406ac_have_as_vpclmulqdq=no
2407AC_MSG_RESULT([no])
2408])
2409
2410AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2411
2412
Elliott Hughesa0664b92017-04-18 17:46:52 -07002413# does the x86/amd64 assembler understand FMA4 instructions?
2414# Note, this doesn't generate a C-level symbol. It generates a
2415# automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
2416AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
2417AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2418 do {
2419 __asm__ __volatile__(
2420 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
2421 } while (0)
2422]])], [
2423ac_have_as_vfmaddpd=yes
2424AC_MSG_RESULT([yes])
2425], [
2426ac_have_as_vfmaddpd=no
2427AC_MSG_RESULT([no])
2428])
2429
2430AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
2431
2432
sewardj27d176a2011-01-17 11:15:48 +00002433# does the x86/amd64 assembler understand the LZCNT instruction?
2434# Note, this doesn't generate a C-level symbol. It generates a
2435# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00002436AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2437
bart417cf3e2011-10-22 09:21:24 +00002438AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
bart55e438b2010-09-14 10:53:57 +00002439 do {
sewardjc62291c2012-07-22 11:10:08 +00002440 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
bart55e438b2010-09-14 10:53:57 +00002441 } while (0)
bart417cf3e2011-10-22 09:21:24 +00002442]])], [
bart55e438b2010-09-14 10:53:57 +00002443 ac_have_as_lzcnt=yes
2444 AC_MSG_RESULT([yes])
2445], [
2446 ac_have_as_lzcnt=no
2447 AC_MSG_RESULT([no])
2448])
2449
2450AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2451
sewardj27d176a2011-01-17 11:15:48 +00002452
florian3df02112013-10-04 11:35:50 +00002453# does the x86/amd64 assembler understand the LOOPNEL instruction?
2454# Note, this doesn't generate a C-level symbol. It generates a
2455# automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2456AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2457
2458AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2459 do {
2460 __asm__ __volatile__("1: loopnel 1b\n");
2461 } while (0)
2462]])], [
2463 ac_have_as_loopnel=yes
2464 AC_MSG_RESULT([yes])
2465], [
2466 ac_have_as_loopnel=no
2467 AC_MSG_RESULT([no])
2468])
2469
2470AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2471
2472
2473# does the x86/amd64 assembler understand ADDR32 ?
2474# Note, this doesn't generate a C-level symbol. It generates a
2475# automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2476AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2477
2478AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2479 do {
2480 asm volatile ("addr32 rep movsb");
2481 } while (0)
2482]])], [
2483 ac_have_as_addr32=yes
2484 AC_MSG_RESULT([yes])
2485], [
2486 ac_have_as_addr32=no
2487 AC_MSG_RESULT([no])
2488])
2489
2490AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2491
2492
sewardj27d176a2011-01-17 11:15:48 +00002493# does the x86/amd64 assembler understand SSE 4.2 instructions?
2494# Note, this doesn't generate a C-level symbol. It generates a
2495# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2496AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2497
bart417cf3e2011-10-22 09:21:24 +00002498AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj27d176a2011-01-17 11:15:48 +00002499 do { long long int x;
2500 __asm__ __volatile__(
florianfdfca222012-01-17 13:16:50 +00002501 "crc32q %%r15,%%r15" : : : "r15" );
2502 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002503 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2504 __asm__ __volatile__(
2505 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
sewardj27d176a2011-01-17 11:15:48 +00002506 while (0)
bart417cf3e2011-10-22 09:21:24 +00002507]])], [
sewardj27d176a2011-01-17 11:15:48 +00002508ac_have_as_sse42=yes
2509AC_MSG_RESULT([yes])
2510], [
2511ac_have_as_sse42=no
2512AC_MSG_RESULT([no])
2513])
2514
2515AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2516
2517
sewardj9fb31ca2012-06-05 00:31:49 +00002518# does the x86/amd64 assembler understand AVX instructions?
2519# Note, this doesn't generate a C-level symbol. It generates a
2520# automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2521AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2522
2523AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2524 do { long long int x;
2525 __asm__ __volatile__(
2526 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2527 __asm__ __volatile__(
2528 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2529 while (0)
2530]])], [
2531ac_have_as_avx=yes
2532AC_MSG_RESULT([yes])
2533], [
2534ac_have_as_avx=no
2535AC_MSG_RESULT([no])
2536])
2537
2538AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2539
2540
sewardjfda50af2013-03-27 11:43:20 +00002541# does the x86/amd64 assembler understand AVX2 instructions?
2542# Note, this doesn't generate a C-level symbol. It generates a
2543# automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2544AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2545
2546AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2547 do { long long int x;
2548 __asm__ __volatile__(
2549 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2550 __asm__ __volatile__(
2551 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2552 while (0)
2553]])], [
2554ac_have_as_avx2=yes
2555AC_MSG_RESULT([yes])
2556], [
2557ac_have_as_avx2=no
2558AC_MSG_RESULT([no])
2559])
2560
2561AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2562
2563
sewardj9ea080b2013-10-16 08:53:07 +00002564# does the x86/amd64 assembler understand TSX instructions and
2565# the XACQUIRE/XRELEASE prefixes?
florian364c3652013-09-30 16:32:53 +00002566# Note, this doesn't generate a C-level symbol. It generates a
2567# automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2568AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2569
2570AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2571 do {
2572 __asm__ __volatile__(
2573 " xbegin Lfoo \n\t"
sewardj9ea080b2013-10-16 08:53:07 +00002574 "Lfoo: xend \n\t"
2575 " xacquire lock incq 0(%rsp) \n\t"
2576 " xrelease lock incq 0(%rsp) \n"
2577 );
florian364c3652013-09-30 16:32:53 +00002578 } while (0)
2579]])], [
2580ac_have_as_tsx=yes
2581AC_MSG_RESULT([yes])
2582], [
2583ac_have_as_tsx=no
2584AC_MSG_RESULT([no])
2585])
2586
2587AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2588
2589
sewardjfda50af2013-03-27 11:43:20 +00002590# does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2591# Note, this doesn't generate a C-level symbol. It generates a
2592# automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2593AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2594
2595AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2596 do { unsigned int h, l;
florian4e94bda2014-10-29 13:57:49 +00002597 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
sewardjfda50af2013-03-27 11:43:20 +00002598 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002599 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
sewardjfda50af2013-03-27 11:43:20 +00002600 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002601 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
sewardjfda50af2013-03-27 11:43:20 +00002602 while (0)
2603]])], [
2604ac_have_as_bmi=yes
2605AC_MSG_RESULT([yes])
2606], [
2607ac_have_as_bmi=no
2608AC_MSG_RESULT([no])
2609])
2610
2611AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2612
2613
2614# does the x86/amd64 assembler understand FMA instructions?
2615# Note, this doesn't generate a C-level symbol. It generates a
2616# automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2617AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2618
2619AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2620 do { unsigned int h, l;
2621 __asm__ __volatile__(
2622 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2623 __asm__ __volatile__(
2624 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2625 __asm__ __volatile__(
2626 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2627 while (0)
2628]])], [
2629ac_have_as_fma=yes
2630AC_MSG_RESULT([yes])
2631], [
2632ac_have_as_fma=no
2633AC_MSG_RESULT([no])
2634])
2635
2636AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2637
2638
mjw20bafc22014-05-09 11:41:46 +00002639# does the amd64 assembler understand MPX instructions?
2640# Note, this doesn't generate a C-level symbol. It generates a
2641# automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2642AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2643
2644AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
florian404c0c72014-12-12 17:44:36 +00002645 do {
2646 asm ("bndmov %bnd0,(%rsp)");
2647 asm ("bndldx 3(%rbx,%rdx), %bnd2");
florian7161e332015-09-02 15:47:33 +00002648 asm ("bnd call foo\n"
2649 bnd jmp end\n"
2650 foo: bnd ret\n"
2651 end: nop");
florian404c0c72014-12-12 17:44:36 +00002652 } while (0)
mjw20bafc22014-05-09 11:41:46 +00002653]])], [
2654ac_have_as_mpx=yes
2655AC_MSG_RESULT([yes])
2656], [
2657ac_have_as_mpx=no
2658AC_MSG_RESULT([no])
2659])
2660
2661AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2662
2663
Elliott Hughesed398002017-06-21 14:41:24 -07002664# does the amd64 assembler understand ADX instructions?
2665# Note, this doesn't generate a C-level symbol. It generates a
2666# automake-level symbol (BUILD_ADX_TESTS), used in test Makefile.am's
2667AC_MSG_CHECKING([if amd64 assembler knows the ADX instructions])
2668
2669AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2670 do {
2671 asm ("adcxq %r14,%r8");
2672 } while (0)
2673]])], [
2674ac_have_as_adx=yes
2675AC_MSG_RESULT([yes])
2676], [
2677ac_have_as_adx=no
2678AC_MSG_RESULT([no])
2679])
2680
2681AM_CONDITIONAL(BUILD_ADX_TESTS, test x$ac_have_as_adx = xyes)
2682
2683
mjw20bafc22014-05-09 11:41:46 +00002684# Does the C compiler support the "ifunc" attribute
2685# Note, this doesn't generate a C-level symbol. It generates a
2686# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
sewardjb08d84d2012-07-16 08:23:26 +00002687# does the x86/amd64 assembler understand MOVBE?
2688# Note, this doesn't generate a C-level symbol. It generates a
2689# automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2690AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2691
2692AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2693 do { long long int x;
2694 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002695 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
sewardjb08d84d2012-07-16 08:23:26 +00002696 while (0)
2697]])], [
2698ac_have_as_movbe=yes
2699AC_MSG_RESULT([yes])
2700], [
2701ac_have_as_movbe=no
2702AC_MSG_RESULT([no])
2703])
2704
2705AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2706
2707
florian251c2f92012-07-05 21:21:37 +00002708# Does the C compiler support the "ifunc" attribute
2709# Note, this doesn't generate a C-level symbol. It generates a
2710# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2711AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2712
florianf78a5032012-07-06 09:17:29 +00002713AC_LINK_IFELSE([AC_LANG_SOURCE([[
2714static void mytest(void) {}
2715
2716static void (*resolve_test(void))(void)
2717{
2718 return (void (*)(void))&mytest;
2719}
2720
2721void test(void) __attribute__((ifunc("resolve_test")));
2722
2723int main()
2724{
2725 test();
2726 return 0;
2727}
florian251c2f92012-07-05 21:21:37 +00002728]])], [
2729ac_have_ifunc_attr=yes
2730AC_MSG_RESULT([yes])
2731], [
2732ac_have_ifunc_attr=no
2733AC_MSG_RESULT([no])
2734])
2735
2736AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2737
Elliott Hughesa0664b92017-04-18 17:46:52 -07002738# Does the C compiler support the armv8 crc feature flag
2739# Note, this doesn't generate a C-level symbol. It generates a
2740# automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
2741AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
2742
2743save_CFLAGS="$CFLAGS"
2744CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
2745AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2746int main()
2747{
2748 return 0;
2749}
2750]])], [
2751ac_have_armv8_crc_feature=yes
2752AC_MSG_RESULT([yes])
2753], [
2754ac_have_armv8_crc_feature=no
2755AC_MSG_RESULT([no])
2756])
2757CFLAGS="$save_CFLAGS"
2758
2759AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
2760
florian251c2f92012-07-05 21:21:37 +00002761
sewardje089f012010-10-13 21:47:29 +00002762# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2763# when building the tool executables. I think we should get rid of it.
2764#
sewardjb5f6f512005-03-10 23:59:00 +00002765# Check for TLS support in the compiler and linker
bart2bd9a682011-10-22 09:46:16 +00002766AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2767 [[return foo;]])],
2768 [vg_cv_linktime_tls=yes],
2769 [vg_cv_linktime_tls=no])
bartca9f2ad2008-06-02 07:14:20 +00002770# Native compilation: check whether running a program using TLS succeeds.
2771# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2772# succeeds but running programs using TLS fails.
bart2bd9a682011-10-22 09:46:16 +00002773# Cross-compiling: check whether linking a program using TLS succeeds.
bartca9f2ad2008-06-02 07:14:20 +00002774AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2775 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2776 [vg_cv_tls=$enableval],
2777 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2778 [[return foo;]])],
2779 [vg_cv_tls=yes],
bart2bd9a682011-10-22 09:46:16 +00002780 [vg_cv_tls=no],
2781 [vg_cv_tls=$vg_cv_linktime_tls])])])
sewardjb5f6f512005-03-10 23:59:00 +00002782
rhyskidd34cba1b2015-06-08 08:56:33 +00002783if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
sewardjb5f6f512005-03-10 23:59:00 +00002784AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2785fi
sewardj5b754b42002-06-03 22:53:35 +00002786
sewardj535c50f2005-06-04 23:14:53 +00002787
njn7fd6d382009-01-22 21:56:32 +00002788#----------------------------------------------------------------------------
sewardj8eb8bab2015-07-21 14:44:28 +00002789# Solaris-specific checks.
2790#----------------------------------------------------------------------------
2791
2792if test "$VGCONF_OS" = "solaris" ; then
Elliott Hughesed398002017-06-21 14:41:24 -07002793AC_CHECK_HEADERS([sys/lgrp_user_impl.h])
2794
sewardj8eb8bab2015-07-21 14:44:28 +00002795# Solaris-specific check determining if the Sun Studio Assembler is used to
2796# build Valgrind. The test checks if the x86/amd64 assembler understands the
2797# cmovl.l instruction, if yes then it's Sun Assembler.
2798#
2799# C-level symbol: none
2800# Automake-level symbol: SOLARIS_SUN_STUDIO_AS
2801#
2802AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
2803AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2804]], [[
2805 __asm__ __volatile__("cmovl.l %edx, %eax");
2806]])], [
2807solaris_have_sun_studio_as=yes
2808AC_MSG_RESULT([yes])
2809], [
2810solaris_have_sun_studio_as=no
2811AC_MSG_RESULT([no])
2812])
2813AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
2814
2815# Solaris-specific check determining if symbols __xpg4 and __xpg6
Elliott Hughesed398002017-06-21 14:41:24 -07002816# are present in linked shared libraries when gcc is invoked with -std=gnu99.
sewardj8eb8bab2015-07-21 14:44:28 +00002817# See solaris/vgpreload-solaris.mapfile for details.
Elliott Hughesed398002017-06-21 14:41:24 -07002818# gcc on older Solaris instructs linker to include these symbols,
2819# gcc on illumos and newer Solaris does not.
sewardj8eb8bab2015-07-21 14:44:28 +00002820#
2821# C-level symbol: none
2822# Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
2823#
2824save_CFLAGS="$CFLAGS"
2825CFLAGS="$CFLAGS -std=gnu99"
2826AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
Elliott Hughesed398002017-06-21 14:41:24 -07002827temp_dir=$( /usr/bin/mktemp -d )
2828cat <<_ACEOF >${temp_dir}/mylib.c
sewardj8eb8bab2015-07-21 14:44:28 +00002829#include <stdio.h>
Elliott Hughesed398002017-06-21 14:41:24 -07002830int myfunc(void) { printf("LaPutyka\n"); }
2831_ACEOF
2832${CC} ${CFLAGS} -fpic -shared -o ${temp_dir}/mylib.so ${temp_dir}/mylib.c
2833xpg_present=$( /usr/bin/nm ${temp_dir}/mylib.so | ${EGREP} '(__xpg4|__xpg6)' )
2834if test "x${xpg_present}" = "x" ; then
2835 solaris_xpg_symbols_present=no
2836 AC_MSG_RESULT([no])
2837else
2838 solaris_xpg_symbols_present=yes
2839 AC_MSG_RESULT([yes])
2840fi
2841rm -rf ${temp_dir}
sewardj8eb8bab2015-07-21 14:44:28 +00002842AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
2843CFLAGS="$save_CFLAGS"
2844
2845
Elliott Hughesa0664b92017-04-18 17:46:52 -07002846# Solaris-specific check determining if gcc enables largefile support by
2847# default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
2848# variable with gcc flags which disable it.
2849#
2850AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
2851save_CFLAGS="$CFLAGS"
2852CFLAGS="$CFLAGS -m32"
2853AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2854 return _LARGEFILE_SOURCE;
2855]])], [
2856SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
2857AC_MSG_RESULT([yes])
2858], [
2859SOLARIS_UNDEF_LARGESOURCE=""
2860AC_MSG_RESULT([no])
2861])
2862CFLAGS=$safe_CFLAGS
2863AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
2864
2865
iraisr23e68ca2015-08-14 20:50:11 +00002866# Solaris-specific check determining if /proc/self/cmdline
2867# or /proc/<pid>/cmdline is supported.
2868#
2869# C-level symbol: SOLARIS_PROC_CMDLINE
2870# Automake-level symbol: SOLARIS_PROC_CMDLINE
2871#
2872AC_CHECK_FILE([/proc/self/cmdline],
2873[
2874solaris_proc_cmdline=yes
2875AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
2876 [Define to 1 if you have /proc/self/cmdline.])
2877], [
2878solaris_proc_cmdline=no
2879])
2880AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
2881
2882
sewardj8eb8bab2015-07-21 14:44:28 +00002883# Solaris-specific check determining default platform for the Valgrind launcher.
2884# Used in case the launcher cannot select platform by looking at the client
2885# image (for example because the executable is a shell script).
2886#
2887# C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
2888# Automake-level symbol: none
2889#
2890AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
2891# Get the ELF class of /bin/sh first.
2892if ! test -f /bin/sh; then
2893 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
2894fi
2895elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
2896case "$elf_class" in
2897 64)
2898 default_arch="$VGCONF_ARCH_PRI";
2899 ;;
2900 32)
2901 if test "x$VGCONF_ARCH_SEC" != "x"; then
2902 default_arch="$VGCONF_ARCH_SEC"
2903 else
2904 default_arch="$VGCONF_ARCH_PRI";
2905 fi
2906 ;;
2907 *)
2908 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
2909 ;;
2910esac
2911default_platform="$default_arch-$VGCONF_OS"
2912AC_MSG_RESULT([$default_platform])
2913AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
2914 [Default platform for Valgrind launcher.])
2915
2916
2917# Solaris-specific check determining if the old syscalls are available.
2918#
2919# C-level symbol: SOLARIS_OLD_SYSCALLS
2920# Automake-level symbol: SOLARIS_OLD_SYSCALLS
2921#
2922AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
2923AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2924#include <sys/syscall.h>
2925]], [[
2926 return !SYS_open;
2927]])], [
2928solaris_old_syscalls=yes
2929AC_MSG_RESULT([yes])
2930AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
2931 [Define to 1 if you have the old Solaris syscalls.])
2932], [
2933solaris_old_syscalls=no
2934AC_MSG_RESULT([no])
2935])
2936AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
2937
2938
2939# Solaris-specific check determining if the new accept() syscall is available.
2940#
2941# Old syscall:
2942# int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2943# int version);
2944#
2945# New syscall (available on illumos):
2946# int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2947# int version, int flags);
2948#
2949# If the old syscall is present then the following syscall will fail with
2950# ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
2951# available then it will fail with EINVAL (because the flags parameter is
2952# invalid).
2953#
2954# C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
2955# Automake-level symbol: none
2956#
2957AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
2958AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2959#include <sys/syscall.h>
2960#include <errno.h>
2961]], [[
2962 errno = 0;
2963 syscall(SYS_accept, 0, 0, 0, 0, -1);
2964 return !(errno == EINVAL);
2965]])], [
2966AC_MSG_RESULT([yes])
2967AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
2968 [Define to 1 if you have the new `accept' syscall.])
2969], [
2970AC_MSG_RESULT([no])
2971])
2972
2973
2974# Solaris-specific check determining if the new illumos pipe() syscall is
2975# available.
2976#
2977# Old syscall:
2978# longlong_t pipe();
2979#
2980# New syscall (available on illumos):
2981# int pipe(intptr_t arg, int flags);
2982#
2983# If the old syscall is present then the following call will succeed, if the
2984# new syscall is available then it will fail with EFAULT (because address 0
2985# cannot be accessed).
2986#
2987# C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
2988# Automake-level symbol: none
2989#
2990AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
2991AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2992#include <sys/syscall.h>
2993#include <errno.h>
2994]], [[
2995 errno = 0;
2996 syscall(SYS_pipe, 0, 0);
2997 return !(errno == EFAULT);
2998]])], [
2999AC_MSG_RESULT([yes])
3000AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
3001 [Define to 1 if you have the new `pipe' syscall.])
3002], [
3003AC_MSG_RESULT([no])
3004])
3005
3006
3007# Solaris-specific check determining if the new lwp_sigqueue() syscall is
3008# available.
3009#
3010# Old syscall:
3011# int lwp_kill(id_t lwpid, int sig);
3012#
3013# New syscall (available on Solaris 11):
3014# int lwp_sigqueue(id_t lwpid, int sig, void *value,
3015# int si_code, timespec_t *timeout);
3016#
3017# C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3018# Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
3019#
3020AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
3021AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3022#include <sys/syscall.h>
3023]], [[
3024 return !SYS_lwp_sigqueue;
3025]])], [
3026solaris_lwp_sigqueue_syscall=yes
3027AC_MSG_RESULT([yes])
3028AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
3029 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
3030], [
3031solaris_lwp_sigqueue_syscall=no
3032AC_MSG_RESULT([no])
3033])
3034AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3035
3036
3037# Solaris-specific check determining if the lwp_sigqueue() syscall
3038# takes both pid and thread id arguments or just thread id.
3039#
3040# Old syscall (available on Solaris 11.x):
3041# int lwp_sigqueue(id_t lwpid, int sig, void *value,
3042# int si_code, timespec_t *timeout);
3043#
3044# New syscall (available on Solaris 12):
3045# int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
3046# int si_code, timespec_t *timeout);
3047#
3048# If the old syscall is present then the following syscall will fail with
3049# EINVAL (because signal is out of range); if the new syscall is available
3050# then it will fail with ESRCH (because it would not find such thread in the
3051# current process).
3052#
3053# C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3054# Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3055#
3056AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
3057AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
3058AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3059#include <sys/syscall.h>
3060#include <errno.h>
3061]], [[
3062 errno = 0;
3063 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
3064 return !(errno == ESRCH);
3065]])], [
3066solaris_lwp_sigqueue_syscall_takes_pid=yes
3067AC_MSG_RESULT([yes])
3068AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
3069 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
3070], [
3071solaris_lwp_sigqueue_syscall_takes_pid=no
3072AC_MSG_RESULT([no])
3073])
3074AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
3075 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
3076,
3077AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
3078)
3079
3080
3081# Solaris-specific check determining if the new lwp_name() syscall is
3082# available.
3083#
3084# New syscall (available on Solaris 11):
3085# int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
3086#
3087# C-level symbol: SOLARIS_LWP_NAME_SYSCALL
3088# Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
3089#
3090AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
3091AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3092#include <sys/syscall.h>
3093]], [[
3094 return !SYS_lwp_name;
3095]])], [
3096solaris_lwp_name_syscall=yes
3097AC_MSG_RESULT([yes])
3098AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
3099 [Define to 1 if you have the new `lwp_name' syscall.])
3100], [
3101solaris_lwp_name_syscall=no
3102AC_MSG_RESULT([no])
3103])
3104AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
3105
3106
Elliott Hughesa0664b92017-04-18 17:46:52 -07003107# Solaris-specific check determining if the new getrandom() syscall is
3108# available.
3109#
3110# New syscall (available on Solaris 11):
3111# int getrandom(void *buf, size_t buflen, uint_t flags);
3112#
3113# C-level symbol: SOLARIS_GETRANDOM_SYSCALL
3114# Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
3115#
3116AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
3117AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3118#include <sys/syscall.h>
3119]], [[
3120 return !SYS_getrandom;
3121]])], [
3122solaris_getrandom_syscall=yes
3123AC_MSG_RESULT([yes])
3124AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
3125 [Define to 1 if you have the new `getrandom' syscall.])
3126], [
3127solaris_getrandom_syscall=no
3128AC_MSG_RESULT([no])
3129])
3130AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
3131
3132
sewardj8eb8bab2015-07-21 14:44:28 +00003133# Solaris-specific check determining if the new zone() syscall subcodes
3134# ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
3135# were added in Solaris 11 but are missing on illumos.
3136#
3137# C-level symbol: SOLARIS_ZONE_DEFUNCT
3138# Automake-level symbol: SOLARIS_ZONE_DEFUNCT
3139#
3140AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
3141AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3142#include <sys/zone.h>
3143]], [[
3144 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
3145]])], [
3146solaris_zone_defunct=yes
3147AC_MSG_RESULT([yes])
3148AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
3149 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
3150], [
3151solaris_zone_defunct=no
3152AC_MSG_RESULT([no])
3153])
3154AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
3155
3156
Elliott Hughesa0664b92017-04-18 17:46:52 -07003157# Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
3158# for auditon(2) subcode of the auditsys() syscall are available.
3159# These commands are available in Solaris 11 and illumos but were removed
3160# in Solaris 12.
3161#
3162# C-level symbol: SOLARIS_AUDITON_STAT
3163# Automake-level symbol: SOLARIS_AUDITON_STAT
3164#
3165AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
3166AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3167#include <bsm/audit.h>
3168]], [[
3169 return !(A_GETSTAT && A_SETSTAT);
3170]])], [
3171solaris_auditon_stat=yes
3172AC_MSG_RESULT([yes])
3173AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
3174 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
3175], [
3176solaris_auditon_stat=no
3177AC_MSG_RESULT([no])
3178])
3179AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
3180
3181
sewardj8eb8bab2015-07-21 14:44:28 +00003182# Solaris-specific check determining if the new shmsys() syscall subcodes
3183# IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
3184# These subcodes were added in Solaris 11 but are missing on illumos.
3185#
3186# C-level symbol: SOLARIS_SHM_NEW
3187# Automake-level symbol: SOLARIS_SHM_NEW
3188#
3189AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
3190AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3191#include <sys/ipc_impl.h>
3192#include <sys/shm.h>
3193#include <sys/shm_impl.h>
3194]], [[
3195 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
3196]])], [
3197solaris_shm_new=yes
3198AC_MSG_RESULT([yes])
3199AC_DEFINE([SOLARIS_SHM_NEW], 1,
3200 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
3201], [
3202solaris_shm_new=no
3203AC_MSG_RESULT([no])
3204])
3205AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
3206
3207
3208# Solaris-specific check determining if prxregset_t is available. Illumos
3209# currently does not define it on the x86 platform.
3210#
3211# C-level symbol: SOLARIS_PRXREGSET_T
3212# Automake-level symbol: SOLARIS_PRXREGSET_T
3213#
3214AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
3215AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3216#include <sys/procfs_isa.h>
3217]], [[
3218 return !sizeof(prxregset_t);
3219]])], [
3220solaris_prxregset_t=yes
3221AC_MSG_RESULT([yes])
3222AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
3223 [Define to 1 if you have the `prxregset_t' type.])
3224], [
3225solaris_prxregset_t=no
3226AC_MSG_RESULT([no])
3227])
3228AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
3229
3230
3231# Solaris-specific check determining if the new frealpathat() syscall is
3232# available.
3233#
3234# New syscall (available on Solaris 11.1):
3235# int frealpathat(int fd, char *path, char *buf, size_t buflen);
3236#
3237# C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3238# Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3239#
3240AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
3241AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3242#include <sys/syscall.h>
3243]], [[
3244 return !SYS_frealpathat;
3245]])], [
3246solaris_frealpathat_syscall=yes
3247AC_MSG_RESULT([yes])
3248AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
3249 [Define to 1 if you have the new `frealpathat' syscall.])
3250], [
3251solaris_frealpathat_syscall=no
3252AC_MSG_RESULT([no])
3253])
3254AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
3255
3256
3257# Solaris-specific check determining if the new uuidsys() syscall is
3258# available.
3259#
3260# New syscall (available on newer Solaris):
3261# int uuidsys(struct uuid *uuid);
3262#
3263# C-level symbol: SOLARIS_UUIDSYS_SYSCALL
3264# Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
3265#
3266AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
3267AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3268#include <sys/syscall.h>
3269]], [[
3270 return !SYS_uuidsys;
3271]])], [
3272solaris_uuidsys_syscall=yes
3273AC_MSG_RESULT([yes])
3274AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
3275 [Define to 1 if you have the new `uuidsys' syscall.])
3276], [
3277solaris_uuidsys_syscall=no
3278AC_MSG_RESULT([no])
3279])
3280AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
3281
3282
3283# Solaris-specific check determining if the new labelsys() syscall subcode
3284# TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
3285# missing on illumos.
3286#
3287# C-level symbol: SOLARIS_TNDB_GET_TNIP
3288# Automake-level symbol: SOLARIS_TNDB_GET_TNIP
3289#
3290AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
3291AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3292#include <sys/tsol/tndb.h>
3293]], [[
3294 return !TNDB_GET_TNIP;
3295]])], [
3296solaris_tndb_get_tnip=yes
3297AC_MSG_RESULT([yes])
3298AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
3299 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
3300], [
3301solaris_tndb_get_tnip=no
3302AC_MSG_RESULT([no])
3303])
3304AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
3305
3306
3307# Solaris-specific check determining if the new labelsys() syscall opcodes
3308# TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
3309# added in Solaris 11 but are missing on illumos.
3310#
3311# C-level symbol: SOLARIS_TSOL_CLEARANCE
3312# Automake-level symbol: SOLARIS_TSOL_CLEARANCE
3313#
3314AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
3315AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3316#include <sys/tsol/tsyscall.h>
3317]], [[
3318 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
3319]])], [
3320solaris_tsol_clearance=yes
3321AC_MSG_RESULT([yes])
3322AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
3323 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
3324], [
3325solaris_tsol_clearance=no
3326AC_MSG_RESULT([no])
3327])
3328AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
3329
3330
iraisr7d4aa192015-10-12 19:10:42 +00003331# Solaris-specific check determining if the new pset() syscall subcode
3332# PSET_GET_NAME is available. This subcode was added in Solaris 12 but
3333# is missing on illumos and Solaris 11.
3334#
3335# C-level symbol: SOLARIS_PSET_GET_NAME
3336# Automake-level symbol: SOLARIS_PSET_GET_NAME
3337#
3338AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
3339AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3340#include <sys/pset.h>
3341]], [[
3342 return !(PSET_GET_NAME);
3343]])], [
3344solaris_pset_get_name=yes
3345AC_MSG_RESULT([yes])
3346AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
3347 [Define to 1 if you have the `PSET_GET_NAME' constants.])
3348], [
3349solaris_pset_get_name=no
3350AC_MSG_RESULT([no])
3351])
3352AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
3353
3354
sewardj8eb8bab2015-07-21 14:44:28 +00003355# Solaris-specific check determining if the utimesys() syscall is
3356# available (on illumos and older Solaris).
3357#
3358# C-level symbol: SOLARIS_UTIMESYS_SYSCALL
3359# Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
3360#
3361AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
3362AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3363#include <sys/syscall.h>
3364]], [[
3365 return !SYS_utimesys;
3366]])], [
3367solaris_utimesys_syscall=yes
3368AC_MSG_RESULT([yes])
3369AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
3370 [Define to 1 if you have the `utimesys' syscall.])
3371], [
3372solaris_utimesys_syscall=no
3373AC_MSG_RESULT([no])
3374])
3375AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
3376
3377
3378# Solaris-specific check determining if the utimensat() syscall is
3379# available (on newer Solaris).
3380#
3381# C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3382# Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3383#
3384AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
3385AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3386#include <sys/syscall.h>
3387]], [[
3388 return !SYS_utimensat;
3389]])], [
3390solaris_utimensat_syscall=yes
3391AC_MSG_RESULT([yes])
3392AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
3393 [Define to 1 if you have the `utimensat' syscall.])
3394], [
3395solaris_utimensat_syscall=no
3396AC_MSG_RESULT([no])
3397])
3398AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
3399
3400
3401# Solaris-specific check determining if the spawn() syscall is available
3402# (on newer Solaris).
3403#
3404# C-level symbol: SOLARIS_SPAWN_SYSCALL
3405# Automake-level symbol: SOLARIS_SPAWN_SYSCALL
3406#
3407AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
3408AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3409#include <sys/syscall.h>
3410]], [[
3411 return !SYS_spawn;
3412]])], [
3413solaris_spawn_syscall=yes
3414AC_MSG_RESULT([yes])
3415AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
3416 [Define to 1 if you have the `spawn' syscall.])
3417], [
3418solaris_spawn_syscall=no
3419AC_MSG_RESULT([no])
3420])
3421AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
3422
3423
Elliott Hughesa0664b92017-04-18 17:46:52 -07003424# Solaris-specific check determining if commands MODNVL_CTRLMAP through
3425# MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
3426#
3427# C-level symbol: SOLARIS_MODCTL_MODNVL
3428# Automake-level symbol: SOLARIS_MODCTL_MODNVL
3429#
3430AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
3431AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3432#include <sys/modctl.h>
3433]], [[
3434 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
3435]])], [
3436solaris_modctl_modnvl=yes
3437AC_MSG_RESULT([yes])
3438AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
3439 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
3440], [
3441solaris_modctl_modnvl=no
3442AC_MSG_RESULT([no])
3443])
3444AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
3445
3446
sewardj8eb8bab2015-07-21 14:44:28 +00003447# Solaris-specific check determining whether nscd (name switch cache daemon)
3448# attaches its door at /system/volatile/name_service_door (Solaris)
3449# or at /var/run/name_service_door (illumos).
3450#
3451# Note that /var/run is a symlink to /system/volatile on Solaris
3452# but not vice versa on illumos.
3453#
3454# C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3455# Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3456#
3457AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
3458if test -e /system/volatile/name_service_door; then
3459 solaris_nscd_door_system_volatile=yes
3460 AC_MSG_RESULT([/system/volatile/name_service_door])
3461 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
3462 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
3463else
3464 solaris_nscd_door_system_volatile=no
3465 AC_MSG_RESULT([/var/run/name_service_door])
3466fi
3467AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
3468
3469
3470# Solaris-specific check determining if the new gethrt() fasttrap is available.
3471#
3472# New fasttrap (available on Solaris 11):
3473# hrt_t *gethrt(void);
3474#
3475# C-level symbol: SOLARIS_GETHRT_FASTTRAP
3476# Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
3477#
3478AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
3479AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3480#include <sys/trap.h>
3481]], [[
3482 return !T_GETHRT;
3483]])], [
3484solaris_gethrt_fasttrap=yes
3485AC_MSG_RESULT([yes])
3486AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
3487 [Define to 1 if you have the new `gethrt' fasttrap.])
3488], [
3489solaris_gethrt_fasttrap=no
3490AC_MSG_RESULT([no])
3491])
3492AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
3493
3494
3495# Solaris-specific check determining if the new get_zone_offset() fasttrap
3496# is available.
3497#
3498# New fasttrap (available on Solaris 11):
3499# zonehrtoffset_t *get_zone_offset(void);
3500#
3501# C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3502# Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3503#
3504AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
3505AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3506#include <sys/trap.h>
3507]], [[
3508 return !T_GETZONEOFFSET;
3509]])], [
3510solaris_getzoneoffset_fasttrap=yes
3511AC_MSG_RESULT([yes])
3512AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
3513 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
3514], [
3515solaris_getzoneoffset_fasttrap=no
3516AC_MSG_RESULT([no])
3517])
3518AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
3519
3520
3521# Solaris-specific check determining if the execve() syscall
3522# takes fourth argument (flags) or not.
3523#
3524# Old syscall (available on illumos):
3525# int execve(const char *fname, const char **argv, const char **envp);
3526#
3527# New syscall (available on Solaris):
3528# int execve(uintptr_t file, const char **argv, const char **envp, int flags);
3529#
3530# If the new syscall is present then it will fail with EINVAL (because flags
3531# are invalid); if the old syscall is available then it will fail with ENOENT
3532# (because the file could not be found).
3533#
3534# C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3535# Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3536#
3537AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
3538AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3539#include <sys/syscall.h>
3540#include <errno.h>
3541]], [[
3542 errno = 0;
3543 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
3544 return !(errno == EINVAL);
3545]])], [
3546solaris_execve_syscall_takes_flags=yes
3547AC_MSG_RESULT([yes])
3548AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
3549 [Define to 1 if you have the new `execve' syscall which accepts flags.])
3550], [
3551solaris_execve_syscall_takes_flags=no
3552AC_MSG_RESULT([no])
3553])
3554AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
3555 test x$solaris_execve_syscall_takes_flags = xyes)
3556
3557
3558# Solaris-specific check determining version of the repository cache protocol.
3559# Every Solaris version uses a different one, ranging from 21 to current 25.
3560# The check is very ugly, though.
3561#
3562# C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
3563# Automake-level symbol: none
3564#
3565AC_PATH_PROG(DIS_PATH, dis, false)
3566if test "x$DIS_PATH" = "xfalse"; then
3567 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
3568fi
3569AC_CHECK_LIB(scf, scf_handle_bind, [], [
3570 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
3571 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3572])
3573
3574AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
3575if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
3576 libscf=/usr/lib/64/libscf.so.1
3577else
3578 libscf=/usr/lib/libscf.so.1
3579fi
3580if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
3581 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
3582 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3583fi
3584hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
3585if test -z "$hex"; then
3586 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
3587 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3588fi
3589version=$( printf "%d\n" 0x$hex )
3590AC_MSG_RESULT([$version])
3591AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
3592 [Version number of the repository door cache protocol.])
3593
iraisrfa0a7f42015-08-01 21:53:08 +00003594
3595# Solaris-specific check determining if "sysstat" segment reservation type
3596# is available.
3597#
3598# New "sysstat" segment reservation (available on Solaris 12):
3599# - program header type: PT_SUNW_SYSSTAT
3600# - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
3601#
3602# C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3603# Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3604#
3605AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
3606AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3607#include <sys/auxv.h>
3608]], [[
3609 return !AT_SUN_SYSSTAT_ADDR;
3610]])], [
3611solaris_reserve_sysstat_addr=yes
3612AC_MSG_RESULT([yes])
3613AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
3614 [Define to 1 if you have the new `sysstat' segment reservation.])
3615], [
3616solaris_reserve_sysstat_addr=no
3617AC_MSG_RESULT([no])
3618])
3619AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
3620
3621
3622# Solaris-specific check determining if "sysstat_zone" segment reservation type
3623# is available.
3624#
3625# New "sysstat_zone" segment reservation (available on Solaris 12):
3626# - program header type: PT_SUNW_SYSSTAT_ZONE
3627# - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
3628#
3629# C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3630# Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3631#
3632AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
3633AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3634#include <sys/auxv.h>
3635]], [[
3636 return !AT_SUN_SYSSTAT_ZONE_ADDR;
3637]])], [
3638solaris_reserve_sysstat_zone_addr=yes
3639AC_MSG_RESULT([yes])
3640AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
3641 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
3642], [
3643solaris_reserve_sysstat_zone_addr=no
3644AC_MSG_RESULT([no])
3645])
3646AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
3647
iraisrc0d46cd2015-09-25 21:04:45 +00003648
3649# Solaris-specific check determining if the system_stats() syscall is available
3650# (on newer Solaris).
3651#
3652# C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3653# Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3654#
3655AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
3656AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3657#include <sys/syscall.h>
3658]], [[
3659 return !SYS_system_stats;
3660]])], [
3661solaris_system_stats_syscall=yes
3662AC_MSG_RESULT([yes])
3663AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
3664 [Define to 1 if you have the `system_stats' syscall.])
3665], [
3666solaris_system_stats_syscall=no
3667AC_MSG_RESULT([no])
3668])
3669AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
3670
Elliott Hughesa0664b92017-04-18 17:46:52 -07003671
3672# Solaris-specific check determining if fpregset_t defines struct _fpchip_state
3673# (on newer illumos) or struct fpchip_state (Solaris, older illumos).
3674#
3675# C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
3676# Automake-level symbol: none
3677#
3678AC_CHECK_TYPE([struct _fpchip_state],
3679 [solaris_fpchip_state_takes_underscore=yes],
3680 [solaris_fpchip_state_takes_underscore=no],
3681 [[#include <sys/regset.h>]])
3682if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
3683 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
3684 [Define to 1 if fpregset_t defines struct _fpchip_state])
3685fi
3686
3687
3688# Solaris-specific check determining if schedctl page shared between kernel
3689# and userspace program is executable (illumos, older Solaris) or not (newer
3690# Solaris).
3691#
3692# C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
3693# Automake-level symbol: none
3694#
3695AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
3696AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3697#include <assert.h>
3698#include <fcntl.h>
3699#include <procfs.h>
3700#include <schedctl.h>
3701#include <stdio.h>
3702#include <unistd.h>
3703]], [[
3704 schedctl_t *scp = schedctl_init();
3705 if (scp == NULL)
3706 return 1;
3707
3708 int fd = open("/proc/self/map", O_RDONLY);
3709 assert(fd >= 0);
3710
3711 prmap_t map;
3712 ssize_t rd;
3713 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
3714 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
3715 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
3716 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
3717 return (map.pr_mflags & MA_EXEC);
3718 }
3719 }
3720
3721 return 1;
3722]])], [
3723solaris_schedctl_page_exec=no
3724AC_MSG_RESULT([no])
3725], [
3726solaris_schedctl_page_exec=yes
3727AC_MSG_RESULT([yes])
3728AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
3729 [Define to 1 if you have the schedctl page executable.])
3730])
3731
3732
3733# Solaris-specific check determining if PT_SUNWDTRACE program header provides
3734# scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
3735# an initial thread pointer for libc (newer Solaris).
3736#
3737# C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
3738# Automake-level symbol: none
3739#
3740AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
3741AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3742#include <sys/fasttrap_isa.h>
3743]], [[
3744 return !FT_SCRATCHSIZE;
3745]])], [
3746solaris_pt_sunwdtrace_thrp=yes
3747AC_MSG_RESULT([yes])
3748AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
3749 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
3750], [
3751solaris_pt_sunwdtrace_thrp=no
3752AC_MSG_RESULT([no])
3753])
3754
sewardj8eb8bab2015-07-21 14:44:28 +00003755else
3756AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
3757AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
iraisr23e68ca2015-08-14 20:50:11 +00003758AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003759AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
3760AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
3761AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
3762AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
Elliott Hughesa0664b92017-04-18 17:46:52 -07003763AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003764AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
Elliott Hughesa0664b92017-04-18 17:46:52 -07003765AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003766AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
3767AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
3768AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
3769AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
3770AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
3771AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
iraisr7d4aa192015-10-12 19:10:42 +00003772AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003773AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
3774AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
3775AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
Elliott Hughesa0664b92017-04-18 17:46:52 -07003776AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003777AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
3778AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
3779AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
3780AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
iraisrfa0a7f42015-08-01 21:53:08 +00003781AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
3782AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
iraisrc0d46cd2015-09-25 21:04:45 +00003783AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003784fi # test "$VGCONF_OS" = "solaris"
3785
3786
3787#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00003788# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00003789#----------------------------------------------------------------------------
3790
sewardjde4a1d02002-03-22 01:27:54 +00003791AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00003792AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00003793 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00003794 endian.h \
3795 mqueue.h \
3796 sys/endian.h \
3797 sys/epoll.h \
3798 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00003799 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00003800 sys/poll.h \
sewardj8eb8bab2015-07-21 14:44:28 +00003801 sys/prctl.h \
bart71bad292008-04-27 11:43:23 +00003802 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00003803 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00003804 sys/syscall.h \
Elliott Hughesa0664b92017-04-18 17:46:52 -07003805 sys/sysnvl.h \
bart71bad292008-04-27 11:43:23 +00003806 sys/time.h \
3807 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00003808 ])
sewardjde4a1d02002-03-22 01:27:54 +00003809
bart818f17e2011-09-17 06:24:49 +00003810# Verify whether the <linux/futex.h> header is usable.
3811AC_MSG_CHECKING([if <linux/futex.h> is usable])
3812
sewardjc12486b2012-12-17 14:46:48 +00003813save_CFLAGS="$CFLAGS"
3814CFLAGS="$CFLAGS -D__user="
bart417cf3e2011-10-22 09:21:24 +00003815AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart818f17e2011-09-17 06:24:49 +00003816#include <linux/futex.h>
bart417cf3e2011-10-22 09:21:24 +00003817]], [[
bart818f17e2011-09-17 06:24:49 +00003818 return FUTEX_WAIT;
bart417cf3e2011-10-22 09:21:24 +00003819]])], [
bart78bfc712011-12-08 16:14:59 +00003820ac_have_usable_linux_futex_h=yes
bart818f17e2011-09-17 06:24:49 +00003821AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
3822 [Define to 1 if you have a usable <linux/futex.h> header file.])
3823AC_MSG_RESULT([yes])
3824], [
bart78bfc712011-12-08 16:14:59 +00003825ac_have_usable_linux_futex_h=no
bart818f17e2011-09-17 06:24:49 +00003826AC_MSG_RESULT([no])
3827])
sewardjc12486b2012-12-17 14:46:48 +00003828CFLAGS="$save_CFLAGS"
3829
bart818f17e2011-09-17 06:24:49 +00003830
njn7fd6d382009-01-22 21:56:32 +00003831#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003832# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00003833#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003834AC_TYPE_UID_T
3835AC_TYPE_OFF_T
3836AC_TYPE_SIZE_T
3837AC_HEADER_TIME
3838
sewardj535c50f2005-06-04 23:14:53 +00003839
njn7fd6d382009-01-22 21:56:32 +00003840#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003841# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00003842#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003843AC_FUNC_MEMCMP
3844AC_FUNC_MMAP
sewardjde4a1d02002-03-22 01:27:54 +00003845
bart26288e42011-04-03 16:46:01 +00003846AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00003847AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00003848
bartf5ceec82008-04-26 07:45:10 +00003849AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00003850 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00003851 epoll_create \
3852 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00003853 klogctl \
bartf5ceec82008-04-26 07:45:10 +00003854 mallinfo \
3855 memchr \
3856 memset \
3857 mkdir \
njnf76d27a2009-05-28 01:53:07 +00003858 mremap \
bartf5ceec82008-04-26 07:45:10 +00003859 ppoll \
bart6d45e922009-01-20 13:45:38 +00003860 pthread_barrier_init \
3861 pthread_condattr_setclock \
3862 pthread_mutex_timedlock \
3863 pthread_rwlock_timedrdlock \
3864 pthread_rwlock_timedwrlock \
3865 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00003866 pthread_yield \
florianc5325ef2013-09-17 20:15:36 +00003867 pthread_setname_np \
bartd1f724c2009-08-26 18:11:18 +00003868 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00003869 semtimedop \
3870 signalfd \
njn6cc22472009-03-16 03:46:48 +00003871 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00003872 strchr \
3873 strdup \
3874 strpbrk \
3875 strrchr \
3876 strstr \
barta72a27b2010-04-29 06:22:17 +00003877 syscall \
bartf5ceec82008-04-26 07:45:10 +00003878 utimensat \
tom9e4b6362012-02-10 09:39:37 +00003879 process_vm_readv \
3880 process_vm_writev \
bartf5ceec82008-04-26 07:45:10 +00003881 ])
sewardjde4a1d02002-03-22 01:27:54 +00003882
bart623eec32008-07-29 17:54:49 +00003883# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
3884# libraries with any shared object and/or executable. This is NOT what we
3885# want for e.g. vgpreload_core-x86-linux.so
3886LIBS=""
sewardj80637752006-03-02 13:48:21 +00003887
bart6d45e922009-01-20 13:45:38 +00003888AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
3889 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00003890AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
3891 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00003892AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
3893 [test x$ac_cv_func_pthread_spin_lock = xyes])
florianc5325ef2013-09-17 20:15:36 +00003894AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
3895 [test x$ac_cv_func_pthread_setname_np = xyes])
bart6d45e922009-01-20 13:45:38 +00003896
petarjc37cea62013-06-02 18:08:04 +00003897if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3898 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
petarj6d79b742012-12-20 18:56:57 +00003899 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
petarjc37cea62013-06-02 18:08:04 +00003900 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
petarj6d79b742012-12-20 18:56:57 +00003901fi
njn7fd6d382009-01-22 21:56:32 +00003902
3903#----------------------------------------------------------------------------
3904# MPI checks
3905#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00003906# Do we have a useable MPI setup on the primary and/or secondary targets?
3907# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00003908# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00003909# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00003910# --with-mpicc=.
mjw46f25042014-08-21 10:04:04 +00003911AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
3912 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
sewardj03d86f22006-10-17 00:57:24 +00003913
sewardje9fa5062006-03-12 18:29:18 +00003914mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00003915if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00003916 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj5db15402012-06-07 09:13:21 +00003917 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +00003918 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +00003919 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
3920 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
sewardje9fa5062006-03-12 18:29:18 +00003921 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00003922elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00003923 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
sewardjf0c12502014-01-12 12:54:00 +00003924 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00003925 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00003926 mflag_primary=$FLAG_M64
philippef7c54332012-05-17 15:32:54 +00003927elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
3928 mflag_primary="$FLAG_M32 -arch i386"
3929elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
3930 mflag_primary="$FLAG_M64 -arch x86_64"
sewardje9fa5062006-03-12 18:29:18 +00003931fi
3932
sewardj03d86f22006-10-17 00:57:24 +00003933mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00003934if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +00003935 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
3936 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS ; then
sewardj03d86f22006-10-17 00:57:24 +00003937 mflag_secondary=$FLAG_M32
philippef7c54332012-05-17 15:32:54 +00003938elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
3939 mflag_secondary="$FLAG_M32 -arch i386"
sewardj03d86f22006-10-17 00:57:24 +00003940fi
3941
3942
sewardj0ad46092006-03-02 17:09:16 +00003943AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00003944 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00003945 MPI_CC=$withval
3946)
sewardj03d86f22006-10-17 00:57:24 +00003947AC_SUBST(MPI_CC)
3948
philippef7c54332012-05-17 15:32:54 +00003949## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
3950## use these values in the check for a functioning mpicc.
3951##
3952## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
3953## mflag_primary/mflag_secondary are sufficient approximations of that behavior
3954AM_COND_IF([VGCONF_OS_IS_LINUX],
3955 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3956 LDFLAGS_MPI="-fpic -shared"])
3957AM_COND_IF([VGCONF_OS_IS_DARWIN],
3958 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
3959 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
sewardj8eb8bab2015-07-21 14:44:28 +00003960AM_COND_IF([VGCONF_OS_IS_SOLARIS],
3961 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3962 LDFLAGS_MPI="-fpic -shared"])
philippef7c54332012-05-17 15:32:54 +00003963
3964AC_SUBST([CFLAGS_MPI])
3965AC_SUBST([LDFLAGS_MPI])
3966
3967
sewardj03d86f22006-10-17 00:57:24 +00003968## See if MPI_CC works for the primary target
3969##
3970AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00003971saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00003972saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00003973CC=$MPI_CC
philippef7c54332012-05-17 15:32:54 +00003974CFLAGS="$CFLAGS_MPI $mflag_primary"
3975saved_LDFLAGS="$LDFLAGS"
3976LDFLAGS="$LDFLAGS_MPI $mflag_primary"
bart417cf3e2011-10-22 09:21:24 +00003977AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj1a85e602006-03-08 15:26:10 +00003978#include <mpi.h>
3979#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00003980]], [[
philippef7c54332012-05-17 15:32:54 +00003981 int ni, na, nd, comb;
sewardjde4f3842006-03-09 02:41:41 +00003982 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00003983 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
3984 r |= MPI_Finalize();
sewardjde4f3842006-03-09 02:41:41 +00003985 return r;
bart417cf3e2011-10-22 09:21:24 +00003986]])], [
sewardj03d86f22006-10-17 00:57:24 +00003987ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00003988AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00003989], [
sewardj03d86f22006-10-17 00:57:24 +00003990ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00003991AC_MSG_RESULT([no])
3992])
sewardj0ad46092006-03-02 17:09:16 +00003993CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00003994CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00003995LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00003996AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00003997
sewardj03d86f22006-10-17 00:57:24 +00003998## See if MPI_CC works for the secondary target. Complication: what if
3999## there is no secondary target? We need this to then fail.
4000## Kludge this by making MPI_CC something which will surely fail in
4001## such a case.
4002##
4003AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
4004saved_CC=$CC
4005saved_CFLAGS=$CFLAGS
philippef7c54332012-05-17 15:32:54 +00004006saved_LDFLAGS="$LDFLAGS"
4007LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
njn7fd6d382009-01-22 21:56:32 +00004008if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00004009 CC="$MPI_CC this will surely fail"
4010else
4011 CC=$MPI_CC
4012fi
philippef7c54332012-05-17 15:32:54 +00004013CFLAGS="$CFLAGS_MPI $mflag_secondary"
bart417cf3e2011-10-22 09:21:24 +00004014AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj03d86f22006-10-17 00:57:24 +00004015#include <mpi.h>
4016#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00004017]], [[
philippef7c54332012-05-17 15:32:54 +00004018 int ni, na, nd, comb;
sewardj03d86f22006-10-17 00:57:24 +00004019 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00004020 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
4021 r |= MPI_Finalize();
sewardj03d86f22006-10-17 00:57:24 +00004022 return r;
bart417cf3e2011-10-22 09:21:24 +00004023]])], [
sewardj03d86f22006-10-17 00:57:24 +00004024ac_have_mpi2_sec=yes
4025AC_MSG_RESULT([yes, $MPI_CC])
4026], [
4027ac_have_mpi2_sec=no
4028AC_MSG_RESULT([no])
4029])
4030CC=$saved_CC
4031CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00004032LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00004033AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00004034
4035
njn7fd6d382009-01-22 21:56:32 +00004036#----------------------------------------------------------------------------
4037# Other library checks
4038#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00004039# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00004040# tests are present because Drd has some regression tests that use
4041# these packages. All regression test programs all compiled only
4042# for the primary target. And so it is important that the configure
4043# checks that follow, use the correct -m32 or -m64 flag for the
4044# primary target (called $mflag_primary). Otherwise, we can end up
4045# in a situation (eg) where, on amd64-linux, the test for Boost checks
4046# for usable 64-bit Boost facilities, but because we are doing a 32-bit
4047# only build (meaning, the primary target is x86-linux), the build
4048# of the regtest programs that use Boost fails, because they are
4049# build as 32-bit (IN THIS EXAMPLE).
4050#
4051# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
4052# NEEDED BY THE REGRESSION TEST PROGRAMS.
4053
4054
sewardj493c4ef2008-12-13 16:45:19 +00004055# Check whether the boost library 1.35 or later has been installed.
4056# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
4057
4058AC_MSG_CHECKING([for boost])
4059
4060AC_LANG(C++)
4061safe_CXXFLAGS=$CXXFLAGS
bart7129c722012-04-18 18:34:22 +00004062CXXFLAGS="$mflag_primary"
4063safe_LIBS="$LIBS"
bartce93f9e2014-06-12 07:45:23 +00004064LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00004065
bart128fc522011-03-12 10:36:35 +00004066AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00004067#include <boost/thread.hpp>
4068static void thread_func(void)
4069{ }
4070int main(int argc, char** argv)
4071{
4072 boost::thread t(thread_func);
4073 return 0;
4074}
bart128fc522011-03-12 10:36:35 +00004075])],
sewardj493c4ef2008-12-13 16:45:19 +00004076[
4077ac_have_boost_1_35=yes
4078AC_SUBST([BOOST_CFLAGS], [])
bartce93f9e2014-06-12 07:45:23 +00004079AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
sewardj493c4ef2008-12-13 16:45:19 +00004080AC_MSG_RESULT([yes])
4081], [
4082ac_have_boost_1_35=no
4083AC_MSG_RESULT([no])
4084])
4085
bart7129c722012-04-18 18:34:22 +00004086LIBS="$safe_LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00004087CXXFLAGS=$safe_CXXFLAGS
4088AC_LANG(C)
4089
4090AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
4091
4092
4093# does this compiler support -fopenmp, does it have the include file
4094# <omp.h> and does it have libgomp ?
4095
4096AC_MSG_CHECKING([for OpenMP])
4097
4098safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00004099CFLAGS="-fopenmp $mflag_primary -Werror"
sewardj493c4ef2008-12-13 16:45:19 +00004100
bart128fc522011-03-12 10:36:35 +00004101AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00004102#include <omp.h>
4103int main(int argc, char** argv)
4104{
4105 omp_set_dynamic(0);
4106 return 0;
4107}
bart128fc522011-03-12 10:36:35 +00004108])],
sewardj493c4ef2008-12-13 16:45:19 +00004109[
4110ac_have_openmp=yes
4111AC_MSG_RESULT([yes])
4112], [
4113ac_have_openmp=no
4114AC_MSG_RESULT([no])
4115])
4116CFLAGS=$safe_CFLAGS
4117
4118AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
4119
4120
florian60637d22014-10-29 08:21:18 +00004121# Check for __builtin_popcount
4122AC_MSG_CHECKING([for __builtin_popcount()])
4123AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4124]], [[
4125 __builtin_popcount(2);
4126 return 0;
4127]])], [
4128AC_MSG_RESULT([yes])
4129AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
4130 [Define to 1 if compiler provides __builtin_popcount().])
4131], [
4132AC_MSG_RESULT([no])
4133])
4134
4135# Check for __builtin_clz
4136AC_MSG_CHECKING([for __builtin_clz()])
4137AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4138]], [[
4139 __builtin_clz(2);
4140 return 0;
4141]])], [
4142AC_MSG_RESULT([yes])
4143AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
4144 [Define to 1 if compiler provides __builtin_clz().])
4145], [
4146AC_MSG_RESULT([no])
4147])
4148
4149# Check for __builtin_ctz
4150AC_MSG_CHECKING([for __builtin_ctz()])
4151AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4152]], [[
4153 __builtin_ctz(2);
4154 return 0;
4155]])], [
4156AC_MSG_RESULT([yes])
4157AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
4158 [Define to 1 if compiler provides __builtin_ctz().])
4159], [
4160AC_MSG_RESULT([no])
4161])
4162
bart78bfc712011-12-08 16:14:59 +00004163# does this compiler have built-in functions for atomic memory access for the
4164# primary target ?
4165AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
sewardjc876a2f2009-01-22 22:44:30 +00004166
4167safe_CFLAGS=$CFLAGS
4168CFLAGS="$mflag_primary"
4169
bart417cf3e2011-10-22 09:21:24 +00004170AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjc876a2f2009-01-22 22:44:30 +00004171 int variable = 1;
4172 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4173 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00004174]])], [
bartb4ff7822011-12-10 19:48:04 +00004175 ac_have_builtin_atomic_primary=yes
sewardjc876a2f2009-01-22 22:44:30 +00004176 AC_MSG_RESULT([yes])
bart78bfc712011-12-08 16:14:59 +00004177 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])
bart417cf3e2011-10-22 09:21:24 +00004178], [
bartb4ff7822011-12-10 19:48:04 +00004179 ac_have_builtin_atomic_primary=no
sewardjc876a2f2009-01-22 22:44:30 +00004180 AC_MSG_RESULT([no])
4181])
4182
4183CFLAGS=$safe_CFLAGS
4184
bartb4ff7822011-12-10 19:48:04 +00004185AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
4186 [test x$ac_have_builtin_atomic_primary = xyes])
bartc82d1372009-05-31 16:21:23 +00004187
bart78bfc712011-12-08 16:14:59 +00004188
4189# does this compiler have built-in functions for atomic memory access for the
4190# secondary target ?
4191
4192if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4193
4194AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
4195
4196safe_CFLAGS=$CFLAGS
4197CFLAGS="$mflag_secondary"
4198
4199AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4200 int variable = 1;
4201 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
4202]])], [
4203 ac_have_builtin_atomic_secondary=yes
4204 AC_MSG_RESULT([yes])
4205], [
4206 ac_have_builtin_atomic_secondary=no
4207 AC_MSG_RESULT([no])
4208])
4209
4210CFLAGS=$safe_CFLAGS
4211
4212fi
4213
4214AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
4215 [test x$ac_have_builtin_atomic_secondary = xyes])
4216
bart1e856ea2011-12-17 12:53:23 +00004217# does this compiler have built-in functions for atomic memory access on
4218# 64-bit integers for all targets ?
4219
4220AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
4221
4222AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4223 #include <stdint.h>
4224]], [[
4225 uint64_t variable = 1;
4226 return __sync_add_and_fetch(&variable, 1)
4227]])], [
4228 ac_have_builtin_atomic64_primary=yes
4229], [
4230 ac_have_builtin_atomic64_primary=no
4231])
4232
4233if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4234
4235safe_CFLAGS=$CFLAGS
4236CFLAGS="$mflag_secondary"
4237
4238AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4239 #include <stdint.h>
4240]], [[
4241 uint64_t variable = 1;
4242 return __sync_add_and_fetch(&variable, 1)
4243]])], [
4244 ac_have_builtin_atomic64_secondary=yes
4245], [
4246 ac_have_builtin_atomic64_secondary=no
4247])
4248
4249CFLAGS=$safe_CFLAGS
4250
4251fi
4252
4253if test x$ac_have_builtin_atomic64_primary = xyes && \
4254 test x$VGCONF_PLATFORM_SEC_CAPS = x \
4255 -o x$ac_have_builtin_atomic64_secondary = xyes; then
4256 AC_MSG_RESULT([yes])
4257 ac_have_builtin_atomic64=yes
4258else
4259 AC_MSG_RESULT([no])
4260 ac_have_builtin_atomic64=no
4261fi
4262
4263AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
4264 [test x$ac_have_builtin_atomic64 = xyes])
4265
bart78bfc712011-12-08 16:14:59 +00004266
barte8740422011-03-24 20:27:54 +00004267# does g++ have built-in functions for atomic memory access ?
bart78bfc712011-12-08 16:14:59 +00004268AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
barte8740422011-03-24 20:27:54 +00004269
4270safe_CXXFLAGS=$CXXFLAGS
4271CXXFLAGS="$mflag_primary"
4272
4273AC_LANG_PUSH(C++)
bart417cf3e2011-10-22 09:21:24 +00004274AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
barte8740422011-03-24 20:27:54 +00004275 int variable = 1;
4276 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4277 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00004278]])], [
barte8740422011-03-24 20:27:54 +00004279 ac_have_builtin_atomic_cxx=yes
4280 AC_MSG_RESULT([yes])
4281 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
bart417cf3e2011-10-22 09:21:24 +00004282], [
barte8740422011-03-24 20:27:54 +00004283 ac_have_builtin_atomic_cxx=no
4284 AC_MSG_RESULT([no])
4285])
4286AC_LANG_POP(C++)
4287
4288CXXFLAGS=$safe_CXXFLAGS
4289
4290AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00004291
bart78bfc712011-12-08 16:14:59 +00004292
4293if test x$ac_have_usable_linux_futex_h = xyes \
bartb4ff7822011-12-10 19:48:04 +00004294 -a x$ac_have_builtin_atomic_primary = xyes; then
bart78bfc712011-12-08 16:14:59 +00004295 ac_enable_linux_ticket_lock_primary=yes
4296fi
4297AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
4298 [test x$ac_enable_linux_ticket_lock_primary = xyes])
4299
4300if test x$VGCONF_PLATFORM_SEC_CAPS != x \
4301 -a x$ac_have_usable_linux_futex_h = xyes \
4302 -a x$ac_have_builtin_atomic_secondary = xyes; then
4303 ac_enable_linux_ticket_lock_secondary=yes
4304fi
4305AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
4306 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
4307
4308
bartf68af882011-12-10 19:42:05 +00004309# does libstdc++ support annotating shared pointers ?
4310AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
4311
floriand79b3bf2013-10-02 15:14:59 +00004312safe_CXXFLAGS=$CXXFLAGS
bartf68af882011-12-10 19:42:05 +00004313CXXFLAGS="-std=c++0x"
4314
4315AC_LANG_PUSH(C++)
4316AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4317 #include <memory>
4318]], [[
4319 std::shared_ptr<int> p
4320]])], [
4321 ac_have_shared_ptr=yes
4322], [
4323 ac_have_shared_ptr=no
4324])
4325if test x$ac_have_shared_ptr = xyes; then
4326 # If compilation of the program below fails because of a syntax error
4327 # triggered by substituting one of the annotation macros then that
4328 # means that libstdc++ supports these macros.
4329 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4330 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
4331 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
4332 #include <memory>
4333 ]], [[
4334 std::shared_ptr<int> p
4335 ]])], [
4336 ac_have_shared_pointer_annotation=no
4337 AC_MSG_RESULT([no])
4338 ], [
4339 ac_have_shared_pointer_annotation=yes
4340 AC_MSG_RESULT([yes])
4341 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
4342 [Define to 1 if libstd++ supports annotating shared pointers])
4343 ])
4344else
4345 ac_have_shared_pointer_annotation=no
4346 AC_MSG_RESULT([no])
4347fi
4348AC_LANG_POP(C++)
4349
4350CXXFLAGS=$safe_CXXFLAGS
4351
4352AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
4353 [test x$ac_have_shared_pointer_annotation = xyes])
4354
4355
njn7fd6d382009-01-22 21:56:32 +00004356#----------------------------------------------------------------------------
4357# Ok. We're done checking.
4358#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00004359
njn8b68b642009-06-24 00:37:09 +00004360# Nb: VEX/Makefile is generated from Makefile.vex.in.
4361AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00004362 Makefile
njn8b68b642009-06-24 00:37:09 +00004363 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00004364 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00004365 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00004366 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00004367 docs/Makefile
4368 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00004369 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00004370 perf/Makefile
4371 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00004372 gdbserver_tests/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004373 gdbserver_tests/solaris/Makefile
njn254d542432002-09-23 16:09:39 +00004374 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00004375 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00004376 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00004377 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004378 memcheck/Makefile
4379 memcheck/tests/Makefile
floriane42cca52013-08-29 17:59:27 +00004380 memcheck/tests/common/Makefile
njnc6168192004-11-29 13:54:10 +00004381 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00004382 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00004383 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00004384 memcheck/tests/darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004385 memcheck/tests/solaris/Makefile
njnea2d6fd2010-07-01 00:20:20 +00004386 memcheck/tests/amd64-linux/Makefile
Elliott Hughesa0664b92017-04-18 17:46:52 -07004387 memcheck/tests/arm64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00004388 memcheck/tests/x86-linux/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004389 memcheck/tests/amd64-solaris/Makefile
4390 memcheck/tests/x86-solaris/Makefile
sewardj0e342a02010-09-03 23:49:33 +00004391 memcheck/tests/ppc32/Makefile
4392 memcheck/tests/ppc64/Makefile
florian0bb707e2012-05-30 20:46:58 +00004393 memcheck/tests/s390x/Makefile
Elliott Hughesed398002017-06-21 14:41:24 -07004394 memcheck/tests/mips32/Makefile
4395 memcheck/tests/mips64/Makefile
florianbb913cd2012-08-28 16:50:39 +00004396 memcheck/tests/vbit-test/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004397 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004398 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00004399 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00004400 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00004401 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00004402 callgrind/Makefile
4403 callgrind/callgrind_annotate
4404 callgrind/callgrind_control
4405 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004406 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00004407 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00004408 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00004409 massif/tests/Makefile
njnd5a8d242007-11-02 20:44:57 +00004410 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00004411 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00004412 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004413 none/Makefile
4414 none/tests/Makefile
florian0a6d8972015-04-03 15:47:19 +00004415 none/tests/scripts/Makefile
njnc6168192004-11-29 13:54:10 +00004416 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00004417 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00004418 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00004419 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00004420 none/tests/arm/Makefile
sewardjf02d2ec2014-08-26 19:28:09 +00004421 none/tests/arm64/Makefile
sewardjb5b87402011-03-07 16:05:35 +00004422 none/tests/s390x/Makefile
sewardj5db15402012-06-07 09:13:21 +00004423 none/tests/mips32/Makefile
petarj8bea8672013-05-10 13:14:54 +00004424 none/tests/mips64/Makefile
njn0458a122009-02-13 06:23:46 +00004425 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00004426 none/tests/darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004427 none/tests/solaris/Makefile
florian7d4a28b2015-04-23 15:20:00 +00004428 none/tests/amd64-linux/Makefile
njn06ca3322009-04-15 23:10:04 +00004429 none/tests/x86-linux/Makefile
rhyskidd0dc35262015-05-28 12:49:00 +00004430 none/tests/amd64-darwin/Makefile
4431 none/tests/x86-darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004432 none/tests/amd64-solaris/Makefile
4433 none/tests/x86-solaris/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00004434 exp-sgcheck/Makefile
4435 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00004436 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00004437 drd/scripts/download-and-build-splash2
4438 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00004439 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00004440 exp-bbv/tests/Makefile
4441 exp-bbv/tests/x86/Makefile
4442 exp-bbv/tests/x86-linux/Makefile
4443 exp-bbv/tests/amd64-linux/Makefile
4444 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00004445 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00004446 exp-dhat/Makefile
4447 exp-dhat/tests/Makefile
mjwaeacd282014-03-11 19:30:32 +00004448 shared/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004449 solaris/Makefile
njn8b68b642009-06-24 00:37:09 +00004450])
sewardjd3645802010-06-13 22:13:58 +00004451AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
4452 [chmod +x coregrind/link_tool_exe_linux])
4453AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
4454 [chmod +x coregrind/link_tool_exe_darwin])
sewardj8eb8bab2015-07-21 14:44:28 +00004455AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
4456 [chmod +x coregrind/link_tool_exe_solaris])
njn8b68b642009-06-24 00:37:09 +00004457AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00004458
4459cat<<EOF
4460
njn311303f2009-02-06 03:46:50 +00004461 Maximum build arch: ${ARCH_MAX}
4462 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00004463 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00004464 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00004465 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
4466 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardjcb495c82011-07-11 20:42:34 +00004467 Platform variant: ${VGCONF_PLATVARIANT}
4468 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
sewardje95d94f2008-09-19 09:02:19 +00004469 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00004470
gobry3b777892002-04-04 09:18:39 +00004471EOF