blob: 7189fa8fb1290951e177661d83231d094662944f [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.
sewardja19c8182014-09-12 09:31:13 +000011AC_INIT([Valgrind],[3.11.0.SVN],[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
rhyskidd9090d2f2015-07-08 13:46:57 +0000157 applellvm-5.1|applellvm-6.*|applellvm-7.*)
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 ;;
bartfec24472014-09-13 09:42:29 +0000163 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 *)
sewardj3ab7b662011-09-29 17:30:13 +0000170 AC_MSG_RESULT([no (${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
195# Valgrind code, the ARCH_MAX name will state LE or BE for the endianess of
196# the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
197# The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
198# Endianess. The name PPC64 or ppc64 to 64-bit systems of either Endianess.
199# The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
200# Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
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
272 tilegx)
273 AC_MSG_RESULT([ok (${host_cpu})])
274 ARCH_MAX="tilegx"
275 ;;
276
sewardjde4a1d02002-03-22 01:27:54 +0000277 *)
278 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000279 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000280 ;;
281esac
282
njn7fd6d382009-01-22 21:56:32 +0000283#----------------------------------------------------------------------------
284
sewardj86e992f2006-01-28 18:39:09 +0000285# Sometimes it's convenient to subvert the bi-arch build system and
286# just have a single build even though the underlying platform is
287# capable of both. Hence handle --enable-only64bit and
288# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000289# [Actually, if either of these options are used, I think both get built,
290# but only one gets installed. So if you use an in-place build, both can be
291# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000292
293# Check if a 64-bit only build has been requested
294AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
295 [AC_ARG_ENABLE(only64bit,
296 [ --enable-only64bit do a 64-bit only build],
297 [vg_cv_only64bit=$enableval],
298 [vg_cv_only64bit=no])])
299
300# Check if a 32-bit only build has been requested
301AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
302 [AC_ARG_ENABLE(only32bit,
303 [ --enable-only32bit do a 32-bit only build],
304 [vg_cv_only32bit=$enableval],
305 [vg_cv_only32bit=no])])
306
307# Stay sane
308if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
309 AC_MSG_ERROR(
310 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
311fi
312
njn7fd6d382009-01-22 21:56:32 +0000313#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000314
njn311303f2009-02-06 03:46:50 +0000315# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
316# compilation of many C files via -VGO_$(VGCONF_OS) and
317# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000318AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000319AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000320
njnf76d27a2009-05-28 01:53:07 +0000321DEFAULT_SUPP=""
322
gobrye721a522002-03-22 13:38:30 +0000323case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000324 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000325 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000326 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000327
328 # Ok, this is linux. Check the kernel version
329 AC_MSG_CHECKING([for the kernel version])
330
331 kernel=`uname -r`
332
333 case "${kernel}" in
cborntra0e8dd912015-02-23 20:19:03 +0000334 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
mueller8c68e042004-01-03 15:21:14 +0000335 AC_MSG_RESULT([unsupported (${kernel})])
cborntra0e8dd912015-02-23 20:19:03 +0000336 AC_MSG_ERROR([Valgrind needs a Linux kernel >= 2.6])
mueller8c68e042004-01-03 15:21:14 +0000337 ;;
cborntra0e8dd912015-02-23 20:19:03 +0000338
339 *)
340 AC_MSG_RESULT([2.6 or later (${kernel})])
341 ;;
mueller8c68e042004-01-03 15:21:14 +0000342 esac
343
344 ;;
345
njnf76d27a2009-05-28 01:53:07 +0000346 *darwin*)
347 AC_MSG_RESULT([ok (${host_os})])
348 VGCONF_OS="darwin"
njnea2d6fd2010-07-01 00:20:20 +0000349 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
350 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
351 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
sewardjae284e52012-08-02 18:25:04 +0000352 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
sewardjec66ad52014-06-20 11:48:38 +0000353 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
sewardjac3afbd2014-11-06 20:16:05 +0000354 AC_DEFINE([DARWIN_10_10], 101000, [DARWIN_VERS value for Mac OS X 10.10])
rhyskidd9090d2f2015-07-08 13:46:57 +0000355 AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11])
njnf76d27a2009-05-28 01:53:07 +0000356
357 AC_MSG_CHECKING([for the kernel version])
358 kernel=`uname -r`
359
360 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
361 # has only one relevant version, the OS version. The `uname` check
362 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
sewardj731f9cf2011-09-21 08:43:08 +0000363 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
364 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
njnea2d6fd2010-07-01 00:20:20 +0000365 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000366 #
367 # XXX: `uname -r` won't do the right thing for cross-compiles, but
368 # that's not a problem yet.
sewardj731f9cf2011-09-21 08:43:08 +0000369 #
370 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
371 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
372 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
373 # time support for 10.5 (the 9.* pattern just below), I'll leave it
374 # in for now, just in case anybody wants to give it a try. But I'm
375 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
njnf76d27a2009-05-28 01:53:07 +0000376 case "${kernel}" in
377 9.*)
378 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000379 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000380 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000381 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000382 ;;
njnea2d6fd2010-07-01 00:20:20 +0000383 10.*)
384 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
385 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
386 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
387 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
388 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000389 11.*)
390 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
391 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
sewardj731f9cf2011-09-21 08:43:08 +0000392 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
393 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
394 ;;
sewardjae284e52012-08-02 18:25:04 +0000395 12.*)
396 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
397 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
398 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
399 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
400 ;;
sewardjec66ad52014-06-20 11:48:38 +0000401 13.*)
402 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
403 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
404 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
405 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
406 ;;
sewardjac3afbd2014-11-06 20:16:05 +0000407 14.*)
408 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
409 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
410 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
411 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
412 ;;
rhyskidd9090d2f2015-07-08 13:46:57 +0000413 15.*)
414 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
415 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
416 DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
417 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
418 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000419 *)
njnf76d27a2009-05-28 01:53:07 +0000420 AC_MSG_RESULT([unsupported (${kernel})])
rhyskidd9090d2f2015-07-08 13:46:57 +0000421 AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x and 15.x (Mac OS X 10.6/7/8/9/10/11)])
njnf76d27a2009-05-28 01:53:07 +0000422 ;;
423 esac
424 ;;
425
sewardj8eb8bab2015-07-21 14:44:28 +0000426 solaris2.11*)
427 AC_MSG_RESULT([ok (${host_os})])
428 VGCONF_OS="solaris"
429 DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
430 ;;
431
432 solaris2.12*)
433 AC_MSG_RESULT([ok (${host_os})])
434 VGCONF_OS="solaris"
435 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
436 ;;
437
sewardjde4a1d02002-03-22 01:27:54 +0000438 *)
439 AC_MSG_RESULT([no (${host_os})])
njncc58cea2010-07-05 07:21:22 +0000440 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
sewardjde4a1d02002-03-22 01:27:54 +0000441 ;;
442esac
443
njn7fd6d382009-01-22 21:56:32 +0000444#----------------------------------------------------------------------------
445
tomd6398392006-06-07 17:44:36 +0000446# If we are building on a 64 bit platform test to see if the system
447# supports building 32 bit programs and disable 32 bit support if it
448# does not support building 32 bit programs
449
njn7fd6d382009-01-22 21:56:32 +0000450case "$ARCH_MAX-$VGCONF_OS" in
sewardj8eb8bab2015-07-21 14:44:28 +0000451 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
tomd6398392006-06-07 17:44:36 +0000452 AC_MSG_CHECKING([for 32 bit build support])
453 safe_CFLAGS=$CFLAGS
454 CFLAGS="-m32"
bart417cf3e2011-10-22 09:21:24 +0000455 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +0000456 return 0;
bart417cf3e2011-10-22 09:21:24 +0000457 ]])], [
tomd6398392006-06-07 17:44:36 +0000458 AC_MSG_RESULT([yes])
459 ], [
460 vg_cv_only64bit="yes"
461 AC_MSG_RESULT([no])
462 ])
463 CFLAGS=$safe_CFLAGS;;
464esac
465
466if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
467 AC_MSG_ERROR(
468 [--enable-only32bit was specified but system does not support 32 bit builds])
469fi
nethercote888ecb72004-08-23 14:54:40 +0000470
njn7fd6d382009-01-22 21:56:32 +0000471#----------------------------------------------------------------------------
472
njn311303f2009-02-06 03:46:50 +0000473# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
474# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
475# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
476# above) will be "amd64" since that reflects the most that this cpu can do,
477# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
478# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000479# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
480# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
481AC_SUBST(VGCONF_ARCH_PRI)
482
njn3f8a6e92009-06-02 00:20:47 +0000483# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
484# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
485# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
486# It is empty if there is no secondary target.
487AC_SUBST(VGCONF_ARCH_SEC)
488
njn311303f2009-02-06 03:46:50 +0000489# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
490# The entire system, including regression and performance tests, will be
491# built for this target. The "_CAPS" indicates that the name is in capital
492# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000493# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000494# convention and cannot contain '-' characters. This is in contrast to
495# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000496AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
497
498# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
499# Valgrind and tools will also be built for this target, but not the
500# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000501#
njn7fd6d382009-01-22 21:56:32 +0000502# By default, the primary arch is the same as the "max" arch, as commented
503# above (at the definition of ARCH_MAX). We may choose to downgrade it in
504# the big case statement just below here, in the case where we're building
505# on a 64 bit machine but have been requested only to do a 32 bit build.
506AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
507
sewardj01262142006-01-04 01:20:28 +0000508AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000509
njnea2d6fd2010-07-01 00:20:20 +0000510# NB. The load address for a given platform may be specified in more
511# than one place, in some cases, depending on whether we're doing a biarch,
512# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
513# Be careful to give consistent values in all subcases. Also, all four
514# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
515# even if it is to "0xUNSET".
516#
njn7fd6d382009-01-22 21:56:32 +0000517case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000518 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000519 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000520 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000521 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
522 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000523 valt_load_address_pri_norml="0x38000000"
524 valt_load_address_pri_inner="0x28000000"
525 valt_load_address_sec_norml="0xUNSET"
526 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000527 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000528 ;;
529 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000530 valt_load_address_sec_norml="0xUNSET"
531 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000532 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000533 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000534 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000535 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
536 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000537 valt_load_address_pri_norml="0x38000000"
538 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000539 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000540 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000541 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000542 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
543 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000544 valt_load_address_pri_norml="0x38000000"
545 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000546 else
njn7fd6d382009-01-22 21:56:32 +0000547 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000548 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000549 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
550 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000551 valt_load_address_pri_norml="0x38000000"
552 valt_load_address_pri_inner="0x28000000"
553 valt_load_address_sec_norml="0x38000000"
554 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000555 fi
njn377c43f2009-05-19 07:39:22 +0000556 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000557 ;;
558 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000559 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000560 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000561 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
562 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000563 valt_load_address_pri_norml="0x38000000"
564 valt_load_address_pri_inner="0x28000000"
565 valt_load_address_sec_norml="0xUNSET"
566 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000567 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000568 ;;
carllcae0cc22014-08-07 23:17:29 +0000569 ppc64be-linux)
njnea2d6fd2010-07-01 00:20:20 +0000570 valt_load_address_sec_norml="0xUNSET"
571 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000572 if test x$vg_cv_only64bit = xyes; then
carllcae0cc22014-08-07 23:17:29 +0000573 VGCONF_ARCH_PRI="ppc64be"
njn3f8a6e92009-06-02 00:20:47 +0000574 VGCONF_ARCH_SEC=""
carllcae0cc22014-08-07 23:17:29 +0000575 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
njn7fd6d382009-01-22 21:56:32 +0000576 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000577 valt_load_address_pri_norml="0x38000000"
578 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000579 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000580 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000581 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000582 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
583 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000584 valt_load_address_pri_norml="0x38000000"
585 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000586 else
carllcae0cc22014-08-07 23:17:29 +0000587 VGCONF_ARCH_PRI="ppc64be"
njn3f8a6e92009-06-02 00:20:47 +0000588 VGCONF_ARCH_SEC="ppc32"
carllcae0cc22014-08-07 23:17:29 +0000589 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
njn7fd6d382009-01-22 21:56:32 +0000590 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000591 valt_load_address_pri_norml="0x38000000"
592 valt_load_address_pri_inner="0x28000000"
593 valt_load_address_sec_norml="0x38000000"
594 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000595 fi
njn377c43f2009-05-19 07:39:22 +0000596 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000597 ;;
carllcae0cc22014-08-07 23:17:29 +0000598 ppc64le-linux)
599 # Little Endian is only supported on PPC64
600 valt_load_address_sec_norml="0xUNSET"
601 valt_load_address_sec_inner="0xUNSET"
602 VGCONF_ARCH_PRI="ppc64le"
603 VGCONF_ARCH_SEC=""
604 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
605 VGCONF_PLATFORM_SEC_CAPS=""
606 valt_load_address_pri_norml="0x38000000"
607 valt_load_address_pri_inner="0x28000000"
608 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
609 ;;
njncc58cea2010-07-05 07:21:22 +0000610 # Darwin gets identified as 32-bit even when it supports 64-bit.
611 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
612 # all Macs support both 32-bit and 64-bit, so we just build both. If
613 # someone has a really old 32-bit only machine they can (hopefully?)
614 # build with --enable-only32bit. See bug 243362.
615 x86-darwin|amd64-darwin)
616 ARCH_MAX="amd64"
njnea2d6fd2010-07-01 00:20:20 +0000617 valt_load_address_sec_norml="0xUNSET"
618 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000619 if test x$vg_cv_only64bit = xyes; then
620 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000621 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000622 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
623 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000624 valt_load_address_pri_norml="0x138000000"
625 valt_load_address_pri_inner="0x128000000"
njnf76d27a2009-05-28 01:53:07 +0000626 elif test x$vg_cv_only32bit = xyes; then
627 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000628 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000629 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
630 VGCONF_PLATFORM_SEC_CAPS=""
631 VGCONF_ARCH_PRI_CAPS="x86"
njnea2d6fd2010-07-01 00:20:20 +0000632 valt_load_address_pri_norml="0x38000000"
633 valt_load_address_pri_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000634 else
635 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000636 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000637 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
638 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
njnea2d6fd2010-07-01 00:20:20 +0000639 valt_load_address_pri_norml="0x138000000"
640 valt_load_address_pri_inner="0x128000000"
641 valt_load_address_sec_norml="0x38000000"
642 valt_load_address_sec_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000643 fi
njnf76d27a2009-05-28 01:53:07 +0000644 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
645 ;;
sewardj59570ff2010-01-01 11:59:33 +0000646 arm-linux)
647 VGCONF_ARCH_PRI="arm"
648 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
649 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000650 valt_load_address_pri_norml="0x38000000"
651 valt_load_address_pri_inner="0x28000000"
652 valt_load_address_sec_norml="0xUNSET"
653 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000654 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
655 ;;
sewardjf0c12502014-01-12 12:54:00 +0000656 arm64-linux)
657 valt_load_address_sec_norml="0xUNSET"
658 valt_load_address_sec_inner="0xUNSET"
659 if test x$vg_cv_only64bit = xyes; then
660 VGCONF_ARCH_PRI="arm64"
661 VGCONF_ARCH_SEC=""
662 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
663 VGCONF_PLATFORM_SEC_CAPS=""
664 valt_load_address_pri_norml="0x38000000"
665 valt_load_address_pri_inner="0x28000000"
666 elif test x$vg_cv_only32bit = xyes; then
667 VGCONF_ARCH_PRI="arm"
668 VGCONF_ARCH_SEC=""
669 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
670 VGCONF_PLATFORM_SEC_CAPS=""
671 valt_load_address_pri_norml="0x38000000"
672 valt_load_address_pri_inner="0x28000000"
673 else
674 VGCONF_ARCH_PRI="arm64"
675 VGCONF_ARCH_SEC="arm"
676 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
677 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
678 valt_load_address_pri_norml="0x38000000"
679 valt_load_address_pri_inner="0x28000000"
680 valt_load_address_sec_norml="0x38000000"
681 valt_load_address_sec_inner="0x28000000"
682 fi
683 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
684 ;;
sewardjb5b87402011-03-07 16:05:35 +0000685 s390x-linux)
686 VGCONF_ARCH_PRI="s390x"
687 VGCONF_ARCH_SEC=""
688 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
689 VGCONF_PLATFORM_SEC_CAPS=""
cborntraf4c46902013-10-23 16:23:30 +0000690 # To improve branch prediction hit rate we want to have
691 # the generated code close to valgrind (host) code
692 valt_load_address_pri_norml="0x800000000"
693 valt_load_address_pri_inner="0x810000000"
sewardjb5b87402011-03-07 16:05:35 +0000694 valt_load_address_sec_norml="0xUNSET"
695 valt_load_address_sec_inner="0xUNSET"
696 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
697 ;;
sewardj5db15402012-06-07 09:13:21 +0000698 mips32-linux)
699 VGCONF_ARCH_PRI="mips32"
700 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
701 VGCONF_PLATFORM_SEC_CAPS=""
702 valt_load_address_pri_norml="0x38000000"
703 valt_load_address_pri_inner="0x28000000"
704 valt_load_address_sec_norml="0xUNSET"
705 valt_load_address_sec_inner="0xUNSET"
706 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
petarj4df0bfc2013-02-27 23:17:33 +0000707 ;;
708 mips64-linux)
709 VGCONF_ARCH_PRI="mips64"
710 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
711 VGCONF_PLATFORM_SEC_CAPS=""
712 valt_load_address_pri_norml="0x38000000"
713 valt_load_address_pri_inner="0x28000000"
714 valt_load_address_sec_norml="0xUNSET"
715 valt_load_address_sec_inner="0xUNSET"
716 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj5db15402012-06-07 09:13:21 +0000717 ;;
sewardj112711a2015-04-10 12:30:09 +0000718 tilegx-linux)
719 VGCONF_ARCH_PRI="tilegx"
720 VGCONF_ARCH_SEC=""
721 VGCONF_PLATFORM_PRI_CAPS="TILEGX_LINUX"
722 VGCONF_PLATFORM_SEC_CAPS=""
723 valt_load_address_pri_norml="0x38000000"
724 valt_load_address_pri_inner="0x28000000"
725 valt_load_address_sec_norml="0xUNSET"
726 valt_load_address_sec_inner="0xUNSET"
727 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
728 ;;
sewardj8eb8bab2015-07-21 14:44:28 +0000729 x86-solaris)
730 VGCONF_ARCH_PRI="x86"
731 VGCONF_ARCH_SEC=""
732 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
733 VGCONF_PLATFORM_SEC_CAPS=""
734 valt_load_address_pri_norml="0x38000000"
735 valt_load_address_pri_inner="0x28000000"
736 valt_load_address_sec_norml="0xUNSET"
737 valt_load_address_sec_inner="0xUNSET"
738 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
739 ;;
740 amd64-solaris)
741 valt_load_address_sec_norml="0xUNSET"
742 valt_load_address_sec_inner="0xUNSET"
743 if test x$vg_cv_only64bit = xyes; then
744 VGCONF_ARCH_PRI="amd64"
745 VGCONF_ARCH_SEC=""
746 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
747 VGCONF_PLATFORM_SEC_CAPS=""
748 valt_load_address_pri_norml="0x38000000"
749 valt_load_address_pri_inner="0x28000000"
750 elif test x$vg_cv_only32bit = xyes; then
751 VGCONF_ARCH_PRI="x86"
752 VGCONF_ARCH_SEC=""
753 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
754 VGCONF_PLATFORM_SEC_CAPS=""
755 valt_load_address_pri_norml="0x38000000"
756 valt_load_address_pri_inner="0x28000000"
757 else
758 VGCONF_ARCH_PRI="amd64"
759 VGCONF_ARCH_SEC="x86"
760 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
761 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
762 valt_load_address_pri_norml="0x38000000"
763 valt_load_address_pri_inner="0x28000000"
764 valt_load_address_sec_norml="0x38000000"
765 valt_load_address_sec_inner="0x28000000"
766 fi
767 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
768 ;;
nethercote888ecb72004-08-23 14:54:40 +0000769 *)
njn7fd6d382009-01-22 21:56:32 +0000770 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000771 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000772 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
773 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000774 valt_load_address_pri_norml="0xUNSET"
775 valt_load_address_pri_inner="0xUNSET"
776 valt_load_address_sec_norml="0xUNSET"
777 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000778 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000779 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000780 ;;
781esac
sewardjde4a1d02002-03-22 01:27:54 +0000782
njn7fd6d382009-01-22 21:56:32 +0000783#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000784
njn7fd6d382009-01-22 21:56:32 +0000785# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
786# defined.
787AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
788 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000789 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
790 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
sewardj8eb8bab2015-07-21 14:44:28 +0000791 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
792 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
793 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
njn7fd6d382009-01-22 21:56:32 +0000794AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000795 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +0000796 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
797 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
njn7fd6d382009-01-22 21:56:32 +0000798AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
799 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj6e9de462011-06-28 07:25:29 +0000800 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000801AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
carllcae0cc22014-08-07 23:17:29 +0000802 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
803 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
sewardj59570ff2010-01-01 11:59:33 +0000804AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
sewardjf0c12502014-01-12 12:54:00 +0000805 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
806 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
807AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
808 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
sewardjb5b87402011-03-07 16:05:35 +0000809AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
810 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
sewardj5db15402012-06-07 09:13:21 +0000811AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
812 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
petarj4df0bfc2013-02-27 23:17:33 +0000813AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
814 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
sewardj112711a2015-04-10 12:30:09 +0000815AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_TILEGX,
816 test x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000817
njn7fd6d382009-01-22 21:56:32 +0000818# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
819# become defined.
820AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
821 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
822 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
823AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
824 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
825AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
826 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
827 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
carllcae0cc22014-08-07 23:17:29 +0000828AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
829 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
830AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
831 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000832AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
sewardjf0c12502014-01-12 12:54:00 +0000833 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
834 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
835AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
836 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
sewardjb5b87402011-03-07 16:05:35 +0000837AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
838 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
839 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
sewardj5db15402012-06-07 09:13:21 +0000840AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
841 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
petarj4df0bfc2013-02-27 23:17:33 +0000842AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
843 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
sewardj112711a2015-04-10 12:30:09 +0000844AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_TILEGX_LINUX,
845 test x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000846AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
847 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
848 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
849AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
850 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj8eb8bab2015-07-21 14:44:28 +0000851AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
852 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
853 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
854AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
855 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
njnf76d27a2009-05-28 01:53:07 +0000856
857
sewardj72a2d802010-07-29 05:24:20 +0000858# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000859# Relies on the assumption that the primary and secondary targets are
860# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000861AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
862 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
863 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
864 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
carllcae0cc22014-08-07 23:17:29 +0000865 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
866 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
sewardjb5b87402011-03-07 16:05:35 +0000867 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
sewardjf0c12502014-01-12 12:54:00 +0000868 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
sewardj5db15402012-06-07 09:13:21 +0000869 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +0000870 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
sewardj112711a2015-04-10 12:30:09 +0000871 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
872 -o x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000873AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
874 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
875 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj8eb8bab2015-07-21 14:44:28 +0000876AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
877 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
878 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
sewardj03d86f22006-10-17 00:57:24 +0000879
880
njn7fd6d382009-01-22 21:56:32 +0000881# Sometimes, in the Makefile.am files, it's useful to know whether or not
882# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000883AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000884 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000885
philippef32cbe82012-05-18 16:48:20 +0000886dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
887dnl fallback definition
888dnl The macro is courtesy of Dave Hart:
889dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
890m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
891if test -z "$$1_TRUE"; then :
892 m4_n([$2])[]dnl
893m4_ifval([$3],
894[else
895 $3
896])dnl
897fi[]dnl
898])])
tomb637bad2005-11-08 12:28:35 +0000899
njn7fd6d382009-01-22 21:56:32 +0000900#----------------------------------------------------------------------------
901# Inner Valgrind?
902#----------------------------------------------------------------------------
903
njnd74b0ef2009-01-20 06:06:52 +0000904# Check if this should be built as an inner Valgrind, to be run within
905# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000906AC_SUBST(VALT_LOAD_ADDRESS_PRI)
907AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000908AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
909 [AC_ARG_ENABLE(inner,
910 [ --enable-inner enables self-hosting],
911 [vg_cv_inner=$enableval],
912 [vg_cv_inner=no])])
913if test "$vg_cv_inner" = yes; then
914 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000915 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
916 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000917else
njnea2d6fd2010-07-01 00:20:20 +0000918 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
919 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000920fi
921
florianbb1a7872015-03-10 16:13:59 +0000922#----------------------------------------------------------------------------
923# Undefined behaviour sanitiser
924#----------------------------------------------------------------------------
925# Check whether we should build with the undefined beahviour sanitiser.
926
927AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
928 [AC_ARG_ENABLE(ubsan,
929 [ --enable-ubsan enables the undefined behaviour sanitiser],
930 [vg_cv_ubsan=$enableval],
931 [vg_cv_ubsan=no])])
njnd74b0ef2009-01-20 06:06:52 +0000932
njn7fd6d382009-01-22 21:56:32 +0000933#----------------------------------------------------------------------------
sewardj5db15402012-06-07 09:13:21 +0000934# Define MIPS_PAGE_SHIFT (--with-pagesize)
935#----------------------------------------------------------------------------
936AC_ARG_WITH(pagesize,
937 [ --with-pagesize= override detected page size (4, 16 or 64)],
938 [psize=$withval],
939 [psize=0]
940)
941
942if test "$psize" = "0"; then
943 psizer=`getconf PAGESIZE`
florian62477d22014-02-22 13:24:15 +0000944 psize=$((${psizer}/1024))
sewardj5db15402012-06-07 09:13:21 +0000945fi
946
947if test "$psize" = "4"; then
948 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured page size 4k])
949elif test "$psize" = "16"; then
950 AC_DEFINE([MIPS_PAGE_SHIFT], 14, [configured page size 16k])
951elif test "$psize" = "64"; then
952 AC_DEFINE([MIPS_PAGE_SHIFT], 16, [configured page size 64k])
953else
954 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured default page size 4k])
955fi
956AC_MSG_RESULT([checking for Pagesize... ${psize}k])
957
sewardj5db15402012-06-07 09:13:21 +0000958
959#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000960# Extra fine-tuning of installation directories
961#----------------------------------------------------------------------------
962AC_ARG_WITH(tmpdir,
963 [ --with-tmpdir=PATH Specify path for temporary files],
964 tmpdir="$withval",
965 tmpdir="/tmp")
966AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
florian7fd2ec32014-06-21 20:25:30 +0000967AC_SUBST(VG_TMPDIR, [$tmpdir])
sewardjcb495c82011-07-11 20:42:34 +0000968
sewardj0ba37c92011-07-12 11:46:24 +0000969
sewardjcb495c82011-07-11 20:42:34 +0000970#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000971# Libc and suppressions
972#----------------------------------------------------------------------------
973# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000974AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000975
bart12e91122010-05-15 08:37:24 +0000976AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000977
bart12e91122010-05-15 08:37:24 +0000978if test x$ac_cv_header_features_h = xyes; then
979 rm -f conftest.$ac_ext
980 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000981#include <features.h>
bart12e91122010-05-15 08:37:24 +0000982#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
983glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000984#endif
bart12e91122010-05-15 08:37:24 +0000985_ACEOF
mjwa384c3f2014-09-10 00:52:30 +0000986 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
bart12e91122010-05-15 08:37:24 +0000987fi
bartb7c3f082010-05-13 06:32:36 +0000988
njnf76d27a2009-05-28 01:53:07 +0000989# not really a version check
990AC_EGREP_CPP([DARWIN_LIBC], [
991#include <sys/cdefs.h>
992#if defined(__DARWIN_VERS_1050)
993 DARWIN_LIBC
994#endif
995],
996GLIBC_VERSION="darwin")
997
sewardjcb495c82011-07-11 20:42:34 +0000998# not really a version check
999AC_EGREP_CPP([BIONIC_LIBC], [
1000#if defined(__ANDROID__)
1001 BIONIC_LIBC
1002#endif
1003],
1004GLIBC_VERSION="bionic")
1005
sewardj8eb8bab2015-07-21 14:44:28 +00001006# there is only one version of libc on Solaris
1007if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
1008 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
1009 GLIBC_VERSION="solaris"
1010fi
1011
sewardjcb495c82011-07-11 20:42:34 +00001012
bart8219bff2014-09-13 10:53:00 +00001013AC_MSG_CHECKING([the glibc version])
sewardj03d86f22006-10-17 00:57:24 +00001014
dirk07596a22008-04-25 11:33:30 +00001015case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +00001016 2.2)
bart8219bff2014-09-13 10:53:00 +00001017 AC_MSG_RESULT(${GLIBC_VERSION} family)
sewardj2c4f3dd2007-11-11 06:13:01 +00001018 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
1019 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +00001020 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +00001021 ;;
bart8219bff2014-09-13 10:53:00 +00001022 2.[[3-6]])
1023 AC_MSG_RESULT(${GLIBC_VERSION} family)
1024 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +00001025 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +00001026 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +00001027 ;;
bart8219bff2014-09-13 10:53:00 +00001028 2.[[7-9]])
1029 AC_MSG_RESULT(${GLIBC_VERSION} family)
dirk07596a22008-04-25 11:33:30 +00001030 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +00001031 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +00001032 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +00001033 ;;
bart8219bff2014-09-13 10:53:00 +00001034 2.10|2.11)
1035 AC_MSG_RESULT(${GLIBC_VERSION} family)
1036 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1037 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
dirk07596a22008-04-25 11:33:30 +00001038 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1039 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1040 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1041 ;;
bart8219bff2014-09-13 10:53:00 +00001042 2.*)
1043 AC_MSG_RESULT(${GLIBC_VERSION} family)
1044 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1045 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1046 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1047 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
mjwedd30332014-09-08 23:41:31 +00001048 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1049 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1050 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1051 ;;
njnf76d27a2009-05-28 01:53:07 +00001052 darwin)
1053 AC_MSG_RESULT(Darwin)
1054 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1055 # DEFAULT_SUPP set by kernel version check above.
1056 ;;
sewardjcb495c82011-07-11 20:42:34 +00001057 bionic)
1058 AC_MSG_RESULT(Bionic)
1059 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1060 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1061 ;;
sewardj8eb8bab2015-07-21 14:44:28 +00001062 solaris)
1063 AC_MSG_RESULT(Solaris)
1064 # DEFAULT_SUPP set in host_os switch-case above.
1065 # No other suppression file is used.
1066 ;;
bart8219bff2014-09-13 10:53:00 +00001067 2.0|2.1|*)
bart12e91122010-05-15 08:37:24 +00001068 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
sewardj8eb8bab2015-07-21 14:44:28 +00001069 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
1070 AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
sewardjde4a1d02002-03-22 01:27:54 +00001071 ;;
1072esac
1073
dirk07596a22008-04-25 11:33:30 +00001074AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +00001075
sewardj414f3582008-07-18 20:46:00 +00001076
sewardj8eb8bab2015-07-21 14:44:28 +00001077if test "$VGCONF_OS" != "solaris"; then
1078 # Add default suppressions for the X client libraries. Make no
1079 # attempt to detect whether such libraries are installed on the
1080 # build machine (or even if any X facilities are present); just
1081 # add the suppressions antidisirregardless.
1082 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1083 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +00001084
sewardj8eb8bab2015-07-21 14:44:28 +00001085 # Add glibc and X11 suppressions for exp-sgcheck
1086 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1087fi
sewardj5744c022008-10-19 18:58:13 +00001088
sewardj2e10a682003-04-07 19:36:41 +00001089
njn7fd6d382009-01-22 21:56:32 +00001090#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +00001091# Platform variants?
1092#----------------------------------------------------------------------------
1093
1094# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1095# But there are times where we need a bit more control. The motivating
philippe5d5dd8e2012-08-05 00:08:25 +00001096# and currently only case is Android: this is almost identical to
dejanj9c6b05d2013-12-27 09:06:55 +00001097# {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1098# platform variant tags, which get passed in the compile as
1099# -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
sewardjcb495c82011-07-11 20:42:34 +00001100#
1101# In almost all cases, the <variant> bit is "vanilla". But for Android
1102# it is "android" instead.
1103#
1104# Consequently (eg), plain arm-linux would build with
1105#
1106# -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1107#
1108# whilst an Android build would have
1109#
1110# -DVGP_arm_linux -DVGPV_arm_linux_android
1111#
philippe5d5dd8e2012-08-05 00:08:25 +00001112# Same for x86. The setup of the platform variant is pushed relatively far
1113# down this file in order that we can inspect any of the variables set above.
sewardjcb495c82011-07-11 20:42:34 +00001114
1115# In the normal case ..
1116VGCONF_PLATVARIANT="vanilla"
1117
philippe5d5dd8e2012-08-05 00:08:25 +00001118# Android ?
1119if test "$GLIBC_VERSION" = "bionic";
sewardjcb495c82011-07-11 20:42:34 +00001120then
1121 VGCONF_PLATVARIANT="android"
1122fi
1123
1124AC_SUBST(VGCONF_PLATVARIANT)
1125
1126
1127# FIXME: do we also want to define automake variables
1128# VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1129# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1130# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1131# do that. Problem is that we can't do and-ing in Makefile.am's, but
1132# that's what we'd need to do to use this, since what we'd want to write
1133# is something like
1134#
1135# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1136#
sewardj0ba37c92011-07-12 11:46:24 +00001137# Hmm. Can't think of a nice clean solution to this.
1138
1139AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1140 test x$VGCONF_PLATVARIANT = xvanilla)
1141AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1142 test x$VGCONF_PLATVARIANT = xandroid)
sewardjcb495c82011-07-11 20:42:34 +00001143
1144
1145#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +00001146# Checking for various library functions and other definitions
1147#----------------------------------------------------------------------------
1148
florian28db75c2012-12-08 19:26:03 +00001149# Check for AT_FDCWD
1150
1151AC_MSG_CHECKING([for AT_FDCWD])
1152AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1153#define _GNU_SOURCE
1154#include <fcntl.h>
1155#include <unistd.h>
1156]], [[
1157 int a = AT_FDCWD;
1158]])], [
1159ac_have_at_fdcwd=yes
1160AC_MSG_RESULT([yes])
1161], [
1162ac_have_at_fdcwd=no
florian28db75c2012-12-08 19:26:03 +00001163AC_MSG_RESULT([no])
1164])
1165
1166AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1167
sewardj24cf8df2012-12-14 10:30:57 +00001168# Check for stpncpy function definition in string.h
1169# This explicitly checks with _GNU_SOURCE defined since that is also
1170# used in the test case (some systems might define it without anyway
1171# since stpncpy is part of The Open Group Base Specifications Issue 7
1172# IEEE Std 1003.1-2008.
1173AC_MSG_CHECKING([for stpncpy])
1174AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1175#define _GNU_SOURCE
1176#include <string.h>
1177]], [[
1178 char *d;
1179 char *s;
1180 size_t n = 0;
1181 char *r = stpncpy(d, s, n);
1182]])], [
1183ac_have_gnu_stpncpy=yes
1184AC_MSG_RESULT([yes])
1185], [
1186ac_have_gnu_stpncpy=no
1187AC_MSG_RESULT([no])
1188])
1189
1190AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
florian28db75c2012-12-08 19:26:03 +00001191
philippe4e98f7c2013-08-03 20:34:58 +00001192# Check for PTRACE_GETREGS
1193
1194AC_MSG_CHECKING([for PTRACE_GETREGS])
1195AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
philippedc1757e2015-02-02 22:40:54 +00001196#include <stdlib.h>
philippe4e98f7c2013-08-03 20:34:58 +00001197#include <stddef.h>
1198#include <sys/ptrace.h>
1199#include <sys/user.h>
1200]], [[
1201 void *p;
1202 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1203]])], [
1204AC_MSG_RESULT([yes])
1205AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1206 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1207], [
1208AC_MSG_RESULT([no])
1209])
1210
1211
bart59e2f182008-04-28 16:22:53 +00001212# Check for CLOCK_MONOTONIC
1213
1214AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1215
bart417cf3e2011-10-22 09:21:24 +00001216AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart59e2f182008-04-28 16:22:53 +00001217#include <time.h>
bart417cf3e2011-10-22 09:21:24 +00001218]], [[
bart59e2f182008-04-28 16:22:53 +00001219 struct timespec t;
1220 clock_gettime(CLOCK_MONOTONIC, &t);
1221 return 0;
bart417cf3e2011-10-22 09:21:24 +00001222]])], [
bart59e2f182008-04-28 16:22:53 +00001223AC_MSG_RESULT([yes])
1224AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1225 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1226], [
1227AC_MSG_RESULT([no])
1228])
1229
bartfea06922008-05-03 09:12:15 +00001230
sewardj0c09bf02011-07-11 22:11:58 +00001231# Check for PTHREAD_RWLOCK_T
1232
1233AC_MSG_CHECKING([for pthread_rwlock_t])
1234
bart417cf3e2011-10-22 09:21:24 +00001235AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardj0c09bf02011-07-11 22:11:58 +00001236#define _GNU_SOURCE
1237#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001238]], [[
sewardj0c09bf02011-07-11 22:11:58 +00001239 pthread_rwlock_t rwl;
bart417cf3e2011-10-22 09:21:24 +00001240]])], [
sewardj0c09bf02011-07-11 22:11:58 +00001241AC_MSG_RESULT([yes])
1242AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1243 [Define to 1 if you have the `pthread_rwlock_t' type.])
1244], [
1245AC_MSG_RESULT([no])
1246])
1247
1248
bartfea06922008-05-03 09:12:15 +00001249# Check for PTHREAD_MUTEX_ADAPTIVE_NP
1250
1251AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1252
bart417cf3e2011-10-22 09:21:24 +00001253AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001254#define _GNU_SOURCE
1255#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001256]], [[
bartfea06922008-05-03 09:12:15 +00001257 return (PTHREAD_MUTEX_ADAPTIVE_NP);
bart417cf3e2011-10-22 09:21:24 +00001258]])], [
bartfea06922008-05-03 09:12:15 +00001259AC_MSG_RESULT([yes])
1260AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1261 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1262], [
1263AC_MSG_RESULT([no])
1264])
1265
1266
1267# Check for PTHREAD_MUTEX_ERRORCHECK_NP
1268
1269AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1270
bart417cf3e2011-10-22 09:21:24 +00001271AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001272#define _GNU_SOURCE
1273#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001274]], [[
bartfea06922008-05-03 09:12:15 +00001275 return (PTHREAD_MUTEX_ERRORCHECK_NP);
bart417cf3e2011-10-22 09:21:24 +00001276]])], [
bartfea06922008-05-03 09:12:15 +00001277AC_MSG_RESULT([yes])
1278AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1279 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1280], [
1281AC_MSG_RESULT([no])
1282])
1283
1284
1285# Check for PTHREAD_MUTEX_RECURSIVE_NP
1286
1287AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1288
bart417cf3e2011-10-22 09:21:24 +00001289AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001290#define _GNU_SOURCE
1291#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001292]], [[
bartfea06922008-05-03 09:12:15 +00001293 return (PTHREAD_MUTEX_RECURSIVE_NP);
bart417cf3e2011-10-22 09:21:24 +00001294]])], [
bartfea06922008-05-03 09:12:15 +00001295AC_MSG_RESULT([yes])
1296AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1297 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1298], [
1299AC_MSG_RESULT([no])
1300])
1301
1302
1303# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1304
1305AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1306
bart417cf3e2011-10-22 09:21:24 +00001307AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001308#define _GNU_SOURCE
1309#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001310]], [[
bartfea06922008-05-03 09:12:15 +00001311 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1312 return 0;
bart417cf3e2011-10-22 09:21:24 +00001313]])], [
bartfea06922008-05-03 09:12:15 +00001314AC_MSG_RESULT([yes])
1315AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1316 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1317], [
1318AC_MSG_RESULT([no])
1319])
1320
1321
bart5e389f12008-04-05 12:53:15 +00001322# Check whether pthread_mutex_t has a member called __m_kind.
1323
bartb11355c2010-04-29 16:37:26 +00001324AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1325 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1326 1,
1327 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1328 ],
1329 [],
1330 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001331
1332
1333# Check whether pthread_mutex_t has a member called __data.__kind.
1334
bartb11355c2010-04-29 16:37:26 +00001335AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1336 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1337 1,
1338 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1339 ],
1340 [],
1341 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001342
carll5bd4f6d2015-07-20 21:25:32 +00001343# Convenience function. Set flags based on the existing HWCAP entries.
1344# The AT_HWCAP entries are generated by glibc, and are based on
1345# functions supported by the hardware/system/libc.
1346# Subsequent support for whether the capability will actually be utilized
1347# will also be checked against the compiler capabilities.
1348# called as
1349# AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1350AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1351 AUXV_CHECK_FOR=$1
1352 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
bart9983eca2015-07-25 14:31:02 +00001353 if LD_SHOW_AUXV=1 `which true` | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
carll5bd4f6d2015-07-20 21:25:32 +00001354 then
1355 AC_MSG_RESULT([yes])
1356 AC_SUBST([$2],[yes])
1357 else
1358 AC_MSG_RESULT([no])
1359 AC_SUBST([$2],[])
1360 fi
1361])
1362
1363# gather hardware capabilities. (hardware/kernel/libc)
carll56f79892015-07-20 21:57:21 +00001364AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1365AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1366AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1367AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1368AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1369AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
carll5bd4f6d2015-07-20 21:25:32 +00001370AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
bart5e389f12008-04-05 12:53:15 +00001371
carll56f79892015-07-20 21:57:21 +00001372# ISA Levels
1373AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1374AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1375# compiler support for isa 2.07 level instructions
1376AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1377AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1378]], [[
1379 __asm__ __volatile__("mtvsrd 1,2 ");
1380]])], [
1381ac_asm_have_isa_2_07=yes
1382AC_MSG_RESULT([yes])
1383], [
1384ac_asm_have_isa_2_07=no
1385AC_MSG_RESULT([no])
1386])
1387AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1388 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1389
1390# altivec (vsx) support.
bart62c370e2008-05-12 18:50:51 +00001391# does this compiler support -maltivec and does it have the include file
1392# <altivec.h> ?
carll56f79892015-07-20 21:57:21 +00001393AC_MSG_CHECKING([for Altivec support in the compiler ])
bart62c370e2008-05-12 18:50:51 +00001394safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001395CFLAGS="-maltivec -Werror"
bart417cf3e2011-10-22 09:21:24 +00001396AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart62c370e2008-05-12 18:50:51 +00001397#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001398]], [[
bart62c370e2008-05-12 18:50:51 +00001399 vector unsigned int v;
bart417cf3e2011-10-22 09:21:24 +00001400]])], [
bart62c370e2008-05-12 18:50:51 +00001401ac_have_altivec=yes
1402AC_MSG_RESULT([yes])
sewardjf9fe6022010-09-03 14:36:50 +00001403AC_DEFINE([HAS_ALTIVEC], 1,
sewardj6467a152010-09-03 14:02:22 +00001404 [Define to 1 if gcc/as can do Altivec.])
bart62c370e2008-05-12 18:50:51 +00001405], [
1406ac_have_altivec=no
1407AC_MSG_RESULT([no])
1408])
1409CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001410AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1411 -a x$HWCAP_HAS_ALTIVEC = xyes])
bart62c370e2008-05-12 18:50:51 +00001412
sewardjf34eb492011-04-15 11:57:05 +00001413# Check that both: the compiler supports -mvsx and that the assembler
1414# understands VSX instructions. If either of those doesn't work,
carll56f79892015-07-20 21:57:21 +00001415# conclude that we can't do VSX.
1416AC_MSG_CHECKING([for VSX compiler flag support])
sewardjf34eb492011-04-15 11:57:05 +00001417safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001418CFLAGS="-mvsx -Werror"
carll56f79892015-07-20 21:57:21 +00001419AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1420]], [[
1421]])], [
1422ac_compiler_supports_vsx_flag=yes
1423AC_MSG_RESULT([yes])
1424], [
1425ac_compiler_supports_vsx_flag=no
1426AC_MSG_RESULT([no])
1427])
1428CFLAGS=$safe_CFLAGS
sewardjf34eb492011-04-15 11:57:05 +00001429
carll56f79892015-07-20 21:57:21 +00001430AC_MSG_CHECKING([for VSX support in the assembler ])
1431safe_CFLAGS=$CFLAGS
1432CFLAGS="-mvsx -Werror"
bart417cf3e2011-10-22 09:21:24 +00001433AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardjf34eb492011-04-15 11:57:05 +00001434#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001435]], [[
sewardjf34eb492011-04-15 11:57:05 +00001436 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +00001437 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
bart417cf3e2011-10-22 09:21:24 +00001438]])], [
carll56f79892015-07-20 21:57:21 +00001439ac_compiler_supports_vsx=yes
sewardjf34eb492011-04-15 11:57:05 +00001440AC_MSG_RESULT([yes])
1441], [
carll56f79892015-07-20 21:57:21 +00001442ac_compiler_supports_vsx=no
sewardjf34eb492011-04-15 11:57:05 +00001443AC_MSG_RESULT([no])
1444])
1445CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001446AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1447 -a x$ac_compiler_supports_vsx = xyes \
1448 -a x$HWCAP_HAS_VSX = xyes ])
sewardjf34eb492011-04-15 11:57:05 +00001449
carll56f79892015-07-20 21:57:21 +00001450# DFP (Decimal Float)
sewardjb0ccb4d2012-04-02 10:22:05 +00001451AC_MSG_CHECKING([that assembler knows DFP])
sewardjb0ccb4d2012-04-02 10:22:05 +00001452AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1453]], [[
1454 __asm__ __volatile__("dadd 1, 2, 3");
sewardj4e1c1912012-08-08 22:22:26 +00001455 __asm__ __volatile__("dcffix 1, 2");
sewardjb0ccb4d2012-04-02 10:22:05 +00001456]])], [
1457ac_asm_have_dfp=yes
1458AC_MSG_RESULT([yes])
1459], [
1460ac_asm_have_dfp=no
1461AC_MSG_RESULT([no])
1462])
sewardjb0ccb4d2012-04-02 10:22:05 +00001463AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1464safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001465CFLAGS="-mhard-dfp -Werror"
sewardjb0ccb4d2012-04-02 10:22:05 +00001466AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1467]], [[
1468 __asm__ __volatile__("dadd 1, 2, 3");
sewardj4e1c1912012-08-08 22:22:26 +00001469 __asm__ __volatile__("dcffix 1, 2");
sewardjb0ccb4d2012-04-02 10:22:05 +00001470]])], [
carll56f79892015-07-20 21:57:21 +00001471ac_compiler_have_dfp=yes
sewardjb0ccb4d2012-04-02 10:22:05 +00001472AC_MSG_RESULT([yes])
1473], [
carll56f79892015-07-20 21:57:21 +00001474ac_compiler_have_dfp=no
sewardjb0ccb4d2012-04-02 10:22:05 +00001475AC_MSG_RESULT([no])
1476])
sewardjb0ccb4d2012-04-02 10:22:05 +00001477CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001478AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1479 -a x$ac_compiler_have_dfp = xyes \
1480 -a x$HWCAP_HAS_DFP = xyes )
sewardj4e1c1912012-08-08 22:22:26 +00001481
florian46825982012-11-10 22:35:24 +00001482AC_MSG_CHECKING([that compiler knows DFP datatypes])
1483AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1484]], [[
1485 _Decimal64 x = 0.0DD;
1486]])], [
carll56f79892015-07-20 21:57:21 +00001487ac_compiler_have_dfp_type=yes
florian46825982012-11-10 22:35:24 +00001488AC_MSG_RESULT([yes])
1489], [
carll56f79892015-07-20 21:57:21 +00001490ac_compiler_have_dfp_type=no
florian46825982012-11-10 22:35:24 +00001491AC_MSG_RESULT([no])
1492])
carll56f79892015-07-20 21:57:21 +00001493AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
1494 -a xHWCAP_$HAS_DFP = xyes )
florian46825982012-11-10 22:35:24 +00001495
florian46825982012-11-10 22:35:24 +00001496
carll5bd4f6d2015-07-20 21:25:32 +00001497# HTM (Hardware Transactional Memory)
1498AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1499safe_CFLAGS=$CFLAGS
1500CFLAGS="-mhtm -Werror"
1501AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1502]], [[
1503 return 0;
1504]])], [
1505AC_MSG_RESULT([yes])
1506ac_compiler_supports_htm=yes
1507], [
1508AC_MSG_RESULT([no])
1509ac_compiler_supports_htm=no
1510])
1511CFLAGS=$safe_CFLAGS
1512
1513AC_MSG_CHECKING([if compiler can find the htm builtins])
1514safe_CFLAGS=$CFLAGS
1515CFLAGS="-mhtm -Werror"
1516 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1517 ]], [[
1518 if (__builtin_tbegin (0))
1519 __builtin_tend (0);
1520 ]])], [
1521 AC_MSG_RESULT([yes])
1522ac_compiler_sees_htm_builtins=yes
1523 ], [
1524 AC_MSG_RESULT([no])
1525ac_compiler_sees_htm_builtins=no
1526 ])
1527CFLAGS=$safe_CFLAGS
1528
1529AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1530 -a x$ac_compiler_sees_htm_builtins = xyes \
1531 -a x$HWCAP_HAS_HTM = xyes )
1532
bart36dd85a2009-04-26 07:11:48 +00001533# Check for pthread_create@GLIBC2.0
1534AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1535
bart16e1c5a2009-04-26 07:38:53 +00001536safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001537CFLAGS="-lpthread -Werror"
bart417cf3e2011-10-22 09:21:24 +00001538AC_LINK_IFELSE([AC_LANG_PROGRAM([[
bart36dd85a2009-04-26 07:11:48 +00001539extern int pthread_create_glibc_2_0(void*, const void*,
1540 void *(*)(void*), void*);
1541__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
bart417cf3e2011-10-22 09:21:24 +00001542]], [[
bart276ed3a2009-05-10 15:41:45 +00001543#ifdef __powerpc__
1544/*
1545 * Apparently on PowerPC linking this program succeeds and generates an
1546 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1547 */
1548#error This test does not work properly on PowerPC.
1549#else
bart16e1c5a2009-04-26 07:38:53 +00001550 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001551#endif
bart16e1c5a2009-04-26 07:38:53 +00001552 return 0;
bart417cf3e2011-10-22 09:21:24 +00001553]])], [
bart36dd85a2009-04-26 07:11:48 +00001554ac_have_pthread_create_glibc_2_0=yes
1555AC_MSG_RESULT([yes])
1556AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1557 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1558], [
1559ac_have_pthread_create_glibc_2_0=no
1560AC_MSG_RESULT([no])
1561])
bart16e1c5a2009-04-26 07:38:53 +00001562CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001563
1564AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001565 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001566
1567
philippe1670b052014-08-15 10:27:52 +00001568# Check for dlinfo RTLD_DI_TLS_MODID
1569AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1570
1571safe_LIBS="$LIBS"
1572LIBS="-ldl"
1573AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1574#ifndef _GNU_SOURCE
1575#define _GNU_SOURCE
1576#endif
1577#include <link.h>
1578#include <dlfcn.h>
1579]], [[
1580 size_t sizes[10000];
1581 size_t modid_offset;
1582 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1583 return 0;
1584]])], [
1585ac_have_dlinfo_rtld_di_tls_modid=yes
1586AC_MSG_RESULT([yes])
1587AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1588 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1589], [
1590ac_have_dlinfo_rtld_di_tls_modid=no
1591AC_MSG_RESULT([no])
1592])
1593LIBS=$safe_LIBS
1594
1595AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1596 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1597
1598
barta50aa8a2008-04-27 06:06:57 +00001599# Check for eventfd_t, eventfd() and eventfd_read()
1600AC_MSG_CHECKING([for eventfd()])
1601
bart417cf3e2011-10-22 09:21:24 +00001602AC_LINK_IFELSE([AC_LANG_PROGRAM([[
barta50aa8a2008-04-27 06:06:57 +00001603#include <sys/eventfd.h>
bart417cf3e2011-10-22 09:21:24 +00001604]], [[
barta50aa8a2008-04-27 06:06:57 +00001605 eventfd_t ev;
1606 int fd;
1607
1608 fd = eventfd(5, 0);
1609 eventfd_read(fd, &ev);
1610 return 0;
bart417cf3e2011-10-22 09:21:24 +00001611]])], [
barta50aa8a2008-04-27 06:06:57 +00001612AC_MSG_RESULT([yes])
1613AC_DEFINE([HAVE_EVENTFD], 1,
1614 [Define to 1 if you have the `eventfd' function.])
1615AC_DEFINE([HAVE_EVENTFD_READ], 1,
1616 [Define to 1 if you have the `eventfd_read' function.])
1617], [
1618AC_MSG_RESULT([no])
1619])
1620
florian24fefb62013-10-08 13:04:00 +00001621# Check whether compiler can process #include <thread> without errors
1622# clang 3.3 cannot process <thread> from e.g.
1623# gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1624
1625AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1626AC_LANG(C++)
1627safe_CXXFLAGS=$CXXFLAGS
1628CXXFLAGS=-std=c++0x
1629
1630AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1631#include <thread>
1632])],
1633[
1634ac_cxx_can_include_thread_header=yes
1635AC_MSG_RESULT([yes])
1636], [
1637ac_cxx_can_include_thread_header=no
1638AC_MSG_RESULT([no])
1639])
1640CXXFLAGS=$safe_CXXFLAGS
1641AC_LANG(C)
1642
1643AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1644
mjw2a429f52014-07-18 20:45:37 +00001645
1646# On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1647# of the user_regs_struct from sys/user.h. They are structurally the same
1648# but we get either one or the other.
1649
1650AC_CHECK_TYPE([struct user_regs_struct],
1651 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1652 [[#include <sys/ptrace.h>]
1653 [#include <sys/time.h>]
1654 [#include <sys/user.h>]])
1655if test "$sys_user_has_user_regs" = "yes"; then
1656 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1657 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1658fi
1659
1660
njn7fd6d382009-01-22 21:56:32 +00001661#----------------------------------------------------------------------------
1662# Checking for supported compiler flags.
1663#----------------------------------------------------------------------------
1664
sewardj535c50f2005-06-04 23:14:53 +00001665# does this compiler support -m32 ?
1666AC_MSG_CHECKING([if gcc accepts -m32])
1667
1668safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001669CFLAGS="-m32 -Werror"
sewardj535c50f2005-06-04 23:14:53 +00001670
bart417cf3e2011-10-22 09:21:24 +00001671AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001672 return 0;
bart417cf3e2011-10-22 09:21:24 +00001673]])], [
sewardj535c50f2005-06-04 23:14:53 +00001674FLAG_M32="-m32"
1675AC_MSG_RESULT([yes])
1676], [
1677FLAG_M32=""
1678AC_MSG_RESULT([no])
1679])
1680CFLAGS=$safe_CFLAGS
1681
1682AC_SUBST(FLAG_M32)
1683
1684
sewardj01262142006-01-04 01:20:28 +00001685# does this compiler support -m64 ?
1686AC_MSG_CHECKING([if gcc accepts -m64])
1687
1688safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001689CFLAGS="-m64 -Werror"
sewardj01262142006-01-04 01:20:28 +00001690
bart417cf3e2011-10-22 09:21:24 +00001691AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001692 return 0;
bart417cf3e2011-10-22 09:21:24 +00001693]])], [
sewardj01262142006-01-04 01:20:28 +00001694FLAG_M64="-m64"
1695AC_MSG_RESULT([yes])
1696], [
1697FLAG_M64=""
1698AC_MSG_RESULT([no])
1699])
1700CFLAGS=$safe_CFLAGS
1701
1702AC_SUBST(FLAG_M64)
1703
1704
dejanjf674e382014-02-18 16:40:25 +00001705# does this compiler support -march=mips32 (mips32 default) ?
1706AC_MSG_CHECKING([if gcc accepts -march=mips32])
1707
1708safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001709CFLAGS="$CFLAGS -march=mips32 -Werror"
dejanjf674e382014-02-18 16:40:25 +00001710
1711AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1712 return 0;
1713]])], [
1714FLAG_MIPS32="-march=mips32"
1715AC_MSG_RESULT([yes])
1716], [
1717FLAG_MIPS32=""
1718AC_MSG_RESULT([no])
1719])
1720CFLAGS=$safe_CFLAGS
1721
1722AC_SUBST(FLAG_MIPS32)
1723
1724
1725# does this compiler support -march=mips64 (mips64 default) ?
1726AC_MSG_CHECKING([if gcc accepts -march=mips64])
1727
1728safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001729CFLAGS="$CFLAGS -march=mips64 -Werror"
dejanjf674e382014-02-18 16:40:25 +00001730
1731AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1732 return 0;
1733]])], [
1734FLAG_MIPS64="-march=mips64"
1735AC_MSG_RESULT([yes])
1736], [
1737FLAG_MIPS64=""
1738AC_MSG_RESULT([no])
1739])
1740CFLAGS=$safe_CFLAGS
1741
1742AC_SUBST(FLAG_MIPS64)
1743
1744
petarj1546c7a2014-01-29 18:08:50 +00001745# does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1746AC_MSG_CHECKING([if gcc accepts -march=octeon])
1747
1748safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001749CFLAGS="$CFLAGS -march=octeon -Werror"
petarj1546c7a2014-01-29 18:08:50 +00001750
1751AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1752 return 0;
1753]])], [
1754FLAG_OCTEON="-march=octeon"
1755AC_MSG_RESULT([yes])
1756], [
1757FLAG_OCTEON=""
1758AC_MSG_RESULT([no])
1759])
1760CFLAGS=$safe_CFLAGS
1761
1762AC_SUBST(FLAG_OCTEON)
1763
dejanjf674e382014-02-18 16:40:25 +00001764
petarj1546c7a2014-01-29 18:08:50 +00001765# does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1766AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1767
1768safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001769CFLAGS="$CFLAGS -march=octeon2 -Werror"
petarj1546c7a2014-01-29 18:08:50 +00001770
1771AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1772 return 0;
1773]])], [
1774FLAG_OCTEON2="-march=octeon2"
1775AC_MSG_RESULT([yes])
1776], [
1777FLAG_OCTEON2=""
1778AC_MSG_RESULT([no])
1779])
1780CFLAGS=$safe_CFLAGS
1781
1782AC_SUBST(FLAG_OCTEON2)
1783
1784
sewardj67f1fcc2005-07-03 10:41:02 +00001785# does this compiler support -mmmx ?
1786AC_MSG_CHECKING([if gcc accepts -mmmx])
1787
1788safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001789CFLAGS="-mmmx -Werror"
sewardj67f1fcc2005-07-03 10:41:02 +00001790
bart417cf3e2011-10-22 09:21:24 +00001791AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001792 return 0;
bart417cf3e2011-10-22 09:21:24 +00001793]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001794FLAG_MMMX="-mmmx"
1795AC_MSG_RESULT([yes])
1796], [
1797FLAG_MMMX=""
1798AC_MSG_RESULT([no])
1799])
1800CFLAGS=$safe_CFLAGS
1801
1802AC_SUBST(FLAG_MMMX)
1803
1804
1805# does this compiler support -msse ?
1806AC_MSG_CHECKING([if gcc accepts -msse])
1807
1808safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001809CFLAGS="-msse -Werror"
sewardj67f1fcc2005-07-03 10:41:02 +00001810
bart417cf3e2011-10-22 09:21:24 +00001811AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001812 return 0;
bart417cf3e2011-10-22 09:21:24 +00001813]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001814FLAG_MSSE="-msse"
1815AC_MSG_RESULT([yes])
1816], [
1817FLAG_MSSE=""
1818AC_MSG_RESULT([no])
1819])
1820CFLAGS=$safe_CFLAGS
1821
1822AC_SUBST(FLAG_MSSE)
1823
1824
sewardj98977e02014-09-05 20:00:22 +00001825# does this compiler support -mpreferred-stack-boundary=2 when
1826# generating code for a 32-bit target? Note that we only care about
1827# this when generating code for (32-bit) x86, so if the compiler
1828# doesn't recognise -m32 it's no big deal. We'll just get code for
1829# the Memcheck and other helper functions, that is a bit slower than
1830# it could be, on x86; and no difference at all on any other platform.
1831AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
sewardj5b754b42002-06-03 22:53:35 +00001832
daywalker3664f562003-10-17 13:43:46 +00001833safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001834CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
sewardj5b754b42002-06-03 22:53:35 +00001835
bart417cf3e2011-10-22 09:21:24 +00001836AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001837 return 0;
bart417cf3e2011-10-22 09:21:24 +00001838]])], [
sewardj98977e02014-09-05 20:00:22 +00001839PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001840AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001841], [
sewardj98977e02014-09-05 20:00:22 +00001842PREFERRED_STACK_BOUNDARY_2=""
sewardj5b754b42002-06-03 22:53:35 +00001843AC_MSG_RESULT([no])
1844])
daywalker3664f562003-10-17 13:43:46 +00001845CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001846
sewardj98977e02014-09-05 20:00:22 +00001847AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
sewardj5b754b42002-06-03 22:53:35 +00001848
sewardj535c50f2005-06-04 23:14:53 +00001849
mjwab69b4a2014-08-20 16:11:53 +00001850# Convenience function to check whether GCC supports a particular
florian3d53d082015-06-05 17:09:57 +00001851# warning option. Takes two arguments,
mjwab69b4a2014-08-20 16:11:53 +00001852# first the warning flag name to check (without -W), then the
1853# substitution name to set with -Wno-warning-flag if the flag exists,
1854# or the empty string if the compiler doesn't accept the flag. Note
1855# that checking is done against the warning flag itself, but the
1856# substitution is then done to cancel the warning flag.
1857AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
sewardja3a27fe2014-09-01 21:16:02 +00001858 AC_MSG_CHECKING([if gcc accepts -W$1])
1859 safe_CFLAGS=$CFLAGS
florian02ffb772015-06-05 21:19:06 +00001860 CFLAGS="-W$1 -Werror"
sewardja3a27fe2014-09-01 21:16:02 +00001861 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1862 AC_SUBST([$2], [-Wno-$1])
1863 AC_MSG_RESULT([yes])], [
1864 AC_SUBST([$2], [])
1865 AC_MSG_RESULT([no])])
1866 CFLAGS=$safe_CFLAGS
barte026bd22009-07-04 12:17:07 +00001867])
barte026bd22009-07-04 12:17:07 +00001868
florian26a790a2014-12-03 22:53:00 +00001869# Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
1870# -W$1 (instead of -Wno-$1).
1871AC_DEFUN([AC_GCC_WARNING_SUBST],[
1872 AC_MSG_CHECKING([if gcc accepts -W$1])
1873 safe_CFLAGS=$CFLAGS
florian02ffb772015-06-05 21:19:06 +00001874 CFLAGS="-W$1 -Werror"
florian26a790a2014-12-03 22:53:00 +00001875 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1876 AC_SUBST([$2], [-W$1])
1877 AC_MSG_RESULT([yes])], [
1878 AC_SUBST([$2], [])
1879 AC_MSG_RESULT([no])])
1880 CFLAGS=$safe_CFLAGS
1881])
1882
florian4f9b7c72015-08-02 19:45:58 +00001883AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
mjwab69b4a2014-08-20 16:11:53 +00001884AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1885AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
florian3d53d082015-06-05 17:09:57 +00001886AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
mjwab69b4a2014-08-20 16:11:53 +00001887AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
florian807c4542014-09-05 18:30:05 +00001888AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1889AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
florian26a790a2014-12-03 22:53:00 +00001890AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
florian54681bf2015-06-05 16:26:14 +00001891AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
florian26a790a2014-12-03 22:53:00 +00001892AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
florianb26101c2015-08-08 21:45:33 +00001893# Disabled for now until all platforms are clean
florian42c2a5b2015-08-09 08:16:54 +00001894format_checking_enabled=no
1895#format_checking_enabled=yes
1896if test "$format_checking_enabled" = "yes"; then
1897 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
1898else
1899 dumy_assignment_to_avoid_syntax_errors=1
1900 AC_SUBST([FLAG_W_FORMAT_SIGNEDNESS], [])
1901fi
florian26a790a2014-12-03 22:53:00 +00001902AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
florian90694062015-05-16 16:17:52 +00001903AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
1904AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
1905AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
sewardja3a27fe2014-09-01 21:16:02 +00001906
floriane1988aa2015-06-09 21:44:58 +00001907# Does this compiler support -Wformat-security ?
1908# Special handling is needed, because certain GCC versions require -Wformat
1909# being present if -Wformat-security is given. Otherwise a warning is issued.
1910# However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
1911# And with that the warning will be turned into an error with the result
1912# that -Wformat-security is believed to be unsupported when in fact it is.
1913AC_MSG_CHECKING([if gcc accepts -Wformat-security])
1914safe_CFLAGS=$CFLAGS
1915CFLAGS="-Wformat -Wformat-security -Werror"
1916AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1917AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
1918AC_MSG_RESULT([yes])], [
1919AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
1920AC_MSG_RESULT([no])])
1921CFLAGS=$safe_CFLAGS
1922
bart56730cd2008-05-11 06:41:46 +00001923# does this compiler support -Wextra or the older -W ?
1924
1925AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1926
1927safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001928CFLAGS="-Wextra -Werror"
bart56730cd2008-05-11 06:41:46 +00001929
bart417cf3e2011-10-22 09:21:24 +00001930AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001931 return 0;
bart417cf3e2011-10-22 09:21:24 +00001932]])], [
bart56730cd2008-05-11 06:41:46 +00001933AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1934AC_MSG_RESULT([-Wextra])
1935], [
florian538cf302015-06-09 21:53:48 +00001936 CFLAGS="-W -Werror"
sewardj9bdf2a62011-10-27 06:22:23 +00001937 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001938 return 0;
sewardj9bdf2a62011-10-27 06:22:23 +00001939 ]])], [
bart56730cd2008-05-11 06:41:46 +00001940 AC_SUBST([FLAG_W_EXTRA], [-W])
1941 AC_MSG_RESULT([-W])
1942 ], [
1943 AC_SUBST([FLAG_W_EXTRA], [])
1944 AC_MSG_RESULT([not supported])
1945 ])
1946])
1947CFLAGS=$safe_CFLAGS
1948
sewardja72c26d2007-05-01 13:44:08 +00001949# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001950AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001951
1952safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001953CFLAGS="-fno-stack-protector -Werror"
sewardja72c26d2007-05-01 13:44:08 +00001954
bart417cf3e2011-10-22 09:21:24 +00001955AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001956 return 0;
bart417cf3e2011-10-22 09:21:24 +00001957]])], [
sewardja72c26d2007-05-01 13:44:08 +00001958no_stack_protector=yes
1959FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1960AC_MSG_RESULT([yes])
1961], [
1962no_stack_protector=no
1963FLAG_FNO_STACK_PROTECTOR=""
1964AC_MSG_RESULT([no])
1965])
1966CFLAGS=$safe_CFLAGS
1967
1968AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1969
mjw37915072015-06-02 20:23:06 +00001970# Does GCC support disabling Identical Code Folding?
1971# We want to disabled Identical Code Folding for the
1972# tools preload shared objects to get better backraces.
1973# For GCC 5.1+ -fipa-icf is enabled by default at -O2.
1974# "The optimization reduces code size and may disturb
1975# unwind stacks by replacing a function by equivalent
1976# one with a different name."
1977AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
1978
1979safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001980CFLAGS="-fno-ipa-icf -Werror"
mjw37915072015-06-02 20:23:06 +00001981
1982AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1983 return 0;
1984]])], [
1985no_ipa_icf=yes
1986FLAG_FNO_IPA_ICF="-fno-ipa-icf"
1987AC_MSG_RESULT([yes])
1988], [
1989no_ipa_icf=no
1990FLAG_FNO_IPA_ICF=""
1991AC_MSG_RESULT([no])
1992])
1993CFLAGS=$safe_CFLAGS
1994
1995AC_SUBST(FLAG_FNO_IPA_ICF)
1996
florianbb1a7872015-03-10 16:13:59 +00001997
florian3878e162015-06-23 20:31:52 +00001998# Does this compiler support -fsanitize=undefined. This is true for
1999# GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2000# also checks for alignment violations on memory accesses which the valgrind
2001# code base is sprinkled (if not littered) with. As those alignment issues
2002# don't pose a problem we want to suppress warnings about them.
2003# In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2004# GCCs do not support that.
2005#
florianbb1a7872015-03-10 16:13:59 +00002006# Only checked for if --enable-ubsan was given.
2007if test "x${vg_cv_ubsan}" = "xyes"; then
florian3878e162015-06-23 20:31:52 +00002008AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
florianbb1a7872015-03-10 16:13:59 +00002009safe_CFLAGS=$CFLAGS
florian3878e162015-06-23 20:31:52 +00002010CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2011AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2012 return 0;
2013]])], [
2014FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2015LIB_UBSAN="-static-libubsan"
2016AC_MSG_RESULT([yes])
2017], [
florian538cf302015-06-09 21:53:48 +00002018CFLAGS="-fsanitize=undefined -Werror"
florianbb1a7872015-03-10 16:13:59 +00002019AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2020 return 0;
2021]])], [
2022FLAG_FSANITIZE="-fsanitize=undefined"
2023LIB_UBSAN="-static-libubsan"
2024AC_MSG_RESULT([yes])
2025], [
2026FLAG_FSANITIZE=""
2027LIB_UBSAN=""
2028AC_MSG_RESULT([no])
2029])
florian3878e162015-06-23 20:31:52 +00002030])
florianbb1a7872015-03-10 16:13:59 +00002031CFLAGS=$safe_CFLAGS
2032AC_SUBST(FLAG_FSANITIZE)
2033AC_SUBST(LIB_UBSAN)
2034fi
bart56730cd2008-05-11 06:41:46 +00002035# does this compiler support --param inline-unit-growth=... ?
2036
2037AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2038
2039safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002040CFLAGS="--param inline-unit-growth=900 -Werror"
bart56730cd2008-05-11 06:41:46 +00002041
bart417cf3e2011-10-22 09:21:24 +00002042AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00002043 return 0;
bart417cf3e2011-10-22 09:21:24 +00002044]])], [
bart56730cd2008-05-11 06:41:46 +00002045AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2046 ["--param inline-unit-growth=900"])
2047AC_MSG_RESULT([yes])
2048], [
2049AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2050AC_MSG_RESULT([no])
2051])
2052CFLAGS=$safe_CFLAGS
2053
2054
sewardjd9350682012-04-05 07:55:47 +00002055# does this compiler support -gdwarf-4 -fdebug-types-section ?
2056
2057AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2058
2059safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002060CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
sewardjd9350682012-04-05 07:55:47 +00002061
2062AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2063 return 0;
2064]])], [
2065ac_have_dwarf4=yes
2066AC_MSG_RESULT([yes])
2067], [
2068ac_have_dwarf4=no
2069AC_MSG_RESULT([no])
2070])
2071AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2072CFLAGS=$safe_CFLAGS
2073
2074
florian3df02112013-10-04 11:35:50 +00002075# does this compiler support nested functions ?
2076
2077AC_MSG_CHECKING([if gcc accepts nested functions])
2078
2079AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2080 int foo() { return 1; }
2081 return foo();
2082]])], [
2083ac_have_nested_functions=yes
2084AC_MSG_RESULT([yes])
2085], [
2086ac_have_nested_functions=no
2087AC_MSG_RESULT([no])
2088])
2089AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2090
2091
2092# does this compiler support the 'p' constraint in ASM statements ?
2093
2094AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2095
2096AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2097 char *p;
2098 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2099]])], [
2100ac_have_asm_constraint_p=yes
2101AC_MSG_RESULT([yes])
2102], [
2103ac_have_asm_constraint_p=no
2104AC_MSG_RESULT([no])
2105])
2106AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2107
2108
sewardje4bc7032013-03-22 11:49:46 +00002109# We want to use use the -Ttext-segment option to the linker.
2110# GNU (bfd) ld supports this directly. Newer GNU gold linkers
2111# support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2112# semantics are NOT what we want (GNU gold -Ttext is fine).
2113#
2114# For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2115# will reside. -Ttext aligns just the .text section start (but not any
2116# other section).
2117#
2118# So test for -Ttext-segment which is supported by all bfd ld versions
2119# and use that if it exists. If it doesn't exist it must be an older
2120# version of gold and we can fall back to using -Ttext which has the
2121# right semantics.
bart699fbac2010-06-08 18:23:59 +00002122
sewardje4bc7032013-03-22 11:49:46 +00002123AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
bart699fbac2010-06-08 18:23:59 +00002124
2125safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002126CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
bart699fbac2010-06-08 18:23:59 +00002127
bart8508c752010-06-10 06:26:21 +00002128AC_LINK_IFELSE(
mjw941277a2013-04-17 19:11:05 +00002129[AC_LANG_SOURCE([int _start () { return 0; }])],
bart699fbac2010-06-08 18:23:59 +00002130[
tom04ce9f52013-03-28 15:53:21 +00002131 linker_using_t_text="no"
sewardje4bc7032013-03-22 11:49:46 +00002132 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
bart699fbac2010-06-08 18:23:59 +00002133 AC_MSG_RESULT([yes])
2134], [
tom04ce9f52013-03-28 15:53:21 +00002135 linker_using_t_text="yes"
sewardje4bc7032013-03-22 11:49:46 +00002136 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
bart699fbac2010-06-08 18:23:59 +00002137 AC_MSG_RESULT([no])
2138])
2139CFLAGS=$safe_CFLAGS
2140
tom04ce9f52013-03-28 15:53:21 +00002141# If the linker only supports -Ttext (not -Ttext-segment) then we will
2142# have to strip any build-id ELF NOTEs from the staticly linked tools.
2143# Otherwise the build-id NOTE might end up at the default load address.
2144# (Pedantically if the linker is gold then -Ttext is fine, but newer
2145# gold versions also support -Ttext-segment. So just assume that unless
2146# we can use -Ttext-segment we need to strip the build-id NOTEs.
florian51b14ee2014-02-22 18:38:32 +00002147if test "x${linker_using_t_text}" = "xyes"; then
tom04ce9f52013-03-28 15:53:21 +00002148AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
2149# does the linker support -Wl,--build-id=none ? Note, it's
2150# important that we test indirectly via whichever C compiler
2151# is selected, rather than testing /usr/bin/ld or whatever
2152# directly.
2153AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
2154safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002155CFLAGS="-Wl,--build-id=none -Werror"
tom04ce9f52013-03-28 15:53:21 +00002156
2157AC_LINK_IFELSE(
2158[AC_LANG_PROGRAM([ ], [return 0;])],
2159[
2160 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
2161 AC_MSG_RESULT([yes])
2162], [
2163 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2164 AC_MSG_RESULT([no])
2165])
2166else
2167AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
2168AC_SUBST([FLAG_NO_BUILD_ID], [""])
2169fi
2170CFLAGS=$safe_CFLAGS
bart699fbac2010-06-08 18:23:59 +00002171
sewardj00f1e622006-03-12 16:47:10 +00002172# does the ppc assembler support "mtocrf" et al?
2173AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
2174
bart417cf3e2011-10-22 09:21:24 +00002175AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjdd4cbe12006-03-12 17:27:44 +00002176__asm__ __volatile__("mtocrf 4,0");
2177__asm__ __volatile__("mfocrf 0,4");
bart417cf3e2011-10-22 09:21:24 +00002178]])], [
sewardj00f1e622006-03-12 16:47:10 +00002179ac_have_as_ppc_mftocrf=yes
2180AC_MSG_RESULT([yes])
2181], [
2182ac_have_as_ppc_mftocrf=no
2183AC_MSG_RESULT([no])
2184])
2185if test x$ac_have_as_ppc_mftocrf = xyes ; then
2186 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2187fi
2188
2189
carll1e5fa2f2013-08-09 21:55:45 +00002190# does the ppc assembler support "lfdp" and other phased out floating point insns?
2191AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2192
2193AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2194 do { typedef struct {
2195 double hi;
2196 double lo;
2197 } dbl_pair_t;
2198 dbl_pair_t dbl_pair[3];
2199 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2200 } while (0)
2201]])], [
2202ac_have_as_ppc_fpPO=yes
2203AC_MSG_RESULT([yes])
2204], [
2205ac_have_as_ppc_fpPO=no
2206AC_MSG_RESULT([no])
2207])
2208if test x$ac_have_as_ppc_fpPO = xyes ; then
2209 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2210fi
2211
sewardjb5b87402011-03-07 16:05:35 +00002212
sewardjf0aabf82007-03-22 00:24:21 +00002213# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00002214# Note, this doesn't generate a C-level symbol. It generates a
2215# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00002216AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2217
bart417cf3e2011-10-22 09:21:24 +00002218AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjf0aabf82007-03-22 00:24:21 +00002219 do { long long int x;
2220 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2221 while (0)
bart417cf3e2011-10-22 09:21:24 +00002222]])], [
sewardjf0aabf82007-03-22 00:24:21 +00002223ac_have_as_sse3=yes
2224AC_MSG_RESULT([yes])
2225], [
2226ac_have_as_sse3=no
2227AC_MSG_RESULT([no])
2228])
sewardjfa18a262007-03-22 12:13:13 +00002229
2230AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00002231
2232
sewardj6d6da5b2008-02-09 12:07:40 +00002233# Ditto for SSSE3 instructions (note extra S)
2234# Note, this doesn't generate a C-level symbol. It generates a
2235# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2236AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2237
florianc443b962011-10-28 21:37:19 +00002238save_CFLAGS="$CFLAGS"
florian538cf302015-06-09 21:53:48 +00002239CFLAGS="$CFLAGS -msse -Werror"
bart417cf3e2011-10-22 09:21:24 +00002240AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj6d6da5b2008-02-09 12:07:40 +00002241 do { long long int x;
2242 __asm__ __volatile__(
2243 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2244 while (0)
bart417cf3e2011-10-22 09:21:24 +00002245]])], [
sewardj6d6da5b2008-02-09 12:07:40 +00002246ac_have_as_ssse3=yes
2247AC_MSG_RESULT([yes])
2248], [
2249ac_have_as_ssse3=no
2250AC_MSG_RESULT([no])
2251])
florianc443b962011-10-28 21:37:19 +00002252CFLAGS="$save_CFLAGS"
sewardj6d6da5b2008-02-09 12:07:40 +00002253
2254AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2255
2256
sewardj27d176a2011-01-17 11:15:48 +00002257# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2258# Note, this doesn't generate a C-level symbol. It generates a
2259# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00002260AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
bart417cf3e2011-10-22 09:21:24 +00002261AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardje3ae8a32010-09-28 19:59:47 +00002262 do {
2263 __asm__ __volatile__(
2264 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2265 while (0)
bart417cf3e2011-10-22 09:21:24 +00002266]])], [
sewardje3ae8a32010-09-28 19:59:47 +00002267ac_have_as_pclmulqdq=yes
2268AC_MSG_RESULT([yes])
2269], [
2270ac_have_as_pclmulqdq=no
2271AC_MSG_RESULT([no])
2272])
2273
2274AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2275
2276
bart9bbe2bb2012-08-03 19:37:02 +00002277# does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2278# Note, this doesn't generate a C-level symbol. It generates a
2279# automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2280AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2281AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2282 do {
2283 /*
2284 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2285 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2286 * xmm2 should be used.
2287 */
2288 __asm__ __volatile__(
2289 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2290 } while (0)
2291]])], [
2292ac_have_as_vpclmulqdq=yes
2293AC_MSG_RESULT([yes])
2294], [
2295ac_have_as_vpclmulqdq=no
2296AC_MSG_RESULT([no])
2297])
2298
2299AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2300
2301
sewardj27d176a2011-01-17 11:15:48 +00002302# does the x86/amd64 assembler understand the LZCNT instruction?
2303# Note, this doesn't generate a C-level symbol. It generates a
2304# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00002305AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2306
bart417cf3e2011-10-22 09:21:24 +00002307AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
bart55e438b2010-09-14 10:53:57 +00002308 do {
sewardjc62291c2012-07-22 11:10:08 +00002309 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
bart55e438b2010-09-14 10:53:57 +00002310 } while (0)
bart417cf3e2011-10-22 09:21:24 +00002311]])], [
bart55e438b2010-09-14 10:53:57 +00002312 ac_have_as_lzcnt=yes
2313 AC_MSG_RESULT([yes])
2314], [
2315 ac_have_as_lzcnt=no
2316 AC_MSG_RESULT([no])
2317])
2318
2319AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2320
sewardj27d176a2011-01-17 11:15:48 +00002321
florian3df02112013-10-04 11:35:50 +00002322# does the x86/amd64 assembler understand the LOOPNEL instruction?
2323# Note, this doesn't generate a C-level symbol. It generates a
2324# automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2325AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2326
2327AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2328 do {
2329 __asm__ __volatile__("1: loopnel 1b\n");
2330 } while (0)
2331]])], [
2332 ac_have_as_loopnel=yes
2333 AC_MSG_RESULT([yes])
2334], [
2335 ac_have_as_loopnel=no
2336 AC_MSG_RESULT([no])
2337])
2338
2339AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2340
2341
2342# does the x86/amd64 assembler understand ADDR32 ?
2343# Note, this doesn't generate a C-level symbol. It generates a
2344# automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2345AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2346
2347AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2348 do {
2349 asm volatile ("addr32 rep movsb");
2350 } while (0)
2351]])], [
2352 ac_have_as_addr32=yes
2353 AC_MSG_RESULT([yes])
2354], [
2355 ac_have_as_addr32=no
2356 AC_MSG_RESULT([no])
2357])
2358
2359AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2360
2361
sewardj27d176a2011-01-17 11:15:48 +00002362# does the x86/amd64 assembler understand SSE 4.2 instructions?
2363# Note, this doesn't generate a C-level symbol. It generates a
2364# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2365AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2366
bart417cf3e2011-10-22 09:21:24 +00002367AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj27d176a2011-01-17 11:15:48 +00002368 do { long long int x;
2369 __asm__ __volatile__(
florianfdfca222012-01-17 13:16:50 +00002370 "crc32q %%r15,%%r15" : : : "r15" );
2371 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002372 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2373 __asm__ __volatile__(
2374 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
sewardj27d176a2011-01-17 11:15:48 +00002375 while (0)
bart417cf3e2011-10-22 09:21:24 +00002376]])], [
sewardj27d176a2011-01-17 11:15:48 +00002377ac_have_as_sse42=yes
2378AC_MSG_RESULT([yes])
2379], [
2380ac_have_as_sse42=no
2381AC_MSG_RESULT([no])
2382])
2383
2384AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2385
2386
sewardj9fb31ca2012-06-05 00:31:49 +00002387# does the x86/amd64 assembler understand AVX instructions?
2388# Note, this doesn't generate a C-level symbol. It generates a
2389# automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2390AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2391
2392AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2393 do { long long int x;
2394 __asm__ __volatile__(
2395 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2396 __asm__ __volatile__(
2397 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2398 while (0)
2399]])], [
2400ac_have_as_avx=yes
2401AC_MSG_RESULT([yes])
2402], [
2403ac_have_as_avx=no
2404AC_MSG_RESULT([no])
2405])
2406
2407AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2408
2409
sewardjfda50af2013-03-27 11:43:20 +00002410# does the x86/amd64 assembler understand AVX2 instructions?
2411# Note, this doesn't generate a C-level symbol. It generates a
2412# automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2413AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2414
2415AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2416 do { long long int x;
2417 __asm__ __volatile__(
2418 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2419 __asm__ __volatile__(
2420 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2421 while (0)
2422]])], [
2423ac_have_as_avx2=yes
2424AC_MSG_RESULT([yes])
2425], [
2426ac_have_as_avx2=no
2427AC_MSG_RESULT([no])
2428])
2429
2430AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2431
2432
sewardj9ea080b2013-10-16 08:53:07 +00002433# does the x86/amd64 assembler understand TSX instructions and
2434# the XACQUIRE/XRELEASE prefixes?
florian364c3652013-09-30 16:32:53 +00002435# Note, this doesn't generate a C-level symbol. It generates a
2436# automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2437AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2438
2439AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2440 do {
2441 __asm__ __volatile__(
2442 " xbegin Lfoo \n\t"
sewardj9ea080b2013-10-16 08:53:07 +00002443 "Lfoo: xend \n\t"
2444 " xacquire lock incq 0(%rsp) \n\t"
2445 " xrelease lock incq 0(%rsp) \n"
2446 );
florian364c3652013-09-30 16:32:53 +00002447 } while (0)
2448]])], [
2449ac_have_as_tsx=yes
2450AC_MSG_RESULT([yes])
2451], [
2452ac_have_as_tsx=no
2453AC_MSG_RESULT([no])
2454])
2455
2456AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2457
2458
sewardjfda50af2013-03-27 11:43:20 +00002459# does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2460# Note, this doesn't generate a C-level symbol. It generates a
2461# automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2462AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2463
2464AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2465 do { unsigned int h, l;
florian4e94bda2014-10-29 13:57:49 +00002466 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
sewardjfda50af2013-03-27 11:43:20 +00002467 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002468 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
sewardjfda50af2013-03-27 11:43:20 +00002469 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002470 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
sewardjfda50af2013-03-27 11:43:20 +00002471 while (0)
2472]])], [
2473ac_have_as_bmi=yes
2474AC_MSG_RESULT([yes])
2475], [
2476ac_have_as_bmi=no
2477AC_MSG_RESULT([no])
2478])
2479
2480AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2481
2482
2483# does the x86/amd64 assembler understand FMA instructions?
2484# Note, this doesn't generate a C-level symbol. It generates a
2485# automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2486AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2487
2488AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2489 do { unsigned int h, l;
2490 __asm__ __volatile__(
2491 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2492 __asm__ __volatile__(
2493 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2494 __asm__ __volatile__(
2495 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2496 while (0)
2497]])], [
2498ac_have_as_fma=yes
2499AC_MSG_RESULT([yes])
2500], [
2501ac_have_as_fma=no
2502AC_MSG_RESULT([no])
2503])
2504
2505AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2506
2507
mjw20bafc22014-05-09 11:41:46 +00002508# does the amd64 assembler understand MPX instructions?
2509# Note, this doesn't generate a C-level symbol. It generates a
2510# automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2511AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2512
2513AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
florian404c0c72014-12-12 17:44:36 +00002514 do {
2515 asm ("bndmov %bnd0,(%rsp)");
2516 asm ("bndldx 3(%rbx,%rdx), %bnd2");
2517 } while (0)
mjw20bafc22014-05-09 11:41:46 +00002518]])], [
2519ac_have_as_mpx=yes
2520AC_MSG_RESULT([yes])
2521], [
2522ac_have_as_mpx=no
2523AC_MSG_RESULT([no])
2524])
2525
2526AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2527
2528
2529# Does the C compiler support the "ifunc" attribute
2530# Note, this doesn't generate a C-level symbol. It generates a
2531# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
sewardjb08d84d2012-07-16 08:23:26 +00002532# does the x86/amd64 assembler understand MOVBE?
2533# Note, this doesn't generate a C-level symbol. It generates a
2534# automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2535AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2536
2537AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2538 do { long long int x;
2539 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002540 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
sewardjb08d84d2012-07-16 08:23:26 +00002541 while (0)
2542]])], [
2543ac_have_as_movbe=yes
2544AC_MSG_RESULT([yes])
2545], [
2546ac_have_as_movbe=no
2547AC_MSG_RESULT([no])
2548])
2549
2550AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2551
2552
florian251c2f92012-07-05 21:21:37 +00002553# Does the C compiler support the "ifunc" attribute
2554# Note, this doesn't generate a C-level symbol. It generates a
2555# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2556AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2557
florianf78a5032012-07-06 09:17:29 +00002558AC_LINK_IFELSE([AC_LANG_SOURCE([[
2559static void mytest(void) {}
2560
2561static void (*resolve_test(void))(void)
2562{
2563 return (void (*)(void))&mytest;
2564}
2565
2566void test(void) __attribute__((ifunc("resolve_test")));
2567
2568int main()
2569{
2570 test();
2571 return 0;
2572}
florian251c2f92012-07-05 21:21:37 +00002573]])], [
2574ac_have_ifunc_attr=yes
2575AC_MSG_RESULT([yes])
2576], [
2577ac_have_ifunc_attr=no
2578AC_MSG_RESULT([no])
2579])
2580
2581AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2582
2583
sewardje089f012010-10-13 21:47:29 +00002584# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2585# when building the tool executables. I think we should get rid of it.
2586#
sewardjb5f6f512005-03-10 23:59:00 +00002587# Check for TLS support in the compiler and linker
bart2bd9a682011-10-22 09:46:16 +00002588AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2589 [[return foo;]])],
2590 [vg_cv_linktime_tls=yes],
2591 [vg_cv_linktime_tls=no])
bartca9f2ad2008-06-02 07:14:20 +00002592# Native compilation: check whether running a program using TLS succeeds.
2593# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2594# succeeds but running programs using TLS fails.
bart2bd9a682011-10-22 09:46:16 +00002595# Cross-compiling: check whether linking a program using TLS succeeds.
bartca9f2ad2008-06-02 07:14:20 +00002596AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2597 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2598 [vg_cv_tls=$enableval],
2599 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2600 [[return foo;]])],
2601 [vg_cv_tls=yes],
bart2bd9a682011-10-22 09:46:16 +00002602 [vg_cv_tls=no],
2603 [vg_cv_tls=$vg_cv_linktime_tls])])])
sewardjb5f6f512005-03-10 23:59:00 +00002604
rhyskidd34cba1b2015-06-08 08:56:33 +00002605if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
sewardjb5f6f512005-03-10 23:59:00 +00002606AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2607fi
sewardj5b754b42002-06-03 22:53:35 +00002608
sewardj535c50f2005-06-04 23:14:53 +00002609
njn7fd6d382009-01-22 21:56:32 +00002610#----------------------------------------------------------------------------
sewardj8eb8bab2015-07-21 14:44:28 +00002611# Solaris-specific checks.
2612#----------------------------------------------------------------------------
2613
2614if test "$VGCONF_OS" = "solaris" ; then
2615# Solaris-specific check determining if the Sun Studio Assembler is used to
2616# build Valgrind. The test checks if the x86/amd64 assembler understands the
2617# cmovl.l instruction, if yes then it's Sun Assembler.
2618#
2619# C-level symbol: none
2620# Automake-level symbol: SOLARIS_SUN_STUDIO_AS
2621#
2622AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
2623AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2624]], [[
2625 __asm__ __volatile__("cmovl.l %edx, %eax");
2626]])], [
2627solaris_have_sun_studio_as=yes
2628AC_MSG_RESULT([yes])
2629], [
2630solaris_have_sun_studio_as=no
2631AC_MSG_RESULT([no])
2632])
2633AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
2634
2635# Solaris-specific check determining if symbols __xpg4 and __xpg6
2636# are present in linked elfs when gcc is invoked with -std=gnu99.
2637# See solaris/vgpreload-solaris.mapfile for details.
2638# gcc on Solaris instructs linker to include these symbols,
2639# gcc on illumos does not.
2640#
2641# C-level symbol: none
2642# Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
2643#
2644save_CFLAGS="$CFLAGS"
2645CFLAGS="$CFLAGS -std=gnu99"
2646AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
2647AC_RUN_IFELSE([AC_LANG_SOURCE([[
2648#include <limits.h>
2649#include <stdio.h>
2650#include <stdlib.h>
2651
2652int main(int argc, const char *argv[]) {
2653 char command[PATH_MAX + 50];
2654 snprintf(command, sizeof(command), "nm %s | egrep '__xpg[4,6]'", argv[0]);
2655
2656 FILE *output = popen(command, "r");
2657 if (output == NULL) return -1;
2658
2659 char buf[100];
2660 if (fgets(buf, sizeof(buf), output) != NULL) {
2661 pclose(output);
2662 return 0;
2663 } else {
2664 pclose(output);
2665 return 1;
2666 }
2667}
2668]])], [
2669solaris_xpg_symbols_present=yes
2670AC_MSG_RESULT([yes])
2671], [
2672solaris_xpg_symbols_present=no
2673AC_MSG_RESULT([no])
2674])
2675AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
2676CFLAGS="$save_CFLAGS"
2677
2678
iraisr23e68ca2015-08-14 20:50:11 +00002679# Solaris-specific check determining if /proc/self/cmdline
2680# or /proc/<pid>/cmdline is supported.
2681#
2682# C-level symbol: SOLARIS_PROC_CMDLINE
2683# Automake-level symbol: SOLARIS_PROC_CMDLINE
2684#
2685AC_CHECK_FILE([/proc/self/cmdline],
2686[
2687solaris_proc_cmdline=yes
2688AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
2689 [Define to 1 if you have /proc/self/cmdline.])
2690], [
2691solaris_proc_cmdline=no
2692])
2693AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
2694
2695
sewardj8eb8bab2015-07-21 14:44:28 +00002696# Solaris-specific check determining default platform for the Valgrind launcher.
2697# Used in case the launcher cannot select platform by looking at the client
2698# image (for example because the executable is a shell script).
2699#
2700# C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
2701# Automake-level symbol: none
2702#
2703AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
2704# Get the ELF class of /bin/sh first.
2705if ! test -f /bin/sh; then
2706 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
2707fi
2708elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
2709case "$elf_class" in
2710 64)
2711 default_arch="$VGCONF_ARCH_PRI";
2712 ;;
2713 32)
2714 if test "x$VGCONF_ARCH_SEC" != "x"; then
2715 default_arch="$VGCONF_ARCH_SEC"
2716 else
2717 default_arch="$VGCONF_ARCH_PRI";
2718 fi
2719 ;;
2720 *)
2721 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
2722 ;;
2723esac
2724default_platform="$default_arch-$VGCONF_OS"
2725AC_MSG_RESULT([$default_platform])
2726AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
2727 [Default platform for Valgrind launcher.])
2728
2729
2730# Solaris-specific check determining if the old syscalls are available.
2731#
2732# C-level symbol: SOLARIS_OLD_SYSCALLS
2733# Automake-level symbol: SOLARIS_OLD_SYSCALLS
2734#
2735AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
2736AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2737#include <sys/syscall.h>
2738]], [[
2739 return !SYS_open;
2740]])], [
2741solaris_old_syscalls=yes
2742AC_MSG_RESULT([yes])
2743AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
2744 [Define to 1 if you have the old Solaris syscalls.])
2745], [
2746solaris_old_syscalls=no
2747AC_MSG_RESULT([no])
2748])
2749AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
2750
2751
2752# Solaris-specific check determining if the new accept() syscall is available.
2753#
2754# Old syscall:
2755# int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2756# int version);
2757#
2758# New syscall (available on illumos):
2759# int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2760# int version, int flags);
2761#
2762# If the old syscall is present then the following syscall will fail with
2763# ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
2764# available then it will fail with EINVAL (because the flags parameter is
2765# invalid).
2766#
2767# C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
2768# Automake-level symbol: none
2769#
2770AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
2771AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2772#include <sys/syscall.h>
2773#include <errno.h>
2774]], [[
2775 errno = 0;
2776 syscall(SYS_accept, 0, 0, 0, 0, -1);
2777 return !(errno == EINVAL);
2778]])], [
2779AC_MSG_RESULT([yes])
2780AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
2781 [Define to 1 if you have the new `accept' syscall.])
2782], [
2783AC_MSG_RESULT([no])
2784])
2785
2786
2787# Solaris-specific check determining if the new illumos pipe() syscall is
2788# available.
2789#
2790# Old syscall:
2791# longlong_t pipe();
2792#
2793# New syscall (available on illumos):
2794# int pipe(intptr_t arg, int flags);
2795#
2796# If the old syscall is present then the following call will succeed, if the
2797# new syscall is available then it will fail with EFAULT (because address 0
2798# cannot be accessed).
2799#
2800# C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
2801# Automake-level symbol: none
2802#
2803AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
2804AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2805#include <sys/syscall.h>
2806#include <errno.h>
2807]], [[
2808 errno = 0;
2809 syscall(SYS_pipe, 0, 0);
2810 return !(errno == EFAULT);
2811]])], [
2812AC_MSG_RESULT([yes])
2813AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
2814 [Define to 1 if you have the new `pipe' syscall.])
2815], [
2816AC_MSG_RESULT([no])
2817])
2818
2819
2820# Solaris-specific check determining if the new lwp_sigqueue() syscall is
2821# available.
2822#
2823# Old syscall:
2824# int lwp_kill(id_t lwpid, int sig);
2825#
2826# New syscall (available on Solaris 11):
2827# int lwp_sigqueue(id_t lwpid, int sig, void *value,
2828# int si_code, timespec_t *timeout);
2829#
2830# C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
2831# Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
2832#
2833AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
2834AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2835#include <sys/syscall.h>
2836]], [[
2837 return !SYS_lwp_sigqueue;
2838]])], [
2839solaris_lwp_sigqueue_syscall=yes
2840AC_MSG_RESULT([yes])
2841AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
2842 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
2843], [
2844solaris_lwp_sigqueue_syscall=no
2845AC_MSG_RESULT([no])
2846])
2847AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
2848
2849
2850# Solaris-specific check determining if the lwp_sigqueue() syscall
2851# takes both pid and thread id arguments or just thread id.
2852#
2853# Old syscall (available on Solaris 11.x):
2854# int lwp_sigqueue(id_t lwpid, int sig, void *value,
2855# int si_code, timespec_t *timeout);
2856#
2857# New syscall (available on Solaris 12):
2858# int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
2859# int si_code, timespec_t *timeout);
2860#
2861# If the old syscall is present then the following syscall will fail with
2862# EINVAL (because signal is out of range); if the new syscall is available
2863# then it will fail with ESRCH (because it would not find such thread in the
2864# current process).
2865#
2866# C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
2867# Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
2868#
2869AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
2870AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
2871AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2872#include <sys/syscall.h>
2873#include <errno.h>
2874]], [[
2875 errno = 0;
2876 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
2877 return !(errno == ESRCH);
2878]])], [
2879solaris_lwp_sigqueue_syscall_takes_pid=yes
2880AC_MSG_RESULT([yes])
2881AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
2882 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
2883], [
2884solaris_lwp_sigqueue_syscall_takes_pid=no
2885AC_MSG_RESULT([no])
2886])
2887AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
2888 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
2889,
2890AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
2891)
2892
2893
2894# Solaris-specific check determining if the new lwp_name() syscall is
2895# available.
2896#
2897# New syscall (available on Solaris 11):
2898# int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
2899#
2900# C-level symbol: SOLARIS_LWP_NAME_SYSCALL
2901# Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
2902#
2903AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
2904AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2905#include <sys/syscall.h>
2906]], [[
2907 return !SYS_lwp_name;
2908]])], [
2909solaris_lwp_name_syscall=yes
2910AC_MSG_RESULT([yes])
2911AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
2912 [Define to 1 if you have the new `lwp_name' syscall.])
2913], [
2914solaris_lwp_name_syscall=no
2915AC_MSG_RESULT([no])
2916])
2917AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
2918
2919
2920# Solaris-specific check determining if the new zone() syscall subcodes
2921# ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
2922# were added in Solaris 11 but are missing on illumos.
2923#
2924# C-level symbol: SOLARIS_ZONE_DEFUNCT
2925# Automake-level symbol: SOLARIS_ZONE_DEFUNCT
2926#
2927AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
2928AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2929#include <sys/zone.h>
2930]], [[
2931 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
2932]])], [
2933solaris_zone_defunct=yes
2934AC_MSG_RESULT([yes])
2935AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
2936 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
2937], [
2938solaris_zone_defunct=no
2939AC_MSG_RESULT([no])
2940])
2941AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
2942
2943
2944# Solaris-specific check determining if the new shmsys() syscall subcodes
2945# IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
2946# These subcodes were added in Solaris 11 but are missing on illumos.
2947#
2948# C-level symbol: SOLARIS_SHM_NEW
2949# Automake-level symbol: SOLARIS_SHM_NEW
2950#
2951AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
2952AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2953#include <sys/ipc_impl.h>
2954#include <sys/shm.h>
2955#include <sys/shm_impl.h>
2956]], [[
2957 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
2958]])], [
2959solaris_shm_new=yes
2960AC_MSG_RESULT([yes])
2961AC_DEFINE([SOLARIS_SHM_NEW], 1,
2962 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
2963], [
2964solaris_shm_new=no
2965AC_MSG_RESULT([no])
2966])
2967AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
2968
2969
2970# Solaris-specific check determining if prxregset_t is available. Illumos
2971# currently does not define it on the x86 platform.
2972#
2973# C-level symbol: SOLARIS_PRXREGSET_T
2974# Automake-level symbol: SOLARIS_PRXREGSET_T
2975#
2976AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
2977AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2978#include <sys/procfs_isa.h>
2979]], [[
2980 return !sizeof(prxregset_t);
2981]])], [
2982solaris_prxregset_t=yes
2983AC_MSG_RESULT([yes])
2984AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
2985 [Define to 1 if you have the `prxregset_t' type.])
2986], [
2987solaris_prxregset_t=no
2988AC_MSG_RESULT([no])
2989])
2990AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
2991
2992
2993# Solaris-specific check determining if the new frealpathat() syscall is
2994# available.
2995#
2996# New syscall (available on Solaris 11.1):
2997# int frealpathat(int fd, char *path, char *buf, size_t buflen);
2998#
2999# C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3000# Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3001#
3002AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
3003AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3004#include <sys/syscall.h>
3005]], [[
3006 return !SYS_frealpathat;
3007]])], [
3008solaris_frealpathat_syscall=yes
3009AC_MSG_RESULT([yes])
3010AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
3011 [Define to 1 if you have the new `frealpathat' syscall.])
3012], [
3013solaris_frealpathat_syscall=no
3014AC_MSG_RESULT([no])
3015])
3016AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
3017
3018
3019# Solaris-specific check determining if the new uuidsys() syscall is
3020# available.
3021#
3022# New syscall (available on newer Solaris):
3023# int uuidsys(struct uuid *uuid);
3024#
3025# C-level symbol: SOLARIS_UUIDSYS_SYSCALL
3026# Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
3027#
3028AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
3029AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3030#include <sys/syscall.h>
3031]], [[
3032 return !SYS_uuidsys;
3033]])], [
3034solaris_uuidsys_syscall=yes
3035AC_MSG_RESULT([yes])
3036AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
3037 [Define to 1 if you have the new `uuidsys' syscall.])
3038], [
3039solaris_uuidsys_syscall=no
3040AC_MSG_RESULT([no])
3041])
3042AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
3043
3044
3045# Solaris-specific check determining if the new labelsys() syscall subcode
3046# TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
3047# missing on illumos.
3048#
3049# C-level symbol: SOLARIS_TNDB_GET_TNIP
3050# Automake-level symbol: SOLARIS_TNDB_GET_TNIP
3051#
3052AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
3053AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3054#include <sys/tsol/tndb.h>
3055]], [[
3056 return !TNDB_GET_TNIP;
3057]])], [
3058solaris_tndb_get_tnip=yes
3059AC_MSG_RESULT([yes])
3060AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
3061 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
3062], [
3063solaris_tndb_get_tnip=no
3064AC_MSG_RESULT([no])
3065])
3066AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
3067
3068
3069# Solaris-specific check determining if the new labelsys() syscall opcodes
3070# TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
3071# added in Solaris 11 but are missing on illumos.
3072#
3073# C-level symbol: SOLARIS_TSOL_CLEARANCE
3074# Automake-level symbol: SOLARIS_TSOL_CLEARANCE
3075#
3076AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
3077AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3078#include <sys/tsol/tsyscall.h>
3079]], [[
3080 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
3081]])], [
3082solaris_tsol_clearance=yes
3083AC_MSG_RESULT([yes])
3084AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
3085 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
3086], [
3087solaris_tsol_clearance=no
3088AC_MSG_RESULT([no])
3089])
3090AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
3091
3092
3093# Solaris-specific check determining if the utimesys() syscall is
3094# available (on illumos and older Solaris).
3095#
3096# C-level symbol: SOLARIS_UTIMESYS_SYSCALL
3097# Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
3098#
3099AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
3100AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3101#include <sys/syscall.h>
3102]], [[
3103 return !SYS_utimesys;
3104]])], [
3105solaris_utimesys_syscall=yes
3106AC_MSG_RESULT([yes])
3107AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
3108 [Define to 1 if you have the `utimesys' syscall.])
3109], [
3110solaris_utimesys_syscall=no
3111AC_MSG_RESULT([no])
3112])
3113AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
3114
3115
3116# Solaris-specific check determining if the utimensat() syscall is
3117# available (on newer Solaris).
3118#
3119# C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3120# Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3121#
3122AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
3123AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3124#include <sys/syscall.h>
3125]], [[
3126 return !SYS_utimensat;
3127]])], [
3128solaris_utimensat_syscall=yes
3129AC_MSG_RESULT([yes])
3130AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
3131 [Define to 1 if you have the `utimensat' syscall.])
3132], [
3133solaris_utimensat_syscall=no
3134AC_MSG_RESULT([no])
3135])
3136AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
3137
3138
3139# Solaris-specific check determining if the spawn() syscall is available
3140# (on newer Solaris).
3141#
3142# C-level symbol: SOLARIS_SPAWN_SYSCALL
3143# Automake-level symbol: SOLARIS_SPAWN_SYSCALL
3144#
3145AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
3146AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3147#include <sys/syscall.h>
3148]], [[
3149 return !SYS_spawn;
3150]])], [
3151solaris_spawn_syscall=yes
3152AC_MSG_RESULT([yes])
3153AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
3154 [Define to 1 if you have the `spawn' syscall.])
3155], [
3156solaris_spawn_syscall=no
3157AC_MSG_RESULT([no])
3158])
3159AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
3160
3161
3162# Solaris-specific check determining whether nscd (name switch cache daemon)
3163# attaches its door at /system/volatile/name_service_door (Solaris)
3164# or at /var/run/name_service_door (illumos).
3165#
3166# Note that /var/run is a symlink to /system/volatile on Solaris
3167# but not vice versa on illumos.
3168#
3169# C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3170# Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3171#
3172AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
3173if test -e /system/volatile/name_service_door; then
3174 solaris_nscd_door_system_volatile=yes
3175 AC_MSG_RESULT([/system/volatile/name_service_door])
3176 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
3177 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
3178else
3179 solaris_nscd_door_system_volatile=no
3180 AC_MSG_RESULT([/var/run/name_service_door])
3181fi
3182AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
3183
3184
3185# Solaris-specific check determining if the new gethrt() fasttrap is available.
3186#
3187# New fasttrap (available on Solaris 11):
3188# hrt_t *gethrt(void);
3189#
3190# C-level symbol: SOLARIS_GETHRT_FASTTRAP
3191# Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
3192#
3193AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
3194AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3195#include <sys/trap.h>
3196]], [[
3197 return !T_GETHRT;
3198]])], [
3199solaris_gethrt_fasttrap=yes
3200AC_MSG_RESULT([yes])
3201AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
3202 [Define to 1 if you have the new `gethrt' fasttrap.])
3203], [
3204solaris_gethrt_fasttrap=no
3205AC_MSG_RESULT([no])
3206])
3207AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
3208
3209
3210# Solaris-specific check determining if the new get_zone_offset() fasttrap
3211# is available.
3212#
3213# New fasttrap (available on Solaris 11):
3214# zonehrtoffset_t *get_zone_offset(void);
3215#
3216# C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3217# Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3218#
3219AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
3220AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3221#include <sys/trap.h>
3222]], [[
3223 return !T_GETZONEOFFSET;
3224]])], [
3225solaris_getzoneoffset_fasttrap=yes
3226AC_MSG_RESULT([yes])
3227AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
3228 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
3229], [
3230solaris_getzoneoffset_fasttrap=no
3231AC_MSG_RESULT([no])
3232])
3233AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
3234
3235
3236# Solaris-specific check determining if the execve() syscall
3237# takes fourth argument (flags) or not.
3238#
3239# Old syscall (available on illumos):
3240# int execve(const char *fname, const char **argv, const char **envp);
3241#
3242# New syscall (available on Solaris):
3243# int execve(uintptr_t file, const char **argv, const char **envp, int flags);
3244#
3245# If the new syscall is present then it will fail with EINVAL (because flags
3246# are invalid); if the old syscall is available then it will fail with ENOENT
3247# (because the file could not be found).
3248#
3249# C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3250# Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3251#
3252AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
3253AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3254#include <sys/syscall.h>
3255#include <errno.h>
3256]], [[
3257 errno = 0;
3258 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
3259 return !(errno == EINVAL);
3260]])], [
3261solaris_execve_syscall_takes_flags=yes
3262AC_MSG_RESULT([yes])
3263AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
3264 [Define to 1 if you have the new `execve' syscall which accepts flags.])
3265], [
3266solaris_execve_syscall_takes_flags=no
3267AC_MSG_RESULT([no])
3268])
3269AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
3270 test x$solaris_execve_syscall_takes_flags = xyes)
3271
3272
3273# Solaris-specific check determining version of the repository cache protocol.
3274# Every Solaris version uses a different one, ranging from 21 to current 25.
3275# The check is very ugly, though.
3276#
3277# C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
3278# Automake-level symbol: none
3279#
3280AC_PATH_PROG(DIS_PATH, dis, false)
3281if test "x$DIS_PATH" = "xfalse"; then
3282 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
3283fi
3284AC_CHECK_LIB(scf, scf_handle_bind, [], [
3285 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
3286 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3287])
3288
3289AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
3290if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
3291 libscf=/usr/lib/64/libscf.so.1
3292else
3293 libscf=/usr/lib/libscf.so.1
3294fi
3295if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
3296 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
3297 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3298fi
3299hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
3300if test -z "$hex"; then
3301 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
3302 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3303fi
3304version=$( printf "%d\n" 0x$hex )
3305AC_MSG_RESULT([$version])
3306AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
3307 [Version number of the repository door cache protocol.])
3308
iraisrfa0a7f42015-08-01 21:53:08 +00003309
3310# Solaris-specific check determining if "sysstat" segment reservation type
3311# is available.
3312#
3313# New "sysstat" segment reservation (available on Solaris 12):
3314# - program header type: PT_SUNW_SYSSTAT
3315# - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
3316#
3317# C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3318# Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3319#
3320AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
3321AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3322#include <sys/auxv.h>
3323]], [[
3324 return !AT_SUN_SYSSTAT_ADDR;
3325]])], [
3326solaris_reserve_sysstat_addr=yes
3327AC_MSG_RESULT([yes])
3328AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
3329 [Define to 1 if you have the new `sysstat' segment reservation.])
3330], [
3331solaris_reserve_sysstat_addr=no
3332AC_MSG_RESULT([no])
3333])
3334AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
3335
3336
3337# Solaris-specific check determining if "sysstat_zone" segment reservation type
3338# is available.
3339#
3340# New "sysstat_zone" segment reservation (available on Solaris 12):
3341# - program header type: PT_SUNW_SYSSTAT_ZONE
3342# - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
3343#
3344# C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3345# Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3346#
3347AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
3348AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3349#include <sys/auxv.h>
3350]], [[
3351 return !AT_SUN_SYSSTAT_ZONE_ADDR;
3352]])], [
3353solaris_reserve_sysstat_zone_addr=yes
3354AC_MSG_RESULT([yes])
3355AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
3356 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
3357], [
3358solaris_reserve_sysstat_zone_addr=no
3359AC_MSG_RESULT([no])
3360])
3361AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
3362
sewardj8eb8bab2015-07-21 14:44:28 +00003363else
3364AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
3365AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
iraisr23e68ca2015-08-14 20:50:11 +00003366AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003367AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
3368AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
3369AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
3370AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
3371AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
3372AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
3373AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
3374AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
3375AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
3376AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
3377AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
3378AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
3379AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
3380AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
3381AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
3382AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
3383AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
3384AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
iraisrfa0a7f42015-08-01 21:53:08 +00003385AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
3386AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003387fi # test "$VGCONF_OS" = "solaris"
3388
3389
3390#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00003391# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00003392#----------------------------------------------------------------------------
3393
sewardjde4a1d02002-03-22 01:27:54 +00003394AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00003395AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00003396 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00003397 endian.h \
3398 mqueue.h \
3399 sys/endian.h \
3400 sys/epoll.h \
3401 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00003402 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00003403 sys/poll.h \
sewardj8eb8bab2015-07-21 14:44:28 +00003404 sys/prctl.h \
bart71bad292008-04-27 11:43:23 +00003405 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00003406 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00003407 sys/syscall.h \
3408 sys/time.h \
3409 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00003410 ])
sewardjde4a1d02002-03-22 01:27:54 +00003411
bart818f17e2011-09-17 06:24:49 +00003412# Verify whether the <linux/futex.h> header is usable.
3413AC_MSG_CHECKING([if <linux/futex.h> is usable])
3414
sewardjc12486b2012-12-17 14:46:48 +00003415save_CFLAGS="$CFLAGS"
3416CFLAGS="$CFLAGS -D__user="
bart417cf3e2011-10-22 09:21:24 +00003417AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart818f17e2011-09-17 06:24:49 +00003418#include <linux/futex.h>
bart417cf3e2011-10-22 09:21:24 +00003419]], [[
bart818f17e2011-09-17 06:24:49 +00003420 return FUTEX_WAIT;
bart417cf3e2011-10-22 09:21:24 +00003421]])], [
bart78bfc712011-12-08 16:14:59 +00003422ac_have_usable_linux_futex_h=yes
bart818f17e2011-09-17 06:24:49 +00003423AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
3424 [Define to 1 if you have a usable <linux/futex.h> header file.])
3425AC_MSG_RESULT([yes])
3426], [
bart78bfc712011-12-08 16:14:59 +00003427ac_have_usable_linux_futex_h=no
bart818f17e2011-09-17 06:24:49 +00003428AC_MSG_RESULT([no])
3429])
sewardjc12486b2012-12-17 14:46:48 +00003430CFLAGS="$save_CFLAGS"
3431
bart818f17e2011-09-17 06:24:49 +00003432
njn7fd6d382009-01-22 21:56:32 +00003433#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003434# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00003435#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003436AC_TYPE_UID_T
3437AC_TYPE_OFF_T
3438AC_TYPE_SIZE_T
3439AC_HEADER_TIME
3440
sewardj535c50f2005-06-04 23:14:53 +00003441
njn7fd6d382009-01-22 21:56:32 +00003442#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003443# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00003444#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003445AC_FUNC_MEMCMP
3446AC_FUNC_MMAP
sewardjde4a1d02002-03-22 01:27:54 +00003447
bart26288e42011-04-03 16:46:01 +00003448AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00003449AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00003450
bartf5ceec82008-04-26 07:45:10 +00003451AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00003452 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00003453 epoll_create \
3454 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00003455 klogctl \
bartf5ceec82008-04-26 07:45:10 +00003456 mallinfo \
3457 memchr \
3458 memset \
3459 mkdir \
njnf76d27a2009-05-28 01:53:07 +00003460 mremap \
bartf5ceec82008-04-26 07:45:10 +00003461 ppoll \
bart6d45e922009-01-20 13:45:38 +00003462 pthread_barrier_init \
3463 pthread_condattr_setclock \
3464 pthread_mutex_timedlock \
3465 pthread_rwlock_timedrdlock \
3466 pthread_rwlock_timedwrlock \
3467 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00003468 pthread_yield \
florianc5325ef2013-09-17 20:15:36 +00003469 pthread_setname_np \
bartd1f724c2009-08-26 18:11:18 +00003470 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00003471 semtimedop \
3472 signalfd \
njn6cc22472009-03-16 03:46:48 +00003473 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00003474 strchr \
3475 strdup \
3476 strpbrk \
3477 strrchr \
3478 strstr \
barta72a27b2010-04-29 06:22:17 +00003479 syscall \
bartf5ceec82008-04-26 07:45:10 +00003480 utimensat \
tom9e4b6362012-02-10 09:39:37 +00003481 process_vm_readv \
3482 process_vm_writev \
bartf5ceec82008-04-26 07:45:10 +00003483 ])
sewardjde4a1d02002-03-22 01:27:54 +00003484
bart623eec32008-07-29 17:54:49 +00003485# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
3486# libraries with any shared object and/or executable. This is NOT what we
3487# want for e.g. vgpreload_core-x86-linux.so
3488LIBS=""
sewardj80637752006-03-02 13:48:21 +00003489
bart6d45e922009-01-20 13:45:38 +00003490AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
3491 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00003492AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
3493 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00003494AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
3495 [test x$ac_cv_func_pthread_spin_lock = xyes])
florianc5325ef2013-09-17 20:15:36 +00003496AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
3497 [test x$ac_cv_func_pthread_setname_np = xyes])
bart6d45e922009-01-20 13:45:38 +00003498
petarjc37cea62013-06-02 18:08:04 +00003499if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3500 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
petarj6d79b742012-12-20 18:56:57 +00003501 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
petarjc37cea62013-06-02 18:08:04 +00003502 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
petarj6d79b742012-12-20 18:56:57 +00003503fi
njn7fd6d382009-01-22 21:56:32 +00003504
3505#----------------------------------------------------------------------------
3506# MPI checks
3507#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00003508# Do we have a useable MPI setup on the primary and/or secondary targets?
3509# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00003510# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00003511# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00003512# --with-mpicc=.
mjw46f25042014-08-21 10:04:04 +00003513AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
3514 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
sewardj03d86f22006-10-17 00:57:24 +00003515
sewardje9fa5062006-03-12 18:29:18 +00003516mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00003517if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00003518 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj5db15402012-06-07 09:13:21 +00003519 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +00003520 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +00003521 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
3522 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
sewardje9fa5062006-03-12 18:29:18 +00003523 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00003524elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00003525 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
sewardjf0c12502014-01-12 12:54:00 +00003526 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00003527 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00003528 mflag_primary=$FLAG_M64
philippef7c54332012-05-17 15:32:54 +00003529elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
3530 mflag_primary="$FLAG_M32 -arch i386"
3531elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
3532 mflag_primary="$FLAG_M64 -arch x86_64"
sewardje9fa5062006-03-12 18:29:18 +00003533fi
3534
sewardj03d86f22006-10-17 00:57:24 +00003535mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00003536if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +00003537 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
3538 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS ; then
sewardj03d86f22006-10-17 00:57:24 +00003539 mflag_secondary=$FLAG_M32
philippef7c54332012-05-17 15:32:54 +00003540elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
3541 mflag_secondary="$FLAG_M32 -arch i386"
sewardj03d86f22006-10-17 00:57:24 +00003542fi
3543
3544
sewardj0ad46092006-03-02 17:09:16 +00003545AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00003546 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00003547 MPI_CC=$withval
3548)
sewardj03d86f22006-10-17 00:57:24 +00003549AC_SUBST(MPI_CC)
3550
philippef7c54332012-05-17 15:32:54 +00003551## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
3552## use these values in the check for a functioning mpicc.
3553##
3554## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
3555## mflag_primary/mflag_secondary are sufficient approximations of that behavior
3556AM_COND_IF([VGCONF_OS_IS_LINUX],
3557 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3558 LDFLAGS_MPI="-fpic -shared"])
3559AM_COND_IF([VGCONF_OS_IS_DARWIN],
3560 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
3561 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
sewardj8eb8bab2015-07-21 14:44:28 +00003562AM_COND_IF([VGCONF_OS_IS_SOLARIS],
3563 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3564 LDFLAGS_MPI="-fpic -shared"])
philippef7c54332012-05-17 15:32:54 +00003565
3566AC_SUBST([CFLAGS_MPI])
3567AC_SUBST([LDFLAGS_MPI])
3568
3569
sewardj03d86f22006-10-17 00:57:24 +00003570## See if MPI_CC works for the primary target
3571##
3572AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00003573saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00003574saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00003575CC=$MPI_CC
philippef7c54332012-05-17 15:32:54 +00003576CFLAGS="$CFLAGS_MPI $mflag_primary"
3577saved_LDFLAGS="$LDFLAGS"
3578LDFLAGS="$LDFLAGS_MPI $mflag_primary"
bart417cf3e2011-10-22 09:21:24 +00003579AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj1a85e602006-03-08 15:26:10 +00003580#include <mpi.h>
3581#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00003582]], [[
philippef7c54332012-05-17 15:32:54 +00003583 int ni, na, nd, comb;
sewardjde4f3842006-03-09 02:41:41 +00003584 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00003585 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
3586 r |= MPI_Finalize();
sewardjde4f3842006-03-09 02:41:41 +00003587 return r;
bart417cf3e2011-10-22 09:21:24 +00003588]])], [
sewardj03d86f22006-10-17 00:57:24 +00003589ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00003590AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00003591], [
sewardj03d86f22006-10-17 00:57:24 +00003592ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00003593AC_MSG_RESULT([no])
3594])
sewardj0ad46092006-03-02 17:09:16 +00003595CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00003596CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00003597LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00003598AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00003599
sewardj03d86f22006-10-17 00:57:24 +00003600## See if MPI_CC works for the secondary target. Complication: what if
3601## there is no secondary target? We need this to then fail.
3602## Kludge this by making MPI_CC something which will surely fail in
3603## such a case.
3604##
3605AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
3606saved_CC=$CC
3607saved_CFLAGS=$CFLAGS
philippef7c54332012-05-17 15:32:54 +00003608saved_LDFLAGS="$LDFLAGS"
3609LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
njn7fd6d382009-01-22 21:56:32 +00003610if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00003611 CC="$MPI_CC this will surely fail"
3612else
3613 CC=$MPI_CC
3614fi
philippef7c54332012-05-17 15:32:54 +00003615CFLAGS="$CFLAGS_MPI $mflag_secondary"
bart417cf3e2011-10-22 09:21:24 +00003616AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj03d86f22006-10-17 00:57:24 +00003617#include <mpi.h>
3618#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00003619]], [[
philippef7c54332012-05-17 15:32:54 +00003620 int ni, na, nd, comb;
sewardj03d86f22006-10-17 00:57:24 +00003621 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00003622 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
3623 r |= MPI_Finalize();
sewardj03d86f22006-10-17 00:57:24 +00003624 return r;
bart417cf3e2011-10-22 09:21:24 +00003625]])], [
sewardj03d86f22006-10-17 00:57:24 +00003626ac_have_mpi2_sec=yes
3627AC_MSG_RESULT([yes, $MPI_CC])
3628], [
3629ac_have_mpi2_sec=no
3630AC_MSG_RESULT([no])
3631])
3632CC=$saved_CC
3633CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00003634LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00003635AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00003636
3637
njn7fd6d382009-01-22 21:56:32 +00003638#----------------------------------------------------------------------------
3639# Other library checks
3640#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00003641# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00003642# tests are present because Drd has some regression tests that use
3643# these packages. All regression test programs all compiled only
3644# for the primary target. And so it is important that the configure
3645# checks that follow, use the correct -m32 or -m64 flag for the
3646# primary target (called $mflag_primary). Otherwise, we can end up
3647# in a situation (eg) where, on amd64-linux, the test for Boost checks
3648# for usable 64-bit Boost facilities, but because we are doing a 32-bit
3649# only build (meaning, the primary target is x86-linux), the build
3650# of the regtest programs that use Boost fails, because they are
3651# build as 32-bit (IN THIS EXAMPLE).
3652#
3653# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
3654# NEEDED BY THE REGRESSION TEST PROGRAMS.
3655
3656
sewardj493c4ef2008-12-13 16:45:19 +00003657# Check whether the boost library 1.35 or later has been installed.
3658# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
3659
3660AC_MSG_CHECKING([for boost])
3661
3662AC_LANG(C++)
3663safe_CXXFLAGS=$CXXFLAGS
bart7129c722012-04-18 18:34:22 +00003664CXXFLAGS="$mflag_primary"
3665safe_LIBS="$LIBS"
bartce93f9e2014-06-12 07:45:23 +00003666LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00003667
bart128fc522011-03-12 10:36:35 +00003668AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00003669#include <boost/thread.hpp>
3670static void thread_func(void)
3671{ }
3672int main(int argc, char** argv)
3673{
3674 boost::thread t(thread_func);
3675 return 0;
3676}
bart128fc522011-03-12 10:36:35 +00003677])],
sewardj493c4ef2008-12-13 16:45:19 +00003678[
3679ac_have_boost_1_35=yes
3680AC_SUBST([BOOST_CFLAGS], [])
bartce93f9e2014-06-12 07:45:23 +00003681AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
sewardj493c4ef2008-12-13 16:45:19 +00003682AC_MSG_RESULT([yes])
3683], [
3684ac_have_boost_1_35=no
3685AC_MSG_RESULT([no])
3686])
3687
bart7129c722012-04-18 18:34:22 +00003688LIBS="$safe_LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00003689CXXFLAGS=$safe_CXXFLAGS
3690AC_LANG(C)
3691
3692AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
3693
3694
3695# does this compiler support -fopenmp, does it have the include file
3696# <omp.h> and does it have libgomp ?
3697
3698AC_MSG_CHECKING([for OpenMP])
3699
3700safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00003701CFLAGS="-fopenmp $mflag_primary -Werror"
sewardj493c4ef2008-12-13 16:45:19 +00003702
bart128fc522011-03-12 10:36:35 +00003703AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00003704#include <omp.h>
3705int main(int argc, char** argv)
3706{
3707 omp_set_dynamic(0);
3708 return 0;
3709}
bart128fc522011-03-12 10:36:35 +00003710])],
sewardj493c4ef2008-12-13 16:45:19 +00003711[
3712ac_have_openmp=yes
3713AC_MSG_RESULT([yes])
3714], [
3715ac_have_openmp=no
3716AC_MSG_RESULT([no])
3717])
3718CFLAGS=$safe_CFLAGS
3719
3720AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
3721
3722
florian60637d22014-10-29 08:21:18 +00003723# Check for __builtin_popcount
3724AC_MSG_CHECKING([for __builtin_popcount()])
3725AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3726]], [[
3727 __builtin_popcount(2);
3728 return 0;
3729]])], [
3730AC_MSG_RESULT([yes])
3731AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
3732 [Define to 1 if compiler provides __builtin_popcount().])
3733], [
3734AC_MSG_RESULT([no])
3735])
3736
3737# Check for __builtin_clz
3738AC_MSG_CHECKING([for __builtin_clz()])
3739AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3740]], [[
3741 __builtin_clz(2);
3742 return 0;
3743]])], [
3744AC_MSG_RESULT([yes])
3745AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
3746 [Define to 1 if compiler provides __builtin_clz().])
3747], [
3748AC_MSG_RESULT([no])
3749])
3750
3751# Check for __builtin_ctz
3752AC_MSG_CHECKING([for __builtin_ctz()])
3753AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3754]], [[
3755 __builtin_ctz(2);
3756 return 0;
3757]])], [
3758AC_MSG_RESULT([yes])
3759AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
3760 [Define to 1 if compiler provides __builtin_ctz().])
3761], [
3762AC_MSG_RESULT([no])
3763])
3764
bart78bfc712011-12-08 16:14:59 +00003765# does this compiler have built-in functions for atomic memory access for the
3766# primary target ?
3767AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
sewardjc876a2f2009-01-22 22:44:30 +00003768
3769safe_CFLAGS=$CFLAGS
3770CFLAGS="$mflag_primary"
3771
bart417cf3e2011-10-22 09:21:24 +00003772AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjc876a2f2009-01-22 22:44:30 +00003773 int variable = 1;
3774 return (__sync_bool_compare_and_swap(&variable, 1, 2)
3775 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00003776]])], [
bartb4ff7822011-12-10 19:48:04 +00003777 ac_have_builtin_atomic_primary=yes
sewardjc876a2f2009-01-22 22:44:30 +00003778 AC_MSG_RESULT([yes])
bart78bfc712011-12-08 16:14:59 +00003779 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 +00003780], [
bartb4ff7822011-12-10 19:48:04 +00003781 ac_have_builtin_atomic_primary=no
sewardjc876a2f2009-01-22 22:44:30 +00003782 AC_MSG_RESULT([no])
3783])
3784
3785CFLAGS=$safe_CFLAGS
3786
bartb4ff7822011-12-10 19:48:04 +00003787AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
3788 [test x$ac_have_builtin_atomic_primary = xyes])
bartc82d1372009-05-31 16:21:23 +00003789
bart78bfc712011-12-08 16:14:59 +00003790
3791# does this compiler have built-in functions for atomic memory access for the
3792# secondary target ?
3793
3794if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
3795
3796AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
3797
3798safe_CFLAGS=$CFLAGS
3799CFLAGS="$mflag_secondary"
3800
3801AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
3802 int variable = 1;
3803 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
3804]])], [
3805 ac_have_builtin_atomic_secondary=yes
3806 AC_MSG_RESULT([yes])
3807], [
3808 ac_have_builtin_atomic_secondary=no
3809 AC_MSG_RESULT([no])
3810])
3811
3812CFLAGS=$safe_CFLAGS
3813
3814fi
3815
3816AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
3817 [test x$ac_have_builtin_atomic_secondary = xyes])
3818
bart1e856ea2011-12-17 12:53:23 +00003819# does this compiler have built-in functions for atomic memory access on
3820# 64-bit integers for all targets ?
3821
3822AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
3823
3824AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3825 #include <stdint.h>
3826]], [[
3827 uint64_t variable = 1;
3828 return __sync_add_and_fetch(&variable, 1)
3829]])], [
3830 ac_have_builtin_atomic64_primary=yes
3831], [
3832 ac_have_builtin_atomic64_primary=no
3833])
3834
3835if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
3836
3837safe_CFLAGS=$CFLAGS
3838CFLAGS="$mflag_secondary"
3839
3840AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3841 #include <stdint.h>
3842]], [[
3843 uint64_t variable = 1;
3844 return __sync_add_and_fetch(&variable, 1)
3845]])], [
3846 ac_have_builtin_atomic64_secondary=yes
3847], [
3848 ac_have_builtin_atomic64_secondary=no
3849])
3850
3851CFLAGS=$safe_CFLAGS
3852
3853fi
3854
3855if test x$ac_have_builtin_atomic64_primary = xyes && \
3856 test x$VGCONF_PLATFORM_SEC_CAPS = x \
3857 -o x$ac_have_builtin_atomic64_secondary = xyes; then
3858 AC_MSG_RESULT([yes])
3859 ac_have_builtin_atomic64=yes
3860else
3861 AC_MSG_RESULT([no])
3862 ac_have_builtin_atomic64=no
3863fi
3864
3865AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
3866 [test x$ac_have_builtin_atomic64 = xyes])
3867
bart78bfc712011-12-08 16:14:59 +00003868
barte8740422011-03-24 20:27:54 +00003869# does g++ have built-in functions for atomic memory access ?
bart78bfc712011-12-08 16:14:59 +00003870AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
barte8740422011-03-24 20:27:54 +00003871
3872safe_CXXFLAGS=$CXXFLAGS
3873CXXFLAGS="$mflag_primary"
3874
3875AC_LANG_PUSH(C++)
bart417cf3e2011-10-22 09:21:24 +00003876AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
barte8740422011-03-24 20:27:54 +00003877 int variable = 1;
3878 return (__sync_bool_compare_and_swap(&variable, 1, 2)
3879 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00003880]])], [
barte8740422011-03-24 20:27:54 +00003881 ac_have_builtin_atomic_cxx=yes
3882 AC_MSG_RESULT([yes])
3883 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 +00003884], [
barte8740422011-03-24 20:27:54 +00003885 ac_have_builtin_atomic_cxx=no
3886 AC_MSG_RESULT([no])
3887])
3888AC_LANG_POP(C++)
3889
3890CXXFLAGS=$safe_CXXFLAGS
3891
3892AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00003893
bart78bfc712011-12-08 16:14:59 +00003894
3895if test x$ac_have_usable_linux_futex_h = xyes \
bartb4ff7822011-12-10 19:48:04 +00003896 -a x$ac_have_builtin_atomic_primary = xyes; then
bart78bfc712011-12-08 16:14:59 +00003897 ac_enable_linux_ticket_lock_primary=yes
3898fi
3899AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
3900 [test x$ac_enable_linux_ticket_lock_primary = xyes])
3901
3902if test x$VGCONF_PLATFORM_SEC_CAPS != x \
3903 -a x$ac_have_usable_linux_futex_h = xyes \
3904 -a x$ac_have_builtin_atomic_secondary = xyes; then
3905 ac_enable_linux_ticket_lock_secondary=yes
3906fi
3907AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
3908 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
3909
3910
bartf68af882011-12-10 19:42:05 +00003911# does libstdc++ support annotating shared pointers ?
3912AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
3913
floriand79b3bf2013-10-02 15:14:59 +00003914safe_CXXFLAGS=$CXXFLAGS
bartf68af882011-12-10 19:42:05 +00003915CXXFLAGS="-std=c++0x"
3916
3917AC_LANG_PUSH(C++)
3918AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3919 #include <memory>
3920]], [[
3921 std::shared_ptr<int> p
3922]])], [
3923 ac_have_shared_ptr=yes
3924], [
3925 ac_have_shared_ptr=no
3926])
3927if test x$ac_have_shared_ptr = xyes; then
3928 # If compilation of the program below fails because of a syntax error
3929 # triggered by substituting one of the annotation macros then that
3930 # means that libstdc++ supports these macros.
3931 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3932 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
3933 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
3934 #include <memory>
3935 ]], [[
3936 std::shared_ptr<int> p
3937 ]])], [
3938 ac_have_shared_pointer_annotation=no
3939 AC_MSG_RESULT([no])
3940 ], [
3941 ac_have_shared_pointer_annotation=yes
3942 AC_MSG_RESULT([yes])
3943 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
3944 [Define to 1 if libstd++ supports annotating shared pointers])
3945 ])
3946else
3947 ac_have_shared_pointer_annotation=no
3948 AC_MSG_RESULT([no])
3949fi
3950AC_LANG_POP(C++)
3951
3952CXXFLAGS=$safe_CXXFLAGS
3953
3954AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
3955 [test x$ac_have_shared_pointer_annotation = xyes])
3956
3957
njn7fd6d382009-01-22 21:56:32 +00003958#----------------------------------------------------------------------------
3959# Ok. We're done checking.
3960#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00003961
njn8b68b642009-06-24 00:37:09 +00003962# Nb: VEX/Makefile is generated from Makefile.vex.in.
3963AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00003964 Makefile
njn8b68b642009-06-24 00:37:09 +00003965 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00003966 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00003967 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00003968 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00003969 docs/Makefile
3970 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00003971 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00003972 perf/Makefile
3973 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00003974 gdbserver_tests/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00003975 gdbserver_tests/solaris/Makefile
njn254d542432002-09-23 16:09:39 +00003976 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00003977 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00003978 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00003979 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00003980 memcheck/Makefile
3981 memcheck/tests/Makefile
floriane42cca52013-08-29 17:59:27 +00003982 memcheck/tests/common/Makefile
njnc6168192004-11-29 13:54:10 +00003983 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00003984 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00003985 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00003986 memcheck/tests/darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00003987 memcheck/tests/solaris/Makefile
njnea2d6fd2010-07-01 00:20:20 +00003988 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00003989 memcheck/tests/x86-linux/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00003990 memcheck/tests/amd64-solaris/Makefile
3991 memcheck/tests/x86-solaris/Makefile
sewardj0e342a02010-09-03 23:49:33 +00003992 memcheck/tests/ppc32/Makefile
3993 memcheck/tests/ppc64/Makefile
florian0bb707e2012-05-30 20:46:58 +00003994 memcheck/tests/s390x/Makefile
florianbb913cd2012-08-28 16:50:39 +00003995 memcheck/tests/vbit-test/Makefile
njn25cac76cb2002-09-23 11:21:57 +00003996 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00003997 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00003998 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00003999 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00004000 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00004001 callgrind/Makefile
4002 callgrind/callgrind_annotate
4003 callgrind/callgrind_control
4004 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004005 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00004006 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00004007 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00004008 massif/tests/Makefile
njnd5a8d242007-11-02 20:44:57 +00004009 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00004010 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00004011 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004012 none/Makefile
4013 none/tests/Makefile
florian0a6d8972015-04-03 15:47:19 +00004014 none/tests/scripts/Makefile
njnc6168192004-11-29 13:54:10 +00004015 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00004016 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00004017 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00004018 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00004019 none/tests/arm/Makefile
sewardjf02d2ec2014-08-26 19:28:09 +00004020 none/tests/arm64/Makefile
sewardjb5b87402011-03-07 16:05:35 +00004021 none/tests/s390x/Makefile
sewardj5db15402012-06-07 09:13:21 +00004022 none/tests/mips32/Makefile
petarj8bea8672013-05-10 13:14:54 +00004023 none/tests/mips64/Makefile
sewardj112711a2015-04-10 12:30:09 +00004024 none/tests/tilegx/Makefile
njn0458a122009-02-13 06:23:46 +00004025 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00004026 none/tests/darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004027 none/tests/solaris/Makefile
florian7d4a28b2015-04-23 15:20:00 +00004028 none/tests/amd64-linux/Makefile
njn06ca3322009-04-15 23:10:04 +00004029 none/tests/x86-linux/Makefile
rhyskidd0dc35262015-05-28 12:49:00 +00004030 none/tests/amd64-darwin/Makefile
4031 none/tests/x86-darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004032 none/tests/amd64-solaris/Makefile
4033 none/tests/x86-solaris/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00004034 exp-sgcheck/Makefile
4035 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00004036 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00004037 drd/scripts/download-and-build-splash2
4038 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00004039 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00004040 exp-bbv/tests/Makefile
4041 exp-bbv/tests/x86/Makefile
4042 exp-bbv/tests/x86-linux/Makefile
4043 exp-bbv/tests/amd64-linux/Makefile
4044 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00004045 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00004046 exp-dhat/Makefile
4047 exp-dhat/tests/Makefile
mjwaeacd282014-03-11 19:30:32 +00004048 shared/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004049 solaris/Makefile
njn8b68b642009-06-24 00:37:09 +00004050])
sewardjd3645802010-06-13 22:13:58 +00004051AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
4052 [chmod +x coregrind/link_tool_exe_linux])
4053AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
4054 [chmod +x coregrind/link_tool_exe_darwin])
sewardj8eb8bab2015-07-21 14:44:28 +00004055AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
4056 [chmod +x coregrind/link_tool_exe_solaris])
njn8b68b642009-06-24 00:37:09 +00004057AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00004058
4059cat<<EOF
4060
njn311303f2009-02-06 03:46:50 +00004061 Maximum build arch: ${ARCH_MAX}
4062 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00004063 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00004064 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00004065 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
4066 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardjcb495c82011-07-11 20:42:34 +00004067 Platform variant: ${VGCONF_PLATVARIANT}
4068 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
sewardje95d94f2008-09-19 09:02:19 +00004069 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00004070
gobry3b777892002-04-04 09:18:39 +00004071EOF