blob: fce2b16b2d736b721bcb1679990f63bef0f27f0d [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
42
bartcddeaf52008-05-25 15:58:11 +000043# If no AR variable was specified, look up the name of the archiver. Otherwise
44# do not touch the AR variable.
45if test "x$AR" = "x"; then
bart325cd972009-04-04 14:36:51 +000046 AC_PATH_PROGS([AR], [`echo $LD | sed 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000047fi
48AC_ARG_VAR([AR],[Archiver command])
49
gobrye721a522002-03-22 13:38:30 +000050# Check for the compiler support
51if test "${GCC}" != "yes" ; then
52 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
53fi
54
sewardj2f685952002-12-22 19:32:23 +000055# figure out where perl lives
56AC_PATH_PROG(PERL, perl)
57
njn9315df32003-04-16 20:50:50 +000058# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000059AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000060AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000061
daywalker48ccca52002-04-15 00:31:58 +000062# some older automake's don't have it so try something on our own
63ifdef([AM_PROG_AS],[AM_PROG_AS],
64[
gobry1be19852002-03-26 20:44:55 +000065AS="${CC}"
66AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000067
gobry1be19852002-03-26 20:44:55 +000068ASFLAGS=""
69AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000070])
gobry3b777892002-04-04 09:18:39 +000071
gobry3b777892002-04-04 09:18:39 +000072
njn0d2e58f2009-02-25 04:57:56 +000073# Check if 'diff' supports -u (universal diffs) and use it if possible.
74
75AC_MSG_CHECKING([for diff -u])
76AC_SUBST(DIFF)
77
78# Comparing two identical files results in 0, unless -u isn't supported (as
79# it's not on AIX).
njn31f665e2009-02-26 21:25:50 +000080tmpfile="tmp-xxx-yyy-zzz"
81touch $tmpfile;
82if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000083 AC_MSG_RESULT([yes])
84 DIFF="diff -u"
85else
86 AC_MSG_RESULT([no])
87 DIFF="diff"
88fi
njn31f665e2009-02-26 21:25:50 +000089rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000090
91
sewardj535c50f2005-06-04 23:14:53 +000092# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +000093AC_MSG_CHECKING([for a supported version of gcc])
94
sewardjf33b4332008-07-18 18:20:42 +000095[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +000096
97case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +000098 2.*)
gobrye721a522002-03-22 13:38:30 +000099 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000100 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
101 ;;
gobrye721a522002-03-22 13:38:30 +0000102 *)
103 AC_MSG_RESULT([ok (${gcc_version})])
104 ;;
105esac
106
njn7fd6d382009-01-22 21:56:32 +0000107#----------------------------------------------------------------------------
108# Arch/OS/platform tests.
109#----------------------------------------------------------------------------
110# We create a number of arch/OS/platform-related variables. We prefix them
111# all with "VGCONF_" which indicates that they are defined at
112# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
113# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000114
sewardjde4a1d02002-03-22 01:27:54 +0000115AC_CANONICAL_HOST
116
117AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000118
njn7fd6d382009-01-22 21:56:32 +0000119# ARCH_MAX reflects the most that this CPU can do: for example if it
120# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
121# Ditto for amd64. It is used for more configuration below, but is not used
122# outside this file.
gobrye721a522002-03-22 13:38:30 +0000123case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000124 i?86)
125 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000126 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000127 ;;
128
njnfe408942004-11-23 17:52:24 +0000129 x86_64)
130 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000131 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000132 ;;
133
sewardj2c48c7b2005-11-29 13:05:56 +0000134 powerpc64)
njn7fd6d382009-01-22 21:56:32 +0000135 # This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000136 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000137 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000138 ;;
139
140 powerpc)
njn7fd6d382009-01-22 21:56:32 +0000141 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
142 # Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000143 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000144 case "${host_os}" in
145 aix5.*)
njn7fd6d382009-01-22 21:56:32 +0000146 ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000147 ;;
148 *)
njn7fd6d382009-01-22 21:56:32 +0000149 ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000150 ;;
151 esac
nethercote9bcc9062004-10-13 13:50:01 +0000152 ;;
153
sewardj59570ff2010-01-01 11:59:33 +0000154 armv7*)
155 AC_MSG_RESULT([ok (${host_cpu})])
156 ARCH_MAX="arm"
157 ;;
158
sewardjde4a1d02002-03-22 01:27:54 +0000159 *)
160 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000161 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000162 ;;
163esac
164
njn7fd6d382009-01-22 21:56:32 +0000165#----------------------------------------------------------------------------
166
sewardj86e992f2006-01-28 18:39:09 +0000167# Sometimes it's convenient to subvert the bi-arch build system and
168# just have a single build even though the underlying platform is
169# capable of both. Hence handle --enable-only64bit and
170# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000171# [Actually, if either of these options are used, I think both get built,
172# but only one gets installed. So if you use an in-place build, both can be
173# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000174
175# Check if a 64-bit only build has been requested
176AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
177 [AC_ARG_ENABLE(only64bit,
178 [ --enable-only64bit do a 64-bit only build],
179 [vg_cv_only64bit=$enableval],
180 [vg_cv_only64bit=no])])
181
182# Check if a 32-bit only build has been requested
183AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
184 [AC_ARG_ENABLE(only32bit,
185 [ --enable-only32bit do a 32-bit only build],
186 [vg_cv_only32bit=$enableval],
187 [vg_cv_only32bit=no])])
188
189# Stay sane
190if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
191 AC_MSG_ERROR(
192 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
193fi
194
njn7fd6d382009-01-22 21:56:32 +0000195#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000196
njn311303f2009-02-06 03:46:50 +0000197# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
198# compilation of many C files via -VGO_$(VGCONF_OS) and
199# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000200AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000201AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000202
njnf76d27a2009-05-28 01:53:07 +0000203DEFAULT_SUPP=""
204
gobrye721a522002-03-22 13:38:30 +0000205case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000206 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000207 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000208 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000209
210 # Ok, this is linux. Check the kernel version
211 AC_MSG_CHECKING([for the kernel version])
212
213 kernel=`uname -r`
214
215 case "${kernel}" in
216 2.6.*)
217 AC_MSG_RESULT([2.6 family (${kernel})])
218 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
219 ;;
220
221 2.4.*)
222 AC_MSG_RESULT([2.4 family (${kernel})])
223 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
224 ;;
225
mueller8c68e042004-01-03 15:21:14 +0000226 *)
227 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000228 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000229 ;;
230 esac
231
232 ;;
233
sewardj03d86f22006-10-17 00:57:24 +0000234 aix5.1.*)
235 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000236 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000237 ;;
238 aix5.2.*)
239 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000240 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000241 ;;
242 aix5.3.*)
243 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000244 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000245 ;;
246
mueller8c68e042004-01-03 15:21:14 +0000247 *freebsd*)
248 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000249 VGCONF_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000250 ;;
251
njnf76d27a2009-05-28 01:53:07 +0000252 *darwin*)
253 AC_MSG_RESULT([ok (${host_os})])
254 VGCONF_OS="darwin"
255
256 AC_MSG_CHECKING([for the kernel version])
257 kernel=`uname -r`
258
259 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
260 # has only one relevant version, the OS version. The `uname` check
261 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
262 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
263 # Snow Leopard and darwin10.supp), and we don't know of an macros
264 # similar to __GLIBC__ to get that info.
265 #
266 # XXX: `uname -r` won't do the right thing for cross-compiles, but
267 # that's not a problem yet.
268 case "${kernel}" in
269 9.*)
270 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
271 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000272 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000273 ;;
274 *)
275 AC_MSG_RESULT([unsupported (${kernel})])
276 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
277 ;;
278 esac
279 ;;
280
sewardjde4a1d02002-03-22 01:27:54 +0000281 *)
282 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000283 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000284 ;;
285esac
286
njn7fd6d382009-01-22 21:56:32 +0000287#----------------------------------------------------------------------------
288
tomd6398392006-06-07 17:44:36 +0000289# If we are building on a 64 bit platform test to see if the system
290# supports building 32 bit programs and disable 32 bit support if it
291# does not support building 32 bit programs
292
njn7fd6d382009-01-22 21:56:32 +0000293case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000294 amd64-linux|ppc64-linux)
295 AC_MSG_CHECKING([for 32 bit build support])
296 safe_CFLAGS=$CFLAGS
297 CFLAGS="-m32"
298 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000299 return 0;
tomd6398392006-06-07 17:44:36 +0000300 ],
301 [
302 AC_MSG_RESULT([yes])
303 ], [
304 vg_cv_only64bit="yes"
305 AC_MSG_RESULT([no])
306 ])
307 CFLAGS=$safe_CFLAGS;;
308esac
309
310if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
311 AC_MSG_ERROR(
312 [--enable-only32bit was specified but system does not support 32 bit builds])
313fi
nethercote888ecb72004-08-23 14:54:40 +0000314
njn7fd6d382009-01-22 21:56:32 +0000315#----------------------------------------------------------------------------
316
njn311303f2009-02-06 03:46:50 +0000317# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
318# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
319# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
320# above) will be "amd64" since that reflects the most that this cpu can do,
321# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
322# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000323# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
324# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
325AC_SUBST(VGCONF_ARCH_PRI)
326
njn3f8a6e92009-06-02 00:20:47 +0000327# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
328# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
329# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
330# It is empty if there is no secondary target.
331AC_SUBST(VGCONF_ARCH_SEC)
332
njn311303f2009-02-06 03:46:50 +0000333# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
334# The entire system, including regression and performance tests, will be
335# built for this target. The "_CAPS" indicates that the name is in capital
336# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000337# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000338# convention and cannot contain '-' characters. This is in contrast to
339# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000340AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
341
342# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
343# Valgrind and tools will also be built for this target, but not the
344# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000345#
njn7fd6d382009-01-22 21:56:32 +0000346# By default, the primary arch is the same as the "max" arch, as commented
347# above (at the definition of ARCH_MAX). We may choose to downgrade it in
348# the big case statement just below here, in the case where we're building
349# on a 64 bit machine but have been requested only to do a 32 bit build.
350AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
351
sewardj01262142006-01-04 01:20:28 +0000352AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000353
njn7fd6d382009-01-22 21:56:32 +0000354case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000355 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000356 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000357 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000358 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
359 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000360 valt_load_address_normal="0x38000000"
361 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000362 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000363 ;;
364 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000365 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000366 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000367 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000368 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
369 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000370 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000371 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000372 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000373 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
374 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000375 else
njn7fd6d382009-01-22 21:56:32 +0000376 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000377 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000378 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
379 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000380 fi
njnd74b0ef2009-01-20 06:06:52 +0000381 valt_load_address_normal="0x38000000"
382 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000383 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000384 ;;
385 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000386 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000387 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000388 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
389 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000390 valt_load_address_normal="0x38000000"
391 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000392 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000393 ;;
sewardj03d86f22006-10-17 00:57:24 +0000394 ppc64-aix5)
395 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000396 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000397 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000398 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
399 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000400 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000401 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000402 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000403 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
404 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000405 else
njn7fd6d382009-01-22 21:56:32 +0000406 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000407 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000408 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
409 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000410 fi
njnd74b0ef2009-01-20 06:06:52 +0000411 valt_load_address_normal="0x38000000"
412 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000413 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000414 ;;
sewardj01262142006-01-04 01:20:28 +0000415 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000416 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000417 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000418 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000419 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
420 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000421 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000422 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000423 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000424 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
425 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000426 else
njn7fd6d382009-01-22 21:56:32 +0000427 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000428 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000429 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
430 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000431 fi
njnd74b0ef2009-01-20 06:06:52 +0000432 valt_load_address_normal="0x38000000"
433 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000434 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000435 ;;
njnf76d27a2009-05-28 01:53:07 +0000436 x86-darwin)
437 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000438 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000439 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
440 VGCONF_PLATFORM_SEC_CAPS=""
441 valt_load_address_normal="0x0"
442 valt_load_address_inner="0x0"
443 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
444 ;;
445 amd64-darwin)
446 if test x$vg_cv_only64bit = xyes; then
447 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000448 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000449 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
450 VGCONF_PLATFORM_SEC_CAPS=""
451 elif test x$vg_cv_only32bit = xyes; then
452 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000453 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000454 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
455 VGCONF_PLATFORM_SEC_CAPS=""
456 VGCONF_ARCH_PRI_CAPS="x86"
457 else
458 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000459 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000460 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
461 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
462 fi
463 valt_load_address_normal="0x0"
464 valt_load_address_inner="0x0"
465 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
466 ;;
sewardj59570ff2010-01-01 11:59:33 +0000467 arm-linux)
468 VGCONF_ARCH_PRI="arm"
469 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
470 VGCONF_PLATFORM_SEC_CAPS=""
471 valt_load_address_normal="0x38000000"
472 valt_load_address_inner="0x28000000"
473 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
474 ;;
nethercote888ecb72004-08-23 14:54:40 +0000475 *)
njn7fd6d382009-01-22 21:56:32 +0000476 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000477 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000478 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
479 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njn377c43f2009-05-19 07:39:22 +0000480 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000481 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000482 ;;
483esac
sewardjde4a1d02002-03-22 01:27:54 +0000484
njn7fd6d382009-01-22 21:56:32 +0000485#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000486
njn7fd6d382009-01-22 21:56:32 +0000487# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
488# defined.
489AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
490 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000491 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
492 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
493 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000494AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000495 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
496 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000497AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
498 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
499 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
500 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
501 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
502AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
503 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
504 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj59570ff2010-01-01 11:59:33 +0000505AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
506 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000507
njn7fd6d382009-01-22 21:56:32 +0000508# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
509# become defined.
510AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
511 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
512 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
513AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
514 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
515AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
516 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
517 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
518AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
519 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000520AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
521 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000522
njn7fd6d382009-01-22 21:56:32 +0000523AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
524 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
525 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
526AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
527 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
528
njnf76d27a2009-05-28 01:53:07 +0000529AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
530 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
531 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
532AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
533 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
534
535
njn7fd6d382009-01-22 21:56:32 +0000536# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000537# Relies on the assumption that the primary and secondary targets are
538# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000539AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
540 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
541 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
542 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000543 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
544 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000545AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
546 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
547 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000548AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
549 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
550 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000551
552
njn7fd6d382009-01-22 21:56:32 +0000553# Sometimes, in the Makefile.am files, it's useful to know whether or not
554# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000555AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000556 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000557
tomb637bad2005-11-08 12:28:35 +0000558
njn7fd6d382009-01-22 21:56:32 +0000559#----------------------------------------------------------------------------
560# Inner Valgrind?
561#----------------------------------------------------------------------------
562
njnd74b0ef2009-01-20 06:06:52 +0000563# Check if this should be built as an inner Valgrind, to be run within
564# another Valgrind. Choose the load address accordingly.
565AC_SUBST(VALT_LOAD_ADDRESS)
566AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
567 [AC_ARG_ENABLE(inner,
568 [ --enable-inner enables self-hosting],
569 [vg_cv_inner=$enableval],
570 [vg_cv_inner=no])])
571if test "$vg_cv_inner" = yes; then
572 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
573 VALT_LOAD_ADDRESS=$valt_load_address_inner
574else
575 VALT_LOAD_ADDRESS=$valt_load_address_normal
576fi
577
578
njn7fd6d382009-01-22 21:56:32 +0000579#----------------------------------------------------------------------------
580# Libc and suppressions
581#----------------------------------------------------------------------------
582# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000583AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000584
dirk07596a22008-04-25 11:33:30 +0000585GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000586
sewardjde4a1d02002-03-22 01:27:54 +0000587AC_EGREP_CPP([GLIBC_22], [
588#include <features.h>
589#ifdef __GNU_LIBRARY__
590 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
591 GLIBC_22
592 #endif
593#endif
594],
dirk07596a22008-04-25 11:33:30 +0000595GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000596
sewardj08c7f012002-10-07 23:56:55 +0000597AC_EGREP_CPP([GLIBC_23], [
598#include <features.h>
599#ifdef __GNU_LIBRARY__
600 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
601 GLIBC_23
602 #endif
603#endif
604],
dirk07596a22008-04-25 11:33:30 +0000605GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000606
njn781dba52005-06-30 04:06:38 +0000607AC_EGREP_CPP([GLIBC_24], [
608#include <features.h>
609#ifdef __GNU_LIBRARY__
610 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
611 GLIBC_24
612 #endif
613#endif
614],
dirk07596a22008-04-25 11:33:30 +0000615GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000616
dirkaece45c2006-10-12 08:17:49 +0000617AC_EGREP_CPP([GLIBC_25], [
618#include <features.h>
619#ifdef __GNU_LIBRARY__
620 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
621 GLIBC_25
622 #endif
623#endif
624],
dirk07596a22008-04-25 11:33:30 +0000625GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000626
dirkc8bd0c52007-05-23 17:39:08 +0000627AC_EGREP_CPP([GLIBC_26], [
628#include <features.h>
629#ifdef __GNU_LIBRARY__
630 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
631 GLIBC_26
632 #endif
633#endif
634],
dirk07596a22008-04-25 11:33:30 +0000635GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000636
sewardj68c80c12007-11-18 14:40:02 +0000637AC_EGREP_CPP([GLIBC_27], [
638#include <features.h>
639#ifdef __GNU_LIBRARY__
640 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
641 GLIBC_27
642 #endif
643#endif
644],
dirk07596a22008-04-25 11:33:30 +0000645GLIBC_VERSION="2.7")
646
647AC_EGREP_CPP([GLIBC_28], [
648#include <features.h>
649#ifdef __GNU_LIBRARY__
650 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
651 GLIBC_28
652 #endif
653#endif
654],
655GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000656
dirkd2e31eb2008-11-19 23:58:36 +0000657AC_EGREP_CPP([GLIBC_29], [
658#include <features.h>
659#ifdef __GNU_LIBRARY__
660 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
661 GLIBC_29
662 #endif
663#endif
664],
665GLIBC_VERSION="2.9")
666
sewardj5d425e82009-02-01 19:01:11 +0000667AC_EGREP_CPP([GLIBC_210], [
668#include <features.h>
669#ifdef __GNU_LIBRARY__
670 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
671 GLIBC_210
672 #endif
673#endif
674],
675GLIBC_VERSION="2.10")
676
bart0fac7ff2009-11-15 19:11:19 +0000677AC_EGREP_CPP([GLIBC_211], [
678#include <features.h>
679#ifdef __GNU_LIBRARY__
680 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 11)
681 GLIBC_211
682 #endif
683#endif
684],
685GLIBC_VERSION="2.11")
686
bartb7c3f082010-05-13 06:32:36 +0000687AC_EGREP_CPP([GLIBC_212], [
688#include <features.h>
689#ifdef __GNU_LIBRARY__
690 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 12)
691 GLIBC_212
692 #endif
693#endif
694],
695GLIBC_VERSION="2.12")
696
sewardj03d86f22006-10-17 00:57:24 +0000697AC_EGREP_CPP([AIX5_LIBC], [
698#include <standards.h>
699#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
700 AIX5_LIBC
701#endif
702],
dirk07596a22008-04-25 11:33:30 +0000703GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000704
njnf76d27a2009-05-28 01:53:07 +0000705# not really a version check
706AC_EGREP_CPP([DARWIN_LIBC], [
707#include <sys/cdefs.h>
708#if defined(__DARWIN_VERS_1050)
709 DARWIN_LIBC
710#endif
711],
712GLIBC_VERSION="darwin")
713
dirk07596a22008-04-25 11:33:30 +0000714AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000715
dirk07596a22008-04-25 11:33:30 +0000716case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000717 2.2)
718 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000719 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000720 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
721 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000722 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000723 ;;
724
sewardj08c7f012002-10-07 23:56:55 +0000725 2.3)
726 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000727 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000728 DEFAULT_SUPP="glibc-2.3.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}"
sewardj08c7f012002-10-07 23:56:55 +0000731 ;;
732
njn781dba52005-06-30 04:06:38 +0000733 2.4)
734 AC_MSG_RESULT(2.4 family)
735 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000736 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000737 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000738 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000739 ;;
740
dirkaece45c2006-10-12 08:17:49 +0000741 2.5)
742 AC_MSG_RESULT(2.5 family)
743 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000744 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000745 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000746 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000747 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000748 2.6)
749 AC_MSG_RESULT(2.6 family)
750 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000751 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000752 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000753 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000754 ;;
755 2.7)
756 AC_MSG_RESULT(2.7 family)
757 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000758 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000759 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000760 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000761 ;;
dirk07596a22008-04-25 11:33:30 +0000762 2.8)
763 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000764 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000765 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
766 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
767 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
768 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000769 2.9)
770 AC_MSG_RESULT(2.9 family)
771 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
772 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
773 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
774 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
775 ;;
sewardj5d425e82009-02-01 19:01:11 +0000776 2.10)
777 AC_MSG_RESULT(2.10 family)
778 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
779 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
780 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
781 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
782 ;;
bart0fac7ff2009-11-15 19:11:19 +0000783 2.11)
784 AC_MSG_RESULT(2.11 family)
785 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
786 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
787 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
788 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000789 ;;
790 2.12)
791 AC_MSG_RESULT(2.12 family)
792 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
793 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
794 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
795 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000796 ;;
sewardj03d86f22006-10-17 00:57:24 +0000797 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000798 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
799 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 +0000800 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
801 ;;
njnf76d27a2009-05-28 01:53:07 +0000802 darwin)
803 AC_MSG_RESULT(Darwin)
804 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
805 # DEFAULT_SUPP set by kernel version check above.
806 ;;
dirkaece45c2006-10-12 08:17:49 +0000807
sewardjde4a1d02002-03-22 01:27:54 +0000808 *)
809 AC_MSG_RESULT(unsupported version)
bartb7c3f082010-05-13 06:32:36 +0000810 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.12])
dirk07596a22008-04-25 11:33:30 +0000811 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000812 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000813 ;;
814esac
815
dirk07596a22008-04-25 11:33:30 +0000816AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000817
sewardj414f3582008-07-18 20:46:00 +0000818
819# Add default suppressions for the X client libraries. Make no
820# attempt to detect whether such libraries are installed on the
821# build machine (or even if any X facilities are present); just
822# add the suppressions antidisirregardless.
823DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
824DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000825
sewardj5744c022008-10-19 18:58:13 +0000826# Add glibc and X11 suppressions for exp-ptrcheck
827DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
828
sewardj2e10a682003-04-07 19:36:41 +0000829
njn7fd6d382009-01-22 21:56:32 +0000830#----------------------------------------------------------------------------
831# Checking for various library functions and other definitions
832#----------------------------------------------------------------------------
833
bart59e2f182008-04-28 16:22:53 +0000834# Check for CLOCK_MONOTONIC
835
836AC_MSG_CHECKING([for CLOCK_MONOTONIC])
837
838AC_TRY_COMPILE(
839[
840#include <time.h>
841], [
842 struct timespec t;
843 clock_gettime(CLOCK_MONOTONIC, &t);
844 return 0;
845],
846[
847AC_MSG_RESULT([yes])
848AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
849 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
850], [
851AC_MSG_RESULT([no])
852])
853
bartfea06922008-05-03 09:12:15 +0000854
855# Check for PTHREAD_MUTEX_ADAPTIVE_NP
856
857AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
858
859AC_TRY_COMPILE(
860[
861#define _GNU_SOURCE
862#include <pthread.h>
863], [
864 return (PTHREAD_MUTEX_ADAPTIVE_NP);
865],
866[
867AC_MSG_RESULT([yes])
868AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
869 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
870], [
871AC_MSG_RESULT([no])
872])
873
874
875# Check for PTHREAD_MUTEX_ERRORCHECK_NP
876
877AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
878
879AC_TRY_COMPILE(
880[
881#define _GNU_SOURCE
882#include <pthread.h>
883], [
884 return (PTHREAD_MUTEX_ERRORCHECK_NP);
885],
886[
887AC_MSG_RESULT([yes])
888AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
889 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
890], [
891AC_MSG_RESULT([no])
892])
893
894
895# Check for PTHREAD_MUTEX_RECURSIVE_NP
896
897AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
898
899AC_TRY_COMPILE(
900[
901#define _GNU_SOURCE
902#include <pthread.h>
903], [
904 return (PTHREAD_MUTEX_RECURSIVE_NP);
905],
906[
907AC_MSG_RESULT([yes])
908AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
909 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
910], [
911AC_MSG_RESULT([no])
912])
913
914
915# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
916
917AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
918
919AC_TRY_COMPILE(
920[
921#define _GNU_SOURCE
922#include <pthread.h>
923], [
924 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
925 return 0;
926],
927[
928AC_MSG_RESULT([yes])
929AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
930 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
931], [
932AC_MSG_RESULT([no])
933])
934
935
bart5e389f12008-04-05 12:53:15 +0000936# Check whether pthread_mutex_t has a member called __m_kind.
937
bartb11355c2010-04-29 16:37:26 +0000938AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
939 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
940 1,
941 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
942 ],
943 [],
944 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000945
946
947# Check whether pthread_mutex_t has a member called __data.__kind.
948
bartb11355c2010-04-29 16:37:26 +0000949AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
950 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
951 1,
952 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
953 ],
954 [],
955 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000956
957
bart62c370e2008-05-12 18:50:51 +0000958# does this compiler support -maltivec and does it have the include file
959# <altivec.h> ?
960
961AC_MSG_CHECKING([for Altivec])
962
963safe_CFLAGS=$CFLAGS
964CFLAGS="-maltivec"
965
966AC_TRY_COMPILE(
967[
968#include <altivec.h>
969], [
970 vector unsigned int v;
971],
972[
973ac_have_altivec=yes
974AC_MSG_RESULT([yes])
975], [
976ac_have_altivec=no
977AC_MSG_RESULT([no])
978])
979CFLAGS=$safe_CFLAGS
980
981AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
982AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
983
984
bart36dd85a2009-04-26 07:11:48 +0000985# Check for pthread_create@GLIBC2.0
986AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
987
bart16e1c5a2009-04-26 07:38:53 +0000988safe_CFLAGS=$CFLAGS
989CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000990AC_TRY_LINK(
991[
992extern int pthread_create_glibc_2_0(void*, const void*,
993 void *(*)(void*), void*);
994__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
995], [
bart276ed3a2009-05-10 15:41:45 +0000996#ifdef __powerpc__
997/*
998 * Apparently on PowerPC linking this program succeeds and generates an
999 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1000 */
1001#error This test does not work properly on PowerPC.
1002#else
bart16e1c5a2009-04-26 07:38:53 +00001003 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001004#endif
bart16e1c5a2009-04-26 07:38:53 +00001005 return 0;
bart36dd85a2009-04-26 07:11:48 +00001006],
1007[
1008ac_have_pthread_create_glibc_2_0=yes
1009AC_MSG_RESULT([yes])
1010AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1011 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1012], [
1013ac_have_pthread_create_glibc_2_0=no
1014AC_MSG_RESULT([no])
1015])
bart16e1c5a2009-04-26 07:38:53 +00001016CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001017
1018AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001019 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001020
1021
barta50aa8a2008-04-27 06:06:57 +00001022# Check for eventfd_t, eventfd() and eventfd_read()
1023AC_MSG_CHECKING([for eventfd()])
1024
1025AC_TRY_LINK(
1026[
1027#include <sys/eventfd.h>
1028], [
1029 eventfd_t ev;
1030 int fd;
1031
1032 fd = eventfd(5, 0);
1033 eventfd_read(fd, &ev);
1034 return 0;
1035],
1036[
1037AC_MSG_RESULT([yes])
1038AC_DEFINE([HAVE_EVENTFD], 1,
1039 [Define to 1 if you have the `eventfd' function.])
1040AC_DEFINE([HAVE_EVENTFD_READ], 1,
1041 [Define to 1 if you have the `eventfd_read' function.])
1042], [
1043AC_MSG_RESULT([no])
1044])
1045
1046
njn7fd6d382009-01-22 21:56:32 +00001047#----------------------------------------------------------------------------
1048# Checking for supported compiler flags.
1049#----------------------------------------------------------------------------
1050
sewardj535c50f2005-06-04 23:14:53 +00001051# does this compiler support -m32 ?
1052AC_MSG_CHECKING([if gcc accepts -m32])
1053
1054safe_CFLAGS=$CFLAGS
1055CFLAGS="-m32"
1056
1057AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001058 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001059],
1060[
1061FLAG_M32="-m32"
1062AC_MSG_RESULT([yes])
1063], [
1064FLAG_M32=""
1065AC_MSG_RESULT([no])
1066])
1067CFLAGS=$safe_CFLAGS
1068
1069AC_SUBST(FLAG_M32)
1070
1071
sewardj03d86f22006-10-17 00:57:24 +00001072# does this compiler support -maix32 ?
1073AC_MSG_CHECKING([if gcc accepts -maix32])
1074
1075safe_CFLAGS=$CFLAGS
1076CFLAGS="-maix32"
1077
1078AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001079 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001080],
1081[
1082FLAG_MAIX32="-maix32"
1083AC_MSG_RESULT([yes])
1084], [
1085FLAG_MAIX32=""
1086AC_MSG_RESULT([no])
1087])
1088CFLAGS=$safe_CFLAGS
1089
1090AC_SUBST(FLAG_MAIX32)
1091
1092
sewardj01262142006-01-04 01:20:28 +00001093# does this compiler support -m64 ?
1094AC_MSG_CHECKING([if gcc accepts -m64])
1095
1096safe_CFLAGS=$CFLAGS
1097CFLAGS="-m64"
1098
1099AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001100 return 0;
sewardj01262142006-01-04 01:20:28 +00001101],
1102[
1103FLAG_M64="-m64"
1104AC_MSG_RESULT([yes])
1105], [
1106FLAG_M64=""
1107AC_MSG_RESULT([no])
1108])
1109CFLAGS=$safe_CFLAGS
1110
1111AC_SUBST(FLAG_M64)
1112
1113
sewardj03d86f22006-10-17 00:57:24 +00001114# does this compiler support -maix64 ?
1115AC_MSG_CHECKING([if gcc accepts -maix64])
1116
1117safe_CFLAGS=$CFLAGS
1118CFLAGS="-maix64"
1119
1120AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001121 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001122],
1123[
1124FLAG_MAIX64="-maix64"
1125AC_MSG_RESULT([yes])
1126], [
1127FLAG_MAIX64=""
1128AC_MSG_RESULT([no])
1129])
1130CFLAGS=$safe_CFLAGS
1131
1132AC_SUBST(FLAG_MAIX64)
1133
1134
sewardj67f1fcc2005-07-03 10:41:02 +00001135# does this compiler support -mmmx ?
1136AC_MSG_CHECKING([if gcc accepts -mmmx])
1137
1138safe_CFLAGS=$CFLAGS
1139CFLAGS="-mmmx"
1140
1141AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001142 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001143],
1144[
1145FLAG_MMMX="-mmmx"
1146AC_MSG_RESULT([yes])
1147], [
1148FLAG_MMMX=""
1149AC_MSG_RESULT([no])
1150])
1151CFLAGS=$safe_CFLAGS
1152
1153AC_SUBST(FLAG_MMMX)
1154
1155
1156# does this compiler support -msse ?
1157AC_MSG_CHECKING([if gcc accepts -msse])
1158
1159safe_CFLAGS=$CFLAGS
1160CFLAGS="-msse"
1161
1162AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001163 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001164],
1165[
1166FLAG_MSSE="-msse"
1167AC_MSG_RESULT([yes])
1168], [
1169FLAG_MSSE=""
1170AC_MSG_RESULT([no])
1171])
1172CFLAGS=$safe_CFLAGS
1173
1174AC_SUBST(FLAG_MSSE)
1175
1176
sewardj5b754b42002-06-03 22:53:35 +00001177# does this compiler support -mpreferred-stack-boundary=2 ?
1178AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1179
daywalker3664f562003-10-17 13:43:46 +00001180safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001181CFLAGS="-mpreferred-stack-boundary=2"
1182
1183AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001184 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001185],
1186[
1187PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001188AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001189], [
1190PREFERRED_STACK_BOUNDARY=""
1191AC_MSG_RESULT([no])
1192])
daywalker3664f562003-10-17 13:43:46 +00001193CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001194
1195AC_SUBST(PREFERRED_STACK_BOUNDARY)
1196
sewardj535c50f2005-06-04 23:14:53 +00001197
sewardjb5f6f512005-03-10 23:59:00 +00001198# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001199AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001200
1201safe_CFLAGS=$CFLAGS
1202CFLAGS="-Wno-pointer-sign"
1203
1204AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001205 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001206],
1207[
1208no_pointer_sign=yes
1209AC_MSG_RESULT([yes])
1210], [
1211no_pointer_sign=no
1212AC_MSG_RESULT([no])
1213])
1214CFLAGS=$safe_CFLAGS
1215
1216if test x$no_pointer_sign = xyes; then
1217 CFLAGS="$CFLAGS -Wno-pointer-sign"
1218fi
1219
sewardj535c50f2005-06-04 23:14:53 +00001220
barte026bd22009-07-04 12:17:07 +00001221# does this compiler support -Wno-empty-body ?
1222
1223AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1224
1225safe_CFLAGS=$CFLAGS
1226CFLAGS="-Wno-empty-body"
1227
1228AC_TRY_COMPILE(
1229[ ],
1230[
1231 return 0;
1232],
1233[
1234AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1235AC_MSG_RESULT([yes])
1236],
1237[
1238AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1239AC_MSG_RESULT([no])
1240])
1241CFLAGS=$safe_CFLAGS
1242
1243
bart9d865fa2008-06-23 12:11:49 +00001244# does this compiler support -Wno-format-zero-length ?
1245
1246AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1247
1248safe_CFLAGS=$CFLAGS
1249CFLAGS="-Wno-format-zero-length"
1250
1251AC_TRY_COMPILE(
1252[ ],
1253[
1254 return 0;
1255],
1256[
1257AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1258AC_MSG_RESULT([yes])
1259],
1260[
1261AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1262AC_MSG_RESULT([no])
1263])
1264CFLAGS=$safe_CFLAGS
1265
1266
bartbf9b85c2009-08-12 12:55:56 +00001267# does this compiler support -Wno-uninitialized ?
1268
1269AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1270
1271safe_CFLAGS=$CFLAGS
1272CFLAGS="-Wno-uninitialized"
1273
1274AC_TRY_COMPILE(
1275[ ],
1276[
1277 return 0;
1278],
1279[
1280AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1281AC_MSG_RESULT([yes])
1282],
1283[
1284AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1285AC_MSG_RESULT([no])
1286])
1287CFLAGS=$safe_CFLAGS
1288
1289
bart56730cd2008-05-11 06:41:46 +00001290# does this compiler support -Wextra or the older -W ?
1291
1292AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1293
1294safe_CFLAGS=$CFLAGS
1295CFLAGS="-Wextra"
1296
1297AC_TRY_COMPILE(
1298[ ],
1299[
1300 return 0;
1301],
1302[
1303AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1304AC_MSG_RESULT([-Wextra])
1305], [
1306 CFLAGS="-W"
1307 AC_TRY_COMPILE(
1308 [ ],
1309 [
1310 return 0;
1311 ],
1312 [
1313 AC_SUBST([FLAG_W_EXTRA], [-W])
1314 AC_MSG_RESULT([-W])
1315 ], [
1316 AC_SUBST([FLAG_W_EXTRA], [])
1317 AC_MSG_RESULT([not supported])
1318 ])
1319])
1320CFLAGS=$safe_CFLAGS
1321
1322
sewardja72c26d2007-05-01 13:44:08 +00001323# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001324AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001325
1326safe_CFLAGS=$CFLAGS
1327CFLAGS="-fno-stack-protector"
1328
1329AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001330 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001331],
1332[
1333no_stack_protector=yes
1334FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1335AC_MSG_RESULT([yes])
1336], [
1337no_stack_protector=no
1338FLAG_FNO_STACK_PROTECTOR=""
1339AC_MSG_RESULT([no])
1340])
1341CFLAGS=$safe_CFLAGS
1342
1343AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1344
1345if test x$no_stack_protector = xyes; then
1346 CFLAGS="$CFLAGS -fno-stack-protector"
1347fi
1348
1349
bart56730cd2008-05-11 06:41:46 +00001350# does this compiler support --param inline-unit-growth=... ?
1351
1352AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1353
1354safe_CFLAGS=$CFLAGS
1355CFLAGS="--param inline-unit-growth=900"
1356
1357AC_TRY_COMPILE(
1358[ ],
1359[
1360 return 0;
1361],
1362[
1363AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1364 ["--param inline-unit-growth=900"])
1365AC_MSG_RESULT([yes])
1366], [
1367AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1368AC_MSG_RESULT([no])
1369])
1370CFLAGS=$safe_CFLAGS
1371
1372
sewardj00f1e622006-03-12 16:47:10 +00001373# does the ppc assembler support "mtocrf" et al?
1374AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1375
1376AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001377__asm__ __volatile__("mtocrf 4,0");
1378__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001379],
1380[
1381ac_have_as_ppc_mftocrf=yes
1382AC_MSG_RESULT([yes])
1383], [
1384ac_have_as_ppc_mftocrf=no
1385AC_MSG_RESULT([no])
1386])
1387if test x$ac_have_as_ppc_mftocrf = xyes ; then
1388 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1389fi
1390
1391
sewardjf0aabf82007-03-22 00:24:21 +00001392# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001393# Note, this doesn't generate a C-level symbol. It generates a
1394# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001395AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1396
1397AC_TRY_COMPILE(, [
1398 do { long long int x;
1399 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1400 while (0)
1401],
1402[
1403ac_have_as_sse3=yes
1404AC_MSG_RESULT([yes])
1405], [
1406ac_have_as_sse3=no
1407AC_MSG_RESULT([no])
1408])
sewardjfa18a262007-03-22 12:13:13 +00001409
1410AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001411
1412
sewardj6d6da5b2008-02-09 12:07:40 +00001413# Ditto for SSSE3 instructions (note extra S)
1414# Note, this doesn't generate a C-level symbol. It generates a
1415# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1416AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1417
1418AC_TRY_COMPILE(, [
1419 do { long long int x;
1420 __asm__ __volatile__(
1421 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1422 while (0)
1423],
1424[
1425ac_have_as_ssse3=yes
1426AC_MSG_RESULT([yes])
1427], [
1428ac_have_as_ssse3=no
1429AC_MSG_RESULT([no])
1430])
1431
1432AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1433
1434
sewardjb5f6f512005-03-10 23:59:00 +00001435# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001436if test "x${cross_compiling}" = "xno"; then
1437# Native compilation: check whether running a program using TLS succeeds.
1438# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1439# succeeds but running programs using TLS fails.
1440AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1441 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1442 [vg_cv_tls=$enableval],
1443 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1444 [[return foo;]])],
1445 [vg_cv_tls=yes],
1446 [vg_cv_tls=no])])])
1447else
1448# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001449AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1450 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1451 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001452 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001453 [[return foo;]])],
1454 [vg_cv_tls=yes],
1455 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001456fi
sewardjb5f6f512005-03-10 23:59:00 +00001457
1458if test "$vg_cv_tls" = yes; then
1459AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1460fi
sewardj5b754b42002-06-03 22:53:35 +00001461
sewardj535c50f2005-06-04 23:14:53 +00001462
njn7fd6d382009-01-22 21:56:32 +00001463#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001464# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001465#----------------------------------------------------------------------------
1466
sewardjde4a1d02002-03-22 01:27:54 +00001467AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001468AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001469 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001470 endian.h \
1471 mqueue.h \
1472 sys/endian.h \
1473 sys/epoll.h \
1474 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001475 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001476 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001477 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001478 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001479 sys/syscall.h \
1480 sys/time.h \
1481 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001482 ])
sewardjde4a1d02002-03-22 01:27:54 +00001483
njn7fd6d382009-01-22 21:56:32 +00001484#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001485# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001486#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001487AC_TYPE_UID_T
1488AC_TYPE_OFF_T
1489AC_TYPE_SIZE_T
1490AC_HEADER_TIME
1491
sewardj535c50f2005-06-04 23:14:53 +00001492
njn7fd6d382009-01-22 21:56:32 +00001493#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001494# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001495#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001496AC_FUNC_MEMCMP
1497AC_FUNC_MMAP
1498AC_TYPE_SIGNAL
1499
bart71bad292008-04-27 11:43:23 +00001500AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001501
bartf5ceec82008-04-26 07:45:10 +00001502AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001503 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001504 epoll_create \
1505 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001506 floor \
bartce48fa92008-04-26 10:59:46 +00001507 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001508 mallinfo \
1509 memchr \
1510 memset \
1511 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001512 mremap \
bartf5ceec82008-04-26 07:45:10 +00001513 ppoll \
bart6d45e922009-01-20 13:45:38 +00001514 pthread_barrier_init \
1515 pthread_condattr_setclock \
1516 pthread_mutex_timedlock \
1517 pthread_rwlock_timedrdlock \
1518 pthread_rwlock_timedwrlock \
1519 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001520 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001521 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001522 semtimedop \
1523 signalfd \
njn6cc22472009-03-16 03:46:48 +00001524 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001525 strchr \
1526 strdup \
1527 strpbrk \
1528 strrchr \
1529 strstr \
barta72a27b2010-04-29 06:22:17 +00001530 syscall \
bartf5ceec82008-04-26 07:45:10 +00001531 timerfd \
1532 utimensat \
1533 ])
sewardjde4a1d02002-03-22 01:27:54 +00001534
bart623eec32008-07-29 17:54:49 +00001535# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1536# libraries with any shared object and/or executable. This is NOT what we
1537# want for e.g. vgpreload_core-x86-linux.so
1538LIBS=""
sewardj80637752006-03-02 13:48:21 +00001539
bart6d45e922009-01-20 13:45:38 +00001540AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1541 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001542AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1543 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001544AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1545 [test x$ac_cv_func_pthread_spin_lock = xyes])
1546
njn7fd6d382009-01-22 21:56:32 +00001547
1548#----------------------------------------------------------------------------
1549# MPI checks
1550#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001551# Do we have a useable MPI setup on the primary and/or secondary targets?
1552# On Linux, by default, assumes mpicc and -m32/-m64
1553# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001554# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001555# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1556# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001557MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001558if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1559 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001560 MPI_CC="mpxlc"
1561fi
1562
sewardje9fa5062006-03-12 18:29:18 +00001563mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001564if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1565 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001566 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001567elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1568 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001569 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001570elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001571 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001572elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001573 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001574fi
1575
sewardj03d86f22006-10-17 00:57:24 +00001576mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001577if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1578 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001579 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001580elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001581 mflag_secondary=-q32
1582fi
1583
1584
sewardj0ad46092006-03-02 17:09:16 +00001585AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001586 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001587 MPI_CC=$withval
1588)
sewardj03d86f22006-10-17 00:57:24 +00001589AC_SUBST(MPI_CC)
1590
1591## See if MPI_CC works for the primary target
1592##
1593AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001594saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001595saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001596CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001597CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001598AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001599#include <mpi.h>
1600#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001601],[
1602 int r = MPI_Init(NULL,NULL);
1603 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1604 return r;
1605], [
sewardj03d86f22006-10-17 00:57:24 +00001606ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001607AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001608], [
sewardj03d86f22006-10-17 00:57:24 +00001609ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001610AC_MSG_RESULT([no])
1611])
sewardj0ad46092006-03-02 17:09:16 +00001612CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001613CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001614AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001615
sewardj03d86f22006-10-17 00:57:24 +00001616## See if MPI_CC works for the secondary target. Complication: what if
1617## there is no secondary target? We need this to then fail.
1618## Kludge this by making MPI_CC something which will surely fail in
1619## such a case.
1620##
1621AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1622saved_CC=$CC
1623saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001624if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001625 CC="$MPI_CC this will surely fail"
1626else
1627 CC=$MPI_CC
1628fi
1629CFLAGS=$mflag_secondary
1630AC_TRY_LINK([
1631#include <mpi.h>
1632#include <stdio.h>
1633],[
1634 int r = MPI_Init(NULL,NULL);
1635 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1636 return r;
1637], [
1638ac_have_mpi2_sec=yes
1639AC_MSG_RESULT([yes, $MPI_CC])
1640], [
1641ac_have_mpi2_sec=no
1642AC_MSG_RESULT([no])
1643])
1644CC=$saved_CC
1645CFLAGS=$saved_CFLAGS
1646AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001647
1648
njn7fd6d382009-01-22 21:56:32 +00001649#----------------------------------------------------------------------------
1650# Other library checks
1651#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001652# There now follow some tests for QtCore, Boost, and OpenMP. These
1653# tests are present because Drd has some regression tests that use
1654# these packages. All regression test programs all compiled only
1655# for the primary target. And so it is important that the configure
1656# checks that follow, use the correct -m32 or -m64 flag for the
1657# primary target (called $mflag_primary). Otherwise, we can end up
1658# in a situation (eg) where, on amd64-linux, the test for Boost checks
1659# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1660# only build (meaning, the primary target is x86-linux), the build
1661# of the regtest programs that use Boost fails, because they are
1662# build as 32-bit (IN THIS EXAMPLE).
1663#
1664# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1665# NEEDED BY THE REGRESSION TEST PROGRAMS.
1666
1667
bart21d3cfc2008-08-02 09:08:17 +00001668# The test below verifies whether the QtCore package been installed.
1669# This test works as follows:
1670# - If pkg-config was not installed at the time autogen.sh was run,
1671# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1672# autogen.sh. Augogen.sh will generate a configure script that prints
1673# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1674# - If pkg-config was installed at the time autogen.sh was run,
1675# the generated configure script will try to detect the presence of the
1676# Qt4 QtCore library by looking up compile and linker flags in the file
1677# called QtCore.pc.
1678# - pkg-config settings can be overridden via the configure variables
1679# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1680# configure script -- see also ./configure --help).
1681# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1682# the pkg-config executable is not present on the system on which the
1683# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001684
bart21d3cfc2008-08-02 09:08:17 +00001685ifdef(
1686 [PKG_CHECK_EXISTS],
1687 [PKG_CHECK_EXISTS(
1688 [QtCore],
1689 [
1690 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001691 # Paranoia: don't trust the result reported by pkg-config, but when
1692 # pkg-config reports that QtCore has been found, verify whether linking
1693 # programs with QtCore succeeds.
1694 AC_LANG(C++)
1695 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001696 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001697 AC_TRY_LINK(
1698 [#include <QMutex>],
1699 [QMutex Mutex;],
1700 [ac_have_qtcore=yes],
1701 [
1702 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1703 ac_have_qtcore=no
1704 ]
1705 )
1706 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001707 ],
1708 [
1709 ac_have_qtcore=no
1710 ]
1711 )
1712 ],
1713 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1714 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1715 [ac_have_qtcore=no]
1716)
bart41ac62a2008-07-07 16:58:03 +00001717
1718AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1719
1720
bart62f54e42008-07-28 11:35:10 +00001721# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1722# See also http://doc.trolltech.com/4.3/qmutex.html.
1723if test x$ac_have_qtcore = xyes; then
1724 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1725 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001726 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001727 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001728 AC_TRY_COMPILE([
1729 #include <QtCore/QMutex>
1730 ],
1731 [
1732 QMutex M;
1733 M.tryLock(1);
1734 M.unlock();
1735 return 0;
1736 ],
1737 [
1738 AC_MSG_RESULT([yes])
1739 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1740 ],
1741 [
1742 AC_MSG_RESULT([no])
1743 ])
bart21d3cfc2008-08-02 09:08:17 +00001744 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001745 AC_LANG(C)
1746fi
1747
1748
bart4f43e002009-11-09 16:07:43 +00001749# Test for QAtomicInt, which has been introduced in Qt 4.4.
1750# See also http://doc.trolltech.com/4.4/qatomicint.html.
1751if test x$ac_have_qtcore = xyes; then
bart9da08ba2009-11-11 19:22:05 +00001752 AC_MSG_CHECKING([for Qt4 QAtomicInt])
bart4f43e002009-11-09 16:07:43 +00001753 AC_LANG(C++)
1754 safe_CXXFLAGS="${CXXFLAGS}"
1755 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1756 AC_TRY_COMPILE([
1757 #include <QtCore/QAtomicInt>
1758 ],
1759 [
1760 QAtomicInt I;
1761 I.testAndSetOrdered(0, 1);
1762 return 0;
1763 ],
1764 [
1765 ac_have_qtcore_qatomicint=yes
1766 AC_MSG_RESULT([yes])
1767 AC_DEFINE([HAVE_QTCORE_QATOMICINT], [1], [Define to 1 if the installed version of Qt4 provides QAtomicInt.])
1768 ],
1769 [
1770 ac_have_qtcore_qatomicint=no
1771 AC_MSG_RESULT([no])
1772 ])
1773 CXXFLAGS="${safe_CXXFLAGS}"
1774 AC_LANG(C)
1775fi
1776
1777AM_CONDITIONAL([HAVE_QTCORE_QATOMICINT], [test x$ac_have_qtcore_qatomicint = xyes])
1778
1779
1780
sewardj493c4ef2008-12-13 16:45:19 +00001781# Check whether the boost library 1.35 or later has been installed.
1782# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1783
1784AC_MSG_CHECKING([for boost])
1785
1786AC_LANG(C++)
1787safe_CXXFLAGS=$CXXFLAGS
1788CXXFLAGS="-lboost_thread-mt $mflag_primary"
1789
1790AC_LINK_IFELSE(
1791[
1792#include <boost/thread.hpp>
1793static void thread_func(void)
1794{ }
1795int main(int argc, char** argv)
1796{
1797 boost::thread t(thread_func);
1798 return 0;
1799}
1800],
1801[
1802ac_have_boost_1_35=yes
1803AC_SUBST([BOOST_CFLAGS], [])
1804AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1805AC_MSG_RESULT([yes])
1806], [
1807ac_have_boost_1_35=no
1808AC_MSG_RESULT([no])
1809])
1810
1811CXXFLAGS=$safe_CXXFLAGS
1812AC_LANG(C)
1813
1814AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1815
1816
1817# does this compiler support -fopenmp, does it have the include file
1818# <omp.h> and does it have libgomp ?
1819
1820AC_MSG_CHECKING([for OpenMP])
1821
1822safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001823CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001824
1825AC_LINK_IFELSE(
1826[
1827#include <omp.h>
1828int main(int argc, char** argv)
1829{
1830 omp_set_dynamic(0);
1831 return 0;
1832}
1833],
1834[
1835ac_have_openmp=yes
1836AC_MSG_RESULT([yes])
1837], [
1838ac_have_openmp=no
1839AC_MSG_RESULT([no])
1840])
1841CFLAGS=$safe_CFLAGS
1842
1843AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1844
1845
sewardjc876a2f2009-01-22 22:44:30 +00001846# does this compiler have built-in functions for atomic memory access ?
1847AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1848
1849safe_CFLAGS=$CFLAGS
1850CFLAGS="$mflag_primary"
1851
1852AC_TRY_LINK(,
1853[
1854 int variable = 1;
1855 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1856 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1857],
1858[
bartc82d1372009-05-31 16:21:23 +00001859 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001860 AC_MSG_RESULT([yes])
1861 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1862],
1863[
bartc82d1372009-05-31 16:21:23 +00001864 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001865 AC_MSG_RESULT([no])
1866])
1867
1868CFLAGS=$safe_CFLAGS
1869
bartc82d1372009-05-31 16:21:23 +00001870AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1871
sewardjc876a2f2009-01-22 22:44:30 +00001872
njn7fd6d382009-01-22 21:56:32 +00001873#----------------------------------------------------------------------------
1874# Ok. We're done checking.
1875#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001876
njn8b68b642009-06-24 00:37:09 +00001877# Nb: VEX/Makefile is generated from Makefile.vex.in.
1878AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001879 Makefile
njn8b68b642009-06-24 00:37:09 +00001880 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001881 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001882 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001883 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001884 docs/Makefile
1885 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001886 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001887 perf/Makefile
1888 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001889 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001890 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001891 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001892 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001893 memcheck/Makefile
1894 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001895 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001896 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001897 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001898 memcheck/tests/darwin/Makefile
njna454ec02009-01-19 03:16:59 +00001899 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001900 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001901 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001902 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001903 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00001904 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001905 callgrind/Makefile
1906 callgrind/callgrind_annotate
1907 callgrind/callgrind_control
1908 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001909 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001910 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001911 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001912 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001913 massif/perf/Makefile
njnd5a8d242007-11-02 20:44:57 +00001914 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001915 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001916 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001917 none/Makefile
1918 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001919 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001920 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001921 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001922 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00001923 none/tests/arm/Makefile
njn0458a122009-02-13 06:23:46 +00001924 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001925 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001926 none/tests/x86-linux/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001927 exp-ptrcheck/Makefile
1928 exp-ptrcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00001929 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00001930 drd/scripts/download-and-build-splash2
1931 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001932 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00001933 exp-bbv/tests/Makefile
1934 exp-bbv/tests/x86/Makefile
1935 exp-bbv/tests/x86-linux/Makefile
1936 exp-bbv/tests/amd64-linux/Makefile
1937 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00001938 exp-bbv/tests/arm-linux/Makefile
njn8b68b642009-06-24 00:37:09 +00001939])
1940AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001941
1942cat<<EOF
1943
njn311303f2009-02-06 03:46:50 +00001944 Maximum build arch: ${ARCH_MAX}
1945 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001946 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001947 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001948 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1949 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001950 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001951
gobry3b777892002-04-04 09:18:39 +00001952EOF