blob: 372871b87dc47269d29c86826d20a36f5f12f2e9 [file] [log] [blame]
sewardj01262142006-01-04 01:20:28 +00001
2##------------------------------------------------------------##
3#
4# The multiple-architecture stuff in this file is pretty
5# cryptic. Read docs/internals/multiple-architectures.txt
6# for at least a partial explanation of what is going on.
7#
8##------------------------------------------------------------##
9
sewardjde4a1d02002-03-22 01:27:54 +000010# Process this file with autoconf to produce a configure script.
Elliott Hughesa0664b92017-04-18 17:46:52 -070011AC_INIT([Valgrind],[3.12.0],[valgrind-users@lists.sourceforge.net])
njn04e16982005-05-31 00:23:43 +000012AC_CONFIG_SRCDIR(coregrind/m_main.c)
bart417cf3e2011-10-22 09:21:24 +000013AC_CONFIG_HEADERS([config.h])
sewardjf9a698e2013-09-02 12:44:52 +000014AM_INIT_AUTOMAKE([foreign subdir-objects])
sewardjde4a1d02002-03-22 01:27:54 +000015
gobryb0ed4672002-03-27 20:58:58 +000016AM_MAINTAINER_MODE
17
njn7fd6d382009-01-22 21:56:32 +000018#----------------------------------------------------------------------------
florian26a790a2014-12-03 22:53:00 +000019# Do NOT modify these flags here. Except in feature tests in which case
20# the original values must be properly restored.
21#----------------------------------------------------------------------------
22CFLAGS="$CFLAGS"
23CXXFLAGS="$CXXFLAGS"
24
25#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +000026# Checks for various programs.
27#----------------------------------------------------------------------------
gobrye721a522002-03-22 13:38:30 +000028
sewardjde4a1d02002-03-22 01:27:54 +000029AC_PROG_LN_S
30AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000031AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000032AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000033AC_PROG_CXX
njn629a5ec2009-07-14 01:29:39 +000034# AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
35# autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
36# base (eg. most likely as Darwin-specific tests) we'll need one of the
37# following:
njn0cd26892009-07-12 23:07:13 +000038# - put AC_PROG_OBJC in a Darwin-specific part of this file
39# - Use AC_PROG_OBJC here and up the minimum autoconf version
40# - Use the following, which is apparently equivalent:
41# m4_ifdef([AC_PROG_OBJC],
42# [AC_PROG_OBJC],
43# [AC_CHECK_TOOL([OBJC], [gcc])
44# AC_SUBST([OBJC])
45# AC_SUBST([OBJCFLAGS])
46# ])
sewardjde4a1d02002-03-22 01:27:54 +000047AC_PROG_RANLIB
bart07de2c92010-05-29 06:44:28 +000048# provide a very basic definition for AC_PROG_SED if it's not provided by
49# autoconf (as e.g. in autoconf 2.59).
50m4_ifndef([AC_PROG_SED],
51 [AC_DEFUN([AC_PROG_SED],
52 [AC_ARG_VAR([SED])
53 AC_CHECK_PROGS([SED],[gsed sed])])])
bart12e91122010-05-15 08:37:24 +000054AC_PROG_SED
sewardjde4a1d02002-03-22 01:27:54 +000055
bartcddeaf52008-05-25 15:58:11 +000056# If no AR variable was specified, look up the name of the archiver. Otherwise
57# do not touch the AR variable.
58if test "x$AR" = "x"; then
bart07de2c92010-05-29 06:44:28 +000059 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000060fi
61AC_ARG_VAR([AR],[Archiver command])
62
gobrye721a522002-03-22 13:38:30 +000063# Check for the compiler support
64if test "${GCC}" != "yes" ; then
65 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
66fi
67
sewardj2f685952002-12-22 19:32:23 +000068# figure out where perl lives
69AC_PATH_PROG(PERL, perl)
70
njn9315df32003-04-16 20:50:50 +000071# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000072AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000073AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000074
daywalker48ccca52002-04-15 00:31:58 +000075# some older automake's don't have it so try something on our own
76ifdef([AM_PROG_AS],[AM_PROG_AS],
77[
gobry1be19852002-03-26 20:44:55 +000078AS="${CC}"
79AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000080
gobry1be19852002-03-26 20:44:55 +000081ASFLAGS=""
82AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000083])
gobry3b777892002-04-04 09:18:39 +000084
gobry3b777892002-04-04 09:18:39 +000085
njn0d2e58f2009-02-25 04:57:56 +000086# Check if 'diff' supports -u (universal diffs) and use it if possible.
87
88AC_MSG_CHECKING([for diff -u])
89AC_SUBST(DIFF)
90
sewardj6e9de462011-06-28 07:25:29 +000091# Comparing two identical files results in 0.
njn31f665e2009-02-26 21:25:50 +000092tmpfile="tmp-xxx-yyy-zzz"
93touch $tmpfile;
94if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000095 AC_MSG_RESULT([yes])
96 DIFF="diff -u"
97else
98 AC_MSG_RESULT([no])
99 DIFF="diff"
100fi
njn31f665e2009-02-26 21:25:50 +0000101rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +0000102
103
sewardj535c50f2005-06-04 23:14:53 +0000104# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +0000105AC_MSG_CHECKING([for a supported version of gcc])
106
bart85037442011-11-22 14:41:31 +0000107# Obtain the compiler version.
sewardja8ca2c52011-09-29 18:18:37 +0000108#
bart85037442011-11-22 14:41:31 +0000109# A few examples of how the ${CC} --version output looks like:
110#
sewardjc754e682014-10-13 13:03:50 +0000111# ######## gcc variants ########
bart85037442011-11-22 14:41:31 +0000112# Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
113# Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
114# openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
115# Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
bartc5214062012-01-11 11:34:23 +0000116# MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
bart85037442011-11-22 14:41:31 +0000117# OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
118# OS/X 10.7: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
sewardjc754e682014-10-13 13:03:50 +0000119#
120# ######## clang variants ########
bart85037442011-11-22 14:41:31 +0000121# Clang: clang version 2.9 (tags/RELEASE_29/final)
bart048081f2012-06-17 05:53:02 +0000122# Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
123# FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
sewardja8ca2c52011-09-29 18:18:37 +0000124#
sewardjc754e682014-10-13 13:03:50 +0000125# ######## Apple LLVM variants ########
126# Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
127# Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
128#
bartc5214062012-01-11 11:34:23 +0000129[
sewardjc754e682014-10-13 13:03:50 +0000130if test "x`${CC} --version | $SED -n -e 's/.*\Apple \(LLVM\) version.*clang.*/\1/p'`" = "xLLVM" ;
131then
132 is_clang="applellvm"
133 gcc_version=`${CC} --version | $SED -n -e 's/.*LLVM version \([0-9.]*\).*$/\1/p'`
134elif test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ;
135then
bart048081f2012-06-17 05:53:02 +0000136 is_clang="clang"
137 # Don't use -dumpversion with clang: it will always produce "4.2.1".
138 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
florian31556c32015-01-05 14:28:46 +0000139elif test "x`${CC} --version | $SED -n -e 's/icc.*\(ICC\).*/\1/p'`" = "xICC" ;
140then
florian4e94bda2014-10-29 13:57:49 +0000141 is_clang="icc"
florian31556c32015-01-05 14:28:46 +0000142 gcc_version=`${CC} -dumpversion 2>/dev/null`
bart048081f2012-06-17 05:53:02 +0000143else
144 is_clang="notclang"
145 gcc_version=`${CC} -dumpversion 2>/dev/null`
146 if test "x$gcc_version" = x; then
147 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
148 fi
sewardj3ab7b662011-09-29 17:30:13 +0000149fi
bart048081f2012-06-17 05:53:02 +0000150]
sewardjc754e682014-10-13 13:03:50 +0000151AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang -o $is_clang = applellvm)
florian4e94bda2014-10-29 13:57:49 +0000152AM_CONDITIONAL(COMPILER_IS_ICC, test $is_clang = icc)
sewardjc754e682014-10-13 13:03:50 +0000153
bartfec24472014-09-13 09:42:29 +0000154# Note: m4 arguments are quoted with [ and ] so square brackets in shell
155# statements have to be quoted.
sewardj3ab7b662011-09-29 17:30:13 +0000156case "${is_clang}-${gcc_version}" in
Elliott Hughesa0664b92017-04-18 17:46:52 -0700157 applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-8.*)
sewardjc754e682014-10-13 13:03:50 +0000158 AC_MSG_RESULT([ok (Apple LLVM version ${gcc_version})])
159 ;;
florian31556c32015-01-05 14:28:46 +0000160 icc-1[[3-9]].*)
florian4e94bda2014-10-29 13:57:49 +0000161 AC_MSG_RESULT([ok (ICC version ${gcc_version})])
162 ;;
Elliott Hughesa0664b92017-04-18 17:46:52 -0700163 notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
sewardj3ab7b662011-09-29 17:30:13 +0000164 AC_MSG_RESULT([ok (${gcc_version})])
165 ;;
bartfec24472014-09-13 09:42:29 +0000166 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
sewardj3ab7b662011-09-29 17:30:13 +0000167 AC_MSG_RESULT([ok (clang-${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000168 ;;
gobrye721a522002-03-22 13:38:30 +0000169 *)
Elliott Hughesa0664b92017-04-18 17:46:52 -0700170 AC_MSG_RESULT([no (${is_clang}-${gcc_version})])
florian4e94bda2014-10-29 13:57:49 +0000171 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0])
gobrye721a522002-03-22 13:38:30 +0000172 ;;
173esac
174
njn7fd6d382009-01-22 21:56:32 +0000175#----------------------------------------------------------------------------
176# Arch/OS/platform tests.
177#----------------------------------------------------------------------------
178# We create a number of arch/OS/platform-related variables. We prefix them
179# all with "VGCONF_" which indicates that they are defined at
180# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
181# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000182
sewardjde4a1d02002-03-22 01:27:54 +0000183AC_CANONICAL_HOST
184
185AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000186
njn7fd6d382009-01-22 21:56:32 +0000187# ARCH_MAX reflects the most that this CPU can do: for example if it
188# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
189# Ditto for amd64. It is used for more configuration below, but is not used
190# outside this file.
carllcae0cc22014-08-07 23:17:29 +0000191#
192# Power PC returns powerpc for Big Endian. This was not changed when Little
193# Endian support was added to the 64-bit architecture. The 64-bit Little
194# Endian systems explicitly state le in the host_cpu. For clarity in the
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])
Elliott Hughesa0664b92017-04-18 17:46:52 -0700356 AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12])
njnf76d27a2009-05-28 01:53:07 +0000357
358 AC_MSG_CHECKING([for the kernel version])
359 kernel=`uname -r`
360
361 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
362 # has only one relevant version, the OS version. The `uname` check
363 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
sewardj731f9cf2011-09-21 08:43:08 +0000364 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
365 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
njnea2d6fd2010-07-01 00:20:20 +0000366 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000367 #
368 # XXX: `uname -r` won't do the right thing for cross-compiles, but
369 # that's not a problem yet.
sewardj731f9cf2011-09-21 08:43:08 +0000370 #
371 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
372 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
373 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
374 # time support for 10.5 (the 9.* pattern just below), I'll leave it
375 # in for now, just in case anybody wants to give it a try. But I'm
376 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
njnf76d27a2009-05-28 01:53:07 +0000377 case "${kernel}" in
378 9.*)
379 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000380 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000381 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000382 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000383 ;;
njnea2d6fd2010-07-01 00:20:20 +0000384 10.*)
385 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
386 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
387 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
388 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
389 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000390 11.*)
391 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
392 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
sewardj731f9cf2011-09-21 08:43:08 +0000393 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
394 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
395 ;;
sewardjae284e52012-08-02 18:25:04 +0000396 12.*)
397 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
398 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
399 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
400 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
401 ;;
sewardjec66ad52014-06-20 11:48:38 +0000402 13.*)
403 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
404 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
405 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
406 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
407 ;;
sewardjac3afbd2014-11-06 20:16:05 +0000408 14.*)
409 AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite])
410 AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version])
411 DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}"
412 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
413 ;;
rhyskidd9090d2f2015-07-08 13:46:57 +0000414 15.*)
415 AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan])
416 AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version])
417 DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}"
418 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
419 ;;
Elliott Hughesa0664b92017-04-18 17:46:52 -0700420 16.*)
421 AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra])
422 AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version])
423 DEFAULT_SUPP="darwin16.supp ${DEFAULT_SUPP}"
424 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
425 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000426 *)
njnf76d27a2009-05-28 01:53:07 +0000427 AC_MSG_RESULT([unsupported (${kernel})])
Elliott Hughesa0664b92017-04-18 17:46:52 -0700428 AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x and 16.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12)])
njnf76d27a2009-05-28 01:53:07 +0000429 ;;
430 esac
431 ;;
432
sewardj8eb8bab2015-07-21 14:44:28 +0000433 solaris2.11*)
434 AC_MSG_RESULT([ok (${host_os})])
435 VGCONF_OS="solaris"
436 DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}"
437 ;;
438
439 solaris2.12*)
440 AC_MSG_RESULT([ok (${host_os})])
441 VGCONF_OS="solaris"
442 DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}"
443 ;;
444
sewardjde4a1d02002-03-22 01:27:54 +0000445 *)
446 AC_MSG_RESULT([no (${host_os})])
njncc58cea2010-07-05 07:21:22 +0000447 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
sewardjde4a1d02002-03-22 01:27:54 +0000448 ;;
449esac
450
njn7fd6d382009-01-22 21:56:32 +0000451#----------------------------------------------------------------------------
452
tomd6398392006-06-07 17:44:36 +0000453# If we are building on a 64 bit platform test to see if the system
454# supports building 32 bit programs and disable 32 bit support if it
455# does not support building 32 bit programs
456
njn7fd6d382009-01-22 21:56:32 +0000457case "$ARCH_MAX-$VGCONF_OS" in
sewardj8eb8bab2015-07-21 14:44:28 +0000458 amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris)
tomd6398392006-06-07 17:44:36 +0000459 AC_MSG_CHECKING([for 32 bit build support])
460 safe_CFLAGS=$CFLAGS
461 CFLAGS="-m32"
bart417cf3e2011-10-22 09:21:24 +0000462 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +0000463 return 0;
bart417cf3e2011-10-22 09:21:24 +0000464 ]])], [
tomd6398392006-06-07 17:44:36 +0000465 AC_MSG_RESULT([yes])
466 ], [
467 vg_cv_only64bit="yes"
468 AC_MSG_RESULT([no])
469 ])
470 CFLAGS=$safe_CFLAGS;;
471esac
472
473if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
474 AC_MSG_ERROR(
475 [--enable-only32bit was specified but system does not support 32 bit builds])
476fi
nethercote888ecb72004-08-23 14:54:40 +0000477
njn7fd6d382009-01-22 21:56:32 +0000478#----------------------------------------------------------------------------
479
njn311303f2009-02-06 03:46:50 +0000480# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
481# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
482# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
483# above) will be "amd64" since that reflects the most that this cpu can do,
484# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
485# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000486# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
487# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
488AC_SUBST(VGCONF_ARCH_PRI)
489
njn3f8a6e92009-06-02 00:20:47 +0000490# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
491# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
492# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
493# It is empty if there is no secondary target.
494AC_SUBST(VGCONF_ARCH_SEC)
495
njn311303f2009-02-06 03:46:50 +0000496# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
497# The entire system, including regression and performance tests, will be
498# built for this target. The "_CAPS" indicates that the name is in capital
499# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000500# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000501# convention and cannot contain '-' characters. This is in contrast to
502# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000503AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
504
505# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
506# Valgrind and tools will also be built for this target, but not the
507# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000508#
njn7fd6d382009-01-22 21:56:32 +0000509# By default, the primary arch is the same as the "max" arch, as commented
510# above (at the definition of ARCH_MAX). We may choose to downgrade it in
511# the big case statement just below here, in the case where we're building
512# on a 64 bit machine but have been requested only to do a 32 bit build.
513AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
514
sewardj01262142006-01-04 01:20:28 +0000515AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000516
njnea2d6fd2010-07-01 00:20:20 +0000517# NB. The load address for a given platform may be specified in more
518# than one place, in some cases, depending on whether we're doing a biarch,
519# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
520# Be careful to give consistent values in all subcases. Also, all four
521# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
522# even if it is to "0xUNSET".
523#
njn7fd6d382009-01-22 21:56:32 +0000524case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000525 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000526 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000527 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000528 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
529 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000530 valt_load_address_pri_norml="0x38000000"
531 valt_load_address_pri_inner="0x28000000"
532 valt_load_address_sec_norml="0xUNSET"
533 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000534 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000535 ;;
536 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000537 valt_load_address_sec_norml="0xUNSET"
538 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000539 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000540 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000541 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000542 VGCONF_PLATFORM_PRI_CAPS="AMD64_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 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000547 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000548 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000549 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
550 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000551 valt_load_address_pri_norml="0x38000000"
552 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000553 else
njn7fd6d382009-01-22 21:56:32 +0000554 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000555 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000556 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
557 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000558 valt_load_address_pri_norml="0x38000000"
559 valt_load_address_pri_inner="0x28000000"
560 valt_load_address_sec_norml="0x38000000"
561 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000562 fi
njn377c43f2009-05-19 07:39:22 +0000563 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000564 ;;
565 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000566 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000567 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000568 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
569 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000570 valt_load_address_pri_norml="0x38000000"
571 valt_load_address_pri_inner="0x28000000"
572 valt_load_address_sec_norml="0xUNSET"
573 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000574 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000575 ;;
carllcae0cc22014-08-07 23:17:29 +0000576 ppc64be-linux)
njnea2d6fd2010-07-01 00:20:20 +0000577 valt_load_address_sec_norml="0xUNSET"
578 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000579 if test x$vg_cv_only64bit = xyes; then
carllcae0cc22014-08-07 23:17:29 +0000580 VGCONF_ARCH_PRI="ppc64be"
njn3f8a6e92009-06-02 00:20:47 +0000581 VGCONF_ARCH_SEC=""
carllcae0cc22014-08-07 23:17:29 +0000582 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
njn7fd6d382009-01-22 21:56:32 +0000583 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 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000587 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000588 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000589 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
590 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000591 valt_load_address_pri_norml="0x38000000"
592 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000593 else
carllcae0cc22014-08-07 23:17:29 +0000594 VGCONF_ARCH_PRI="ppc64be"
njn3f8a6e92009-06-02 00:20:47 +0000595 VGCONF_ARCH_SEC="ppc32"
carllcae0cc22014-08-07 23:17:29 +0000596 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
njn7fd6d382009-01-22 21:56:32 +0000597 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000598 valt_load_address_pri_norml="0x38000000"
599 valt_load_address_pri_inner="0x28000000"
600 valt_load_address_sec_norml="0x38000000"
601 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000602 fi
njn377c43f2009-05-19 07:39:22 +0000603 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000604 ;;
carllcae0cc22014-08-07 23:17:29 +0000605 ppc64le-linux)
606 # Little Endian is only supported on PPC64
607 valt_load_address_sec_norml="0xUNSET"
608 valt_load_address_sec_inner="0xUNSET"
609 VGCONF_ARCH_PRI="ppc64le"
610 VGCONF_ARCH_SEC=""
611 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
612 VGCONF_PLATFORM_SEC_CAPS=""
613 valt_load_address_pri_norml="0x38000000"
614 valt_load_address_pri_inner="0x28000000"
615 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
616 ;;
njncc58cea2010-07-05 07:21:22 +0000617 # Darwin gets identified as 32-bit even when it supports 64-bit.
618 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
619 # all Macs support both 32-bit and 64-bit, so we just build both. If
620 # someone has a really old 32-bit only machine they can (hopefully?)
621 # build with --enable-only32bit. See bug 243362.
622 x86-darwin|amd64-darwin)
623 ARCH_MAX="amd64"
njnea2d6fd2010-07-01 00:20:20 +0000624 valt_load_address_sec_norml="0xUNSET"
625 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000626 if test x$vg_cv_only64bit = xyes; then
627 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000628 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000629 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
630 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000631 valt_load_address_pri_norml="0x138000000"
632 valt_load_address_pri_inner="0x128000000"
njnf76d27a2009-05-28 01:53:07 +0000633 elif test x$vg_cv_only32bit = xyes; then
634 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000635 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000636 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
637 VGCONF_PLATFORM_SEC_CAPS=""
638 VGCONF_ARCH_PRI_CAPS="x86"
njnea2d6fd2010-07-01 00:20:20 +0000639 valt_load_address_pri_norml="0x38000000"
640 valt_load_address_pri_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000641 else
642 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000643 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000644 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
645 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
njnea2d6fd2010-07-01 00:20:20 +0000646 valt_load_address_pri_norml="0x138000000"
647 valt_load_address_pri_inner="0x128000000"
648 valt_load_address_sec_norml="0x38000000"
649 valt_load_address_sec_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000650 fi
njnf76d27a2009-05-28 01:53:07 +0000651 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
652 ;;
sewardj59570ff2010-01-01 11:59:33 +0000653 arm-linux)
654 VGCONF_ARCH_PRI="arm"
655 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
656 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000657 valt_load_address_pri_norml="0x38000000"
658 valt_load_address_pri_inner="0x28000000"
659 valt_load_address_sec_norml="0xUNSET"
660 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000661 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
662 ;;
sewardjf0c12502014-01-12 12:54:00 +0000663 arm64-linux)
664 valt_load_address_sec_norml="0xUNSET"
665 valt_load_address_sec_inner="0xUNSET"
666 if test x$vg_cv_only64bit = xyes; then
667 VGCONF_ARCH_PRI="arm64"
668 VGCONF_ARCH_SEC=""
669 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
670 VGCONF_PLATFORM_SEC_CAPS=""
671 valt_load_address_pri_norml="0x38000000"
672 valt_load_address_pri_inner="0x28000000"
673 elif test x$vg_cv_only32bit = xyes; then
674 VGCONF_ARCH_PRI="arm"
675 VGCONF_ARCH_SEC=""
676 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
677 VGCONF_PLATFORM_SEC_CAPS=""
678 valt_load_address_pri_norml="0x38000000"
679 valt_load_address_pri_inner="0x28000000"
680 else
681 VGCONF_ARCH_PRI="arm64"
682 VGCONF_ARCH_SEC="arm"
683 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
684 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
685 valt_load_address_pri_norml="0x38000000"
686 valt_load_address_pri_inner="0x28000000"
687 valt_load_address_sec_norml="0x38000000"
688 valt_load_address_sec_inner="0x28000000"
689 fi
690 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
691 ;;
sewardjb5b87402011-03-07 16:05:35 +0000692 s390x-linux)
693 VGCONF_ARCH_PRI="s390x"
694 VGCONF_ARCH_SEC=""
695 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
696 VGCONF_PLATFORM_SEC_CAPS=""
cborntraf4c46902013-10-23 16:23:30 +0000697 # To improve branch prediction hit rate we want to have
698 # the generated code close to valgrind (host) code
699 valt_load_address_pri_norml="0x800000000"
700 valt_load_address_pri_inner="0x810000000"
sewardjb5b87402011-03-07 16:05:35 +0000701 valt_load_address_sec_norml="0xUNSET"
702 valt_load_address_sec_inner="0xUNSET"
703 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
704 ;;
sewardj5db15402012-06-07 09:13:21 +0000705 mips32-linux)
706 VGCONF_ARCH_PRI="mips32"
707 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
708 VGCONF_PLATFORM_SEC_CAPS=""
709 valt_load_address_pri_norml="0x38000000"
710 valt_load_address_pri_inner="0x28000000"
711 valt_load_address_sec_norml="0xUNSET"
712 valt_load_address_sec_inner="0xUNSET"
713 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
petarj4df0bfc2013-02-27 23:17:33 +0000714 ;;
715 mips64-linux)
716 VGCONF_ARCH_PRI="mips64"
717 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
718 VGCONF_PLATFORM_SEC_CAPS=""
719 valt_load_address_pri_norml="0x38000000"
720 valt_load_address_pri_inner="0x28000000"
721 valt_load_address_sec_norml="0xUNSET"
722 valt_load_address_sec_inner="0xUNSET"
723 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj5db15402012-06-07 09:13:21 +0000724 ;;
sewardj112711a2015-04-10 12:30:09 +0000725 tilegx-linux)
726 VGCONF_ARCH_PRI="tilegx"
727 VGCONF_ARCH_SEC=""
728 VGCONF_PLATFORM_PRI_CAPS="TILEGX_LINUX"
729 VGCONF_PLATFORM_SEC_CAPS=""
730 valt_load_address_pri_norml="0x38000000"
731 valt_load_address_pri_inner="0x28000000"
732 valt_load_address_sec_norml="0xUNSET"
733 valt_load_address_sec_inner="0xUNSET"
734 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
735 ;;
sewardj8eb8bab2015-07-21 14:44:28 +0000736 x86-solaris)
737 VGCONF_ARCH_PRI="x86"
738 VGCONF_ARCH_SEC=""
739 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
740 VGCONF_PLATFORM_SEC_CAPS=""
741 valt_load_address_pri_norml="0x38000000"
742 valt_load_address_pri_inner="0x28000000"
743 valt_load_address_sec_norml="0xUNSET"
744 valt_load_address_sec_inner="0xUNSET"
745 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
746 ;;
747 amd64-solaris)
748 valt_load_address_sec_norml="0xUNSET"
749 valt_load_address_sec_inner="0xUNSET"
750 if test x$vg_cv_only64bit = xyes; then
751 VGCONF_ARCH_PRI="amd64"
752 VGCONF_ARCH_SEC=""
753 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
754 VGCONF_PLATFORM_SEC_CAPS=""
755 valt_load_address_pri_norml="0x38000000"
756 valt_load_address_pri_inner="0x28000000"
757 elif test x$vg_cv_only32bit = xyes; then
758 VGCONF_ARCH_PRI="x86"
759 VGCONF_ARCH_SEC=""
760 VGCONF_PLATFORM_PRI_CAPS="X86_SOLARIS"
761 VGCONF_PLATFORM_SEC_CAPS=""
762 valt_load_address_pri_norml="0x38000000"
763 valt_load_address_pri_inner="0x28000000"
764 else
765 VGCONF_ARCH_PRI="amd64"
766 VGCONF_ARCH_SEC="x86"
767 VGCONF_PLATFORM_PRI_CAPS="AMD64_SOLARIS"
768 VGCONF_PLATFORM_SEC_CAPS="X86_SOLARIS"
769 valt_load_address_pri_norml="0x38000000"
770 valt_load_address_pri_inner="0x28000000"
771 valt_load_address_sec_norml="0x38000000"
772 valt_load_address_sec_inner="0x28000000"
773 fi
774 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
775 ;;
nethercote888ecb72004-08-23 14:54:40 +0000776 *)
njn7fd6d382009-01-22 21:56:32 +0000777 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000778 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000779 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
780 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000781 valt_load_address_pri_norml="0xUNSET"
782 valt_load_address_pri_inner="0xUNSET"
783 valt_load_address_sec_norml="0xUNSET"
784 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000785 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000786 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000787 ;;
788esac
sewardjde4a1d02002-03-22 01:27:54 +0000789
njn7fd6d382009-01-22 21:56:32 +0000790#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000791
njn7fd6d382009-01-22 21:56:32 +0000792# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
793# defined.
794AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
795 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000796 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
797 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
sewardj8eb8bab2015-07-21 14:44:28 +0000798 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN \
799 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
800 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS )
njn7fd6d382009-01-22 21:56:32 +0000801AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000802 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +0000803 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN \
804 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS )
njn7fd6d382009-01-22 21:56:32 +0000805AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
806 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj6e9de462011-06-28 07:25:29 +0000807 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000808AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
carllcae0cc22014-08-07 23:17:29 +0000809 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
810 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
sewardj59570ff2010-01-01 11:59:33 +0000811AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
sewardjf0c12502014-01-12 12:54:00 +0000812 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
813 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
814AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
815 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
sewardjb5b87402011-03-07 16:05:35 +0000816AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
817 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
sewardj5db15402012-06-07 09:13:21 +0000818AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
819 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
petarj4df0bfc2013-02-27 23:17:33 +0000820AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
821 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
sewardj112711a2015-04-10 12:30:09 +0000822AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_TILEGX,
823 test x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000824
njn7fd6d382009-01-22 21:56:32 +0000825# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
826# become defined.
827AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
828 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
829 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
830AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
831 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
832AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
833 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
834 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
carllcae0cc22014-08-07 23:17:29 +0000835AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
836 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
837AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
838 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000839AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
sewardjf0c12502014-01-12 12:54:00 +0000840 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
841 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
842AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
843 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
sewardjb5b87402011-03-07 16:05:35 +0000844AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
845 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
846 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
sewardj5db15402012-06-07 09:13:21 +0000847AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
848 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
petarj4df0bfc2013-02-27 23:17:33 +0000849AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
850 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
sewardj112711a2015-04-10 12:30:09 +0000851AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_TILEGX_LINUX,
852 test x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000853AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
854 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
855 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
856AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
857 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj8eb8bab2015-07-21 14:44:28 +0000858AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_SOLARIS,
859 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
860 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS)
861AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_SOLARIS,
862 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
njnf76d27a2009-05-28 01:53:07 +0000863
864
sewardj72a2d802010-07-29 05:24:20 +0000865# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000866# Relies on the assumption that the primary and secondary targets are
867# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000868AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
869 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
870 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
871 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
carllcae0cc22014-08-07 23:17:29 +0000872 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
873 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
sewardjb5b87402011-03-07 16:05:35 +0000874 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
sewardjf0c12502014-01-12 12:54:00 +0000875 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
sewardj5db15402012-06-07 09:13:21 +0000876 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +0000877 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
sewardj112711a2015-04-10 12:30:09 +0000878 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
879 -o x$VGCONF_PLATFORM_PRI_CAPS = xTILEGX_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000880AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
881 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
882 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj8eb8bab2015-07-21 14:44:28 +0000883AM_CONDITIONAL(VGCONF_OS_IS_SOLARIS,
884 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
885 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS)
sewardj03d86f22006-10-17 00:57:24 +0000886
887
njn7fd6d382009-01-22 21:56:32 +0000888# Sometimes, in the Makefile.am files, it's useful to know whether or not
889# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000890AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000891 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000892
philippef32cbe82012-05-18 16:48:20 +0000893dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
894dnl fallback definition
895dnl The macro is courtesy of Dave Hart:
896dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
897m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
898if test -z "$$1_TRUE"; then :
899 m4_n([$2])[]dnl
900m4_ifval([$3],
901[else
902 $3
903])dnl
904fi[]dnl
905])])
tomb637bad2005-11-08 12:28:35 +0000906
njn7fd6d382009-01-22 21:56:32 +0000907#----------------------------------------------------------------------------
908# Inner Valgrind?
909#----------------------------------------------------------------------------
910
njnd74b0ef2009-01-20 06:06:52 +0000911# Check if this should be built as an inner Valgrind, to be run within
912# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000913AC_SUBST(VALT_LOAD_ADDRESS_PRI)
914AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000915AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
916 [AC_ARG_ENABLE(inner,
917 [ --enable-inner enables self-hosting],
918 [vg_cv_inner=$enableval],
919 [vg_cv_inner=no])])
920if test "$vg_cv_inner" = yes; then
921 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000922 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
923 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000924else
njnea2d6fd2010-07-01 00:20:20 +0000925 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
926 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000927fi
928
florianbb1a7872015-03-10 16:13:59 +0000929#----------------------------------------------------------------------------
930# Undefined behaviour sanitiser
931#----------------------------------------------------------------------------
932# Check whether we should build with the undefined beahviour sanitiser.
933
934AC_CACHE_CHECK([for using the undefined behaviour sanitiser], vg_cv_ubsan,
935 [AC_ARG_ENABLE(ubsan,
936 [ --enable-ubsan enables the undefined behaviour sanitiser],
937 [vg_cv_ubsan=$enableval],
938 [vg_cv_ubsan=no])])
njnd74b0ef2009-01-20 06:06:52 +0000939
njn7fd6d382009-01-22 21:56:32 +0000940#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000941# Extra fine-tuning of installation directories
942#----------------------------------------------------------------------------
943AC_ARG_WITH(tmpdir,
944 [ --with-tmpdir=PATH Specify path for temporary files],
945 tmpdir="$withval",
946 tmpdir="/tmp")
947AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
florian7fd2ec32014-06-21 20:25:30 +0000948AC_SUBST(VG_TMPDIR, [$tmpdir])
sewardjcb495c82011-07-11 20:42:34 +0000949
sewardj0ba37c92011-07-12 11:46:24 +0000950
sewardjcb495c82011-07-11 20:42:34 +0000951#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000952# Libc and suppressions
953#----------------------------------------------------------------------------
954# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000955AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000956
bart12e91122010-05-15 08:37:24 +0000957AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000958
bart12e91122010-05-15 08:37:24 +0000959if test x$ac_cv_header_features_h = xyes; then
960 rm -f conftest.$ac_ext
961 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000962#include <features.h>
bart12e91122010-05-15 08:37:24 +0000963#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
964glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000965#endif
bart12e91122010-05-15 08:37:24 +0000966_ACEOF
mjwa384c3f2014-09-10 00:52:30 +0000967 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
bart12e91122010-05-15 08:37:24 +0000968fi
bartb7c3f082010-05-13 06:32:36 +0000969
njnf76d27a2009-05-28 01:53:07 +0000970# not really a version check
971AC_EGREP_CPP([DARWIN_LIBC], [
972#include <sys/cdefs.h>
973#if defined(__DARWIN_VERS_1050)
974 DARWIN_LIBC
975#endif
976],
977GLIBC_VERSION="darwin")
978
sewardjcb495c82011-07-11 20:42:34 +0000979# not really a version check
980AC_EGREP_CPP([BIONIC_LIBC], [
981#if defined(__ANDROID__)
982 BIONIC_LIBC
983#endif
984],
985GLIBC_VERSION="bionic")
986
sewardj8eb8bab2015-07-21 14:44:28 +0000987# there is only one version of libc on Solaris
988if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
989 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_SOLARIS; then
990 GLIBC_VERSION="solaris"
991fi
992
sewardjcb495c82011-07-11 20:42:34 +0000993
bart8219bff2014-09-13 10:53:00 +0000994AC_MSG_CHECKING([the glibc version])
sewardj03d86f22006-10-17 00:57:24 +0000995
dirk07596a22008-04-25 11:33:30 +0000996case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000997 2.2)
bart8219bff2014-09-13 10:53:00 +0000998 AC_MSG_RESULT(${GLIBC_VERSION} family)
sewardj2c4f3dd2007-11-11 06:13:01 +0000999 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
1000 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +00001001 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +00001002 ;;
bart8219bff2014-09-13 10:53:00 +00001003 2.[[3-6]])
1004 AC_MSG_RESULT(${GLIBC_VERSION} family)
1005 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +00001006 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +00001007 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +00001008 ;;
bart8219bff2014-09-13 10:53:00 +00001009 2.[[7-9]])
1010 AC_MSG_RESULT(${GLIBC_VERSION} family)
dirk07596a22008-04-25 11:33:30 +00001011 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +00001012 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +00001013 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +00001014 ;;
bart8219bff2014-09-13 10:53:00 +00001015 2.10|2.11)
1016 AC_MSG_RESULT(${GLIBC_VERSION} family)
1017 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1018 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
dirk07596a22008-04-25 11:33:30 +00001019 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1020 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1021 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1022 ;;
bart8219bff2014-09-13 10:53:00 +00001023 2.*)
1024 AC_MSG_RESULT(${GLIBC_VERSION} family)
1025 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
1026 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
1027 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
1028 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
mjwedd30332014-09-08 23:41:31 +00001029 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
1030 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
1031 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
1032 ;;
njnf76d27a2009-05-28 01:53:07 +00001033 darwin)
1034 AC_MSG_RESULT(Darwin)
1035 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
1036 # DEFAULT_SUPP set by kernel version check above.
1037 ;;
sewardjcb495c82011-07-11 20:42:34 +00001038 bionic)
1039 AC_MSG_RESULT(Bionic)
1040 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
1041 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
1042 ;;
sewardj8eb8bab2015-07-21 14:44:28 +00001043 solaris)
1044 AC_MSG_RESULT(Solaris)
1045 # DEFAULT_SUPP set in host_os switch-case above.
1046 # No other suppression file is used.
1047 ;;
bart8219bff2014-09-13 10:53:00 +00001048 2.0|2.1|*)
bart12e91122010-05-15 08:37:24 +00001049 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
sewardj8eb8bab2015-07-21 14:44:28 +00001050 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
1051 AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
sewardjde4a1d02002-03-22 01:27:54 +00001052 ;;
1053esac
1054
dirk07596a22008-04-25 11:33:30 +00001055AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +00001056
sewardj414f3582008-07-18 20:46:00 +00001057
sewardj8eb8bab2015-07-21 14:44:28 +00001058if test "$VGCONF_OS" != "solaris"; then
1059 # Add default suppressions for the X client libraries. Make no
1060 # attempt to detect whether such libraries are installed on the
1061 # build machine (or even if any X facilities are present); just
1062 # add the suppressions antidisirregardless.
1063 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
1064 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +00001065
sewardj8eb8bab2015-07-21 14:44:28 +00001066 # Add glibc and X11 suppressions for exp-sgcheck
1067 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
1068fi
sewardj5744c022008-10-19 18:58:13 +00001069
sewardj2e10a682003-04-07 19:36:41 +00001070
njn7fd6d382009-01-22 21:56:32 +00001071#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +00001072# Platform variants?
1073#----------------------------------------------------------------------------
1074
1075# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
1076# But there are times where we need a bit more control. The motivating
philippe5d5dd8e2012-08-05 00:08:25 +00001077# and currently only case is Android: this is almost identical to
dejanj9c6b05d2013-12-27 09:06:55 +00001078# {x86,arm,mips}-linux, but not quite. So this introduces the concept of
1079# platform variant tags, which get passed in the compile as
1080# -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
sewardjcb495c82011-07-11 20:42:34 +00001081#
1082# In almost all cases, the <variant> bit is "vanilla". But for Android
1083# it is "android" instead.
1084#
1085# Consequently (eg), plain arm-linux would build with
1086#
1087# -DVGP_arm_linux -DVGPV_arm_linux_vanilla
1088#
1089# whilst an Android build would have
1090#
1091# -DVGP_arm_linux -DVGPV_arm_linux_android
1092#
philippe5d5dd8e2012-08-05 00:08:25 +00001093# Same for x86. The setup of the platform variant is pushed relatively far
1094# down this file in order that we can inspect any of the variables set above.
sewardjcb495c82011-07-11 20:42:34 +00001095
1096# In the normal case ..
1097VGCONF_PLATVARIANT="vanilla"
1098
philippe5d5dd8e2012-08-05 00:08:25 +00001099# Android ?
1100if test "$GLIBC_VERSION" = "bionic";
sewardjcb495c82011-07-11 20:42:34 +00001101then
1102 VGCONF_PLATVARIANT="android"
1103fi
1104
1105AC_SUBST(VGCONF_PLATVARIANT)
1106
1107
1108# FIXME: do we also want to define automake variables
1109# VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
1110# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
1111# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
1112# do that. Problem is that we can't do and-ing in Makefile.am's, but
1113# that's what we'd need to do to use this, since what we'd want to write
1114# is something like
1115#
1116# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
1117#
sewardj0ba37c92011-07-12 11:46:24 +00001118# Hmm. Can't think of a nice clean solution to this.
1119
1120AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1121 test x$VGCONF_PLATVARIANT = xvanilla)
1122AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1123 test x$VGCONF_PLATVARIANT = xandroid)
sewardjcb495c82011-07-11 20:42:34 +00001124
1125
1126#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +00001127# Checking for various library functions and other definitions
1128#----------------------------------------------------------------------------
1129
florian28db75c2012-12-08 19:26:03 +00001130# Check for AT_FDCWD
1131
1132AC_MSG_CHECKING([for AT_FDCWD])
1133AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1134#define _GNU_SOURCE
1135#include <fcntl.h>
1136#include <unistd.h>
1137]], [[
1138 int a = AT_FDCWD;
1139]])], [
1140ac_have_at_fdcwd=yes
1141AC_MSG_RESULT([yes])
1142], [
1143ac_have_at_fdcwd=no
florian28db75c2012-12-08 19:26:03 +00001144AC_MSG_RESULT([no])
1145])
1146
1147AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1148
sewardj24cf8df2012-12-14 10:30:57 +00001149# Check for stpncpy function definition in string.h
1150# This explicitly checks with _GNU_SOURCE defined since that is also
1151# used in the test case (some systems might define it without anyway
1152# since stpncpy is part of The Open Group Base Specifications Issue 7
1153# IEEE Std 1003.1-2008.
1154AC_MSG_CHECKING([for stpncpy])
1155AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1156#define _GNU_SOURCE
1157#include <string.h>
1158]], [[
1159 char *d;
1160 char *s;
1161 size_t n = 0;
1162 char *r = stpncpy(d, s, n);
1163]])], [
1164ac_have_gnu_stpncpy=yes
1165AC_MSG_RESULT([yes])
1166], [
1167ac_have_gnu_stpncpy=no
1168AC_MSG_RESULT([no])
1169])
1170
1171AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
florian28db75c2012-12-08 19:26:03 +00001172
philippe4e98f7c2013-08-03 20:34:58 +00001173# Check for PTRACE_GETREGS
1174
1175AC_MSG_CHECKING([for PTRACE_GETREGS])
1176AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
philippedc1757e2015-02-02 22:40:54 +00001177#include <stdlib.h>
philippe4e98f7c2013-08-03 20:34:58 +00001178#include <stddef.h>
1179#include <sys/ptrace.h>
1180#include <sys/user.h>
1181]], [[
1182 void *p;
1183 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1184]])], [
1185AC_MSG_RESULT([yes])
1186AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1187 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1188], [
1189AC_MSG_RESULT([no])
1190])
1191
1192
bart59e2f182008-04-28 16:22:53 +00001193# Check for CLOCK_MONOTONIC
1194
1195AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1196
bart417cf3e2011-10-22 09:21:24 +00001197AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart59e2f182008-04-28 16:22:53 +00001198#include <time.h>
bart417cf3e2011-10-22 09:21:24 +00001199]], [[
bart59e2f182008-04-28 16:22:53 +00001200 struct timespec t;
1201 clock_gettime(CLOCK_MONOTONIC, &t);
1202 return 0;
bart417cf3e2011-10-22 09:21:24 +00001203]])], [
bart59e2f182008-04-28 16:22:53 +00001204AC_MSG_RESULT([yes])
1205AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1206 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1207], [
1208AC_MSG_RESULT([no])
1209])
1210
bartfea06922008-05-03 09:12:15 +00001211
Elliott Hughesa0664b92017-04-18 17:46:52 -07001212# Check for ELF32/64_CHDR
1213
1214AC_CHECK_TYPES([Elf32_Chdr, Elf64_Chdr], [], [], [[#include <elf.h>]])
1215
1216
sewardj0c09bf02011-07-11 22:11:58 +00001217# Check for PTHREAD_RWLOCK_T
1218
1219AC_MSG_CHECKING([for pthread_rwlock_t])
1220
bart417cf3e2011-10-22 09:21:24 +00001221AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardj0c09bf02011-07-11 22:11:58 +00001222#define _GNU_SOURCE
1223#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001224]], [[
sewardj0c09bf02011-07-11 22:11:58 +00001225 pthread_rwlock_t rwl;
bart417cf3e2011-10-22 09:21:24 +00001226]])], [
sewardj0c09bf02011-07-11 22:11:58 +00001227AC_MSG_RESULT([yes])
1228AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1229 [Define to 1 if you have the `pthread_rwlock_t' type.])
1230], [
1231AC_MSG_RESULT([no])
1232])
1233
1234
bartfea06922008-05-03 09:12:15 +00001235# Check for PTHREAD_MUTEX_ADAPTIVE_NP
1236
1237AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1238
bart417cf3e2011-10-22 09:21:24 +00001239AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001240#define _GNU_SOURCE
1241#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001242]], [[
bartfea06922008-05-03 09:12:15 +00001243 return (PTHREAD_MUTEX_ADAPTIVE_NP);
bart417cf3e2011-10-22 09:21:24 +00001244]])], [
bartfea06922008-05-03 09:12:15 +00001245AC_MSG_RESULT([yes])
1246AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1247 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1248], [
1249AC_MSG_RESULT([no])
1250])
1251
1252
1253# Check for PTHREAD_MUTEX_ERRORCHECK_NP
1254
1255AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1256
bart417cf3e2011-10-22 09:21:24 +00001257AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001258#define _GNU_SOURCE
1259#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001260]], [[
bartfea06922008-05-03 09:12:15 +00001261 return (PTHREAD_MUTEX_ERRORCHECK_NP);
bart417cf3e2011-10-22 09:21:24 +00001262]])], [
bartfea06922008-05-03 09:12:15 +00001263AC_MSG_RESULT([yes])
1264AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1265 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1266], [
1267AC_MSG_RESULT([no])
1268])
1269
1270
1271# Check for PTHREAD_MUTEX_RECURSIVE_NP
1272
1273AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1274
bart417cf3e2011-10-22 09:21:24 +00001275AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001276#define _GNU_SOURCE
1277#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001278]], [[
bartfea06922008-05-03 09:12:15 +00001279 return (PTHREAD_MUTEX_RECURSIVE_NP);
bart417cf3e2011-10-22 09:21:24 +00001280]])], [
bartfea06922008-05-03 09:12:15 +00001281AC_MSG_RESULT([yes])
1282AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1283 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1284], [
1285AC_MSG_RESULT([no])
1286])
1287
1288
1289# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1290
1291AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1292
bart417cf3e2011-10-22 09:21:24 +00001293AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001294#define _GNU_SOURCE
1295#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001296]], [[
bartfea06922008-05-03 09:12:15 +00001297 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1298 return 0;
bart417cf3e2011-10-22 09:21:24 +00001299]])], [
bartfea06922008-05-03 09:12:15 +00001300AC_MSG_RESULT([yes])
1301AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1302 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1303], [
1304AC_MSG_RESULT([no])
1305])
1306
1307
bart5e389f12008-04-05 12:53:15 +00001308# Check whether pthread_mutex_t has a member called __m_kind.
1309
bartb11355c2010-04-29 16:37:26 +00001310AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1311 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1312 1,
1313 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1314 ],
1315 [],
1316 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001317
1318
1319# Check whether pthread_mutex_t has a member called __data.__kind.
1320
bartb11355c2010-04-29 16:37:26 +00001321AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1322 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1323 1,
1324 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1325 ],
1326 [],
1327 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001328
carll5bd4f6d2015-07-20 21:25:32 +00001329# Convenience function. Set flags based on the existing HWCAP entries.
1330# The AT_HWCAP entries are generated by glibc, and are based on
1331# functions supported by the hardware/system/libc.
1332# Subsequent support for whether the capability will actually be utilized
1333# will also be checked against the compiler capabilities.
1334# called as
1335# AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET]
1336AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[
1337 AUXV_CHECK_FOR=$1
1338 AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator])
bart9983eca2015-07-25 14:31:02 +00001339 if LD_SHOW_AUXV=1 `which true` | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR}
carll5bd4f6d2015-07-20 21:25:32 +00001340 then
1341 AC_MSG_RESULT([yes])
1342 AC_SUBST([$2],[yes])
1343 else
1344 AC_MSG_RESULT([no])
1345 AC_SUBST([$2],[])
1346 fi
1347])
1348
1349# gather hardware capabilities. (hardware/kernel/libc)
carll56f79892015-07-20 21:57:21 +00001350AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC])
1351AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX])
1352AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP])
1353AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05])
1354AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06])
1355AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07])
Elliott Hughesa0664b92017-04-18 17:46:52 -07001356AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00])
carll5bd4f6d2015-07-20 21:25:32 +00001357AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM])
bart5e389f12008-04-05 12:53:15 +00001358
carll56f79892015-07-20 21:57:21 +00001359# ISA Levels
1360AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes])
1361AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes])
1362# compiler support for isa 2.07 level instructions
1363AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ])
1364AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1365]], [[
1366 __asm__ __volatile__("mtvsrd 1,2 ");
1367]])], [
1368ac_asm_have_isa_2_07=yes
1369AC_MSG_RESULT([yes])
1370], [
1371ac_asm_have_isa_2_07=no
1372AC_MSG_RESULT([no])
1373])
1374AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \
1375 -a x$HWCAP_HAS_ISA_2_07 = xyes])
1376
1377# altivec (vsx) support.
bart62c370e2008-05-12 18:50:51 +00001378# does this compiler support -maltivec and does it have the include file
1379# <altivec.h> ?
carll56f79892015-07-20 21:57:21 +00001380AC_MSG_CHECKING([for Altivec support in the compiler ])
bart62c370e2008-05-12 18:50:51 +00001381safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001382CFLAGS="-maltivec -Werror"
bart417cf3e2011-10-22 09:21:24 +00001383AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart62c370e2008-05-12 18:50:51 +00001384#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001385]], [[
bart62c370e2008-05-12 18:50:51 +00001386 vector unsigned int v;
bart417cf3e2011-10-22 09:21:24 +00001387]])], [
bart62c370e2008-05-12 18:50:51 +00001388ac_have_altivec=yes
1389AC_MSG_RESULT([yes])
1390], [
1391ac_have_altivec=no
1392AC_MSG_RESULT([no])
1393])
1394CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001395AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \
1396 -a x$HWCAP_HAS_ALTIVEC = xyes])
bart62c370e2008-05-12 18:50:51 +00001397
sewardjf34eb492011-04-15 11:57:05 +00001398# Check that both: the compiler supports -mvsx and that the assembler
1399# understands VSX instructions. If either of those doesn't work,
carll56f79892015-07-20 21:57:21 +00001400# conclude that we can't do VSX.
1401AC_MSG_CHECKING([for VSX compiler flag support])
sewardjf34eb492011-04-15 11:57:05 +00001402safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001403CFLAGS="-mvsx -Werror"
carll56f79892015-07-20 21:57:21 +00001404AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1405]], [[
1406]])], [
1407ac_compiler_supports_vsx_flag=yes
1408AC_MSG_RESULT([yes])
1409], [
1410ac_compiler_supports_vsx_flag=no
1411AC_MSG_RESULT([no])
1412])
1413CFLAGS=$safe_CFLAGS
sewardjf34eb492011-04-15 11:57:05 +00001414
carll56f79892015-07-20 21:57:21 +00001415AC_MSG_CHECKING([for VSX support in the assembler ])
1416safe_CFLAGS=$CFLAGS
1417CFLAGS="-mvsx -Werror"
bart417cf3e2011-10-22 09:21:24 +00001418AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardjf34eb492011-04-15 11:57:05 +00001419#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001420]], [[
sewardjf34eb492011-04-15 11:57:05 +00001421 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +00001422 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
bart417cf3e2011-10-22 09:21:24 +00001423]])], [
carll56f79892015-07-20 21:57:21 +00001424ac_compiler_supports_vsx=yes
sewardjf34eb492011-04-15 11:57:05 +00001425AC_MSG_RESULT([yes])
1426], [
carll56f79892015-07-20 21:57:21 +00001427ac_compiler_supports_vsx=no
sewardjf34eb492011-04-15 11:57:05 +00001428AC_MSG_RESULT([no])
1429])
1430CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001431AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \
1432 -a x$ac_compiler_supports_vsx = xyes \
1433 -a x$HWCAP_HAS_VSX = xyes ])
sewardjf34eb492011-04-15 11:57:05 +00001434
carll56f79892015-07-20 21:57:21 +00001435# DFP (Decimal Float)
sewardjb0ccb4d2012-04-02 10:22:05 +00001436AC_MSG_CHECKING([that assembler knows DFP])
sewardjb0ccb4d2012-04-02 10:22:05 +00001437AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1438]], [[
Elliott Hughesa0664b92017-04-18 17:46:52 -07001439 #ifdef __s390__
1440 __asm__ __volatile__("adtr 1, 2, 3")
1441 #else
sewardjb0ccb4d2012-04-02 10:22:05 +00001442 __asm__ __volatile__("dadd 1, 2, 3");
sewardj4e1c1912012-08-08 22:22:26 +00001443 __asm__ __volatile__("dcffix 1, 2");
Elliott Hughesa0664b92017-04-18 17:46:52 -07001444 #endif
sewardjb0ccb4d2012-04-02 10:22:05 +00001445]])], [
1446ac_asm_have_dfp=yes
1447AC_MSG_RESULT([yes])
1448], [
1449ac_asm_have_dfp=no
1450AC_MSG_RESULT([no])
1451])
sewardjb0ccb4d2012-04-02 10:22:05 +00001452AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1453safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001454CFLAGS="-mhard-dfp -Werror"
sewardjb0ccb4d2012-04-02 10:22:05 +00001455AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1456]], [[
Elliott Hughesa0664b92017-04-18 17:46:52 -07001457 #ifdef __s390__
1458 __asm__ __volatile__("adtr 1, 2, 3")
1459 #else
sewardjb0ccb4d2012-04-02 10:22:05 +00001460 __asm__ __volatile__("dadd 1, 2, 3");
sewardj4e1c1912012-08-08 22:22:26 +00001461 __asm__ __volatile__("dcffix 1, 2");
Elliott Hughesa0664b92017-04-18 17:46:52 -07001462 #endif
sewardjb0ccb4d2012-04-02 10:22:05 +00001463]])], [
carll56f79892015-07-20 21:57:21 +00001464ac_compiler_have_dfp=yes
sewardjb0ccb4d2012-04-02 10:22:05 +00001465AC_MSG_RESULT([yes])
1466], [
carll56f79892015-07-20 21:57:21 +00001467ac_compiler_have_dfp=no
sewardjb0ccb4d2012-04-02 10:22:05 +00001468AC_MSG_RESULT([no])
1469])
sewardjb0ccb4d2012-04-02 10:22:05 +00001470CFLAGS=$safe_CFLAGS
carll56f79892015-07-20 21:57:21 +00001471AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \
1472 -a x$ac_compiler_have_dfp = xyes \
1473 -a x$HWCAP_HAS_DFP = xyes )
sewardj4e1c1912012-08-08 22:22:26 +00001474
florian46825982012-11-10 22:35:24 +00001475AC_MSG_CHECKING([that compiler knows DFP datatypes])
1476AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1477]], [[
1478 _Decimal64 x = 0.0DD;
1479]])], [
carll56f79892015-07-20 21:57:21 +00001480ac_compiler_have_dfp_type=yes
florian46825982012-11-10 22:35:24 +00001481AC_MSG_RESULT([yes])
1482], [
carll56f79892015-07-20 21:57:21 +00001483ac_compiler_have_dfp_type=no
florian46825982012-11-10 22:35:24 +00001484AC_MSG_RESULT([no])
1485])
carll56f79892015-07-20 21:57:21 +00001486AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \
Elliott Hughesa0664b92017-04-18 17:46:52 -07001487 -a x$HWCAP_HAS_DFP = xyes )
florian46825982012-11-10 22:35:24 +00001488
florian46825982012-11-10 22:35:24 +00001489
carll5bd4f6d2015-07-20 21:25:32 +00001490# HTM (Hardware Transactional Memory)
1491AC_MSG_CHECKING([if compiler accepts the -mhtm flag])
1492safe_CFLAGS=$CFLAGS
1493CFLAGS="-mhtm -Werror"
1494AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1495]], [[
1496 return 0;
1497]])], [
1498AC_MSG_RESULT([yes])
1499ac_compiler_supports_htm=yes
1500], [
1501AC_MSG_RESULT([no])
1502ac_compiler_supports_htm=no
1503])
1504CFLAGS=$safe_CFLAGS
1505
1506AC_MSG_CHECKING([if compiler can find the htm builtins])
1507safe_CFLAGS=$CFLAGS
1508CFLAGS="-mhtm -Werror"
1509 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1510 ]], [[
1511 if (__builtin_tbegin (0))
1512 __builtin_tend (0);
1513 ]])], [
1514 AC_MSG_RESULT([yes])
1515ac_compiler_sees_htm_builtins=yes
1516 ], [
1517 AC_MSG_RESULT([no])
1518ac_compiler_sees_htm_builtins=no
1519 ])
1520CFLAGS=$safe_CFLAGS
1521
1522AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \
1523 -a x$ac_compiler_sees_htm_builtins = xyes \
1524 -a x$HWCAP_HAS_HTM = xyes )
1525
Elliott Hughesa0664b92017-04-18 17:46:52 -07001526# isa 3.0 checking
1527AC_MSG_CHECKING([that assembler knows ISA 3.00 ])
1528
1529AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1530]], [[
1531 __asm__ __volatile__("cnttzw 1,2 ");
1532]])], [
1533ac_asm_have_isa_3_00=yes
1534AC_MSG_RESULT([yes])
1535], [
1536ac_asm_have_isa_3_00=no
1537AC_MSG_RESULT([no])
1538])
1539
1540AM_CONDITIONAL(HAS_ISA_3_00, test x$ac_asm_have_isa_3_00 = xyes \
1541 -a x$HWCAP_HAS_ISA_3_00 = xyes])
1542
bart36dd85a2009-04-26 07:11:48 +00001543# Check for pthread_create@GLIBC2.0
1544AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1545
bart16e1c5a2009-04-26 07:38:53 +00001546safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001547CFLAGS="-lpthread -Werror"
bart417cf3e2011-10-22 09:21:24 +00001548AC_LINK_IFELSE([AC_LANG_PROGRAM([[
bart36dd85a2009-04-26 07:11:48 +00001549extern int pthread_create_glibc_2_0(void*, const void*,
1550 void *(*)(void*), void*);
1551__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
bart417cf3e2011-10-22 09:21:24 +00001552]], [[
bart276ed3a2009-05-10 15:41:45 +00001553#ifdef __powerpc__
1554/*
1555 * Apparently on PowerPC linking this program succeeds and generates an
1556 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1557 */
1558#error This test does not work properly on PowerPC.
1559#else
bart16e1c5a2009-04-26 07:38:53 +00001560 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001561#endif
bart16e1c5a2009-04-26 07:38:53 +00001562 return 0;
bart417cf3e2011-10-22 09:21:24 +00001563]])], [
bart36dd85a2009-04-26 07:11:48 +00001564ac_have_pthread_create_glibc_2_0=yes
1565AC_MSG_RESULT([yes])
1566AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1567 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1568], [
1569ac_have_pthread_create_glibc_2_0=no
1570AC_MSG_RESULT([no])
1571])
bart16e1c5a2009-04-26 07:38:53 +00001572CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001573
1574AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001575 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001576
1577
philippe1670b052014-08-15 10:27:52 +00001578# Check for dlinfo RTLD_DI_TLS_MODID
1579AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1580
1581safe_LIBS="$LIBS"
1582LIBS="-ldl"
1583AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1584#ifndef _GNU_SOURCE
1585#define _GNU_SOURCE
1586#endif
1587#include <link.h>
1588#include <dlfcn.h>
1589]], [[
1590 size_t sizes[10000];
1591 size_t modid_offset;
1592 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1593 return 0;
1594]])], [
1595ac_have_dlinfo_rtld_di_tls_modid=yes
1596AC_MSG_RESULT([yes])
1597AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1598 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1599], [
1600ac_have_dlinfo_rtld_di_tls_modid=no
1601AC_MSG_RESULT([no])
1602])
1603LIBS=$safe_LIBS
1604
1605AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1606 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1607
1608
barta50aa8a2008-04-27 06:06:57 +00001609# Check for eventfd_t, eventfd() and eventfd_read()
1610AC_MSG_CHECKING([for eventfd()])
1611
bart417cf3e2011-10-22 09:21:24 +00001612AC_LINK_IFELSE([AC_LANG_PROGRAM([[
barta50aa8a2008-04-27 06:06:57 +00001613#include <sys/eventfd.h>
bart417cf3e2011-10-22 09:21:24 +00001614]], [[
barta50aa8a2008-04-27 06:06:57 +00001615 eventfd_t ev;
1616 int fd;
1617
1618 fd = eventfd(5, 0);
1619 eventfd_read(fd, &ev);
1620 return 0;
bart417cf3e2011-10-22 09:21:24 +00001621]])], [
barta50aa8a2008-04-27 06:06:57 +00001622AC_MSG_RESULT([yes])
1623AC_DEFINE([HAVE_EVENTFD], 1,
1624 [Define to 1 if you have the `eventfd' function.])
1625AC_DEFINE([HAVE_EVENTFD_READ], 1,
1626 [Define to 1 if you have the `eventfd_read' function.])
1627], [
1628AC_MSG_RESULT([no])
1629])
1630
florian24fefb62013-10-08 13:04:00 +00001631# Check whether compiler can process #include <thread> without errors
1632# clang 3.3 cannot process <thread> from e.g.
1633# gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1634
1635AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1636AC_LANG(C++)
1637safe_CXXFLAGS=$CXXFLAGS
1638CXXFLAGS=-std=c++0x
1639
1640AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1641#include <thread>
1642])],
1643[
1644ac_cxx_can_include_thread_header=yes
1645AC_MSG_RESULT([yes])
1646], [
1647ac_cxx_can_include_thread_header=no
1648AC_MSG_RESULT([no])
1649])
1650CXXFLAGS=$safe_CXXFLAGS
1651AC_LANG(C)
1652
1653AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1654
mjw2a429f52014-07-18 20:45:37 +00001655
1656# On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1657# of the user_regs_struct from sys/user.h. They are structurally the same
1658# but we get either one or the other.
1659
1660AC_CHECK_TYPE([struct user_regs_struct],
1661 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1662 [[#include <sys/ptrace.h>]
1663 [#include <sys/time.h>]
1664 [#include <sys/user.h>]])
1665if test "$sys_user_has_user_regs" = "yes"; then
1666 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1667 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1668fi
1669
1670
njn7fd6d382009-01-22 21:56:32 +00001671#----------------------------------------------------------------------------
1672# Checking for supported compiler flags.
1673#----------------------------------------------------------------------------
1674
sewardj535c50f2005-06-04 23:14:53 +00001675# does this compiler support -m32 ?
1676AC_MSG_CHECKING([if gcc accepts -m32])
1677
1678safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001679CFLAGS="-m32 -Werror"
sewardj535c50f2005-06-04 23:14:53 +00001680
bart417cf3e2011-10-22 09:21:24 +00001681AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001682 return 0;
bart417cf3e2011-10-22 09:21:24 +00001683]])], [
sewardj535c50f2005-06-04 23:14:53 +00001684FLAG_M32="-m32"
1685AC_MSG_RESULT([yes])
1686], [
1687FLAG_M32=""
1688AC_MSG_RESULT([no])
1689])
1690CFLAGS=$safe_CFLAGS
1691
1692AC_SUBST(FLAG_M32)
1693
1694
sewardj01262142006-01-04 01:20:28 +00001695# does this compiler support -m64 ?
1696AC_MSG_CHECKING([if gcc accepts -m64])
1697
1698safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001699CFLAGS="-m64 -Werror"
sewardj01262142006-01-04 01:20:28 +00001700
bart417cf3e2011-10-22 09:21:24 +00001701AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001702 return 0;
bart417cf3e2011-10-22 09:21:24 +00001703]])], [
sewardj01262142006-01-04 01:20:28 +00001704FLAG_M64="-m64"
1705AC_MSG_RESULT([yes])
1706], [
1707FLAG_M64=""
1708AC_MSG_RESULT([no])
1709])
1710CFLAGS=$safe_CFLAGS
1711
1712AC_SUBST(FLAG_M64)
1713
1714
dejanjf674e382014-02-18 16:40:25 +00001715# does this compiler support -march=mips32 (mips32 default) ?
1716AC_MSG_CHECKING([if gcc accepts -march=mips32])
1717
1718safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001719CFLAGS="$CFLAGS -march=mips32 -Werror"
dejanjf674e382014-02-18 16:40:25 +00001720
1721AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1722 return 0;
1723]])], [
1724FLAG_MIPS32="-march=mips32"
1725AC_MSG_RESULT([yes])
1726], [
1727FLAG_MIPS32=""
1728AC_MSG_RESULT([no])
1729])
1730CFLAGS=$safe_CFLAGS
1731
1732AC_SUBST(FLAG_MIPS32)
1733
1734
1735# does this compiler support -march=mips64 (mips64 default) ?
1736AC_MSG_CHECKING([if gcc accepts -march=mips64])
1737
1738safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001739CFLAGS="$CFLAGS -march=mips64 -Werror"
dejanjf674e382014-02-18 16:40:25 +00001740
1741AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1742 return 0;
1743]])], [
1744FLAG_MIPS64="-march=mips64"
1745AC_MSG_RESULT([yes])
1746], [
1747FLAG_MIPS64=""
1748AC_MSG_RESULT([no])
1749])
1750CFLAGS=$safe_CFLAGS
1751
1752AC_SUBST(FLAG_MIPS64)
1753
1754
petarj1546c7a2014-01-29 18:08:50 +00001755# does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1756AC_MSG_CHECKING([if gcc accepts -march=octeon])
1757
1758safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001759CFLAGS="$CFLAGS -march=octeon -Werror"
petarj1546c7a2014-01-29 18:08:50 +00001760
1761AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1762 return 0;
1763]])], [
1764FLAG_OCTEON="-march=octeon"
1765AC_MSG_RESULT([yes])
1766], [
1767FLAG_OCTEON=""
1768AC_MSG_RESULT([no])
1769])
1770CFLAGS=$safe_CFLAGS
1771
1772AC_SUBST(FLAG_OCTEON)
1773
dejanjf674e382014-02-18 16:40:25 +00001774
petarj1546c7a2014-01-29 18:08:50 +00001775# does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1776AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1777
1778safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001779CFLAGS="$CFLAGS -march=octeon2 -Werror"
petarj1546c7a2014-01-29 18:08:50 +00001780
1781AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1782 return 0;
1783]])], [
1784FLAG_OCTEON2="-march=octeon2"
1785AC_MSG_RESULT([yes])
1786], [
1787FLAG_OCTEON2=""
1788AC_MSG_RESULT([no])
1789])
1790CFLAGS=$safe_CFLAGS
1791
1792AC_SUBST(FLAG_OCTEON2)
1793
1794
sewardj67f1fcc2005-07-03 10:41:02 +00001795# does this compiler support -mmmx ?
1796AC_MSG_CHECKING([if gcc accepts -mmmx])
1797
1798safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001799CFLAGS="-mmmx -Werror"
sewardj67f1fcc2005-07-03 10:41:02 +00001800
bart417cf3e2011-10-22 09:21:24 +00001801AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001802 return 0;
bart417cf3e2011-10-22 09:21:24 +00001803]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001804FLAG_MMMX="-mmmx"
1805AC_MSG_RESULT([yes])
1806], [
1807FLAG_MMMX=""
1808AC_MSG_RESULT([no])
1809])
1810CFLAGS=$safe_CFLAGS
1811
1812AC_SUBST(FLAG_MMMX)
1813
1814
1815# does this compiler support -msse ?
1816AC_MSG_CHECKING([if gcc accepts -msse])
1817
1818safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001819CFLAGS="-msse -Werror"
sewardj67f1fcc2005-07-03 10:41:02 +00001820
bart417cf3e2011-10-22 09:21:24 +00001821AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001822 return 0;
bart417cf3e2011-10-22 09:21:24 +00001823]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001824FLAG_MSSE="-msse"
1825AC_MSG_RESULT([yes])
1826], [
1827FLAG_MSSE=""
1828AC_MSG_RESULT([no])
1829])
1830CFLAGS=$safe_CFLAGS
1831
1832AC_SUBST(FLAG_MSSE)
1833
1834
sewardj98977e02014-09-05 20:00:22 +00001835# does this compiler support -mpreferred-stack-boundary=2 when
1836# generating code for a 32-bit target? Note that we only care about
1837# this when generating code for (32-bit) x86, so if the compiler
1838# doesn't recognise -m32 it's no big deal. We'll just get code for
1839# the Memcheck and other helper functions, that is a bit slower than
1840# it could be, on x86; and no difference at all on any other platform.
1841AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
sewardj5b754b42002-06-03 22:53:35 +00001842
daywalker3664f562003-10-17 13:43:46 +00001843safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001844CFLAGS="-mpreferred-stack-boundary=2 -m32 -Werror"
sewardj5b754b42002-06-03 22:53:35 +00001845
bart417cf3e2011-10-22 09:21:24 +00001846AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001847 return 0;
bart417cf3e2011-10-22 09:21:24 +00001848]])], [
sewardj98977e02014-09-05 20:00:22 +00001849PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001850AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001851], [
sewardj98977e02014-09-05 20:00:22 +00001852PREFERRED_STACK_BOUNDARY_2=""
sewardj5b754b42002-06-03 22:53:35 +00001853AC_MSG_RESULT([no])
1854])
daywalker3664f562003-10-17 13:43:46 +00001855CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001856
sewardj98977e02014-09-05 20:00:22 +00001857AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
sewardj5b754b42002-06-03 22:53:35 +00001858
sewardj535c50f2005-06-04 23:14:53 +00001859
florian743515c2015-09-04 20:52:20 +00001860# does this compiler support -mlong-double-128 ?
1861AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
1862safe_CFLAGS=$CFLAGS
1863CFLAGS="-mlong-double-128 -Werror"
1864AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1865 return 0;
1866]])], [
1867ac_compiler_supports_mlong_double_128=yes
1868AC_MSG_RESULT([yes])
1869], [
1870ac_compiler_supports_mlong_double_128=no
1871AC_MSG_RESULT([no])
1872])
1873CFLAGS=$safe_CFLAGS
1874AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
1875FLAG_MLONG_DOUBLE_128="-mlong-double-128"
1876AC_SUBST(FLAG_MLONG_DOUBLE_128)
1877
1878
mjwab69b4a2014-08-20 16:11:53 +00001879# Convenience function to check whether GCC supports a particular
florian3d53d082015-06-05 17:09:57 +00001880# warning option. Takes two arguments,
mjwab69b4a2014-08-20 16:11:53 +00001881# first the warning flag name to check (without -W), then the
1882# substitution name to set with -Wno-warning-flag if the flag exists,
1883# or the empty string if the compiler doesn't accept the flag. Note
1884# that checking is done against the warning flag itself, but the
1885# substitution is then done to cancel the warning flag.
1886AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
sewardja3a27fe2014-09-01 21:16:02 +00001887 AC_MSG_CHECKING([if gcc accepts -W$1])
1888 safe_CFLAGS=$CFLAGS
florian02ffb772015-06-05 21:19:06 +00001889 CFLAGS="-W$1 -Werror"
sewardja3a27fe2014-09-01 21:16:02 +00001890 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1891 AC_SUBST([$2], [-Wno-$1])
1892 AC_MSG_RESULT([yes])], [
1893 AC_SUBST([$2], [])
1894 AC_MSG_RESULT([no])])
1895 CFLAGS=$safe_CFLAGS
barte026bd22009-07-04 12:17:07 +00001896])
barte026bd22009-07-04 12:17:07 +00001897
florian26a790a2014-12-03 22:53:00 +00001898# Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
1899# -W$1 (instead of -Wno-$1).
1900AC_DEFUN([AC_GCC_WARNING_SUBST],[
1901 AC_MSG_CHECKING([if gcc accepts -W$1])
1902 safe_CFLAGS=$CFLAGS
florian02ffb772015-06-05 21:19:06 +00001903 CFLAGS="-W$1 -Werror"
florian26a790a2014-12-03 22:53:00 +00001904 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1905 AC_SUBST([$2], [-W$1])
1906 AC_MSG_RESULT([yes])], [
1907 AC_SUBST([$2], [])
1908 AC_MSG_RESULT([no])])
1909 CFLAGS=$safe_CFLAGS
1910])
1911
florian4f9b7c72015-08-02 19:45:58 +00001912AC_GCC_WARNING_SUBST_NO([memset-transposed-args], [FLAG_W_NO_MEMSET_TRANSPOSED_ARGS])
mjwab69b4a2014-08-20 16:11:53 +00001913AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1914AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
florian3d53d082015-06-05 17:09:57 +00001915AC_GCC_WARNING_SUBST_NO([pointer-sign], [FLAG_W_NO_POINTER_SIGN])
mjwab69b4a2014-08-20 16:11:53 +00001916AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
florian807c4542014-09-05 18:30:05 +00001917AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1918AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
florian7161e332015-09-02 15:47:33 +00001919AC_GCC_WARNING_SUBST_NO([mismatched-new-delete], [FLAG_W_NO_MISMATCHED_NEW_DELETE])
1920AC_GCC_WARNING_SUBST_NO([infinite-recursion], [FLAG_W_NO_INFINITE_RECURSION])
florian26a790a2014-12-03 22:53:00 +00001921AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
florian54681bf2015-06-05 16:26:14 +00001922AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
florian26a790a2014-12-03 22:53:00 +00001923AC_GCC_WARNING_SUBST([format], [FLAG_W_FORMAT])
florianb26101c2015-08-08 21:45:33 +00001924# Disabled for now until all platforms are clean
florian42c2a5b2015-08-09 08:16:54 +00001925format_checking_enabled=no
1926#format_checking_enabled=yes
1927if test "$format_checking_enabled" = "yes"; then
1928 AC_GCC_WARNING_SUBST([format-signedness], [FLAG_W_FORMAT_SIGNEDNESS])
1929else
1930 dumy_assignment_to_avoid_syntax_errors=1
1931 AC_SUBST([FLAG_W_FORMAT_SIGNEDNESS], [])
1932fi
florian26a790a2014-12-03 22:53:00 +00001933AC_GCC_WARNING_SUBST([cast-qual], [FLAG_W_CAST_QUAL])
florian90694062015-05-16 16:17:52 +00001934AC_GCC_WARNING_SUBST([old-style-declaration], [FLAG_W_OLD_STYLE_DECLARATION])
1935AC_GCC_WARNING_SUBST([ignored-qualifiers], [FLAG_W_IGNORED_QUALIFIERS])
1936AC_GCC_WARNING_SUBST([missing-parameter-type], [FLAG_W_MISSING_PARAMETER_TYPE])
sewardja3a27fe2014-09-01 21:16:02 +00001937
floriane1988aa2015-06-09 21:44:58 +00001938# Does this compiler support -Wformat-security ?
1939# Special handling is needed, because certain GCC versions require -Wformat
1940# being present if -Wformat-security is given. Otherwise a warning is issued.
1941# However, AC_GCC_WARNING_SUBST will stick in -Werror (see r15323 for rationale).
1942# And with that the warning will be turned into an error with the result
1943# that -Wformat-security is believed to be unsupported when in fact it is.
1944AC_MSG_CHECKING([if gcc accepts -Wformat-security])
1945safe_CFLAGS=$CFLAGS
1946CFLAGS="-Wformat -Wformat-security -Werror"
1947AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1948AC_SUBST([FLAG_W_FORMAT_SECURITY], [-Wformat-security])
1949AC_MSG_RESULT([yes])], [
1950AC_SUBST([FLAG_W_FORMAT_SECURITY], [])
1951AC_MSG_RESULT([no])])
1952CFLAGS=$safe_CFLAGS
1953
bart56730cd2008-05-11 06:41:46 +00001954# does this compiler support -Wextra or the older -W ?
1955
1956AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1957
1958safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001959CFLAGS="-Wextra -Werror"
bart56730cd2008-05-11 06:41:46 +00001960
bart417cf3e2011-10-22 09:21:24 +00001961AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001962 return 0;
bart417cf3e2011-10-22 09:21:24 +00001963]])], [
bart56730cd2008-05-11 06:41:46 +00001964AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1965AC_MSG_RESULT([-Wextra])
1966], [
florian538cf302015-06-09 21:53:48 +00001967 CFLAGS="-W -Werror"
sewardj9bdf2a62011-10-27 06:22:23 +00001968 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001969 return 0;
sewardj9bdf2a62011-10-27 06:22:23 +00001970 ]])], [
bart56730cd2008-05-11 06:41:46 +00001971 AC_SUBST([FLAG_W_EXTRA], [-W])
1972 AC_MSG_RESULT([-W])
1973 ], [
1974 AC_SUBST([FLAG_W_EXTRA], [])
1975 AC_MSG_RESULT([not supported])
1976 ])
1977])
1978CFLAGS=$safe_CFLAGS
1979
florian1537bb42015-09-14 21:11:32 +00001980# On ARM we do not want to pass -Wcast-align as that produces loads
1981# of warnings. GCC is just being conservative. See here:
1982# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65459#c4
1983if test "X$VGCONF_ARCH_PRI" = "Xarm"; then
1984 AC_SUBST([FLAG_W_CAST_ALIGN], [""])
1985else
1986 AC_SUBST([FLAG_W_CAST_ALIGN], [-Wcast-align])
1987fi
1988
sewardja72c26d2007-05-01 13:44:08 +00001989# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001990AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001991
1992safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00001993CFLAGS="-fno-stack-protector -Werror"
sewardja72c26d2007-05-01 13:44:08 +00001994
bart417cf3e2011-10-22 09:21:24 +00001995AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001996 return 0;
bart417cf3e2011-10-22 09:21:24 +00001997]])], [
sewardja72c26d2007-05-01 13:44:08 +00001998no_stack_protector=yes
1999FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
2000AC_MSG_RESULT([yes])
2001], [
2002no_stack_protector=no
2003FLAG_FNO_STACK_PROTECTOR=""
2004AC_MSG_RESULT([no])
2005])
2006CFLAGS=$safe_CFLAGS
2007
2008AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
2009
mjw37915072015-06-02 20:23:06 +00002010# Does GCC support disabling Identical Code Folding?
2011# We want to disabled Identical Code Folding for the
2012# tools preload shared objects to get better backraces.
2013# For GCC 5.1+ -fipa-icf is enabled by default at -O2.
2014# "The optimization reduces code size and may disturb
2015# unwind stacks by replacing a function by equivalent
2016# one with a different name."
2017AC_MSG_CHECKING([if gcc accepts -fno-ipa-icf])
2018
2019safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002020CFLAGS="-fno-ipa-icf -Werror"
mjw37915072015-06-02 20:23:06 +00002021
2022AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2023 return 0;
2024]])], [
2025no_ipa_icf=yes
2026FLAG_FNO_IPA_ICF="-fno-ipa-icf"
2027AC_MSG_RESULT([yes])
2028], [
2029no_ipa_icf=no
2030FLAG_FNO_IPA_ICF=""
2031AC_MSG_RESULT([no])
2032])
2033CFLAGS=$safe_CFLAGS
2034
2035AC_SUBST(FLAG_FNO_IPA_ICF)
2036
florianbb1a7872015-03-10 16:13:59 +00002037
florian3878e162015-06-23 20:31:52 +00002038# Does this compiler support -fsanitize=undefined. This is true for
2039# GCC 4.9 and newer. However, the undefined behaviour sanitiser in GCC 5.1
2040# also checks for alignment violations on memory accesses which the valgrind
2041# code base is sprinkled (if not littered) with. As those alignment issues
2042# don't pose a problem we want to suppress warnings about them.
2043# In GCC 5.1 this can be done by passing -fno-sanitize=alignment. Earlier
2044# GCCs do not support that.
2045#
florianbb1a7872015-03-10 16:13:59 +00002046# Only checked for if --enable-ubsan was given.
2047if test "x${vg_cv_ubsan}" = "xyes"; then
florian3878e162015-06-23 20:31:52 +00002048AC_MSG_CHECKING([if gcc accepts -fsanitize=undefined -fno-sanitize=alignment])
florianbb1a7872015-03-10 16:13:59 +00002049safe_CFLAGS=$CFLAGS
florian3878e162015-06-23 20:31:52 +00002050CFLAGS="-fsanitize=undefined -fno-sanitize=alignment -Werror"
2051AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2052 return 0;
2053]])], [
2054FLAG_FSANITIZE="-fsanitize=undefined -fno-sanitize=alignment"
2055LIB_UBSAN="-static-libubsan"
2056AC_MSG_RESULT([yes])
2057], [
florian538cf302015-06-09 21:53:48 +00002058CFLAGS="-fsanitize=undefined -Werror"
florianbb1a7872015-03-10 16:13:59 +00002059AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2060 return 0;
2061]])], [
2062FLAG_FSANITIZE="-fsanitize=undefined"
2063LIB_UBSAN="-static-libubsan"
2064AC_MSG_RESULT([yes])
2065], [
2066FLAG_FSANITIZE=""
2067LIB_UBSAN=""
2068AC_MSG_RESULT([no])
2069])
florian3878e162015-06-23 20:31:52 +00002070])
florianbb1a7872015-03-10 16:13:59 +00002071CFLAGS=$safe_CFLAGS
2072AC_SUBST(FLAG_FSANITIZE)
2073AC_SUBST(LIB_UBSAN)
2074fi
bart56730cd2008-05-11 06:41:46 +00002075# does this compiler support --param inline-unit-growth=... ?
2076
2077AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
2078
2079safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002080CFLAGS="--param inline-unit-growth=900 -Werror"
bart56730cd2008-05-11 06:41:46 +00002081
bart417cf3e2011-10-22 09:21:24 +00002082AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00002083 return 0;
bart417cf3e2011-10-22 09:21:24 +00002084]])], [
bart56730cd2008-05-11 06:41:46 +00002085AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
2086 ["--param inline-unit-growth=900"])
2087AC_MSG_RESULT([yes])
2088], [
2089AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
2090AC_MSG_RESULT([no])
2091])
2092CFLAGS=$safe_CFLAGS
2093
2094
sewardjd9350682012-04-05 07:55:47 +00002095# does this compiler support -gdwarf-4 -fdebug-types-section ?
2096
2097AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
2098
2099safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002100CFLAGS="-gdwarf-4 -fdebug-types-section -Werror"
sewardjd9350682012-04-05 07:55:47 +00002101
2102AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2103 return 0;
2104]])], [
2105ac_have_dwarf4=yes
2106AC_MSG_RESULT([yes])
2107], [
2108ac_have_dwarf4=no
2109AC_MSG_RESULT([no])
2110])
2111AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
2112CFLAGS=$safe_CFLAGS
2113
2114
Elliott Hughesa0664b92017-04-18 17:46:52 -07002115# does this compiler support -g -gz=zlib ?
2116
2117AC_MSG_CHECKING([if gcc accepts -g -gz=zlib])
2118
2119safe_CFLAGS=$CFLAGS
2120CFLAGS="-g -gz=zlib"
2121
2122AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2123 return 0;
2124]])], [
2125ac_have_gz_zlib=yes
2126AC_MSG_RESULT([yes])
2127], [
2128ac_have_gz_zlib=no
2129AC_MSG_RESULT([no])
2130])
2131AM_CONDITIONAL(GZ_ZLIB, test x$ac_have_gz_zlib = xyes)
2132CFLAGS=$safe_CFLAGS
2133
2134
2135# does this compiler support -g -gz=zlib-gnu ?
2136
2137AC_MSG_CHECKING([if gcc accepts -g -gz=zlib-gnu])
2138
2139safe_CFLAGS=$CFLAGS
2140CFLAGS="-g -gz=zlib-gnu"
2141
2142AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
2143 return 0;
2144]])], [
2145ac_have_gz_zlib_gnu=yes
2146AC_MSG_RESULT([yes])
2147], [
2148ac_have_gz_zlib_gnu=no
2149AC_MSG_RESULT([no])
2150])
2151AM_CONDITIONAL(GZ_ZLIB_GNU, test x$ac_have_gz_zlib_gnu = xyes)
2152CFLAGS=$safe_CFLAGS
2153
2154
florian3df02112013-10-04 11:35:50 +00002155# does this compiler support nested functions ?
2156
2157AC_MSG_CHECKING([if gcc accepts nested functions])
2158
2159AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2160 int foo() { return 1; }
2161 return foo();
2162]])], [
2163ac_have_nested_functions=yes
2164AC_MSG_RESULT([yes])
2165], [
2166ac_have_nested_functions=no
2167AC_MSG_RESULT([no])
2168])
2169AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
2170
2171
2172# does this compiler support the 'p' constraint in ASM statements ?
2173
2174AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
2175
2176AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2177 char *p;
2178 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
2179]])], [
2180ac_have_asm_constraint_p=yes
2181AC_MSG_RESULT([yes])
2182], [
2183ac_have_asm_constraint_p=no
2184AC_MSG_RESULT([no])
2185])
2186AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
2187
2188
sewardje4bc7032013-03-22 11:49:46 +00002189# We want to use use the -Ttext-segment option to the linker.
2190# GNU (bfd) ld supports this directly. Newer GNU gold linkers
2191# support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
2192# semantics are NOT what we want (GNU gold -Ttext is fine).
2193#
2194# For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
2195# will reside. -Ttext aligns just the .text section start (but not any
2196# other section).
2197#
2198# So test for -Ttext-segment which is supported by all bfd ld versions
2199# and use that if it exists. If it doesn't exist it must be an older
2200# version of gold and we can fall back to using -Ttext which has the
2201# right semantics.
bart699fbac2010-06-08 18:23:59 +00002202
sewardje4bc7032013-03-22 11:49:46 +00002203AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
bart699fbac2010-06-08 18:23:59 +00002204
2205safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002206CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror"
bart699fbac2010-06-08 18:23:59 +00002207
bart8508c752010-06-10 06:26:21 +00002208AC_LINK_IFELSE(
mjw941277a2013-04-17 19:11:05 +00002209[AC_LANG_SOURCE([int _start () { return 0; }])],
bart699fbac2010-06-08 18:23:59 +00002210[
tom04ce9f52013-03-28 15:53:21 +00002211 linker_using_t_text="no"
sewardje4bc7032013-03-22 11:49:46 +00002212 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
bart699fbac2010-06-08 18:23:59 +00002213 AC_MSG_RESULT([yes])
2214], [
tom04ce9f52013-03-28 15:53:21 +00002215 linker_using_t_text="yes"
sewardje4bc7032013-03-22 11:49:46 +00002216 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
bart699fbac2010-06-08 18:23:59 +00002217 AC_MSG_RESULT([no])
2218])
2219CFLAGS=$safe_CFLAGS
2220
tom04ce9f52013-03-28 15:53:21 +00002221# If the linker only supports -Ttext (not -Ttext-segment) then we will
2222# have to strip any build-id ELF NOTEs from the staticly linked tools.
2223# Otherwise the build-id NOTE might end up at the default load address.
2224# (Pedantically if the linker is gold then -Ttext is fine, but newer
2225# gold versions also support -Ttext-segment. So just assume that unless
2226# we can use -Ttext-segment we need to strip the build-id NOTEs.
florian51b14ee2014-02-22 18:38:32 +00002227if test "x${linker_using_t_text}" = "xyes"; then
tom04ce9f52013-03-28 15:53:21 +00002228AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
2229# does the linker support -Wl,--build-id=none ? Note, it's
2230# important that we test indirectly via whichever C compiler
2231# is selected, rather than testing /usr/bin/ld or whatever
2232# directly.
2233AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
2234safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00002235CFLAGS="-Wl,--build-id=none -Werror"
tom04ce9f52013-03-28 15:53:21 +00002236
2237AC_LINK_IFELSE(
2238[AC_LANG_PROGRAM([ ], [return 0;])],
2239[
2240 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
2241 AC_MSG_RESULT([yes])
2242], [
2243 AC_SUBST([FLAG_NO_BUILD_ID], [""])
2244 AC_MSG_RESULT([no])
2245])
2246else
2247AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
2248AC_SUBST([FLAG_NO_BUILD_ID], [""])
2249fi
2250CFLAGS=$safe_CFLAGS
bart699fbac2010-06-08 18:23:59 +00002251
sewardj00f1e622006-03-12 16:47:10 +00002252# does the ppc assembler support "mtocrf" et al?
2253AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
2254
bart417cf3e2011-10-22 09:21:24 +00002255AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjdd4cbe12006-03-12 17:27:44 +00002256__asm__ __volatile__("mtocrf 4,0");
2257__asm__ __volatile__("mfocrf 0,4");
bart417cf3e2011-10-22 09:21:24 +00002258]])], [
sewardj00f1e622006-03-12 16:47:10 +00002259ac_have_as_ppc_mftocrf=yes
2260AC_MSG_RESULT([yes])
2261], [
2262ac_have_as_ppc_mftocrf=no
2263AC_MSG_RESULT([no])
2264])
2265if test x$ac_have_as_ppc_mftocrf = xyes ; then
2266 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
2267fi
2268
2269
carll1e5fa2f2013-08-09 21:55:45 +00002270# does the ppc assembler support "lfdp" and other phased out floating point insns?
2271AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
2272
2273AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2274 do { typedef struct {
2275 double hi;
2276 double lo;
2277 } dbl_pair_t;
2278 dbl_pair_t dbl_pair[3];
2279 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
2280 } while (0)
2281]])], [
2282ac_have_as_ppc_fpPO=yes
2283AC_MSG_RESULT([yes])
2284], [
2285ac_have_as_ppc_fpPO=no
2286AC_MSG_RESULT([no])
2287])
2288if test x$ac_have_as_ppc_fpPO = xyes ; then
2289 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
2290fi
2291
sewardjb5b87402011-03-07 16:05:35 +00002292
mjw70bbba02015-09-04 21:52:52 +00002293# does the amd64 assembler understand "fxsave64" and "fxrstor64"?
2294AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64])
2295
2296AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2297void* p;
2298asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" );
2299asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" );
2300]])], [
2301ac_have_as_amd64_fxsave64=yes
2302AC_MSG_RESULT([yes])
2303], [
2304ac_have_as_amd64_fxsave64=no
2305AC_MSG_RESULT([no])
2306])
2307if test x$ac_have_as_amd64_fxsave64 = xyes ; then
2308 AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.])
2309fi
2310
sewardjf0aabf82007-03-22 00:24:21 +00002311# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00002312# Note, this doesn't generate a C-level symbol. It generates a
2313# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00002314AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
2315
bart417cf3e2011-10-22 09:21:24 +00002316AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjf0aabf82007-03-22 00:24:21 +00002317 do { long long int x;
2318 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
2319 while (0)
bart417cf3e2011-10-22 09:21:24 +00002320]])], [
sewardjf0aabf82007-03-22 00:24:21 +00002321ac_have_as_sse3=yes
2322AC_MSG_RESULT([yes])
2323], [
2324ac_have_as_sse3=no
2325AC_MSG_RESULT([no])
2326])
sewardjfa18a262007-03-22 12:13:13 +00002327
2328AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00002329
2330
sewardj6d6da5b2008-02-09 12:07:40 +00002331# Ditto for SSSE3 instructions (note extra S)
2332# Note, this doesn't generate a C-level symbol. It generates a
2333# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
2334AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
2335
florianc443b962011-10-28 21:37:19 +00002336save_CFLAGS="$CFLAGS"
florian538cf302015-06-09 21:53:48 +00002337CFLAGS="$CFLAGS -msse -Werror"
bart417cf3e2011-10-22 09:21:24 +00002338AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj6d6da5b2008-02-09 12:07:40 +00002339 do { long long int x;
2340 __asm__ __volatile__(
2341 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
2342 while (0)
bart417cf3e2011-10-22 09:21:24 +00002343]])], [
sewardj6d6da5b2008-02-09 12:07:40 +00002344ac_have_as_ssse3=yes
2345AC_MSG_RESULT([yes])
2346], [
2347ac_have_as_ssse3=no
2348AC_MSG_RESULT([no])
2349])
florianc443b962011-10-28 21:37:19 +00002350CFLAGS="$save_CFLAGS"
sewardj6d6da5b2008-02-09 12:07:40 +00002351
2352AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
2353
2354
sewardj27d176a2011-01-17 11:15:48 +00002355# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
2356# Note, this doesn't generate a C-level symbol. It generates a
2357# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00002358AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
bart417cf3e2011-10-22 09:21:24 +00002359AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardje3ae8a32010-09-28 19:59:47 +00002360 do {
2361 __asm__ __volatile__(
2362 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
2363 while (0)
bart417cf3e2011-10-22 09:21:24 +00002364]])], [
sewardje3ae8a32010-09-28 19:59:47 +00002365ac_have_as_pclmulqdq=yes
2366AC_MSG_RESULT([yes])
2367], [
2368ac_have_as_pclmulqdq=no
2369AC_MSG_RESULT([no])
2370])
2371
2372AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2373
2374
bart9bbe2bb2012-08-03 19:37:02 +00002375# does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2376# Note, this doesn't generate a C-level symbol. It generates a
2377# automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2378AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2379AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2380 do {
2381 /*
2382 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2383 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2384 * xmm2 should be used.
2385 */
2386 __asm__ __volatile__(
2387 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2388 } while (0)
2389]])], [
2390ac_have_as_vpclmulqdq=yes
2391AC_MSG_RESULT([yes])
2392], [
2393ac_have_as_vpclmulqdq=no
2394AC_MSG_RESULT([no])
2395])
2396
2397AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2398
2399
Elliott Hughesa0664b92017-04-18 17:46:52 -07002400# does the x86/amd64 assembler understand FMA4 instructions?
2401# Note, this doesn't generate a C-level symbol. It generates a
2402# automake-level symbol (BUILD_AFM4_TESTS), used in test Makefile.am's
2403AC_MSG_CHECKING([if x86/amd64 assembler supports FMA4 'vfmaddpd'])
2404AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2405 do {
2406 __asm__ __volatile__(
2407 "vfmaddpd %%xmm7,%%xmm8,%%xmm6,%%xmm9" : : : );
2408 } while (0)
2409]])], [
2410ac_have_as_vfmaddpd=yes
2411AC_MSG_RESULT([yes])
2412], [
2413ac_have_as_vfmaddpd=no
2414AC_MSG_RESULT([no])
2415])
2416
2417AM_CONDITIONAL(BUILD_FMA4_TESTS, test x$ac_have_as_vfmaddpd = xyes)
2418
2419
sewardj27d176a2011-01-17 11:15:48 +00002420# does the x86/amd64 assembler understand the LZCNT instruction?
2421# Note, this doesn't generate a C-level symbol. It generates a
2422# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00002423AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2424
bart417cf3e2011-10-22 09:21:24 +00002425AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
bart55e438b2010-09-14 10:53:57 +00002426 do {
sewardjc62291c2012-07-22 11:10:08 +00002427 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
bart55e438b2010-09-14 10:53:57 +00002428 } while (0)
bart417cf3e2011-10-22 09:21:24 +00002429]])], [
bart55e438b2010-09-14 10:53:57 +00002430 ac_have_as_lzcnt=yes
2431 AC_MSG_RESULT([yes])
2432], [
2433 ac_have_as_lzcnt=no
2434 AC_MSG_RESULT([no])
2435])
2436
2437AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2438
sewardj27d176a2011-01-17 11:15:48 +00002439
florian3df02112013-10-04 11:35:50 +00002440# does the x86/amd64 assembler understand the LOOPNEL instruction?
2441# Note, this doesn't generate a C-level symbol. It generates a
2442# automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2443AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2444
2445AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2446 do {
2447 __asm__ __volatile__("1: loopnel 1b\n");
2448 } while (0)
2449]])], [
2450 ac_have_as_loopnel=yes
2451 AC_MSG_RESULT([yes])
2452], [
2453 ac_have_as_loopnel=no
2454 AC_MSG_RESULT([no])
2455])
2456
2457AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2458
2459
2460# does the x86/amd64 assembler understand ADDR32 ?
2461# Note, this doesn't generate a C-level symbol. It generates a
2462# automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2463AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2464
2465AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2466 do {
2467 asm volatile ("addr32 rep movsb");
2468 } while (0)
2469]])], [
2470 ac_have_as_addr32=yes
2471 AC_MSG_RESULT([yes])
2472], [
2473 ac_have_as_addr32=no
2474 AC_MSG_RESULT([no])
2475])
2476
2477AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2478
2479
sewardj27d176a2011-01-17 11:15:48 +00002480# does the x86/amd64 assembler understand SSE 4.2 instructions?
2481# Note, this doesn't generate a C-level symbol. It generates a
2482# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2483AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2484
bart417cf3e2011-10-22 09:21:24 +00002485AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj27d176a2011-01-17 11:15:48 +00002486 do { long long int x;
2487 __asm__ __volatile__(
florianfdfca222012-01-17 13:16:50 +00002488 "crc32q %%r15,%%r15" : : : "r15" );
2489 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002490 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2491 __asm__ __volatile__(
2492 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
sewardj27d176a2011-01-17 11:15:48 +00002493 while (0)
bart417cf3e2011-10-22 09:21:24 +00002494]])], [
sewardj27d176a2011-01-17 11:15:48 +00002495ac_have_as_sse42=yes
2496AC_MSG_RESULT([yes])
2497], [
2498ac_have_as_sse42=no
2499AC_MSG_RESULT([no])
2500])
2501
2502AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2503
2504
sewardj9fb31ca2012-06-05 00:31:49 +00002505# does the x86/amd64 assembler understand AVX instructions?
2506# Note, this doesn't generate a C-level symbol. It generates a
2507# automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2508AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2509
2510AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2511 do { long long int x;
2512 __asm__ __volatile__(
2513 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2514 __asm__ __volatile__(
2515 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2516 while (0)
2517]])], [
2518ac_have_as_avx=yes
2519AC_MSG_RESULT([yes])
2520], [
2521ac_have_as_avx=no
2522AC_MSG_RESULT([no])
2523])
2524
2525AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2526
2527
sewardjfda50af2013-03-27 11:43:20 +00002528# does the x86/amd64 assembler understand AVX2 instructions?
2529# Note, this doesn't generate a C-level symbol. It generates a
2530# automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2531AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2532
2533AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2534 do { long long int x;
2535 __asm__ __volatile__(
2536 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2537 __asm__ __volatile__(
2538 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2539 while (0)
2540]])], [
2541ac_have_as_avx2=yes
2542AC_MSG_RESULT([yes])
2543], [
2544ac_have_as_avx2=no
2545AC_MSG_RESULT([no])
2546])
2547
2548AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2549
2550
sewardj9ea080b2013-10-16 08:53:07 +00002551# does the x86/amd64 assembler understand TSX instructions and
2552# the XACQUIRE/XRELEASE prefixes?
florian364c3652013-09-30 16:32:53 +00002553# Note, this doesn't generate a C-level symbol. It generates a
2554# automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2555AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2556
2557AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2558 do {
2559 __asm__ __volatile__(
2560 " xbegin Lfoo \n\t"
sewardj9ea080b2013-10-16 08:53:07 +00002561 "Lfoo: xend \n\t"
2562 " xacquire lock incq 0(%rsp) \n\t"
2563 " xrelease lock incq 0(%rsp) \n"
2564 );
florian364c3652013-09-30 16:32:53 +00002565 } while (0)
2566]])], [
2567ac_have_as_tsx=yes
2568AC_MSG_RESULT([yes])
2569], [
2570ac_have_as_tsx=no
2571AC_MSG_RESULT([no])
2572])
2573
2574AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2575
2576
sewardjfda50af2013-03-27 11:43:20 +00002577# does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2578# Note, this doesn't generate a C-level symbol. It generates a
2579# automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2580AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2581
2582AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2583 do { unsigned int h, l;
florian4e94bda2014-10-29 13:57:49 +00002584 __asm__ __volatile__( "mulx %rax,%rcx,%r8" );
sewardjfda50af2013-03-27 11:43:20 +00002585 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002586 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
sewardjfda50af2013-03-27 11:43:20 +00002587 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002588 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
sewardjfda50af2013-03-27 11:43:20 +00002589 while (0)
2590]])], [
2591ac_have_as_bmi=yes
2592AC_MSG_RESULT([yes])
2593], [
2594ac_have_as_bmi=no
2595AC_MSG_RESULT([no])
2596])
2597
2598AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2599
2600
2601# does the x86/amd64 assembler understand FMA instructions?
2602# Note, this doesn't generate a C-level symbol. It generates a
2603# automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2604AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2605
2606AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2607 do { unsigned int h, l;
2608 __asm__ __volatile__(
2609 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2610 __asm__ __volatile__(
2611 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2612 __asm__ __volatile__(
2613 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2614 while (0)
2615]])], [
2616ac_have_as_fma=yes
2617AC_MSG_RESULT([yes])
2618], [
2619ac_have_as_fma=no
2620AC_MSG_RESULT([no])
2621])
2622
2623AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2624
2625
mjw20bafc22014-05-09 11:41:46 +00002626# does the amd64 assembler understand MPX instructions?
2627# Note, this doesn't generate a C-level symbol. It generates a
2628# automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2629AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2630
2631AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
florian404c0c72014-12-12 17:44:36 +00002632 do {
2633 asm ("bndmov %bnd0,(%rsp)");
2634 asm ("bndldx 3(%rbx,%rdx), %bnd2");
florian7161e332015-09-02 15:47:33 +00002635 asm ("bnd call foo\n"
2636 bnd jmp end\n"
2637 foo: bnd ret\n"
2638 end: nop");
florian404c0c72014-12-12 17:44:36 +00002639 } while (0)
mjw20bafc22014-05-09 11:41:46 +00002640]])], [
2641ac_have_as_mpx=yes
2642AC_MSG_RESULT([yes])
2643], [
2644ac_have_as_mpx=no
2645AC_MSG_RESULT([no])
2646])
2647
2648AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2649
2650
2651# Does the C compiler support the "ifunc" attribute
2652# Note, this doesn't generate a C-level symbol. It generates a
2653# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
sewardjb08d84d2012-07-16 08:23:26 +00002654# does the x86/amd64 assembler understand MOVBE?
2655# Note, this doesn't generate a C-level symbol. It generates a
2656# automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2657AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2658
2659AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2660 do { long long int x;
2661 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002662 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
sewardjb08d84d2012-07-16 08:23:26 +00002663 while (0)
2664]])], [
2665ac_have_as_movbe=yes
2666AC_MSG_RESULT([yes])
2667], [
2668ac_have_as_movbe=no
2669AC_MSG_RESULT([no])
2670])
2671
2672AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2673
2674
florian251c2f92012-07-05 21:21:37 +00002675# Does the C compiler support the "ifunc" attribute
2676# Note, this doesn't generate a C-level symbol. It generates a
2677# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2678AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2679
florianf78a5032012-07-06 09:17:29 +00002680AC_LINK_IFELSE([AC_LANG_SOURCE([[
2681static void mytest(void) {}
2682
2683static void (*resolve_test(void))(void)
2684{
2685 return (void (*)(void))&mytest;
2686}
2687
2688void test(void) __attribute__((ifunc("resolve_test")));
2689
2690int main()
2691{
2692 test();
2693 return 0;
2694}
florian251c2f92012-07-05 21:21:37 +00002695]])], [
2696ac_have_ifunc_attr=yes
2697AC_MSG_RESULT([yes])
2698], [
2699ac_have_ifunc_attr=no
2700AC_MSG_RESULT([no])
2701])
2702
2703AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2704
Elliott Hughesa0664b92017-04-18 17:46:52 -07002705# Does the C compiler support the armv8 crc feature flag
2706# Note, this doesn't generate a C-level symbol. It generates a
2707# automake-level symbol (BUILD_ARMV8_CRC_TESTS), used in test Makefile.am's
2708AC_MSG_CHECKING([if gcc supports the armv8 crc feature flag])
2709
2710save_CFLAGS="$CFLAGS"
2711CFLAGS="$CFLAGS -march=armv8-a+crc -Werror"
2712AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2713int main()
2714{
2715 return 0;
2716}
2717]])], [
2718ac_have_armv8_crc_feature=yes
2719AC_MSG_RESULT([yes])
2720], [
2721ac_have_armv8_crc_feature=no
2722AC_MSG_RESULT([no])
2723])
2724CFLAGS="$save_CFLAGS"
2725
2726AM_CONDITIONAL(BUILD_ARMV8_CRC_TESTS, test x$ac_have_armv8_crc_feature = xyes)
2727
florian251c2f92012-07-05 21:21:37 +00002728
sewardje089f012010-10-13 21:47:29 +00002729# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2730# when building the tool executables. I think we should get rid of it.
2731#
sewardjb5f6f512005-03-10 23:59:00 +00002732# Check for TLS support in the compiler and linker
bart2bd9a682011-10-22 09:46:16 +00002733AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2734 [[return foo;]])],
2735 [vg_cv_linktime_tls=yes],
2736 [vg_cv_linktime_tls=no])
bartca9f2ad2008-06-02 07:14:20 +00002737# Native compilation: check whether running a program using TLS succeeds.
2738# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2739# succeeds but running programs using TLS fails.
bart2bd9a682011-10-22 09:46:16 +00002740# Cross-compiling: check whether linking a program using TLS succeeds.
bartca9f2ad2008-06-02 07:14:20 +00002741AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2742 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2743 [vg_cv_tls=$enableval],
2744 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2745 [[return foo;]])],
2746 [vg_cv_tls=yes],
bart2bd9a682011-10-22 09:46:16 +00002747 [vg_cv_tls=no],
2748 [vg_cv_tls=$vg_cv_linktime_tls])])])
sewardjb5f6f512005-03-10 23:59:00 +00002749
rhyskidd34cba1b2015-06-08 08:56:33 +00002750if test "$vg_cv_tls" = yes -a $is_clang != applellvm; then
sewardjb5f6f512005-03-10 23:59:00 +00002751AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2752fi
sewardj5b754b42002-06-03 22:53:35 +00002753
sewardj535c50f2005-06-04 23:14:53 +00002754
njn7fd6d382009-01-22 21:56:32 +00002755#----------------------------------------------------------------------------
sewardj8eb8bab2015-07-21 14:44:28 +00002756# Solaris-specific checks.
2757#----------------------------------------------------------------------------
2758
2759if test "$VGCONF_OS" = "solaris" ; then
2760# Solaris-specific check determining if the Sun Studio Assembler is used to
2761# build Valgrind. The test checks if the x86/amd64 assembler understands the
2762# cmovl.l instruction, if yes then it's Sun Assembler.
2763#
2764# C-level symbol: none
2765# Automake-level symbol: SOLARIS_SUN_STUDIO_AS
2766#
2767AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)])
2768AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2769]], [[
2770 __asm__ __volatile__("cmovl.l %edx, %eax");
2771]])], [
2772solaris_have_sun_studio_as=yes
2773AC_MSG_RESULT([yes])
2774], [
2775solaris_have_sun_studio_as=no
2776AC_MSG_RESULT([no])
2777])
2778AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes)
2779
2780# Solaris-specific check determining if symbols __xpg4 and __xpg6
2781# are present in linked elfs when gcc is invoked with -std=gnu99.
2782# See solaris/vgpreload-solaris.mapfile for details.
2783# gcc on Solaris instructs linker to include these symbols,
2784# gcc on illumos does not.
2785#
2786# C-level symbol: none
2787# Automake-level symbol: SOLARIS_XPG_SYMBOLS_PRESENT
2788#
2789save_CFLAGS="$CFLAGS"
2790CFLAGS="$CFLAGS -std=gnu99"
2791AC_MSG_CHECKING([if xpg symbols are present with -std=gnu99 (Solaris-specific)])
2792AC_RUN_IFELSE([AC_LANG_SOURCE([[
2793#include <limits.h>
2794#include <stdio.h>
2795#include <stdlib.h>
2796
2797int main(int argc, const char *argv[]) {
2798 char command[PATH_MAX + 50];
2799 snprintf(command, sizeof(command), "nm %s | egrep '__xpg[4,6]'", argv[0]);
2800
2801 FILE *output = popen(command, "r");
2802 if (output == NULL) return -1;
2803
2804 char buf[100];
2805 if (fgets(buf, sizeof(buf), output) != NULL) {
2806 pclose(output);
2807 return 0;
2808 } else {
2809 pclose(output);
2810 return 1;
2811 }
2812}
2813]])], [
2814solaris_xpg_symbols_present=yes
2815AC_MSG_RESULT([yes])
2816], [
2817solaris_xpg_symbols_present=no
2818AC_MSG_RESULT([no])
2819])
2820AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, test x$solaris_xpg_symbols_present = xyes)
2821CFLAGS="$save_CFLAGS"
2822
2823
Elliott Hughesa0664b92017-04-18 17:46:52 -07002824# Solaris-specific check determining if gcc enables largefile support by
2825# default for 32-bit executables. If it does, then set SOLARIS_UNDEF_LARGESOURCE
2826# variable with gcc flags which disable it.
2827#
2828AC_MSG_CHECKING([if gcc enables largefile support for 32-bit apps (Solaris-specific)])
2829save_CFLAGS="$CFLAGS"
2830CFLAGS="$CFLAGS -m32"
2831AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2832 return _LARGEFILE_SOURCE;
2833]])], [
2834SOLARIS_UNDEF_LARGESOURCE="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
2835AC_MSG_RESULT([yes])
2836], [
2837SOLARIS_UNDEF_LARGESOURCE=""
2838AC_MSG_RESULT([no])
2839])
2840CFLAGS=$safe_CFLAGS
2841AC_SUBST(SOLARIS_UNDEF_LARGESOURCE)
2842
2843
iraisr23e68ca2015-08-14 20:50:11 +00002844# Solaris-specific check determining if /proc/self/cmdline
2845# or /proc/<pid>/cmdline is supported.
2846#
2847# C-level symbol: SOLARIS_PROC_CMDLINE
2848# Automake-level symbol: SOLARIS_PROC_CMDLINE
2849#
2850AC_CHECK_FILE([/proc/self/cmdline],
2851[
2852solaris_proc_cmdline=yes
2853AC_DEFINE([SOLARIS_PROC_CMDLINE], 1,
2854 [Define to 1 if you have /proc/self/cmdline.])
2855], [
2856solaris_proc_cmdline=no
2857])
2858AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, test x$solaris_proc_cmdline = xyes)
2859
2860
sewardj8eb8bab2015-07-21 14:44:28 +00002861# Solaris-specific check determining default platform for the Valgrind launcher.
2862# Used in case the launcher cannot select platform by looking at the client
2863# image (for example because the executable is a shell script).
2864#
2865# C-level symbol: SOLARIS_LAUNCHER_DEFAULT_PLATFORM
2866# Automake-level symbol: none
2867#
2868AC_MSG_CHECKING([for default platform of Valgrind launcher (Solaris-specific)])
2869# Get the ELF class of /bin/sh first.
2870if ! test -f /bin/sh; then
2871 AC_MSG_ERROR([Shell interpreter `/bin/sh' not found.])
2872fi
2873elf_class=$( /usr/bin/file /bin/sh | sed -n 's/.*ELF \(..\)-bit.*/\1/p' )
2874case "$elf_class" in
2875 64)
2876 default_arch="$VGCONF_ARCH_PRI";
2877 ;;
2878 32)
2879 if test "x$VGCONF_ARCH_SEC" != "x"; then
2880 default_arch="$VGCONF_ARCH_SEC"
2881 else
2882 default_arch="$VGCONF_ARCH_PRI";
2883 fi
2884 ;;
2885 *)
2886 AC_MSG_ERROR([Cannot determine ELF class of `/bin/sh'.])
2887 ;;
2888esac
2889default_platform="$default_arch-$VGCONF_OS"
2890AC_MSG_RESULT([$default_platform])
2891AC_DEFINE_UNQUOTED([SOLARIS_LAUNCHER_DEFAULT_PLATFORM], ["$default_platform"],
2892 [Default platform for Valgrind launcher.])
2893
2894
2895# Solaris-specific check determining if the old syscalls are available.
2896#
2897# C-level symbol: SOLARIS_OLD_SYSCALLS
2898# Automake-level symbol: SOLARIS_OLD_SYSCALLS
2899#
2900AC_MSG_CHECKING([for the old Solaris syscalls (Solaris-specific)])
2901AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2902#include <sys/syscall.h>
2903]], [[
2904 return !SYS_open;
2905]])], [
2906solaris_old_syscalls=yes
2907AC_MSG_RESULT([yes])
2908AC_DEFINE([SOLARIS_OLD_SYSCALLS], 1,
2909 [Define to 1 if you have the old Solaris syscalls.])
2910], [
2911solaris_old_syscalls=no
2912AC_MSG_RESULT([no])
2913])
2914AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, test x$solaris_old_syscalls = xyes)
2915
2916
2917# Solaris-specific check determining if the new accept() syscall is available.
2918#
2919# Old syscall:
2920# int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2921# int version);
2922#
2923# New syscall (available on illumos):
2924# int accept(int sock, struct sockaddr *name, socklen_t *namelenp,
2925# int version, int flags);
2926#
2927# If the old syscall is present then the following syscall will fail with
2928# ENOTSOCK (because file descriptor 0 is not a socket), if the new syscall is
2929# available then it will fail with EINVAL (because the flags parameter is
2930# invalid).
2931#
2932# C-level symbol: SOLARIS_NEW_ACCEPT_SYSCALL
2933# Automake-level symbol: none
2934#
2935AC_MSG_CHECKING([for the new `accept' syscall (Solaris-specific)])
2936AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2937#include <sys/syscall.h>
2938#include <errno.h>
2939]], [[
2940 errno = 0;
2941 syscall(SYS_accept, 0, 0, 0, 0, -1);
2942 return !(errno == EINVAL);
2943]])], [
2944AC_MSG_RESULT([yes])
2945AC_DEFINE([SOLARIS_NEW_ACCEPT_SYSCALL], 1,
2946 [Define to 1 if you have the new `accept' syscall.])
2947], [
2948AC_MSG_RESULT([no])
2949])
2950
2951
2952# Solaris-specific check determining if the new illumos pipe() syscall is
2953# available.
2954#
2955# Old syscall:
2956# longlong_t pipe();
2957#
2958# New syscall (available on illumos):
2959# int pipe(intptr_t arg, int flags);
2960#
2961# If the old syscall is present then the following call will succeed, if the
2962# new syscall is available then it will fail with EFAULT (because address 0
2963# cannot be accessed).
2964#
2965# C-level symbol: SOLARIS_NEW_PIPE_SYSCALL
2966# Automake-level symbol: none
2967#
2968AC_MSG_CHECKING([for the new `pipe' syscall (Solaris-specific)])
2969AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2970#include <sys/syscall.h>
2971#include <errno.h>
2972]], [[
2973 errno = 0;
2974 syscall(SYS_pipe, 0, 0);
2975 return !(errno == EFAULT);
2976]])], [
2977AC_MSG_RESULT([yes])
2978AC_DEFINE([SOLARIS_NEW_PIPE_SYSCALL], 1,
2979 [Define to 1 if you have the new `pipe' syscall.])
2980], [
2981AC_MSG_RESULT([no])
2982])
2983
2984
2985# Solaris-specific check determining if the new lwp_sigqueue() syscall is
2986# available.
2987#
2988# Old syscall:
2989# int lwp_kill(id_t lwpid, int sig);
2990#
2991# New syscall (available on Solaris 11):
2992# int lwp_sigqueue(id_t lwpid, int sig, void *value,
2993# int si_code, timespec_t *timeout);
2994#
2995# C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
2996# Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL
2997#
2998AC_MSG_CHECKING([for the new `lwp_sigqueue' syscall (Solaris-specific)])
2999AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3000#include <sys/syscall.h>
3001]], [[
3002 return !SYS_lwp_sigqueue;
3003]])], [
3004solaris_lwp_sigqueue_syscall=yes
3005AC_MSG_RESULT([yes])
3006AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL], 1,
3007 [Define to 1 if you have the new `lwp_sigqueue' syscall.])
3008], [
3009solaris_lwp_sigqueue_syscall=no
3010AC_MSG_RESULT([no])
3011])
3012AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, test x$solaris_lwp_sigqueue_syscall = xyes)
3013
3014
3015# Solaris-specific check determining if the lwp_sigqueue() syscall
3016# takes both pid and thread id arguments or just thread id.
3017#
3018# Old syscall (available on Solaris 11.x):
3019# int lwp_sigqueue(id_t lwpid, int sig, void *value,
3020# int si_code, timespec_t *timeout);
3021#
3022# New syscall (available on Solaris 12):
3023# int lwp_sigqueue(pid_t pid, id_t lwpid, int sig, void *value,
3024# int si_code, timespec_t *timeout);
3025#
3026# If the old syscall is present then the following syscall will fail with
3027# EINVAL (because signal is out of range); if the new syscall is available
3028# then it will fail with ESRCH (because it would not find such thread in the
3029# current process).
3030#
3031# C-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3032# Automake-level symbol: SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
3033#
3034AM_COND_IF(SOLARIS_LWP_SIGQUEUE_SYSCALL,
3035AC_MSG_CHECKING([if the `lwp_sigqueue' syscall accepts pid (Solaris-specific)])
3036AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3037#include <sys/syscall.h>
3038#include <errno.h>
3039]], [[
3040 errno = 0;
3041 syscall(SYS_lwp_sigqueue, 0, 101, 0, 0, 0, 0);
3042 return !(errno == ESRCH);
3043]])], [
3044solaris_lwp_sigqueue_syscall_takes_pid=yes
3045AC_MSG_RESULT([yes])
3046AC_DEFINE([SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID], 1,
3047 [Define to 1 if you have the new `lwp_sigqueue' syscall which accepts pid.])
3048], [
3049solaris_lwp_sigqueue_syscall_takes_pid=no
3050AC_MSG_RESULT([no])
3051])
3052AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID,
3053 test x$solaris_lwp_sigqueue_syscall_takes_pid = xyes)
3054,
3055AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, test x = y)
3056)
3057
3058
3059# Solaris-specific check determining if the new lwp_name() syscall is
3060# available.
3061#
3062# New syscall (available on Solaris 11):
3063# int lwp_name(int opcode, id_t lwpid, char *name, size_t len);
3064#
3065# C-level symbol: SOLARIS_LWP_NAME_SYSCALL
3066# Automake-level symbol: SOLARIS_LWP_NAME_SYSCALL
3067#
3068AC_MSG_CHECKING([for the new `lwp_name' syscall (Solaris-specific)])
3069AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3070#include <sys/syscall.h>
3071]], [[
3072 return !SYS_lwp_name;
3073]])], [
3074solaris_lwp_name_syscall=yes
3075AC_MSG_RESULT([yes])
3076AC_DEFINE([SOLARIS_LWP_NAME_SYSCALL], 1,
3077 [Define to 1 if you have the new `lwp_name' syscall.])
3078], [
3079solaris_lwp_name_syscall=no
3080AC_MSG_RESULT([no])
3081])
3082AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, test x$solaris_lwp_name_syscall = xyes)
3083
3084
Elliott Hughesa0664b92017-04-18 17:46:52 -07003085# Solaris-specific check determining if the new getrandom() syscall is
3086# available.
3087#
3088# New syscall (available on Solaris 11):
3089# int getrandom(void *buf, size_t buflen, uint_t flags);
3090#
3091# C-level symbol: SOLARIS_GETRANDOM_SYSCALL
3092# Automake-level symbol: SOLARIS_GETRANDOM_SYSCALL
3093#
3094AC_MSG_CHECKING([for the new `getrandom' syscall (Solaris-specific)])
3095AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3096#include <sys/syscall.h>
3097]], [[
3098 return !SYS_getrandom;
3099]])], [
3100solaris_getrandom_syscall=yes
3101AC_MSG_RESULT([yes])
3102AC_DEFINE([SOLARIS_GETRANDOM_SYSCALL], 1,
3103 [Define to 1 if you have the new `getrandom' syscall.])
3104], [
3105solaris_getrandom_syscall=no
3106AC_MSG_RESULT([no])
3107])
3108AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, test x$solaris_getrandom_syscall = xyes)
3109
3110
sewardj8eb8bab2015-07-21 14:44:28 +00003111# Solaris-specific check determining if the new zone() syscall subcodes
3112# ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT are available. These subcodes
3113# were added in Solaris 11 but are missing on illumos.
3114#
3115# C-level symbol: SOLARIS_ZONE_DEFUNCT
3116# Automake-level symbol: SOLARIS_ZONE_DEFUNCT
3117#
3118AC_MSG_CHECKING([for ZONE_LIST_DEFUNCT and ZONE_GETATTR_DEFUNCT (Solaris-specific)])
3119AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3120#include <sys/zone.h>
3121]], [[
3122 return !(ZONE_LIST_DEFUNCT && ZONE_GETATTR_DEFUNCT);
3123]])], [
3124solaris_zone_defunct=yes
3125AC_MSG_RESULT([yes])
3126AC_DEFINE([SOLARIS_ZONE_DEFUNCT], 1,
3127 [Define to 1 if you have the `ZONE_LIST_DEFUNCT' and `ZONE_GETATTR_DEFUNC' constants.])
3128], [
3129solaris_zone_defunct=no
3130AC_MSG_RESULT([no])
3131])
3132AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, test x$solaris_zone_defunct = xyes)
3133
3134
Elliott Hughesa0664b92017-04-18 17:46:52 -07003135# Solaris-specific check determining if commands A_GETSTAT and A_SETSTAT
3136# for auditon(2) subcode of the auditsys() syscall are available.
3137# These commands are available in Solaris 11 and illumos but were removed
3138# in Solaris 12.
3139#
3140# C-level symbol: SOLARIS_AUDITON_STAT
3141# Automake-level symbol: SOLARIS_AUDITON_STAT
3142#
3143AC_MSG_CHECKING([for A_GETSTAT and A_SETSTAT auditon(2) commands (Solaris-specific)])
3144AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3145#include <bsm/audit.h>
3146]], [[
3147 return !(A_GETSTAT && A_SETSTAT);
3148]])], [
3149solaris_auditon_stat=yes
3150AC_MSG_RESULT([yes])
3151AC_DEFINE([SOLARIS_AUDITON_STAT], 1,
3152 [Define to 1 if you have the `A_GETSTAT' and `A_SETSTAT' constants.])
3153], [
3154solaris_auditon_stat=no
3155AC_MSG_RESULT([no])
3156])
3157AM_CONDITIONAL(SOLARIS_AUDITON_STAT, test x$solaris_auditon_stat = xyes)
3158
3159
sewardj8eb8bab2015-07-21 14:44:28 +00003160# Solaris-specific check determining if the new shmsys() syscall subcodes
3161# IPC_XSTAT64, SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM are available.
3162# These subcodes were added in Solaris 11 but are missing on illumos.
3163#
3164# C-level symbol: SOLARIS_SHM_NEW
3165# Automake-level symbol: SOLARIS_SHM_NEW
3166#
3167AC_MSG_CHECKING([for SHMADV, SHM_ADV_GET, SHM_ADV_SET and SHMGET_OSM (Solaris-specific)])
3168AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3169#include <sys/ipc_impl.h>
3170#include <sys/shm.h>
3171#include <sys/shm_impl.h>
3172]], [[
3173 return !(IPC_XSTAT64 && SHMADV && SHM_ADV_GET && SHM_ADV_SET && SHMGET_OSM);
3174]])], [
3175solaris_shm_new=yes
3176AC_MSG_RESULT([yes])
3177AC_DEFINE([SOLARIS_SHM_NEW], 1,
3178 [Define to 1 if you have the `IPC_XSTAT64', `SHMADV', `SHM_ADV_GET', `SHM_ADV_SET' and `SHMGET_OSM' constants.])
3179], [
3180solaris_shm_new=no
3181AC_MSG_RESULT([no])
3182])
3183AM_CONDITIONAL(SOLARIS_SHM_NEW, test x$solaris_shm_new = xyes)
3184
3185
3186# Solaris-specific check determining if prxregset_t is available. Illumos
3187# currently does not define it on the x86 platform.
3188#
3189# C-level symbol: SOLARIS_PRXREGSET_T
3190# Automake-level symbol: SOLARIS_PRXREGSET_T
3191#
3192AC_MSG_CHECKING([for the `prxregset_t' type (Solaris-specific)])
3193AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3194#include <sys/procfs_isa.h>
3195]], [[
3196 return !sizeof(prxregset_t);
3197]])], [
3198solaris_prxregset_t=yes
3199AC_MSG_RESULT([yes])
3200AC_DEFINE([SOLARIS_PRXREGSET_T], 1,
3201 [Define to 1 if you have the `prxregset_t' type.])
3202], [
3203solaris_prxregset_t=no
3204AC_MSG_RESULT([no])
3205])
3206AM_CONDITIONAL(SOLARIS_PRXREGSET_T, test x$solaris_prxregset_t = xyes)
3207
3208
3209# Solaris-specific check determining if the new frealpathat() syscall is
3210# available.
3211#
3212# New syscall (available on Solaris 11.1):
3213# int frealpathat(int fd, char *path, char *buf, size_t buflen);
3214#
3215# C-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3216# Automake-level symbol: SOLARIS_FREALPATHAT_SYSCALL
3217#
3218AC_MSG_CHECKING([for the new `frealpathat' syscall (Solaris-specific)])
3219AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3220#include <sys/syscall.h>
3221]], [[
3222 return !SYS_frealpathat;
3223]])], [
3224solaris_frealpathat_syscall=yes
3225AC_MSG_RESULT([yes])
3226AC_DEFINE([SOLARIS_FREALPATHAT_SYSCALL], 1,
3227 [Define to 1 if you have the new `frealpathat' syscall.])
3228], [
3229solaris_frealpathat_syscall=no
3230AC_MSG_RESULT([no])
3231])
3232AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, test x$solaris_frealpathat_syscall = xyes)
3233
3234
3235# Solaris-specific check determining if the new uuidsys() syscall is
3236# available.
3237#
3238# New syscall (available on newer Solaris):
3239# int uuidsys(struct uuid *uuid);
3240#
3241# C-level symbol: SOLARIS_UUIDSYS_SYSCALL
3242# Automake-level symbol: SOLARIS_UUIDSYS_SYSCALL
3243#
3244AC_MSG_CHECKING([for the new `uuidsys' syscall (Solaris-specific)])
3245AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3246#include <sys/syscall.h>
3247]], [[
3248 return !SYS_uuidsys;
3249]])], [
3250solaris_uuidsys_syscall=yes
3251AC_MSG_RESULT([yes])
3252AC_DEFINE([SOLARIS_UUIDSYS_SYSCALL], 1,
3253 [Define to 1 if you have the new `uuidsys' syscall.])
3254], [
3255solaris_uuidsys_syscall=no
3256AC_MSG_RESULT([no])
3257])
3258AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, test x$solaris_uuidsys_syscall = xyes)
3259
3260
3261# Solaris-specific check determining if the new labelsys() syscall subcode
3262# TNDB_GET_TNIP is available. This subcode was added in Solaris 11 but is
3263# missing on illumos.
3264#
3265# C-level symbol: SOLARIS_TNDB_GET_TNIP
3266# Automake-level symbol: SOLARIS_TNDB_GET_TNIP
3267#
3268AC_MSG_CHECKING([for TNDB_GET_TNIP (Solaris-specific)])
3269AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3270#include <sys/tsol/tndb.h>
3271]], [[
3272 return !TNDB_GET_TNIP;
3273]])], [
3274solaris_tndb_get_tnip=yes
3275AC_MSG_RESULT([yes])
3276AC_DEFINE([SOLARIS_TNDB_GET_TNIP], 1,
3277 [Define to 1 if you have the `TNDB_GET_TNIP' constant.])
3278], [
3279solaris_tndb_get_tnip=no
3280AC_MSG_RESULT([no])
3281])
3282AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, test x$solaris_tndb_get_tnip = xyes)
3283
3284
3285# Solaris-specific check determining if the new labelsys() syscall opcodes
3286# TSOL_GETCLEARANCE and TSOL_SETCLEARANCE are available. These opcodes were
3287# added in Solaris 11 but are missing on illumos.
3288#
3289# C-level symbol: SOLARIS_TSOL_CLEARANCE
3290# Automake-level symbol: SOLARIS_TSOL_CLEARANCE
3291#
3292AC_MSG_CHECKING([for TSOL_GETCLEARANCE and TSOL_SETCLEARANCE (Solaris-specific)])
3293AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3294#include <sys/tsol/tsyscall.h>
3295]], [[
3296 return !(TSOL_GETCLEARANCE && TSOL_SETCLEARANCE);
3297]])], [
3298solaris_tsol_clearance=yes
3299AC_MSG_RESULT([yes])
3300AC_DEFINE([SOLARIS_TSOL_CLEARANCE], 1,
3301 [Define to 1 if you have the `TSOL_GETCLEARANCE' and `TSOL_SETCLEARANCE' constants.])
3302], [
3303solaris_tsol_clearance=no
3304AC_MSG_RESULT([no])
3305])
3306AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, test x$solaris_tsol_clearance = xyes)
3307
3308
iraisr7d4aa192015-10-12 19:10:42 +00003309# Solaris-specific check determining if the new pset() syscall subcode
3310# PSET_GET_NAME is available. This subcode was added in Solaris 12 but
3311# is missing on illumos and Solaris 11.
3312#
3313# C-level symbol: SOLARIS_PSET_GET_NAME
3314# Automake-level symbol: SOLARIS_PSET_GET_NAME
3315#
3316AC_MSG_CHECKING([for PSET_GET_NAME (Solaris-specific)])
3317AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3318#include <sys/pset.h>
3319]], [[
3320 return !(PSET_GET_NAME);
3321]])], [
3322solaris_pset_get_name=yes
3323AC_MSG_RESULT([yes])
3324AC_DEFINE([SOLARIS_PSET_GET_NAME], 1,
3325 [Define to 1 if you have the `PSET_GET_NAME' constants.])
3326], [
3327solaris_pset_get_name=no
3328AC_MSG_RESULT([no])
3329])
3330AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, test x$solaris_pset_get_name = xyes)
3331
3332
sewardj8eb8bab2015-07-21 14:44:28 +00003333# Solaris-specific check determining if the utimesys() syscall is
3334# available (on illumos and older Solaris).
3335#
3336# C-level symbol: SOLARIS_UTIMESYS_SYSCALL
3337# Automake-level symbol: SOLARIS_UTIMESYS_SYSCALL
3338#
3339AC_MSG_CHECKING([for the `utimesys' syscall (Solaris-specific)])
3340AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3341#include <sys/syscall.h>
3342]], [[
3343 return !SYS_utimesys;
3344]])], [
3345solaris_utimesys_syscall=yes
3346AC_MSG_RESULT([yes])
3347AC_DEFINE([SOLARIS_UTIMESYS_SYSCALL], 1,
3348 [Define to 1 if you have the `utimesys' syscall.])
3349], [
3350solaris_utimesys_syscall=no
3351AC_MSG_RESULT([no])
3352])
3353AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, test x$solaris_utimesys_syscall = xyes)
3354
3355
3356# Solaris-specific check determining if the utimensat() syscall is
3357# available (on newer Solaris).
3358#
3359# C-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3360# Automake-level symbol: SOLARIS_UTIMENSAT_SYSCALL
3361#
3362AC_MSG_CHECKING([for the `utimensat' syscall (Solaris-specific)])
3363AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3364#include <sys/syscall.h>
3365]], [[
3366 return !SYS_utimensat;
3367]])], [
3368solaris_utimensat_syscall=yes
3369AC_MSG_RESULT([yes])
3370AC_DEFINE([SOLARIS_UTIMENSAT_SYSCALL], 1,
3371 [Define to 1 if you have the `utimensat' syscall.])
3372], [
3373solaris_utimensat_syscall=no
3374AC_MSG_RESULT([no])
3375])
3376AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, test x$solaris_utimensat_syscall = xyes)
3377
3378
3379# Solaris-specific check determining if the spawn() syscall is available
3380# (on newer Solaris).
3381#
3382# C-level symbol: SOLARIS_SPAWN_SYSCALL
3383# Automake-level symbol: SOLARIS_SPAWN_SYSCALL
3384#
3385AC_MSG_CHECKING([for the `spawn' syscall (Solaris-specific)])
3386AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3387#include <sys/syscall.h>
3388]], [[
3389 return !SYS_spawn;
3390]])], [
3391solaris_spawn_syscall=yes
3392AC_MSG_RESULT([yes])
3393AC_DEFINE([SOLARIS_SPAWN_SYSCALL], 1,
3394 [Define to 1 if you have the `spawn' syscall.])
3395], [
3396solaris_spawn_syscall=no
3397AC_MSG_RESULT([no])
3398])
3399AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
3400
3401
Elliott Hughesa0664b92017-04-18 17:46:52 -07003402# Solaris-specific check determining if commands MODNVL_CTRLMAP through
3403# MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
3404#
3405# C-level symbol: SOLARIS_MODCTL_MODNVL
3406# Automake-level symbol: SOLARIS_MODCTL_MODNVL
3407#
3408AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
3409AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3410#include <sys/modctl.h>
3411]], [[
3412 return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
3413]])], [
3414solaris_modctl_modnvl=yes
3415AC_MSG_RESULT([yes])
3416AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
3417 [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
3418], [
3419solaris_modctl_modnvl=no
3420AC_MSG_RESULT([no])
3421])
3422AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
3423
3424
sewardj8eb8bab2015-07-21 14:44:28 +00003425# Solaris-specific check determining whether nscd (name switch cache daemon)
3426# attaches its door at /system/volatile/name_service_door (Solaris)
3427# or at /var/run/name_service_door (illumos).
3428#
3429# Note that /var/run is a symlink to /system/volatile on Solaris
3430# but not vice versa on illumos.
3431#
3432# C-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3433# Automake-level symbol: SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE
3434#
3435AC_MSG_CHECKING([for nscd door location (Solaris-specific)])
3436if test -e /system/volatile/name_service_door; then
3437 solaris_nscd_door_system_volatile=yes
3438 AC_MSG_RESULT([/system/volatile/name_service_door])
3439 AC_DEFINE([SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE], 1,
3440 [Define to 1 if nscd attaches to /system/volatile/name_service_door.])
3441else
3442 solaris_nscd_door_system_volatile=no
3443 AC_MSG_RESULT([/var/run/name_service_door])
3444fi
3445AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, test x$solaris_nscd_door_system_volatile = xyes)
3446
3447
3448# Solaris-specific check determining if the new gethrt() fasttrap is available.
3449#
3450# New fasttrap (available on Solaris 11):
3451# hrt_t *gethrt(void);
3452#
3453# C-level symbol: SOLARIS_GETHRT_FASTTRAP
3454# Automake-level symbol: SOLARIS_GETHRT_FASTTRAP
3455#
3456AC_MSG_CHECKING([for the new `gethrt' fasttrap (Solaris-specific)])
3457AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3458#include <sys/trap.h>
3459]], [[
3460 return !T_GETHRT;
3461]])], [
3462solaris_gethrt_fasttrap=yes
3463AC_MSG_RESULT([yes])
3464AC_DEFINE([SOLARIS_GETHRT_FASTTRAP], 1,
3465 [Define to 1 if you have the new `gethrt' fasttrap.])
3466], [
3467solaris_gethrt_fasttrap=no
3468AC_MSG_RESULT([no])
3469])
3470AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, test x$solaris_gethrt_fasttrap = xyes)
3471
3472
3473# Solaris-specific check determining if the new get_zone_offset() fasttrap
3474# is available.
3475#
3476# New fasttrap (available on Solaris 11):
3477# zonehrtoffset_t *get_zone_offset(void);
3478#
3479# C-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3480# Automake-level symbol: SOLARIS_GETZONEOFFSET_FASTTRAP
3481#
3482AC_MSG_CHECKING([for the new `get_zone_offset' fasttrap (Solaris-specific)])
3483AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3484#include <sys/trap.h>
3485]], [[
3486 return !T_GETZONEOFFSET;
3487]])], [
3488solaris_getzoneoffset_fasttrap=yes
3489AC_MSG_RESULT([yes])
3490AC_DEFINE([SOLARIS_GETZONEOFFSET_FASTTRAP], 1,
3491 [Define to 1 if you have the new `get_zone_offset' fasttrap.])
3492], [
3493solaris_getzoneoffset_fasttrap=no
3494AC_MSG_RESULT([no])
3495])
3496AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, test x$solaris_getzoneoffset_fasttrap = xyes)
3497
3498
3499# Solaris-specific check determining if the execve() syscall
3500# takes fourth argument (flags) or not.
3501#
3502# Old syscall (available on illumos):
3503# int execve(const char *fname, const char **argv, const char **envp);
3504#
3505# New syscall (available on Solaris):
3506# int execve(uintptr_t file, const char **argv, const char **envp, int flags);
3507#
3508# If the new syscall is present then it will fail with EINVAL (because flags
3509# are invalid); if the old syscall is available then it will fail with ENOENT
3510# (because the file could not be found).
3511#
3512# C-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3513# Automake-level symbol: SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS
3514#
3515AC_MSG_CHECKING([if the `execve' syscall accepts flags (Solaris-specific)])
3516AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3517#include <sys/syscall.h>
3518#include <errno.h>
3519]], [[
3520 errno = 0;
3521 syscall(SYS_execve, "/no/existing/path", 0, 0, 0xdeadbeef, 0, 0);
3522 return !(errno == EINVAL);
3523]])], [
3524solaris_execve_syscall_takes_flags=yes
3525AC_MSG_RESULT([yes])
3526AC_DEFINE([SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS], 1,
3527 [Define to 1 if you have the new `execve' syscall which accepts flags.])
3528], [
3529solaris_execve_syscall_takes_flags=no
3530AC_MSG_RESULT([no])
3531])
3532AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS,
3533 test x$solaris_execve_syscall_takes_flags = xyes)
3534
3535
3536# Solaris-specific check determining version of the repository cache protocol.
3537# Every Solaris version uses a different one, ranging from 21 to current 25.
3538# The check is very ugly, though.
3539#
3540# C-level symbol: SOLARIS_REPCACHE_PROTOCOL_VERSION vv
3541# Automake-level symbol: none
3542#
3543AC_PATH_PROG(DIS_PATH, dis, false)
3544if test "x$DIS_PATH" = "xfalse"; then
3545 AC_MSG_FAILURE([Object code disassembler (`dis') not found.])
3546fi
3547AC_CHECK_LIB(scf, scf_handle_bind, [], [
3548 AC_MSG_WARN([Function `scf_handle_bind' was not found in `libscf'.])
3549 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3550])
3551
3552AC_MSG_CHECKING([for version of the repository cache protocol (Solaris-specific)])
3553if test "X$VGCONF_ARCH_PRI" = "Xamd64"; then
3554 libscf=/usr/lib/64/libscf.so.1
3555else
3556 libscf=/usr/lib/libscf.so.1
3557fi
3558if ! $DIS_PATH -F scf_handle_bind $libscf | grep -q 0x526570; then
3559 AC_MSG_WARN([Function `scf_handle_bind' does not contain repository cache protocol version.])
3560 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3561fi
3562hex=$( $DIS_PATH -F scf_handle_bind $libscf | sed -n 's/.*0x526570\(..\).*/\1/p' )
3563if test -z "$hex"; then
3564 AC_MSG_WARN([Version of the repository cache protocol is empty?!])
3565 AC_MSG_ERROR([Cannot determine version of the repository cache protocol.])
3566fi
3567version=$( printf "%d\n" 0x$hex )
3568AC_MSG_RESULT([$version])
3569AC_DEFINE_UNQUOTED([SOLARIS_REPCACHE_PROTOCOL_VERSION], [$version],
3570 [Version number of the repository door cache protocol.])
3571
iraisrfa0a7f42015-08-01 21:53:08 +00003572
3573# Solaris-specific check determining if "sysstat" segment reservation type
3574# is available.
3575#
3576# New "sysstat" segment reservation (available on Solaris 12):
3577# - program header type: PT_SUNW_SYSSTAT
3578# - auxiliary vector entry: AT_SUN_SYSSTAT_ADDR
3579#
3580# C-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3581# Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ADDR
3582#
3583AC_MSG_CHECKING([for the new `sysstat' segment reservation (Solaris-specific)])
3584AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3585#include <sys/auxv.h>
3586]], [[
3587 return !AT_SUN_SYSSTAT_ADDR;
3588]])], [
3589solaris_reserve_sysstat_addr=yes
3590AC_MSG_RESULT([yes])
3591AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ADDR], 1,
3592 [Define to 1 if you have the new `sysstat' segment reservation.])
3593], [
3594solaris_reserve_sysstat_addr=no
3595AC_MSG_RESULT([no])
3596])
3597AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, test x$solaris_reserve_sysstat_addr = xyes)
3598
3599
3600# Solaris-specific check determining if "sysstat_zone" segment reservation type
3601# is available.
3602#
3603# New "sysstat_zone" segment reservation (available on Solaris 12):
3604# - program header type: PT_SUNW_SYSSTAT_ZONE
3605# - auxiliary vector entry: AT_SUN_SYSSTAT_ZONE_ADDR
3606#
3607# C-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3608# Automake-level symbol: SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR
3609#
3610AC_MSG_CHECKING([for the new `sysstat_zone' segment reservation (Solaris-specific)])
3611AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3612#include <sys/auxv.h>
3613]], [[
3614 return !AT_SUN_SYSSTAT_ZONE_ADDR;
3615]])], [
3616solaris_reserve_sysstat_zone_addr=yes
3617AC_MSG_RESULT([yes])
3618AC_DEFINE([SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR], 1,
3619 [Define to 1 if you have the new `sysstat_zone' segment reservation.])
3620], [
3621solaris_reserve_sysstat_zone_addr=no
3622AC_MSG_RESULT([no])
3623])
3624AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, test x$solaris_reserve_sysstat_zone_addr = xyes)
3625
iraisrc0d46cd2015-09-25 21:04:45 +00003626
3627# Solaris-specific check determining if the system_stats() syscall is available
3628# (on newer Solaris).
3629#
3630# C-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3631# Automake-level symbol: SOLARIS_SYSTEM_STATS_SYSCALL
3632#
3633AC_MSG_CHECKING([for the `system_stats' syscall (Solaris-specific)])
3634AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3635#include <sys/syscall.h>
3636]], [[
3637 return !SYS_system_stats;
3638]])], [
3639solaris_system_stats_syscall=yes
3640AC_MSG_RESULT([yes])
3641AC_DEFINE([SOLARIS_SYSTEM_STATS_SYSCALL], 1,
3642 [Define to 1 if you have the `system_stats' syscall.])
3643], [
3644solaris_system_stats_syscall=no
3645AC_MSG_RESULT([no])
3646])
3647AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, test x$solaris_system_stats_syscall = xyes)
3648
Elliott Hughesa0664b92017-04-18 17:46:52 -07003649
3650# Solaris-specific check determining if fpregset_t defines struct _fpchip_state
3651# (on newer illumos) or struct fpchip_state (Solaris, older illumos).
3652#
3653# C-level symbol: SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE
3654# Automake-level symbol: none
3655#
3656AC_CHECK_TYPE([struct _fpchip_state],
3657 [solaris_fpchip_state_takes_underscore=yes],
3658 [solaris_fpchip_state_takes_underscore=no],
3659 [[#include <sys/regset.h>]])
3660if test "$solaris_fpchip_state_takes_underscore" = "yes"; then
3661 AC_DEFINE(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE, 1,
3662 [Define to 1 if fpregset_t defines struct _fpchip_state])
3663fi
3664
3665
3666# Solaris-specific check determining if schedctl page shared between kernel
3667# and userspace program is executable (illumos, older Solaris) or not (newer
3668# Solaris).
3669#
3670# C-level symbol: SOLARIS_SCHEDCTL_PAGE_EXEC
3671# Automake-level symbol: none
3672#
3673AC_MSG_CHECKING([if schedctl page is executable (Solaris-specific)])
3674AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3675#include <assert.h>
3676#include <fcntl.h>
3677#include <procfs.h>
3678#include <schedctl.h>
3679#include <stdio.h>
3680#include <unistd.h>
3681]], [[
3682 schedctl_t *scp = schedctl_init();
3683 if (scp == NULL)
3684 return 1;
3685
3686 int fd = open("/proc/self/map", O_RDONLY);
3687 assert(fd >= 0);
3688
3689 prmap_t map;
3690 ssize_t rd;
3691 while ((rd = read(fd, &map, sizeof(map))) == sizeof(map)) {
3692 if (map.pr_vaddr == ((uintptr_t) scp & PAGEMASK)) {
3693 fprintf(stderr, "%#lx [%zu] %s\n", map.pr_vaddr, map.pr_size,
3694 (map.pr_mflags & MA_EXEC) ? "x" : "no-x");
3695 return (map.pr_mflags & MA_EXEC);
3696 }
3697 }
3698
3699 return 1;
3700]])], [
3701solaris_schedctl_page_exec=no
3702AC_MSG_RESULT([no])
3703], [
3704solaris_schedctl_page_exec=yes
3705AC_MSG_RESULT([yes])
3706AC_DEFINE([SOLARIS_SCHEDCTL_PAGE_EXEC], 1,
3707 [Define to 1 if you have the schedctl page executable.])
3708])
3709
3710
3711# Solaris-specific check determining if PT_SUNWDTRACE program header provides
3712# scratch space for DTrace fasttrap provider (illumos, older Solaris) or just
3713# an initial thread pointer for libc (newer Solaris).
3714#
3715# C-level symbol: SOLARIS_PT_SUNDWTRACE_THRP
3716# Automake-level symbol: none
3717#
3718AC_MSG_CHECKING([if PT_SUNWDTRACE serves for initial thread pointer (Solaris-specific)])
3719AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3720#include <sys/fasttrap_isa.h>
3721]], [[
3722 return !FT_SCRATCHSIZE;
3723]])], [
3724solaris_pt_sunwdtrace_thrp=yes
3725AC_MSG_RESULT([yes])
3726AC_DEFINE([SOLARIS_PT_SUNDWTRACE_THRP], 1,
3727 [Define to 1 if PT_SUNWDTRACE program header provides just an initial thread pointer for libc.])
3728], [
3729solaris_pt_sunwdtrace_thrp=no
3730AC_MSG_RESULT([no])
3731])
3732
sewardj8eb8bab2015-07-21 14:44:28 +00003733else
3734AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, false)
3735AM_CONDITIONAL(SOLARIS_XPG_SYMBOLS_PRESENT, false)
iraisr23e68ca2015-08-14 20:50:11 +00003736AM_CONDITIONAL(SOLARIS_PROC_CMDLINE, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003737AM_CONDITIONAL(SOLARIS_OLD_SYSCALLS, false)
3738AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL, false)
3739AM_CONDITIONAL(SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID, false)
3740AM_CONDITIONAL(SOLARIS_LWP_NAME_SYSCALL, false)
Elliott Hughesa0664b92017-04-18 17:46:52 -07003741AM_CONDITIONAL(SOLARIS_GETRANDOM_SYSCALL, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003742AM_CONDITIONAL(SOLARIS_ZONE_DEFUNCT, false)
Elliott Hughesa0664b92017-04-18 17:46:52 -07003743AM_CONDITIONAL(SOLARIS_AUDITON_STAT, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003744AM_CONDITIONAL(SOLARIS_SHM_NEW, false)
3745AM_CONDITIONAL(SOLARIS_PRXREGSET_T, false)
3746AM_CONDITIONAL(SOLARIS_FREALPATHAT_SYSCALL, false)
3747AM_CONDITIONAL(SOLARIS_UUIDSYS_SYSCALL, false)
3748AM_CONDITIONAL(SOLARIS_TNDB_GET_TNIP, false)
3749AM_CONDITIONAL(SOLARIS_TSOL_CLEARANCE, false)
iraisr7d4aa192015-10-12 19:10:42 +00003750AM_CONDITIONAL(SOLARIS_PSET_GET_NAME, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003751AM_CONDITIONAL(SOLARIS_UTIMESYS_SYSCALL, false)
3752AM_CONDITIONAL(SOLARIS_UTIMENSAT_SYSCALL, false)
3753AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, false)
Elliott Hughesa0664b92017-04-18 17:46:52 -07003754AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003755AM_CONDITIONAL(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE, false)
3756AM_CONDITIONAL(SOLARIS_GETHRT_FASTTRAP, false)
3757AM_CONDITIONAL(SOLARIS_GETZONEOFFSET_FASTTRAP, false)
3758AM_CONDITIONAL(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS, false)
iraisrfa0a7f42015-08-01 21:53:08 +00003759AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ADDR, false)
3760AM_CONDITIONAL(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR, false)
iraisrc0d46cd2015-09-25 21:04:45 +00003761AM_CONDITIONAL(SOLARIS_SYSTEM_STATS_SYSCALL, false)
sewardj8eb8bab2015-07-21 14:44:28 +00003762fi # test "$VGCONF_OS" = "solaris"
3763
3764
3765#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00003766# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00003767#----------------------------------------------------------------------------
3768
sewardjde4a1d02002-03-22 01:27:54 +00003769AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00003770AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00003771 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00003772 endian.h \
3773 mqueue.h \
3774 sys/endian.h \
3775 sys/epoll.h \
3776 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00003777 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00003778 sys/poll.h \
sewardj8eb8bab2015-07-21 14:44:28 +00003779 sys/prctl.h \
bart71bad292008-04-27 11:43:23 +00003780 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00003781 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00003782 sys/syscall.h \
Elliott Hughesa0664b92017-04-18 17:46:52 -07003783 sys/sysnvl.h \
bart71bad292008-04-27 11:43:23 +00003784 sys/time.h \
3785 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00003786 ])
sewardjde4a1d02002-03-22 01:27:54 +00003787
bart818f17e2011-09-17 06:24:49 +00003788# Verify whether the <linux/futex.h> header is usable.
3789AC_MSG_CHECKING([if <linux/futex.h> is usable])
3790
sewardjc12486b2012-12-17 14:46:48 +00003791save_CFLAGS="$CFLAGS"
3792CFLAGS="$CFLAGS -D__user="
bart417cf3e2011-10-22 09:21:24 +00003793AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart818f17e2011-09-17 06:24:49 +00003794#include <linux/futex.h>
bart417cf3e2011-10-22 09:21:24 +00003795]], [[
bart818f17e2011-09-17 06:24:49 +00003796 return FUTEX_WAIT;
bart417cf3e2011-10-22 09:21:24 +00003797]])], [
bart78bfc712011-12-08 16:14:59 +00003798ac_have_usable_linux_futex_h=yes
bart818f17e2011-09-17 06:24:49 +00003799AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
3800 [Define to 1 if you have a usable <linux/futex.h> header file.])
3801AC_MSG_RESULT([yes])
3802], [
bart78bfc712011-12-08 16:14:59 +00003803ac_have_usable_linux_futex_h=no
bart818f17e2011-09-17 06:24:49 +00003804AC_MSG_RESULT([no])
3805])
sewardjc12486b2012-12-17 14:46:48 +00003806CFLAGS="$save_CFLAGS"
3807
bart818f17e2011-09-17 06:24:49 +00003808
njn7fd6d382009-01-22 21:56:32 +00003809#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003810# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00003811#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003812AC_TYPE_UID_T
3813AC_TYPE_OFF_T
3814AC_TYPE_SIZE_T
3815AC_HEADER_TIME
3816
sewardj535c50f2005-06-04 23:14:53 +00003817
njn7fd6d382009-01-22 21:56:32 +00003818#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003819# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00003820#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00003821AC_FUNC_MEMCMP
3822AC_FUNC_MMAP
sewardjde4a1d02002-03-22 01:27:54 +00003823
bart26288e42011-04-03 16:46:01 +00003824AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00003825AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00003826
bartf5ceec82008-04-26 07:45:10 +00003827AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00003828 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00003829 epoll_create \
3830 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00003831 klogctl \
bartf5ceec82008-04-26 07:45:10 +00003832 mallinfo \
3833 memchr \
3834 memset \
3835 mkdir \
njnf76d27a2009-05-28 01:53:07 +00003836 mremap \
bartf5ceec82008-04-26 07:45:10 +00003837 ppoll \
bart6d45e922009-01-20 13:45:38 +00003838 pthread_barrier_init \
3839 pthread_condattr_setclock \
3840 pthread_mutex_timedlock \
3841 pthread_rwlock_timedrdlock \
3842 pthread_rwlock_timedwrlock \
3843 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00003844 pthread_yield \
florianc5325ef2013-09-17 20:15:36 +00003845 pthread_setname_np \
bartd1f724c2009-08-26 18:11:18 +00003846 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00003847 semtimedop \
3848 signalfd \
njn6cc22472009-03-16 03:46:48 +00003849 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00003850 strchr \
3851 strdup \
3852 strpbrk \
3853 strrchr \
3854 strstr \
barta72a27b2010-04-29 06:22:17 +00003855 syscall \
bartf5ceec82008-04-26 07:45:10 +00003856 utimensat \
tom9e4b6362012-02-10 09:39:37 +00003857 process_vm_readv \
3858 process_vm_writev \
bartf5ceec82008-04-26 07:45:10 +00003859 ])
sewardjde4a1d02002-03-22 01:27:54 +00003860
bart623eec32008-07-29 17:54:49 +00003861# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
3862# libraries with any shared object and/or executable. This is NOT what we
3863# want for e.g. vgpreload_core-x86-linux.so
3864LIBS=""
sewardj80637752006-03-02 13:48:21 +00003865
bart6d45e922009-01-20 13:45:38 +00003866AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
3867 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00003868AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
3869 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00003870AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
3871 [test x$ac_cv_func_pthread_spin_lock = xyes])
florianc5325ef2013-09-17 20:15:36 +00003872AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
3873 [test x$ac_cv_func_pthread_setname_np = xyes])
bart6d45e922009-01-20 13:45:38 +00003874
petarjc37cea62013-06-02 18:08:04 +00003875if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
3876 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
petarj6d79b742012-12-20 18:56:57 +00003877 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
petarjc37cea62013-06-02 18:08:04 +00003878 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
petarj6d79b742012-12-20 18:56:57 +00003879fi
njn7fd6d382009-01-22 21:56:32 +00003880
3881#----------------------------------------------------------------------------
3882# MPI checks
3883#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00003884# Do we have a useable MPI setup on the primary and/or secondary targets?
3885# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00003886# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00003887# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00003888# --with-mpicc=.
mjw46f25042014-08-21 10:04:04 +00003889AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
3890 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
sewardj03d86f22006-10-17 00:57:24 +00003891
sewardje9fa5062006-03-12 18:29:18 +00003892mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00003893if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00003894 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj5db15402012-06-07 09:13:21 +00003895 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +00003896 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +00003897 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
3898 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS ; then
sewardje9fa5062006-03-12 18:29:18 +00003899 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00003900elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00003901 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
sewardjf0c12502014-01-12 12:54:00 +00003902 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00003903 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00003904 mflag_primary=$FLAG_M64
philippef7c54332012-05-17 15:32:54 +00003905elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
3906 mflag_primary="$FLAG_M32 -arch i386"
3907elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
3908 mflag_primary="$FLAG_M64 -arch x86_64"
sewardje9fa5062006-03-12 18:29:18 +00003909fi
3910
sewardj03d86f22006-10-17 00:57:24 +00003911mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00003912if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
sewardj8eb8bab2015-07-21 14:44:28 +00003913 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
3914 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_SOLARIS ; then
sewardj03d86f22006-10-17 00:57:24 +00003915 mflag_secondary=$FLAG_M32
philippef7c54332012-05-17 15:32:54 +00003916elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
3917 mflag_secondary="$FLAG_M32 -arch i386"
sewardj03d86f22006-10-17 00:57:24 +00003918fi
3919
3920
sewardj0ad46092006-03-02 17:09:16 +00003921AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00003922 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00003923 MPI_CC=$withval
3924)
sewardj03d86f22006-10-17 00:57:24 +00003925AC_SUBST(MPI_CC)
3926
philippef7c54332012-05-17 15:32:54 +00003927## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
3928## use these values in the check for a functioning mpicc.
3929##
3930## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
3931## mflag_primary/mflag_secondary are sufficient approximations of that behavior
3932AM_COND_IF([VGCONF_OS_IS_LINUX],
3933 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3934 LDFLAGS_MPI="-fpic -shared"])
3935AM_COND_IF([VGCONF_OS_IS_DARWIN],
3936 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
3937 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
sewardj8eb8bab2015-07-21 14:44:28 +00003938AM_COND_IF([VGCONF_OS_IS_SOLARIS],
3939 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
3940 LDFLAGS_MPI="-fpic -shared"])
philippef7c54332012-05-17 15:32:54 +00003941
3942AC_SUBST([CFLAGS_MPI])
3943AC_SUBST([LDFLAGS_MPI])
3944
3945
sewardj03d86f22006-10-17 00:57:24 +00003946## See if MPI_CC works for the primary target
3947##
3948AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00003949saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00003950saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00003951CC=$MPI_CC
philippef7c54332012-05-17 15:32:54 +00003952CFLAGS="$CFLAGS_MPI $mflag_primary"
3953saved_LDFLAGS="$LDFLAGS"
3954LDFLAGS="$LDFLAGS_MPI $mflag_primary"
bart417cf3e2011-10-22 09:21:24 +00003955AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj1a85e602006-03-08 15:26:10 +00003956#include <mpi.h>
3957#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00003958]], [[
philippef7c54332012-05-17 15:32:54 +00003959 int ni, na, nd, comb;
sewardjde4f3842006-03-09 02:41:41 +00003960 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00003961 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
3962 r |= MPI_Finalize();
sewardjde4f3842006-03-09 02:41:41 +00003963 return r;
bart417cf3e2011-10-22 09:21:24 +00003964]])], [
sewardj03d86f22006-10-17 00:57:24 +00003965ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00003966AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00003967], [
sewardj03d86f22006-10-17 00:57:24 +00003968ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00003969AC_MSG_RESULT([no])
3970])
sewardj0ad46092006-03-02 17:09:16 +00003971CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00003972CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00003973LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00003974AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00003975
sewardj03d86f22006-10-17 00:57:24 +00003976## See if MPI_CC works for the secondary target. Complication: what if
3977## there is no secondary target? We need this to then fail.
3978## Kludge this by making MPI_CC something which will surely fail in
3979## such a case.
3980##
3981AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
3982saved_CC=$CC
3983saved_CFLAGS=$CFLAGS
philippef7c54332012-05-17 15:32:54 +00003984saved_LDFLAGS="$LDFLAGS"
3985LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
njn7fd6d382009-01-22 21:56:32 +00003986if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00003987 CC="$MPI_CC this will surely fail"
3988else
3989 CC=$MPI_CC
3990fi
philippef7c54332012-05-17 15:32:54 +00003991CFLAGS="$CFLAGS_MPI $mflag_secondary"
bart417cf3e2011-10-22 09:21:24 +00003992AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj03d86f22006-10-17 00:57:24 +00003993#include <mpi.h>
3994#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00003995]], [[
philippef7c54332012-05-17 15:32:54 +00003996 int ni, na, nd, comb;
sewardj03d86f22006-10-17 00:57:24 +00003997 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00003998 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
3999 r |= MPI_Finalize();
sewardj03d86f22006-10-17 00:57:24 +00004000 return r;
bart417cf3e2011-10-22 09:21:24 +00004001]])], [
sewardj03d86f22006-10-17 00:57:24 +00004002ac_have_mpi2_sec=yes
4003AC_MSG_RESULT([yes, $MPI_CC])
4004], [
4005ac_have_mpi2_sec=no
4006AC_MSG_RESULT([no])
4007])
4008CC=$saved_CC
4009CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00004010LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00004011AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00004012
4013
njn7fd6d382009-01-22 21:56:32 +00004014#----------------------------------------------------------------------------
4015# Other library checks
4016#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00004017# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00004018# tests are present because Drd has some regression tests that use
4019# these packages. All regression test programs all compiled only
4020# for the primary target. And so it is important that the configure
4021# checks that follow, use the correct -m32 or -m64 flag for the
4022# primary target (called $mflag_primary). Otherwise, we can end up
4023# in a situation (eg) where, on amd64-linux, the test for Boost checks
4024# for usable 64-bit Boost facilities, but because we are doing a 32-bit
4025# only build (meaning, the primary target is x86-linux), the build
4026# of the regtest programs that use Boost fails, because they are
4027# build as 32-bit (IN THIS EXAMPLE).
4028#
4029# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
4030# NEEDED BY THE REGRESSION TEST PROGRAMS.
4031
4032
sewardj493c4ef2008-12-13 16:45:19 +00004033# Check whether the boost library 1.35 or later has been installed.
4034# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
4035
4036AC_MSG_CHECKING([for boost])
4037
4038AC_LANG(C++)
4039safe_CXXFLAGS=$CXXFLAGS
bart7129c722012-04-18 18:34:22 +00004040CXXFLAGS="$mflag_primary"
4041safe_LIBS="$LIBS"
bartce93f9e2014-06-12 07:45:23 +00004042LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00004043
bart128fc522011-03-12 10:36:35 +00004044AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00004045#include <boost/thread.hpp>
4046static void thread_func(void)
4047{ }
4048int main(int argc, char** argv)
4049{
4050 boost::thread t(thread_func);
4051 return 0;
4052}
bart128fc522011-03-12 10:36:35 +00004053])],
sewardj493c4ef2008-12-13 16:45:19 +00004054[
4055ac_have_boost_1_35=yes
4056AC_SUBST([BOOST_CFLAGS], [])
bartce93f9e2014-06-12 07:45:23 +00004057AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
sewardj493c4ef2008-12-13 16:45:19 +00004058AC_MSG_RESULT([yes])
4059], [
4060ac_have_boost_1_35=no
4061AC_MSG_RESULT([no])
4062])
4063
bart7129c722012-04-18 18:34:22 +00004064LIBS="$safe_LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00004065CXXFLAGS=$safe_CXXFLAGS
4066AC_LANG(C)
4067
4068AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
4069
4070
4071# does this compiler support -fopenmp, does it have the include file
4072# <omp.h> and does it have libgomp ?
4073
4074AC_MSG_CHECKING([for OpenMP])
4075
4076safe_CFLAGS=$CFLAGS
florian538cf302015-06-09 21:53:48 +00004077CFLAGS="-fopenmp $mflag_primary -Werror"
sewardj493c4ef2008-12-13 16:45:19 +00004078
bart128fc522011-03-12 10:36:35 +00004079AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00004080#include <omp.h>
4081int main(int argc, char** argv)
4082{
4083 omp_set_dynamic(0);
4084 return 0;
4085}
bart128fc522011-03-12 10:36:35 +00004086])],
sewardj493c4ef2008-12-13 16:45:19 +00004087[
4088ac_have_openmp=yes
4089AC_MSG_RESULT([yes])
4090], [
4091ac_have_openmp=no
4092AC_MSG_RESULT([no])
4093])
4094CFLAGS=$safe_CFLAGS
4095
4096AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
4097
4098
florian60637d22014-10-29 08:21:18 +00004099# Check for __builtin_popcount
4100AC_MSG_CHECKING([for __builtin_popcount()])
4101AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4102]], [[
4103 __builtin_popcount(2);
4104 return 0;
4105]])], [
4106AC_MSG_RESULT([yes])
4107AC_DEFINE([HAVE_BUILTIN_POPCOUT], 1,
4108 [Define to 1 if compiler provides __builtin_popcount().])
4109], [
4110AC_MSG_RESULT([no])
4111])
4112
4113# Check for __builtin_clz
4114AC_MSG_CHECKING([for __builtin_clz()])
4115AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4116]], [[
4117 __builtin_clz(2);
4118 return 0;
4119]])], [
4120AC_MSG_RESULT([yes])
4121AC_DEFINE([HAVE_BUILTIN_CLZ], 1,
4122 [Define to 1 if compiler provides __builtin_clz().])
4123], [
4124AC_MSG_RESULT([no])
4125])
4126
4127# Check for __builtin_ctz
4128AC_MSG_CHECKING([for __builtin_ctz()])
4129AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4130]], [[
4131 __builtin_ctz(2);
4132 return 0;
4133]])], [
4134AC_MSG_RESULT([yes])
4135AC_DEFINE([HAVE_BUILTIN_CTZ], 1,
4136 [Define to 1 if compiler provides __builtin_ctz().])
4137], [
4138AC_MSG_RESULT([no])
4139])
4140
bart78bfc712011-12-08 16:14:59 +00004141# does this compiler have built-in functions for atomic memory access for the
4142# primary target ?
4143AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
sewardjc876a2f2009-01-22 22:44:30 +00004144
4145safe_CFLAGS=$CFLAGS
4146CFLAGS="$mflag_primary"
4147
bart417cf3e2011-10-22 09:21:24 +00004148AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjc876a2f2009-01-22 22:44:30 +00004149 int variable = 1;
4150 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4151 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00004152]])], [
bartb4ff7822011-12-10 19:48:04 +00004153 ac_have_builtin_atomic_primary=yes
sewardjc876a2f2009-01-22 22:44:30 +00004154 AC_MSG_RESULT([yes])
bart78bfc712011-12-08 16:14:59 +00004155 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 +00004156], [
bartb4ff7822011-12-10 19:48:04 +00004157 ac_have_builtin_atomic_primary=no
sewardjc876a2f2009-01-22 22:44:30 +00004158 AC_MSG_RESULT([no])
4159])
4160
4161CFLAGS=$safe_CFLAGS
4162
bartb4ff7822011-12-10 19:48:04 +00004163AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
4164 [test x$ac_have_builtin_atomic_primary = xyes])
bartc82d1372009-05-31 16:21:23 +00004165
bart78bfc712011-12-08 16:14:59 +00004166
4167# does this compiler have built-in functions for atomic memory access for the
4168# secondary target ?
4169
4170if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4171
4172AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
4173
4174safe_CFLAGS=$CFLAGS
4175CFLAGS="$mflag_secondary"
4176
4177AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
4178 int variable = 1;
4179 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
4180]])], [
4181 ac_have_builtin_atomic_secondary=yes
4182 AC_MSG_RESULT([yes])
4183], [
4184 ac_have_builtin_atomic_secondary=no
4185 AC_MSG_RESULT([no])
4186])
4187
4188CFLAGS=$safe_CFLAGS
4189
4190fi
4191
4192AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
4193 [test x$ac_have_builtin_atomic_secondary = xyes])
4194
bart1e856ea2011-12-17 12:53:23 +00004195# does this compiler have built-in functions for atomic memory access on
4196# 64-bit integers for all targets ?
4197
4198AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
4199
4200AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4201 #include <stdint.h>
4202]], [[
4203 uint64_t variable = 1;
4204 return __sync_add_and_fetch(&variable, 1)
4205]])], [
4206 ac_have_builtin_atomic64_primary=yes
4207], [
4208 ac_have_builtin_atomic64_primary=no
4209])
4210
4211if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
4212
4213safe_CFLAGS=$CFLAGS
4214CFLAGS="$mflag_secondary"
4215
4216AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4217 #include <stdint.h>
4218]], [[
4219 uint64_t variable = 1;
4220 return __sync_add_and_fetch(&variable, 1)
4221]])], [
4222 ac_have_builtin_atomic64_secondary=yes
4223], [
4224 ac_have_builtin_atomic64_secondary=no
4225])
4226
4227CFLAGS=$safe_CFLAGS
4228
4229fi
4230
4231if test x$ac_have_builtin_atomic64_primary = xyes && \
4232 test x$VGCONF_PLATFORM_SEC_CAPS = x \
4233 -o x$ac_have_builtin_atomic64_secondary = xyes; then
4234 AC_MSG_RESULT([yes])
4235 ac_have_builtin_atomic64=yes
4236else
4237 AC_MSG_RESULT([no])
4238 ac_have_builtin_atomic64=no
4239fi
4240
4241AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
4242 [test x$ac_have_builtin_atomic64 = xyes])
4243
bart78bfc712011-12-08 16:14:59 +00004244
barte8740422011-03-24 20:27:54 +00004245# does g++ have built-in functions for atomic memory access ?
bart78bfc712011-12-08 16:14:59 +00004246AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
barte8740422011-03-24 20:27:54 +00004247
4248safe_CXXFLAGS=$CXXFLAGS
4249CXXFLAGS="$mflag_primary"
4250
4251AC_LANG_PUSH(C++)
bart417cf3e2011-10-22 09:21:24 +00004252AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
barte8740422011-03-24 20:27:54 +00004253 int variable = 1;
4254 return (__sync_bool_compare_and_swap(&variable, 1, 2)
4255 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00004256]])], [
barte8740422011-03-24 20:27:54 +00004257 ac_have_builtin_atomic_cxx=yes
4258 AC_MSG_RESULT([yes])
4259 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 +00004260], [
barte8740422011-03-24 20:27:54 +00004261 ac_have_builtin_atomic_cxx=no
4262 AC_MSG_RESULT([no])
4263])
4264AC_LANG_POP(C++)
4265
4266CXXFLAGS=$safe_CXXFLAGS
4267
4268AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00004269
bart78bfc712011-12-08 16:14:59 +00004270
4271if test x$ac_have_usable_linux_futex_h = xyes \
bartb4ff7822011-12-10 19:48:04 +00004272 -a x$ac_have_builtin_atomic_primary = xyes; then
bart78bfc712011-12-08 16:14:59 +00004273 ac_enable_linux_ticket_lock_primary=yes
4274fi
4275AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
4276 [test x$ac_enable_linux_ticket_lock_primary = xyes])
4277
4278if test x$VGCONF_PLATFORM_SEC_CAPS != x \
4279 -a x$ac_have_usable_linux_futex_h = xyes \
4280 -a x$ac_have_builtin_atomic_secondary = xyes; then
4281 ac_enable_linux_ticket_lock_secondary=yes
4282fi
4283AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
4284 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
4285
4286
bartf68af882011-12-10 19:42:05 +00004287# does libstdc++ support annotating shared pointers ?
4288AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
4289
floriand79b3bf2013-10-02 15:14:59 +00004290safe_CXXFLAGS=$CXXFLAGS
bartf68af882011-12-10 19:42:05 +00004291CXXFLAGS="-std=c++0x"
4292
4293AC_LANG_PUSH(C++)
4294AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4295 #include <memory>
4296]], [[
4297 std::shared_ptr<int> p
4298]])], [
4299 ac_have_shared_ptr=yes
4300], [
4301 ac_have_shared_ptr=no
4302])
4303if test x$ac_have_shared_ptr = xyes; then
4304 # If compilation of the program below fails because of a syntax error
4305 # triggered by substituting one of the annotation macros then that
4306 # means that libstdc++ supports these macros.
4307 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4308 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
4309 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
4310 #include <memory>
4311 ]], [[
4312 std::shared_ptr<int> p
4313 ]])], [
4314 ac_have_shared_pointer_annotation=no
4315 AC_MSG_RESULT([no])
4316 ], [
4317 ac_have_shared_pointer_annotation=yes
4318 AC_MSG_RESULT([yes])
4319 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
4320 [Define to 1 if libstd++ supports annotating shared pointers])
4321 ])
4322else
4323 ac_have_shared_pointer_annotation=no
4324 AC_MSG_RESULT([no])
4325fi
4326AC_LANG_POP(C++)
4327
4328CXXFLAGS=$safe_CXXFLAGS
4329
4330AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
4331 [test x$ac_have_shared_pointer_annotation = xyes])
4332
4333
njn7fd6d382009-01-22 21:56:32 +00004334#----------------------------------------------------------------------------
4335# Ok. We're done checking.
4336#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00004337
njn8b68b642009-06-24 00:37:09 +00004338# Nb: VEX/Makefile is generated from Makefile.vex.in.
4339AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00004340 Makefile
njn8b68b642009-06-24 00:37:09 +00004341 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00004342 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00004343 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00004344 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00004345 docs/Makefile
4346 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00004347 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00004348 perf/Makefile
4349 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00004350 gdbserver_tests/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004351 gdbserver_tests/solaris/Makefile
njn254d542432002-09-23 16:09:39 +00004352 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00004353 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00004354 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00004355 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004356 memcheck/Makefile
4357 memcheck/tests/Makefile
floriane42cca52013-08-29 17:59:27 +00004358 memcheck/tests/common/Makefile
njnc6168192004-11-29 13:54:10 +00004359 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00004360 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00004361 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00004362 memcheck/tests/darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004363 memcheck/tests/solaris/Makefile
njnea2d6fd2010-07-01 00:20:20 +00004364 memcheck/tests/amd64-linux/Makefile
Elliott Hughesa0664b92017-04-18 17:46:52 -07004365 memcheck/tests/arm64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00004366 memcheck/tests/x86-linux/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004367 memcheck/tests/amd64-solaris/Makefile
4368 memcheck/tests/x86-solaris/Makefile
sewardj0e342a02010-09-03 23:49:33 +00004369 memcheck/tests/ppc32/Makefile
4370 memcheck/tests/ppc64/Makefile
florian0bb707e2012-05-30 20:46:58 +00004371 memcheck/tests/s390x/Makefile
florianbb913cd2012-08-28 16:50:39 +00004372 memcheck/tests/vbit-test/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004373 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004374 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00004375 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00004376 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00004377 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00004378 callgrind/Makefile
4379 callgrind/callgrind_annotate
4380 callgrind/callgrind_control
4381 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004382 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00004383 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00004384 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00004385 massif/tests/Makefile
njnd5a8d242007-11-02 20:44:57 +00004386 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00004387 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00004388 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00004389 none/Makefile
4390 none/tests/Makefile
florian0a6d8972015-04-03 15:47:19 +00004391 none/tests/scripts/Makefile
njnc6168192004-11-29 13:54:10 +00004392 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00004393 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00004394 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00004395 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00004396 none/tests/arm/Makefile
sewardjf02d2ec2014-08-26 19:28:09 +00004397 none/tests/arm64/Makefile
sewardjb5b87402011-03-07 16:05:35 +00004398 none/tests/s390x/Makefile
sewardj5db15402012-06-07 09:13:21 +00004399 none/tests/mips32/Makefile
petarj8bea8672013-05-10 13:14:54 +00004400 none/tests/mips64/Makefile
sewardj112711a2015-04-10 12:30:09 +00004401 none/tests/tilegx/Makefile
njn0458a122009-02-13 06:23:46 +00004402 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00004403 none/tests/darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004404 none/tests/solaris/Makefile
florian7d4a28b2015-04-23 15:20:00 +00004405 none/tests/amd64-linux/Makefile
njn06ca3322009-04-15 23:10:04 +00004406 none/tests/x86-linux/Makefile
rhyskidd0dc35262015-05-28 12:49:00 +00004407 none/tests/amd64-darwin/Makefile
4408 none/tests/x86-darwin/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004409 none/tests/amd64-solaris/Makefile
4410 none/tests/x86-solaris/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00004411 exp-sgcheck/Makefile
4412 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00004413 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00004414 drd/scripts/download-and-build-splash2
4415 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00004416 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00004417 exp-bbv/tests/Makefile
4418 exp-bbv/tests/x86/Makefile
4419 exp-bbv/tests/x86-linux/Makefile
4420 exp-bbv/tests/amd64-linux/Makefile
4421 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00004422 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00004423 exp-dhat/Makefile
4424 exp-dhat/tests/Makefile
mjwaeacd282014-03-11 19:30:32 +00004425 shared/Makefile
sewardj8eb8bab2015-07-21 14:44:28 +00004426 solaris/Makefile
njn8b68b642009-06-24 00:37:09 +00004427])
sewardjd3645802010-06-13 22:13:58 +00004428AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
4429 [chmod +x coregrind/link_tool_exe_linux])
4430AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
4431 [chmod +x coregrind/link_tool_exe_darwin])
sewardj8eb8bab2015-07-21 14:44:28 +00004432AC_CONFIG_FILES([coregrind/link_tool_exe_solaris],
4433 [chmod +x coregrind/link_tool_exe_solaris])
njn8b68b642009-06-24 00:37:09 +00004434AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00004435
4436cat<<EOF
4437
njn311303f2009-02-06 03:46:50 +00004438 Maximum build arch: ${ARCH_MAX}
4439 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00004440 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00004441 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00004442 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
4443 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardjcb495c82011-07-11 20:42:34 +00004444 Platform variant: ${VGCONF_PLATVARIANT}
4445 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
sewardje95d94f2008-09-19 09:02:19 +00004446 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00004447
gobry3b777892002-04-04 09:18:39 +00004448EOF