blob: 42f2ac5ce64ee1b78c423ed756b5aa95613949bd [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
njn7fd6d382009-01-22 21:56:32 +00001384#----------------------------------------------------------------------------
1385# Checking for supported compiler flags.
1386#----------------------------------------------------------------------------
1387
sewardj535c50f2005-06-04 23:14:53 +00001388# does this compiler support -m32 ?
1389AC_MSG_CHECKING([if gcc accepts -m32])
1390
1391safe_CFLAGS=$CFLAGS
1392CFLAGS="-m32"
1393
bart417cf3e2011-10-22 09:21:24 +00001394AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001395 return 0;
bart417cf3e2011-10-22 09:21:24 +00001396]])], [
sewardj535c50f2005-06-04 23:14:53 +00001397FLAG_M32="-m32"
1398AC_MSG_RESULT([yes])
1399], [
1400FLAG_M32=""
1401AC_MSG_RESULT([no])
1402])
1403CFLAGS=$safe_CFLAGS
1404
1405AC_SUBST(FLAG_M32)
1406
1407
sewardj01262142006-01-04 01:20:28 +00001408# does this compiler support -m64 ?
1409AC_MSG_CHECKING([if gcc accepts -m64])
1410
1411safe_CFLAGS=$CFLAGS
1412CFLAGS="-m64"
1413
bart417cf3e2011-10-22 09:21:24 +00001414AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001415 return 0;
bart417cf3e2011-10-22 09:21:24 +00001416]])], [
sewardj01262142006-01-04 01:20:28 +00001417FLAG_M64="-m64"
1418AC_MSG_RESULT([yes])
1419], [
1420FLAG_M64=""
1421AC_MSG_RESULT([no])
1422])
1423CFLAGS=$safe_CFLAGS
1424
1425AC_SUBST(FLAG_M64)
1426
1427
sewardj67f1fcc2005-07-03 10:41:02 +00001428# does this compiler support -mmmx ?
1429AC_MSG_CHECKING([if gcc accepts -mmmx])
1430
1431safe_CFLAGS=$CFLAGS
1432CFLAGS="-mmmx"
1433
bart417cf3e2011-10-22 09:21:24 +00001434AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001435 return 0;
bart417cf3e2011-10-22 09:21:24 +00001436]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001437FLAG_MMMX="-mmmx"
1438AC_MSG_RESULT([yes])
1439], [
1440FLAG_MMMX=""
1441AC_MSG_RESULT([no])
1442])
1443CFLAGS=$safe_CFLAGS
1444
1445AC_SUBST(FLAG_MMMX)
1446
1447
1448# does this compiler support -msse ?
1449AC_MSG_CHECKING([if gcc accepts -msse])
1450
1451safe_CFLAGS=$CFLAGS
1452CFLAGS="-msse"
1453
bart417cf3e2011-10-22 09:21:24 +00001454AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001455 return 0;
bart417cf3e2011-10-22 09:21:24 +00001456]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001457FLAG_MSSE="-msse"
1458AC_MSG_RESULT([yes])
1459], [
1460FLAG_MSSE=""
1461AC_MSG_RESULT([no])
1462])
1463CFLAGS=$safe_CFLAGS
1464
1465AC_SUBST(FLAG_MSSE)
1466
1467
sewardj5b754b42002-06-03 22:53:35 +00001468# does this compiler support -mpreferred-stack-boundary=2 ?
1469AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1470
daywalker3664f562003-10-17 13:43:46 +00001471safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001472CFLAGS="-mpreferred-stack-boundary=2"
1473
bart417cf3e2011-10-22 09:21:24 +00001474AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001475 return 0;
bart417cf3e2011-10-22 09:21:24 +00001476]])], [
sewardj5b754b42002-06-03 22:53:35 +00001477PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001478AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001479], [
1480PREFERRED_STACK_BOUNDARY=""
1481AC_MSG_RESULT([no])
1482])
daywalker3664f562003-10-17 13:43:46 +00001483CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001484
1485AC_SUBST(PREFERRED_STACK_BOUNDARY)
1486
sewardj535c50f2005-06-04 23:14:53 +00001487
florianda8c1262012-11-18 14:39:11 +00001488# does this compiler support -Wno-pointer-sign ?
1489AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
1490
1491safe_CFLAGS=$CFLAGS
1492CFLAGS="-Wno-pointer-sign"
1493
1494AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1495 return 0;
1496]])], [
1497no_pointer_sign=yes
1498AC_MSG_RESULT([yes])
1499], [
1500no_pointer_sign=no
1501AC_MSG_RESULT([no])
1502])
1503CFLAGS=$safe_CFLAGS
1504
1505AM_CONDITIONAL(HAS_POINTER_SIGN_WARNING, test x$no_pointer_sign = xyes)
1506
1507
florian6bd9dc12012-11-23 16:17:43 +00001508# does this compiler support -Wno-write-strings ?
1509AC_MSG_CHECKING([if gcc accepts -Wwrite-strings])
1510
1511safe_CFLAGS=$CFLAGS
1512CFLAGS="-Wwrite-strings"
1513
1514AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1515 return 0;
1516]])], [
1517no_write_strings=yes
1518AC_MSG_RESULT([yes])
1519], [
1520no_write_strings=no
1521AC_MSG_RESULT([no])
1522])
1523CFLAGS=$safe_CFLAGS
1524
1525if test x$no_write_strings = xyes; then
1526 CFLAGS="$CFLAGS -Wwrite-strings"
floriand79b3bf2013-10-02 15:14:59 +00001527 CXXFLAGS="$CXXFLAGS -Wwrite-strings"
florian6bd9dc12012-11-23 16:17:43 +00001528fi
1529
1530AM_CONDITIONAL(HAS_WRITE_STRINGS_WARNING, test x$no_write_strings = xyes)
1531
barte026bd22009-07-04 12:17:07 +00001532# does this compiler support -Wno-empty-body ?
1533
1534AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1535
1536safe_CFLAGS=$CFLAGS
1537CFLAGS="-Wno-empty-body"
1538
bart417cf3e2011-10-22 09:21:24 +00001539AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
barte026bd22009-07-04 12:17:07 +00001540 return 0;
bart417cf3e2011-10-22 09:21:24 +00001541]])], [
barte026bd22009-07-04 12:17:07 +00001542AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1543AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001544], [
barte026bd22009-07-04 12:17:07 +00001545AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1546AC_MSG_RESULT([no])
1547])
1548CFLAGS=$safe_CFLAGS
1549
1550
bart9d865fa2008-06-23 12:11:49 +00001551# does this compiler support -Wno-format-zero-length ?
1552
1553AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1554
1555safe_CFLAGS=$CFLAGS
1556CFLAGS="-Wno-format-zero-length"
1557
bart417cf3e2011-10-22 09:21:24 +00001558AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart9d865fa2008-06-23 12:11:49 +00001559 return 0;
bart417cf3e2011-10-22 09:21:24 +00001560]])], [
bart9d865fa2008-06-23 12:11:49 +00001561AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1562AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001563], [
bart9d865fa2008-06-23 12:11:49 +00001564AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1565AC_MSG_RESULT([no])
1566])
1567CFLAGS=$safe_CFLAGS
1568
1569
bart8e216312011-05-15 17:05:36 +00001570# does this compiler support -Wno-nonnull ?
1571
1572AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
1573
1574safe_CFLAGS=$CFLAGS
1575CFLAGS="-Wno-nonnull"
1576
bart417cf3e2011-10-22 09:21:24 +00001577AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart8e216312011-05-15 17:05:36 +00001578 return 0;
bart417cf3e2011-10-22 09:21:24 +00001579]])], [
bart8e216312011-05-15 17:05:36 +00001580AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
1581AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001582], [
bart8e216312011-05-15 17:05:36 +00001583AC_SUBST([FLAG_W_NO_NONNULL], [])
1584AC_MSG_RESULT([no])
1585])
1586CFLAGS=$safe_CFLAGS
1587
1588
1589# does this compiler support -Wno-overflow ?
1590
1591AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
1592
1593safe_CFLAGS=$CFLAGS
1594CFLAGS="-Wno-overflow"
1595
bart417cf3e2011-10-22 09:21:24 +00001596AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart8e216312011-05-15 17:05:36 +00001597 return 0;
bart417cf3e2011-10-22 09:21:24 +00001598]])], [
bart8e216312011-05-15 17:05:36 +00001599AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
1600AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001601], [
bart8e216312011-05-15 17:05:36 +00001602AC_SUBST([FLAG_W_NO_OVERFLOW], [])
1603AC_MSG_RESULT([no])
1604])
1605CFLAGS=$safe_CFLAGS
1606
1607
bartbf9b85c2009-08-12 12:55:56 +00001608# does this compiler support -Wno-uninitialized ?
1609
1610AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1611
1612safe_CFLAGS=$CFLAGS
1613CFLAGS="-Wno-uninitialized"
1614
bart417cf3e2011-10-22 09:21:24 +00001615AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bartbf9b85c2009-08-12 12:55:56 +00001616 return 0;
bart417cf3e2011-10-22 09:21:24 +00001617]])], [
bartbf9b85c2009-08-12 12:55:56 +00001618AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1619AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001620], [
bartbf9b85c2009-08-12 12:55:56 +00001621AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1622AC_MSG_RESULT([no])
1623])
1624CFLAGS=$safe_CFLAGS
1625
1626
bart56730cd2008-05-11 06:41:46 +00001627# does this compiler support -Wextra or the older -W ?
1628
1629AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1630
1631safe_CFLAGS=$CFLAGS
1632CFLAGS="-Wextra"
1633
bart417cf3e2011-10-22 09:21:24 +00001634AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001635 return 0;
bart417cf3e2011-10-22 09:21:24 +00001636]])], [
bart56730cd2008-05-11 06:41:46 +00001637AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1638AC_MSG_RESULT([-Wextra])
1639], [
1640 CFLAGS="-W"
sewardj9bdf2a62011-10-27 06:22:23 +00001641 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001642 return 0;
sewardj9bdf2a62011-10-27 06:22:23 +00001643 ]])], [
bart56730cd2008-05-11 06:41:46 +00001644 AC_SUBST([FLAG_W_EXTRA], [-W])
1645 AC_MSG_RESULT([-W])
1646 ], [
1647 AC_SUBST([FLAG_W_EXTRA], [])
1648 AC_MSG_RESULT([not supported])
1649 ])
1650])
1651CFLAGS=$safe_CFLAGS
1652
1653
sewardja72c26d2007-05-01 13:44:08 +00001654# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001655AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001656
1657safe_CFLAGS=$CFLAGS
1658CFLAGS="-fno-stack-protector"
1659
bart417cf3e2011-10-22 09:21:24 +00001660AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001661 return 0;
bart417cf3e2011-10-22 09:21:24 +00001662]])], [
sewardja72c26d2007-05-01 13:44:08 +00001663no_stack_protector=yes
1664FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1665AC_MSG_RESULT([yes])
1666], [
1667no_stack_protector=no
1668FLAG_FNO_STACK_PROTECTOR=""
1669AC_MSG_RESULT([no])
1670])
1671CFLAGS=$safe_CFLAGS
1672
1673AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1674
1675if test x$no_stack_protector = xyes; then
1676 CFLAGS="$CFLAGS -fno-stack-protector"
floriand79b3bf2013-10-02 15:14:59 +00001677 CXXFLAGS="$CXXFLAGS -fno-stack-protector"
sewardja72c26d2007-05-01 13:44:08 +00001678fi
1679
1680
bart56730cd2008-05-11 06:41:46 +00001681# does this compiler support --param inline-unit-growth=... ?
1682
1683AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1684
1685safe_CFLAGS=$CFLAGS
1686CFLAGS="--param inline-unit-growth=900"
1687
bart417cf3e2011-10-22 09:21:24 +00001688AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001689 return 0;
bart417cf3e2011-10-22 09:21:24 +00001690]])], [
bart56730cd2008-05-11 06:41:46 +00001691AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1692 ["--param inline-unit-growth=900"])
1693AC_MSG_RESULT([yes])
1694], [
1695AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1696AC_MSG_RESULT([no])
1697])
1698CFLAGS=$safe_CFLAGS
1699
1700
sewardjd9350682012-04-05 07:55:47 +00001701# does this compiler support -gdwarf-4 -fdebug-types-section ?
1702
1703AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
1704
1705safe_CFLAGS=$CFLAGS
1706CFLAGS="-gdwarf-4 -fdebug-types-section"
1707
1708AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1709 return 0;
1710]])], [
1711ac_have_dwarf4=yes
1712AC_MSG_RESULT([yes])
1713], [
1714ac_have_dwarf4=no
1715AC_MSG_RESULT([no])
1716])
1717AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
1718CFLAGS=$safe_CFLAGS
1719
1720
florian3df02112013-10-04 11:35:50 +00001721# does this compiler support -gstabs ?
1722
1723AC_MSG_CHECKING([if gcc accepts -gstabs])
1724
1725safe_CFLAGS=$CFLAGS
1726CFLAGS="-gstabs"
1727AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1728 return 0;
1729]])], [
1730ac_have_gstabs=yes
1731AC_MSG_RESULT([yes])
1732], [
1733ac_have_gstabs=no
1734AC_MSG_RESULT([no])
1735])
1736CFLAGS=$safe_CFLAGS
1737AM_CONDITIONAL([HAVE_GSTABS], [test x$ac_have_gstabs = xyes])
1738
1739
1740# does this compiler support nested functions ?
1741
1742AC_MSG_CHECKING([if gcc accepts nested functions])
1743
1744AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1745 int foo() { return 1; }
1746 return foo();
1747]])], [
1748ac_have_nested_functions=yes
1749AC_MSG_RESULT([yes])
1750], [
1751ac_have_nested_functions=no
1752AC_MSG_RESULT([no])
1753])
1754AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
1755
1756
1757# does this compiler support the 'p' constraint in ASM statements ?
1758
1759AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
1760
1761AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1762 char *p;
1763 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
1764]])], [
1765ac_have_asm_constraint_p=yes
1766AC_MSG_RESULT([yes])
1767], [
1768ac_have_asm_constraint_p=no
1769AC_MSG_RESULT([no])
1770])
1771AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
1772
1773
sewardje4bc7032013-03-22 11:49:46 +00001774# We want to use use the -Ttext-segment option to the linker.
1775# GNU (bfd) ld supports this directly. Newer GNU gold linkers
1776# support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
1777# semantics are NOT what we want (GNU gold -Ttext is fine).
1778#
1779# For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
1780# will reside. -Ttext aligns just the .text section start (but not any
1781# other section).
1782#
1783# So test for -Ttext-segment which is supported by all bfd ld versions
1784# and use that if it exists. If it doesn't exist it must be an older
1785# version of gold and we can fall back to using -Ttext which has the
1786# right semantics.
bart699fbac2010-06-08 18:23:59 +00001787
sewardje4bc7032013-03-22 11:49:46 +00001788AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
bart699fbac2010-06-08 18:23:59 +00001789
1790safe_CFLAGS=$CFLAGS
mjw941277a2013-04-17 19:11:05 +00001791CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml"
bart699fbac2010-06-08 18:23:59 +00001792
bart8508c752010-06-10 06:26:21 +00001793AC_LINK_IFELSE(
mjw941277a2013-04-17 19:11:05 +00001794[AC_LANG_SOURCE([int _start () { return 0; }])],
bart699fbac2010-06-08 18:23:59 +00001795[
tom04ce9f52013-03-28 15:53:21 +00001796 linker_using_t_text="no"
sewardje4bc7032013-03-22 11:49:46 +00001797 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
bart699fbac2010-06-08 18:23:59 +00001798 AC_MSG_RESULT([yes])
1799], [
tom04ce9f52013-03-28 15:53:21 +00001800 linker_using_t_text="yes"
sewardje4bc7032013-03-22 11:49:46 +00001801 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
bart699fbac2010-06-08 18:23:59 +00001802 AC_MSG_RESULT([no])
1803])
1804CFLAGS=$safe_CFLAGS
1805
tom04ce9f52013-03-28 15:53:21 +00001806# If the linker only supports -Ttext (not -Ttext-segment) then we will
1807# have to strip any build-id ELF NOTEs from the staticly linked tools.
1808# Otherwise the build-id NOTE might end up at the default load address.
1809# (Pedantically if the linker is gold then -Ttext is fine, but newer
1810# gold versions also support -Ttext-segment. So just assume that unless
1811# we can use -Ttext-segment we need to strip the build-id NOTEs.
1812if test "x${linker_using_t_text}" == "xyes"; then
1813AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
1814# does the linker support -Wl,--build-id=none ? Note, it's
1815# important that we test indirectly via whichever C compiler
1816# is selected, rather than testing /usr/bin/ld or whatever
1817# directly.
1818AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
1819safe_CFLAGS=$CFLAGS
1820CFLAGS="-Wl,--build-id=none"
1821
1822AC_LINK_IFELSE(
1823[AC_LANG_PROGRAM([ ], [return 0;])],
1824[
1825 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1826 AC_MSG_RESULT([yes])
1827], [
1828 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1829 AC_MSG_RESULT([no])
1830])
1831else
1832AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
1833AC_SUBST([FLAG_NO_BUILD_ID], [""])
1834fi
1835CFLAGS=$safe_CFLAGS
bart699fbac2010-06-08 18:23:59 +00001836
sewardj00f1e622006-03-12 16:47:10 +00001837# does the ppc assembler support "mtocrf" et al?
1838AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1839
bart417cf3e2011-10-22 09:21:24 +00001840AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjdd4cbe12006-03-12 17:27:44 +00001841__asm__ __volatile__("mtocrf 4,0");
1842__asm__ __volatile__("mfocrf 0,4");
bart417cf3e2011-10-22 09:21:24 +00001843]])], [
sewardj00f1e622006-03-12 16:47:10 +00001844ac_have_as_ppc_mftocrf=yes
1845AC_MSG_RESULT([yes])
1846], [
1847ac_have_as_ppc_mftocrf=no
1848AC_MSG_RESULT([no])
1849])
1850if test x$ac_have_as_ppc_mftocrf = xyes ; then
1851 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1852fi
1853
1854
carll1e5fa2f2013-08-09 21:55:45 +00001855# does the ppc assembler support "lfdp" and other phased out floating point insns?
1856AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
1857
1858AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1859 do { typedef struct {
1860 double hi;
1861 double lo;
1862 } dbl_pair_t;
1863 dbl_pair_t dbl_pair[3];
1864 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
1865 } while (0)
1866]])], [
1867ac_have_as_ppc_fpPO=yes
1868AC_MSG_RESULT([yes])
1869], [
1870ac_have_as_ppc_fpPO=no
1871AC_MSG_RESULT([no])
1872])
1873if test x$ac_have_as_ppc_fpPO = xyes ; then
1874 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
1875fi
1876
sewardjb5b87402011-03-07 16:05:35 +00001877CFLAGS=$safe_CFLAGS
1878
sewardjf0aabf82007-03-22 00:24:21 +00001879# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001880# Note, this doesn't generate a C-level symbol. It generates a
1881# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001882AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1883
bart417cf3e2011-10-22 09:21:24 +00001884AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjf0aabf82007-03-22 00:24:21 +00001885 do { long long int x;
1886 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1887 while (0)
bart417cf3e2011-10-22 09:21:24 +00001888]])], [
sewardjf0aabf82007-03-22 00:24:21 +00001889ac_have_as_sse3=yes
1890AC_MSG_RESULT([yes])
1891], [
1892ac_have_as_sse3=no
1893AC_MSG_RESULT([no])
1894])
sewardjfa18a262007-03-22 12:13:13 +00001895
1896AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001897
1898
sewardj6d6da5b2008-02-09 12:07:40 +00001899# Ditto for SSSE3 instructions (note extra S)
1900# Note, this doesn't generate a C-level symbol. It generates a
1901# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1902AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1903
florianc443b962011-10-28 21:37:19 +00001904save_CFLAGS="$CFLAGS"
1905CFLAGS="$CFLAGS -msse"
bart417cf3e2011-10-22 09:21:24 +00001906AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj6d6da5b2008-02-09 12:07:40 +00001907 do { long long int x;
1908 __asm__ __volatile__(
1909 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1910 while (0)
bart417cf3e2011-10-22 09:21:24 +00001911]])], [
sewardj6d6da5b2008-02-09 12:07:40 +00001912ac_have_as_ssse3=yes
1913AC_MSG_RESULT([yes])
1914], [
1915ac_have_as_ssse3=no
1916AC_MSG_RESULT([no])
1917])
florianc443b962011-10-28 21:37:19 +00001918CFLAGS="$save_CFLAGS"
sewardj6d6da5b2008-02-09 12:07:40 +00001919
1920AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1921
1922
sewardj27d176a2011-01-17 11:15:48 +00001923# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1924# Note, this doesn't generate a C-level symbol. It generates a
1925# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00001926AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
bart417cf3e2011-10-22 09:21:24 +00001927AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardje3ae8a32010-09-28 19:59:47 +00001928 do {
1929 __asm__ __volatile__(
1930 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1931 while (0)
bart417cf3e2011-10-22 09:21:24 +00001932]])], [
sewardje3ae8a32010-09-28 19:59:47 +00001933ac_have_as_pclmulqdq=yes
1934AC_MSG_RESULT([yes])
1935], [
1936ac_have_as_pclmulqdq=no
1937AC_MSG_RESULT([no])
1938])
1939
1940AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1941
1942
bart9bbe2bb2012-08-03 19:37:02 +00001943# does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
1944# Note, this doesn't generate a C-level symbol. It generates a
1945# automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
1946AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
1947AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1948 do {
1949 /*
1950 * Carry-less multiplication of xmm1 with xmm2 and store the result in
1951 * xmm3. The immediate is used to determine which quadwords of xmm1 and
1952 * xmm2 should be used.
1953 */
1954 __asm__ __volatile__(
1955 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
1956 } while (0)
1957]])], [
1958ac_have_as_vpclmulqdq=yes
1959AC_MSG_RESULT([yes])
1960], [
1961ac_have_as_vpclmulqdq=no
1962AC_MSG_RESULT([no])
1963])
1964
1965AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
1966
1967
sewardj27d176a2011-01-17 11:15:48 +00001968# does the x86/amd64 assembler understand the LZCNT instruction?
1969# Note, this doesn't generate a C-level symbol. It generates a
1970# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00001971AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1972
bart417cf3e2011-10-22 09:21:24 +00001973AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
bart55e438b2010-09-14 10:53:57 +00001974 do {
sewardjc62291c2012-07-22 11:10:08 +00001975 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
bart55e438b2010-09-14 10:53:57 +00001976 } while (0)
bart417cf3e2011-10-22 09:21:24 +00001977]])], [
bart55e438b2010-09-14 10:53:57 +00001978 ac_have_as_lzcnt=yes
1979 AC_MSG_RESULT([yes])
1980], [
1981 ac_have_as_lzcnt=no
1982 AC_MSG_RESULT([no])
1983])
1984
1985AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1986
sewardj27d176a2011-01-17 11:15:48 +00001987
florian3df02112013-10-04 11:35:50 +00001988# does the x86/amd64 assembler understand the LOOPNEL instruction?
1989# Note, this doesn't generate a C-level symbol. It generates a
1990# automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
1991AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
1992
1993AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1994 do {
1995 __asm__ __volatile__("1: loopnel 1b\n");
1996 } while (0)
1997]])], [
1998 ac_have_as_loopnel=yes
1999 AC_MSG_RESULT([yes])
2000], [
2001 ac_have_as_loopnel=no
2002 AC_MSG_RESULT([no])
2003])
2004
2005AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2006
2007
2008# does the x86/amd64 assembler understand ADDR32 ?
2009# Note, this doesn't generate a C-level symbol. It generates a
2010# automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2011AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2012
2013AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2014 do {
2015 asm volatile ("addr32 rep movsb");
2016 } while (0)
2017]])], [
2018 ac_have_as_addr32=yes
2019 AC_MSG_RESULT([yes])
2020], [
2021 ac_have_as_addr32=no
2022 AC_MSG_RESULT([no])
2023])
2024
2025AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2026
2027
sewardj27d176a2011-01-17 11:15:48 +00002028# does the x86/amd64 assembler understand SSE 4.2 instructions?
2029# Note, this doesn't generate a C-level symbol. It generates a
2030# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2031AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2032
bart417cf3e2011-10-22 09:21:24 +00002033AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj27d176a2011-01-17 11:15:48 +00002034 do { long long int x;
2035 __asm__ __volatile__(
florianfdfca222012-01-17 13:16:50 +00002036 "crc32q %%r15,%%r15" : : : "r15" );
2037 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002038 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2039 __asm__ __volatile__(
2040 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
sewardj27d176a2011-01-17 11:15:48 +00002041 while (0)
bart417cf3e2011-10-22 09:21:24 +00002042]])], [
sewardj27d176a2011-01-17 11:15:48 +00002043ac_have_as_sse42=yes
2044AC_MSG_RESULT([yes])
2045], [
2046ac_have_as_sse42=no
2047AC_MSG_RESULT([no])
2048])
2049
2050AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2051
2052
sewardj9fb31ca2012-06-05 00:31:49 +00002053# does the x86/amd64 assembler understand AVX instructions?
2054# Note, this doesn't generate a C-level symbol. It generates a
2055# automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2056AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2057
2058AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2059 do { long long int x;
2060 __asm__ __volatile__(
2061 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2062 __asm__ __volatile__(
2063 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2064 while (0)
2065]])], [
2066ac_have_as_avx=yes
2067AC_MSG_RESULT([yes])
2068], [
2069ac_have_as_avx=no
2070AC_MSG_RESULT([no])
2071])
2072
2073AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2074
2075
sewardjfda50af2013-03-27 11:43:20 +00002076# does the x86/amd64 assembler understand AVX2 instructions?
2077# Note, this doesn't generate a C-level symbol. It generates a
2078# automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2079AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2080
2081AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2082 do { long long int x;
2083 __asm__ __volatile__(
2084 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2085 __asm__ __volatile__(
2086 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2087 while (0)
2088]])], [
2089ac_have_as_avx2=yes
2090AC_MSG_RESULT([yes])
2091], [
2092ac_have_as_avx2=no
2093AC_MSG_RESULT([no])
2094])
2095
2096AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2097
2098
florian364c3652013-09-30 16:32:53 +00002099# does the x86/amd64 assembler understand TSX instructions?
2100# Note, this doesn't generate a C-level symbol. It generates a
2101# automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2102AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2103
2104AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2105 do {
2106 __asm__ __volatile__(
2107 " xbegin Lfoo \n\t"
2108 "Lfoo: xend \n\t");
2109 } while (0)
2110]])], [
2111ac_have_as_tsx=yes
2112AC_MSG_RESULT([yes])
2113], [
2114ac_have_as_tsx=no
2115AC_MSG_RESULT([no])
2116])
2117
2118AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2119
2120
sewardjfda50af2013-03-27 11:43:20 +00002121# does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2122# Note, this doesn't generate a C-level symbol. It generates a
2123# automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2124AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2125
2126AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2127 do { unsigned int h, l;
2128 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002129 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
sewardjfda50af2013-03-27 11:43:20 +00002130 __asm__ __volatile__(
sewardje222efc2013-03-27 21:59:21 +00002131 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
sewardjfda50af2013-03-27 11:43:20 +00002132 while (0)
2133]])], [
2134ac_have_as_bmi=yes
2135AC_MSG_RESULT([yes])
2136], [
2137ac_have_as_bmi=no
2138AC_MSG_RESULT([no])
2139])
2140
2141AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2142
2143
2144# does the x86/amd64 assembler understand FMA instructions?
2145# Note, this doesn't generate a C-level symbol. It generates a
2146# automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2147AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2148
2149AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2150 do { unsigned int h, l;
2151 __asm__ __volatile__(
2152 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2153 __asm__ __volatile__(
2154 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2155 __asm__ __volatile__(
2156 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2157 while (0)
2158]])], [
2159ac_have_as_fma=yes
2160AC_MSG_RESULT([yes])
2161], [
2162ac_have_as_fma=no
2163AC_MSG_RESULT([no])
2164])
2165
2166AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2167
2168
sewardjb08d84d2012-07-16 08:23:26 +00002169# does the x86/amd64 assembler understand MOVBE?
2170# Note, this doesn't generate a C-level symbol. It generates a
2171# automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2172AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2173
2174AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2175 do { long long int x;
2176 __asm__ __volatile__(
sewardjc62291c2012-07-22 11:10:08 +00002177 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
sewardjb08d84d2012-07-16 08:23:26 +00002178 while (0)
2179]])], [
2180ac_have_as_movbe=yes
2181AC_MSG_RESULT([yes])
2182], [
2183ac_have_as_movbe=no
2184AC_MSG_RESULT([no])
2185])
2186
2187AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2188
2189
florian251c2f92012-07-05 21:21:37 +00002190# Does the C compiler support the "ifunc" attribute
2191# Note, this doesn't generate a C-level symbol. It generates a
2192# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2193AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2194
florianf78a5032012-07-06 09:17:29 +00002195AC_LINK_IFELSE([AC_LANG_SOURCE([[
2196static void mytest(void) {}
2197
2198static void (*resolve_test(void))(void)
2199{
2200 return (void (*)(void))&mytest;
2201}
2202
2203void test(void) __attribute__((ifunc("resolve_test")));
2204
2205int main()
2206{
2207 test();
2208 return 0;
2209}
florian251c2f92012-07-05 21:21:37 +00002210]])], [
2211ac_have_ifunc_attr=yes
2212AC_MSG_RESULT([yes])
2213], [
2214ac_have_ifunc_attr=no
2215AC_MSG_RESULT([no])
2216])
2217
2218AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2219
2220
sewardje089f012010-10-13 21:47:29 +00002221# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2222# when building the tool executables. I think we should get rid of it.
2223#
sewardjb5f6f512005-03-10 23:59:00 +00002224# Check for TLS support in the compiler and linker
bart2bd9a682011-10-22 09:46:16 +00002225AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2226 [[return foo;]])],
2227 [vg_cv_linktime_tls=yes],
2228 [vg_cv_linktime_tls=no])
bartca9f2ad2008-06-02 07:14:20 +00002229# Native compilation: check whether running a program using TLS succeeds.
2230# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2231# succeeds but running programs using TLS fails.
bart2bd9a682011-10-22 09:46:16 +00002232# Cross-compiling: check whether linking a program using TLS succeeds.
bartca9f2ad2008-06-02 07:14:20 +00002233AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2234 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2235 [vg_cv_tls=$enableval],
2236 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2237 [[return foo;]])],
2238 [vg_cv_tls=yes],
bart2bd9a682011-10-22 09:46:16 +00002239 [vg_cv_tls=no],
2240 [vg_cv_tls=$vg_cv_linktime_tls])])])
sewardjb5f6f512005-03-10 23:59:00 +00002241
2242if test "$vg_cv_tls" = yes; then
2243AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2244fi
sewardj5b754b42002-06-03 22:53:35 +00002245
sewardj535c50f2005-06-04 23:14:53 +00002246
njn7fd6d382009-01-22 21:56:32 +00002247#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00002248# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00002249#----------------------------------------------------------------------------
2250
sewardjde4a1d02002-03-22 01:27:54 +00002251AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00002252AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00002253 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00002254 endian.h \
2255 mqueue.h \
2256 sys/endian.h \
2257 sys/epoll.h \
2258 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00002259 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00002260 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00002261 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00002262 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00002263 sys/syscall.h \
2264 sys/time.h \
2265 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00002266 ])
sewardjde4a1d02002-03-22 01:27:54 +00002267
bart818f17e2011-09-17 06:24:49 +00002268# Verify whether the <linux/futex.h> header is usable.
2269AC_MSG_CHECKING([if <linux/futex.h> is usable])
2270
sewardjc12486b2012-12-17 14:46:48 +00002271save_CFLAGS="$CFLAGS"
2272CFLAGS="$CFLAGS -D__user="
bart417cf3e2011-10-22 09:21:24 +00002273AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart818f17e2011-09-17 06:24:49 +00002274#include <linux/futex.h>
bart417cf3e2011-10-22 09:21:24 +00002275]], [[
bart818f17e2011-09-17 06:24:49 +00002276 return FUTEX_WAIT;
bart417cf3e2011-10-22 09:21:24 +00002277]])], [
bart78bfc712011-12-08 16:14:59 +00002278ac_have_usable_linux_futex_h=yes
bart818f17e2011-09-17 06:24:49 +00002279AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
2280 [Define to 1 if you have a usable <linux/futex.h> header file.])
2281AC_MSG_RESULT([yes])
2282], [
bart78bfc712011-12-08 16:14:59 +00002283ac_have_usable_linux_futex_h=no
bart818f17e2011-09-17 06:24:49 +00002284AC_MSG_RESULT([no])
2285])
sewardjc12486b2012-12-17 14:46:48 +00002286CFLAGS="$save_CFLAGS"
2287
bart818f17e2011-09-17 06:24:49 +00002288
njn7fd6d382009-01-22 21:56:32 +00002289#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00002290# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00002291#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00002292AC_TYPE_UID_T
2293AC_TYPE_OFF_T
2294AC_TYPE_SIZE_T
2295AC_HEADER_TIME
2296
sewardj535c50f2005-06-04 23:14:53 +00002297
njn7fd6d382009-01-22 21:56:32 +00002298#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00002299# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00002300#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00002301AC_FUNC_MEMCMP
2302AC_FUNC_MMAP
sewardjde4a1d02002-03-22 01:27:54 +00002303
bart26288e42011-04-03 16:46:01 +00002304AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00002305AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00002306
bartf5ceec82008-04-26 07:45:10 +00002307AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00002308 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00002309 epoll_create \
2310 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00002311 klogctl \
bartf5ceec82008-04-26 07:45:10 +00002312 mallinfo \
2313 memchr \
2314 memset \
2315 mkdir \
njnf76d27a2009-05-28 01:53:07 +00002316 mremap \
bartf5ceec82008-04-26 07:45:10 +00002317 ppoll \
bart6d45e922009-01-20 13:45:38 +00002318 pthread_barrier_init \
2319 pthread_condattr_setclock \
2320 pthread_mutex_timedlock \
2321 pthread_rwlock_timedrdlock \
2322 pthread_rwlock_timedwrlock \
2323 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00002324 pthread_yield \
florianc5325ef2013-09-17 20:15:36 +00002325 pthread_setname_np \
bartd1f724c2009-08-26 18:11:18 +00002326 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00002327 semtimedop \
2328 signalfd \
njn6cc22472009-03-16 03:46:48 +00002329 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00002330 strchr \
2331 strdup \
2332 strpbrk \
2333 strrchr \
2334 strstr \
barta72a27b2010-04-29 06:22:17 +00002335 syscall \
bartf5ceec82008-04-26 07:45:10 +00002336 utimensat \
tom9e4b6362012-02-10 09:39:37 +00002337 process_vm_readv \
2338 process_vm_writev \
bartf5ceec82008-04-26 07:45:10 +00002339 ])
sewardjde4a1d02002-03-22 01:27:54 +00002340
bart623eec32008-07-29 17:54:49 +00002341# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
2342# libraries with any shared object and/or executable. This is NOT what we
2343# want for e.g. vgpreload_core-x86-linux.so
2344LIBS=""
sewardj80637752006-03-02 13:48:21 +00002345
bart6d45e922009-01-20 13:45:38 +00002346AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
2347 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00002348AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
2349 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00002350AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
2351 [test x$ac_cv_func_pthread_spin_lock = xyes])
florianc5325ef2013-09-17 20:15:36 +00002352AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
2353 [test x$ac_cv_func_pthread_setname_np = xyes])
bart6d45e922009-01-20 13:45:38 +00002354
petarjc37cea62013-06-02 18:08:04 +00002355if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2356 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
petarj6d79b742012-12-20 18:56:57 +00002357 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
petarjc37cea62013-06-02 18:08:04 +00002358 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
petarj6d79b742012-12-20 18:56:57 +00002359fi
njn7fd6d382009-01-22 21:56:32 +00002360
2361#----------------------------------------------------------------------------
2362# MPI checks
2363#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00002364# Do we have a useable MPI setup on the primary and/or secondary targets?
2365# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00002366# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00002367# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00002368# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00002369MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00002370
sewardje9fa5062006-03-12 18:29:18 +00002371mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00002372if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00002373 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj5db15402012-06-07 09:13:21 +00002374 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
petarj4df0bfc2013-02-27 23:17:33 +00002375 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2376 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00002377 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00002378elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00002379 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
2380 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00002381 mflag_primary=$FLAG_M64
philippef7c54332012-05-17 15:32:54 +00002382elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
2383 mflag_primary="$FLAG_M32 -arch i386"
2384elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
2385 mflag_primary="$FLAG_M64 -arch x86_64"
sewardje9fa5062006-03-12 18:29:18 +00002386fi
2387
sewardj03d86f22006-10-17 00:57:24 +00002388mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00002389if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
2390 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00002391 mflag_secondary=$FLAG_M32
philippef7c54332012-05-17 15:32:54 +00002392elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
2393 mflag_secondary="$FLAG_M32 -arch i386"
sewardj03d86f22006-10-17 00:57:24 +00002394fi
2395
2396
sewardj0ad46092006-03-02 17:09:16 +00002397AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00002398 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00002399 MPI_CC=$withval
2400)
sewardj03d86f22006-10-17 00:57:24 +00002401AC_SUBST(MPI_CC)
2402
philippef7c54332012-05-17 15:32:54 +00002403## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
2404## use these values in the check for a functioning mpicc.
2405##
2406## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
2407## mflag_primary/mflag_secondary are sufficient approximations of that behavior
2408AM_COND_IF([VGCONF_OS_IS_LINUX],
2409 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
2410 LDFLAGS_MPI="-fpic -shared"])
2411AM_COND_IF([VGCONF_OS_IS_DARWIN],
2412 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
2413 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
2414
2415AC_SUBST([CFLAGS_MPI])
2416AC_SUBST([LDFLAGS_MPI])
2417
2418
sewardj03d86f22006-10-17 00:57:24 +00002419## See if MPI_CC works for the primary target
2420##
2421AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00002422saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00002423saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00002424CC=$MPI_CC
philippef7c54332012-05-17 15:32:54 +00002425CFLAGS="$CFLAGS_MPI $mflag_primary"
2426saved_LDFLAGS="$LDFLAGS"
2427LDFLAGS="$LDFLAGS_MPI $mflag_primary"
bart417cf3e2011-10-22 09:21:24 +00002428AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj1a85e602006-03-08 15:26:10 +00002429#include <mpi.h>
2430#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00002431]], [[
philippef7c54332012-05-17 15:32:54 +00002432 int ni, na, nd, comb;
sewardjde4f3842006-03-09 02:41:41 +00002433 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00002434 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2435 r |= MPI_Finalize();
sewardjde4f3842006-03-09 02:41:41 +00002436 return r;
bart417cf3e2011-10-22 09:21:24 +00002437]])], [
sewardj03d86f22006-10-17 00:57:24 +00002438ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00002439AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00002440], [
sewardj03d86f22006-10-17 00:57:24 +00002441ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00002442AC_MSG_RESULT([no])
2443])
sewardj0ad46092006-03-02 17:09:16 +00002444CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00002445CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00002446LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00002447AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00002448
sewardj03d86f22006-10-17 00:57:24 +00002449## See if MPI_CC works for the secondary target. Complication: what if
2450## there is no secondary target? We need this to then fail.
2451## Kludge this by making MPI_CC something which will surely fail in
2452## such a case.
2453##
2454AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
2455saved_CC=$CC
2456saved_CFLAGS=$CFLAGS
philippef7c54332012-05-17 15:32:54 +00002457saved_LDFLAGS="$LDFLAGS"
2458LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
njn7fd6d382009-01-22 21:56:32 +00002459if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00002460 CC="$MPI_CC this will surely fail"
2461else
2462 CC=$MPI_CC
2463fi
philippef7c54332012-05-17 15:32:54 +00002464CFLAGS="$CFLAGS_MPI $mflag_secondary"
bart417cf3e2011-10-22 09:21:24 +00002465AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj03d86f22006-10-17 00:57:24 +00002466#include <mpi.h>
2467#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00002468]], [[
philippef7c54332012-05-17 15:32:54 +00002469 int ni, na, nd, comb;
sewardj03d86f22006-10-17 00:57:24 +00002470 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00002471 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2472 r |= MPI_Finalize();
sewardj03d86f22006-10-17 00:57:24 +00002473 return r;
bart417cf3e2011-10-22 09:21:24 +00002474]])], [
sewardj03d86f22006-10-17 00:57:24 +00002475ac_have_mpi2_sec=yes
2476AC_MSG_RESULT([yes, $MPI_CC])
2477], [
2478ac_have_mpi2_sec=no
2479AC_MSG_RESULT([no])
2480])
2481CC=$saved_CC
2482CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00002483LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00002484AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00002485
2486
njn7fd6d382009-01-22 21:56:32 +00002487#----------------------------------------------------------------------------
2488# Other library checks
2489#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00002490# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00002491# tests are present because Drd has some regression tests that use
2492# these packages. All regression test programs all compiled only
2493# for the primary target. And so it is important that the configure
2494# checks that follow, use the correct -m32 or -m64 flag for the
2495# primary target (called $mflag_primary). Otherwise, we can end up
2496# in a situation (eg) where, on amd64-linux, the test for Boost checks
2497# for usable 64-bit Boost facilities, but because we are doing a 32-bit
2498# only build (meaning, the primary target is x86-linux), the build
2499# of the regtest programs that use Boost fails, because they are
2500# build as 32-bit (IN THIS EXAMPLE).
2501#
2502# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
2503# NEEDED BY THE REGRESSION TEST PROGRAMS.
2504
2505
sewardj493c4ef2008-12-13 16:45:19 +00002506# Check whether the boost library 1.35 or later has been installed.
2507# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
2508
2509AC_MSG_CHECKING([for boost])
2510
2511AC_LANG(C++)
2512safe_CXXFLAGS=$CXXFLAGS
bart7129c722012-04-18 18:34:22 +00002513CXXFLAGS="$mflag_primary"
2514safe_LIBS="$LIBS"
2515LIBS="-lboost_thread-mt $LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00002516
bart128fc522011-03-12 10:36:35 +00002517AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00002518#include <boost/thread.hpp>
2519static void thread_func(void)
2520{ }
2521int main(int argc, char** argv)
2522{
2523 boost::thread t(thread_func);
2524 return 0;
2525}
bart128fc522011-03-12 10:36:35 +00002526])],
sewardj493c4ef2008-12-13 16:45:19 +00002527[
2528ac_have_boost_1_35=yes
2529AC_SUBST([BOOST_CFLAGS], [])
bartbb31f2d2012-04-18 18:42:34 +00002530AC_SUBST([BOOST_LIBS], [-lboost_thread-mt])
sewardj493c4ef2008-12-13 16:45:19 +00002531AC_MSG_RESULT([yes])
2532], [
2533ac_have_boost_1_35=no
2534AC_MSG_RESULT([no])
2535])
2536
bart7129c722012-04-18 18:34:22 +00002537LIBS="$safe_LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00002538CXXFLAGS=$safe_CXXFLAGS
2539AC_LANG(C)
2540
2541AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
2542
2543
2544# does this compiler support -fopenmp, does it have the include file
2545# <omp.h> and does it have libgomp ?
2546
2547AC_MSG_CHECKING([for OpenMP])
2548
2549safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00002550CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00002551
bart128fc522011-03-12 10:36:35 +00002552AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00002553#include <omp.h>
2554int main(int argc, char** argv)
2555{
2556 omp_set_dynamic(0);
2557 return 0;
2558}
bart128fc522011-03-12 10:36:35 +00002559])],
sewardj493c4ef2008-12-13 16:45:19 +00002560[
2561ac_have_openmp=yes
2562AC_MSG_RESULT([yes])
2563], [
2564ac_have_openmp=no
2565AC_MSG_RESULT([no])
2566])
2567CFLAGS=$safe_CFLAGS
2568
2569AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
2570
2571
bart78bfc712011-12-08 16:14:59 +00002572# does this compiler have built-in functions for atomic memory access for the
2573# primary target ?
2574AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
sewardjc876a2f2009-01-22 22:44:30 +00002575
2576safe_CFLAGS=$CFLAGS
2577CFLAGS="$mflag_primary"
2578
bart417cf3e2011-10-22 09:21:24 +00002579AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjc876a2f2009-01-22 22:44:30 +00002580 int variable = 1;
2581 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2582 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00002583]])], [
bartb4ff7822011-12-10 19:48:04 +00002584 ac_have_builtin_atomic_primary=yes
sewardjc876a2f2009-01-22 22:44:30 +00002585 AC_MSG_RESULT([yes])
bart78bfc712011-12-08 16:14:59 +00002586 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 +00002587], [
bartb4ff7822011-12-10 19:48:04 +00002588 ac_have_builtin_atomic_primary=no
sewardjc876a2f2009-01-22 22:44:30 +00002589 AC_MSG_RESULT([no])
2590])
2591
2592CFLAGS=$safe_CFLAGS
2593
bartb4ff7822011-12-10 19:48:04 +00002594AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
2595 [test x$ac_have_builtin_atomic_primary = xyes])
bartc82d1372009-05-31 16:21:23 +00002596
bart78bfc712011-12-08 16:14:59 +00002597
2598# does this compiler have built-in functions for atomic memory access for the
2599# secondary target ?
2600
2601if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2602
2603AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
2604
2605safe_CFLAGS=$CFLAGS
2606CFLAGS="$mflag_secondary"
2607
2608AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2609 int variable = 1;
2610 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
2611]])], [
2612 ac_have_builtin_atomic_secondary=yes
2613 AC_MSG_RESULT([yes])
2614], [
2615 ac_have_builtin_atomic_secondary=no
2616 AC_MSG_RESULT([no])
2617])
2618
2619CFLAGS=$safe_CFLAGS
2620
2621fi
2622
2623AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
2624 [test x$ac_have_builtin_atomic_secondary = xyes])
2625
bart1e856ea2011-12-17 12:53:23 +00002626# does this compiler have built-in functions for atomic memory access on
2627# 64-bit integers for all targets ?
2628
2629AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
2630
2631AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2632 #include <stdint.h>
2633]], [[
2634 uint64_t variable = 1;
2635 return __sync_add_and_fetch(&variable, 1)
2636]])], [
2637 ac_have_builtin_atomic64_primary=yes
2638], [
2639 ac_have_builtin_atomic64_primary=no
2640])
2641
2642if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2643
2644safe_CFLAGS=$CFLAGS
2645CFLAGS="$mflag_secondary"
2646
2647AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2648 #include <stdint.h>
2649]], [[
2650 uint64_t variable = 1;
2651 return __sync_add_and_fetch(&variable, 1)
2652]])], [
2653 ac_have_builtin_atomic64_secondary=yes
2654], [
2655 ac_have_builtin_atomic64_secondary=no
2656])
2657
2658CFLAGS=$safe_CFLAGS
2659
2660fi
2661
2662if test x$ac_have_builtin_atomic64_primary = xyes && \
2663 test x$VGCONF_PLATFORM_SEC_CAPS = x \
2664 -o x$ac_have_builtin_atomic64_secondary = xyes; then
2665 AC_MSG_RESULT([yes])
2666 ac_have_builtin_atomic64=yes
2667else
2668 AC_MSG_RESULT([no])
2669 ac_have_builtin_atomic64=no
2670fi
2671
2672AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
2673 [test x$ac_have_builtin_atomic64 = xyes])
2674
bart78bfc712011-12-08 16:14:59 +00002675
barte8740422011-03-24 20:27:54 +00002676# does g++ have built-in functions for atomic memory access ?
bart78bfc712011-12-08 16:14:59 +00002677AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
barte8740422011-03-24 20:27:54 +00002678
2679safe_CXXFLAGS=$CXXFLAGS
2680CXXFLAGS="$mflag_primary"
2681
2682AC_LANG_PUSH(C++)
bart417cf3e2011-10-22 09:21:24 +00002683AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
barte8740422011-03-24 20:27:54 +00002684 int variable = 1;
2685 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2686 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00002687]])], [
barte8740422011-03-24 20:27:54 +00002688 ac_have_builtin_atomic_cxx=yes
2689 AC_MSG_RESULT([yes])
2690 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 +00002691], [
barte8740422011-03-24 20:27:54 +00002692 ac_have_builtin_atomic_cxx=no
2693 AC_MSG_RESULT([no])
2694])
2695AC_LANG_POP(C++)
2696
2697CXXFLAGS=$safe_CXXFLAGS
2698
2699AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00002700
bart78bfc712011-12-08 16:14:59 +00002701
2702if test x$ac_have_usable_linux_futex_h = xyes \
bartb4ff7822011-12-10 19:48:04 +00002703 -a x$ac_have_builtin_atomic_primary = xyes; then
bart78bfc712011-12-08 16:14:59 +00002704 ac_enable_linux_ticket_lock_primary=yes
2705fi
2706AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
2707 [test x$ac_enable_linux_ticket_lock_primary = xyes])
2708
2709if test x$VGCONF_PLATFORM_SEC_CAPS != x \
2710 -a x$ac_have_usable_linux_futex_h = xyes \
2711 -a x$ac_have_builtin_atomic_secondary = xyes; then
2712 ac_enable_linux_ticket_lock_secondary=yes
2713fi
2714AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
2715 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
2716
2717
bartf68af882011-12-10 19:42:05 +00002718# does libstdc++ support annotating shared pointers ?
2719AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
2720
floriand79b3bf2013-10-02 15:14:59 +00002721safe_CXXFLAGS=$CXXFLAGS
bartf68af882011-12-10 19:42:05 +00002722CXXFLAGS="-std=c++0x"
2723
2724AC_LANG_PUSH(C++)
2725AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2726 #include <memory>
2727]], [[
2728 std::shared_ptr<int> p
2729]])], [
2730 ac_have_shared_ptr=yes
2731], [
2732 ac_have_shared_ptr=no
2733])
2734if test x$ac_have_shared_ptr = xyes; then
2735 # If compilation of the program below fails because of a syntax error
2736 # triggered by substituting one of the annotation macros then that
2737 # means that libstdc++ supports these macros.
2738 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2739 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
2740 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
2741 #include <memory>
2742 ]], [[
2743 std::shared_ptr<int> p
2744 ]])], [
2745 ac_have_shared_pointer_annotation=no
2746 AC_MSG_RESULT([no])
2747 ], [
2748 ac_have_shared_pointer_annotation=yes
2749 AC_MSG_RESULT([yes])
2750 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
2751 [Define to 1 if libstd++ supports annotating shared pointers])
2752 ])
2753else
2754 ac_have_shared_pointer_annotation=no
2755 AC_MSG_RESULT([no])
2756fi
2757AC_LANG_POP(C++)
2758
2759CXXFLAGS=$safe_CXXFLAGS
2760
2761AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
2762 [test x$ac_have_shared_pointer_annotation = xyes])
2763
2764
njn7fd6d382009-01-22 21:56:32 +00002765#----------------------------------------------------------------------------
2766# Ok. We're done checking.
2767#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00002768
njn8b68b642009-06-24 00:37:09 +00002769# Nb: VEX/Makefile is generated from Makefile.vex.in.
2770AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00002771 Makefile
njn8b68b642009-06-24 00:37:09 +00002772 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00002773 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00002774 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00002775 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00002776 docs/Makefile
2777 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00002778 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00002779 perf/Makefile
2780 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00002781 gdbserver_tests/Makefile
njn254d542432002-09-23 16:09:39 +00002782 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00002783 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00002784 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00002785 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002786 memcheck/Makefile
2787 memcheck/tests/Makefile
floriane42cca52013-08-29 17:59:27 +00002788 memcheck/tests/common/Makefile
njnc6168192004-11-29 13:54:10 +00002789 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00002790 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00002791 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00002792 memcheck/tests/darwin/Makefile
njnea2d6fd2010-07-01 00:20:20 +00002793 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00002794 memcheck/tests/x86-linux/Makefile
sewardj0e342a02010-09-03 23:49:33 +00002795 memcheck/tests/ppc32/Makefile
2796 memcheck/tests/ppc64/Makefile
florian0bb707e2012-05-30 20:46:58 +00002797 memcheck/tests/s390x/Makefile
florianbb913cd2012-08-28 16:50:39 +00002798 memcheck/tests/vbit-test/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002799 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002800 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00002801 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00002802 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00002803 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00002804 callgrind/Makefile
2805 callgrind/callgrind_annotate
2806 callgrind/callgrind_control
2807 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002808 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00002809 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00002810 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00002811 massif/tests/Makefile
njnd5a8d242007-11-02 20:44:57 +00002812 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00002813 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00002814 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002815 none/Makefile
2816 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00002817 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00002818 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00002819 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00002820 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00002821 none/tests/arm/Makefile
sewardjb5b87402011-03-07 16:05:35 +00002822 none/tests/s390x/Makefile
sewardj5db15402012-06-07 09:13:21 +00002823 none/tests/mips32/Makefile
petarj8bea8672013-05-10 13:14:54 +00002824 none/tests/mips64/Makefile
njn0458a122009-02-13 06:23:46 +00002825 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00002826 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00002827 none/tests/x86-linux/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00002828 exp-sgcheck/Makefile
2829 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00002830 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00002831 drd/scripts/download-and-build-splash2
2832 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00002833 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00002834 exp-bbv/tests/Makefile
2835 exp-bbv/tests/x86/Makefile
2836 exp-bbv/tests/x86-linux/Makefile
2837 exp-bbv/tests/amd64-linux/Makefile
2838 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00002839 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00002840 exp-dhat/Makefile
2841 exp-dhat/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00002842])
sewardjd3645802010-06-13 22:13:58 +00002843AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
2844 [chmod +x coregrind/link_tool_exe_linux])
2845AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
2846 [chmod +x coregrind/link_tool_exe_darwin])
njn8b68b642009-06-24 00:37:09 +00002847AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00002848
2849cat<<EOF
2850
njn311303f2009-02-06 03:46:50 +00002851 Maximum build arch: ${ARCH_MAX}
2852 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00002853 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00002854 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00002855 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
2856 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardjcb495c82011-07-11 20:42:34 +00002857 Platform variant: ${VGCONF_PLATVARIANT}
2858 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
sewardje95d94f2008-09-19 09:02:19 +00002859 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00002860
gobry3b777892002-04-04 09:18:39 +00002861EOF