blob: 69544b4a5ec5c06be0a7709f2ef4563e77f3d832 [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.
sewardj96e6aa62011-10-25 09:20:05 +000011AC_INIT([Valgrind],[3.8.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])
bart3a2dac02008-03-18 17:40:38 +000014AM_INIT_AUTOMAKE([foreign])
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"
gobrye721a522002-03-22 13:38:30 +000022
sewardjde4a1d02002-03-22 01:27:54 +000023AC_PROG_LN_S
24AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000025AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000026AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000027AC_PROG_CXX
njn629a5ec2009-07-14 01:29:39 +000028# AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
29# autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
30# base (eg. most likely as Darwin-specific tests) we'll need one of the
31# following:
njn0cd26892009-07-12 23:07:13 +000032# - put AC_PROG_OBJC in a Darwin-specific part of this file
33# - Use AC_PROG_OBJC here and up the minimum autoconf version
34# - Use the following, which is apparently equivalent:
35# m4_ifdef([AC_PROG_OBJC],
36# [AC_PROG_OBJC],
37# [AC_CHECK_TOOL([OBJC], [gcc])
38# AC_SUBST([OBJC])
39# AC_SUBST([OBJCFLAGS])
40# ])
sewardjde4a1d02002-03-22 01:27:54 +000041AC_PROG_RANLIB
bart07de2c92010-05-29 06:44:28 +000042# provide a very basic definition for AC_PROG_SED if it's not provided by
43# autoconf (as e.g. in autoconf 2.59).
44m4_ifndef([AC_PROG_SED],
45 [AC_DEFUN([AC_PROG_SED],
46 [AC_ARG_VAR([SED])
47 AC_CHECK_PROGS([SED],[gsed sed])])])
bart12e91122010-05-15 08:37:24 +000048AC_PROG_SED
sewardjde4a1d02002-03-22 01:27:54 +000049
bartcddeaf52008-05-25 15:58:11 +000050# If no AR variable was specified, look up the name of the archiver. Otherwise
51# do not touch the AR variable.
52if test "x$AR" = "x"; then
bart07de2c92010-05-29 06:44:28 +000053 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000054fi
55AC_ARG_VAR([AR],[Archiver command])
56
gobrye721a522002-03-22 13:38:30 +000057# Check for the compiler support
58if test "${GCC}" != "yes" ; then
59 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
60fi
61
sewardj2f685952002-12-22 19:32:23 +000062# figure out where perl lives
63AC_PATH_PROG(PERL, perl)
64
njn9315df32003-04-16 20:50:50 +000065# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000066AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000067AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000068
daywalker48ccca52002-04-15 00:31:58 +000069# some older automake's don't have it so try something on our own
70ifdef([AM_PROG_AS],[AM_PROG_AS],
71[
gobry1be19852002-03-26 20:44:55 +000072AS="${CC}"
73AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000074
gobry1be19852002-03-26 20:44:55 +000075ASFLAGS=""
76AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000077])
gobry3b777892002-04-04 09:18:39 +000078
gobry3b777892002-04-04 09:18:39 +000079
njn0d2e58f2009-02-25 04:57:56 +000080# Check if 'diff' supports -u (universal diffs) and use it if possible.
81
82AC_MSG_CHECKING([for diff -u])
83AC_SUBST(DIFF)
84
sewardj6e9de462011-06-28 07:25:29 +000085# Comparing two identical files results in 0.
njn31f665e2009-02-26 21:25:50 +000086tmpfile="tmp-xxx-yyy-zzz"
87touch $tmpfile;
88if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000089 AC_MSG_RESULT([yes])
90 DIFF="diff -u"
91else
92 AC_MSG_RESULT([no])
93 DIFF="diff"
94fi
njn31f665e2009-02-26 21:25:50 +000095rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000096
97
sewardj535c50f2005-06-04 23:14:53 +000098# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +000099AC_MSG_CHECKING([for a supported version of gcc])
100
bart85037442011-11-22 14:41:31 +0000101# Obtain the compiler version.
sewardja8ca2c52011-09-29 18:18:37 +0000102#
bart85037442011-11-22 14:41:31 +0000103# A few examples of how the ${CC} --version output looks like:
104#
105# Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
106# Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
107# openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
108# Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
bartc5214062012-01-11 11:34:23 +0000109# MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
bart85037442011-11-22 14:41:31 +0000110# OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
111# 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)
112# Clang: clang version 2.9 (tags/RELEASE_29/final)
sewardja8ca2c52011-09-29 18:18:37 +0000113#
bartc5214062012-01-11 11:34:23 +0000114[
115 gcc_version=`${CC} -dumpversion 2>/dev/null`
116 if test "x$gcc_version" = x; then
117 gcc_version=`${CC} --version \
118 | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p' \
119 -e 's/[^ ]*clang version \([0-9.]*\).*$/\1/p'`
120 fi
121]
gobrye721a522002-03-22 13:38:30 +0000122
sewardj3ab7b662011-09-29 17:30:13 +0000123is_clang="notclang"
124if test "x`${CC} --version | head -n 1 | $SED 's/\(clang\) version.*/\1/'`" = "xclang" ; then
125 is_clang="clang"
126fi
127
128case "${is_clang}-${gcc_version}" in
129 notclang-3.*)
130 AC_MSG_RESULT([ok (${gcc_version})])
131 ;;
132 notclang-4.*)
133 AC_MSG_RESULT([ok (${gcc_version})])
134 ;;
135 clang-2.9)
136 AC_MSG_RESULT([ok (clang-${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000137 ;;
gobrye721a522002-03-22 13:38:30 +0000138 *)
sewardj3ab7b662011-09-29 17:30:13 +0000139 AC_MSG_RESULT([no (${gcc_version})])
140 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9])
gobrye721a522002-03-22 13:38:30 +0000141 ;;
142esac
143
njn7fd6d382009-01-22 21:56:32 +0000144#----------------------------------------------------------------------------
145# Arch/OS/platform tests.
146#----------------------------------------------------------------------------
147# We create a number of arch/OS/platform-related variables. We prefix them
148# all with "VGCONF_" which indicates that they are defined at
149# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
150# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000151
sewardjde4a1d02002-03-22 01:27:54 +0000152AC_CANONICAL_HOST
153
154AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000155
njn7fd6d382009-01-22 21:56:32 +0000156# ARCH_MAX reflects the most that this CPU can do: for example if it
157# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
158# Ditto for amd64. It is used for more configuration below, but is not used
159# outside this file.
gobrye721a522002-03-22 13:38:30 +0000160case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000161 i?86)
162 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000163 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000164 ;;
165
njnfe408942004-11-23 17:52:24 +0000166 x86_64)
167 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000168 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000169 ;;
170
sewardj2c48c7b2005-11-29 13:05:56 +0000171 powerpc64)
172 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000173 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000174 ;;
175
176 powerpc)
sewardj6e9de462011-06-28 07:25:29 +0000177 # On Linux this means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000178 AC_MSG_RESULT([ok (${host_cpu})])
sewardj6e9de462011-06-28 07:25:29 +0000179 ARCH_MAX="ppc32"
nethercote9bcc9062004-10-13 13:50:01 +0000180 ;;
181
sewardjb5b87402011-03-07 16:05:35 +0000182 s390x)
183 AC_MSG_RESULT([ok (${host_cpu})])
184 ARCH_MAX="s390x"
185 ;;
186
sewardj59570ff2010-01-01 11:59:33 +0000187 armv7*)
188 AC_MSG_RESULT([ok (${host_cpu})])
189 ARCH_MAX="arm"
190 ;;
191
sewardjde4a1d02002-03-22 01:27:54 +0000192 *)
193 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000194 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000195 ;;
196esac
197
njn7fd6d382009-01-22 21:56:32 +0000198#----------------------------------------------------------------------------
199
sewardj86e992f2006-01-28 18:39:09 +0000200# Sometimes it's convenient to subvert the bi-arch build system and
201# just have a single build even though the underlying platform is
202# capable of both. Hence handle --enable-only64bit and
203# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000204# [Actually, if either of these options are used, I think both get built,
205# but only one gets installed. So if you use an in-place build, both can be
206# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000207
208# Check if a 64-bit only build has been requested
209AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
210 [AC_ARG_ENABLE(only64bit,
211 [ --enable-only64bit do a 64-bit only build],
212 [vg_cv_only64bit=$enableval],
213 [vg_cv_only64bit=no])])
214
215# Check if a 32-bit only build has been requested
216AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
217 [AC_ARG_ENABLE(only32bit,
218 [ --enable-only32bit do a 32-bit only build],
219 [vg_cv_only32bit=$enableval],
220 [vg_cv_only32bit=no])])
221
222# Stay sane
223if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
224 AC_MSG_ERROR(
225 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
226fi
227
njn7fd6d382009-01-22 21:56:32 +0000228#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000229
njn311303f2009-02-06 03:46:50 +0000230# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
231# compilation of many C files via -VGO_$(VGCONF_OS) and
232# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000233AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000234AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000235
njnf76d27a2009-05-28 01:53:07 +0000236DEFAULT_SUPP=""
237
gobrye721a522002-03-22 13:38:30 +0000238case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000239 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000240 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000241 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000242
243 # Ok, this is linux. Check the kernel version
244 AC_MSG_CHECKING([for the kernel version])
245
246 kernel=`uname -r`
247
248 case "${kernel}" in
bart0419e512011-06-05 08:51:47 +0000249 2.6.*|3.*)
bart2d6e6e72011-06-05 10:01:48 +0000250 AC_MSG_RESULT([2.6.x/3.x family (${kernel})])
251 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 +0000252 ;;
253
254 2.4.*)
255 AC_MSG_RESULT([2.4 family (${kernel})])
256 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
257 ;;
258
mueller8c68e042004-01-03 15:21:14 +0000259 *)
260 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000261 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000262 ;;
263 esac
264
265 ;;
266
njnf76d27a2009-05-28 01:53:07 +0000267 *darwin*)
268 AC_MSG_RESULT([ok (${host_os})])
269 VGCONF_OS="darwin"
njnea2d6fd2010-07-01 00:20:20 +0000270 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
271 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
272 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
njnf76d27a2009-05-28 01:53:07 +0000273
274 AC_MSG_CHECKING([for the kernel version])
275 kernel=`uname -r`
276
277 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
278 # has only one relevant version, the OS version. The `uname` check
279 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
sewardj731f9cf2011-09-21 08:43:08 +0000280 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
281 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
njnea2d6fd2010-07-01 00:20:20 +0000282 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000283 #
284 # XXX: `uname -r` won't do the right thing for cross-compiles, but
285 # that's not a problem yet.
sewardj731f9cf2011-09-21 08:43:08 +0000286 #
287 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
288 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
289 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
290 # time support for 10.5 (the 9.* pattern just below), I'll leave it
291 # in for now, just in case anybody wants to give it a try. But I'm
292 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
njnf76d27a2009-05-28 01:53:07 +0000293 case "${kernel}" in
294 9.*)
295 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000296 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000297 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000298 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000299 ;;
njnea2d6fd2010-07-01 00:20:20 +0000300 10.*)
301 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
302 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
303 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
304 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
305 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000306 11.*)
307 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
308 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
309 # FIXME: change these to xx11.supp
310 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
311 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
312 ;;
313 *)
njnf76d27a2009-05-28 01:53:07 +0000314 AC_MSG_RESULT([unsupported (${kernel})])
sewardj731f9cf2011-09-21 08:43:08 +0000315 AC_MSG_ERROR([Valgrind works on Darwin 10.x and 11.x (Mac OS X 10.6/7)])
njnf76d27a2009-05-28 01:53:07 +0000316 ;;
317 esac
318 ;;
319
sewardjde4a1d02002-03-22 01:27:54 +0000320 *)
321 AC_MSG_RESULT([no (${host_os})])
njncc58cea2010-07-05 07:21:22 +0000322 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
sewardjde4a1d02002-03-22 01:27:54 +0000323 ;;
324esac
325
njn7fd6d382009-01-22 21:56:32 +0000326#----------------------------------------------------------------------------
327
tomd6398392006-06-07 17:44:36 +0000328# If we are building on a 64 bit platform test to see if the system
329# supports building 32 bit programs and disable 32 bit support if it
330# does not support building 32 bit programs
331
njn7fd6d382009-01-22 21:56:32 +0000332case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000333 amd64-linux|ppc64-linux)
334 AC_MSG_CHECKING([for 32 bit build support])
335 safe_CFLAGS=$CFLAGS
336 CFLAGS="-m32"
bart417cf3e2011-10-22 09:21:24 +0000337 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +0000338 return 0;
bart417cf3e2011-10-22 09:21:24 +0000339 ]])], [
tomd6398392006-06-07 17:44:36 +0000340 AC_MSG_RESULT([yes])
341 ], [
342 vg_cv_only64bit="yes"
343 AC_MSG_RESULT([no])
344 ])
345 CFLAGS=$safe_CFLAGS;;
346esac
347
348if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
349 AC_MSG_ERROR(
350 [--enable-only32bit was specified but system does not support 32 bit builds])
351fi
nethercote888ecb72004-08-23 14:54:40 +0000352
njn7fd6d382009-01-22 21:56:32 +0000353#----------------------------------------------------------------------------
354
njn311303f2009-02-06 03:46:50 +0000355# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
356# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
357# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
358# above) will be "amd64" since that reflects the most that this cpu can do,
359# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
360# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000361# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
362# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
363AC_SUBST(VGCONF_ARCH_PRI)
364
njn3f8a6e92009-06-02 00:20:47 +0000365# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
366# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
367# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
368# It is empty if there is no secondary target.
369AC_SUBST(VGCONF_ARCH_SEC)
370
njn311303f2009-02-06 03:46:50 +0000371# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
372# The entire system, including regression and performance tests, will be
373# built for this target. The "_CAPS" indicates that the name is in capital
374# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000375# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000376# convention and cannot contain '-' characters. This is in contrast to
377# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000378AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
379
380# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
381# Valgrind and tools will also be built for this target, but not the
382# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000383#
njn7fd6d382009-01-22 21:56:32 +0000384# By default, the primary arch is the same as the "max" arch, as commented
385# above (at the definition of ARCH_MAX). We may choose to downgrade it in
386# the big case statement just below here, in the case where we're building
387# on a 64 bit machine but have been requested only to do a 32 bit build.
388AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
389
sewardj01262142006-01-04 01:20:28 +0000390AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000391
njnea2d6fd2010-07-01 00:20:20 +0000392# NB. The load address for a given platform may be specified in more
393# than one place, in some cases, depending on whether we're doing a biarch,
394# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
395# Be careful to give consistent values in all subcases. Also, all four
396# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
397# even if it is to "0xUNSET".
398#
njn7fd6d382009-01-22 21:56:32 +0000399case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000400 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000401 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000402 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000403 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
404 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000405 valt_load_address_pri_norml="0x38000000"
406 valt_load_address_pri_inner="0x28000000"
407 valt_load_address_sec_norml="0xUNSET"
408 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000409 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000410 ;;
411 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000412 valt_load_address_sec_norml="0xUNSET"
413 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000414 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000415 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000416 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000417 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
418 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000419 valt_load_address_pri_norml="0x38000000"
420 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000421 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000422 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000423 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000424 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
425 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000426 valt_load_address_pri_norml="0x38000000"
427 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000428 else
njn7fd6d382009-01-22 21:56:32 +0000429 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000430 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000431 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
432 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000433 valt_load_address_pri_norml="0x38000000"
434 valt_load_address_pri_inner="0x28000000"
435 valt_load_address_sec_norml="0x38000000"
436 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000437 fi
njn377c43f2009-05-19 07:39:22 +0000438 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000439 ;;
440 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000441 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000442 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000443 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
444 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000445 valt_load_address_pri_norml="0x38000000"
446 valt_load_address_pri_inner="0x28000000"
447 valt_load_address_sec_norml="0xUNSET"
448 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000449 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000450 ;;
451 ppc64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000452 valt_load_address_sec_norml="0xUNSET"
453 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000454 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000455 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000456 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000457 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
458 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000459 valt_load_address_pri_norml="0x38000000"
460 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000461 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000462 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000463 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000464 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
465 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000466 valt_load_address_pri_norml="0x38000000"
467 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000468 else
njn7fd6d382009-01-22 21:56:32 +0000469 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000470 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000471 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
472 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000473 valt_load_address_pri_norml="0x38000000"
474 valt_load_address_pri_inner="0x28000000"
475 valt_load_address_sec_norml="0x38000000"
476 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000477 fi
njn377c43f2009-05-19 07:39:22 +0000478 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000479 ;;
njncc58cea2010-07-05 07:21:22 +0000480 # Darwin gets identified as 32-bit even when it supports 64-bit.
481 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
482 # all Macs support both 32-bit and 64-bit, so we just build both. If
483 # someone has a really old 32-bit only machine they can (hopefully?)
484 # build with --enable-only32bit. See bug 243362.
485 x86-darwin|amd64-darwin)
486 ARCH_MAX="amd64"
njnea2d6fd2010-07-01 00:20:20 +0000487 valt_load_address_sec_norml="0xUNSET"
488 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000489 if test x$vg_cv_only64bit = xyes; then
490 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000491 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000492 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
493 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000494 valt_load_address_pri_norml="0x138000000"
495 valt_load_address_pri_inner="0x128000000"
njnf76d27a2009-05-28 01:53:07 +0000496 elif test x$vg_cv_only32bit = xyes; then
497 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000498 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000499 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
500 VGCONF_PLATFORM_SEC_CAPS=""
501 VGCONF_ARCH_PRI_CAPS="x86"
njnea2d6fd2010-07-01 00:20:20 +0000502 valt_load_address_pri_norml="0x38000000"
503 valt_load_address_pri_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000504 else
505 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000506 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000507 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
508 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
njnea2d6fd2010-07-01 00:20:20 +0000509 valt_load_address_pri_norml="0x138000000"
510 valt_load_address_pri_inner="0x128000000"
511 valt_load_address_sec_norml="0x38000000"
512 valt_load_address_sec_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000513 fi
njnf76d27a2009-05-28 01:53:07 +0000514 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
515 ;;
sewardj59570ff2010-01-01 11:59:33 +0000516 arm-linux)
517 VGCONF_ARCH_PRI="arm"
518 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
519 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000520 valt_load_address_pri_norml="0x38000000"
521 valt_load_address_pri_inner="0x28000000"
522 valt_load_address_sec_norml="0xUNSET"
523 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000524 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
525 ;;
sewardjb5b87402011-03-07 16:05:35 +0000526 s390x-linux)
527 VGCONF_ARCH_PRI="s390x"
528 VGCONF_ARCH_SEC=""
529 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
530 VGCONF_PLATFORM_SEC_CAPS=""
531 # we want to have the generated code close to the dispatcher
532 valt_load_address_pri_norml="0x401000000"
533 valt_load_address_pri_inner="0x410000000"
534 valt_load_address_sec_norml="0xUNSET"
535 valt_load_address_sec_inner="0xUNSET"
536 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
537 ;;
nethercote888ecb72004-08-23 14:54:40 +0000538 *)
njn7fd6d382009-01-22 21:56:32 +0000539 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000540 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000541 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
542 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000543 valt_load_address_pri_norml="0xUNSET"
544 valt_load_address_pri_inner="0xUNSET"
545 valt_load_address_sec_norml="0xUNSET"
546 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000547 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000548 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000549 ;;
550esac
sewardjde4a1d02002-03-22 01:27:54 +0000551
njn7fd6d382009-01-22 21:56:32 +0000552#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000553
njn7fd6d382009-01-22 21:56:32 +0000554# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
555# defined.
556AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
557 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000558 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
559 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
560 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000561AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000562 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
563 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000564AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
565 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj6e9de462011-06-28 07:25:29 +0000566 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000567AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
sewardj6e9de462011-06-28 07:25:29 +0000568 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX )
sewardj59570ff2010-01-01 11:59:33 +0000569AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
570 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardjb5b87402011-03-07 16:05:35 +0000571AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
572 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000573
njn7fd6d382009-01-22 21:56:32 +0000574# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
575# become defined.
576AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
577 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
578 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
579AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
580 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
581AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
582 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
583 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
584AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
585 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000586AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
587 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
sewardjb5b87402011-03-07 16:05:35 +0000588AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
589 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
590 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000591
njnf76d27a2009-05-28 01:53:07 +0000592AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
593 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
594 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
595AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
596 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
597
598
sewardj72a2d802010-07-29 05:24:20 +0000599# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000600# Relies on the assumption that the primary and secondary targets are
601# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000602AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
603 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
604 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
605 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000606 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +0000607 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
608 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000609AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
610 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
611 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000612
613
njn7fd6d382009-01-22 21:56:32 +0000614# Sometimes, in the Makefile.am files, it's useful to know whether or not
615# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000616AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000617 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000618
tomb637bad2005-11-08 12:28:35 +0000619
njn7fd6d382009-01-22 21:56:32 +0000620#----------------------------------------------------------------------------
621# Inner Valgrind?
622#----------------------------------------------------------------------------
623
njnd74b0ef2009-01-20 06:06:52 +0000624# Check if this should be built as an inner Valgrind, to be run within
625# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000626AC_SUBST(VALT_LOAD_ADDRESS_PRI)
627AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000628AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
629 [AC_ARG_ENABLE(inner,
630 [ --enable-inner enables self-hosting],
631 [vg_cv_inner=$enableval],
632 [vg_cv_inner=no])])
633if test "$vg_cv_inner" = yes; then
634 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000635 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
636 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000637else
njnea2d6fd2010-07-01 00:20:20 +0000638 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
639 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000640fi
641
642
njn7fd6d382009-01-22 21:56:32 +0000643#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000644# Extra fine-tuning of installation directories
645#----------------------------------------------------------------------------
646AC_ARG_WITH(tmpdir,
647 [ --with-tmpdir=PATH Specify path for temporary files],
648 tmpdir="$withval",
649 tmpdir="/tmp")
650AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
651
sewardj0ba37c92011-07-12 11:46:24 +0000652
sewardjcb495c82011-07-11 20:42:34 +0000653#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000654# Libc and suppressions
655#----------------------------------------------------------------------------
656# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000657AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000658
bart12e91122010-05-15 08:37:24 +0000659AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000660
bart12e91122010-05-15 08:37:24 +0000661if test x$ac_cv_header_features_h = xyes; then
662 rm -f conftest.$ac_ext
663 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000664#include <features.h>
bart12e91122010-05-15 08:37:24 +0000665#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
666glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000667#endif
bart12e91122010-05-15 08:37:24 +0000668_ACEOF
669 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
670fi
bartb7c3f082010-05-13 06:32:36 +0000671
njnf76d27a2009-05-28 01:53:07 +0000672# not really a version check
673AC_EGREP_CPP([DARWIN_LIBC], [
674#include <sys/cdefs.h>
675#if defined(__DARWIN_VERS_1050)
676 DARWIN_LIBC
677#endif
678],
679GLIBC_VERSION="darwin")
680
sewardjcb495c82011-07-11 20:42:34 +0000681# not really a version check
682AC_EGREP_CPP([BIONIC_LIBC], [
683#if defined(__ANDROID__)
684 BIONIC_LIBC
685#endif
686],
687GLIBC_VERSION="bionic")
688
689
dirk07596a22008-04-25 11:33:30 +0000690AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000691
dirk07596a22008-04-25 11:33:30 +0000692case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000693 2.2)
694 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000695 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000696 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
697 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000698 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000699 ;;
700
sewardj08c7f012002-10-07 23:56:55 +0000701 2.3)
702 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000703 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000704 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000705 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000706 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000707 ;;
708
njn781dba52005-06-30 04:06:38 +0000709 2.4)
710 AC_MSG_RESULT(2.4 family)
711 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000712 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000713 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000714 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000715 ;;
716
dirkaece45c2006-10-12 08:17:49 +0000717 2.5)
718 AC_MSG_RESULT(2.5 family)
719 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000720 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000721 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000722 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000723 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000724 2.6)
725 AC_MSG_RESULT(2.6 family)
726 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000727 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000728 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000729 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000730 ;;
731 2.7)
732 AC_MSG_RESULT(2.7 family)
733 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000734 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000735 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000736 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000737 ;;
dirk07596a22008-04-25 11:33:30 +0000738 2.8)
739 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000740 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000741 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
742 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
743 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
744 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000745 2.9)
746 AC_MSG_RESULT(2.9 family)
747 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
748 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
749 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
750 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
751 ;;
sewardj5d425e82009-02-01 19:01:11 +0000752 2.10)
753 AC_MSG_RESULT(2.10 family)
754 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
755 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
756 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
757 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
758 ;;
bart0fac7ff2009-11-15 19:11:19 +0000759 2.11)
760 AC_MSG_RESULT(2.11 family)
761 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
762 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
763 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
764 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000765 ;;
766 2.12)
767 AC_MSG_RESULT(2.12 family)
768 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
769 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
770 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
771 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000772 ;;
tomebd619b2011-02-10 09:09:09 +0000773 2.13)
774 AC_MSG_RESULT(2.13 family)
775 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
776 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
777 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
778 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
779 ;;
tomcc077412011-06-07 21:52:26 +0000780 2.14)
781 AC_MSG_RESULT(2.14 family)
782 AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x])
783 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
784 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
785 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
786 ;;
dirke75fdeb2011-12-29 08:24:55 +0000787 2.15)
788 AC_MSG_RESULT(2.15 family)
789 AC_DEFINE([GLIBC_2_15], 1, [Define to 1 if you're using glibc 2.15.x])
790 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
791 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
792 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
793 ;;
njnf76d27a2009-05-28 01:53:07 +0000794 darwin)
795 AC_MSG_RESULT(Darwin)
796 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
797 # DEFAULT_SUPP set by kernel version check above.
798 ;;
sewardjcb495c82011-07-11 20:42:34 +0000799 bionic)
800 AC_MSG_RESULT(Bionic)
801 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
802 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
803 ;;
dirkaece45c2006-10-12 08:17:49 +0000804
sewardjde4a1d02002-03-22 01:27:54 +0000805 *)
bart12e91122010-05-15 08:37:24 +0000806 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
dirke75fdeb2011-12-29 08:24:55 +0000807 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.15])
njnf76d27a2009-05-28 01:53:07 +0000808 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000809 ;;
810esac
811
dirk07596a22008-04-25 11:33:30 +0000812AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000813
sewardj414f3582008-07-18 20:46:00 +0000814
815# Add default suppressions for the X client libraries. Make no
816# attempt to detect whether such libraries are installed on the
817# build machine (or even if any X facilities are present); just
818# add the suppressions antidisirregardless.
819DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
820DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000821
sewardjd2f95a02011-05-11 16:04:28 +0000822# Add glibc and X11 suppressions for exp-sgcheck
823DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
sewardj5744c022008-10-19 18:58:13 +0000824
sewardj2e10a682003-04-07 19:36:41 +0000825
njn7fd6d382009-01-22 21:56:32 +0000826#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000827# Platform variants?
828#----------------------------------------------------------------------------
829
830# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
831# But there are times where we need a bit more control. The motivating
832# and currently only case is Android: this is almost identical to arm-linux,
833# but not quite. So this introduces the concept of platform variant tags,
834# which get passed in the compile as -DVGPV_<arch>_<os>_<variant> along
835# with the main -DVGP_<arch>_<os> definition.
836#
837# In almost all cases, the <variant> bit is "vanilla". But for Android
838# it is "android" instead.
839#
840# Consequently (eg), plain arm-linux would build with
841#
842# -DVGP_arm_linux -DVGPV_arm_linux_vanilla
843#
844# whilst an Android build would have
845#
846# -DVGP_arm_linux -DVGPV_arm_linux_android
847#
848# The setup of the platform variant is pushed relatively far down this
849# file in order that we can inspect any of the variables set above.
850
851# In the normal case ..
852VGCONF_PLATVARIANT="vanilla"
853
854# Android on ARM ?
855if test "$VGCONF_ARCH_PRI-$VGCONF_OS" = "arm-linux" \
856 -a "$GLIBC_VERSION" = "bionic";
857then
858 VGCONF_PLATVARIANT="android"
859fi
860
861AC_SUBST(VGCONF_PLATVARIANT)
862
863
864# FIXME: do we also want to define automake variables
865# VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
866# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
867# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
868# do that. Problem is that we can't do and-ing in Makefile.am's, but
869# that's what we'd need to do to use this, since what we'd want to write
870# is something like
871#
872# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
873#
sewardj0ba37c92011-07-12 11:46:24 +0000874# Hmm. Can't think of a nice clean solution to this.
875
876AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
877 test x$VGCONF_PLATVARIANT = xvanilla)
878AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
879 test x$VGCONF_PLATVARIANT = xandroid)
sewardjcb495c82011-07-11 20:42:34 +0000880
881
882#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000883# Checking for various library functions and other definitions
884#----------------------------------------------------------------------------
885
bart59e2f182008-04-28 16:22:53 +0000886# Check for CLOCK_MONOTONIC
887
888AC_MSG_CHECKING([for CLOCK_MONOTONIC])
889
bart417cf3e2011-10-22 09:21:24 +0000890AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart59e2f182008-04-28 16:22:53 +0000891#include <time.h>
bart417cf3e2011-10-22 09:21:24 +0000892]], [[
bart59e2f182008-04-28 16:22:53 +0000893 struct timespec t;
894 clock_gettime(CLOCK_MONOTONIC, &t);
895 return 0;
bart417cf3e2011-10-22 09:21:24 +0000896]])], [
bart59e2f182008-04-28 16:22:53 +0000897AC_MSG_RESULT([yes])
898AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
899 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
900], [
901AC_MSG_RESULT([no])
902])
903
bartfea06922008-05-03 09:12:15 +0000904
sewardj0c09bf02011-07-11 22:11:58 +0000905# Check for PTHREAD_RWLOCK_T
906
907AC_MSG_CHECKING([for pthread_rwlock_t])
908
bart417cf3e2011-10-22 09:21:24 +0000909AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardj0c09bf02011-07-11 22:11:58 +0000910#define _GNU_SOURCE
911#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000912]], [[
sewardj0c09bf02011-07-11 22:11:58 +0000913 pthread_rwlock_t rwl;
bart417cf3e2011-10-22 09:21:24 +0000914]])], [
sewardj0c09bf02011-07-11 22:11:58 +0000915AC_MSG_RESULT([yes])
916AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
917 [Define to 1 if you have the `pthread_rwlock_t' type.])
918], [
919AC_MSG_RESULT([no])
920])
921
922
bartfea06922008-05-03 09:12:15 +0000923# Check for PTHREAD_MUTEX_ADAPTIVE_NP
924
925AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
926
bart417cf3e2011-10-22 09:21:24 +0000927AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +0000928#define _GNU_SOURCE
929#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000930]], [[
bartfea06922008-05-03 09:12:15 +0000931 return (PTHREAD_MUTEX_ADAPTIVE_NP);
bart417cf3e2011-10-22 09:21:24 +0000932]])], [
bartfea06922008-05-03 09:12:15 +0000933AC_MSG_RESULT([yes])
934AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
935 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
936], [
937AC_MSG_RESULT([no])
938])
939
940
941# Check for PTHREAD_MUTEX_ERRORCHECK_NP
942
943AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
944
bart417cf3e2011-10-22 09:21:24 +0000945AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +0000946#define _GNU_SOURCE
947#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000948]], [[
bartfea06922008-05-03 09:12:15 +0000949 return (PTHREAD_MUTEX_ERRORCHECK_NP);
bart417cf3e2011-10-22 09:21:24 +0000950]])], [
bartfea06922008-05-03 09:12:15 +0000951AC_MSG_RESULT([yes])
952AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
953 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
954], [
955AC_MSG_RESULT([no])
956])
957
958
959# Check for PTHREAD_MUTEX_RECURSIVE_NP
960
961AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
962
bart417cf3e2011-10-22 09:21:24 +0000963AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +0000964#define _GNU_SOURCE
965#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000966]], [[
bartfea06922008-05-03 09:12:15 +0000967 return (PTHREAD_MUTEX_RECURSIVE_NP);
bart417cf3e2011-10-22 09:21:24 +0000968]])], [
bartfea06922008-05-03 09:12:15 +0000969AC_MSG_RESULT([yes])
970AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
971 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
972], [
973AC_MSG_RESULT([no])
974])
975
976
977# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
978
979AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
980
bart417cf3e2011-10-22 09:21:24 +0000981AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +0000982#define _GNU_SOURCE
983#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000984]], [[
bartfea06922008-05-03 09:12:15 +0000985 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
986 return 0;
bart417cf3e2011-10-22 09:21:24 +0000987]])], [
bartfea06922008-05-03 09:12:15 +0000988AC_MSG_RESULT([yes])
989AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
990 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
991], [
992AC_MSG_RESULT([no])
993])
994
995
bart5e389f12008-04-05 12:53:15 +0000996# Check whether pthread_mutex_t has a member called __m_kind.
997
bartb11355c2010-04-29 16:37:26 +0000998AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
999 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1000 1,
1001 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1002 ],
1003 [],
1004 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001005
1006
1007# Check whether pthread_mutex_t has a member called __data.__kind.
1008
bartb11355c2010-04-29 16:37:26 +00001009AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1010 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1011 1,
1012 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1013 ],
1014 [],
1015 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001016
1017
bart62c370e2008-05-12 18:50:51 +00001018# does this compiler support -maltivec and does it have the include file
1019# <altivec.h> ?
1020
1021AC_MSG_CHECKING([for Altivec])
1022
1023safe_CFLAGS=$CFLAGS
1024CFLAGS="-maltivec"
1025
bart417cf3e2011-10-22 09:21:24 +00001026AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart62c370e2008-05-12 18:50:51 +00001027#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001028]], [[
bart62c370e2008-05-12 18:50:51 +00001029 vector unsigned int v;
bart417cf3e2011-10-22 09:21:24 +00001030]])], [
bart62c370e2008-05-12 18:50:51 +00001031ac_have_altivec=yes
1032AC_MSG_RESULT([yes])
sewardjf9fe6022010-09-03 14:36:50 +00001033AC_DEFINE([HAS_ALTIVEC], 1,
sewardj6467a152010-09-03 14:02:22 +00001034 [Define to 1 if gcc/as can do Altivec.])
bart62c370e2008-05-12 18:50:51 +00001035], [
1036ac_have_altivec=no
1037AC_MSG_RESULT([no])
1038])
1039CFLAGS=$safe_CFLAGS
1040
sewardj0e342a02010-09-03 23:49:33 +00001041AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
bart62c370e2008-05-12 18:50:51 +00001042
1043
sewardjf34eb492011-04-15 11:57:05 +00001044# Check that both: the compiler supports -mvsx and that the assembler
1045# understands VSX instructions. If either of those doesn't work,
1046# conclude that we can't do VSX. NOTE: basically this is a kludge
1047# in that it conflates two things that should be separate -- whether
1048# the compiler understands the flag vs whether the assembler
1049# understands the opcodes. This really ought to be cleaned up
1050# and done properly, like it is for x86/x86_64.
1051
1052AC_MSG_CHECKING([for VSX])
1053
1054safe_CFLAGS=$CFLAGS
1055CFLAGS="-mvsx"
1056
bart417cf3e2011-10-22 09:21:24 +00001057AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardjf34eb492011-04-15 11:57:05 +00001058#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001059]], [[
sewardjf34eb492011-04-15 11:57:05 +00001060 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +00001061 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
bart417cf3e2011-10-22 09:21:24 +00001062]])], [
sewardjf34eb492011-04-15 11:57:05 +00001063ac_have_vsx=yes
1064AC_MSG_RESULT([yes])
1065], [
1066ac_have_vsx=no
1067AC_MSG_RESULT([no])
1068])
1069CFLAGS=$safe_CFLAGS
1070
1071AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1072
sewardjb0ccb4d2012-04-02 10:22:05 +00001073AC_MSG_CHECKING([that assembler knows DFP])
1074
1075AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1076]], [[
1077 __asm__ __volatile__("dadd 1, 2, 3");
1078]])], [
1079ac_asm_have_dfp=yes
1080AC_MSG_RESULT([yes])
1081], [
1082ac_asm_have_dfp=no
1083AC_MSG_RESULT([no])
1084])
1085
1086AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1087safe_CFLAGS=$CFLAGS
1088CFLAGS="-mhard-dfp"
1089AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1090]], [[
1091 __asm__ __volatile__("dadd 1, 2, 3");
1092]])], [
1093ac_gcc_have_dfp=yes
1094AC_MSG_RESULT([yes])
1095], [
1096ac_gcc_have_dfp=no
1097AC_MSG_RESULT([no])
1098])
1099
sewardjb0ccb4d2012-04-02 10:22:05 +00001100CFLAGS=$safe_CFLAGS
1101
1102AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes -a x$ac_gcc_have_dfp = xyes)
sewardjf34eb492011-04-15 11:57:05 +00001103
bart36dd85a2009-04-26 07:11:48 +00001104# Check for pthread_create@GLIBC2.0
1105AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1106
bart16e1c5a2009-04-26 07:38:53 +00001107safe_CFLAGS=$CFLAGS
1108CFLAGS="-lpthread"
bart417cf3e2011-10-22 09:21:24 +00001109AC_LINK_IFELSE([AC_LANG_PROGRAM([[
bart36dd85a2009-04-26 07:11:48 +00001110extern int pthread_create_glibc_2_0(void*, const void*,
1111 void *(*)(void*), void*);
1112__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
bart417cf3e2011-10-22 09:21:24 +00001113]], [[
bart276ed3a2009-05-10 15:41:45 +00001114#ifdef __powerpc__
1115/*
1116 * Apparently on PowerPC linking this program succeeds and generates an
1117 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1118 */
1119#error This test does not work properly on PowerPC.
1120#else
bart16e1c5a2009-04-26 07:38:53 +00001121 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001122#endif
bart16e1c5a2009-04-26 07:38:53 +00001123 return 0;
bart417cf3e2011-10-22 09:21:24 +00001124]])], [
bart36dd85a2009-04-26 07:11:48 +00001125ac_have_pthread_create_glibc_2_0=yes
1126AC_MSG_RESULT([yes])
1127AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1128 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1129], [
1130ac_have_pthread_create_glibc_2_0=no
1131AC_MSG_RESULT([no])
1132])
bart16e1c5a2009-04-26 07:38:53 +00001133CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001134
1135AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001136 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001137
1138
barta50aa8a2008-04-27 06:06:57 +00001139# Check for eventfd_t, eventfd() and eventfd_read()
1140AC_MSG_CHECKING([for eventfd()])
1141
bart417cf3e2011-10-22 09:21:24 +00001142AC_LINK_IFELSE([AC_LANG_PROGRAM([[
barta50aa8a2008-04-27 06:06:57 +00001143#include <sys/eventfd.h>
bart417cf3e2011-10-22 09:21:24 +00001144]], [[
barta50aa8a2008-04-27 06:06:57 +00001145 eventfd_t ev;
1146 int fd;
1147
1148 fd = eventfd(5, 0);
1149 eventfd_read(fd, &ev);
1150 return 0;
bart417cf3e2011-10-22 09:21:24 +00001151]])], [
barta50aa8a2008-04-27 06:06:57 +00001152AC_MSG_RESULT([yes])
1153AC_DEFINE([HAVE_EVENTFD], 1,
1154 [Define to 1 if you have the `eventfd' function.])
1155AC_DEFINE([HAVE_EVENTFD_READ], 1,
1156 [Define to 1 if you have the `eventfd_read' function.])
1157], [
1158AC_MSG_RESULT([no])
1159])
1160
1161
njn7fd6d382009-01-22 21:56:32 +00001162#----------------------------------------------------------------------------
1163# Checking for supported compiler flags.
1164#----------------------------------------------------------------------------
1165
sewardj535c50f2005-06-04 23:14:53 +00001166# does this compiler support -m32 ?
1167AC_MSG_CHECKING([if gcc accepts -m32])
1168
1169safe_CFLAGS=$CFLAGS
1170CFLAGS="-m32"
1171
bart417cf3e2011-10-22 09:21:24 +00001172AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001173 return 0;
bart417cf3e2011-10-22 09:21:24 +00001174]])], [
sewardj535c50f2005-06-04 23:14:53 +00001175FLAG_M32="-m32"
1176AC_MSG_RESULT([yes])
1177], [
1178FLAG_M32=""
1179AC_MSG_RESULT([no])
1180])
1181CFLAGS=$safe_CFLAGS
1182
1183AC_SUBST(FLAG_M32)
1184
1185
sewardj01262142006-01-04 01:20:28 +00001186# does this compiler support -m64 ?
1187AC_MSG_CHECKING([if gcc accepts -m64])
1188
1189safe_CFLAGS=$CFLAGS
1190CFLAGS="-m64"
1191
bart417cf3e2011-10-22 09:21:24 +00001192AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001193 return 0;
bart417cf3e2011-10-22 09:21:24 +00001194]])], [
sewardj01262142006-01-04 01:20:28 +00001195FLAG_M64="-m64"
1196AC_MSG_RESULT([yes])
1197], [
1198FLAG_M64=""
1199AC_MSG_RESULT([no])
1200])
1201CFLAGS=$safe_CFLAGS
1202
1203AC_SUBST(FLAG_M64)
1204
1205
sewardj67f1fcc2005-07-03 10:41:02 +00001206# does this compiler support -mmmx ?
1207AC_MSG_CHECKING([if gcc accepts -mmmx])
1208
1209safe_CFLAGS=$CFLAGS
1210CFLAGS="-mmmx"
1211
bart417cf3e2011-10-22 09:21:24 +00001212AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001213 return 0;
bart417cf3e2011-10-22 09:21:24 +00001214]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001215FLAG_MMMX="-mmmx"
1216AC_MSG_RESULT([yes])
1217], [
1218FLAG_MMMX=""
1219AC_MSG_RESULT([no])
1220])
1221CFLAGS=$safe_CFLAGS
1222
1223AC_SUBST(FLAG_MMMX)
1224
1225
1226# does this compiler support -msse ?
1227AC_MSG_CHECKING([if gcc accepts -msse])
1228
1229safe_CFLAGS=$CFLAGS
1230CFLAGS="-msse"
1231
bart417cf3e2011-10-22 09:21:24 +00001232AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001233 return 0;
bart417cf3e2011-10-22 09:21:24 +00001234]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001235FLAG_MSSE="-msse"
1236AC_MSG_RESULT([yes])
1237], [
1238FLAG_MSSE=""
1239AC_MSG_RESULT([no])
1240])
1241CFLAGS=$safe_CFLAGS
1242
1243AC_SUBST(FLAG_MSSE)
1244
1245
sewardj5b754b42002-06-03 22:53:35 +00001246# does this compiler support -mpreferred-stack-boundary=2 ?
1247AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1248
daywalker3664f562003-10-17 13:43:46 +00001249safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001250CFLAGS="-mpreferred-stack-boundary=2"
1251
bart417cf3e2011-10-22 09:21:24 +00001252AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001253 return 0;
bart417cf3e2011-10-22 09:21:24 +00001254]])], [
sewardj5b754b42002-06-03 22:53:35 +00001255PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001256AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001257], [
1258PREFERRED_STACK_BOUNDARY=""
1259AC_MSG_RESULT([no])
1260])
daywalker3664f562003-10-17 13:43:46 +00001261CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001262
1263AC_SUBST(PREFERRED_STACK_BOUNDARY)
1264
sewardj535c50f2005-06-04 23:14:53 +00001265
sewardjb5f6f512005-03-10 23:59:00 +00001266# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001267AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001268
1269safe_CFLAGS=$CFLAGS
1270CFLAGS="-Wno-pointer-sign"
1271
bart417cf3e2011-10-22 09:21:24 +00001272AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001273 return 0;
bart417cf3e2011-10-22 09:21:24 +00001274]])], [
sewardjb5f6f512005-03-10 23:59:00 +00001275no_pointer_sign=yes
1276AC_MSG_RESULT([yes])
1277], [
1278no_pointer_sign=no
1279AC_MSG_RESULT([no])
1280])
1281CFLAGS=$safe_CFLAGS
1282
1283if test x$no_pointer_sign = xyes; then
1284 CFLAGS="$CFLAGS -Wno-pointer-sign"
1285fi
1286
sewardj535c50f2005-06-04 23:14:53 +00001287
barte026bd22009-07-04 12:17:07 +00001288# does this compiler support -Wno-empty-body ?
1289
1290AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1291
1292safe_CFLAGS=$CFLAGS
1293CFLAGS="-Wno-empty-body"
1294
bart417cf3e2011-10-22 09:21:24 +00001295AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
barte026bd22009-07-04 12:17:07 +00001296 return 0;
bart417cf3e2011-10-22 09:21:24 +00001297]])], [
barte026bd22009-07-04 12:17:07 +00001298AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1299AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001300], [
barte026bd22009-07-04 12:17:07 +00001301AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1302AC_MSG_RESULT([no])
1303])
1304CFLAGS=$safe_CFLAGS
1305
1306
bart9d865fa2008-06-23 12:11:49 +00001307# does this compiler support -Wno-format-zero-length ?
1308
1309AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1310
1311safe_CFLAGS=$CFLAGS
1312CFLAGS="-Wno-format-zero-length"
1313
bart417cf3e2011-10-22 09:21:24 +00001314AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart9d865fa2008-06-23 12:11:49 +00001315 return 0;
bart417cf3e2011-10-22 09:21:24 +00001316]])], [
bart9d865fa2008-06-23 12:11:49 +00001317AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1318AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001319], [
bart9d865fa2008-06-23 12:11:49 +00001320AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1321AC_MSG_RESULT([no])
1322])
1323CFLAGS=$safe_CFLAGS
1324
1325
bart8e216312011-05-15 17:05:36 +00001326# does this compiler support -Wno-nonnull ?
1327
1328AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
1329
1330safe_CFLAGS=$CFLAGS
1331CFLAGS="-Wno-nonnull"
1332
bart417cf3e2011-10-22 09:21:24 +00001333AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart8e216312011-05-15 17:05:36 +00001334 return 0;
bart417cf3e2011-10-22 09:21:24 +00001335]])], [
bart8e216312011-05-15 17:05:36 +00001336AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
1337AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001338], [
bart8e216312011-05-15 17:05:36 +00001339AC_SUBST([FLAG_W_NO_NONNULL], [])
1340AC_MSG_RESULT([no])
1341])
1342CFLAGS=$safe_CFLAGS
1343
1344
1345# does this compiler support -Wno-overflow ?
1346
1347AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
1348
1349safe_CFLAGS=$CFLAGS
1350CFLAGS="-Wno-overflow"
1351
bart417cf3e2011-10-22 09:21:24 +00001352AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart8e216312011-05-15 17:05:36 +00001353 return 0;
bart417cf3e2011-10-22 09:21:24 +00001354]])], [
bart8e216312011-05-15 17:05:36 +00001355AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
1356AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001357], [
bart8e216312011-05-15 17:05:36 +00001358AC_SUBST([FLAG_W_NO_OVERFLOW], [])
1359AC_MSG_RESULT([no])
1360])
1361CFLAGS=$safe_CFLAGS
1362
1363
bartbf9b85c2009-08-12 12:55:56 +00001364# does this compiler support -Wno-uninitialized ?
1365
1366AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1367
1368safe_CFLAGS=$CFLAGS
1369CFLAGS="-Wno-uninitialized"
1370
bart417cf3e2011-10-22 09:21:24 +00001371AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bartbf9b85c2009-08-12 12:55:56 +00001372 return 0;
bart417cf3e2011-10-22 09:21:24 +00001373]])], [
bartbf9b85c2009-08-12 12:55:56 +00001374AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1375AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001376], [
bartbf9b85c2009-08-12 12:55:56 +00001377AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1378AC_MSG_RESULT([no])
1379])
1380CFLAGS=$safe_CFLAGS
1381
1382
bart56730cd2008-05-11 06:41:46 +00001383# does this compiler support -Wextra or the older -W ?
1384
1385AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1386
1387safe_CFLAGS=$CFLAGS
1388CFLAGS="-Wextra"
1389
bart417cf3e2011-10-22 09:21:24 +00001390AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001391 return 0;
bart417cf3e2011-10-22 09:21:24 +00001392]])], [
bart56730cd2008-05-11 06:41:46 +00001393AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1394AC_MSG_RESULT([-Wextra])
1395], [
1396 CFLAGS="-W"
sewardj9bdf2a62011-10-27 06:22:23 +00001397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001398 return 0;
sewardj9bdf2a62011-10-27 06:22:23 +00001399 ]])], [
bart56730cd2008-05-11 06:41:46 +00001400 AC_SUBST([FLAG_W_EXTRA], [-W])
1401 AC_MSG_RESULT([-W])
1402 ], [
1403 AC_SUBST([FLAG_W_EXTRA], [])
1404 AC_MSG_RESULT([not supported])
1405 ])
1406])
1407CFLAGS=$safe_CFLAGS
1408
1409
sewardja72c26d2007-05-01 13:44:08 +00001410# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001411AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001412
1413safe_CFLAGS=$CFLAGS
1414CFLAGS="-fno-stack-protector"
1415
bart417cf3e2011-10-22 09:21:24 +00001416AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001417 return 0;
bart417cf3e2011-10-22 09:21:24 +00001418]])], [
sewardja72c26d2007-05-01 13:44:08 +00001419no_stack_protector=yes
1420FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1421AC_MSG_RESULT([yes])
1422], [
1423no_stack_protector=no
1424FLAG_FNO_STACK_PROTECTOR=""
1425AC_MSG_RESULT([no])
1426])
1427CFLAGS=$safe_CFLAGS
1428
1429AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1430
1431if test x$no_stack_protector = xyes; then
1432 CFLAGS="$CFLAGS -fno-stack-protector"
1433fi
1434
1435
bart56730cd2008-05-11 06:41:46 +00001436# does this compiler support --param inline-unit-growth=... ?
1437
1438AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1439
1440safe_CFLAGS=$CFLAGS
1441CFLAGS="--param inline-unit-growth=900"
1442
bart417cf3e2011-10-22 09:21:24 +00001443AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001444 return 0;
bart417cf3e2011-10-22 09:21:24 +00001445]])], [
bart56730cd2008-05-11 06:41:46 +00001446AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1447 ["--param inline-unit-growth=900"])
1448AC_MSG_RESULT([yes])
1449], [
1450AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1451AC_MSG_RESULT([no])
1452])
1453CFLAGS=$safe_CFLAGS
1454
1455
sewardjd9350682012-04-05 07:55:47 +00001456# does this compiler support -gdwarf-4 -fdebug-types-section ?
1457
1458AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
1459
1460safe_CFLAGS=$CFLAGS
1461CFLAGS="-gdwarf-4 -fdebug-types-section"
1462
1463AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1464 return 0;
1465]])], [
1466ac_have_dwarf4=yes
1467AC_MSG_RESULT([yes])
1468], [
1469ac_have_dwarf4=no
1470AC_MSG_RESULT([no])
1471])
1472AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
1473CFLAGS=$safe_CFLAGS
1474
1475
sewardjd3645802010-06-13 22:13:58 +00001476# does the linker support -Wl,--build-id=none ? Note, it's
1477# important that we test indirectly via whichever C compiler
1478# is selected, rather than testing /usr/bin/ld or whatever
1479# directly.
bart699fbac2010-06-08 18:23:59 +00001480
sewardjd3645802010-06-13 22:13:58 +00001481AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
bart699fbac2010-06-08 18:23:59 +00001482
1483safe_CFLAGS=$CFLAGS
1484CFLAGS="-Wl,--build-id=none"
1485
bart8508c752010-06-10 06:26:21 +00001486AC_LINK_IFELSE(
1487[AC_LANG_PROGRAM([ ], [return 0;])],
bart699fbac2010-06-08 18:23:59 +00001488[
1489 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1490 AC_MSG_RESULT([yes])
1491], [
1492 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1493 AC_MSG_RESULT([no])
1494])
1495CFLAGS=$safe_CFLAGS
1496
1497
sewardj00f1e622006-03-12 16:47:10 +00001498# does the ppc assembler support "mtocrf" et al?
1499AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1500
bart417cf3e2011-10-22 09:21:24 +00001501AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjdd4cbe12006-03-12 17:27:44 +00001502__asm__ __volatile__("mtocrf 4,0");
1503__asm__ __volatile__("mfocrf 0,4");
bart417cf3e2011-10-22 09:21:24 +00001504]])], [
sewardj00f1e622006-03-12 16:47:10 +00001505ac_have_as_ppc_mftocrf=yes
1506AC_MSG_RESULT([yes])
1507], [
1508ac_have_as_ppc_mftocrf=no
1509AC_MSG_RESULT([no])
1510])
1511if test x$ac_have_as_ppc_mftocrf = xyes ; then
1512 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1513fi
1514
1515
sewardjb5b87402011-03-07 16:05:35 +00001516CFLAGS=$safe_CFLAGS
1517
sewardjf0aabf82007-03-22 00:24:21 +00001518# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001519# Note, this doesn't generate a C-level symbol. It generates a
1520# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001521AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1522
bart417cf3e2011-10-22 09:21:24 +00001523AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjf0aabf82007-03-22 00:24:21 +00001524 do { long long int x;
1525 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1526 while (0)
bart417cf3e2011-10-22 09:21:24 +00001527]])], [
sewardjf0aabf82007-03-22 00:24:21 +00001528ac_have_as_sse3=yes
1529AC_MSG_RESULT([yes])
1530], [
1531ac_have_as_sse3=no
1532AC_MSG_RESULT([no])
1533])
sewardjfa18a262007-03-22 12:13:13 +00001534
1535AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001536
1537
sewardj6d6da5b2008-02-09 12:07:40 +00001538# Ditto for SSSE3 instructions (note extra S)
1539# Note, this doesn't generate a C-level symbol. It generates a
1540# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1541AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1542
florianc443b962011-10-28 21:37:19 +00001543save_CFLAGS="$CFLAGS"
1544CFLAGS="$CFLAGS -msse"
bart417cf3e2011-10-22 09:21:24 +00001545AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj6d6da5b2008-02-09 12:07:40 +00001546 do { long long int x;
1547 __asm__ __volatile__(
1548 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1549 while (0)
bart417cf3e2011-10-22 09:21:24 +00001550]])], [
sewardj6d6da5b2008-02-09 12:07:40 +00001551ac_have_as_ssse3=yes
1552AC_MSG_RESULT([yes])
1553], [
1554ac_have_as_ssse3=no
1555AC_MSG_RESULT([no])
1556])
florianc443b962011-10-28 21:37:19 +00001557CFLAGS="$save_CFLAGS"
sewardj6d6da5b2008-02-09 12:07:40 +00001558
1559AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1560
1561
sewardj27d176a2011-01-17 11:15:48 +00001562# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1563# Note, this doesn't generate a C-level symbol. It generates a
1564# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00001565AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
bart417cf3e2011-10-22 09:21:24 +00001566AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardje3ae8a32010-09-28 19:59:47 +00001567 do {
1568 __asm__ __volatile__(
1569 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1570 while (0)
bart417cf3e2011-10-22 09:21:24 +00001571]])], [
sewardje3ae8a32010-09-28 19:59:47 +00001572ac_have_as_pclmulqdq=yes
1573AC_MSG_RESULT([yes])
1574], [
1575ac_have_as_pclmulqdq=no
1576AC_MSG_RESULT([no])
1577])
1578
1579AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1580
1581
sewardj27d176a2011-01-17 11:15:48 +00001582# does the x86/amd64 assembler understand the LZCNT instruction?
1583# Note, this doesn't generate a C-level symbol. It generates a
1584# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00001585AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1586
bart417cf3e2011-10-22 09:21:24 +00001587AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
bart55e438b2010-09-14 10:53:57 +00001588 do {
1589 __asm__ __volatile__("lzcnt %rax,%rax");
1590 } while (0)
bart417cf3e2011-10-22 09:21:24 +00001591]])], [
bart55e438b2010-09-14 10:53:57 +00001592 ac_have_as_lzcnt=yes
1593 AC_MSG_RESULT([yes])
1594], [
1595 ac_have_as_lzcnt=no
1596 AC_MSG_RESULT([no])
1597])
1598
1599AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1600
sewardj27d176a2011-01-17 11:15:48 +00001601
1602# does the x86/amd64 assembler understand SSE 4.2 instructions?
1603# Note, this doesn't generate a C-level symbol. It generates a
1604# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
1605AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
1606
bart417cf3e2011-10-22 09:21:24 +00001607AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj27d176a2011-01-17 11:15:48 +00001608 do { long long int x;
1609 __asm__ __volatile__(
florianfdfca222012-01-17 13:16:50 +00001610 "crc32q %%r15,%%r15" : : : "r15" );
1611 __asm__ __volatile__(
1612 "pblendvb (%rcx), %xmm11"); }
sewardj27d176a2011-01-17 11:15:48 +00001613 while (0)
bart417cf3e2011-10-22 09:21:24 +00001614]])], [
sewardj27d176a2011-01-17 11:15:48 +00001615ac_have_as_sse42=yes
1616AC_MSG_RESULT([yes])
1617], [
1618ac_have_as_sse42=no
1619AC_MSG_RESULT([no])
1620])
1621
1622AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
1623
1624
sewardje089f012010-10-13 21:47:29 +00001625# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
1626# when building the tool executables. I think we should get rid of it.
1627#
sewardjb5f6f512005-03-10 23:59:00 +00001628# Check for TLS support in the compiler and linker
bart2bd9a682011-10-22 09:46:16 +00001629AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1630 [[return foo;]])],
1631 [vg_cv_linktime_tls=yes],
1632 [vg_cv_linktime_tls=no])
bartca9f2ad2008-06-02 07:14:20 +00001633# Native compilation: check whether running a program using TLS succeeds.
1634# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1635# succeeds but running programs using TLS fails.
bart2bd9a682011-10-22 09:46:16 +00001636# Cross-compiling: check whether linking a program using TLS succeeds.
bartca9f2ad2008-06-02 07:14:20 +00001637AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1638 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1639 [vg_cv_tls=$enableval],
1640 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1641 [[return foo;]])],
1642 [vg_cv_tls=yes],
bart2bd9a682011-10-22 09:46:16 +00001643 [vg_cv_tls=no],
1644 [vg_cv_tls=$vg_cv_linktime_tls])])])
sewardjb5f6f512005-03-10 23:59:00 +00001645
1646if test "$vg_cv_tls" = yes; then
1647AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1648fi
sewardj5b754b42002-06-03 22:53:35 +00001649
sewardj535c50f2005-06-04 23:14:53 +00001650
njn7fd6d382009-01-22 21:56:32 +00001651#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001652# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001653#----------------------------------------------------------------------------
1654
sewardjde4a1d02002-03-22 01:27:54 +00001655AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001656AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001657 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001658 endian.h \
1659 mqueue.h \
1660 sys/endian.h \
1661 sys/epoll.h \
1662 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001663 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001664 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001665 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001666 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001667 sys/syscall.h \
1668 sys/time.h \
1669 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001670 ])
sewardjde4a1d02002-03-22 01:27:54 +00001671
bart818f17e2011-09-17 06:24:49 +00001672# Verify whether the <linux/futex.h> header is usable.
1673AC_MSG_CHECKING([if <linux/futex.h> is usable])
1674
bart417cf3e2011-10-22 09:21:24 +00001675AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart818f17e2011-09-17 06:24:49 +00001676#include <linux/futex.h>
bart417cf3e2011-10-22 09:21:24 +00001677]], [[
bart818f17e2011-09-17 06:24:49 +00001678 return FUTEX_WAIT;
bart417cf3e2011-10-22 09:21:24 +00001679]])], [
bart78bfc712011-12-08 16:14:59 +00001680ac_have_usable_linux_futex_h=yes
bart818f17e2011-09-17 06:24:49 +00001681AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
1682 [Define to 1 if you have a usable <linux/futex.h> header file.])
1683AC_MSG_RESULT([yes])
1684], [
bart78bfc712011-12-08 16:14:59 +00001685ac_have_usable_linux_futex_h=no
bart818f17e2011-09-17 06:24:49 +00001686AC_MSG_RESULT([no])
1687])
1688
njn7fd6d382009-01-22 21:56:32 +00001689#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001690# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001691#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001692AC_TYPE_UID_T
1693AC_TYPE_OFF_T
1694AC_TYPE_SIZE_T
1695AC_HEADER_TIME
1696
sewardj535c50f2005-06-04 23:14:53 +00001697
njn7fd6d382009-01-22 21:56:32 +00001698#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001699# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001700#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001701AC_FUNC_MEMCMP
1702AC_FUNC_MMAP
sewardjde4a1d02002-03-22 01:27:54 +00001703
bart26288e42011-04-03 16:46:01 +00001704AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00001705AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001706
bartf5ceec82008-04-26 07:45:10 +00001707AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001708 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001709 epoll_create \
1710 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00001711 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001712 mallinfo \
1713 memchr \
1714 memset \
1715 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001716 mremap \
bartf5ceec82008-04-26 07:45:10 +00001717 ppoll \
bart6d45e922009-01-20 13:45:38 +00001718 pthread_barrier_init \
1719 pthread_condattr_setclock \
1720 pthread_mutex_timedlock \
1721 pthread_rwlock_timedrdlock \
1722 pthread_rwlock_timedwrlock \
1723 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001724 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001725 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001726 semtimedop \
1727 signalfd \
njn6cc22472009-03-16 03:46:48 +00001728 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001729 strchr \
1730 strdup \
1731 strpbrk \
1732 strrchr \
1733 strstr \
barta72a27b2010-04-29 06:22:17 +00001734 syscall \
bartf5ceec82008-04-26 07:45:10 +00001735 utimensat \
tom9e4b6362012-02-10 09:39:37 +00001736 process_vm_readv \
1737 process_vm_writev \
bartf5ceec82008-04-26 07:45:10 +00001738 ])
sewardjde4a1d02002-03-22 01:27:54 +00001739
bart623eec32008-07-29 17:54:49 +00001740# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1741# libraries with any shared object and/or executable. This is NOT what we
1742# want for e.g. vgpreload_core-x86-linux.so
1743LIBS=""
sewardj80637752006-03-02 13:48:21 +00001744
bart6d45e922009-01-20 13:45:38 +00001745AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1746 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001747AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1748 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001749AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1750 [test x$ac_cv_func_pthread_spin_lock = xyes])
1751
njn7fd6d382009-01-22 21:56:32 +00001752
1753#----------------------------------------------------------------------------
1754# MPI checks
1755#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001756# Do we have a useable MPI setup on the primary and/or secondary targets?
1757# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00001758# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00001759# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00001760# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001761MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00001762
sewardje9fa5062006-03-12 18:29:18 +00001763mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001764if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00001765 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1766 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001767 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001768elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00001769 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
1770 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001771 mflag_primary=$FLAG_M64
philippef7c54332012-05-17 15:32:54 +00001772elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
1773 mflag_primary="$FLAG_M32 -arch i386"
1774elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
1775 mflag_primary="$FLAG_M64 -arch x86_64"
sewardje9fa5062006-03-12 18:29:18 +00001776fi
1777
sewardj03d86f22006-10-17 00:57:24 +00001778mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001779if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1780 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001781 mflag_secondary=$FLAG_M32
philippef7c54332012-05-17 15:32:54 +00001782elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
1783 mflag_secondary="$FLAG_M32 -arch i386"
sewardj03d86f22006-10-17 00:57:24 +00001784fi
1785
1786
sewardj0ad46092006-03-02 17:09:16 +00001787AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001788 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001789 MPI_CC=$withval
1790)
sewardj03d86f22006-10-17 00:57:24 +00001791AC_SUBST(MPI_CC)
1792
philippef7c54332012-05-17 15:32:54 +00001793## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
1794## use these values in the check for a functioning mpicc.
1795##
1796## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
1797## mflag_primary/mflag_secondary are sufficient approximations of that behavior
1798AM_COND_IF([VGCONF_OS_IS_LINUX],
1799 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
1800 LDFLAGS_MPI="-fpic -shared"])
1801AM_COND_IF([VGCONF_OS_IS_DARWIN],
1802 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
1803 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
1804
1805AC_SUBST([CFLAGS_MPI])
1806AC_SUBST([LDFLAGS_MPI])
1807
1808
sewardj03d86f22006-10-17 00:57:24 +00001809## See if MPI_CC works for the primary target
1810##
1811AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001812saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001813saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001814CC=$MPI_CC
philippef7c54332012-05-17 15:32:54 +00001815CFLAGS="$CFLAGS_MPI $mflag_primary"
1816saved_LDFLAGS="$LDFLAGS"
1817LDFLAGS="$LDFLAGS_MPI $mflag_primary"
bart417cf3e2011-10-22 09:21:24 +00001818AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj1a85e602006-03-08 15:26:10 +00001819#include <mpi.h>
1820#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00001821]], [[
philippef7c54332012-05-17 15:32:54 +00001822 int ni, na, nd, comb;
sewardjde4f3842006-03-09 02:41:41 +00001823 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00001824 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
1825 r |= MPI_Finalize();
sewardjde4f3842006-03-09 02:41:41 +00001826 return r;
bart417cf3e2011-10-22 09:21:24 +00001827]])], [
sewardj03d86f22006-10-17 00:57:24 +00001828ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001829AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001830], [
sewardj03d86f22006-10-17 00:57:24 +00001831ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001832AC_MSG_RESULT([no])
1833])
sewardj0ad46092006-03-02 17:09:16 +00001834CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001835CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00001836LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00001837AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001838
sewardj03d86f22006-10-17 00:57:24 +00001839## See if MPI_CC works for the secondary target. Complication: what if
1840## there is no secondary target? We need this to then fail.
1841## Kludge this by making MPI_CC something which will surely fail in
1842## such a case.
1843##
1844AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1845saved_CC=$CC
1846saved_CFLAGS=$CFLAGS
philippef7c54332012-05-17 15:32:54 +00001847saved_LDFLAGS="$LDFLAGS"
1848LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
njn7fd6d382009-01-22 21:56:32 +00001849if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001850 CC="$MPI_CC this will surely fail"
1851else
1852 CC=$MPI_CC
1853fi
philippef7c54332012-05-17 15:32:54 +00001854CFLAGS="$CFLAGS_MPI $mflag_secondary"
bart417cf3e2011-10-22 09:21:24 +00001855AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj03d86f22006-10-17 00:57:24 +00001856#include <mpi.h>
1857#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00001858]], [[
philippef7c54332012-05-17 15:32:54 +00001859 int ni, na, nd, comb;
sewardj03d86f22006-10-17 00:57:24 +00001860 int r = MPI_Init(NULL,NULL);
philippef7c54332012-05-17 15:32:54 +00001861 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
1862 r |= MPI_Finalize();
sewardj03d86f22006-10-17 00:57:24 +00001863 return r;
bart417cf3e2011-10-22 09:21:24 +00001864]])], [
sewardj03d86f22006-10-17 00:57:24 +00001865ac_have_mpi2_sec=yes
1866AC_MSG_RESULT([yes, $MPI_CC])
1867], [
1868ac_have_mpi2_sec=no
1869AC_MSG_RESULT([no])
1870])
1871CC=$saved_CC
1872CFLAGS=$saved_CFLAGS
philippef7c54332012-05-17 15:32:54 +00001873LDFLAGS="$saved_LDFLAGS"
sewardj03d86f22006-10-17 00:57:24 +00001874AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001875
1876
njn7fd6d382009-01-22 21:56:32 +00001877#----------------------------------------------------------------------------
1878# Other library checks
1879#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00001880# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00001881# tests are present because Drd has some regression tests that use
1882# these packages. All regression test programs all compiled only
1883# for the primary target. And so it is important that the configure
1884# checks that follow, use the correct -m32 or -m64 flag for the
1885# primary target (called $mflag_primary). Otherwise, we can end up
1886# in a situation (eg) where, on amd64-linux, the test for Boost checks
1887# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1888# only build (meaning, the primary target is x86-linux), the build
1889# of the regtest programs that use Boost fails, because they are
1890# build as 32-bit (IN THIS EXAMPLE).
1891#
1892# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1893# NEEDED BY THE REGRESSION TEST PROGRAMS.
1894
1895
sewardj493c4ef2008-12-13 16:45:19 +00001896# Check whether the boost library 1.35 or later has been installed.
1897# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1898
1899AC_MSG_CHECKING([for boost])
1900
1901AC_LANG(C++)
1902safe_CXXFLAGS=$CXXFLAGS
bart7129c722012-04-18 18:34:22 +00001903CXXFLAGS="$mflag_primary"
1904safe_LIBS="$LIBS"
1905LIBS="-lboost_thread-mt $LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00001906
bart128fc522011-03-12 10:36:35 +00001907AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001908#include <boost/thread.hpp>
1909static void thread_func(void)
1910{ }
1911int main(int argc, char** argv)
1912{
1913 boost::thread t(thread_func);
1914 return 0;
1915}
bart128fc522011-03-12 10:36:35 +00001916])],
sewardj493c4ef2008-12-13 16:45:19 +00001917[
1918ac_have_boost_1_35=yes
1919AC_SUBST([BOOST_CFLAGS], [])
bartbb31f2d2012-04-18 18:42:34 +00001920AC_SUBST([BOOST_LIBS], [-lboost_thread-mt])
sewardj493c4ef2008-12-13 16:45:19 +00001921AC_MSG_RESULT([yes])
1922], [
1923ac_have_boost_1_35=no
1924AC_MSG_RESULT([no])
1925])
1926
bart7129c722012-04-18 18:34:22 +00001927LIBS="$safe_LIBS"
sewardj493c4ef2008-12-13 16:45:19 +00001928CXXFLAGS=$safe_CXXFLAGS
1929AC_LANG(C)
1930
1931AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1932
1933
1934# does this compiler support -fopenmp, does it have the include file
1935# <omp.h> and does it have libgomp ?
1936
1937AC_MSG_CHECKING([for OpenMP])
1938
1939safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001940CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001941
bart128fc522011-03-12 10:36:35 +00001942AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001943#include <omp.h>
1944int main(int argc, char** argv)
1945{
1946 omp_set_dynamic(0);
1947 return 0;
1948}
bart128fc522011-03-12 10:36:35 +00001949])],
sewardj493c4ef2008-12-13 16:45:19 +00001950[
1951ac_have_openmp=yes
1952AC_MSG_RESULT([yes])
1953], [
1954ac_have_openmp=no
1955AC_MSG_RESULT([no])
1956])
1957CFLAGS=$safe_CFLAGS
1958
1959AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1960
1961
bart78bfc712011-12-08 16:14:59 +00001962# does this compiler have built-in functions for atomic memory access for the
1963# primary target ?
1964AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
sewardjc876a2f2009-01-22 22:44:30 +00001965
1966safe_CFLAGS=$CFLAGS
1967CFLAGS="$mflag_primary"
1968
bart417cf3e2011-10-22 09:21:24 +00001969AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjc876a2f2009-01-22 22:44:30 +00001970 int variable = 1;
1971 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1972 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00001973]])], [
bartb4ff7822011-12-10 19:48:04 +00001974 ac_have_builtin_atomic_primary=yes
sewardjc876a2f2009-01-22 22:44:30 +00001975 AC_MSG_RESULT([yes])
bart78bfc712011-12-08 16:14:59 +00001976 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 +00001977], [
bartb4ff7822011-12-10 19:48:04 +00001978 ac_have_builtin_atomic_primary=no
sewardjc876a2f2009-01-22 22:44:30 +00001979 AC_MSG_RESULT([no])
1980])
1981
1982CFLAGS=$safe_CFLAGS
1983
bartb4ff7822011-12-10 19:48:04 +00001984AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
1985 [test x$ac_have_builtin_atomic_primary = xyes])
bartc82d1372009-05-31 16:21:23 +00001986
bart78bfc712011-12-08 16:14:59 +00001987
1988# does this compiler have built-in functions for atomic memory access for the
1989# secondary target ?
1990
1991if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
1992
1993AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
1994
1995safe_CFLAGS=$CFLAGS
1996CFLAGS="$mflag_secondary"
1997
1998AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
1999 int variable = 1;
2000 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
2001]])], [
2002 ac_have_builtin_atomic_secondary=yes
2003 AC_MSG_RESULT([yes])
2004], [
2005 ac_have_builtin_atomic_secondary=no
2006 AC_MSG_RESULT([no])
2007])
2008
2009CFLAGS=$safe_CFLAGS
2010
2011fi
2012
2013AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
2014 [test x$ac_have_builtin_atomic_secondary = xyes])
2015
bart1e856ea2011-12-17 12:53:23 +00002016# does this compiler have built-in functions for atomic memory access on
2017# 64-bit integers for all targets ?
2018
2019AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
2020
2021AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2022 #include <stdint.h>
2023]], [[
2024 uint64_t variable = 1;
2025 return __sync_add_and_fetch(&variable, 1)
2026]])], [
2027 ac_have_builtin_atomic64_primary=yes
2028], [
2029 ac_have_builtin_atomic64_primary=no
2030])
2031
2032if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2033
2034safe_CFLAGS=$CFLAGS
2035CFLAGS="$mflag_secondary"
2036
2037AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2038 #include <stdint.h>
2039]], [[
2040 uint64_t variable = 1;
2041 return __sync_add_and_fetch(&variable, 1)
2042]])], [
2043 ac_have_builtin_atomic64_secondary=yes
2044], [
2045 ac_have_builtin_atomic64_secondary=no
2046])
2047
2048CFLAGS=$safe_CFLAGS
2049
2050fi
2051
2052if test x$ac_have_builtin_atomic64_primary = xyes && \
2053 test x$VGCONF_PLATFORM_SEC_CAPS = x \
2054 -o x$ac_have_builtin_atomic64_secondary = xyes; then
2055 AC_MSG_RESULT([yes])
2056 ac_have_builtin_atomic64=yes
2057else
2058 AC_MSG_RESULT([no])
2059 ac_have_builtin_atomic64=no
2060fi
2061
2062AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
2063 [test x$ac_have_builtin_atomic64 = xyes])
2064
bart78bfc712011-12-08 16:14:59 +00002065
barte8740422011-03-24 20:27:54 +00002066# does g++ have built-in functions for atomic memory access ?
bart78bfc712011-12-08 16:14:59 +00002067AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
barte8740422011-03-24 20:27:54 +00002068
2069safe_CXXFLAGS=$CXXFLAGS
2070CXXFLAGS="$mflag_primary"
2071
2072AC_LANG_PUSH(C++)
bart417cf3e2011-10-22 09:21:24 +00002073AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
barte8740422011-03-24 20:27:54 +00002074 int variable = 1;
2075 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2076 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00002077]])], [
barte8740422011-03-24 20:27:54 +00002078 ac_have_builtin_atomic_cxx=yes
2079 AC_MSG_RESULT([yes])
2080 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 +00002081], [
barte8740422011-03-24 20:27:54 +00002082 ac_have_builtin_atomic_cxx=no
2083 AC_MSG_RESULT([no])
2084])
2085AC_LANG_POP(C++)
2086
2087CXXFLAGS=$safe_CXXFLAGS
2088
2089AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00002090
bart78bfc712011-12-08 16:14:59 +00002091
2092if test x$ac_have_usable_linux_futex_h = xyes \
bartb4ff7822011-12-10 19:48:04 +00002093 -a x$ac_have_builtin_atomic_primary = xyes; then
bart78bfc712011-12-08 16:14:59 +00002094 ac_enable_linux_ticket_lock_primary=yes
2095fi
2096AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
2097 [test x$ac_enable_linux_ticket_lock_primary = xyes])
2098
2099if test x$VGCONF_PLATFORM_SEC_CAPS != x \
2100 -a x$ac_have_usable_linux_futex_h = xyes \
2101 -a x$ac_have_builtin_atomic_secondary = xyes; then
2102 ac_enable_linux_ticket_lock_secondary=yes
2103fi
2104AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
2105 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
2106
2107
bartf68af882011-12-10 19:42:05 +00002108# does libstdc++ support annotating shared pointers ?
2109AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
2110
2111safe_CXXFLAGS=$CFLAGS
2112CXXFLAGS="-std=c++0x"
2113
2114AC_LANG_PUSH(C++)
2115AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2116 #include <memory>
2117]], [[
2118 std::shared_ptr<int> p
2119]])], [
2120 ac_have_shared_ptr=yes
2121], [
2122 ac_have_shared_ptr=no
2123])
2124if test x$ac_have_shared_ptr = xyes; then
2125 # If compilation of the program below fails because of a syntax error
2126 # triggered by substituting one of the annotation macros then that
2127 # means that libstdc++ supports these macros.
2128 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2129 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
2130 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
2131 #include <memory>
2132 ]], [[
2133 std::shared_ptr<int> p
2134 ]])], [
2135 ac_have_shared_pointer_annotation=no
2136 AC_MSG_RESULT([no])
2137 ], [
2138 ac_have_shared_pointer_annotation=yes
2139 AC_MSG_RESULT([yes])
2140 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
2141 [Define to 1 if libstd++ supports annotating shared pointers])
2142 ])
2143else
2144 ac_have_shared_pointer_annotation=no
2145 AC_MSG_RESULT([no])
2146fi
2147AC_LANG_POP(C++)
2148
2149CXXFLAGS=$safe_CXXFLAGS
2150
2151AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
2152 [test x$ac_have_shared_pointer_annotation = xyes])
2153
2154
njn7fd6d382009-01-22 21:56:32 +00002155#----------------------------------------------------------------------------
2156# Ok. We're done checking.
2157#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00002158
njn8b68b642009-06-24 00:37:09 +00002159# Nb: VEX/Makefile is generated from Makefile.vex.in.
2160AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00002161 Makefile
njn8b68b642009-06-24 00:37:09 +00002162 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00002163 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00002164 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00002165 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00002166 docs/Makefile
2167 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00002168 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00002169 perf/Makefile
2170 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00002171 gdbserver_tests/Makefile
njn254d542432002-09-23 16:09:39 +00002172 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00002173 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00002174 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00002175 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002176 memcheck/Makefile
2177 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00002178 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00002179 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00002180 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00002181 memcheck/tests/darwin/Makefile
njnea2d6fd2010-07-01 00:20:20 +00002182 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00002183 memcheck/tests/x86-linux/Makefile
sewardj0e342a02010-09-03 23:49:33 +00002184 memcheck/tests/ppc32/Makefile
2185 memcheck/tests/ppc64/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002186 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002187 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00002188 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00002189 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00002190 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00002191 callgrind/Makefile
2192 callgrind/callgrind_annotate
2193 callgrind/callgrind_control
2194 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002195 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00002196 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00002197 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00002198 massif/tests/Makefile
njnd5a8d242007-11-02 20:44:57 +00002199 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00002200 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00002201 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00002202 none/Makefile
2203 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00002204 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00002205 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00002206 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00002207 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00002208 none/tests/arm/Makefile
sewardjb5b87402011-03-07 16:05:35 +00002209 none/tests/s390x/Makefile
njn0458a122009-02-13 06:23:46 +00002210 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00002211 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00002212 none/tests/x86-linux/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00002213 exp-sgcheck/Makefile
2214 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00002215 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00002216 drd/scripts/download-and-build-splash2
2217 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00002218 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00002219 exp-bbv/tests/Makefile
2220 exp-bbv/tests/x86/Makefile
2221 exp-bbv/tests/x86-linux/Makefile
2222 exp-bbv/tests/amd64-linux/Makefile
2223 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00002224 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00002225 exp-dhat/Makefile
2226 exp-dhat/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00002227])
sewardjd3645802010-06-13 22:13:58 +00002228AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
2229 [chmod +x coregrind/link_tool_exe_linux])
2230AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
2231 [chmod +x coregrind/link_tool_exe_darwin])
njn8b68b642009-06-24 00:37:09 +00002232AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00002233
2234cat<<EOF
2235
njn311303f2009-02-06 03:46:50 +00002236 Maximum build arch: ${ARCH_MAX}
2237 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00002238 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00002239 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00002240 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
2241 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardjcb495c82011-07-11 20:42:34 +00002242 Platform variant: ${VGCONF_PLATVARIANT}
2243 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
sewardje95d94f2008-09-19 09:02:19 +00002244 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00002245
gobry3b777892002-04-04 09:18:39 +00002246EOF