blob: a4d33d2c68c37c5fe513944d04330477c7a6d73f [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.
sewardj704deb62012-08-09 15:51:55 +000011AC_INIT([Valgrind],[3.9.0.SVN],[valgrind-users@lists.sourceforge.net])
njn04e16982005-05-31 00:23:43 +000012AC_CONFIG_SRCDIR(coregrind/m_main.c)
bart417cf3e2011-10-22 09:21:24 +000013AC_CONFIG_HEADERS([config.h])
sewardjf9a698e2013-09-02 12:44:52 +000014AM_INIT_AUTOMAKE([foreign subdir-objects])
sewardjde4a1d02002-03-22 01:27:54 +000015
gobryb0ed4672002-03-27 20:58:58 +000016AM_MAINTAINER_MODE
17
njn7fd6d382009-01-22 21:56:32 +000018#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +000019# Checks for various programs.
20#----------------------------------------------------------------------------
bartaca399a2010-08-15 18:54:15 +000021CFLAGS="-Wno-long-long $CFLAGS"
floriand79b3bf2013-10-02 15:14:59 +000022CXXFLAGS="-Wno-long-long $CXXFLAGS"
gobrye721a522002-03-22 13:38:30 +000023
sewardjde4a1d02002-03-22 01:27:54 +000024AC_PROG_LN_S
25AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000026AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000027AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000028AC_PROG_CXX
njn629a5ec2009-07-14 01:29:39 +000029# AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
30# autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
31# base (eg. most likely as Darwin-specific tests) we'll need one of the
32# following:
njn0cd26892009-07-12 23:07:13 +000033# - put AC_PROG_OBJC in a Darwin-specific part of this file
34# - Use AC_PROG_OBJC here and up the minimum autoconf version
35# - Use the following, which is apparently equivalent:
36# m4_ifdef([AC_PROG_OBJC],
37# [AC_PROG_OBJC],
38# [AC_CHECK_TOOL([OBJC], [gcc])
39# AC_SUBST([OBJC])
40# AC_SUBST([OBJCFLAGS])
41# ])
sewardjde4a1d02002-03-22 01:27:54 +000042AC_PROG_RANLIB
bart07de2c92010-05-29 06:44:28 +000043# provide a very basic definition for AC_PROG_SED if it's not provided by
44# autoconf (as e.g. in autoconf 2.59).
45m4_ifndef([AC_PROG_SED],
46 [AC_DEFUN([AC_PROG_SED],
47 [AC_ARG_VAR([SED])
48 AC_CHECK_PROGS([SED],[gsed sed])])])
bart12e91122010-05-15 08:37:24 +000049AC_PROG_SED
sewardjde4a1d02002-03-22 01:27:54 +000050
bartcddeaf52008-05-25 15:58:11 +000051# If no AR variable was specified, look up the name of the archiver. Otherwise
52# do not touch the AR variable.
53if test "x$AR" = "x"; then
bart07de2c92010-05-29 06:44:28 +000054 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000055fi
56AC_ARG_VAR([AR],[Archiver command])
57
gobrye721a522002-03-22 13:38:30 +000058# Check for the compiler support
59if test "${GCC}" != "yes" ; then
60 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
61fi
62
sewardj2f685952002-12-22 19:32:23 +000063# figure out where perl lives
64AC_PATH_PROG(PERL, perl)
65
njn9315df32003-04-16 20:50:50 +000066# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000067AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000068AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000069
daywalker48ccca52002-04-15 00:31:58 +000070# some older automake's don't have it so try something on our own
71ifdef([AM_PROG_AS],[AM_PROG_AS],
72[
gobry1be19852002-03-26 20:44:55 +000073AS="${CC}"
74AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000075
gobry1be19852002-03-26 20:44:55 +000076ASFLAGS=""
77AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000078])
gobry3b777892002-04-04 09:18:39 +000079
gobry3b777892002-04-04 09:18:39 +000080
njn0d2e58f2009-02-25 04:57:56 +000081# Check if 'diff' supports -u (universal diffs) and use it if possible.
82
83AC_MSG_CHECKING([for diff -u])
84AC_SUBST(DIFF)
85
sewardj6e9de462011-06-28 07:25:29 +000086# Comparing two identical files results in 0.
njn31f665e2009-02-26 21:25:50 +000087tmpfile="tmp-xxx-yyy-zzz"
88touch $tmpfile;
89if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000090 AC_MSG_RESULT([yes])
91 DIFF="diff -u"
92else
93 AC_MSG_RESULT([no])
94 DIFF="diff"
95fi
njn31f665e2009-02-26 21:25:50 +000096rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000097
98
sewardj535c50f2005-06-04 23:14:53 +000099# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +0000100AC_MSG_CHECKING([for a supported version of gcc])
101
bart85037442011-11-22 14:41:31 +0000102# Obtain the compiler version.
sewardja8ca2c52011-09-29 18:18:37 +0000103#
bart85037442011-11-22 14:41:31 +0000104# A few examples of how the ${CC} --version output looks like:
105#
106# Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
107# Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
108# openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
109# Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
bartc5214062012-01-11 11:34:23 +0000110# MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
bart85037442011-11-22 14:41:31 +0000111# OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
112# 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)
113# Clang: clang version 2.9 (tags/RELEASE_29/final)
bart048081f2012-06-17 05:53:02 +0000114# Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
115# FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
sewardja8ca2c52011-09-29 18:18:37 +0000116#
bartc5214062012-01-11 11:34:23 +0000117[
bart048081f2012-06-17 05:53:02 +0000118if test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ; then
119 is_clang="clang"
120 # Don't use -dumpversion with clang: it will always produce "4.2.1".
121 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
florian3d9368e2013-10-04 21:12:17 +0000122 CFLAGS="$CFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign"
123 CXXFLAGS="$CXXFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign"
bart048081f2012-06-17 05:53:02 +0000124else
125 is_clang="notclang"
126 gcc_version=`${CC} -dumpversion 2>/dev/null`
127 if test "x$gcc_version" = x; then
128 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
129 fi
sewardj3ab7b662011-09-29 17:30:13 +0000130fi
bart048081f2012-06-17 05:53:02 +0000131]
florian3d9368e2013-10-04 21:12:17 +0000132AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang)
sewardj3ab7b662011-09-29 17:30:13 +0000133
134case "${is_clang}-${gcc_version}" in
135 notclang-3.*)
136 AC_MSG_RESULT([ok (${gcc_version})])
137 ;;
138 notclang-4.*)
139 AC_MSG_RESULT([ok (${gcc_version})])
140 ;;
sewardjae284e52012-08-02 18:25:04 +0000141 clang-2.9|clang-3.*|clang-4.*)
sewardj3ab7b662011-09-29 17:30:13 +0000142 AC_MSG_RESULT([ok (clang-${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000143 ;;
gobrye721a522002-03-22 13:38:30 +0000144 *)
sewardj3ab7b662011-09-29 17:30:13 +0000145 AC_MSG_RESULT([no (${gcc_version})])
146 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9])
gobrye721a522002-03-22 13:38:30 +0000147 ;;
148esac
149
njn7fd6d382009-01-22 21:56:32 +0000150#----------------------------------------------------------------------------
151# Arch/OS/platform tests.
152#----------------------------------------------------------------------------
153# We create a number of arch/OS/platform-related variables. We prefix them
154# all with "VGCONF_" which indicates that they are defined at
155# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
156# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000157
sewardjde4a1d02002-03-22 01:27:54 +0000158AC_CANONICAL_HOST
159
160AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000161
njn7fd6d382009-01-22 21:56:32 +0000162# ARCH_MAX reflects the most that this CPU can do: for example if it
163# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
164# Ditto for amd64. It is used for more configuration below, but is not used
165# outside this file.
gobrye721a522002-03-22 13:38:30 +0000166case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000167 i?86)
168 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000169 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000170 ;;
171
njnfe408942004-11-23 17:52:24 +0000172 x86_64)
173 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000174 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000175 ;;
176
sewardj2c48c7b2005-11-29 13:05:56 +0000177 powerpc64)
178 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000179 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000180 ;;
181
182 powerpc)
sewardj6e9de462011-06-28 07:25:29 +0000183 # On Linux this means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000184 AC_MSG_RESULT([ok (${host_cpu})])
sewardj6e9de462011-06-28 07:25:29 +0000185 ARCH_MAX="ppc32"
nethercote9bcc9062004-10-13 13:50:01 +0000186 ;;
187
sewardjb5b87402011-03-07 16:05:35 +0000188 s390x)
189 AC_MSG_RESULT([ok (${host_cpu})])
190 ARCH_MAX="s390x"
191 ;;
192
sewardj59570ff2010-01-01 11:59:33 +0000193 armv7*)
194 AC_MSG_RESULT([ok (${host_cpu})])
195 ARCH_MAX="arm"
196 ;;
197
sewardj5db15402012-06-07 09:13:21 +0000198 mips)
petarj4df0bfc2013-02-27 23:17:33 +0000199 AC_MSG_RESULT([ok (${host_cpu})])
200 ARCH_MAX="mips32"
201 ;;
sewardj5db15402012-06-07 09:13:21 +0000202
203 mipsel)
petarj4df0bfc2013-02-27 23:17:33 +0000204 AC_MSG_RESULT([ok (${host_cpu})])
205 ARCH_MAX="mips32"
206 ;;
sewardj5db15402012-06-07 09:13:21 +0000207
208 mipsisa32r2)
petarj4df0bfc2013-02-27 23:17:33 +0000209 AC_MSG_RESULT([ok (${host_cpu})])
210 ARCH_MAX="mips32"
211 ;;
sewardj5db15402012-06-07 09:13:21 +0000212
petarj4df0bfc2013-02-27 23:17:33 +0000213 mips64*)
214 AC_MSG_RESULT([ok (${host_cpu})])
215 ARCH_MAX="mips64"
216 ;;
217
218 mipsisa64*)
219 AC_MSG_RESULT([ok (${host_cpu})])
220 ARCH_MAX="mips64"
221 ;;
sewardjde4a1d02002-03-22 01:27:54 +0000222 *)
223 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000224 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000225 ;;
226esac
227
njn7fd6d382009-01-22 21:56:32 +0000228#----------------------------------------------------------------------------
229
sewardj86e992f2006-01-28 18:39:09 +0000230# Sometimes it's convenient to subvert the bi-arch build system and
231# just have a single build even though the underlying platform is
232# capable of both. Hence handle --enable-only64bit and
233# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000234# [Actually, if either of these options are used, I think both get built,
235# but only one gets installed. So if you use an in-place build, both can be
236# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000237
238# Check if a 64-bit only build has been requested
239AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
240 [AC_ARG_ENABLE(only64bit,
241 [ --enable-only64bit do a 64-bit only build],
242 [vg_cv_only64bit=$enableval],
243 [vg_cv_only64bit=no])])
244
245# Check if a 32-bit only build has been requested
246AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
247 [AC_ARG_ENABLE(only32bit,
248 [ --enable-only32bit do a 32-bit only build],
249 [vg_cv_only32bit=$enableval],
250 [vg_cv_only32bit=no])])
251
252# Stay sane
253if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
254 AC_MSG_ERROR(
255 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
256fi
257
njn7fd6d382009-01-22 21:56:32 +0000258#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000259
njn311303f2009-02-06 03:46:50 +0000260# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
261# compilation of many C files via -VGO_$(VGCONF_OS) and
262# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000263AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000264AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000265
njnf76d27a2009-05-28 01:53:07 +0000266DEFAULT_SUPP=""
267
gobrye721a522002-03-22 13:38:30 +0000268case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000269 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000270 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000271 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000272
273 # Ok, this is linux. Check the kernel version
274 AC_MSG_CHECKING([for the kernel version])
275
276 kernel=`uname -r`
277
278 case "${kernel}" in
bart0419e512011-06-05 08:51:47 +0000279 2.6.*|3.*)
bart2d6e6e72011-06-05 10:01:48 +0000280 AC_MSG_RESULT([2.6.x/3.x family (${kernel})])
281 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x or Linux 3.x])
mueller8c68e042004-01-03 15:21:14 +0000282 ;;
283
284 2.4.*)
285 AC_MSG_RESULT([2.4 family (${kernel})])
286 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
287 ;;
288
mueller8c68e042004-01-03 15:21:14 +0000289 *)
290 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000291 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000292 ;;
293 esac
294
295 ;;
296
njnf76d27a2009-05-28 01:53:07 +0000297 *darwin*)
298 AC_MSG_RESULT([ok (${host_os})])
299 VGCONF_OS="darwin"
njnea2d6fd2010-07-01 00:20:20 +0000300 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
301 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
302 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
sewardjae284e52012-08-02 18:25:04 +0000303 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
njnf76d27a2009-05-28 01:53:07 +0000304
305 AC_MSG_CHECKING([for the kernel version])
306 kernel=`uname -r`
307
308 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
309 # has only one relevant version, the OS version. The `uname` check
310 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
sewardj731f9cf2011-09-21 08:43:08 +0000311 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
312 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
njnea2d6fd2010-07-01 00:20:20 +0000313 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000314 #
315 # XXX: `uname -r` won't do the right thing for cross-compiles, but
316 # that's not a problem yet.
sewardj731f9cf2011-09-21 08:43:08 +0000317 #
318 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
319 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
320 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
321 # time support for 10.5 (the 9.* pattern just below), I'll leave it
322 # in for now, just in case anybody wants to give it a try. But I'm
323 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
njnf76d27a2009-05-28 01:53:07 +0000324 case "${kernel}" in
325 9.*)
326 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000327 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000328 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000329 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000330 ;;
njnea2d6fd2010-07-01 00:20:20 +0000331 10.*)
332 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
333 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
334 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
335 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
336 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000337 11.*)
338 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
339 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
sewardj731f9cf2011-09-21 08:43:08 +0000340 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
341 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
342 ;;
sewardjae284e52012-08-02 18:25:04 +0000343 12.*)
344 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
345 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
346 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
347 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
348 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000349 *)
njnf76d27a2009-05-28 01:53:07 +0000350 AC_MSG_RESULT([unsupported (${kernel})])
sewardj731f9cf2011-09-21 08:43:08 +0000351 AC_MSG_ERROR([Valgrind works on Darwin 10.x and 11.x (Mac OS X 10.6/7)])
njnf76d27a2009-05-28 01:53:07 +0000352 ;;
353 esac
354 ;;
355
sewardjde4a1d02002-03-22 01:27:54 +0000356 *)
357 AC_MSG_RESULT([no (${host_os})])
njncc58cea2010-07-05 07:21:22 +0000358 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
sewardjde4a1d02002-03-22 01:27:54 +0000359 ;;
360esac
361
njn7fd6d382009-01-22 21:56:32 +0000362#----------------------------------------------------------------------------
363
tomd6398392006-06-07 17:44:36 +0000364# If we are building on a 64 bit platform test to see if the system
365# supports building 32 bit programs and disable 32 bit support if it
366# does not support building 32 bit programs
367
njn7fd6d382009-01-22 21:56:32 +0000368case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000369 amd64-linux|ppc64-linux)
370 AC_MSG_CHECKING([for 32 bit build support])
371 safe_CFLAGS=$CFLAGS
372 CFLAGS="-m32"
bart417cf3e2011-10-22 09:21:24 +0000373 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +0000374 return 0;
bart417cf3e2011-10-22 09:21:24 +0000375 ]])], [
tomd6398392006-06-07 17:44:36 +0000376 AC_MSG_RESULT([yes])
377 ], [
378 vg_cv_only64bit="yes"
379 AC_MSG_RESULT([no])
380 ])
381 CFLAGS=$safe_CFLAGS;;
382esac
383
384if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
385 AC_MSG_ERROR(
386 [--enable-only32bit was specified but system does not support 32 bit builds])
387fi
nethercote888ecb72004-08-23 14:54:40 +0000388
njn7fd6d382009-01-22 21:56:32 +0000389#----------------------------------------------------------------------------
390
njn311303f2009-02-06 03:46:50 +0000391# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
392# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
393# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
394# above) will be "amd64" since that reflects the most that this cpu can do,
395# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
396# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000397# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
398# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
399AC_SUBST(VGCONF_ARCH_PRI)
400
njn3f8a6e92009-06-02 00:20:47 +0000401# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
402# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
403# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
404# It is empty if there is no secondary target.
405AC_SUBST(VGCONF_ARCH_SEC)
406
njn311303f2009-02-06 03:46:50 +0000407# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
408# The entire system, including regression and performance tests, will be
409# built for this target. The "_CAPS" indicates that the name is in capital
410# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000411# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000412# convention and cannot contain '-' characters. This is in contrast to
413# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000414AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
415
416# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
417# Valgrind and tools will also be built for this target, but not the
418# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000419#
njn7fd6d382009-01-22 21:56:32 +0000420# By default, the primary arch is the same as the "max" arch, as commented
421# above (at the definition of ARCH_MAX). We may choose to downgrade it in
422# the big case statement just below here, in the case where we're building
423# on a 64 bit machine but have been requested only to do a 32 bit build.
424AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
425
sewardj01262142006-01-04 01:20:28 +0000426AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000427
njnea2d6fd2010-07-01 00:20:20 +0000428# NB. The load address for a given platform may be specified in more
429# than one place, in some cases, depending on whether we're doing a biarch,
430# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
431# Be careful to give consistent values in all subcases. Also, all four
432# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
433# even if it is to "0xUNSET".
434#
njn7fd6d382009-01-22 21:56:32 +0000435case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000436 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000437 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000438 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000439 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
440 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000441 valt_load_address_pri_norml="0x38000000"
442 valt_load_address_pri_inner="0x28000000"
443 valt_load_address_sec_norml="0xUNSET"
444 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000445 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000446 ;;
447 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000448 valt_load_address_sec_norml="0xUNSET"
449 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000450 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000451 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000452 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000453 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
454 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000455 valt_load_address_pri_norml="0x38000000"
456 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000457 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000458 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000459 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000460 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
461 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000462 valt_load_address_pri_norml="0x38000000"
463 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000464 else
njn7fd6d382009-01-22 21:56:32 +0000465 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000466 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000467 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
468 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000469 valt_load_address_pri_norml="0x38000000"
470 valt_load_address_pri_inner="0x28000000"
471 valt_load_address_sec_norml="0x38000000"
472 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000473 fi
njn377c43f2009-05-19 07:39:22 +0000474 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000475 ;;
476 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000477 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000478 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000479 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
480 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000481 valt_load_address_pri_norml="0x38000000"
482 valt_load_address_pri_inner="0x28000000"
483 valt_load_address_sec_norml="0xUNSET"
484 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000485 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000486 ;;
487 ppc64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000488 valt_load_address_sec_norml="0xUNSET"
489 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000490 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000491 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000492 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000493 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
494 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000495 valt_load_address_pri_norml="0x38000000"
496 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000497 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000498 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000499 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000500 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
501 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000502 valt_load_address_pri_norml="0x38000000"
503 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000504 else
njn7fd6d382009-01-22 21:56:32 +0000505 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000506 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000507 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
508 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000509 valt_load_address_pri_norml="0x38000000"
510 valt_load_address_pri_inner="0x28000000"
511 valt_load_address_sec_norml="0x38000000"
512 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000513 fi
njn377c43f2009-05-19 07:39:22 +0000514 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000515 ;;
njncc58cea2010-07-05 07:21:22 +0000516 # Darwin gets identified as 32-bit even when it supports 64-bit.
517 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
518 # all Macs support both 32-bit and 64-bit, so we just build both. If
519 # someone has a really old 32-bit only machine they can (hopefully?)
520 # build with --enable-only32bit. See bug 243362.
521 x86-darwin|amd64-darwin)
522 ARCH_MAX="amd64"
njnea2d6fd2010-07-01 00:20:20 +0000523 valt_load_address_sec_norml="0xUNSET"
524 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000525 if test x$vg_cv_only64bit = xyes; then
526 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000527 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000528 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
529 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000530 valt_load_address_pri_norml="0x138000000"
531 valt_load_address_pri_inner="0x128000000"
njnf76d27a2009-05-28 01:53:07 +0000532 elif test x$vg_cv_only32bit = xyes; then
533 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000534 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000535 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
536 VGCONF_PLATFORM_SEC_CAPS=""
537 VGCONF_ARCH_PRI_CAPS="x86"
njnea2d6fd2010-07-01 00:20:20 +0000538 valt_load_address_pri_norml="0x38000000"
539 valt_load_address_pri_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000540 else
541 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000542 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000543 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
544 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
njnea2d6fd2010-07-01 00:20:20 +0000545 valt_load_address_pri_norml="0x138000000"
546 valt_load_address_pri_inner="0x128000000"
547 valt_load_address_sec_norml="0x38000000"
548 valt_load_address_sec_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000549 fi
njnf76d27a2009-05-28 01:53:07 +0000550 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
551 ;;
sewardj59570ff2010-01-01 11:59:33 +0000552 arm-linux)
553 VGCONF_ARCH_PRI="arm"
554 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
555 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000556 valt_load_address_pri_norml="0x38000000"
557 valt_load_address_pri_inner="0x28000000"
558 valt_load_address_sec_norml="0xUNSET"
559 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000560 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
561 ;;
sewardjb5b87402011-03-07 16:05:35 +0000562 s390x-linux)
563 VGCONF_ARCH_PRI="s390x"
564 VGCONF_ARCH_SEC=""
565 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
566 VGCONF_PLATFORM_SEC_CAPS=""
567 # we want to have the generated code close to the dispatcher
568 valt_load_address_pri_norml="0x401000000"
569 valt_load_address_pri_inner="0x410000000"
570 valt_load_address_sec_norml="0xUNSET"
571 valt_load_address_sec_inner="0xUNSET"
572 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
573 ;;
sewardj5db15402012-06-07 09:13:21 +0000574 mips32-linux)
575 VGCONF_ARCH_PRI="mips32"
576 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
577 VGCONF_PLATFORM_SEC_CAPS=""
578 valt_load_address_pri_norml="0x38000000"
579 valt_load_address_pri_inner="0x28000000"
580 valt_load_address_sec_norml="0xUNSET"
581 valt_load_address_sec_inner="0xUNSET"
582 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
petarj4df0bfc2013-02-27 23:17:33 +0000583 ;;
584 mips64-linux)
585 VGCONF_ARCH_PRI="mips64"
586 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
587 VGCONF_PLATFORM_SEC_CAPS=""
588 valt_load_address_pri_norml="0x38000000"
589 valt_load_address_pri_inner="0x28000000"
590 valt_load_address_sec_norml="0xUNSET"
591 valt_load_address_sec_inner="0xUNSET"
592 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj5db15402012-06-07 09:13:21 +0000593 ;;
nethercote888ecb72004-08-23 14:54:40 +0000594 *)
njn7fd6d382009-01-22 21:56:32 +0000595 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000596 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000597 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
598 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000599 valt_load_address_pri_norml="0xUNSET"
600 valt_load_address_pri_inner="0xUNSET"
601 valt_load_address_sec_norml="0xUNSET"
602 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000603 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000604 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000605 ;;
606esac
sewardjde4a1d02002-03-22 01:27:54 +0000607
njn7fd6d382009-01-22 21:56:32 +0000608#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000609
njn7fd6d382009-01-22 21:56:32 +0000610# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
611# defined.
612AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
613 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000614 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
615 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
616 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000617AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000618 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
619 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000620AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
621 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj6e9de462011-06-28 07:25:29 +0000622 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000623AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
sewardj6e9de462011-06-28 07:25:29 +0000624 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX )
sewardj59570ff2010-01-01 11:59:33 +0000625AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
626 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardjb5b87402011-03-07 16:05:35 +0000627AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
628 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
sewardj5db15402012-06-07 09:13:21 +0000629AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
630 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
petarj4df0bfc2013-02-27 23:17:33 +0000631AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
632 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000633
njn7fd6d382009-01-22 21:56:32 +0000634# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
635# become defined.
636AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
637 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
638 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
639AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
640 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
641AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
642 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
643 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
644AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
645 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000646AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
647 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
sewardjb5b87402011-03-07 16:05:35 +0000648AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
649 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
650 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
sewardj5db15402012-06-07 09:13:21 +0000651AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
652 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
petarj4df0bfc2013-02-27 23:17:33 +0000653AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
654 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000655
njnf76d27a2009-05-28 01:53:07 +0000656AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
657 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
658 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
659AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
660 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
661
662
sewardj72a2d802010-07-29 05:24:20 +0000663# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000664# Relies on the assumption that the primary and secondary targets are
665# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000666AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
667 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
668 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
669 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000670 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +0000671 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
sewardj5db15402012-06-07 09:13:21 +0000672 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +0000673 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
674 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000675AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
676 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
677 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000678
679
njn7fd6d382009-01-22 21:56:32 +0000680# Sometimes, in the Makefile.am files, it's useful to know whether or not
681# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000682AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000683 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000684
philippef32cbe82012-05-18 16:48:20 +0000685dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
686dnl fallback definition
687dnl The macro is courtesy of Dave Hart:
688dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
689m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
690if test -z "$$1_TRUE"; then :
691 m4_n([$2])[]dnl
692m4_ifval([$3],
693[else
694 $3
695])dnl
696fi[]dnl
697])])
tomb637bad2005-11-08 12:28:35 +0000698
njn7fd6d382009-01-22 21:56:32 +0000699#----------------------------------------------------------------------------
700# Inner Valgrind?
701#----------------------------------------------------------------------------
702
njnd74b0ef2009-01-20 06:06:52 +0000703# Check if this should be built as an inner Valgrind, to be run within
704# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000705AC_SUBST(VALT_LOAD_ADDRESS_PRI)
706AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000707AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
708 [AC_ARG_ENABLE(inner,
709 [ --enable-inner enables self-hosting],
710 [vg_cv_inner=$enableval],
711 [vg_cv_inner=no])])
712if test "$vg_cv_inner" = yes; then
713 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000714 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
715 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000716else
njnea2d6fd2010-07-01 00:20:20 +0000717 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
718 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000719fi
720
721
njn7fd6d382009-01-22 21:56:32 +0000722#----------------------------------------------------------------------------
sewardj5db15402012-06-07 09:13:21 +0000723# Define MIPS_PAGE_SHIFT (--with-pagesize)
724#----------------------------------------------------------------------------
725AC_ARG_WITH(pagesize,
726 [ --with-pagesize= override detected page size (4, 16 or 64)],
727 [psize=$withval],
728 [psize=0]
729)
730
731if test "$psize" = "0"; then
732 psizer=`getconf PAGESIZE`
733 let "psize=${psizer}/1024"
734fi
735
736if test "$psize" = "4"; then
737 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured page size 4k])
738elif test "$psize" = "16"; then
739 AC_DEFINE([MIPS_PAGE_SHIFT], 14, [configured page size 16k])
740elif test "$psize" = "64"; then
741 AC_DEFINE([MIPS_PAGE_SHIFT], 16, [configured page size 64k])
742else
743 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured default page size 4k])
744fi
745AC_MSG_RESULT([checking for Pagesize... ${psize}k])
746
sewardj5db15402012-06-07 09:13:21 +0000747
748#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000749# Extra fine-tuning of installation directories
750#----------------------------------------------------------------------------
751AC_ARG_WITH(tmpdir,
752 [ --with-tmpdir=PATH Specify path for temporary files],
753 tmpdir="$withval",
754 tmpdir="/tmp")
755AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
756
sewardj0ba37c92011-07-12 11:46:24 +0000757
sewardjcb495c82011-07-11 20:42:34 +0000758#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000759# Libc and suppressions
760#----------------------------------------------------------------------------
761# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000762AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000763
bart12e91122010-05-15 08:37:24 +0000764AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000765
bart12e91122010-05-15 08:37:24 +0000766if test x$ac_cv_header_features_h = xyes; then
767 rm -f conftest.$ac_ext
768 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000769#include <features.h>
bart12e91122010-05-15 08:37:24 +0000770#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
771glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000772#endif
bart12e91122010-05-15 08:37:24 +0000773_ACEOF
774 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
775fi
bartb7c3f082010-05-13 06:32:36 +0000776
njnf76d27a2009-05-28 01:53:07 +0000777# not really a version check
778AC_EGREP_CPP([DARWIN_LIBC], [
779#include <sys/cdefs.h>
780#if defined(__DARWIN_VERS_1050)
781 DARWIN_LIBC
782#endif
783],
784GLIBC_VERSION="darwin")
785
sewardjcb495c82011-07-11 20:42:34 +0000786# not really a version check
787AC_EGREP_CPP([BIONIC_LIBC], [
788#if defined(__ANDROID__)
789 BIONIC_LIBC
790#endif
791],
792GLIBC_VERSION="bionic")
793
794
dirk07596a22008-04-25 11:33:30 +0000795AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000796
dirk07596a22008-04-25 11:33:30 +0000797case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000798 2.2)
799 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000800 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000801 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
802 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000803 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000804 ;;
805
sewardj08c7f012002-10-07 23:56:55 +0000806 2.3)
807 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000808 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000809 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000810 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000811 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000812 ;;
813
njn781dba52005-06-30 04:06:38 +0000814 2.4)
815 AC_MSG_RESULT(2.4 family)
816 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000817 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000818 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000819 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000820 ;;
821
dirkaece45c2006-10-12 08:17:49 +0000822 2.5)
823 AC_MSG_RESULT(2.5 family)
824 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000825 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000826 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000827 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000828 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000829 2.6)
830 AC_MSG_RESULT(2.6 family)
831 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000832 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000833 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000834 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000835 ;;
836 2.7)
837 AC_MSG_RESULT(2.7 family)
838 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000839 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000840 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000841 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000842 ;;
dirk07596a22008-04-25 11:33:30 +0000843 2.8)
844 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000845 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000846 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
847 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
848 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
849 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000850 2.9)
851 AC_MSG_RESULT(2.9 family)
852 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
853 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
854 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
855 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
856 ;;
sewardj5d425e82009-02-01 19:01:11 +0000857 2.10)
858 AC_MSG_RESULT(2.10 family)
859 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
860 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
861 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
862 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
863 ;;
bart0fac7ff2009-11-15 19:11:19 +0000864 2.11)
865 AC_MSG_RESULT(2.11 family)
866 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
867 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
868 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
869 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000870 ;;
871 2.12)
872 AC_MSG_RESULT(2.12 family)
873 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
874 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
875 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
876 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000877 ;;
tomebd619b2011-02-10 09:09:09 +0000878 2.13)
879 AC_MSG_RESULT(2.13 family)
880 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
881 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
882 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
883 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
884 ;;
tomcc077412011-06-07 21:52:26 +0000885 2.14)
886 AC_MSG_RESULT(2.14 family)
887 AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x])
888 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
889 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
890 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
891 ;;
dirke75fdeb2011-12-29 08:24:55 +0000892 2.15)
893 AC_MSG_RESULT(2.15 family)
894 AC_DEFINE([GLIBC_2_15], 1, [Define to 1 if you're using glibc 2.15.x])
895 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
896 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
897 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
898 ;;
sewardjc7188be2012-07-14 10:07:06 +0000899 2.16)
900 AC_MSG_RESULT(2.16 family)
901 AC_DEFINE([GLIBC_2_16], 1, [Define to 1 if you're using glibc 2.16.x])
902 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
903 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
904 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
905 ;;
tom3781ac12013-01-14 09:48:49 +0000906 2.17)
907 AC_MSG_RESULT(2.17 family)
908 AC_DEFINE([GLIBC_2_17], 1, [Define to 1 if you're using glibc 2.17.x])
909 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
910 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
911 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
912 ;;
mjw317f01b2013-08-21 14:47:52 +0000913 2.18)
914 AC_MSG_RESULT(2.18 family)
915 AC_DEFINE([GLIBC_2_18], 1, [Define to 1 if you're using glibc 2.18.x])
916 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
917 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
918 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
919 ;;
njnf76d27a2009-05-28 01:53:07 +0000920 darwin)
921 AC_MSG_RESULT(Darwin)
922 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
923 # DEFAULT_SUPP set by kernel version check above.
924 ;;
sewardjcb495c82011-07-11 20:42:34 +0000925 bionic)
926 AC_MSG_RESULT(Bionic)
927 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
928 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
929 ;;
dirkaece45c2006-10-12 08:17:49 +0000930
sewardjde4a1d02002-03-22 01:27:54 +0000931 *)
bart12e91122010-05-15 08:37:24 +0000932 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
tom3781ac12013-01-14 09:48:49 +0000933 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.17])
njnf76d27a2009-05-28 01:53:07 +0000934 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000935 ;;
936esac
937
dirk07596a22008-04-25 11:33:30 +0000938AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000939
sewardj414f3582008-07-18 20:46:00 +0000940
941# Add default suppressions for the X client libraries. Make no
942# attempt to detect whether such libraries are installed on the
943# build machine (or even if any X facilities are present); just
944# add the suppressions antidisirregardless.
945DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
946DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000947
sewardjd2f95a02011-05-11 16:04:28 +0000948# Add glibc and X11 suppressions for exp-sgcheck
949DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
sewardj5744c022008-10-19 18:58:13 +0000950
sewardj2e10a682003-04-07 19:36:41 +0000951
njn7fd6d382009-01-22 21:56:32 +0000952#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000953# Platform variants?
954#----------------------------------------------------------------------------
955
956# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
957# But there are times where we need a bit more control. The motivating
philippe5d5dd8e2012-08-05 00:08:25 +0000958# and currently only case is Android: this is almost identical to
959# {x86,arm}-linux, but not quite. So this introduces the concept of platform
960# variant tags, which get passed in the compile as -DVGPV_<arch>_<os>_<variant>
961# along with the main -DVGP_<arch>_<os> definition.
sewardjcb495c82011-07-11 20:42:34 +0000962#
963# In almost all cases, the <variant> bit is "vanilla". But for Android
964# it is "android" instead.
965#
966# Consequently (eg), plain arm-linux would build with
967#
968# -DVGP_arm_linux -DVGPV_arm_linux_vanilla
969#
970# whilst an Android build would have
971#
972# -DVGP_arm_linux -DVGPV_arm_linux_android
973#
philippe5d5dd8e2012-08-05 00:08:25 +0000974# Same for x86. The setup of the platform variant is pushed relatively far
975# down this file in order that we can inspect any of the variables set above.
sewardjcb495c82011-07-11 20:42:34 +0000976
977# In the normal case ..
978VGCONF_PLATVARIANT="vanilla"
979
philippe5d5dd8e2012-08-05 00:08:25 +0000980# Android ?
981if test "$GLIBC_VERSION" = "bionic";
sewardjcb495c82011-07-11 20:42:34 +0000982then
983 VGCONF_PLATVARIANT="android"
984fi
985
986AC_SUBST(VGCONF_PLATVARIANT)
987
988
989# FIXME: do we also want to define automake variables
990# VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
991# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
992# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
993# do that. Problem is that we can't do and-ing in Makefile.am's, but
994# that's what we'd need to do to use this, since what we'd want to write
995# is something like
996#
997# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
998#
sewardj0ba37c92011-07-12 11:46:24 +0000999# Hmm. Can't think of a nice clean solution to this.
1000
1001AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
1002 test x$VGCONF_PLATVARIANT = xvanilla)
1003AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1004 test x$VGCONF_PLATVARIANT = xandroid)
sewardjcb495c82011-07-11 20:42:34 +00001005
1006
1007#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +00001008# Checking for various library functions and other definitions
1009#----------------------------------------------------------------------------
1010
florian28db75c2012-12-08 19:26:03 +00001011# Check for AT_FDCWD
1012
1013AC_MSG_CHECKING([for AT_FDCWD])
1014AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1015#define _GNU_SOURCE
1016#include <fcntl.h>
1017#include <unistd.h>
1018]], [[
1019 int a = AT_FDCWD;
1020]])], [
1021ac_have_at_fdcwd=yes
1022AC_MSG_RESULT([yes])
1023], [
1024ac_have_at_fdcwd=no
florian28db75c2012-12-08 19:26:03 +00001025AC_MSG_RESULT([no])
1026])
1027
1028AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1029
sewardj24cf8df2012-12-14 10:30:57 +00001030# Check for stpncpy function definition in string.h
1031# This explicitly checks with _GNU_SOURCE defined since that is also
1032# used in the test case (some systems might define it without anyway
1033# since stpncpy is part of The Open Group Base Specifications Issue 7
1034# IEEE Std 1003.1-2008.
1035AC_MSG_CHECKING([for stpncpy])
1036AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1037#define _GNU_SOURCE
1038#include <string.h>
1039]], [[
1040 char *d;
1041 char *s;
1042 size_t n = 0;
1043 char *r = stpncpy(d, s, n);
1044]])], [
1045ac_have_gnu_stpncpy=yes
1046AC_MSG_RESULT([yes])
1047], [
1048ac_have_gnu_stpncpy=no
1049AC_MSG_RESULT([no])
1050])
1051
1052AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
florian28db75c2012-12-08 19:26:03 +00001053
philippe4e98f7c2013-08-03 20:34:58 +00001054# Check for PTRACE_GETREGS
1055
1056AC_MSG_CHECKING([for PTRACE_GETREGS])
1057AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1058#include <stddef.h>
1059#include <sys/ptrace.h>
1060#include <sys/user.h>
1061]], [[
1062 void *p;
1063 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1064]])], [
1065AC_MSG_RESULT([yes])
1066AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1067 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1068], [
1069AC_MSG_RESULT([no])
1070])
1071
1072
bart59e2f182008-04-28 16:22:53 +00001073# Check for CLOCK_MONOTONIC
1074
1075AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1076
bart417cf3e2011-10-22 09:21:24 +00001077AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart59e2f182008-04-28 16:22:53 +00001078#include <time.h>
bart417cf3e2011-10-22 09:21:24 +00001079]], [[
bart59e2f182008-04-28 16:22:53 +00001080 struct timespec t;
1081 clock_gettime(CLOCK_MONOTONIC, &t);
1082 return 0;
bart417cf3e2011-10-22 09:21:24 +00001083]])], [
bart59e2f182008-04-28 16:22:53 +00001084AC_MSG_RESULT([yes])
1085AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1086 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1087], [
1088AC_MSG_RESULT([no])
1089])
1090
bartfea06922008-05-03 09:12:15 +00001091
sewardj0c09bf02011-07-11 22:11:58 +00001092# Check for PTHREAD_RWLOCK_T
1093
1094AC_MSG_CHECKING([for pthread_rwlock_t])
1095
bart417cf3e2011-10-22 09:21:24 +00001096AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardj0c09bf02011-07-11 22:11:58 +00001097#define _GNU_SOURCE
1098#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001099]], [[
sewardj0c09bf02011-07-11 22:11:58 +00001100 pthread_rwlock_t rwl;
bart417cf3e2011-10-22 09:21:24 +00001101]])], [
sewardj0c09bf02011-07-11 22:11:58 +00001102AC_MSG_RESULT([yes])
1103AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1104 [Define to 1 if you have the `pthread_rwlock_t' type.])
1105], [
1106AC_MSG_RESULT([no])
1107])
1108
1109
bartfea06922008-05-03 09:12:15 +00001110# Check for PTHREAD_MUTEX_ADAPTIVE_NP
1111
1112AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1113
bart417cf3e2011-10-22 09:21:24 +00001114AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001115#define _GNU_SOURCE
1116#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001117]], [[
bartfea06922008-05-03 09:12:15 +00001118 return (PTHREAD_MUTEX_ADAPTIVE_NP);
bart417cf3e2011-10-22 09:21:24 +00001119]])], [
bartfea06922008-05-03 09:12:15 +00001120AC_MSG_RESULT([yes])
1121AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1122 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1123], [
1124AC_MSG_RESULT([no])
1125])
1126
1127
1128# Check for PTHREAD_MUTEX_ERRORCHECK_NP
1129
1130AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1131
bart417cf3e2011-10-22 09:21:24 +00001132AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001133#define _GNU_SOURCE
1134#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001135]], [[
bartfea06922008-05-03 09:12:15 +00001136 return (PTHREAD_MUTEX_ERRORCHECK_NP);
bart417cf3e2011-10-22 09:21:24 +00001137]])], [
bartfea06922008-05-03 09:12:15 +00001138AC_MSG_RESULT([yes])
1139AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1140 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1141], [
1142AC_MSG_RESULT([no])
1143])
1144
1145
1146# Check for PTHREAD_MUTEX_RECURSIVE_NP
1147
1148AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1149
bart417cf3e2011-10-22 09:21:24 +00001150AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001151#define _GNU_SOURCE
1152#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001153]], [[
bartfea06922008-05-03 09:12:15 +00001154 return (PTHREAD_MUTEX_RECURSIVE_NP);
bart417cf3e2011-10-22 09:21:24 +00001155]])], [
bartfea06922008-05-03 09:12:15 +00001156AC_MSG_RESULT([yes])
1157AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1158 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1159], [
1160AC_MSG_RESULT([no])
1161])
1162
1163
1164# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1165
1166AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1167
bart417cf3e2011-10-22 09:21:24 +00001168AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +00001169#define _GNU_SOURCE
1170#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +00001171]], [[
bartfea06922008-05-03 09:12:15 +00001172 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1173 return 0;
bart417cf3e2011-10-22 09:21:24 +00001174]])], [
bartfea06922008-05-03 09:12:15 +00001175AC_MSG_RESULT([yes])
1176AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1177 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1178], [
1179AC_MSG_RESULT([no])
1180])
1181
1182
bart5e389f12008-04-05 12:53:15 +00001183# Check whether pthread_mutex_t has a member called __m_kind.
1184
bartb11355c2010-04-29 16:37:26 +00001185AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1186 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1187 1,
1188 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1189 ],
1190 [],
1191 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001192
1193
1194# Check whether pthread_mutex_t has a member called __data.__kind.
1195
bartb11355c2010-04-29 16:37:26 +00001196AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1197 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1198 1,
1199 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1200 ],
1201 [],
1202 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001203
1204
bart62c370e2008-05-12 18:50:51 +00001205# does this compiler support -maltivec and does it have the include file
1206# <altivec.h> ?
1207
1208AC_MSG_CHECKING([for Altivec])
1209
1210safe_CFLAGS=$CFLAGS
1211CFLAGS="-maltivec"
1212
bart417cf3e2011-10-22 09:21:24 +00001213AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart62c370e2008-05-12 18:50:51 +00001214#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001215]], [[
bart62c370e2008-05-12 18:50:51 +00001216 vector unsigned int v;
bart417cf3e2011-10-22 09:21:24 +00001217]])], [
bart62c370e2008-05-12 18:50:51 +00001218ac_have_altivec=yes
1219AC_MSG_RESULT([yes])
sewardjf9fe6022010-09-03 14:36:50 +00001220AC_DEFINE([HAS_ALTIVEC], 1,
sewardj6467a152010-09-03 14:02:22 +00001221 [Define to 1 if gcc/as can do Altivec.])
bart62c370e2008-05-12 18:50:51 +00001222], [
1223ac_have_altivec=no
1224AC_MSG_RESULT([no])
1225])
1226CFLAGS=$safe_CFLAGS
1227
sewardj0e342a02010-09-03 23:49:33 +00001228AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
bart62c370e2008-05-12 18:50:51 +00001229
1230
sewardjf34eb492011-04-15 11:57:05 +00001231# Check that both: the compiler supports -mvsx and that the assembler
1232# understands VSX instructions. If either of those doesn't work,
1233# conclude that we can't do VSX. NOTE: basically this is a kludge
1234# in that it conflates two things that should be separate -- whether
1235# the compiler understands the flag vs whether the assembler
1236# understands the opcodes. This really ought to be cleaned up
1237# and done properly, like it is for x86/x86_64.
1238
1239AC_MSG_CHECKING([for VSX])
1240
1241safe_CFLAGS=$CFLAGS
1242CFLAGS="-mvsx"
1243
bart417cf3e2011-10-22 09:21:24 +00001244AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardjf34eb492011-04-15 11:57:05 +00001245#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001246]], [[
sewardjf34eb492011-04-15 11:57:05 +00001247 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +00001248 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
bart417cf3e2011-10-22 09:21:24 +00001249]])], [
sewardjf34eb492011-04-15 11:57:05 +00001250ac_have_vsx=yes
1251AC_MSG_RESULT([yes])
1252], [
1253ac_have_vsx=no
1254AC_MSG_RESULT([no])
1255])
1256CFLAGS=$safe_CFLAGS
1257
1258AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1259
sewardj4e1c1912012-08-08 22:22:26 +00001260
sewardjb0ccb4d2012-04-02 10:22:05 +00001261AC_MSG_CHECKING([that assembler knows DFP])
1262
1263AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1264]], [[
1265 __asm__ __volatile__("dadd 1, 2, 3");
sewardj4e1c1912012-08-08 22:22:26 +00001266 __asm__ __volatile__("dcffix 1, 2");
sewardjb0ccb4d2012-04-02 10:22:05 +00001267]])], [
1268ac_asm_have_dfp=yes
1269AC_MSG_RESULT([yes])
1270], [
1271ac_asm_have_dfp=no
1272AC_MSG_RESULT([no])
1273])
1274
sewardj4e1c1912012-08-08 22:22:26 +00001275
sewardjb0ccb4d2012-04-02 10:22:05 +00001276AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1277safe_CFLAGS=$CFLAGS
1278CFLAGS="-mhard-dfp"
1279AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1280]], [[
1281 __asm__ __volatile__("dadd 1, 2, 3");
sewardj4e1c1912012-08-08 22:22:26 +00001282 __asm__ __volatile__("dcffix 1, 2");
sewardjb0ccb4d2012-04-02 10:22:05 +00001283]])], [
1284ac_gcc_have_dfp=yes
1285AC_MSG_RESULT([yes])
1286], [
1287ac_gcc_have_dfp=no
1288AC_MSG_RESULT([no])
1289])
1290
sewardjb0ccb4d2012-04-02 10:22:05 +00001291CFLAGS=$safe_CFLAGS
1292
1293AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes -a x$ac_gcc_have_dfp = xyes)
sewardjf34eb492011-04-15 11:57:05 +00001294
sewardj4e1c1912012-08-08 22:22:26 +00001295
florian46825982012-11-10 22:35:24 +00001296AC_MSG_CHECKING([that compiler knows DFP datatypes])
1297AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1298]], [[
1299 _Decimal64 x = 0.0DD;
1300]])], [
1301ac_gcc_have_dfp_type=yes
1302AC_MSG_RESULT([yes])
1303], [
1304ac_gcc_have_dfp_type=no
1305AC_MSG_RESULT([no])
1306])
1307
1308AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_gcc_have_dfp_type = xyes)
1309
carlldfbf2942013-08-12 18:04:22 +00001310# isa 2.07 checking
1311AC_MSG_CHECKING([that assembler knows ISA 2.07 ])
1312
1313AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1314]], [[
1315 __asm__ __volatile__("mtvsrd 1,2 ");
1316]])], [
1317ac_asm_have_isa_2_07=yes
1318AC_MSG_RESULT([yes])
1319], [
1320ac_asm_have_isa_2_07=no
1321AC_MSG_RESULT([no])
1322])
1323
1324AM_CONDITIONAL(HAS_ISA_2_07, test x$ac_asm_have_isa_2_07 = xyes)
florian46825982012-11-10 22:35:24 +00001325
bart36dd85a2009-04-26 07:11:48 +00001326# Check for pthread_create@GLIBC2.0
1327AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1328
bart16e1c5a2009-04-26 07:38:53 +00001329safe_CFLAGS=$CFLAGS
1330CFLAGS="-lpthread"
bart417cf3e2011-10-22 09:21:24 +00001331AC_LINK_IFELSE([AC_LANG_PROGRAM([[
bart36dd85a2009-04-26 07:11:48 +00001332extern int pthread_create_glibc_2_0(void*, const void*,
1333 void *(*)(void*), void*);
1334__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
bart417cf3e2011-10-22 09:21:24 +00001335]], [[
bart276ed3a2009-05-10 15:41:45 +00001336#ifdef __powerpc__
1337/*
1338 * Apparently on PowerPC linking this program succeeds and generates an
1339 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1340 */
1341#error This test does not work properly on PowerPC.
1342#else
bart16e1c5a2009-04-26 07:38:53 +00001343 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001344#endif
bart16e1c5a2009-04-26 07:38:53 +00001345 return 0;
bart417cf3e2011-10-22 09:21:24 +00001346]])], [
bart36dd85a2009-04-26 07:11:48 +00001347ac_have_pthread_create_glibc_2_0=yes
1348AC_MSG_RESULT([yes])
1349AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1350 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1351], [
1352ac_have_pthread_create_glibc_2_0=no
1353AC_MSG_RESULT([no])
1354])
bart16e1c5a2009-04-26 07:38:53 +00001355CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001356
1357AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001358 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001359
1360
barta50aa8a2008-04-27 06:06:57 +00001361# Check for eventfd_t, eventfd() and eventfd_read()
1362AC_MSG_CHECKING([for eventfd()])
1363
bart417cf3e2011-10-22 09:21:24 +00001364AC_LINK_IFELSE([AC_LANG_PROGRAM([[
barta50aa8a2008-04-27 06:06:57 +00001365#include <sys/eventfd.h>
bart417cf3e2011-10-22 09:21:24 +00001366]], [[
barta50aa8a2008-04-27 06:06:57 +00001367 eventfd_t ev;
1368 int fd;
1369
1370 fd = eventfd(5, 0);
1371 eventfd_read(fd, &ev);
1372 return 0;
bart417cf3e2011-10-22 09:21:24 +00001373]])], [
barta50aa8a2008-04-27 06:06:57 +00001374AC_MSG_RESULT([yes])
1375AC_DEFINE([HAVE_EVENTFD], 1,
1376 [Define to 1 if you have the `eventfd' function.])
1377AC_DEFINE([HAVE_EVENTFD_READ], 1,
1378 [Define to 1 if you have the `eventfd_read' function.])
1379], [
1380AC_MSG_RESULT([no])
1381])
1382
1383
florian24fefb62013-10-08 13:04:00 +00001384# Check whether compiler can process #include <thread> without errors
1385# clang 3.3 cannot process <thread> from e.g.
1386# gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1387
1388AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1389AC_LANG(C++)
1390safe_CXXFLAGS=$CXXFLAGS
1391CXXFLAGS=-std=c++0x
1392
1393AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1394#include <thread>
1395])],
1396[
1397ac_cxx_can_include_thread_header=yes
1398AC_MSG_RESULT([yes])
1399], [
1400ac_cxx_can_include_thread_header=no
1401AC_MSG_RESULT([no])
1402])
1403CXXFLAGS=$safe_CXXFLAGS
1404AC_LANG(C)
1405
1406AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1407
njn7fd6d382009-01-22 21:56:32 +00001408#----------------------------------------------------------------------------
1409# Checking for supported compiler flags.
1410#----------------------------------------------------------------------------
1411
sewardj535c50f2005-06-04 23:14:53 +00001412# does this compiler support -m32 ?
1413AC_MSG_CHECKING([if gcc accepts -m32])
1414
1415safe_CFLAGS=$CFLAGS
1416CFLAGS="-m32"
1417
bart417cf3e2011-10-22 09:21:24 +00001418AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001419 return 0;
bart417cf3e2011-10-22 09:21:24 +00001420]])], [
sewardj535c50f2005-06-04 23:14:53 +00001421FLAG_M32="-m32"
1422AC_MSG_RESULT([yes])
1423], [
1424FLAG_M32=""
1425AC_MSG_RESULT([no])
1426])
1427CFLAGS=$safe_CFLAGS
1428
1429AC_SUBST(FLAG_M32)
1430
1431
sewardj01262142006-01-04 01:20:28 +00001432# does this compiler support -m64 ?
1433AC_MSG_CHECKING([if gcc accepts -m64])
1434
1435safe_CFLAGS=$CFLAGS
1436CFLAGS="-m64"
1437
bart417cf3e2011-10-22 09:21:24 +00001438AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001439 return 0;
bart417cf3e2011-10-22 09:21:24 +00001440]])], [
sewardj01262142006-01-04 01:20:28 +00001441FLAG_M64="-m64"
1442AC_MSG_RESULT([yes])
1443], [
1444FLAG_M64=""
1445AC_MSG_RESULT([no])
1446])
1447CFLAGS=$safe_CFLAGS
1448
1449AC_SUBST(FLAG_M64)
1450
1451
sewardj67f1fcc2005-07-03 10:41:02 +00001452# does this compiler support -mmmx ?
1453AC_MSG_CHECKING([if gcc accepts -mmmx])
1454
1455safe_CFLAGS=$CFLAGS
1456CFLAGS="-mmmx"
1457
bart417cf3e2011-10-22 09:21:24 +00001458AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001459 return 0;
bart417cf3e2011-10-22 09:21:24 +00001460]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001461FLAG_MMMX="-mmmx"
1462AC_MSG_RESULT([yes])
1463], [
1464FLAG_MMMX=""
1465AC_MSG_RESULT([no])
1466])
1467CFLAGS=$safe_CFLAGS
1468
1469AC_SUBST(FLAG_MMMX)
1470
1471
1472# does this compiler support -msse ?
1473AC_MSG_CHECKING([if gcc accepts -msse])
1474
1475safe_CFLAGS=$CFLAGS
1476CFLAGS="-msse"
1477
bart417cf3e2011-10-22 09:21:24 +00001478AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001479 return 0;
bart417cf3e2011-10-22 09:21:24 +00001480]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001481FLAG_MSSE="-msse"
1482AC_MSG_RESULT([yes])
1483], [
1484FLAG_MSSE=""
1485AC_MSG_RESULT([no])
1486])
1487CFLAGS=$safe_CFLAGS
1488
1489AC_SUBST(FLAG_MSSE)
1490
1491
sewardj5b754b42002-06-03 22:53:35 +00001492# does this compiler support -mpreferred-stack-boundary=2 ?
1493AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1494
daywalker3664f562003-10-17 13:43:46 +00001495safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001496CFLAGS="-mpreferred-stack-boundary=2"
1497
bart417cf3e2011-10-22 09:21:24 +00001498AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001499 return 0;
bart417cf3e2011-10-22 09:21:24 +00001500]])], [
sewardj5b754b42002-06-03 22:53:35 +00001501PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001502AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001503], [
1504PREFERRED_STACK_BOUNDARY=""
1505AC_MSG_RESULT([no])
1506])
daywalker3664f562003-10-17 13:43:46 +00001507CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001508
1509AC_SUBST(PREFERRED_STACK_BOUNDARY)
1510
sewardj535c50f2005-06-04 23:14:53 +00001511
florianda8c1262012-11-18 14:39:11 +00001512# does this compiler support -Wno-pointer-sign ?
1513AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
1514
1515safe_CFLAGS=$CFLAGS
1516CFLAGS="-Wno-pointer-sign"
1517
1518AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1519 return 0;
1520]])], [
1521no_pointer_sign=yes
1522AC_MSG_RESULT([yes])
1523], [
1524no_pointer_sign=no
1525AC_MSG_RESULT([no])
1526])
1527CFLAGS=$safe_CFLAGS
1528
1529AM_CONDITIONAL(HAS_POINTER_SIGN_WARNING, test x$no_pointer_sign = xyes)
1530
1531
florian6bd9dc12012-11-23 16:17:43 +00001532# does this compiler support -Wno-write-strings ?
1533AC_MSG_CHECKING([if gcc accepts -Wwrite-strings])
1534
1535safe_CFLAGS=$CFLAGS
1536CFLAGS="-Wwrite-strings"
1537
1538AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1539 return 0;
1540]])], [
1541no_write_strings=yes
1542AC_MSG_RESULT([yes])
1543], [
1544no_write_strings=no
1545AC_MSG_RESULT([no])
1546])
1547CFLAGS=$safe_CFLAGS
1548
1549if test x$no_write_strings = xyes; then
1550 CFLAGS="$CFLAGS -Wwrite-strings"
floriand79b3bf2013-10-02 15:14:59 +00001551 CXXFLAGS="$CXXFLAGS -Wwrite-strings"
florian6bd9dc12012-11-23 16:17:43 +00001552fi
1553
1554AM_CONDITIONAL(HAS_WRITE_STRINGS_WARNING, test x$no_write_strings = xyes)
1555
barte026bd22009-07-04 12:17:07 +00001556# does this compiler support -Wno-empty-body ?
1557
1558AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1559
1560safe_CFLAGS=$CFLAGS
1561CFLAGS="-Wno-empty-body"
1562
bart417cf3e2011-10-22 09:21:24 +00001563AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
barte026bd22009-07-04 12:17:07 +00001564 return 0;
bart417cf3e2011-10-22 09:21:24 +00001565]])], [
barte026bd22009-07-04 12:17:07 +00001566AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1567AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001568], [
barte026bd22009-07-04 12:17:07 +00001569AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1570AC_MSG_RESULT([no])
1571])
1572CFLAGS=$safe_CFLAGS
1573
1574
bart9d865fa2008-06-23 12:11:49 +00001575# does this compiler support -Wno-format-zero-length ?
1576
1577AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1578
1579safe_CFLAGS=$CFLAGS
1580CFLAGS="-Wno-format-zero-length"
1581
bart417cf3e2011-10-22 09:21:24 +00001582AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart9d865fa2008-06-23 12:11:49 +00001583 return 0;
bart417cf3e2011-10-22 09:21:24 +00001584]])], [
bart9d865fa2008-06-23 12:11:49 +00001585AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1586AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001587], [
bart9d865fa2008-06-23 12:11:49 +00001588AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1589AC_MSG_RESULT([no])
1590])
1591CFLAGS=$safe_CFLAGS
1592
1593
bart8e216312011-05-15 17:05:36 +00001594# does this compiler support -Wno-nonnull ?
1595
1596AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
1597
1598safe_CFLAGS=$CFLAGS
1599CFLAGS="-Wno-nonnull"
1600
bart417cf3e2011-10-22 09:21:24 +00001601AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart8e216312011-05-15 17:05:36 +00001602 return 0;
bart417cf3e2011-10-22 09:21:24 +00001603]])], [
bart8e216312011-05-15 17:05:36 +00001604AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
1605AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001606], [
bart8e216312011-05-15 17:05:36 +00001607AC_SUBST([FLAG_W_NO_NONNULL], [])
1608AC_MSG_RESULT([no])
1609])
1610CFLAGS=$safe_CFLAGS
1611
1612
1613# does this compiler support -Wno-overflow ?
1614
1615AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
1616
1617safe_CFLAGS=$CFLAGS
1618CFLAGS="-Wno-overflow"
1619
bart417cf3e2011-10-22 09:21:24 +00001620AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart8e216312011-05-15 17:05:36 +00001621 return 0;
bart417cf3e2011-10-22 09:21:24 +00001622]])], [
bart8e216312011-05-15 17:05:36 +00001623AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
1624AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001625], [
bart8e216312011-05-15 17:05:36 +00001626AC_SUBST([FLAG_W_NO_OVERFLOW], [])
1627AC_MSG_RESULT([no])
1628])
1629CFLAGS=$safe_CFLAGS
1630
1631
bartbf9b85c2009-08-12 12:55:56 +00001632# does this compiler support -Wno-uninitialized ?
1633
1634AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1635
1636safe_CFLAGS=$CFLAGS
1637CFLAGS="-Wno-uninitialized"
1638
bart417cf3e2011-10-22 09:21:24 +00001639AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bartbf9b85c2009-08-12 12:55:56 +00001640 return 0;
bart417cf3e2011-10-22 09:21:24 +00001641]])], [
bartbf9b85c2009-08-12 12:55:56 +00001642AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1643AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001644], [
bartbf9b85c2009-08-12 12:55:56 +00001645AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1646AC_MSG_RESULT([no])
1647])
1648CFLAGS=$safe_CFLAGS
1649
1650
bart56730cd2008-05-11 06:41:46 +00001651# does this compiler support -Wextra or the older -W ?
1652
1653AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1654
1655safe_CFLAGS=$CFLAGS
1656CFLAGS="-Wextra"
1657
bart417cf3e2011-10-22 09:21:24 +00001658AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001659 return 0;
bart417cf3e2011-10-22 09:21:24 +00001660]])], [
bart56730cd2008-05-11 06:41:46 +00001661AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1662AC_MSG_RESULT([-Wextra])
1663], [
1664 CFLAGS="-W"
sewardj9bdf2a62011-10-27 06:22:23 +00001665 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001666 return 0;
sewardj9bdf2a62011-10-27 06:22:23 +00001667 ]])], [
bart56730cd2008-05-11 06:41:46 +00001668 AC_SUBST([FLAG_W_EXTRA], [-W])
1669 AC_MSG_RESULT([-W])
1670 ], [
1671 AC_SUBST([FLAG_W_EXTRA], [])
1672 AC_MSG_RESULT([not supported])
1673 ])
1674])
1675CFLAGS=$safe_CFLAGS
1676
1677
sewardja72c26d2007-05-01 13:44:08 +00001678# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001679AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001680
1681safe_CFLAGS=$CFLAGS
1682CFLAGS="-fno-stack-protector"
1683
bart417cf3e2011-10-22 09:21:24 +00001684AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001685 return 0;
bart417cf3e2011-10-22 09:21:24 +00001686]])], [
sewardja72c26d2007-05-01 13:44:08 +00001687no_stack_protector=yes
1688FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1689AC_MSG_RESULT([yes])
1690], [
1691no_stack_protector=no
1692FLAG_FNO_STACK_PROTECTOR=""
1693AC_MSG_RESULT([no])
1694])
1695CFLAGS=$safe_CFLAGS
1696
1697AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1698
1699if test x$no_stack_protector = xyes; then
1700 CFLAGS="$CFLAGS -fno-stack-protector"
floriand79b3bf2013-10-02 15:14:59 +00001701 CXXFLAGS="$CXXFLAGS -fno-stack-protector"
sewardja72c26d2007-05-01 13:44:08 +00001702fi
1703
1704
bart56730cd2008-05-11 06:41:46 +00001705# does this compiler support --param inline-unit-growth=... ?
1706
1707AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1708
1709safe_CFLAGS=$CFLAGS
1710CFLAGS="--param inline-unit-growth=900"
1711
bart417cf3e2011-10-22 09:21:24 +00001712AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001713 return 0;
bart417cf3e2011-10-22 09:21:24 +00001714]])], [
bart56730cd2008-05-11 06:41:46 +00001715AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1716 ["--param inline-unit-growth=900"])
1717AC_MSG_RESULT([yes])
1718], [
1719AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1720AC_MSG_RESULT([no])
1721])
1722CFLAGS=$safe_CFLAGS
1723
1724
sewardjd9350682012-04-05 07:55:47 +00001725# does this compiler support -gdwarf-4 -fdebug-types-section ?
1726
1727AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
1728
1729safe_CFLAGS=$CFLAGS
1730CFLAGS="-gdwarf-4 -fdebug-types-section"
1731
1732AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1733 return 0;
1734]])], [
1735ac_have_dwarf4=yes
1736AC_MSG_RESULT([yes])
1737], [
1738ac_have_dwarf4=no
1739AC_MSG_RESULT([no])
1740])
1741AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
1742CFLAGS=$safe_CFLAGS
1743
1744
florian3df02112013-10-04 11:35:50 +00001745# does this compiler support -gstabs ?
1746
1747AC_MSG_CHECKING([if gcc accepts -gstabs])
1748
1749safe_CFLAGS=$CFLAGS
1750CFLAGS="-gstabs"
1751AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1752 return 0;
1753]])], [
1754ac_have_gstabs=yes
1755AC_MSG_RESULT([yes])
1756], [
1757ac_have_gstabs=no
1758AC_MSG_RESULT([no])
1759])
1760CFLAGS=$safe_CFLAGS
1761AM_CONDITIONAL([HAVE_GSTABS], [test x$ac_have_gstabs = xyes])
1762
1763
1764# does this compiler support nested functions ?
1765
1766AC_MSG_CHECKING([if gcc accepts nested functions])
1767
1768AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1769 int foo() { return 1; }
1770 return foo();
1771]])], [
1772ac_have_nested_functions=yes
1773AC_MSG_RESULT([yes])
1774], [
1775ac_have_nested_functions=no
1776AC_MSG_RESULT([no])
1777])
1778AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
1779
1780
1781# does this compiler support the 'p' constraint in ASM statements ?
1782
1783AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
1784
1785AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1786 char *p;
1787 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
1788]])], [
1789ac_have_asm_constraint_p=yes
1790AC_MSG_RESULT([yes])
1791], [
1792ac_have_asm_constraint_p=no
1793AC_MSG_RESULT([no])
1794])
1795AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
1796
1797
sewardje4bc7032013-03-22 11:49:46 +00001798# We want to use use the -Ttext-segment option to the linker.
1799# GNU (bfd) ld supports this directly. Newer GNU gold linkers
1800# support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
1801# semantics are NOT what we want (GNU gold -Ttext is fine).
1802#
1803# For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
1804# will reside. -Ttext aligns just the .text section start (but not any
1805# other section).
1806#
1807# So test for -Ttext-segment which is supported by all bfd ld versions
1808# and use that if it exists. If it doesn't exist it must be an older
1809# version of gold and we can fall back to using -Ttext which has the
1810# right semantics.
bart699fbac2010-06-08 18:23:59 +00001811
sewardje4bc7032013-03-22 11:49:46 +00001812AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
bart699fbac2010-06-08 18:23:59 +00001813
1814safe_CFLAGS=$CFLAGS
mjw941277a2013-04-17 19:11:05 +00001815CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml"
bart699fbac2010-06-08 18:23:59 +00001816
bart8508c752010-06-10 06:26:21 +00001817AC_LINK_IFELSE(
mjw941277a2013-04-17 19:11:05 +00001818[AC_LANG_SOURCE([int _start () { return 0; }])],
bart699fbac2010-06-08 18:23:59 +00001819[
tom04ce9f52013-03-28 15:53:21 +00001820 linker_using_t_text="no"
sewardje4bc7032013-03-22 11:49:46 +00001821 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
bart699fbac2010-06-08 18:23:59 +00001822 AC_MSG_RESULT([yes])
1823], [
tom04ce9f52013-03-28 15:53:21 +00001824 linker_using_t_text="yes"
sewardje4bc7032013-03-22 11:49:46 +00001825 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
bart699fbac2010-06-08 18:23:59 +00001826 AC_MSG_RESULT([no])
1827])
1828CFLAGS=$safe_CFLAGS
1829
tom04ce9f52013-03-28 15:53:21 +00001830# If the linker only supports -Ttext (not -Ttext-segment) then we will
1831# have to strip any build-id ELF NOTEs from the staticly linked tools.
1832# Otherwise the build-id NOTE might end up at the default load address.
1833# (Pedantically if the linker is gold then -Ttext is fine, but newer
1834# gold versions also support -Ttext-segment. So just assume that unless
1835# we can use -Ttext-segment we need to strip the build-id NOTEs.
1836if test "x${linker_using_t_text}" == "xyes"; then
1837AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
1838# does the linker support -Wl,--build-id=none ? Note, it's
1839# important that we test indirectly via whichever C compiler
1840# is selected, rather than testing /usr/bin/ld or whatever
1841# directly.
1842AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
1843safe_CFLAGS=$CFLAGS
1844CFLAGS="-Wl,--build-id=none"
1845
1846AC_LINK_IFELSE(
1847[AC_LANG_PROGRAM([ ], [return 0;])],
1848[
1849 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1850 AC_MSG_RESULT([yes])
1851], [
1852 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1853 AC_MSG_RESULT([no])
1854])
1855else
1856AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
1857AC_SUBST([FLAG_NO_BUILD_ID], [""])
1858fi
1859CFLAGS=$safe_CFLAGS
bart699fbac2010-06-08 18:23:59 +00001860
sewardj00f1e622006-03-12 16:47:10 +00001861# does the ppc assembler support "mtocrf" et al?
1862AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1863
bart417cf3e2011-10-22 09:21:24 +00001864AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjdd4cbe12006-03-12 17:27:44 +00001865__asm__ __volatile__("mtocrf 4,0");
1866__asm__ __volatile__("mfocrf 0,4");
bart417cf3e2011-10-22 09:21:24 +00001867]])], [
sewardj00f1e622006-03-12 16:47:10 +00001868ac_have_as_ppc_mftocrf=yes
1869AC_MSG_RESULT([yes])
1870], [
1871ac_have_as_ppc_mftocrf=no
1872AC_MSG_RESULT([no])
1873])
1874if test x$ac_have_as_ppc_mftocrf = xyes ; then
1875 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1876fi
1877
1878
carll1e5fa2f2013-08-09 21:55:45 +00001879# does the ppc assembler support "lfdp" and other phased out floating point insns?
1880AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
1881
1882AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1883 do { typedef struct {
1884 double hi;
1885 double lo;
1886 } dbl_pair_t;
1887 dbl_pair_t dbl_pair[3];
1888 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
1889 } while (0)
1890]])], [
1891ac_have_as_ppc_fpPO=yes
1892AC_MSG_RESULT([yes])
1893], [
1894ac_have_as_ppc_fpPO=no
1895AC_MSG_RESULT([no])
1896])
1897if test x$ac_have_as_ppc_fpPO = xyes ; then
1898 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
1899fi
1900
sewardjb5b87402011-03-07 16:05:35 +00001901CFLAGS=$safe_CFLAGS
1902
sewardjf0aabf82007-03-22 00:24:21 +00001903# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001904# Note, this doesn't generate a C-level symbol. It generates a
1905# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001906AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1907
bart417cf3e2011-10-22 09:21:24 +00001908AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjf0aabf82007-03-22 00:24:21 +00001909 do { long long int x;
1910 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1911 while (0)
bart417cf3e2011-10-22 09:21:24 +00001912]])], [
sewardjf0aabf82007-03-22 00:24:21 +00001913ac_have_as_sse3=yes
1914AC_MSG_RESULT([yes])
1915], [
1916ac_have_as_sse3=no
1917AC_MSG_RESULT([no])
1918])
sewardjfa18a262007-03-22 12:13:13 +00001919
1920AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001921
1922
sewardj6d6da5b2008-02-09 12:07:40 +00001923# Ditto for SSSE3 instructions (note extra S)
1924# Note, this doesn't generate a C-level symbol. It generates a
1925# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1926AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1927
florianc443b962011-10-28 21:37:19 +00001928save_CFLAGS="$CFLAGS"
1929CFLAGS="$CFLAGS -msse"
bart417cf3e2011-10-22 09:21:24 +00001930AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj6d6da5b2008-02-09 12:07:40 +00001931 do { long long int x;
1932 __asm__ __volatile__(
1933 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1934 while (0)
bart417cf3e2011-10-22 09:21:24 +00001935]])], [
sewardj6d6da5b2008-02-09 12:07:40 +00001936ac_have_as_ssse3=yes
1937AC_MSG_RESULT([yes])
1938], [
1939ac_have_as_ssse3=no
1940AC_MSG_RESULT([no])
1941])
florianc443b962011-10-28 21:37:19 +00001942CFLAGS="$save_CFLAGS"
sewardj6d6da5b2008-02-09 12:07:40 +00001943
1944AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1945
1946
sewardj27d176a2011-01-17 11:15:48 +00001947# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1948# Note, this doesn't generate a C-level symbol. It generates a
1949# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00001950AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
bart417cf3e2011-10-22 09:21:24 +00001951AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardje3ae8a32010-09-28 19:59:47 +00001952 do {
1953 __asm__ __volatile__(
1954 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1955 while (0)
bart417cf3e2011-10-22 09:21:24 +00001956]])], [
sewardje3ae8a32010-09-28 19:59:47 +00001957ac_have_as_pclmulqdq=yes
1958AC_MSG_RESULT([yes])
1959], [
1960ac_have_as_pclmulqdq=no
1961AC_MSG_RESULT([no])
1962])
1963
1964AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1965
1966
bart9bbe2bb2012-08-03 19:37:02 +00001967# does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
1968# Note, this doesn't generate a C-level symbol. It generates a
1969# automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
1970AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
1971AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1972 do {
1973 /*
1974 * Carry-less multiplication of xmm1 with xmm2 and store the result in
1975 * xmm3. The immediate is used to determine which quadwords of xmm1 and
1976 * xmm2 should be used.
1977 */
1978 __asm__ __volatile__(
1979 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
1980 } while (0)
1981]])], [
1982ac_have_as_vpclmulqdq=yes
1983AC_MSG_RESULT([yes])
1984], [
1985ac_have_as_vpclmulqdq=no
1986AC_MSG_RESULT([no])
1987])
1988
1989AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
1990
1991
sewardj27d176a2011-01-17 11:15:48 +00001992# does the x86/amd64 assembler understand the LZCNT instruction?
1993# Note, this doesn't generate a C-level symbol. It generates a
1994# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00001995AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1996
bart417cf3e2011-10-22 09:21:24 +00001997AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
bart55e438b2010-09-14 10:53:57 +00001998 do {
sewardjc62291c2012-07-22 11:10:08 +00001999 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
bart55e438b2010-09-14 10:53:57 +00002000 } while (0)
bart417cf3e2011-10-22 09:21:24 +00002001]])], [
bart55e438b2010-09-14 10:53:57 +00002002 ac_have_as_lzcnt=yes
2003 AC_MSG_RESULT([yes])
2004], [
2005 ac_have_as_lzcnt=no
2006 AC_MSG_RESULT([no])
2007])
2008
2009AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2010
sewardj27d176a2011-01-17 11:15:48 +00002011
florian3df02112013-10-04 11:35:50 +00002012# does the x86/amd64 assembler understand the LOOPNEL instruction?
2013# Note, this doesn't generate a C-level symbol. It generates a
2014# automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2015AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2016
2017AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2018 do {
2019 __asm__ __volatile__("1: loopnel 1b\n");
2020 } while (0)
2021]])], [
2022 ac_have_as_loopnel=yes
2023 AC_MSG_RESULT([yes])
2024], [
2025 ac_have_as_loopnel=no
2026 AC_MSG_RESULT([no])
2027])
2028
2029AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2030
2031
2032# does the x86/amd64 assembler understand ADDR32 ?
2033# Note, this doesn't generate a C-level symbol. It generates a
2034# automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2035AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2036
2037AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2038 do {
2039 asm volatile ("addr32 rep movsb");
2040 } while (0)
2041]])], [
2042 ac_have_as_addr32=yes
2043 AC_MSG_RESULT([yes])
2044], [
2045 ac_have_as_addr32=no
2046 AC_MSG_RESULT([no])
2047])
2048
2049AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2050
2051
sewardj27d176a2011-01-17 11:15:48 +00002052# does the x86/amd64 assembler understand SSE 4.2 instructions?
2053# Note, this doesn't generate a C-level symbol. It generates a
2054# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2055AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2056
bart417cf3e2011-10-22 09:21:24 +00002057AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj27d176a2011-01-17 11:15:48 +00002058 do { long long int x;
2059 __asm__ __volatile__(
florianfdfca222012-01-17 13:16:50 +00002060 "crc32q %%r15,%%r15" : : : "r15" );
2061 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002062 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2063 __asm__ __volatile__(
2064 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
sewardj27d176a2011-01-17 11:15:48 +00002065 while (0)
bart417cf3e2011-10-22 09:21:24 +00002066]])], [
sewardj27d176a2011-01-17 11:15:48 +00002067ac_have_as_sse42=yes
2068AC_MSG_RESULT([yes])
2069], [
2070ac_have_as_sse42=no
2071AC_MSG_RESULT([no])
2072])
2073
2074AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2075
2076
sewardj9fb31ca2012-06-05 00:31:49 +00002077# does the x86/amd64 assembler understand AVX instructions?
2078# Note, this doesn't generate a C-level symbol. It generates a
2079# automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2080AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2081
2082AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2083 do { long long int x;
2084 __asm__ __volatile__(
2085 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2086 __asm__ __volatile__(
2087 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2088 while (0)
2089]])], [
2090ac_have_as_avx=yes
2091AC_MSG_RESULT([yes])
2092], [
2093ac_have_as_avx=no
2094AC_MSG_RESULT([no])
2095])
2096
2097AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2098
2099
sewardjfda50af2013-03-27 11:43:20 +00002100# does the x86/amd64 assembler understand AVX2 instructions?
2101# Note, this doesn't generate a C-level symbol. It generates a
2102# automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2103AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2104
2105AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2106 do { long long int x;
2107 __asm__ __volatile__(
2108 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2109 __asm__ __volatile__(
2110 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2111 while (0)
2112]])], [
2113ac_have_as_avx2=yes
2114AC_MSG_RESULT([yes])
2115], [
2116ac_have_as_avx2=no
2117AC_MSG_RESULT([no])
2118])
2119
2120AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2121
2122
sewardj9ea080b2013-10-16 08:53:07 +00002123# does the x86/amd64 assembler understand TSX instructions and
2124# the XACQUIRE/XRELEASE prefixes?
florian364c3652013-09-30 16:32:53 +00002125# Note, this doesn't generate a C-level symbol. It generates a
2126# automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2127AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2128
2129AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2130 do {
2131 __asm__ __volatile__(
2132 " xbegin Lfoo \n\t"
sewardj9ea080b2013-10-16 08:53:07 +00002133 "Lfoo: xend \n\t"
2134 " xacquire lock incq 0(%rsp) \n\t"
2135 " xrelease lock incq 0(%rsp) \n"
2136 );
florian364c3652013-09-30 16:32:53 +00002137 } while (0)
2138]])], [
2139ac_have_as_tsx=yes
2140AC_MSG_RESULT([yes])
2141], [
2142ac_have_as_tsx=no
2143AC_MSG_RESULT([no])
2144])
2145
2146AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2147
2148
sewardjfda50af2013-03-27 11:43:20 +00002149# does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2150# Note, this doesn't generate a C-level symbol. It generates a
2151# automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2152AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2153
2154AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2155 do { unsigned int h, l;
2156 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002157 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
sewardjfda50af2013-03-27 11:43:20 +00002158 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002159 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
sewardjfda50af2013-03-27 11:43:20 +00002160 while (0)
2161]])], [
2162ac_have_as_bmi=yes
2163AC_MSG_RESULT([yes])
2164], [
2165ac_have_as_bmi=no
2166AC_MSG_RESULT([no])
2167])
2168
2169AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2170
2171
2172# does the x86/amd64 assembler understand FMA instructions?
2173# Note, this doesn't generate a C-level symbol. It generates a
2174# automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2175AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2176
2177AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2178 do { unsigned int h, l;
2179 __asm__ __volatile__(
2180 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2181 __asm__ __volatile__(
2182 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2183 __asm__ __volatile__(
2184 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2185 while (0)
2186]])], [
2187ac_have_as_fma=yes
2188AC_MSG_RESULT([yes])
2189], [
2190ac_have_as_fma=no
2191AC_MSG_RESULT([no])
2192])
2193
2194AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2195
2196
sewardjb08d84d2012-07-16 08:23:26 +00002197# does the x86/amd64 assembler understand MOVBE?
2198# Note, this doesn't generate a C-level symbol. It generates a
2199# automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2200AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2201
2202AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2203 do { long long int x;
2204 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002205 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
sewardjb08d84d2012-07-16 08:23:26 +00002206 while (0)
2207]])], [
2208ac_have_as_movbe=yes
2209AC_MSG_RESULT([yes])
2210], [
2211ac_have_as_movbe=no
2212AC_MSG_RESULT([no])
2213])
2214
2215AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2216
2217
florian251c2f92012-07-05 21:21:37 +00002218# Does the C compiler support the "ifunc" attribute
2219# Note, this doesn't generate a C-level symbol. It generates a
2220# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2221AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2222
florianf78a5032012-07-06 09:17:29 +00002223AC_LINK_IFELSE([AC_LANG_SOURCE([[
2224static void mytest(void) {}
2225
2226static void (*resolve_test(void))(void)
2227{
2228 return (void (*)(void))&mytest;
2229}
2230
2231void test(void) __attribute__((ifunc("resolve_test")));
2232
2233int main()
2234{
2235 test();
2236 return 0;
2237}
florian251c2f92012-07-05 21:21:37 +00002238]])], [
2239ac_have_ifunc_attr=yes
2240AC_MSG_RESULT([yes])
2241], [
2242ac_have_ifunc_attr=no
2243AC_MSG_RESULT([no])
2244])
2245
2246AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2247
2248
sewardje089f012010-10-13 21:47:29 +00002249# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2250# when building the tool executables. I think we should get rid of it.
2251#
sewardjb5f6f512005-03-10 23:59:00 +00002252# Check for TLS support in the compiler and linker
bart2bd9a682011-10-22 09:46:16 +00002253AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2254 [[return foo;]])],
2255 [vg_cv_linktime_tls=yes],
2256 [vg_cv_linktime_tls=no])
bartca9f2ad2008-06-02 07:14:20 +00002257# Native compilation: check whether running a program using TLS succeeds.
2258# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2259# succeeds but running programs using TLS fails.
bart2bd9a682011-10-22 09:46:16 +00002260# Cross-compiling: check whether linking a program using TLS succeeds.
bartca9f2ad2008-06-02 07:14:20 +00002261AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2262 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2263 [vg_cv_tls=$enableval],
2264 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2265 [[return foo;]])],
2266 [vg_cv_tls=yes],
bart2bd9a682011-10-22 09:46:16 +00002267 [vg_cv_tls=no],
2268 [vg_cv_tls=$vg_cv_linktime_tls])])])
sewardjb5f6f512005-03-10 23:59:00 +00002269
2270if test "$vg_cv_tls" = yes; then
2271AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2272fi
sewardj5b754b42002-06-03 22:53:35 +00002273
sewardj535c50f2005-06-04 23:14:53 +00002274
njn7fd6d382009-01-22 21:56:32 +00002275#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00002276# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00002277#----------------------------------------------------------------------------
2278
sewardjde4a1d02002-03-22 01:27:54 +00002279AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00002280AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00002281 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00002282 endian.h \
2283 mqueue.h \
2284 sys/endian.h \
2285 sys/epoll.h \
2286 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00002287 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00002288 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00002289 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00002290 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00002291 sys/syscall.h \
2292 sys/time.h \
2293 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00002294 ])
sewardjde4a1d02002-03-22 01:27:54 +00002295
bart818f17e2011-09-17 06:24:49 +00002296# Verify whether the <linux/futex.h> header is usable.
2297AC_MSG_CHECKING([if <linux/futex.h> is usable])
2298
sewardjc12486b2012-12-17 14:46:48 +00002299save_CFLAGS="$CFLAGS"
2300CFLAGS="$CFLAGS -D__user="
bart417cf3e2011-10-22 09:21:24 +00002301AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart818f17e2011-09-17 06:24:49 +00002302#include <linux/futex.h>
bart417cf3e2011-10-22 09:21:24 +00002303]], [[
bart818f17e2011-09-17 06:24:49 +00002304 return FUTEX_WAIT;
bart417cf3e2011-10-22 09:21:24 +00002305]])], [
bart78bfc712011-12-08 16:14:59 +00002306ac_have_usable_linux_futex_h=yes
bart818f17e2011-09-17 06:24:49 +00002307AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
2308 [Define to 1 if you have a usable <linux/futex.h> header file.])
2309AC_MSG_RESULT([yes])
2310], [
bart78bfc712011-12-08 16:14:59 +00002311ac_have_usable_linux_futex_h=no
bart818f17e2011-09-17 06:24:49 +00002312AC_MSG_RESULT([no])
2313])
sewardjc12486b2012-12-17 14:46:48 +00002314CFLAGS="$save_CFLAGS"
2315
bart818f17e2011-09-17 06:24:49 +00002316
njn7fd6d382009-01-22 21:56:32 +00002317#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00002318# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00002319#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00002320AC_TYPE_UID_T
2321AC_TYPE_OFF_T
2322AC_TYPE_SIZE_T
2323AC_HEADER_TIME
2324
sewardj535c50f2005-06-04 23:14:53 +00002325
njn7fd6d382009-01-22 21:56:32 +00002326#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00002327# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00002328#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00002329AC_FUNC_MEMCMP
2330AC_FUNC_MMAP
sewardjde4a1d02002-03-22 01:27:54 +00002331
bart26288e42011-04-03 16:46:01 +00002332AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00002333AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00002334
bartf5ceec82008-04-26 07:45:10 +00002335AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00002336 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00002337 epoll_create \
2338 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00002339 klogctl \
bartf5ceec82008-04-26 07:45:10 +00002340 mallinfo \
2341 memchr \
2342 memset \
2343 mkdir \
njnf76d27a2009-05-28 01:53:07 +00002344 mremap \
bartf5ceec82008-04-26 07:45:10 +00002345 ppoll \
bart6d45e922009-01-20 13:45:38 +00002346 pthread_barrier_init \
2347 pthread_condattr_setclock \
2348 pthread_mutex_timedlock \
2349 pthread_rwlock_timedrdlock \
2350 pthread_rwlock_timedwrlock \
2351 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00002352 pthread_yield \
florianc5325ef2013-09-17 20:15:36 +00002353 pthread_setname_np \
bartd1f724c2009-08-26 18:11:18 +00002354 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00002355 semtimedop \
2356 signalfd \
njn6cc22472009-03-16 03:46:48 +00002357 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00002358 strchr \
2359 strdup \
2360 strpbrk \
2361 strrchr \
2362 strstr \
barta72a27b2010-04-29 06:22:17 +00002363 syscall \
bartf5ceec82008-04-26 07:45:10 +00002364 utimensat \
tom9e4b6362012-02-10 09:39:37 +00002365 process_vm_readv \
2366 process_vm_writev \
bartf5ceec82008-04-26 07:45:10 +00002367 ])
sewardjde4a1d02002-03-22 01:27:54 +00002368
bart623eec32008-07-29 17:54:49 +00002369# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
2370# libraries with any shared object and/or executable. This is NOT what we
2371# want for e.g. vgpreload_core-x86-linux.so
2372LIBS=""
sewardj80637752006-03-02 13:48:21 +00002373
bart6d45e922009-01-20 13:45:38 +00002374AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
2375 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00002376AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
2377 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00002378AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
2379 [test x$ac_cv_func_pthread_spin_lock = xyes])
florianc5325ef2013-09-17 20:15:36 +00002380AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
2381 [test x$ac_cv_func_pthread_setname_np = xyes])
bart6d45e922009-01-20 13:45:38 +00002382
petarjc37cea62013-06-02 18:08:04 +00002383if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2384 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
petarj6d79b742012-12-20 18:56:57 +00002385 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
petarjc37cea62013-06-02 18:08:04 +00002386 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
petarj6d79b742012-12-20 18:56:57 +00002387fi
njn7fd6d382009-01-22 21:56:32 +00002388
2389#----------------------------------------------------------------------------
2390# MPI checks
2391#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00002392# Do we have a useable MPI setup on the primary and/or secondary targets?
2393# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00002394# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00002395# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00002396# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00002397MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00002398
sewardje9fa5062006-03-12 18:29:18 +00002399mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00002400if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00002401 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj5db15402012-06-07 09:13:21 +00002402 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +00002403 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2404 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00002405 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00002406elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00002407 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
2408 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00002409 mflag_primary=$FLAG_M64
philippef7c54332012-05-17 15:32:54 +00002410elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
2411 mflag_primary="$FLAG_M32 -arch i386"
2412elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
2413 mflag_primary="$FLAG_M64 -arch x86_64"
sewardje9fa5062006-03-12 18:29:18 +00002414fi
2415
sewardj03d86f22006-10-17 00:57:24 +00002416mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00002417if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
2418 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00002419 mflag_secondary=$FLAG_M32
philippef7c54332012-05-17 15:32:54 +00002420elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
2421 mflag_secondary="$FLAG_M32 -arch i386"
sewardj03d86f22006-10-17 00:57:24 +00002422fi
2423
2424
sewardj0ad46092006-03-02 17:09:16 +00002425AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00002426 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00002427 MPI_CC=$withval
2428)
sewardj03d86f22006-10-17 00:57:24 +00002429AC_SUBST(MPI_CC)
2430
philippef7c54332012-05-17 15:32:54 +00002431## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
2432## use these values in the check for a functioning mpicc.
2433##
2434## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
2435## mflag_primary/mflag_secondary are sufficient approximations of that behavior
2436AM_COND_IF([VGCONF_OS_IS_LINUX],
2437 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
2438 LDFLAGS_MPI="-fpic -shared"])
2439AM_COND_IF([VGCONF_OS_IS_DARWIN],
2440 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
2441 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
2442
2443AC_SUBST([CFLAGS_MPI])
2444AC_SUBST([LDFLAGS_MPI])
2445
2446
sewardj03d86f22006-10-17 00:57:24 +00002447## See if MPI_CC works for the primary target
2448##
2449AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00002450saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00002451saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00002452CC=$MPI_CC
philippef7c54332012-05-17 15:32:54 +00002453CFLAGS="$CFLAGS_MPI $mflag_primary"
2454saved_LDFLAGS="$LDFLAGS"
2455LDFLAGS="$LDFLAGS_MPI $mflag_primary"
bart417cf3e2011-10-22 09:21:24 +00002456AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj1a85e602006-03-08 15:26:10 +00002457#include <mpi.h>
2458#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00002459]], [[
philippef7c54332012-05-17 15:32:54 +00002460 int ni, na, nd, comb;
sewardjde4f3842006-03-09 02:41:41 +00002461 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00002462 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2463 r |= MPI_Finalize();
sewardjde4f3842006-03-09 02:41:41 +00002464 return r;
bart417cf3e2011-10-22 09:21:24 +00002465]])], [
sewardj03d86f22006-10-17 00:57:24 +00002466ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00002467AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00002468], [
sewardj03d86f22006-10-17 00:57:24 +00002469ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00002470AC_MSG_RESULT([no])
2471])
sewardj0ad46092006-03-02 17:09:16 +00002472CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00002473CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00002474LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00002475AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00002476
sewardj03d86f22006-10-17 00:57:24 +00002477## See if MPI_CC works for the secondary target. Complication: what if
2478## there is no secondary target? We need this to then fail.
2479## Kludge this by making MPI_CC something which will surely fail in
2480## such a case.
2481##
2482AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
2483saved_CC=$CC
2484saved_CFLAGS=$CFLAGS
philippef7c54332012-05-17 15:32:54 +00002485saved_LDFLAGS="$LDFLAGS"
2486LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
njn7fd6d382009-01-22 21:56:32 +00002487if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00002488 CC="$MPI_CC this will surely fail"
2489else
2490 CC=$MPI_CC
2491fi
philippef7c54332012-05-17 15:32:54 +00002492CFLAGS="$CFLAGS_MPI $mflag_secondary"
bart417cf3e2011-10-22 09:21:24 +00002493AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj03d86f22006-10-17 00:57:24 +00002494#include <mpi.h>
2495#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00002496]], [[
philippef7c54332012-05-17 15:32:54 +00002497 int ni, na, nd, comb;
sewardj03d86f22006-10-17 00:57:24 +00002498 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00002499 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2500 r |= MPI_Finalize();
sewardj03d86f22006-10-17 00:57:24 +00002501 return r;
bart417cf3e2011-10-22 09:21:24 +00002502]])], [
sewardj03d86f22006-10-17 00:57:24 +00002503ac_have_mpi2_sec=yes
2504AC_MSG_RESULT([yes, $MPI_CC])
2505], [
2506ac_have_mpi2_sec=no
2507AC_MSG_RESULT([no])
2508])
2509CC=$saved_CC
2510CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00002511LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00002512AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00002513
2514
njn7fd6d382009-01-22 21:56:32 +00002515#----------------------------------------------------------------------------
2516# Other library checks
2517#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00002518# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00002519# tests are present because Drd has some regression tests that use
2520# these packages. All regression test programs all compiled only
2521# for the primary target. And so it is important that the configure
2522# checks that follow, use the correct -m32 or -m64 flag for the
2523# primary target (called $mflag_primary). Otherwise, we can end up
2524# in a situation (eg) where, on amd64-linux, the test for Boost checks
2525# for usable 64-bit Boost facilities, but because we are doing a 32-bit
2526# only build (meaning, the primary target is x86-linux), the build
2527# of the regtest programs that use Boost fails, because they are
2528# build as 32-bit (IN THIS EXAMPLE).
2529#
2530# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
2531# NEEDED BY THE REGRESSION TEST PROGRAMS.
2532
2533
sewardj493c4ef2008-12-13 16:45:19 +00002534# Check whether the boost library 1.35 or later has been installed.
2535# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
2536
2537AC_MSG_CHECKING([for boost])
2538
2539AC_LANG(C++)
2540safe_CXXFLAGS=$CXXFLAGS
bart7129c722012-04-18 18:34:22 +00002541CXXFLAGS="$mflag_primary"
2542safe_LIBS="$LIBS"
2543LIBS="-lboost_thread-mt $LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00002544
bart128fc522011-03-12 10:36:35 +00002545AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00002546#include <boost/thread.hpp>
2547static void thread_func(void)
2548{ }
2549int main(int argc, char** argv)
2550{
2551 boost::thread t(thread_func);
2552 return 0;
2553}
bart128fc522011-03-12 10:36:35 +00002554])],
sewardj493c4ef2008-12-13 16:45:19 +00002555[
2556ac_have_boost_1_35=yes
2557AC_SUBST([BOOST_CFLAGS], [])
bartbb31f2d2012-04-18 18:42:34 +00002558AC_SUBST([BOOST_LIBS], [-lboost_thread-mt])
sewardj493c4ef2008-12-13 16:45:19 +00002559AC_MSG_RESULT([yes])
2560], [
2561ac_have_boost_1_35=no
2562AC_MSG_RESULT([no])
2563])
2564
bart7129c722012-04-18 18:34:22 +00002565LIBS="$safe_LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00002566CXXFLAGS=$safe_CXXFLAGS
2567AC_LANG(C)
2568
2569AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
2570
2571
2572# does this compiler support -fopenmp, does it have the include file
2573# <omp.h> and does it have libgomp ?
2574
2575AC_MSG_CHECKING([for OpenMP])
2576
2577safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00002578CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00002579
bart128fc522011-03-12 10:36:35 +00002580AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00002581#include <omp.h>
2582int main(int argc, char** argv)
2583{
2584 omp_set_dynamic(0);
2585 return 0;
2586}
bart128fc522011-03-12 10:36:35 +00002587])],
sewardj493c4ef2008-12-13 16:45:19 +00002588[
2589ac_have_openmp=yes
2590AC_MSG_RESULT([yes])
2591], [
2592ac_have_openmp=no
2593AC_MSG_RESULT([no])
2594])
2595CFLAGS=$safe_CFLAGS
2596
2597AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
2598
2599
bart78bfc712011-12-08 16:14:59 +00002600# does this compiler have built-in functions for atomic memory access for the
2601# primary target ?
2602AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
sewardjc876a2f2009-01-22 22:44:30 +00002603
2604safe_CFLAGS=$CFLAGS
2605CFLAGS="$mflag_primary"
2606
bart417cf3e2011-10-22 09:21:24 +00002607AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjc876a2f2009-01-22 22:44:30 +00002608 int variable = 1;
2609 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2610 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00002611]])], [
bartb4ff7822011-12-10 19:48:04 +00002612 ac_have_builtin_atomic_primary=yes
sewardjc876a2f2009-01-22 22:44:30 +00002613 AC_MSG_RESULT([yes])
bart78bfc712011-12-08 16:14:59 +00002614 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 +00002615], [
bartb4ff7822011-12-10 19:48:04 +00002616 ac_have_builtin_atomic_primary=no
sewardjc876a2f2009-01-22 22:44:30 +00002617 AC_MSG_RESULT([no])
2618])
2619
2620CFLAGS=$safe_CFLAGS
2621
bartb4ff7822011-12-10 19:48:04 +00002622AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
2623 [test x$ac_have_builtin_atomic_primary = xyes])
bartc82d1372009-05-31 16:21:23 +00002624
bart78bfc712011-12-08 16:14:59 +00002625
2626# does this compiler have built-in functions for atomic memory access for the
2627# secondary target ?
2628
2629if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2630
2631AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
2632
2633safe_CFLAGS=$CFLAGS
2634CFLAGS="$mflag_secondary"
2635
2636AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2637 int variable = 1;
2638 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
2639]])], [
2640 ac_have_builtin_atomic_secondary=yes
2641 AC_MSG_RESULT([yes])
2642], [
2643 ac_have_builtin_atomic_secondary=no
2644 AC_MSG_RESULT([no])
2645])
2646
2647CFLAGS=$safe_CFLAGS
2648
2649fi
2650
2651AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
2652 [test x$ac_have_builtin_atomic_secondary = xyes])
2653
bart1e856ea2011-12-17 12:53:23 +00002654# does this compiler have built-in functions for atomic memory access on
2655# 64-bit integers for all targets ?
2656
2657AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
2658
2659AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2660 #include <stdint.h>
2661]], [[
2662 uint64_t variable = 1;
2663 return __sync_add_and_fetch(&variable, 1)
2664]])], [
2665 ac_have_builtin_atomic64_primary=yes
2666], [
2667 ac_have_builtin_atomic64_primary=no
2668])
2669
2670if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2671
2672safe_CFLAGS=$CFLAGS
2673CFLAGS="$mflag_secondary"
2674
2675AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2676 #include <stdint.h>
2677]], [[
2678 uint64_t variable = 1;
2679 return __sync_add_and_fetch(&variable, 1)
2680]])], [
2681 ac_have_builtin_atomic64_secondary=yes
2682], [
2683 ac_have_builtin_atomic64_secondary=no
2684])
2685
2686CFLAGS=$safe_CFLAGS
2687
2688fi
2689
2690if test x$ac_have_builtin_atomic64_primary = xyes && \
2691 test x$VGCONF_PLATFORM_SEC_CAPS = x \
2692 -o x$ac_have_builtin_atomic64_secondary = xyes; then
2693 AC_MSG_RESULT([yes])
2694 ac_have_builtin_atomic64=yes
2695else
2696 AC_MSG_RESULT([no])
2697 ac_have_builtin_atomic64=no
2698fi
2699
2700AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
2701 [test x$ac_have_builtin_atomic64 = xyes])
2702
bart78bfc712011-12-08 16:14:59 +00002703
barte8740422011-03-24 20:27:54 +00002704# does g++ have built-in functions for atomic memory access ?
bart78bfc712011-12-08 16:14:59 +00002705AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
barte8740422011-03-24 20:27:54 +00002706
2707safe_CXXFLAGS=$CXXFLAGS
2708CXXFLAGS="$mflag_primary"
2709
2710AC_LANG_PUSH(C++)
bart417cf3e2011-10-22 09:21:24 +00002711AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
barte8740422011-03-24 20:27:54 +00002712 int variable = 1;
2713 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2714 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00002715]])], [
barte8740422011-03-24 20:27:54 +00002716 ac_have_builtin_atomic_cxx=yes
2717 AC_MSG_RESULT([yes])
2718 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 +00002719], [
barte8740422011-03-24 20:27:54 +00002720 ac_have_builtin_atomic_cxx=no
2721 AC_MSG_RESULT([no])
2722])
2723AC_LANG_POP(C++)
2724
2725CXXFLAGS=$safe_CXXFLAGS
2726
2727AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00002728
bart78bfc712011-12-08 16:14:59 +00002729
2730if test x$ac_have_usable_linux_futex_h = xyes \
bartb4ff7822011-12-10 19:48:04 +00002731 -a x$ac_have_builtin_atomic_primary = xyes; then
bart78bfc712011-12-08 16:14:59 +00002732 ac_enable_linux_ticket_lock_primary=yes
2733fi
2734AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
2735 [test x$ac_enable_linux_ticket_lock_primary = xyes])
2736
2737if test x$VGCONF_PLATFORM_SEC_CAPS != x \
2738 -a x$ac_have_usable_linux_futex_h = xyes \
2739 -a x$ac_have_builtin_atomic_secondary = xyes; then
2740 ac_enable_linux_ticket_lock_secondary=yes
2741fi
2742AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
2743 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
2744
2745
bartf68af882011-12-10 19:42:05 +00002746# does libstdc++ support annotating shared pointers ?
2747AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
2748
floriand79b3bf2013-10-02 15:14:59 +00002749safe_CXXFLAGS=$CXXFLAGS
bartf68af882011-12-10 19:42:05 +00002750CXXFLAGS="-std=c++0x"
2751
2752AC_LANG_PUSH(C++)
2753AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2754 #include <memory>
2755]], [[
2756 std::shared_ptr<int> p
2757]])], [
2758 ac_have_shared_ptr=yes
2759], [
2760 ac_have_shared_ptr=no
2761])
2762if test x$ac_have_shared_ptr = xyes; then
2763 # If compilation of the program below fails because of a syntax error
2764 # triggered by substituting one of the annotation macros then that
2765 # means that libstdc++ supports these macros.
2766 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2767 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
2768 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
2769 #include <memory>
2770 ]], [[
2771 std::shared_ptr<int> p
2772 ]])], [
2773 ac_have_shared_pointer_annotation=no
2774 AC_MSG_RESULT([no])
2775 ], [
2776 ac_have_shared_pointer_annotation=yes
2777 AC_MSG_RESULT([yes])
2778 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
2779 [Define to 1 if libstd++ supports annotating shared pointers])
2780 ])
2781else
2782 ac_have_shared_pointer_annotation=no
2783 AC_MSG_RESULT([no])
2784fi
2785AC_LANG_POP(C++)
2786
2787CXXFLAGS=$safe_CXXFLAGS
2788
2789AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
2790 [test x$ac_have_shared_pointer_annotation = xyes])
2791
2792
njn7fd6d382009-01-22 21:56:32 +00002793#----------------------------------------------------------------------------
2794# Ok. We're done checking.
2795#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00002796
njn8b68b642009-06-24 00:37:09 +00002797# Nb: VEX/Makefile is generated from Makefile.vex.in.
2798AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00002799 Makefile
njn8b68b642009-06-24 00:37:09 +00002800 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00002801 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00002802 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00002803 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00002804 docs/Makefile
2805 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00002806 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00002807 perf/Makefile
2808 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00002809 gdbserver_tests/Makefile
njn254d542432002-09-23 16:09:39 +00002810 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00002811 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00002812 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00002813 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002814 memcheck/Makefile
2815 memcheck/tests/Makefile
floriane42cca52013-08-29 17:59:27 +00002816 memcheck/tests/common/Makefile
njnc6168192004-11-29 13:54:10 +00002817 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00002818 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00002819 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00002820 memcheck/tests/darwin/Makefile
njnea2d6fd2010-07-01 00:20:20 +00002821 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00002822 memcheck/tests/x86-linux/Makefile
sewardj0e342a02010-09-03 23:49:33 +00002823 memcheck/tests/ppc32/Makefile
2824 memcheck/tests/ppc64/Makefile
florian0bb707e2012-05-30 20:46:58 +00002825 memcheck/tests/s390x/Makefile
florianbb913cd2012-08-28 16:50:39 +00002826 memcheck/tests/vbit-test/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002827 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002828 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00002829 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00002830 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00002831 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00002832 callgrind/Makefile
2833 callgrind/callgrind_annotate
2834 callgrind/callgrind_control
2835 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002836 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00002837 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00002838 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00002839 massif/tests/Makefile
njnd5a8d242007-11-02 20:44:57 +00002840 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00002841 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00002842 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002843 none/Makefile
2844 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00002845 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00002846 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00002847 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00002848 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00002849 none/tests/arm/Makefile
sewardjb5b87402011-03-07 16:05:35 +00002850 none/tests/s390x/Makefile
sewardj5db15402012-06-07 09:13:21 +00002851 none/tests/mips32/Makefile
petarj8bea8672013-05-10 13:14:54 +00002852 none/tests/mips64/Makefile
njn0458a122009-02-13 06:23:46 +00002853 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00002854 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00002855 none/tests/x86-linux/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00002856 exp-sgcheck/Makefile
2857 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00002858 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00002859 drd/scripts/download-and-build-splash2
2860 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00002861 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00002862 exp-bbv/tests/Makefile
2863 exp-bbv/tests/x86/Makefile
2864 exp-bbv/tests/x86-linux/Makefile
2865 exp-bbv/tests/amd64-linux/Makefile
2866 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00002867 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00002868 exp-dhat/Makefile
2869 exp-dhat/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00002870])
sewardjd3645802010-06-13 22:13:58 +00002871AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
2872 [chmod +x coregrind/link_tool_exe_linux])
2873AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
2874 [chmod +x coregrind/link_tool_exe_darwin])
njn8b68b642009-06-24 00:37:09 +00002875AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00002876
2877cat<<EOF
2878
njn311303f2009-02-06 03:46:50 +00002879 Maximum build arch: ${ARCH_MAX}
2880 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00002881 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00002882 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00002883 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
2884 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardjcb495c82011-07-11 20:42:34 +00002885 Platform variant: ${VGCONF_PLATVARIANT}
2886 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
sewardje95d94f2008-09-19 09:02:19 +00002887 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00002888
gobry3b777892002-04-04 09:18:39 +00002889EOF