blob: 24ffc258cd0f15c734da94bebfc1bb59725127a1 [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.
sewardj9ccee392009-08-20 20:20:05 +000011AC_INIT(Valgrind, 3.6.0.SVN, valgrind-users@lists.sourceforge.net)
njn04e16982005-05-31 00:23:43 +000012AC_CONFIG_SRCDIR(coregrind/m_main.c)
sewardjde4a1d02002-03-22 01:27:54 +000013AM_CONFIG_HEADER(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#----------------------------------------------------------------------------
sewardjb5f6f512005-03-10 23:59:00 +000021CFLAGS="-Wno-long-long"
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
bart12e91122010-05-15 08:37:24 +000042AC_PROG_SED
sewardjde4a1d02002-03-22 01:27:54 +000043
bartcddeaf52008-05-25 15:58:11 +000044# If no AR variable was specified, look up the name of the archiver. Otherwise
45# do not touch the AR variable.
46if test "x$AR" = "x"; then
bart325cd972009-04-04 14:36:51 +000047 AC_PATH_PROGS([AR], [`echo $LD | sed 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000048fi
49AC_ARG_VAR([AR],[Archiver command])
50
gobrye721a522002-03-22 13:38:30 +000051# Check for the compiler support
52if test "${GCC}" != "yes" ; then
53 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
54fi
55
sewardj2f685952002-12-22 19:32:23 +000056# figure out where perl lives
57AC_PATH_PROG(PERL, perl)
58
njn9315df32003-04-16 20:50:50 +000059# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000060AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000061AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000062
daywalker48ccca52002-04-15 00:31:58 +000063# some older automake's don't have it so try something on our own
64ifdef([AM_PROG_AS],[AM_PROG_AS],
65[
gobry1be19852002-03-26 20:44:55 +000066AS="${CC}"
67AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000068
gobry1be19852002-03-26 20:44:55 +000069ASFLAGS=""
70AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000071])
gobry3b777892002-04-04 09:18:39 +000072
gobry3b777892002-04-04 09:18:39 +000073
njn0d2e58f2009-02-25 04:57:56 +000074# Check if 'diff' supports -u (universal diffs) and use it if possible.
75
76AC_MSG_CHECKING([for diff -u])
77AC_SUBST(DIFF)
78
79# Comparing two identical files results in 0, unless -u isn't supported (as
80# it's not on AIX).
njn31f665e2009-02-26 21:25:50 +000081tmpfile="tmp-xxx-yyy-zzz"
82touch $tmpfile;
83if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000084 AC_MSG_RESULT([yes])
85 DIFF="diff -u"
86else
87 AC_MSG_RESULT([no])
88 DIFF="diff"
89fi
njn31f665e2009-02-26 21:25:50 +000090rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000091
92
sewardj535c50f2005-06-04 23:14:53 +000093# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +000094AC_MSG_CHECKING([for a supported version of gcc])
95
sewardjf33b4332008-07-18 18:20:42 +000096[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +000097
98case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +000099 2.*)
gobrye721a522002-03-22 13:38:30 +0000100 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000101 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
102 ;;
gobrye721a522002-03-22 13:38:30 +0000103 *)
104 AC_MSG_RESULT([ok (${gcc_version})])
105 ;;
106esac
107
njn7fd6d382009-01-22 21:56:32 +0000108#----------------------------------------------------------------------------
109# Arch/OS/platform tests.
110#----------------------------------------------------------------------------
111# We create a number of arch/OS/platform-related variables. We prefix them
112# all with "VGCONF_" which indicates that they are defined at
113# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
114# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000115
sewardjde4a1d02002-03-22 01:27:54 +0000116AC_CANONICAL_HOST
117
118AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000119
njn7fd6d382009-01-22 21:56:32 +0000120# ARCH_MAX reflects the most that this CPU can do: for example if it
121# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
122# Ditto for amd64. It is used for more configuration below, but is not used
123# outside this file.
gobrye721a522002-03-22 13:38:30 +0000124case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000125 i?86)
126 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000127 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000128 ;;
129
njnfe408942004-11-23 17:52:24 +0000130 x86_64)
131 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000132 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000133 ;;
134
sewardj2c48c7b2005-11-29 13:05:56 +0000135 powerpc64)
njn7fd6d382009-01-22 21:56:32 +0000136 # This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000137 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000138 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000139 ;;
140
141 powerpc)
njn7fd6d382009-01-22 21:56:32 +0000142 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
143 # Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000144 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000145 case "${host_os}" in
146 aix5.*)
njn7fd6d382009-01-22 21:56:32 +0000147 ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000148 ;;
149 *)
njn7fd6d382009-01-22 21:56:32 +0000150 ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000151 ;;
152 esac
nethercote9bcc9062004-10-13 13:50:01 +0000153 ;;
154
sewardj59570ff2010-01-01 11:59:33 +0000155 armv7*)
156 AC_MSG_RESULT([ok (${host_cpu})])
157 ARCH_MAX="arm"
158 ;;
159
sewardjde4a1d02002-03-22 01:27:54 +0000160 *)
161 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000162 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000163 ;;
164esac
165
njn7fd6d382009-01-22 21:56:32 +0000166#----------------------------------------------------------------------------
167
sewardj86e992f2006-01-28 18:39:09 +0000168# Sometimes it's convenient to subvert the bi-arch build system and
169# just have a single build even though the underlying platform is
170# capable of both. Hence handle --enable-only64bit and
171# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000172# [Actually, if either of these options are used, I think both get built,
173# but only one gets installed. So if you use an in-place build, both can be
174# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000175
176# Check if a 64-bit only build has been requested
177AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
178 [AC_ARG_ENABLE(only64bit,
179 [ --enable-only64bit do a 64-bit only build],
180 [vg_cv_only64bit=$enableval],
181 [vg_cv_only64bit=no])])
182
183# Check if a 32-bit only build has been requested
184AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
185 [AC_ARG_ENABLE(only32bit,
186 [ --enable-only32bit do a 32-bit only build],
187 [vg_cv_only32bit=$enableval],
188 [vg_cv_only32bit=no])])
189
190# Stay sane
191if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
192 AC_MSG_ERROR(
193 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
194fi
195
njn7fd6d382009-01-22 21:56:32 +0000196#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000197
njn311303f2009-02-06 03:46:50 +0000198# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
199# compilation of many C files via -VGO_$(VGCONF_OS) and
200# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000201AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000202AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000203
njnf76d27a2009-05-28 01:53:07 +0000204DEFAULT_SUPP=""
205
gobrye721a522002-03-22 13:38:30 +0000206case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000207 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000208 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000209 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000210
211 # Ok, this is linux. Check the kernel version
212 AC_MSG_CHECKING([for the kernel version])
213
214 kernel=`uname -r`
215
216 case "${kernel}" in
217 2.6.*)
218 AC_MSG_RESULT([2.6 family (${kernel})])
219 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
220 ;;
221
222 2.4.*)
223 AC_MSG_RESULT([2.4 family (${kernel})])
224 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
225 ;;
226
mueller8c68e042004-01-03 15:21:14 +0000227 *)
228 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000229 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000230 ;;
231 esac
232
233 ;;
234
sewardj03d86f22006-10-17 00:57:24 +0000235 aix5.1.*)
236 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000237 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000238 ;;
239 aix5.2.*)
240 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000241 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000242 ;;
243 aix5.3.*)
244 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000245 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000246 ;;
247
mueller8c68e042004-01-03 15:21:14 +0000248 *freebsd*)
249 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000250 VGCONF_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000251 ;;
252
njnf76d27a2009-05-28 01:53:07 +0000253 *darwin*)
254 AC_MSG_RESULT([ok (${host_os})])
255 VGCONF_OS="darwin"
256
257 AC_MSG_CHECKING([for the kernel version])
258 kernel=`uname -r`
259
260 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
261 # has only one relevant version, the OS version. The `uname` check
262 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
263 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
264 # Snow Leopard and darwin10.supp), and we don't know of an macros
265 # similar to __GLIBC__ to get that info.
266 #
267 # XXX: `uname -r` won't do the right thing for cross-compiles, but
268 # that's not a problem yet.
269 case "${kernel}" in
270 9.*)
271 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
272 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000273 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000274 ;;
275 *)
276 AC_MSG_RESULT([unsupported (${kernel})])
277 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
278 ;;
279 esac
280 ;;
281
sewardjde4a1d02002-03-22 01:27:54 +0000282 *)
283 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000284 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000285 ;;
286esac
287
njn7fd6d382009-01-22 21:56:32 +0000288#----------------------------------------------------------------------------
289
tomd6398392006-06-07 17:44:36 +0000290# If we are building on a 64 bit platform test to see if the system
291# supports building 32 bit programs and disable 32 bit support if it
292# does not support building 32 bit programs
293
njn7fd6d382009-01-22 21:56:32 +0000294case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000295 amd64-linux|ppc64-linux)
296 AC_MSG_CHECKING([for 32 bit build support])
297 safe_CFLAGS=$CFLAGS
298 CFLAGS="-m32"
299 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000300 return 0;
tomd6398392006-06-07 17:44:36 +0000301 ],
302 [
303 AC_MSG_RESULT([yes])
304 ], [
305 vg_cv_only64bit="yes"
306 AC_MSG_RESULT([no])
307 ])
308 CFLAGS=$safe_CFLAGS;;
309esac
310
311if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
312 AC_MSG_ERROR(
313 [--enable-only32bit was specified but system does not support 32 bit builds])
314fi
nethercote888ecb72004-08-23 14:54:40 +0000315
njn7fd6d382009-01-22 21:56:32 +0000316#----------------------------------------------------------------------------
317
njn311303f2009-02-06 03:46:50 +0000318# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
319# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
320# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
321# above) will be "amd64" since that reflects the most that this cpu can do,
322# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
323# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000324# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
325# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
326AC_SUBST(VGCONF_ARCH_PRI)
327
njn3f8a6e92009-06-02 00:20:47 +0000328# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
329# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
330# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
331# It is empty if there is no secondary target.
332AC_SUBST(VGCONF_ARCH_SEC)
333
njn311303f2009-02-06 03:46:50 +0000334# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
335# The entire system, including regression and performance tests, will be
336# built for this target. The "_CAPS" indicates that the name is in capital
337# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000338# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000339# convention and cannot contain '-' characters. This is in contrast to
340# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000341AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
342
343# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
344# Valgrind and tools will also be built for this target, but not the
345# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000346#
njn7fd6d382009-01-22 21:56:32 +0000347# By default, the primary arch is the same as the "max" arch, as commented
348# above (at the definition of ARCH_MAX). We may choose to downgrade it in
349# the big case statement just below here, in the case where we're building
350# on a 64 bit machine but have been requested only to do a 32 bit build.
351AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
352
sewardj01262142006-01-04 01:20:28 +0000353AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000354
njn7fd6d382009-01-22 21:56:32 +0000355case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000356 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000357 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000358 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000359 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
360 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000361 valt_load_address_normal="0x38000000"
362 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000363 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000364 ;;
365 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000366 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000367 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000368 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000369 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
370 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000371 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000372 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000373 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000374 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
375 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000376 else
njn7fd6d382009-01-22 21:56:32 +0000377 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000378 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000379 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
380 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000381 fi
njnd74b0ef2009-01-20 06:06:52 +0000382 valt_load_address_normal="0x38000000"
383 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000384 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000385 ;;
386 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000387 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000388 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000389 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
390 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000391 valt_load_address_normal="0x38000000"
392 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000393 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000394 ;;
sewardj03d86f22006-10-17 00:57:24 +0000395 ppc64-aix5)
396 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000397 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000398 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000399 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
400 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000401 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000402 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000403 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000404 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
405 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000406 else
njn7fd6d382009-01-22 21:56:32 +0000407 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000408 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000409 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
410 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000411 fi
njnd74b0ef2009-01-20 06:06:52 +0000412 valt_load_address_normal="0x38000000"
413 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000414 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000415 ;;
sewardj01262142006-01-04 01:20:28 +0000416 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000417 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000418 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000419 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000420 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
421 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000422 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000423 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000424 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000425 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
426 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000427 else
njn7fd6d382009-01-22 21:56:32 +0000428 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000429 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000430 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
431 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000432 fi
njnd74b0ef2009-01-20 06:06:52 +0000433 valt_load_address_normal="0x38000000"
434 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000435 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000436 ;;
njnf76d27a2009-05-28 01:53:07 +0000437 x86-darwin)
438 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000439 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000440 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
441 VGCONF_PLATFORM_SEC_CAPS=""
442 valt_load_address_normal="0x0"
443 valt_load_address_inner="0x0"
444 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
445 ;;
446 amd64-darwin)
447 if test x$vg_cv_only64bit = xyes; then
448 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000449 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000450 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
451 VGCONF_PLATFORM_SEC_CAPS=""
452 elif test x$vg_cv_only32bit = xyes; then
453 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000454 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000455 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
456 VGCONF_PLATFORM_SEC_CAPS=""
457 VGCONF_ARCH_PRI_CAPS="x86"
458 else
459 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000460 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000461 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
462 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
463 fi
464 valt_load_address_normal="0x0"
465 valt_load_address_inner="0x0"
466 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
467 ;;
sewardj59570ff2010-01-01 11:59:33 +0000468 arm-linux)
469 VGCONF_ARCH_PRI="arm"
470 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
471 VGCONF_PLATFORM_SEC_CAPS=""
472 valt_load_address_normal="0x38000000"
473 valt_load_address_inner="0x28000000"
474 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
475 ;;
nethercote888ecb72004-08-23 14:54:40 +0000476 *)
njn7fd6d382009-01-22 21:56:32 +0000477 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000478 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000479 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
480 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njn377c43f2009-05-19 07:39:22 +0000481 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000482 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000483 ;;
484esac
sewardjde4a1d02002-03-22 01:27:54 +0000485
njn7fd6d382009-01-22 21:56:32 +0000486#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000487
njn7fd6d382009-01-22 21:56:32 +0000488# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
489# defined.
490AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
491 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000492 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
493 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
494 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000495AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000496 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
497 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000498AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
499 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
500 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
501 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
502 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
503AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
504 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
505 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj59570ff2010-01-01 11:59:33 +0000506AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
507 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000508
njn7fd6d382009-01-22 21:56:32 +0000509# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
510# become defined.
511AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
512 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
513 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
514AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
515 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
516AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
517 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
518 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
519AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
520 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000521AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
522 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000523
njn7fd6d382009-01-22 21:56:32 +0000524AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
525 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
526 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
527AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
528 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
529
njnf76d27a2009-05-28 01:53:07 +0000530AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
531 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
532 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
533AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
534 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
535
536
njn7fd6d382009-01-22 21:56:32 +0000537# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000538# Relies on the assumption that the primary and secondary targets are
539# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000540AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
541 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
542 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
543 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000544 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
545 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000546AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
547 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
548 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000549AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
550 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
551 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000552
553
njn7fd6d382009-01-22 21:56:32 +0000554# Sometimes, in the Makefile.am files, it's useful to know whether or not
555# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000556AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000557 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000558
tomb637bad2005-11-08 12:28:35 +0000559
njn7fd6d382009-01-22 21:56:32 +0000560#----------------------------------------------------------------------------
561# Inner Valgrind?
562#----------------------------------------------------------------------------
563
njnd74b0ef2009-01-20 06:06:52 +0000564# Check if this should be built as an inner Valgrind, to be run within
565# another Valgrind. Choose the load address accordingly.
566AC_SUBST(VALT_LOAD_ADDRESS)
567AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
568 [AC_ARG_ENABLE(inner,
569 [ --enable-inner enables self-hosting],
570 [vg_cv_inner=$enableval],
571 [vg_cv_inner=no])])
572if test "$vg_cv_inner" = yes; then
573 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
574 VALT_LOAD_ADDRESS=$valt_load_address_inner
575else
576 VALT_LOAD_ADDRESS=$valt_load_address_normal
577fi
578
579
njn7fd6d382009-01-22 21:56:32 +0000580#----------------------------------------------------------------------------
581# Libc and suppressions
582#----------------------------------------------------------------------------
583# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000584AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000585
bart12e91122010-05-15 08:37:24 +0000586AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000587
bart12e91122010-05-15 08:37:24 +0000588if test x$ac_cv_header_features_h = xyes; then
589 rm -f conftest.$ac_ext
590 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000591#include <features.h>
bart12e91122010-05-15 08:37:24 +0000592#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
593glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000594#endif
bart12e91122010-05-15 08:37:24 +0000595_ACEOF
596 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
597fi
bartb7c3f082010-05-13 06:32:36 +0000598
sewardj03d86f22006-10-17 00:57:24 +0000599AC_EGREP_CPP([AIX5_LIBC], [
600#include <standards.h>
601#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
602 AIX5_LIBC
603#endif
604],
dirk07596a22008-04-25 11:33:30 +0000605GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000606
njnf76d27a2009-05-28 01:53:07 +0000607# not really a version check
608AC_EGREP_CPP([DARWIN_LIBC], [
609#include <sys/cdefs.h>
610#if defined(__DARWIN_VERS_1050)
611 DARWIN_LIBC
612#endif
613],
614GLIBC_VERSION="darwin")
615
dirk07596a22008-04-25 11:33:30 +0000616AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000617
dirk07596a22008-04-25 11:33:30 +0000618case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000619 2.2)
620 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000621 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000622 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
623 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000624 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000625 ;;
626
sewardj08c7f012002-10-07 23:56:55 +0000627 2.3)
628 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000629 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000630 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000631 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000632 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000633 ;;
634
njn781dba52005-06-30 04:06:38 +0000635 2.4)
636 AC_MSG_RESULT(2.4 family)
637 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000638 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000639 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000640 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000641 ;;
642
dirkaece45c2006-10-12 08:17:49 +0000643 2.5)
644 AC_MSG_RESULT(2.5 family)
645 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000646 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000647 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000648 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000649 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000650 2.6)
651 AC_MSG_RESULT(2.6 family)
652 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000653 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000654 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000655 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000656 ;;
657 2.7)
658 AC_MSG_RESULT(2.7 family)
659 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000660 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000661 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000662 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000663 ;;
dirk07596a22008-04-25 11:33:30 +0000664 2.8)
665 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000666 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000667 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
668 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
669 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
670 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000671 2.9)
672 AC_MSG_RESULT(2.9 family)
673 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
674 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
675 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
676 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
677 ;;
sewardj5d425e82009-02-01 19:01:11 +0000678 2.10)
679 AC_MSG_RESULT(2.10 family)
680 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
681 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
682 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
683 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
684 ;;
bart0fac7ff2009-11-15 19:11:19 +0000685 2.11)
686 AC_MSG_RESULT(2.11 family)
687 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
688 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
689 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
690 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000691 ;;
692 2.12)
693 AC_MSG_RESULT(2.12 family)
694 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
695 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
696 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
697 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000698 ;;
sewardj03d86f22006-10-17 00:57:24 +0000699 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000700 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
701 AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
sewardj03d86f22006-10-17 00:57:24 +0000702 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
703 ;;
njnf76d27a2009-05-28 01:53:07 +0000704 darwin)
705 AC_MSG_RESULT(Darwin)
706 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
707 # DEFAULT_SUPP set by kernel version check above.
708 ;;
dirkaece45c2006-10-12 08:17:49 +0000709
sewardjde4a1d02002-03-22 01:27:54 +0000710 *)
bart12e91122010-05-15 08:37:24 +0000711 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
bartb7c3f082010-05-13 06:32:36 +0000712 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.12])
dirk07596a22008-04-25 11:33:30 +0000713 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000714 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000715 ;;
716esac
717
dirk07596a22008-04-25 11:33:30 +0000718AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000719
sewardj414f3582008-07-18 20:46:00 +0000720
721# Add default suppressions for the X client libraries. Make no
722# attempt to detect whether such libraries are installed on the
723# build machine (or even if any X facilities are present); just
724# add the suppressions antidisirregardless.
725DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
726DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000727
sewardj5744c022008-10-19 18:58:13 +0000728# Add glibc and X11 suppressions for exp-ptrcheck
729DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
730
sewardj2e10a682003-04-07 19:36:41 +0000731
njn7fd6d382009-01-22 21:56:32 +0000732#----------------------------------------------------------------------------
733# Checking for various library functions and other definitions
734#----------------------------------------------------------------------------
735
bart59e2f182008-04-28 16:22:53 +0000736# Check for CLOCK_MONOTONIC
737
738AC_MSG_CHECKING([for CLOCK_MONOTONIC])
739
740AC_TRY_COMPILE(
741[
742#include <time.h>
743], [
744 struct timespec t;
745 clock_gettime(CLOCK_MONOTONIC, &t);
746 return 0;
747],
748[
749AC_MSG_RESULT([yes])
750AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
751 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
752], [
753AC_MSG_RESULT([no])
754])
755
bartfea06922008-05-03 09:12:15 +0000756
757# Check for PTHREAD_MUTEX_ADAPTIVE_NP
758
759AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
760
761AC_TRY_COMPILE(
762[
763#define _GNU_SOURCE
764#include <pthread.h>
765], [
766 return (PTHREAD_MUTEX_ADAPTIVE_NP);
767],
768[
769AC_MSG_RESULT([yes])
770AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
771 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
772], [
773AC_MSG_RESULT([no])
774])
775
776
777# Check for PTHREAD_MUTEX_ERRORCHECK_NP
778
779AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
780
781AC_TRY_COMPILE(
782[
783#define _GNU_SOURCE
784#include <pthread.h>
785], [
786 return (PTHREAD_MUTEX_ERRORCHECK_NP);
787],
788[
789AC_MSG_RESULT([yes])
790AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
791 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
792], [
793AC_MSG_RESULT([no])
794])
795
796
797# Check for PTHREAD_MUTEX_RECURSIVE_NP
798
799AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
800
801AC_TRY_COMPILE(
802[
803#define _GNU_SOURCE
804#include <pthread.h>
805], [
806 return (PTHREAD_MUTEX_RECURSIVE_NP);
807],
808[
809AC_MSG_RESULT([yes])
810AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
811 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
812], [
813AC_MSG_RESULT([no])
814])
815
816
817# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
818
819AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
820
821AC_TRY_COMPILE(
822[
823#define _GNU_SOURCE
824#include <pthread.h>
825], [
826 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
827 return 0;
828],
829[
830AC_MSG_RESULT([yes])
831AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
832 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
833], [
834AC_MSG_RESULT([no])
835])
836
837
bart5e389f12008-04-05 12:53:15 +0000838# Check whether pthread_mutex_t has a member called __m_kind.
839
bartb11355c2010-04-29 16:37:26 +0000840AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
841 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
842 1,
843 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
844 ],
845 [],
846 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000847
848
849# Check whether pthread_mutex_t has a member called __data.__kind.
850
bartb11355c2010-04-29 16:37:26 +0000851AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
852 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
853 1,
854 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
855 ],
856 [],
857 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000858
859
bart62c370e2008-05-12 18:50:51 +0000860# does this compiler support -maltivec and does it have the include file
861# <altivec.h> ?
862
863AC_MSG_CHECKING([for Altivec])
864
865safe_CFLAGS=$CFLAGS
866CFLAGS="-maltivec"
867
868AC_TRY_COMPILE(
869[
870#include <altivec.h>
871], [
872 vector unsigned int v;
873],
874[
875ac_have_altivec=yes
876AC_MSG_RESULT([yes])
877], [
878ac_have_altivec=no
879AC_MSG_RESULT([no])
880])
881CFLAGS=$safe_CFLAGS
882
883AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
884AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
885
886
bart36dd85a2009-04-26 07:11:48 +0000887# Check for pthread_create@GLIBC2.0
888AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
889
bart16e1c5a2009-04-26 07:38:53 +0000890safe_CFLAGS=$CFLAGS
891CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000892AC_TRY_LINK(
893[
894extern int pthread_create_glibc_2_0(void*, const void*,
895 void *(*)(void*), void*);
896__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
897], [
bart276ed3a2009-05-10 15:41:45 +0000898#ifdef __powerpc__
899/*
900 * Apparently on PowerPC linking this program succeeds and generates an
901 * executable with the undefined symbol pthread_create@GLIBC_2.0.
902 */
903#error This test does not work properly on PowerPC.
904#else
bart16e1c5a2009-04-26 07:38:53 +0000905 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000906#endif
bart16e1c5a2009-04-26 07:38:53 +0000907 return 0;
bart36dd85a2009-04-26 07:11:48 +0000908],
909[
910ac_have_pthread_create_glibc_2_0=yes
911AC_MSG_RESULT([yes])
912AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
913 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
914], [
915ac_have_pthread_create_glibc_2_0=no
916AC_MSG_RESULT([no])
917])
bart16e1c5a2009-04-26 07:38:53 +0000918CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000919
920AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000921 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000922
923
barta50aa8a2008-04-27 06:06:57 +0000924# Check for eventfd_t, eventfd() and eventfd_read()
925AC_MSG_CHECKING([for eventfd()])
926
927AC_TRY_LINK(
928[
929#include <sys/eventfd.h>
930], [
931 eventfd_t ev;
932 int fd;
933
934 fd = eventfd(5, 0);
935 eventfd_read(fd, &ev);
936 return 0;
937],
938[
939AC_MSG_RESULT([yes])
940AC_DEFINE([HAVE_EVENTFD], 1,
941 [Define to 1 if you have the `eventfd' function.])
942AC_DEFINE([HAVE_EVENTFD_READ], 1,
943 [Define to 1 if you have the `eventfd_read' function.])
944], [
945AC_MSG_RESULT([no])
946])
947
948
njn7fd6d382009-01-22 21:56:32 +0000949#----------------------------------------------------------------------------
950# Checking for supported compiler flags.
951#----------------------------------------------------------------------------
952
sewardj535c50f2005-06-04 23:14:53 +0000953# does this compiler support -m32 ?
954AC_MSG_CHECKING([if gcc accepts -m32])
955
956safe_CFLAGS=$CFLAGS
957CFLAGS="-m32"
958
959AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000960 return 0;
sewardj535c50f2005-06-04 23:14:53 +0000961],
962[
963FLAG_M32="-m32"
964AC_MSG_RESULT([yes])
965], [
966FLAG_M32=""
967AC_MSG_RESULT([no])
968])
969CFLAGS=$safe_CFLAGS
970
971AC_SUBST(FLAG_M32)
972
973
sewardj03d86f22006-10-17 00:57:24 +0000974# does this compiler support -maix32 ?
975AC_MSG_CHECKING([if gcc accepts -maix32])
976
977safe_CFLAGS=$CFLAGS
978CFLAGS="-maix32"
979
980AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000981 return 0;
sewardj03d86f22006-10-17 00:57:24 +0000982],
983[
984FLAG_MAIX32="-maix32"
985AC_MSG_RESULT([yes])
986], [
987FLAG_MAIX32=""
988AC_MSG_RESULT([no])
989])
990CFLAGS=$safe_CFLAGS
991
992AC_SUBST(FLAG_MAIX32)
993
994
sewardj01262142006-01-04 01:20:28 +0000995# does this compiler support -m64 ?
996AC_MSG_CHECKING([if gcc accepts -m64])
997
998safe_CFLAGS=$CFLAGS
999CFLAGS="-m64"
1000
1001AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001002 return 0;
sewardj01262142006-01-04 01:20:28 +00001003],
1004[
1005FLAG_M64="-m64"
1006AC_MSG_RESULT([yes])
1007], [
1008FLAG_M64=""
1009AC_MSG_RESULT([no])
1010])
1011CFLAGS=$safe_CFLAGS
1012
1013AC_SUBST(FLAG_M64)
1014
1015
sewardj03d86f22006-10-17 00:57:24 +00001016# does this compiler support -maix64 ?
1017AC_MSG_CHECKING([if gcc accepts -maix64])
1018
1019safe_CFLAGS=$CFLAGS
1020CFLAGS="-maix64"
1021
1022AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001023 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001024],
1025[
1026FLAG_MAIX64="-maix64"
1027AC_MSG_RESULT([yes])
1028], [
1029FLAG_MAIX64=""
1030AC_MSG_RESULT([no])
1031])
1032CFLAGS=$safe_CFLAGS
1033
1034AC_SUBST(FLAG_MAIX64)
1035
1036
sewardj67f1fcc2005-07-03 10:41:02 +00001037# does this compiler support -mmmx ?
1038AC_MSG_CHECKING([if gcc accepts -mmmx])
1039
1040safe_CFLAGS=$CFLAGS
1041CFLAGS="-mmmx"
1042
1043AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001044 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001045],
1046[
1047FLAG_MMMX="-mmmx"
1048AC_MSG_RESULT([yes])
1049], [
1050FLAG_MMMX=""
1051AC_MSG_RESULT([no])
1052])
1053CFLAGS=$safe_CFLAGS
1054
1055AC_SUBST(FLAG_MMMX)
1056
1057
1058# does this compiler support -msse ?
1059AC_MSG_CHECKING([if gcc accepts -msse])
1060
1061safe_CFLAGS=$CFLAGS
1062CFLAGS="-msse"
1063
1064AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001065 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001066],
1067[
1068FLAG_MSSE="-msse"
1069AC_MSG_RESULT([yes])
1070], [
1071FLAG_MSSE=""
1072AC_MSG_RESULT([no])
1073])
1074CFLAGS=$safe_CFLAGS
1075
1076AC_SUBST(FLAG_MSSE)
1077
1078
sewardj5b754b42002-06-03 22:53:35 +00001079# does this compiler support -mpreferred-stack-boundary=2 ?
1080AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1081
daywalker3664f562003-10-17 13:43:46 +00001082safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001083CFLAGS="-mpreferred-stack-boundary=2"
1084
1085AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001086 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001087],
1088[
1089PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001090AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001091], [
1092PREFERRED_STACK_BOUNDARY=""
1093AC_MSG_RESULT([no])
1094])
daywalker3664f562003-10-17 13:43:46 +00001095CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001096
1097AC_SUBST(PREFERRED_STACK_BOUNDARY)
1098
sewardj535c50f2005-06-04 23:14:53 +00001099
sewardjb5f6f512005-03-10 23:59:00 +00001100# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001101AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001102
1103safe_CFLAGS=$CFLAGS
1104CFLAGS="-Wno-pointer-sign"
1105
1106AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001107 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001108],
1109[
1110no_pointer_sign=yes
1111AC_MSG_RESULT([yes])
1112], [
1113no_pointer_sign=no
1114AC_MSG_RESULT([no])
1115])
1116CFLAGS=$safe_CFLAGS
1117
1118if test x$no_pointer_sign = xyes; then
1119 CFLAGS="$CFLAGS -Wno-pointer-sign"
1120fi
1121
sewardj535c50f2005-06-04 23:14:53 +00001122
barte026bd22009-07-04 12:17:07 +00001123# does this compiler support -Wno-empty-body ?
1124
1125AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1126
1127safe_CFLAGS=$CFLAGS
1128CFLAGS="-Wno-empty-body"
1129
1130AC_TRY_COMPILE(
1131[ ],
1132[
1133 return 0;
1134],
1135[
1136AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1137AC_MSG_RESULT([yes])
1138],
1139[
1140AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1141AC_MSG_RESULT([no])
1142])
1143CFLAGS=$safe_CFLAGS
1144
1145
bart9d865fa2008-06-23 12:11:49 +00001146# does this compiler support -Wno-format-zero-length ?
1147
1148AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1149
1150safe_CFLAGS=$CFLAGS
1151CFLAGS="-Wno-format-zero-length"
1152
1153AC_TRY_COMPILE(
1154[ ],
1155[
1156 return 0;
1157],
1158[
1159AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1160AC_MSG_RESULT([yes])
1161],
1162[
1163AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1164AC_MSG_RESULT([no])
1165])
1166CFLAGS=$safe_CFLAGS
1167
1168
bartbf9b85c2009-08-12 12:55:56 +00001169# does this compiler support -Wno-uninitialized ?
1170
1171AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1172
1173safe_CFLAGS=$CFLAGS
1174CFLAGS="-Wno-uninitialized"
1175
1176AC_TRY_COMPILE(
1177[ ],
1178[
1179 return 0;
1180],
1181[
1182AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1183AC_MSG_RESULT([yes])
1184],
1185[
1186AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1187AC_MSG_RESULT([no])
1188])
1189CFLAGS=$safe_CFLAGS
1190
1191
bart56730cd2008-05-11 06:41:46 +00001192# does this compiler support -Wextra or the older -W ?
1193
1194AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1195
1196safe_CFLAGS=$CFLAGS
1197CFLAGS="-Wextra"
1198
1199AC_TRY_COMPILE(
1200[ ],
1201[
1202 return 0;
1203],
1204[
1205AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1206AC_MSG_RESULT([-Wextra])
1207], [
1208 CFLAGS="-W"
1209 AC_TRY_COMPILE(
1210 [ ],
1211 [
1212 return 0;
1213 ],
1214 [
1215 AC_SUBST([FLAG_W_EXTRA], [-W])
1216 AC_MSG_RESULT([-W])
1217 ], [
1218 AC_SUBST([FLAG_W_EXTRA], [])
1219 AC_MSG_RESULT([not supported])
1220 ])
1221])
1222CFLAGS=$safe_CFLAGS
1223
1224
sewardja72c26d2007-05-01 13:44:08 +00001225# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001226AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001227
1228safe_CFLAGS=$CFLAGS
1229CFLAGS="-fno-stack-protector"
1230
1231AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001232 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001233],
1234[
1235no_stack_protector=yes
1236FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1237AC_MSG_RESULT([yes])
1238], [
1239no_stack_protector=no
1240FLAG_FNO_STACK_PROTECTOR=""
1241AC_MSG_RESULT([no])
1242])
1243CFLAGS=$safe_CFLAGS
1244
1245AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1246
1247if test x$no_stack_protector = xyes; then
1248 CFLAGS="$CFLAGS -fno-stack-protector"
1249fi
1250
1251
bart56730cd2008-05-11 06:41:46 +00001252# does this compiler support --param inline-unit-growth=... ?
1253
1254AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1255
1256safe_CFLAGS=$CFLAGS
1257CFLAGS="--param inline-unit-growth=900"
1258
1259AC_TRY_COMPILE(
1260[ ],
1261[
1262 return 0;
1263],
1264[
1265AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1266 ["--param inline-unit-growth=900"])
1267AC_MSG_RESULT([yes])
1268], [
1269AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1270AC_MSG_RESULT([no])
1271])
1272CFLAGS=$safe_CFLAGS
1273
1274
sewardj00f1e622006-03-12 16:47:10 +00001275# does the ppc assembler support "mtocrf" et al?
1276AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1277
1278AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001279__asm__ __volatile__("mtocrf 4,0");
1280__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001281],
1282[
1283ac_have_as_ppc_mftocrf=yes
1284AC_MSG_RESULT([yes])
1285], [
1286ac_have_as_ppc_mftocrf=no
1287AC_MSG_RESULT([no])
1288])
1289if test x$ac_have_as_ppc_mftocrf = xyes ; then
1290 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1291fi
1292
1293
sewardjf0aabf82007-03-22 00:24:21 +00001294# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001295# Note, this doesn't generate a C-level symbol. It generates a
1296# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001297AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1298
1299AC_TRY_COMPILE(, [
1300 do { long long int x;
1301 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1302 while (0)
1303],
1304[
1305ac_have_as_sse3=yes
1306AC_MSG_RESULT([yes])
1307], [
1308ac_have_as_sse3=no
1309AC_MSG_RESULT([no])
1310])
sewardjfa18a262007-03-22 12:13:13 +00001311
1312AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001313
1314
sewardj6d6da5b2008-02-09 12:07:40 +00001315# Ditto for SSSE3 instructions (note extra S)
1316# Note, this doesn't generate a C-level symbol. It generates a
1317# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1318AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1319
1320AC_TRY_COMPILE(, [
1321 do { long long int x;
1322 __asm__ __volatile__(
1323 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1324 while (0)
1325],
1326[
1327ac_have_as_ssse3=yes
1328AC_MSG_RESULT([yes])
1329], [
1330ac_have_as_ssse3=no
1331AC_MSG_RESULT([no])
1332])
1333
1334AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1335
1336
sewardjb5f6f512005-03-10 23:59:00 +00001337# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001338if test "x${cross_compiling}" = "xno"; then
1339# Native compilation: check whether running a program using TLS succeeds.
1340# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1341# succeeds but running programs using TLS fails.
1342AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1343 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1344 [vg_cv_tls=$enableval],
1345 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1346 [[return foo;]])],
1347 [vg_cv_tls=yes],
1348 [vg_cv_tls=no])])])
1349else
1350# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001351AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1352 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1353 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001354 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001355 [[return foo;]])],
1356 [vg_cv_tls=yes],
1357 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001358fi
sewardjb5f6f512005-03-10 23:59:00 +00001359
1360if test "$vg_cv_tls" = yes; then
1361AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1362fi
sewardj5b754b42002-06-03 22:53:35 +00001363
sewardj535c50f2005-06-04 23:14:53 +00001364
njn7fd6d382009-01-22 21:56:32 +00001365#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001366# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001367#----------------------------------------------------------------------------
1368
sewardjde4a1d02002-03-22 01:27:54 +00001369AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001370AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001371 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001372 endian.h \
1373 mqueue.h \
1374 sys/endian.h \
1375 sys/epoll.h \
1376 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001377 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001378 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001379 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001380 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001381 sys/syscall.h \
1382 sys/time.h \
1383 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001384 ])
sewardjde4a1d02002-03-22 01:27:54 +00001385
njn7fd6d382009-01-22 21:56:32 +00001386#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001387# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001388#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001389AC_TYPE_UID_T
1390AC_TYPE_OFF_T
1391AC_TYPE_SIZE_T
1392AC_HEADER_TIME
1393
sewardj535c50f2005-06-04 23:14:53 +00001394
njn7fd6d382009-01-22 21:56:32 +00001395#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001396# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001397#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001398AC_FUNC_MEMCMP
1399AC_FUNC_MMAP
1400AC_TYPE_SIGNAL
1401
bart71bad292008-04-27 11:43:23 +00001402AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001403
bartf5ceec82008-04-26 07:45:10 +00001404AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001405 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001406 epoll_create \
1407 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001408 floor \
bartce48fa92008-04-26 10:59:46 +00001409 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001410 mallinfo \
1411 memchr \
1412 memset \
1413 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001414 mremap \
bartf5ceec82008-04-26 07:45:10 +00001415 ppoll \
bart6d45e922009-01-20 13:45:38 +00001416 pthread_barrier_init \
1417 pthread_condattr_setclock \
1418 pthread_mutex_timedlock \
1419 pthread_rwlock_timedrdlock \
1420 pthread_rwlock_timedwrlock \
1421 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001422 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001423 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001424 semtimedop \
1425 signalfd \
njn6cc22472009-03-16 03:46:48 +00001426 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001427 strchr \
1428 strdup \
1429 strpbrk \
1430 strrchr \
1431 strstr \
barta72a27b2010-04-29 06:22:17 +00001432 syscall \
bartf5ceec82008-04-26 07:45:10 +00001433 timerfd \
1434 utimensat \
1435 ])
sewardjde4a1d02002-03-22 01:27:54 +00001436
bart623eec32008-07-29 17:54:49 +00001437# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1438# libraries with any shared object and/or executable. This is NOT what we
1439# want for e.g. vgpreload_core-x86-linux.so
1440LIBS=""
sewardj80637752006-03-02 13:48:21 +00001441
bart6d45e922009-01-20 13:45:38 +00001442AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1443 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001444AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1445 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001446AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1447 [test x$ac_cv_func_pthread_spin_lock = xyes])
1448
njn7fd6d382009-01-22 21:56:32 +00001449
1450#----------------------------------------------------------------------------
1451# MPI checks
1452#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001453# Do we have a useable MPI setup on the primary and/or secondary targets?
1454# On Linux, by default, assumes mpicc and -m32/-m64
1455# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001456# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001457# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1458# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001459MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001460if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1461 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001462 MPI_CC="mpxlc"
1463fi
1464
sewardje9fa5062006-03-12 18:29:18 +00001465mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001466if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1467 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001468 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001469elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1470 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001471 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001472elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001473 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001474elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001475 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001476fi
1477
sewardj03d86f22006-10-17 00:57:24 +00001478mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001479if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1480 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001481 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001482elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001483 mflag_secondary=-q32
1484fi
1485
1486
sewardj0ad46092006-03-02 17:09:16 +00001487AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001488 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001489 MPI_CC=$withval
1490)
sewardj03d86f22006-10-17 00:57:24 +00001491AC_SUBST(MPI_CC)
1492
1493## See if MPI_CC works for the primary target
1494##
1495AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001496saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001497saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001498CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001499CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001500AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001501#include <mpi.h>
1502#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001503],[
1504 int r = MPI_Init(NULL,NULL);
1505 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1506 return r;
1507], [
sewardj03d86f22006-10-17 00:57:24 +00001508ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001509AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001510], [
sewardj03d86f22006-10-17 00:57:24 +00001511ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001512AC_MSG_RESULT([no])
1513])
sewardj0ad46092006-03-02 17:09:16 +00001514CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001515CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001516AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001517
sewardj03d86f22006-10-17 00:57:24 +00001518## See if MPI_CC works for the secondary target. Complication: what if
1519## there is no secondary target? We need this to then fail.
1520## Kludge this by making MPI_CC something which will surely fail in
1521## such a case.
1522##
1523AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1524saved_CC=$CC
1525saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001526if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001527 CC="$MPI_CC this will surely fail"
1528else
1529 CC=$MPI_CC
1530fi
1531CFLAGS=$mflag_secondary
1532AC_TRY_LINK([
1533#include <mpi.h>
1534#include <stdio.h>
1535],[
1536 int r = MPI_Init(NULL,NULL);
1537 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1538 return r;
1539], [
1540ac_have_mpi2_sec=yes
1541AC_MSG_RESULT([yes, $MPI_CC])
1542], [
1543ac_have_mpi2_sec=no
1544AC_MSG_RESULT([no])
1545])
1546CC=$saved_CC
1547CFLAGS=$saved_CFLAGS
1548AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001549
1550
njn7fd6d382009-01-22 21:56:32 +00001551#----------------------------------------------------------------------------
1552# Other library checks
1553#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001554# There now follow some tests for QtCore, Boost, and OpenMP. These
1555# tests are present because Drd has some regression tests that use
1556# these packages. All regression test programs all compiled only
1557# for the primary target. And so it is important that the configure
1558# checks that follow, use the correct -m32 or -m64 flag for the
1559# primary target (called $mflag_primary). Otherwise, we can end up
1560# in a situation (eg) where, on amd64-linux, the test for Boost checks
1561# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1562# only build (meaning, the primary target is x86-linux), the build
1563# of the regtest programs that use Boost fails, because they are
1564# build as 32-bit (IN THIS EXAMPLE).
1565#
1566# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1567# NEEDED BY THE REGRESSION TEST PROGRAMS.
1568
1569
bart21d3cfc2008-08-02 09:08:17 +00001570# The test below verifies whether the QtCore package been installed.
1571# This test works as follows:
1572# - If pkg-config was not installed at the time autogen.sh was run,
1573# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1574# autogen.sh. Augogen.sh will generate a configure script that prints
1575# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1576# - If pkg-config was installed at the time autogen.sh was run,
1577# the generated configure script will try to detect the presence of the
1578# Qt4 QtCore library by looking up compile and linker flags in the file
1579# called QtCore.pc.
1580# - pkg-config settings can be overridden via the configure variables
1581# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1582# configure script -- see also ./configure --help).
1583# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1584# the pkg-config executable is not present on the system on which the
1585# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001586
bart21d3cfc2008-08-02 09:08:17 +00001587ifdef(
1588 [PKG_CHECK_EXISTS],
1589 [PKG_CHECK_EXISTS(
1590 [QtCore],
1591 [
1592 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001593 # Paranoia: don't trust the result reported by pkg-config, but when
1594 # pkg-config reports that QtCore has been found, verify whether linking
1595 # programs with QtCore succeeds.
1596 AC_LANG(C++)
1597 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001598 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001599 AC_TRY_LINK(
1600 [#include <QMutex>],
1601 [QMutex Mutex;],
1602 [ac_have_qtcore=yes],
1603 [
1604 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1605 ac_have_qtcore=no
1606 ]
1607 )
1608 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001609 ],
1610 [
1611 ac_have_qtcore=no
1612 ]
1613 )
1614 ],
1615 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1616 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1617 [ac_have_qtcore=no]
1618)
bart41ac62a2008-07-07 16:58:03 +00001619
1620AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1621
1622
bart62f54e42008-07-28 11:35:10 +00001623# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1624# See also http://doc.trolltech.com/4.3/qmutex.html.
1625if test x$ac_have_qtcore = xyes; then
1626 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1627 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001628 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001629 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001630 AC_TRY_COMPILE([
1631 #include <QtCore/QMutex>
1632 ],
1633 [
1634 QMutex M;
1635 M.tryLock(1);
1636 M.unlock();
1637 return 0;
1638 ],
1639 [
1640 AC_MSG_RESULT([yes])
1641 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1642 ],
1643 [
1644 AC_MSG_RESULT([no])
1645 ])
bart21d3cfc2008-08-02 09:08:17 +00001646 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001647 AC_LANG(C)
1648fi
1649
1650
bart4f43e002009-11-09 16:07:43 +00001651# Test for QAtomicInt, which has been introduced in Qt 4.4.
1652# See also http://doc.trolltech.com/4.4/qatomicint.html.
1653if test x$ac_have_qtcore = xyes; then
bart9da08ba2009-11-11 19:22:05 +00001654 AC_MSG_CHECKING([for Qt4 QAtomicInt])
bart4f43e002009-11-09 16:07:43 +00001655 AC_LANG(C++)
1656 safe_CXXFLAGS="${CXXFLAGS}"
1657 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1658 AC_TRY_COMPILE([
1659 #include <QtCore/QAtomicInt>
1660 ],
1661 [
1662 QAtomicInt I;
1663 I.testAndSetOrdered(0, 1);
1664 return 0;
1665 ],
1666 [
1667 ac_have_qtcore_qatomicint=yes
1668 AC_MSG_RESULT([yes])
1669 AC_DEFINE([HAVE_QTCORE_QATOMICINT], [1], [Define to 1 if the installed version of Qt4 provides QAtomicInt.])
1670 ],
1671 [
1672 ac_have_qtcore_qatomicint=no
1673 AC_MSG_RESULT([no])
1674 ])
1675 CXXFLAGS="${safe_CXXFLAGS}"
1676 AC_LANG(C)
1677fi
1678
1679AM_CONDITIONAL([HAVE_QTCORE_QATOMICINT], [test x$ac_have_qtcore_qatomicint = xyes])
1680
1681
1682
sewardj493c4ef2008-12-13 16:45:19 +00001683# Check whether the boost library 1.35 or later has been installed.
1684# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1685
1686AC_MSG_CHECKING([for boost])
1687
1688AC_LANG(C++)
1689safe_CXXFLAGS=$CXXFLAGS
1690CXXFLAGS="-lboost_thread-mt $mflag_primary"
1691
1692AC_LINK_IFELSE(
1693[
1694#include <boost/thread.hpp>
1695static void thread_func(void)
1696{ }
1697int main(int argc, char** argv)
1698{
1699 boost::thread t(thread_func);
1700 return 0;
1701}
1702],
1703[
1704ac_have_boost_1_35=yes
1705AC_SUBST([BOOST_CFLAGS], [])
1706AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1707AC_MSG_RESULT([yes])
1708], [
1709ac_have_boost_1_35=no
1710AC_MSG_RESULT([no])
1711])
1712
1713CXXFLAGS=$safe_CXXFLAGS
1714AC_LANG(C)
1715
1716AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1717
1718
1719# does this compiler support -fopenmp, does it have the include file
1720# <omp.h> and does it have libgomp ?
1721
1722AC_MSG_CHECKING([for OpenMP])
1723
1724safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001725CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001726
1727AC_LINK_IFELSE(
1728[
1729#include <omp.h>
1730int main(int argc, char** argv)
1731{
1732 omp_set_dynamic(0);
1733 return 0;
1734}
1735],
1736[
1737ac_have_openmp=yes
1738AC_MSG_RESULT([yes])
1739], [
1740ac_have_openmp=no
1741AC_MSG_RESULT([no])
1742])
1743CFLAGS=$safe_CFLAGS
1744
1745AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1746
1747
sewardjc876a2f2009-01-22 22:44:30 +00001748# does this compiler have built-in functions for atomic memory access ?
1749AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1750
1751safe_CFLAGS=$CFLAGS
1752CFLAGS="$mflag_primary"
1753
1754AC_TRY_LINK(,
1755[
1756 int variable = 1;
1757 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1758 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1759],
1760[
bartc82d1372009-05-31 16:21:23 +00001761 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001762 AC_MSG_RESULT([yes])
1763 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1764],
1765[
bartc82d1372009-05-31 16:21:23 +00001766 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001767 AC_MSG_RESULT([no])
1768])
1769
1770CFLAGS=$safe_CFLAGS
1771
bartc82d1372009-05-31 16:21:23 +00001772AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1773
sewardjc876a2f2009-01-22 22:44:30 +00001774
njn7fd6d382009-01-22 21:56:32 +00001775#----------------------------------------------------------------------------
1776# Ok. We're done checking.
1777#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001778
njn8b68b642009-06-24 00:37:09 +00001779# Nb: VEX/Makefile is generated from Makefile.vex.in.
1780AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001781 Makefile
njn8b68b642009-06-24 00:37:09 +00001782 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001783 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001784 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001785 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001786 docs/Makefile
1787 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001788 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001789 perf/Makefile
1790 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001791 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001792 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001793 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001794 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001795 memcheck/Makefile
1796 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001797 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001798 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001799 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001800 memcheck/tests/darwin/Makefile
njna454ec02009-01-19 03:16:59 +00001801 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001802 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001803 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001804 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001805 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00001806 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001807 callgrind/Makefile
1808 callgrind/callgrind_annotate
1809 callgrind/callgrind_control
1810 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001811 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001812 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001813 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001814 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001815 massif/perf/Makefile
njnd5a8d242007-11-02 20:44:57 +00001816 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001817 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001818 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001819 none/Makefile
1820 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001821 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001822 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001823 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001824 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00001825 none/tests/arm/Makefile
njn0458a122009-02-13 06:23:46 +00001826 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001827 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001828 none/tests/x86-linux/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001829 exp-ptrcheck/Makefile
1830 exp-ptrcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00001831 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00001832 drd/scripts/download-and-build-splash2
1833 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001834 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00001835 exp-bbv/tests/Makefile
1836 exp-bbv/tests/x86/Makefile
1837 exp-bbv/tests/x86-linux/Makefile
1838 exp-bbv/tests/amd64-linux/Makefile
1839 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00001840 exp-bbv/tests/arm-linux/Makefile
njn8b68b642009-06-24 00:37:09 +00001841])
1842AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001843
1844cat<<EOF
1845
njn311303f2009-02-06 03:46:50 +00001846 Maximum build arch: ${ARCH_MAX}
1847 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001848 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001849 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001850 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1851 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001852 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001853
gobry3b777892002-04-04 09:18:39 +00001854EOF