blob: 9a635c20215c8f6dcf7b936e8efab59dcc8d65fd [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
109# OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
110# 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)
111# Clang: clang version 2.9 (tags/RELEASE_29/final)
sewardja8ca2c52011-09-29 18:18:37 +0000112#
113[gcc_version=`${CC} --version \
bart85037442011-11-22 14:41:31 +0000114 | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p' \
115 -e 's/[^ ]*clang version \([0-9.]*\).*$/\1/p'`]
gobrye721a522002-03-22 13:38:30 +0000116
sewardj3ab7b662011-09-29 17:30:13 +0000117is_clang="notclang"
118if test "x`${CC} --version | head -n 1 | $SED 's/\(clang\) version.*/\1/'`" = "xclang" ; then
119 is_clang="clang"
120fi
121
122case "${is_clang}-${gcc_version}" in
123 notclang-3.*)
124 AC_MSG_RESULT([ok (${gcc_version})])
125 ;;
126 notclang-4.*)
127 AC_MSG_RESULT([ok (${gcc_version})])
128 ;;
129 clang-2.9)
130 AC_MSG_RESULT([ok (clang-${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000131 ;;
gobrye721a522002-03-22 13:38:30 +0000132 *)
sewardj3ab7b662011-09-29 17:30:13 +0000133 AC_MSG_RESULT([no (${gcc_version})])
134 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9])
gobrye721a522002-03-22 13:38:30 +0000135 ;;
136esac
137
njn7fd6d382009-01-22 21:56:32 +0000138#----------------------------------------------------------------------------
139# Arch/OS/platform tests.
140#----------------------------------------------------------------------------
141# We create a number of arch/OS/platform-related variables. We prefix them
142# all with "VGCONF_" which indicates that they are defined at
143# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
144# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000145
sewardjde4a1d02002-03-22 01:27:54 +0000146AC_CANONICAL_HOST
147
148AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000149
njn7fd6d382009-01-22 21:56:32 +0000150# ARCH_MAX reflects the most that this CPU can do: for example if it
151# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
152# Ditto for amd64. It is used for more configuration below, but is not used
153# outside this file.
gobrye721a522002-03-22 13:38:30 +0000154case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000155 i?86)
156 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000157 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000158 ;;
159
njnfe408942004-11-23 17:52:24 +0000160 x86_64)
161 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000162 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000163 ;;
164
sewardj2c48c7b2005-11-29 13:05:56 +0000165 powerpc64)
166 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000167 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000168 ;;
169
170 powerpc)
sewardj6e9de462011-06-28 07:25:29 +0000171 # On Linux this means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000172 AC_MSG_RESULT([ok (${host_cpu})])
sewardj6e9de462011-06-28 07:25:29 +0000173 ARCH_MAX="ppc32"
nethercote9bcc9062004-10-13 13:50:01 +0000174 ;;
175
sewardjb5b87402011-03-07 16:05:35 +0000176 s390x)
177 AC_MSG_RESULT([ok (${host_cpu})])
178 ARCH_MAX="s390x"
179 ;;
180
sewardj59570ff2010-01-01 11:59:33 +0000181 armv7*)
182 AC_MSG_RESULT([ok (${host_cpu})])
183 ARCH_MAX="arm"
184 ;;
185
sewardjde4a1d02002-03-22 01:27:54 +0000186 *)
187 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000188 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000189 ;;
190esac
191
njn7fd6d382009-01-22 21:56:32 +0000192#----------------------------------------------------------------------------
193
sewardj86e992f2006-01-28 18:39:09 +0000194# Sometimes it's convenient to subvert the bi-arch build system and
195# just have a single build even though the underlying platform is
196# capable of both. Hence handle --enable-only64bit and
197# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000198# [Actually, if either of these options are used, I think both get built,
199# but only one gets installed. So if you use an in-place build, both can be
200# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000201
202# Check if a 64-bit only build has been requested
203AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
204 [AC_ARG_ENABLE(only64bit,
205 [ --enable-only64bit do a 64-bit only build],
206 [vg_cv_only64bit=$enableval],
207 [vg_cv_only64bit=no])])
208
209# Check if a 32-bit only build has been requested
210AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
211 [AC_ARG_ENABLE(only32bit,
212 [ --enable-only32bit do a 32-bit only build],
213 [vg_cv_only32bit=$enableval],
214 [vg_cv_only32bit=no])])
215
216# Stay sane
217if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
218 AC_MSG_ERROR(
219 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
220fi
221
njn7fd6d382009-01-22 21:56:32 +0000222#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000223
njn311303f2009-02-06 03:46:50 +0000224# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
225# compilation of many C files via -VGO_$(VGCONF_OS) and
226# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000227AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000228AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000229
njnf76d27a2009-05-28 01:53:07 +0000230DEFAULT_SUPP=""
231
gobrye721a522002-03-22 13:38:30 +0000232case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000233 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000234 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000235 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000236
237 # Ok, this is linux. Check the kernel version
238 AC_MSG_CHECKING([for the kernel version])
239
240 kernel=`uname -r`
241
242 case "${kernel}" in
bart0419e512011-06-05 08:51:47 +0000243 2.6.*|3.*)
bart2d6e6e72011-06-05 10:01:48 +0000244 AC_MSG_RESULT([2.6.x/3.x family (${kernel})])
245 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 +0000246 ;;
247
248 2.4.*)
249 AC_MSG_RESULT([2.4 family (${kernel})])
250 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
251 ;;
252
mueller8c68e042004-01-03 15:21:14 +0000253 *)
254 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000255 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000256 ;;
257 esac
258
259 ;;
260
njnf76d27a2009-05-28 01:53:07 +0000261 *darwin*)
262 AC_MSG_RESULT([ok (${host_os})])
263 VGCONF_OS="darwin"
njnea2d6fd2010-07-01 00:20:20 +0000264 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
265 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
266 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
njnf76d27a2009-05-28 01:53:07 +0000267
268 AC_MSG_CHECKING([for the kernel version])
269 kernel=`uname -r`
270
271 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
272 # has only one relevant version, the OS version. The `uname` check
273 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
sewardj731f9cf2011-09-21 08:43:08 +0000274 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
275 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
njnea2d6fd2010-07-01 00:20:20 +0000276 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000277 #
278 # XXX: `uname -r` won't do the right thing for cross-compiles, but
279 # that's not a problem yet.
sewardj731f9cf2011-09-21 08:43:08 +0000280 #
281 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
282 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
283 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
284 # time support for 10.5 (the 9.* pattern just below), I'll leave it
285 # in for now, just in case anybody wants to give it a try. But I'm
286 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
njnf76d27a2009-05-28 01:53:07 +0000287 case "${kernel}" in
288 9.*)
289 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000290 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000291 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000292 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000293 ;;
njnea2d6fd2010-07-01 00:20:20 +0000294 10.*)
295 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
296 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
297 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
298 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
299 ;;
sewardj731f9cf2011-09-21 08:43:08 +0000300 11.*)
301 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
302 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
303 # FIXME: change these to xx11.supp
304 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
305 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
306 ;;
307 *)
njnf76d27a2009-05-28 01:53:07 +0000308 AC_MSG_RESULT([unsupported (${kernel})])
sewardj731f9cf2011-09-21 08:43:08 +0000309 AC_MSG_ERROR([Valgrind works on Darwin 10.x and 11.x (Mac OS X 10.6/7)])
njnf76d27a2009-05-28 01:53:07 +0000310 ;;
311 esac
312 ;;
313
sewardjde4a1d02002-03-22 01:27:54 +0000314 *)
315 AC_MSG_RESULT([no (${host_os})])
njncc58cea2010-07-05 07:21:22 +0000316 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
sewardjde4a1d02002-03-22 01:27:54 +0000317 ;;
318esac
319
njn7fd6d382009-01-22 21:56:32 +0000320#----------------------------------------------------------------------------
321
tomd6398392006-06-07 17:44:36 +0000322# If we are building on a 64 bit platform test to see if the system
323# supports building 32 bit programs and disable 32 bit support if it
324# does not support building 32 bit programs
325
njn7fd6d382009-01-22 21:56:32 +0000326case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000327 amd64-linux|ppc64-linux)
328 AC_MSG_CHECKING([for 32 bit build support])
329 safe_CFLAGS=$CFLAGS
330 CFLAGS="-m32"
bart417cf3e2011-10-22 09:21:24 +0000331 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +0000332 return 0;
bart417cf3e2011-10-22 09:21:24 +0000333 ]])], [
tomd6398392006-06-07 17:44:36 +0000334 AC_MSG_RESULT([yes])
335 ], [
336 vg_cv_only64bit="yes"
337 AC_MSG_RESULT([no])
338 ])
339 CFLAGS=$safe_CFLAGS;;
340esac
341
342if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
343 AC_MSG_ERROR(
344 [--enable-only32bit was specified but system does not support 32 bit builds])
345fi
nethercote888ecb72004-08-23 14:54:40 +0000346
njn7fd6d382009-01-22 21:56:32 +0000347#----------------------------------------------------------------------------
348
njn311303f2009-02-06 03:46:50 +0000349# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
350# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
351# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
352# above) will be "amd64" since that reflects the most that this cpu can do,
353# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
354# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000355# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
356# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
357AC_SUBST(VGCONF_ARCH_PRI)
358
njn3f8a6e92009-06-02 00:20:47 +0000359# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
360# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
361# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
362# It is empty if there is no secondary target.
363AC_SUBST(VGCONF_ARCH_SEC)
364
njn311303f2009-02-06 03:46:50 +0000365# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
366# The entire system, including regression and performance tests, will be
367# built for this target. The "_CAPS" indicates that the name is in capital
368# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000369# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000370# convention and cannot contain '-' characters. This is in contrast to
371# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000372AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
373
374# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
375# Valgrind and tools will also be built for this target, but not the
376# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000377#
njn7fd6d382009-01-22 21:56:32 +0000378# By default, the primary arch is the same as the "max" arch, as commented
379# above (at the definition of ARCH_MAX). We may choose to downgrade it in
380# the big case statement just below here, in the case where we're building
381# on a 64 bit machine but have been requested only to do a 32 bit build.
382AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
383
sewardj01262142006-01-04 01:20:28 +0000384AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000385
njnea2d6fd2010-07-01 00:20:20 +0000386# NB. The load address for a given platform may be specified in more
387# than one place, in some cases, depending on whether we're doing a biarch,
388# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
389# Be careful to give consistent values in all subcases. Also, all four
390# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
391# even if it is to "0xUNSET".
392#
njn7fd6d382009-01-22 21:56:32 +0000393case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000394 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000395 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000396 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000397 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
398 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000399 valt_load_address_pri_norml="0x38000000"
400 valt_load_address_pri_inner="0x28000000"
401 valt_load_address_sec_norml="0xUNSET"
402 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000403 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000404 ;;
405 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000406 valt_load_address_sec_norml="0xUNSET"
407 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000408 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000409 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000410 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000411 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
412 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000413 valt_load_address_pri_norml="0x38000000"
414 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000415 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000416 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000417 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000418 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
419 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000420 valt_load_address_pri_norml="0x38000000"
421 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000422 else
njn7fd6d382009-01-22 21:56:32 +0000423 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000424 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000425 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
426 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000427 valt_load_address_pri_norml="0x38000000"
428 valt_load_address_pri_inner="0x28000000"
429 valt_load_address_sec_norml="0x38000000"
430 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000431 fi
njn377c43f2009-05-19 07:39:22 +0000432 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000433 ;;
434 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000435 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000436 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000437 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
438 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000439 valt_load_address_pri_norml="0x38000000"
440 valt_load_address_pri_inner="0x28000000"
441 valt_load_address_sec_norml="0xUNSET"
442 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000443 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000444 ;;
445 ppc64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000446 valt_load_address_sec_norml="0xUNSET"
447 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000448 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000449 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000450 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000451 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
452 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000453 valt_load_address_pri_norml="0x38000000"
454 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000455 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000456 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000457 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000458 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
459 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000460 valt_load_address_pri_norml="0x38000000"
461 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000462 else
njn7fd6d382009-01-22 21:56:32 +0000463 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000464 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000465 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
466 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000467 valt_load_address_pri_norml="0x38000000"
468 valt_load_address_pri_inner="0x28000000"
469 valt_load_address_sec_norml="0x38000000"
470 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000471 fi
njn377c43f2009-05-19 07:39:22 +0000472 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000473 ;;
njncc58cea2010-07-05 07:21:22 +0000474 # Darwin gets identified as 32-bit even when it supports 64-bit.
475 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
476 # all Macs support both 32-bit and 64-bit, so we just build both. If
477 # someone has a really old 32-bit only machine they can (hopefully?)
478 # build with --enable-only32bit. See bug 243362.
479 x86-darwin|amd64-darwin)
480 ARCH_MAX="amd64"
njnea2d6fd2010-07-01 00:20:20 +0000481 valt_load_address_sec_norml="0xUNSET"
482 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000483 if test x$vg_cv_only64bit = xyes; then
484 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000485 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000486 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
487 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000488 valt_load_address_pri_norml="0x138000000"
489 valt_load_address_pri_inner="0x128000000"
njnf76d27a2009-05-28 01:53:07 +0000490 elif test x$vg_cv_only32bit = xyes; then
491 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000492 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000493 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
494 VGCONF_PLATFORM_SEC_CAPS=""
495 VGCONF_ARCH_PRI_CAPS="x86"
njnea2d6fd2010-07-01 00:20:20 +0000496 valt_load_address_pri_norml="0x38000000"
497 valt_load_address_pri_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000498 else
499 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000500 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000501 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
502 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
njnea2d6fd2010-07-01 00:20:20 +0000503 valt_load_address_pri_norml="0x138000000"
504 valt_load_address_pri_inner="0x128000000"
505 valt_load_address_sec_norml="0x38000000"
506 valt_load_address_sec_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000507 fi
njnf76d27a2009-05-28 01:53:07 +0000508 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
509 ;;
sewardj59570ff2010-01-01 11:59:33 +0000510 arm-linux)
511 VGCONF_ARCH_PRI="arm"
512 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
513 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000514 valt_load_address_pri_norml="0x38000000"
515 valt_load_address_pri_inner="0x28000000"
516 valt_load_address_sec_norml="0xUNSET"
517 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000518 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
519 ;;
sewardjb5b87402011-03-07 16:05:35 +0000520 s390x-linux)
521 VGCONF_ARCH_PRI="s390x"
522 VGCONF_ARCH_SEC=""
523 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
524 VGCONF_PLATFORM_SEC_CAPS=""
525 # we want to have the generated code close to the dispatcher
526 valt_load_address_pri_norml="0x401000000"
527 valt_load_address_pri_inner="0x410000000"
528 valt_load_address_sec_norml="0xUNSET"
529 valt_load_address_sec_inner="0xUNSET"
530 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
531 ;;
nethercote888ecb72004-08-23 14:54:40 +0000532 *)
njn7fd6d382009-01-22 21:56:32 +0000533 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000534 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000535 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
536 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000537 valt_load_address_pri_norml="0xUNSET"
538 valt_load_address_pri_inner="0xUNSET"
539 valt_load_address_sec_norml="0xUNSET"
540 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000541 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000542 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000543 ;;
544esac
sewardjde4a1d02002-03-22 01:27:54 +0000545
njn7fd6d382009-01-22 21:56:32 +0000546#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000547
njn7fd6d382009-01-22 21:56:32 +0000548# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
549# defined.
550AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
551 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000552 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
553 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
554 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000555AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000556 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
557 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000558AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
559 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj6e9de462011-06-28 07:25:29 +0000560 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000561AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
sewardj6e9de462011-06-28 07:25:29 +0000562 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX )
sewardj59570ff2010-01-01 11:59:33 +0000563AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
564 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardjb5b87402011-03-07 16:05:35 +0000565AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
566 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000567
njn7fd6d382009-01-22 21:56:32 +0000568# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
569# become defined.
570AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
571 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
572 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
573AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
574 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
575AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
576 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
577 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
578AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
579 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000580AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
581 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
sewardjb5b87402011-03-07 16:05:35 +0000582AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
583 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
584 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000585
njnf76d27a2009-05-28 01:53:07 +0000586AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
587 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
588 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
589AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
590 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
591
592
sewardj72a2d802010-07-29 05:24:20 +0000593# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000594# Relies on the assumption that the primary and secondary targets are
595# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000596AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
597 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
598 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
599 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000600 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +0000601 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
602 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000603AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
604 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
605 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000606
607
njn7fd6d382009-01-22 21:56:32 +0000608# Sometimes, in the Makefile.am files, it's useful to know whether or not
609# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000610AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000611 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000612
tomb637bad2005-11-08 12:28:35 +0000613
njn7fd6d382009-01-22 21:56:32 +0000614#----------------------------------------------------------------------------
615# Inner Valgrind?
616#----------------------------------------------------------------------------
617
njnd74b0ef2009-01-20 06:06:52 +0000618# Check if this should be built as an inner Valgrind, to be run within
619# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000620AC_SUBST(VALT_LOAD_ADDRESS_PRI)
621AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000622AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
623 [AC_ARG_ENABLE(inner,
624 [ --enable-inner enables self-hosting],
625 [vg_cv_inner=$enableval],
626 [vg_cv_inner=no])])
627if test "$vg_cv_inner" = yes; then
628 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000629 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
630 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000631else
njnea2d6fd2010-07-01 00:20:20 +0000632 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
633 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000634fi
635
636
njn7fd6d382009-01-22 21:56:32 +0000637#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000638# Extra fine-tuning of installation directories
639#----------------------------------------------------------------------------
640AC_ARG_WITH(tmpdir,
641 [ --with-tmpdir=PATH Specify path for temporary files],
642 tmpdir="$withval",
643 tmpdir="/tmp")
644AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
645
sewardj0ba37c92011-07-12 11:46:24 +0000646
sewardjcb495c82011-07-11 20:42:34 +0000647#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000648# Libc and suppressions
649#----------------------------------------------------------------------------
650# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000651AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000652
bart12e91122010-05-15 08:37:24 +0000653AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000654
bart12e91122010-05-15 08:37:24 +0000655if test x$ac_cv_header_features_h = xyes; then
656 rm -f conftest.$ac_ext
657 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000658#include <features.h>
bart12e91122010-05-15 08:37:24 +0000659#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
660glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000661#endif
bart12e91122010-05-15 08:37:24 +0000662_ACEOF
663 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
664fi
bartb7c3f082010-05-13 06:32:36 +0000665
njnf76d27a2009-05-28 01:53:07 +0000666# not really a version check
667AC_EGREP_CPP([DARWIN_LIBC], [
668#include <sys/cdefs.h>
669#if defined(__DARWIN_VERS_1050)
670 DARWIN_LIBC
671#endif
672],
673GLIBC_VERSION="darwin")
674
sewardjcb495c82011-07-11 20:42:34 +0000675# not really a version check
676AC_EGREP_CPP([BIONIC_LIBC], [
677#if defined(__ANDROID__)
678 BIONIC_LIBC
679#endif
680],
681GLIBC_VERSION="bionic")
682
683
dirk07596a22008-04-25 11:33:30 +0000684AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000685
dirk07596a22008-04-25 11:33:30 +0000686case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000687 2.2)
688 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000689 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000690 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
691 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000692 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000693 ;;
694
sewardj08c7f012002-10-07 23:56:55 +0000695 2.3)
696 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000697 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000698 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000699 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000700 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000701 ;;
702
njn781dba52005-06-30 04:06:38 +0000703 2.4)
704 AC_MSG_RESULT(2.4 family)
705 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000706 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000707 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000708 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000709 ;;
710
dirkaece45c2006-10-12 08:17:49 +0000711 2.5)
712 AC_MSG_RESULT(2.5 family)
713 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000714 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000715 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000716 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000717 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000718 2.6)
719 AC_MSG_RESULT(2.6 family)
720 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000721 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000722 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000723 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000724 ;;
725 2.7)
726 AC_MSG_RESULT(2.7 family)
727 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000728 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000729 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000730 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000731 ;;
dirk07596a22008-04-25 11:33:30 +0000732 2.8)
733 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000734 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000735 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
736 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
737 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
738 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000739 2.9)
740 AC_MSG_RESULT(2.9 family)
741 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
742 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
743 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
744 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
745 ;;
sewardj5d425e82009-02-01 19:01:11 +0000746 2.10)
747 AC_MSG_RESULT(2.10 family)
748 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
749 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
750 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
751 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
752 ;;
bart0fac7ff2009-11-15 19:11:19 +0000753 2.11)
754 AC_MSG_RESULT(2.11 family)
755 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
756 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
757 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
758 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000759 ;;
760 2.12)
761 AC_MSG_RESULT(2.12 family)
762 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
763 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
764 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
765 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000766 ;;
tomebd619b2011-02-10 09:09:09 +0000767 2.13)
768 AC_MSG_RESULT(2.13 family)
769 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
770 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
771 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
772 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
773 ;;
tomcc077412011-06-07 21:52:26 +0000774 2.14)
775 AC_MSG_RESULT(2.14 family)
776 AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x])
777 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
778 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
779 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
780 ;;
njnf76d27a2009-05-28 01:53:07 +0000781 darwin)
782 AC_MSG_RESULT(Darwin)
783 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
784 # DEFAULT_SUPP set by kernel version check above.
785 ;;
sewardjcb495c82011-07-11 20:42:34 +0000786 bionic)
787 AC_MSG_RESULT(Bionic)
788 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
789 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
790 ;;
dirkaece45c2006-10-12 08:17:49 +0000791
sewardjde4a1d02002-03-22 01:27:54 +0000792 *)
bart12e91122010-05-15 08:37:24 +0000793 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
tomcc077412011-06-07 21:52:26 +0000794 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.14])
njnf76d27a2009-05-28 01:53:07 +0000795 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000796 ;;
797esac
798
dirk07596a22008-04-25 11:33:30 +0000799AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000800
sewardj414f3582008-07-18 20:46:00 +0000801
802# Add default suppressions for the X client libraries. Make no
803# attempt to detect whether such libraries are installed on the
804# build machine (or even if any X facilities are present); just
805# add the suppressions antidisirregardless.
806DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
807DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000808
sewardjd2f95a02011-05-11 16:04:28 +0000809# Add glibc and X11 suppressions for exp-sgcheck
810DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
sewardj5744c022008-10-19 18:58:13 +0000811
sewardj2e10a682003-04-07 19:36:41 +0000812
njn7fd6d382009-01-22 21:56:32 +0000813#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000814# Platform variants?
815#----------------------------------------------------------------------------
816
817# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
818# But there are times where we need a bit more control. The motivating
819# and currently only case is Android: this is almost identical to arm-linux,
820# but not quite. So this introduces the concept of platform variant tags,
821# which get passed in the compile as -DVGPV_<arch>_<os>_<variant> along
822# with the main -DVGP_<arch>_<os> definition.
823#
824# In almost all cases, the <variant> bit is "vanilla". But for Android
825# it is "android" instead.
826#
827# Consequently (eg), plain arm-linux would build with
828#
829# -DVGP_arm_linux -DVGPV_arm_linux_vanilla
830#
831# whilst an Android build would have
832#
833# -DVGP_arm_linux -DVGPV_arm_linux_android
834#
835# The setup of the platform variant is pushed relatively far down this
836# file in order that we can inspect any of the variables set above.
837
838# In the normal case ..
839VGCONF_PLATVARIANT="vanilla"
840
841# Android on ARM ?
842if test "$VGCONF_ARCH_PRI-$VGCONF_OS" = "arm-linux" \
843 -a "$GLIBC_VERSION" = "bionic";
844then
845 VGCONF_PLATVARIANT="android"
846fi
847
848AC_SUBST(VGCONF_PLATVARIANT)
849
850
851# FIXME: do we also want to define automake variables
852# VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
853# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
854# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
855# do that. Problem is that we can't do and-ing in Makefile.am's, but
856# that's what we'd need to do to use this, since what we'd want to write
857# is something like
858#
859# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
860#
sewardj0ba37c92011-07-12 11:46:24 +0000861# Hmm. Can't think of a nice clean solution to this.
862
863AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
864 test x$VGCONF_PLATVARIANT = xvanilla)
865AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
866 test x$VGCONF_PLATVARIANT = xandroid)
sewardjcb495c82011-07-11 20:42:34 +0000867
868
869#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000870# Checking for various library functions and other definitions
871#----------------------------------------------------------------------------
872
bart59e2f182008-04-28 16:22:53 +0000873# Check for CLOCK_MONOTONIC
874
875AC_MSG_CHECKING([for CLOCK_MONOTONIC])
876
bart417cf3e2011-10-22 09:21:24 +0000877AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart59e2f182008-04-28 16:22:53 +0000878#include <time.h>
bart417cf3e2011-10-22 09:21:24 +0000879]], [[
bart59e2f182008-04-28 16:22:53 +0000880 struct timespec t;
881 clock_gettime(CLOCK_MONOTONIC, &t);
882 return 0;
bart417cf3e2011-10-22 09:21:24 +0000883]])], [
bart59e2f182008-04-28 16:22:53 +0000884AC_MSG_RESULT([yes])
885AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
886 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
887], [
888AC_MSG_RESULT([no])
889])
890
bartfea06922008-05-03 09:12:15 +0000891
sewardj0c09bf02011-07-11 22:11:58 +0000892# Check for PTHREAD_RWLOCK_T
893
894AC_MSG_CHECKING([for pthread_rwlock_t])
895
bart417cf3e2011-10-22 09:21:24 +0000896AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardj0c09bf02011-07-11 22:11:58 +0000897#define _GNU_SOURCE
898#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000899]], [[
sewardj0c09bf02011-07-11 22:11:58 +0000900 pthread_rwlock_t rwl;
bart417cf3e2011-10-22 09:21:24 +0000901]])], [
sewardj0c09bf02011-07-11 22:11:58 +0000902AC_MSG_RESULT([yes])
903AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
904 [Define to 1 if you have the `pthread_rwlock_t' type.])
905], [
906AC_MSG_RESULT([no])
907])
908
909
bartfea06922008-05-03 09:12:15 +0000910# Check for PTHREAD_MUTEX_ADAPTIVE_NP
911
912AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
913
bart417cf3e2011-10-22 09:21:24 +0000914AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +0000915#define _GNU_SOURCE
916#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000917]], [[
bartfea06922008-05-03 09:12:15 +0000918 return (PTHREAD_MUTEX_ADAPTIVE_NP);
bart417cf3e2011-10-22 09:21:24 +0000919]])], [
bartfea06922008-05-03 09:12:15 +0000920AC_MSG_RESULT([yes])
921AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
922 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
923], [
924AC_MSG_RESULT([no])
925])
926
927
928# Check for PTHREAD_MUTEX_ERRORCHECK_NP
929
930AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
931
bart417cf3e2011-10-22 09:21:24 +0000932AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +0000933#define _GNU_SOURCE
934#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000935]], [[
bartfea06922008-05-03 09:12:15 +0000936 return (PTHREAD_MUTEX_ERRORCHECK_NP);
bart417cf3e2011-10-22 09:21:24 +0000937]])], [
bartfea06922008-05-03 09:12:15 +0000938AC_MSG_RESULT([yes])
939AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
940 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
941], [
942AC_MSG_RESULT([no])
943])
944
945
946# Check for PTHREAD_MUTEX_RECURSIVE_NP
947
948AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
949
bart417cf3e2011-10-22 09:21:24 +0000950AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +0000951#define _GNU_SOURCE
952#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000953]], [[
bartfea06922008-05-03 09:12:15 +0000954 return (PTHREAD_MUTEX_RECURSIVE_NP);
bart417cf3e2011-10-22 09:21:24 +0000955]])], [
bartfea06922008-05-03 09:12:15 +0000956AC_MSG_RESULT([yes])
957AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
958 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
959], [
960AC_MSG_RESULT([no])
961])
962
963
964# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
965
966AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
967
bart417cf3e2011-10-22 09:21:24 +0000968AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bartfea06922008-05-03 09:12:15 +0000969#define _GNU_SOURCE
970#include <pthread.h>
bart417cf3e2011-10-22 09:21:24 +0000971]], [[
bartfea06922008-05-03 09:12:15 +0000972 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
973 return 0;
bart417cf3e2011-10-22 09:21:24 +0000974]])], [
bartfea06922008-05-03 09:12:15 +0000975AC_MSG_RESULT([yes])
976AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
977 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
978], [
979AC_MSG_RESULT([no])
980])
981
982
bart5e389f12008-04-05 12:53:15 +0000983# Check whether pthread_mutex_t has a member called __m_kind.
984
bartb11355c2010-04-29 16:37:26 +0000985AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
986 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
987 1,
988 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
989 ],
990 [],
991 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000992
993
994# Check whether pthread_mutex_t has a member called __data.__kind.
995
bartb11355c2010-04-29 16:37:26 +0000996AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
997 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
998 1,
999 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1000 ],
1001 [],
1002 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +00001003
1004
bart62c370e2008-05-12 18:50:51 +00001005# does this compiler support -maltivec and does it have the include file
1006# <altivec.h> ?
1007
1008AC_MSG_CHECKING([for Altivec])
1009
1010safe_CFLAGS=$CFLAGS
1011CFLAGS="-maltivec"
1012
bart417cf3e2011-10-22 09:21:24 +00001013AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart62c370e2008-05-12 18:50:51 +00001014#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001015]], [[
bart62c370e2008-05-12 18:50:51 +00001016 vector unsigned int v;
bart417cf3e2011-10-22 09:21:24 +00001017]])], [
bart62c370e2008-05-12 18:50:51 +00001018ac_have_altivec=yes
1019AC_MSG_RESULT([yes])
sewardjf9fe6022010-09-03 14:36:50 +00001020AC_DEFINE([HAS_ALTIVEC], 1,
sewardj6467a152010-09-03 14:02:22 +00001021 [Define to 1 if gcc/as can do Altivec.])
bart62c370e2008-05-12 18:50:51 +00001022], [
1023ac_have_altivec=no
1024AC_MSG_RESULT([no])
1025])
1026CFLAGS=$safe_CFLAGS
1027
sewardj0e342a02010-09-03 23:49:33 +00001028AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
bart62c370e2008-05-12 18:50:51 +00001029
1030
sewardjf34eb492011-04-15 11:57:05 +00001031# Check that both: the compiler supports -mvsx and that the assembler
1032# understands VSX instructions. If either of those doesn't work,
1033# conclude that we can't do VSX. NOTE: basically this is a kludge
1034# in that it conflates two things that should be separate -- whether
1035# the compiler understands the flag vs whether the assembler
1036# understands the opcodes. This really ought to be cleaned up
1037# and done properly, like it is for x86/x86_64.
1038
1039AC_MSG_CHECKING([for VSX])
1040
1041safe_CFLAGS=$CFLAGS
1042CFLAGS="-mvsx"
1043
bart417cf3e2011-10-22 09:21:24 +00001044AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
sewardjf34eb492011-04-15 11:57:05 +00001045#include <altivec.h>
bart417cf3e2011-10-22 09:21:24 +00001046]], [[
sewardjf34eb492011-04-15 11:57:05 +00001047 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +00001048 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
bart417cf3e2011-10-22 09:21:24 +00001049]])], [
sewardjf34eb492011-04-15 11:57:05 +00001050ac_have_vsx=yes
1051AC_MSG_RESULT([yes])
1052], [
1053ac_have_vsx=no
1054AC_MSG_RESULT([no])
1055])
1056CFLAGS=$safe_CFLAGS
1057
1058AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1059
1060
bart36dd85a2009-04-26 07:11:48 +00001061# Check for pthread_create@GLIBC2.0
1062AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1063
bart16e1c5a2009-04-26 07:38:53 +00001064safe_CFLAGS=$CFLAGS
1065CFLAGS="-lpthread"
bart417cf3e2011-10-22 09:21:24 +00001066AC_LINK_IFELSE([AC_LANG_PROGRAM([[
bart36dd85a2009-04-26 07:11:48 +00001067extern int pthread_create_glibc_2_0(void*, const void*,
1068 void *(*)(void*), void*);
1069__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
bart417cf3e2011-10-22 09:21:24 +00001070]], [[
bart276ed3a2009-05-10 15:41:45 +00001071#ifdef __powerpc__
1072/*
1073 * Apparently on PowerPC linking this program succeeds and generates an
1074 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1075 */
1076#error This test does not work properly on PowerPC.
1077#else
bart16e1c5a2009-04-26 07:38:53 +00001078 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001079#endif
bart16e1c5a2009-04-26 07:38:53 +00001080 return 0;
bart417cf3e2011-10-22 09:21:24 +00001081]])], [
bart36dd85a2009-04-26 07:11:48 +00001082ac_have_pthread_create_glibc_2_0=yes
1083AC_MSG_RESULT([yes])
1084AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1085 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1086], [
1087ac_have_pthread_create_glibc_2_0=no
1088AC_MSG_RESULT([no])
1089])
bart16e1c5a2009-04-26 07:38:53 +00001090CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001091
1092AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001093 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001094
1095
barta50aa8a2008-04-27 06:06:57 +00001096# Check for eventfd_t, eventfd() and eventfd_read()
1097AC_MSG_CHECKING([for eventfd()])
1098
bart417cf3e2011-10-22 09:21:24 +00001099AC_LINK_IFELSE([AC_LANG_PROGRAM([[
barta50aa8a2008-04-27 06:06:57 +00001100#include <sys/eventfd.h>
bart417cf3e2011-10-22 09:21:24 +00001101]], [[
barta50aa8a2008-04-27 06:06:57 +00001102 eventfd_t ev;
1103 int fd;
1104
1105 fd = eventfd(5, 0);
1106 eventfd_read(fd, &ev);
1107 return 0;
bart417cf3e2011-10-22 09:21:24 +00001108]])], [
barta50aa8a2008-04-27 06:06:57 +00001109AC_MSG_RESULT([yes])
1110AC_DEFINE([HAVE_EVENTFD], 1,
1111 [Define to 1 if you have the `eventfd' function.])
1112AC_DEFINE([HAVE_EVENTFD_READ], 1,
1113 [Define to 1 if you have the `eventfd_read' function.])
1114], [
1115AC_MSG_RESULT([no])
1116])
1117
1118
njn7fd6d382009-01-22 21:56:32 +00001119#----------------------------------------------------------------------------
1120# Checking for supported compiler flags.
1121#----------------------------------------------------------------------------
1122
sewardj535c50f2005-06-04 23:14:53 +00001123# does this compiler support -m32 ?
1124AC_MSG_CHECKING([if gcc accepts -m32])
1125
1126safe_CFLAGS=$CFLAGS
1127CFLAGS="-m32"
1128
bart417cf3e2011-10-22 09:21:24 +00001129AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001130 return 0;
bart417cf3e2011-10-22 09:21:24 +00001131]])], [
sewardj535c50f2005-06-04 23:14:53 +00001132FLAG_M32="-m32"
1133AC_MSG_RESULT([yes])
1134], [
1135FLAG_M32=""
1136AC_MSG_RESULT([no])
1137])
1138CFLAGS=$safe_CFLAGS
1139
1140AC_SUBST(FLAG_M32)
1141
1142
sewardj01262142006-01-04 01:20:28 +00001143# does this compiler support -m64 ?
1144AC_MSG_CHECKING([if gcc accepts -m64])
1145
1146safe_CFLAGS=$CFLAGS
1147CFLAGS="-m64"
1148
bart417cf3e2011-10-22 09:21:24 +00001149AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001150 return 0;
bart417cf3e2011-10-22 09:21:24 +00001151]])], [
sewardj01262142006-01-04 01:20:28 +00001152FLAG_M64="-m64"
1153AC_MSG_RESULT([yes])
1154], [
1155FLAG_M64=""
1156AC_MSG_RESULT([no])
1157])
1158CFLAGS=$safe_CFLAGS
1159
1160AC_SUBST(FLAG_M64)
1161
1162
sewardj67f1fcc2005-07-03 10:41:02 +00001163# does this compiler support -mmmx ?
1164AC_MSG_CHECKING([if gcc accepts -mmmx])
1165
1166safe_CFLAGS=$CFLAGS
1167CFLAGS="-mmmx"
1168
bart417cf3e2011-10-22 09:21:24 +00001169AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001170 return 0;
bart417cf3e2011-10-22 09:21:24 +00001171]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001172FLAG_MMMX="-mmmx"
1173AC_MSG_RESULT([yes])
1174], [
1175FLAG_MMMX=""
1176AC_MSG_RESULT([no])
1177])
1178CFLAGS=$safe_CFLAGS
1179
1180AC_SUBST(FLAG_MMMX)
1181
1182
1183# does this compiler support -msse ?
1184AC_MSG_CHECKING([if gcc accepts -msse])
1185
1186safe_CFLAGS=$CFLAGS
1187CFLAGS="-msse"
1188
bart417cf3e2011-10-22 09:21:24 +00001189AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001190 return 0;
bart417cf3e2011-10-22 09:21:24 +00001191]])], [
sewardj67f1fcc2005-07-03 10:41:02 +00001192FLAG_MSSE="-msse"
1193AC_MSG_RESULT([yes])
1194], [
1195FLAG_MSSE=""
1196AC_MSG_RESULT([no])
1197])
1198CFLAGS=$safe_CFLAGS
1199
1200AC_SUBST(FLAG_MSSE)
1201
1202
sewardj5b754b42002-06-03 22:53:35 +00001203# does this compiler support -mpreferred-stack-boundary=2 ?
1204AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1205
daywalker3664f562003-10-17 13:43:46 +00001206safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001207CFLAGS="-mpreferred-stack-boundary=2"
1208
bart417cf3e2011-10-22 09:21:24 +00001209AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001210 return 0;
bart417cf3e2011-10-22 09:21:24 +00001211]])], [
sewardj5b754b42002-06-03 22:53:35 +00001212PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001213AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001214], [
1215PREFERRED_STACK_BOUNDARY=""
1216AC_MSG_RESULT([no])
1217])
daywalker3664f562003-10-17 13:43:46 +00001218CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001219
1220AC_SUBST(PREFERRED_STACK_BOUNDARY)
1221
sewardj535c50f2005-06-04 23:14:53 +00001222
sewardjb5f6f512005-03-10 23:59:00 +00001223# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001224AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001225
1226safe_CFLAGS=$CFLAGS
1227CFLAGS="-Wno-pointer-sign"
1228
bart417cf3e2011-10-22 09:21:24 +00001229AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001230 return 0;
bart417cf3e2011-10-22 09:21:24 +00001231]])], [
sewardjb5f6f512005-03-10 23:59:00 +00001232no_pointer_sign=yes
1233AC_MSG_RESULT([yes])
1234], [
1235no_pointer_sign=no
1236AC_MSG_RESULT([no])
1237])
1238CFLAGS=$safe_CFLAGS
1239
1240if test x$no_pointer_sign = xyes; then
1241 CFLAGS="$CFLAGS -Wno-pointer-sign"
1242fi
1243
sewardj535c50f2005-06-04 23:14:53 +00001244
barte026bd22009-07-04 12:17:07 +00001245# does this compiler support -Wno-empty-body ?
1246
1247AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1248
1249safe_CFLAGS=$CFLAGS
1250CFLAGS="-Wno-empty-body"
1251
bart417cf3e2011-10-22 09:21:24 +00001252AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
barte026bd22009-07-04 12:17:07 +00001253 return 0;
bart417cf3e2011-10-22 09:21:24 +00001254]])], [
barte026bd22009-07-04 12:17:07 +00001255AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1256AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001257], [
barte026bd22009-07-04 12:17:07 +00001258AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1259AC_MSG_RESULT([no])
1260])
1261CFLAGS=$safe_CFLAGS
1262
1263
bart9d865fa2008-06-23 12:11:49 +00001264# does this compiler support -Wno-format-zero-length ?
1265
1266AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1267
1268safe_CFLAGS=$CFLAGS
1269CFLAGS="-Wno-format-zero-length"
1270
bart417cf3e2011-10-22 09:21:24 +00001271AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart9d865fa2008-06-23 12:11:49 +00001272 return 0;
bart417cf3e2011-10-22 09:21:24 +00001273]])], [
bart9d865fa2008-06-23 12:11:49 +00001274AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1275AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001276], [
bart9d865fa2008-06-23 12:11:49 +00001277AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1278AC_MSG_RESULT([no])
1279])
1280CFLAGS=$safe_CFLAGS
1281
1282
bart8e216312011-05-15 17:05:36 +00001283# does this compiler support -Wno-nonnull ?
1284
1285AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
1286
1287safe_CFLAGS=$CFLAGS
1288CFLAGS="-Wno-nonnull"
1289
bart417cf3e2011-10-22 09:21:24 +00001290AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart8e216312011-05-15 17:05:36 +00001291 return 0;
bart417cf3e2011-10-22 09:21:24 +00001292]])], [
bart8e216312011-05-15 17:05:36 +00001293AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
1294AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001295], [
bart8e216312011-05-15 17:05:36 +00001296AC_SUBST([FLAG_W_NO_NONNULL], [])
1297AC_MSG_RESULT([no])
1298])
1299CFLAGS=$safe_CFLAGS
1300
1301
1302# does this compiler support -Wno-overflow ?
1303
1304AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
1305
1306safe_CFLAGS=$CFLAGS
1307CFLAGS="-Wno-overflow"
1308
bart417cf3e2011-10-22 09:21:24 +00001309AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart8e216312011-05-15 17:05:36 +00001310 return 0;
bart417cf3e2011-10-22 09:21:24 +00001311]])], [
bart8e216312011-05-15 17:05:36 +00001312AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
1313AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001314], [
bart8e216312011-05-15 17:05:36 +00001315AC_SUBST([FLAG_W_NO_OVERFLOW], [])
1316AC_MSG_RESULT([no])
1317])
1318CFLAGS=$safe_CFLAGS
1319
1320
bartbf9b85c2009-08-12 12:55:56 +00001321# does this compiler support -Wno-uninitialized ?
1322
1323AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1324
1325safe_CFLAGS=$CFLAGS
1326CFLAGS="-Wno-uninitialized"
1327
bart417cf3e2011-10-22 09:21:24 +00001328AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bartbf9b85c2009-08-12 12:55:56 +00001329 return 0;
bart417cf3e2011-10-22 09:21:24 +00001330]])], [
bartbf9b85c2009-08-12 12:55:56 +00001331AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1332AC_MSG_RESULT([yes])
bart417cf3e2011-10-22 09:21:24 +00001333], [
bartbf9b85c2009-08-12 12:55:56 +00001334AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1335AC_MSG_RESULT([no])
1336])
1337CFLAGS=$safe_CFLAGS
1338
1339
bart56730cd2008-05-11 06:41:46 +00001340# does this compiler support -Wextra or the older -W ?
1341
1342AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1343
1344safe_CFLAGS=$CFLAGS
1345CFLAGS="-Wextra"
1346
bart417cf3e2011-10-22 09:21:24 +00001347AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001348 return 0;
bart417cf3e2011-10-22 09:21:24 +00001349]])], [
bart56730cd2008-05-11 06:41:46 +00001350AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1351AC_MSG_RESULT([-Wextra])
1352], [
1353 CFLAGS="-W"
sewardj9bdf2a62011-10-27 06:22:23 +00001354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001355 return 0;
sewardj9bdf2a62011-10-27 06:22:23 +00001356 ]])], [
bart56730cd2008-05-11 06:41:46 +00001357 AC_SUBST([FLAG_W_EXTRA], [-W])
1358 AC_MSG_RESULT([-W])
1359 ], [
1360 AC_SUBST([FLAG_W_EXTRA], [])
1361 AC_MSG_RESULT([not supported])
1362 ])
1363])
1364CFLAGS=$safe_CFLAGS
1365
1366
sewardja72c26d2007-05-01 13:44:08 +00001367# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001368AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001369
1370safe_CFLAGS=$CFLAGS
1371CFLAGS="-fno-stack-protector"
1372
bart417cf3e2011-10-22 09:21:24 +00001373AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
njn9890ee12009-01-21 22:25:50 +00001374 return 0;
bart417cf3e2011-10-22 09:21:24 +00001375]])], [
sewardja72c26d2007-05-01 13:44:08 +00001376no_stack_protector=yes
1377FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1378AC_MSG_RESULT([yes])
1379], [
1380no_stack_protector=no
1381FLAG_FNO_STACK_PROTECTOR=""
1382AC_MSG_RESULT([no])
1383])
1384CFLAGS=$safe_CFLAGS
1385
1386AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1387
1388if test x$no_stack_protector = xyes; then
1389 CFLAGS="$CFLAGS -fno-stack-protector"
1390fi
1391
1392
bart56730cd2008-05-11 06:41:46 +00001393# does this compiler support --param inline-unit-growth=... ?
1394
1395AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1396
1397safe_CFLAGS=$CFLAGS
1398CFLAGS="--param inline-unit-growth=900"
1399
bart417cf3e2011-10-22 09:21:24 +00001400AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
bart56730cd2008-05-11 06:41:46 +00001401 return 0;
bart417cf3e2011-10-22 09:21:24 +00001402]])], [
bart56730cd2008-05-11 06:41:46 +00001403AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1404 ["--param inline-unit-growth=900"])
1405AC_MSG_RESULT([yes])
1406], [
1407AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1408AC_MSG_RESULT([no])
1409])
1410CFLAGS=$safe_CFLAGS
1411
1412
sewardjd3645802010-06-13 22:13:58 +00001413# does the linker support -Wl,--build-id=none ? Note, it's
1414# important that we test indirectly via whichever C compiler
1415# is selected, rather than testing /usr/bin/ld or whatever
1416# directly.
bart699fbac2010-06-08 18:23:59 +00001417
sewardjd3645802010-06-13 22:13:58 +00001418AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
bart699fbac2010-06-08 18:23:59 +00001419
1420safe_CFLAGS=$CFLAGS
1421CFLAGS="-Wl,--build-id=none"
1422
bart8508c752010-06-10 06:26:21 +00001423AC_LINK_IFELSE(
1424[AC_LANG_PROGRAM([ ], [return 0;])],
bart699fbac2010-06-08 18:23:59 +00001425[
1426 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1427 AC_MSG_RESULT([yes])
1428], [
1429 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1430 AC_MSG_RESULT([no])
1431])
1432CFLAGS=$safe_CFLAGS
1433
1434
sewardj00f1e622006-03-12 16:47:10 +00001435# does the ppc assembler support "mtocrf" et al?
1436AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1437
bart417cf3e2011-10-22 09:21:24 +00001438AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjdd4cbe12006-03-12 17:27:44 +00001439__asm__ __volatile__("mtocrf 4,0");
1440__asm__ __volatile__("mfocrf 0,4");
bart417cf3e2011-10-22 09:21:24 +00001441]])], [
sewardj00f1e622006-03-12 16:47:10 +00001442ac_have_as_ppc_mftocrf=yes
1443AC_MSG_RESULT([yes])
1444], [
1445ac_have_as_ppc_mftocrf=no
1446AC_MSG_RESULT([no])
1447])
1448if test x$ac_have_as_ppc_mftocrf = xyes ; then
1449 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1450fi
1451
1452
sewardjb5b87402011-03-07 16:05:35 +00001453CFLAGS=$safe_CFLAGS
1454
sewardjf0aabf82007-03-22 00:24:21 +00001455# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001456# Note, this doesn't generate a C-level symbol. It generates a
1457# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001458AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1459
bart417cf3e2011-10-22 09:21:24 +00001460AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjf0aabf82007-03-22 00:24:21 +00001461 do { long long int x;
1462 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1463 while (0)
bart417cf3e2011-10-22 09:21:24 +00001464]])], [
sewardjf0aabf82007-03-22 00:24:21 +00001465ac_have_as_sse3=yes
1466AC_MSG_RESULT([yes])
1467], [
1468ac_have_as_sse3=no
1469AC_MSG_RESULT([no])
1470])
sewardjfa18a262007-03-22 12:13:13 +00001471
1472AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001473
1474
sewardj6d6da5b2008-02-09 12:07:40 +00001475# Ditto for SSSE3 instructions (note extra S)
1476# Note, this doesn't generate a C-level symbol. It generates a
1477# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1478AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1479
florianc443b962011-10-28 21:37:19 +00001480save_CFLAGS="$CFLAGS"
1481CFLAGS="$CFLAGS -msse"
bart417cf3e2011-10-22 09:21:24 +00001482AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj6d6da5b2008-02-09 12:07:40 +00001483 do { long long int x;
1484 __asm__ __volatile__(
1485 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1486 while (0)
bart417cf3e2011-10-22 09:21:24 +00001487]])], [
sewardj6d6da5b2008-02-09 12:07:40 +00001488ac_have_as_ssse3=yes
1489AC_MSG_RESULT([yes])
1490], [
1491ac_have_as_ssse3=no
1492AC_MSG_RESULT([no])
1493])
florianc443b962011-10-28 21:37:19 +00001494CFLAGS="$save_CFLAGS"
sewardj6d6da5b2008-02-09 12:07:40 +00001495
1496AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1497
1498
sewardj27d176a2011-01-17 11:15:48 +00001499# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1500# Note, this doesn't generate a C-level symbol. It generates a
1501# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00001502AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
bart417cf3e2011-10-22 09:21:24 +00001503AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardje3ae8a32010-09-28 19:59:47 +00001504 do {
1505 __asm__ __volatile__(
1506 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1507 while (0)
bart417cf3e2011-10-22 09:21:24 +00001508]])], [
sewardje3ae8a32010-09-28 19:59:47 +00001509ac_have_as_pclmulqdq=yes
1510AC_MSG_RESULT([yes])
1511], [
1512ac_have_as_pclmulqdq=no
1513AC_MSG_RESULT([no])
1514])
1515
1516AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1517
1518
sewardj27d176a2011-01-17 11:15:48 +00001519# does the x86/amd64 assembler understand the LZCNT instruction?
1520# Note, this doesn't generate a C-level symbol. It generates a
1521# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00001522AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1523
bart417cf3e2011-10-22 09:21:24 +00001524AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
bart55e438b2010-09-14 10:53:57 +00001525 do {
1526 __asm__ __volatile__("lzcnt %rax,%rax");
1527 } while (0)
bart417cf3e2011-10-22 09:21:24 +00001528]])], [
bart55e438b2010-09-14 10:53:57 +00001529 ac_have_as_lzcnt=yes
1530 AC_MSG_RESULT([yes])
1531], [
1532 ac_have_as_lzcnt=no
1533 AC_MSG_RESULT([no])
1534])
1535
1536AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1537
sewardj27d176a2011-01-17 11:15:48 +00001538
1539# does the x86/amd64 assembler understand SSE 4.2 instructions?
1540# Note, this doesn't generate a C-level symbol. It generates a
1541# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
1542AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
1543
bart417cf3e2011-10-22 09:21:24 +00001544AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardj27d176a2011-01-17 11:15:48 +00001545 do { long long int x;
1546 __asm__ __volatile__(
1547 "crc32q %%r15,%%r15" : : : "r15" ); }
1548 while (0)
bart417cf3e2011-10-22 09:21:24 +00001549]])], [
sewardj27d176a2011-01-17 11:15:48 +00001550ac_have_as_sse42=yes
1551AC_MSG_RESULT([yes])
1552], [
1553ac_have_as_sse42=no
1554AC_MSG_RESULT([no])
1555])
1556
1557AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
1558
1559
sewardje089f012010-10-13 21:47:29 +00001560# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
1561# when building the tool executables. I think we should get rid of it.
1562#
sewardjb5f6f512005-03-10 23:59:00 +00001563# Check for TLS support in the compiler and linker
bart2bd9a682011-10-22 09:46:16 +00001564AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1565 [[return foo;]])],
1566 [vg_cv_linktime_tls=yes],
1567 [vg_cv_linktime_tls=no])
bartca9f2ad2008-06-02 07:14:20 +00001568# Native compilation: check whether running a program using TLS succeeds.
1569# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1570# succeeds but running programs using TLS fails.
bart2bd9a682011-10-22 09:46:16 +00001571# Cross-compiling: check whether linking a program using TLS succeeds.
bartca9f2ad2008-06-02 07:14:20 +00001572AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1573 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1574 [vg_cv_tls=$enableval],
1575 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1576 [[return foo;]])],
1577 [vg_cv_tls=yes],
bart2bd9a682011-10-22 09:46:16 +00001578 [vg_cv_tls=no],
1579 [vg_cv_tls=$vg_cv_linktime_tls])])])
sewardjb5f6f512005-03-10 23:59:00 +00001580
1581if test "$vg_cv_tls" = yes; then
1582AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1583fi
sewardj5b754b42002-06-03 22:53:35 +00001584
sewardj535c50f2005-06-04 23:14:53 +00001585
njn7fd6d382009-01-22 21:56:32 +00001586#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001587# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001588#----------------------------------------------------------------------------
1589
sewardjde4a1d02002-03-22 01:27:54 +00001590AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001591AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001592 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001593 endian.h \
1594 mqueue.h \
1595 sys/endian.h \
1596 sys/epoll.h \
1597 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001598 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001599 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001600 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001601 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001602 sys/syscall.h \
1603 sys/time.h \
1604 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001605 ])
sewardjde4a1d02002-03-22 01:27:54 +00001606
bart818f17e2011-09-17 06:24:49 +00001607# Verify whether the <linux/futex.h> header is usable.
1608AC_MSG_CHECKING([if <linux/futex.h> is usable])
1609
bart417cf3e2011-10-22 09:21:24 +00001610AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
bart818f17e2011-09-17 06:24:49 +00001611#include <linux/futex.h>
bart417cf3e2011-10-22 09:21:24 +00001612]], [[
bart818f17e2011-09-17 06:24:49 +00001613 return FUTEX_WAIT;
bart417cf3e2011-10-22 09:21:24 +00001614]])], [
bart818f17e2011-09-17 06:24:49 +00001615AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
1616 [Define to 1 if you have a usable <linux/futex.h> header file.])
1617AC_MSG_RESULT([yes])
1618], [
1619AC_MSG_RESULT([no])
1620])
1621
njn7fd6d382009-01-22 21:56:32 +00001622#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001623# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001624#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001625AC_TYPE_UID_T
1626AC_TYPE_OFF_T
1627AC_TYPE_SIZE_T
1628AC_HEADER_TIME
1629
sewardj535c50f2005-06-04 23:14:53 +00001630
njn7fd6d382009-01-22 21:56:32 +00001631#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001632# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001633#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001634AC_FUNC_MEMCMP
1635AC_FUNC_MMAP
sewardjde4a1d02002-03-22 01:27:54 +00001636
bart26288e42011-04-03 16:46:01 +00001637AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00001638AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001639
bartf5ceec82008-04-26 07:45:10 +00001640AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001641 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001642 epoll_create \
1643 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00001644 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001645 mallinfo \
1646 memchr \
1647 memset \
1648 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001649 mremap \
bartf5ceec82008-04-26 07:45:10 +00001650 ppoll \
bart6d45e922009-01-20 13:45:38 +00001651 pthread_barrier_init \
1652 pthread_condattr_setclock \
1653 pthread_mutex_timedlock \
1654 pthread_rwlock_timedrdlock \
1655 pthread_rwlock_timedwrlock \
1656 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001657 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001658 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001659 semtimedop \
1660 signalfd \
njn6cc22472009-03-16 03:46:48 +00001661 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001662 strchr \
1663 strdup \
1664 strpbrk \
1665 strrchr \
1666 strstr \
barta72a27b2010-04-29 06:22:17 +00001667 syscall \
bartf5ceec82008-04-26 07:45:10 +00001668 utimensat \
1669 ])
sewardjde4a1d02002-03-22 01:27:54 +00001670
bart623eec32008-07-29 17:54:49 +00001671# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1672# libraries with any shared object and/or executable. This is NOT what we
1673# want for e.g. vgpreload_core-x86-linux.so
1674LIBS=""
sewardj80637752006-03-02 13:48:21 +00001675
bart6d45e922009-01-20 13:45:38 +00001676AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1677 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001678AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1679 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001680AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1681 [test x$ac_cv_func_pthread_spin_lock = xyes])
1682
njn7fd6d382009-01-22 21:56:32 +00001683
1684#----------------------------------------------------------------------------
1685# MPI checks
1686#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001687# Do we have a useable MPI setup on the primary and/or secondary targets?
1688# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00001689# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00001690# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00001691# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001692MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00001693
sewardje9fa5062006-03-12 18:29:18 +00001694mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001695if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00001696 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1697 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001698 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001699elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00001700 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
1701 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001702 mflag_primary=$FLAG_M64
1703fi
1704
sewardj03d86f22006-10-17 00:57:24 +00001705mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001706if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1707 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001708 mflag_secondary=$FLAG_M32
sewardj03d86f22006-10-17 00:57:24 +00001709fi
1710
1711
sewardj0ad46092006-03-02 17:09:16 +00001712AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001713 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001714 MPI_CC=$withval
1715)
sewardj03d86f22006-10-17 00:57:24 +00001716AC_SUBST(MPI_CC)
1717
1718## See if MPI_CC works for the primary target
1719##
1720AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001721saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001722saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001723CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001724CFLAGS=$mflag_primary
bart417cf3e2011-10-22 09:21:24 +00001725AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj1a85e602006-03-08 15:26:10 +00001726#include <mpi.h>
1727#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00001728]], [[
sewardjde4f3842006-03-09 02:41:41 +00001729 int r = MPI_Init(NULL,NULL);
1730 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1731 return r;
bart417cf3e2011-10-22 09:21:24 +00001732]])], [
sewardj03d86f22006-10-17 00:57:24 +00001733ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001734AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001735], [
sewardj03d86f22006-10-17 00:57:24 +00001736ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001737AC_MSG_RESULT([no])
1738])
sewardj0ad46092006-03-02 17:09:16 +00001739CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001740CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001741AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001742
sewardj03d86f22006-10-17 00:57:24 +00001743## See if MPI_CC works for the secondary target. Complication: what if
1744## there is no secondary target? We need this to then fail.
1745## Kludge this by making MPI_CC something which will surely fail in
1746## such a case.
1747##
1748AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1749saved_CC=$CC
1750saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001751if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001752 CC="$MPI_CC this will surely fail"
1753else
1754 CC=$MPI_CC
1755fi
1756CFLAGS=$mflag_secondary
bart417cf3e2011-10-22 09:21:24 +00001757AC_LINK_IFELSE([AC_LANG_PROGRAM([[
sewardj03d86f22006-10-17 00:57:24 +00001758#include <mpi.h>
1759#include <stdio.h>
bart417cf3e2011-10-22 09:21:24 +00001760]], [[
sewardj03d86f22006-10-17 00:57:24 +00001761 int r = MPI_Init(NULL,NULL);
1762 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1763 return r;
bart417cf3e2011-10-22 09:21:24 +00001764]])], [
sewardj03d86f22006-10-17 00:57:24 +00001765ac_have_mpi2_sec=yes
1766AC_MSG_RESULT([yes, $MPI_CC])
1767], [
1768ac_have_mpi2_sec=no
1769AC_MSG_RESULT([no])
1770])
1771CC=$saved_CC
1772CFLAGS=$saved_CFLAGS
1773AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001774
1775
njn7fd6d382009-01-22 21:56:32 +00001776#----------------------------------------------------------------------------
1777# Other library checks
1778#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00001779# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00001780# tests are present because Drd has some regression tests that use
1781# these packages. All regression test programs all compiled only
1782# for the primary target. And so it is important that the configure
1783# checks that follow, use the correct -m32 or -m64 flag for the
1784# primary target (called $mflag_primary). Otherwise, we can end up
1785# in a situation (eg) where, on amd64-linux, the test for Boost checks
1786# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1787# only build (meaning, the primary target is x86-linux), the build
1788# of the regtest programs that use Boost fails, because they are
1789# build as 32-bit (IN THIS EXAMPLE).
1790#
1791# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1792# NEEDED BY THE REGRESSION TEST PROGRAMS.
1793
1794
sewardj493c4ef2008-12-13 16:45:19 +00001795# Check whether the boost library 1.35 or later has been installed.
1796# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1797
1798AC_MSG_CHECKING([for boost])
1799
1800AC_LANG(C++)
1801safe_CXXFLAGS=$CXXFLAGS
1802CXXFLAGS="-lboost_thread-mt $mflag_primary"
1803
bart128fc522011-03-12 10:36:35 +00001804AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001805#include <boost/thread.hpp>
1806static void thread_func(void)
1807{ }
1808int main(int argc, char** argv)
1809{
1810 boost::thread t(thread_func);
1811 return 0;
1812}
bart128fc522011-03-12 10:36:35 +00001813])],
sewardj493c4ef2008-12-13 16:45:19 +00001814[
1815ac_have_boost_1_35=yes
1816AC_SUBST([BOOST_CFLAGS], [])
1817AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1818AC_MSG_RESULT([yes])
1819], [
1820ac_have_boost_1_35=no
1821AC_MSG_RESULT([no])
1822])
1823
1824CXXFLAGS=$safe_CXXFLAGS
1825AC_LANG(C)
1826
1827AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1828
1829
1830# does this compiler support -fopenmp, does it have the include file
1831# <omp.h> and does it have libgomp ?
1832
1833AC_MSG_CHECKING([for OpenMP])
1834
1835safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001836CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001837
bart128fc522011-03-12 10:36:35 +00001838AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001839#include <omp.h>
1840int main(int argc, char** argv)
1841{
1842 omp_set_dynamic(0);
1843 return 0;
1844}
bart128fc522011-03-12 10:36:35 +00001845])],
sewardj493c4ef2008-12-13 16:45:19 +00001846[
1847ac_have_openmp=yes
1848AC_MSG_RESULT([yes])
1849], [
1850ac_have_openmp=no
1851AC_MSG_RESULT([no])
1852])
1853CFLAGS=$safe_CFLAGS
1854
1855AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1856
1857
sewardjc876a2f2009-01-22 22:44:30 +00001858# does this compiler have built-in functions for atomic memory access ?
1859AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1860
1861safe_CFLAGS=$CFLAGS
1862CFLAGS="$mflag_primary"
1863
bart417cf3e2011-10-22 09:21:24 +00001864AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
sewardjc876a2f2009-01-22 22:44:30 +00001865 int variable = 1;
1866 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1867 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00001868]])], [
bartc82d1372009-05-31 16:21:23 +00001869 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001870 AC_MSG_RESULT([yes])
barte8740422011-03-24 20:27:54 +00001871 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
bart417cf3e2011-10-22 09:21:24 +00001872], [
bartc82d1372009-05-31 16:21:23 +00001873 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001874 AC_MSG_RESULT([no])
1875])
1876
1877CFLAGS=$safe_CFLAGS
1878
bartc82d1372009-05-31 16:21:23 +00001879AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1880
barte8740422011-03-24 20:27:54 +00001881# does g++ have built-in functions for atomic memory access ?
1882AC_MSG_CHECKING([if g++ supports __sync_bool_compare_and_swap])
1883
1884safe_CXXFLAGS=$CXXFLAGS
1885CXXFLAGS="$mflag_primary"
1886
1887AC_LANG_PUSH(C++)
bart417cf3e2011-10-22 09:21:24 +00001888AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
barte8740422011-03-24 20:27:54 +00001889 int variable = 1;
1890 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1891 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bart417cf3e2011-10-22 09:21:24 +00001892]])], [
barte8740422011-03-24 20:27:54 +00001893 ac_have_builtin_atomic_cxx=yes
1894 AC_MSG_RESULT([yes])
1895 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 +00001896], [
barte8740422011-03-24 20:27:54 +00001897 ac_have_builtin_atomic_cxx=no
1898 AC_MSG_RESULT([no])
1899])
1900AC_LANG_POP(C++)
1901
1902CXXFLAGS=$safe_CXXFLAGS
1903
1904AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00001905
njn7fd6d382009-01-22 21:56:32 +00001906#----------------------------------------------------------------------------
1907# Ok. We're done checking.
1908#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001909
njn8b68b642009-06-24 00:37:09 +00001910# Nb: VEX/Makefile is generated from Makefile.vex.in.
1911AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001912 Makefile
njn8b68b642009-06-24 00:37:09 +00001913 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001914 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001915 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001916 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001917 docs/Makefile
1918 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001919 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001920 perf/Makefile
1921 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00001922 gdbserver_tests/Makefile
njn254d542432002-09-23 16:09:39 +00001923 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001924 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001925 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001926 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001927 memcheck/Makefile
1928 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001929 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001930 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001931 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001932 memcheck/tests/darwin/Makefile
njnea2d6fd2010-07-01 00:20:20 +00001933 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00001934 memcheck/tests/x86-linux/Makefile
sewardj0e342a02010-09-03 23:49:33 +00001935 memcheck/tests/ppc32/Makefile
1936 memcheck/tests/ppc64/Makefile
njn29a5c012009-05-06 06:15:55 +00001937 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001938 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001939 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001940 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00001941 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00001942 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00001943 callgrind/Makefile
1944 callgrind/callgrind_annotate
1945 callgrind/callgrind_control
1946 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001947 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001948 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001949 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001950 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001951 massif/perf/Makefile
njnd5a8d242007-11-02 20:44:57 +00001952 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001953 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001954 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001955 none/Makefile
1956 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001957 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001958 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001959 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001960 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00001961 none/tests/arm/Makefile
sewardjb5b87402011-03-07 16:05:35 +00001962 none/tests/s390x/Makefile
njn0458a122009-02-13 06:23:46 +00001963 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001964 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001965 none/tests/x86-linux/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00001966 exp-sgcheck/Makefile
1967 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00001968 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00001969 drd/scripts/download-and-build-splash2
1970 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001971 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00001972 exp-bbv/tests/Makefile
1973 exp-bbv/tests/x86/Makefile
1974 exp-bbv/tests/x86-linux/Makefile
1975 exp-bbv/tests/amd64-linux/Makefile
1976 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00001977 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00001978 exp-dhat/Makefile
1979 exp-dhat/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00001980])
sewardjd3645802010-06-13 22:13:58 +00001981AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
1982 [chmod +x coregrind/link_tool_exe_linux])
1983AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
1984 [chmod +x coregrind/link_tool_exe_darwin])
njn8b68b642009-06-24 00:37:09 +00001985AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001986
1987cat<<EOF
1988
njn311303f2009-02-06 03:46:50 +00001989 Maximum build arch: ${ARCH_MAX}
1990 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001991 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001992 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001993 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1994 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardjcb495c82011-07-11 20:42:34 +00001995 Platform variant: ${VGCONF_PLATVARIANT}
1996 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
sewardje95d94f2008-09-19 09:02:19 +00001997 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001998
gobry3b777892002-04-04 09:18:39 +00001999EOF