blob: c3fd234d5e1cac6712747b7a8399ac281a3c03c9 [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.
sewardj17c4eb12007-12-11 00:50:54 +000011AC_INIT(Valgrind, 3.4.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
njn8738c282004-11-23 16:31:56 +000018# Where is VEX ?
njnfe408942004-11-23 17:52:24 +000019# Nb: For the 2nd arg, the help string, AS_HELP_STRING is the proper way, but
20# older autoconfs don't support it... here's what it would say:
21#
sewardj85a9dca2005-07-26 10:42:57 +000022# AS_HELP_STRING([--with-vex], [Vex directory]),
njnfe408942004-11-23 17:52:24 +000023#
njn8738c282004-11-23 16:31:56 +000024AC_ARG_WITH(vex,
sewardj85a9dca2005-07-26 10:42:57 +000025 [ --with-vex=/path/to/vex/dir Vex directory],
njn8738c282004-11-23 16:31:56 +000026[
27 AC_CHECK_FILE($withval/pub/libvex.h,
28 [VEX_DIR=$withval],
29 [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain Vex])])
30],
31[
njn17adf1e2005-09-16 03:59:37 +000032 VEX_DIR='$(top_srcdir)/VEX'
njn8738c282004-11-23 16:31:56 +000033])
sewardj50629ec2004-11-22 13:44:11 +000034AC_SUBST(VEX_DIR)
35
njn657d9512005-06-24 15:20:52 +000036# "make distcheck" first builds a tarball, then extracts it.
37# Then it creates a build directory different from the extracted sources
38# (called _build), and issues
39#
40# ../configure $(DISTCHECK_CONFIGURE_FLAGS)
41#
42# and then builds, runs "make check", installs using DESTDIR, runs make
43# installcheck, uninstalls, checks whether the installed base is empty
44# again, then does yet another "make dist" and compares the resulting
45# tarball with the one it started off with for identical content. Then it
46# tests "make distclean" for no leftover files.
47#
48# So this line means: when doing "make dist", use the same --with-vex value
49# that you used when running configure to configure this tree in the first
50# place.
51AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], [--with-vex=$VEX_DIR])
52
sewardjde4a1d02002-03-22 01:27:54 +000053# Checks for programs.
sewardjb5f6f512005-03-10 23:59:00 +000054CFLAGS="-Wno-long-long"
gobrye721a522002-03-22 13:38:30 +000055
sewardjde4a1d02002-03-22 01:27:54 +000056AC_PROG_LN_S
57AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000058AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000059AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000060AC_PROG_CXX
sewardjde4a1d02002-03-22 01:27:54 +000061AC_PROG_RANLIB
62
gobrye721a522002-03-22 13:38:30 +000063# Check for the compiler support
64if test "${GCC}" != "yes" ; then
65 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
66fi
67
sewardj2f685952002-12-22 19:32:23 +000068# figure out where perl lives
69AC_PATH_PROG(PERL, perl)
70
njn9315df32003-04-16 20:50:50 +000071# figure out where gdb lives
72AC_PATH_PROG(GDB, gdb)
njnfe408942004-11-23 17:52:24 +000073AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000074
daywalker48ccca52002-04-15 00:31:58 +000075# some older automake's don't have it so try something on our own
76ifdef([AM_PROG_AS],[AM_PROG_AS],
77[
gobry1be19852002-03-26 20:44:55 +000078AS="${CC}"
79AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000080
gobry1be19852002-03-26 20:44:55 +000081ASFLAGS=""
82AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000083])
gobry3b777892002-04-04 09:18:39 +000084
gobry3b777892002-04-04 09:18:39 +000085
sewardj535c50f2005-06-04 23:14:53 +000086# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +000087AC_MSG_CHECKING([for a supported version of gcc])
88
bart76719bf2008-04-19 07:47:56 +000089[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +000090
91case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +000092 2.*)
gobrye721a522002-03-22 13:38:30 +000093 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +000094 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
95 ;;
gobrye721a522002-03-22 13:38:30 +000096 *)
97 AC_MSG_RESULT([ok (${gcc_version})])
98 ;;
99esac
100
gobrye721a522002-03-22 13:38:30 +0000101
sewardj03d86f22006-10-17 00:57:24 +0000102# Checks for the platform, with the aim of setting VG_ARCH. Note
103# that VG_ARCH must be set to reflect the most that this CPU can
104# do: for example if it is a 64-bit capable PowerPC, then it must
105# be set to ppc64 and not ppc32. Ditto for amd64.
106
sewardjde4a1d02002-03-22 01:27:54 +0000107AC_CANONICAL_HOST
108
109AC_MSG_CHECKING([for a supported CPU])
nethercote888ecb72004-08-23 14:54:40 +0000110AC_SUBST(VG_ARCH)
sewardjbc692db2006-01-04 03:31:07 +0000111
sewardj9b0567a2006-01-17 02:56:18 +0000112AC_SUBST(VG_ARCH_ALL)
113VG_ARCH_ALL="amd64 ppc32 ppc64 x86"
114
sewardj45f4e7c2005-09-27 19:20:21 +0000115AC_SUBST(VALT_LOAD_ADDRESS)
sewardjde4a1d02002-03-22 01:27:54 +0000116
gobrye721a522002-03-22 13:38:30 +0000117case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000118 i?86)
119 AC_MSG_RESULT([ok (${host_cpu})])
nethercote888ecb72004-08-23 14:54:40 +0000120 VG_ARCH="x86"
sewardjd7baad42006-05-20 01:13:38 +0000121 valt_load_address_normal="0x38000000"
122 valt_load_address_inner="0x28000000"
sewardjde4a1d02002-03-22 01:27:54 +0000123 ;;
124
njnfe408942004-11-23 17:52:24 +0000125 x86_64)
126 AC_MSG_RESULT([ok (${host_cpu})])
127 VG_ARCH="amd64"
sewardjd7baad42006-05-20 01:13:38 +0000128 valt_load_address_normal="0x38000000"
129 valt_load_address_inner="0x28000000"
njnfe408942004-11-23 17:52:24 +0000130 ;;
131
sewardj2c48c7b2005-11-29 13:05:56 +0000132 powerpc64)
sewardj03d86f22006-10-17 00:57:24 +0000133# This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000134 AC_MSG_RESULT([ok (${host_cpu})])
135 VG_ARCH="ppc64"
sewardjd7baad42006-05-20 01:13:38 +0000136 valt_load_address_normal="0x38000000"
137 valt_load_address_inner="0x28000000"
sewardj2c48c7b2005-11-29 13:05:56 +0000138 ;;
139
140 powerpc)
sewardj03d86f22006-10-17 00:57:24 +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.*)
146 VG_ARCH="ppc64"
147 ;;
148 *)
149 VG_ARCH="ppc32"
150 ;;
151 esac
sewardjd7baad42006-05-20 01:13:38 +0000152 valt_load_address_normal="0x38000000"
153 valt_load_address_inner="0x28000000"
nethercote9bcc9062004-10-13 13:50:01 +0000154 ;;
155
sewardjde4a1d02002-03-22 01:27:54 +0000156 *)
157 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000158 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000159 ;;
160esac
161
sewardj45f4e7c2005-09-27 19:20:21 +0000162# Check if this should be built as an inner Valgrind, to be run within
163# another Valgrind. Choose the load address accordingly.
sewardj86e992f2006-01-28 18:39:09 +0000164AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
165 [AC_ARG_ENABLE(inner,
166 [ --enable-inner enables self-hosting],
167 [vg_cv_inner=$enableval],
168 [vg_cv_inner=no])])
sewardj45f4e7c2005-09-27 19:20:21 +0000169if test "$vg_cv_inner" = yes; then
170 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
171 VALT_LOAD_ADDRESS=$valt_load_address_inner
172else
173 VALT_LOAD_ADDRESS=$valt_load_address_normal
174fi
175
sewardj86e992f2006-01-28 18:39:09 +0000176# Sometimes it's convenient to subvert the bi-arch build system and
177# just have a single build even though the underlying platform is
178# capable of both. Hence handle --enable-only64bit and
179# --enable-only32bit. Complain if both are issued :-)
180
181# Check if a 64-bit only build has been requested
182AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
183 [AC_ARG_ENABLE(only64bit,
184 [ --enable-only64bit do a 64-bit only build],
185 [vg_cv_only64bit=$enableval],
186 [vg_cv_only64bit=no])])
187
188# Check if a 32-bit only build has been requested
189AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
190 [AC_ARG_ENABLE(only32bit,
191 [ --enable-only32bit do a 32-bit only build],
192 [vg_cv_only32bit=$enableval],
193 [vg_cv_only32bit=no])])
194
195# Stay sane
196if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
197 AC_MSG_ERROR(
198 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
199fi
200
201
202
sewardjde4a1d02002-03-22 01:27:54 +0000203AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000204AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000205
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})])
nethercote888ecb72004-08-23 14:54:40 +0000209 VG_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})])
237 VG_OS="aix5"
238 ;;
239 aix5.2.*)
240 AC_MSG_RESULT([ok (${host_os})])
241 VG_OS="aix5"
242 ;;
243 aix5.3.*)
244 AC_MSG_RESULT([ok (${host_os})])
245 VG_OS="aix5"
246 ;;
247
mueller8c68e042004-01-03 15:21:14 +0000248 *freebsd*)
249 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000250 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000251 ;;
252
253 *)
254 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000255 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000256 ;;
257esac
258
tomd6398392006-06-07 17:44:36 +0000259# If we are building on a 64 bit platform test to see if the system
260# supports building 32 bit programs and disable 32 bit support if it
261# does not support building 32 bit programs
262
263case "$VG_ARCH-$VG_OS" in
264 amd64-linux|ppc64-linux)
265 AC_MSG_CHECKING([for 32 bit build support])
266 safe_CFLAGS=$CFLAGS
267 CFLAGS="-m32"
268 AC_TRY_LINK(, [
269 int main () { return 0 ; }
270 ],
271 [
272 AC_MSG_RESULT([yes])
273 ], [
274 vg_cv_only64bit="yes"
275 AC_MSG_RESULT([no])
276 ])
277 CFLAGS=$safe_CFLAGS;;
278esac
279
280if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
281 AC_MSG_ERROR(
282 [--enable-only32bit was specified but system does not support 32 bit builds])
283fi
nethercote888ecb72004-08-23 14:54:40 +0000284
sewardj01262142006-01-04 01:20:28 +0000285# Establish VG_PLATFORM_PRI. This is the primary build target. The
286# entire system, including regression and performance tests, will be
sewardjbc692db2006-01-04 03:31:07 +0000287# built for this target.
sewardj01262142006-01-04 01:20:28 +0000288#
sewardjbc692db2006-01-04 03:31:07 +0000289# Also establish VG_PLATFORM_SEC, the secondary build target, if
sewardj01262142006-01-04 01:20:28 +0000290# possible. The system will also be built for this target, but not
sewardjbc692db2006-01-04 03:31:07 +0000291# the regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000292#
293AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000294
sewardj01262142006-01-04 01:20:28 +0000295AC_SUBST(VG_PLATFORM_PRI)
296AC_SUBST(VG_PLATFORM_SEC)
297
298case "$VG_ARCH-$VG_OS" in
299 x86-linux)
300 VG_PLATFORM_PRI="X86_LINUX"
301 VG_PLATFORM_SEC=""
sewardj3e38ce02004-11-23 01:17:29 +0000302 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000303 ;;
304 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000305 if test x$vg_cv_only64bit = xyes; then
306 VG_PLATFORM_PRI="AMD64_LINUX"
307 VG_PLATFORM_SEC=""
308 elif test x$vg_cv_only32bit = xyes; then
309 VG_PLATFORM_PRI="X86_LINUX"
310 VG_PLATFORM_SEC=""
311 else
312 VG_PLATFORM_PRI="AMD64_LINUX"
313 VG_PLATFORM_SEC="X86_LINUX"
314 fi
sewardj01262142006-01-04 01:20:28 +0000315 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
316 ;;
317 ppc32-linux)
318 VG_PLATFORM_PRI="PPC32_LINUX"
319 VG_PLATFORM_SEC=""
320 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
321 ;;
sewardj03d86f22006-10-17 00:57:24 +0000322 ppc64-aix5)
323 if test x$vg_cv_only64bit = xyes; then
324 VG_PLATFORM_PRI="PPC64_AIX5"
325 VG_PLATFORM_SEC=""
326 elif test x$vg_cv_only32bit = xyes; then
327 VG_PLATFORM_PRI="PPC32_AIX5"
328 VG_PLATFORM_SEC=""
329 else
330 VG_PLATFORM_PRI="PPC64_AIX5"
331 VG_PLATFORM_SEC="PPC32_AIX5"
332 fi
333 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
334 ;;
sewardj01262142006-01-04 01:20:28 +0000335 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000336 if test x$vg_cv_only64bit = xyes; then
337 VG_PLATFORM_PRI="PPC64_LINUX"
338 VG_PLATFORM_SEC=""
339 elif test x$vg_cv_only32bit = xyes; then
340 VG_PLATFORM_PRI="PPC32_LINUX"
341 VG_PLATFORM_SEC=""
342 else
343 VG_PLATFORM_PRI="PPC64_LINUX"
344 VG_PLATFORM_SEC="PPC32_LINUX"
345 fi
sewardj01262142006-01-04 01:20:28 +0000346 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
347 ;;
nethercote888ecb72004-08-23 14:54:40 +0000348 *)
sewardj01262142006-01-04 01:20:28 +0000349 VG_PLATFORM_PRI="unknown"
350 VG_PLATFORM_SEC="unknown"
nethercote888ecb72004-08-23 14:54:40 +0000351 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000352 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000353 ;;
354esac
sewardjde4a1d02002-03-22 01:27:54 +0000355
sewardj03d86f22006-10-17 00:57:24 +0000356# Set up VGP_<platform>. Either one or two of these become defined.
sewardj01262142006-01-04 01:20:28 +0000357#
sewardj03d86f22006-10-17 00:57:24 +0000358AM_CONDITIONAL(VGP_X86_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000359 test x$VG_PLATFORM_PRI = xX86_LINUX \
360 -o x$VG_PLATFORM_SEC = xX86_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000361AM_CONDITIONAL(VGP_AMD64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000362 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000363AM_CONDITIONAL(VGP_PPC32_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000364 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
365 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000366AM_CONDITIONAL(VGP_PPC64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000367 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000368AM_CONDITIONAL(VGP_PPC32_AIX5,
369 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
370 -o x$VG_PLATFORM_SEC = xPPC32_AIX5)
371AM_CONDITIONAL(VGP_PPC64_AIX5,
372 test x$VG_PLATFORM_PRI = xPPC64_AIX5)
373
374# Similarly, set up VGO_<os>. Exactly one of these becomes defined.
375# Relies on the assumption that the primary and secondary targets are
376# for the same OS, so therefore only necessary to test the primary.
377#
378AM_CONDITIONAL(VGO_LINUX,
379 test x$VG_PLATFORM_PRI = xX86_LINUX \
380 -o x$VG_PLATFORM_PRI = xAMD64_LINUX \
381 -o x$VG_PLATFORM_PRI = xPPC32_LINUX \
382 -o x$VG_PLATFORM_PRI = xPPC64_LINUX)
383AM_CONDITIONAL(VGO_AIX5,
384 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
385 -o x$VG_PLATFORM_PRI = xPPC64_AIX5)
386
387
388# Sometimes, in the Makefile.am-s, it's useful to know
389# whether or not there is a secondary target.
390#
391AM_CONDITIONAL(VGP_HAVE_SECONDARY,
392 test x$VG_PLATFORM_SEC != x)
tomfb7bcde2005-11-07 15:24:38 +0000393
tomb637bad2005-11-08 12:28:35 +0000394
sewardj01262142006-01-04 01:20:28 +0000395# This variable will collect the individual suppression files
396# depending on the results of autoconf
397DEFAULT_SUPP=""
sewardjde4a1d02002-03-22 01:27:54 +0000398AC_SUBST(DEFAULT_SUPP)
399
sewardj01262142006-01-04 01:20:28 +0000400
dirk07596a22008-04-25 11:33:30 +0000401GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000402
sewardjde4a1d02002-03-22 01:27:54 +0000403AC_EGREP_CPP([GLIBC_22], [
404#include <features.h>
405#ifdef __GNU_LIBRARY__
406 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
407 GLIBC_22
408 #endif
409#endif
410],
dirk07596a22008-04-25 11:33:30 +0000411GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000412
sewardj08c7f012002-10-07 23:56:55 +0000413AC_EGREP_CPP([GLIBC_23], [
414#include <features.h>
415#ifdef __GNU_LIBRARY__
416 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
417 GLIBC_23
418 #endif
419#endif
420],
dirk07596a22008-04-25 11:33:30 +0000421GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000422
njn781dba52005-06-30 04:06:38 +0000423AC_EGREP_CPP([GLIBC_24], [
424#include <features.h>
425#ifdef __GNU_LIBRARY__
426 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
427 GLIBC_24
428 #endif
429#endif
430],
dirk07596a22008-04-25 11:33:30 +0000431GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000432
dirkaece45c2006-10-12 08:17:49 +0000433AC_EGREP_CPP([GLIBC_25], [
434#include <features.h>
435#ifdef __GNU_LIBRARY__
436 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
437 GLIBC_25
438 #endif
439#endif
440],
dirk07596a22008-04-25 11:33:30 +0000441GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000442
dirkc8bd0c52007-05-23 17:39:08 +0000443AC_EGREP_CPP([GLIBC_26], [
444#include <features.h>
445#ifdef __GNU_LIBRARY__
446 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
447 GLIBC_26
448 #endif
449#endif
450],
dirk07596a22008-04-25 11:33:30 +0000451GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000452
sewardj68c80c12007-11-18 14:40:02 +0000453AC_EGREP_CPP([GLIBC_27], [
454#include <features.h>
455#ifdef __GNU_LIBRARY__
456 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
457 GLIBC_27
458 #endif
459#endif
460],
dirk07596a22008-04-25 11:33:30 +0000461GLIBC_VERSION="2.7")
462
463AC_EGREP_CPP([GLIBC_28], [
464#include <features.h>
465#ifdef __GNU_LIBRARY__
466 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
467 GLIBC_28
468 #endif
469#endif
470],
471GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000472
sewardj03d86f22006-10-17 00:57:24 +0000473AC_EGREP_CPP([AIX5_LIBC], [
474#include <standards.h>
475#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
476 AIX5_LIBC
477#endif
478],
dirk07596a22008-04-25 11:33:30 +0000479GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000480
dirk07596a22008-04-25 11:33:30 +0000481AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000482
dirk07596a22008-04-25 11:33:30 +0000483case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000484 2.2)
485 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000486 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000487 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
488 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000489 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000490 ;;
491
sewardj08c7f012002-10-07 23:56:55 +0000492 2.3)
493 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000494 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000495 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000496 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000497 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000498 ;;
499
njn781dba52005-06-30 04:06:38 +0000500 2.4)
501 AC_MSG_RESULT(2.4 family)
502 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000503 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000504 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000505 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000506 ;;
507
dirkaece45c2006-10-12 08:17:49 +0000508 2.5)
509 AC_MSG_RESULT(2.5 family)
510 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000511 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000512 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000513 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000514 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000515 2.6)
516 AC_MSG_RESULT(2.6 family)
517 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000518 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000519 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000520 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000521 ;;
522 2.7)
523 AC_MSG_RESULT(2.7 family)
524 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000525 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000526 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000527 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000528 ;;
dirk07596a22008-04-25 11:33:30 +0000529 2.8)
530 AC_MSG_RESULT(2.8 family)
531 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
532 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
533 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
534 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
535 ;;
536
sewardj03d86f22006-10-17 00:57:24 +0000537 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000538 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
539 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 +0000540 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
541 ;;
dirkaece45c2006-10-12 08:17:49 +0000542
sewardjde4a1d02002-03-22 01:27:54 +0000543 *)
544 AC_MSG_RESULT(unsupported version)
dirk07596a22008-04-25 11:33:30 +0000545 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.8])
546 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
sewardjde4a1d02002-03-22 01:27:54 +0000547 ;;
548esac
549
dirk07596a22008-04-25 11:33:30 +0000550AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000551
nethercote3d260f62004-10-31 19:39:18 +0000552# We don't know how to detect the X client library version
sewardj03d86f22006-10-17 00:57:24 +0000553# (detecting the server version is easy, but no help). So we
nethercote3d260f62004-10-31 19:39:18 +0000554# just use a hack: always include the suppressions for both
555# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000556AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000557if test "${no_x}" != 'yes' ; then
sewardj01262142006-01-04 01:20:28 +0000558 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
559 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000560fi
561
sewardj2e10a682003-04-07 19:36:41 +0000562
bart5e389f12008-04-05 12:53:15 +0000563# Check whether pthread_mutex_t has a member called __m_kind.
564
565AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
566
567AC_COMPILE_IFELSE(
568[
569#include <pthread.h>
570int main(int argc, char** argv)
571{
572 pthread_mutex_t m;
573 return m.__m_kind;
574}
575],
576[
577AC_MSG_RESULT([yes])
578AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
579 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
580], [
581AC_MSG_RESULT([no])
582])
583
584
585# Check whether pthread_mutex_t has a member called __data.__kind.
586
587AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
588
589AC_COMPILE_IFELSE(
590[
591#include <pthread.h>
592int main(int argc, char** argv)
593{
594 pthread_mutex_t m;
595 return m.__data.__kind;
596}
597],
598[
599AC_MSG_RESULT([yes])
600AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
601 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
602], [
603AC_MSG_RESULT([no])
604])
605
606
bart61111332008-03-10 17:57:41 +0000607# does this compiler support -fopenmp, does it have the include file
608# <omp.h> and does it have libgomp ?
bart29cc9db2008-03-09 15:59:30 +0000609
bart1f52b822008-03-12 17:11:48 +0000610AC_MSG_CHECKING([for OpenMP])
611
bart29cc9db2008-03-09 15:59:30 +0000612safe_CFLAGS=$CFLAGS
613CFLAGS="-fopenmp"
614
bart1f52b822008-03-12 17:11:48 +0000615AC_LINK_IFELSE(
bart29cc9db2008-03-09 15:59:30 +0000616[
bart1f52b822008-03-12 17:11:48 +0000617#include <omp.h>
618int main(int argc, char** argv)
619{
620 omp_set_dynamic(0);
621 return 0;
622}
623],
624[
625ac_have_openmp=yes
bart29cc9db2008-03-09 15:59:30 +0000626AC_MSG_RESULT([yes])
627], [
bart1f52b822008-03-12 17:11:48 +0000628ac_have_openmp=no
bart29cc9db2008-03-09 15:59:30 +0000629AC_MSG_RESULT([no])
630])
631CFLAGS=$safe_CFLAGS
632
bart1f52b822008-03-12 17:11:48 +0000633AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
bart29cc9db2008-03-09 15:59:30 +0000634
635
sewardj535c50f2005-06-04 23:14:53 +0000636# does this compiler support -m32 ?
637AC_MSG_CHECKING([if gcc accepts -m32])
638
639safe_CFLAGS=$CFLAGS
640CFLAGS="-m32"
641
642AC_TRY_COMPILE(, [
643int main () { return 0 ; }
644],
645[
646FLAG_M32="-m32"
647AC_MSG_RESULT([yes])
648], [
649FLAG_M32=""
650AC_MSG_RESULT([no])
651])
652CFLAGS=$safe_CFLAGS
653
654AC_SUBST(FLAG_M32)
655
656
sewardj03d86f22006-10-17 00:57:24 +0000657# does this compiler support -maix32 ?
658AC_MSG_CHECKING([if gcc accepts -maix32])
659
660safe_CFLAGS=$CFLAGS
661CFLAGS="-maix32"
662
663AC_TRY_COMPILE(, [
664int main () { return 0 ; }
665],
666[
667FLAG_MAIX32="-maix32"
668AC_MSG_RESULT([yes])
669], [
670FLAG_MAIX32=""
671AC_MSG_RESULT([no])
672])
673CFLAGS=$safe_CFLAGS
674
675AC_SUBST(FLAG_MAIX32)
676
677
sewardj01262142006-01-04 01:20:28 +0000678# does this compiler support -m64 ?
679AC_MSG_CHECKING([if gcc accepts -m64])
680
681safe_CFLAGS=$CFLAGS
682CFLAGS="-m64"
683
684AC_TRY_COMPILE(, [
685int main () { return 0 ; }
686],
687[
688FLAG_M64="-m64"
689AC_MSG_RESULT([yes])
690], [
691FLAG_M64=""
692AC_MSG_RESULT([no])
693])
694CFLAGS=$safe_CFLAGS
695
696AC_SUBST(FLAG_M64)
697
698
sewardj03d86f22006-10-17 00:57:24 +0000699# does this compiler support -maix64 ?
700AC_MSG_CHECKING([if gcc accepts -maix64])
701
702safe_CFLAGS=$CFLAGS
703CFLAGS="-maix64"
704
705AC_TRY_COMPILE(, [
706int main () { return 0 ; }
707],
708[
709FLAG_MAIX64="-maix64"
710AC_MSG_RESULT([yes])
711], [
712FLAG_MAIX64=""
713AC_MSG_RESULT([no])
714])
715CFLAGS=$safe_CFLAGS
716
717AC_SUBST(FLAG_MAIX64)
718
719
sewardj67f1fcc2005-07-03 10:41:02 +0000720# does this compiler support -mmmx ?
721AC_MSG_CHECKING([if gcc accepts -mmmx])
722
723safe_CFLAGS=$CFLAGS
724CFLAGS="-mmmx"
725
726AC_TRY_COMPILE(, [
727int main () { return 0 ; }
728],
729[
730FLAG_MMMX="-mmmx"
731AC_MSG_RESULT([yes])
732], [
733FLAG_MMMX=""
734AC_MSG_RESULT([no])
735])
736CFLAGS=$safe_CFLAGS
737
738AC_SUBST(FLAG_MMMX)
739
740
741# does this compiler support -msse ?
742AC_MSG_CHECKING([if gcc accepts -msse])
743
744safe_CFLAGS=$CFLAGS
745CFLAGS="-msse"
746
747AC_TRY_COMPILE(, [
748int main () { return 0 ; }
749],
750[
751FLAG_MSSE="-msse"
752AC_MSG_RESULT([yes])
753], [
754FLAG_MSSE=""
755AC_MSG_RESULT([no])
756])
757CFLAGS=$safe_CFLAGS
758
759AC_SUBST(FLAG_MSSE)
760
761
sewardj5b754b42002-06-03 22:53:35 +0000762# does this compiler support -mpreferred-stack-boundary=2 ?
763AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
764
daywalker3664f562003-10-17 13:43:46 +0000765safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000766CFLAGS="-mpreferred-stack-boundary=2"
767
768AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000769int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000770],
771[
772PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000773AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000774], [
775PREFERRED_STACK_BOUNDARY=""
776AC_MSG_RESULT([no])
777])
daywalker3664f562003-10-17 13:43:46 +0000778CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000779
780AC_SUBST(PREFERRED_STACK_BOUNDARY)
781
sewardj535c50f2005-06-04 23:14:53 +0000782
sewardjb5f6f512005-03-10 23:59:00 +0000783# does this compiler support -Wno-pointer-sign ?
784AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
785
786safe_CFLAGS=$CFLAGS
787CFLAGS="-Wno-pointer-sign"
788
789AC_TRY_COMPILE(, [
790int main () { return 0 ; }
791],
792[
793no_pointer_sign=yes
794AC_MSG_RESULT([yes])
795], [
796no_pointer_sign=no
797AC_MSG_RESULT([no])
798])
799CFLAGS=$safe_CFLAGS
800
801if test x$no_pointer_sign = xyes; then
802 CFLAGS="$CFLAGS -Wno-pointer-sign"
803fi
804
sewardj535c50f2005-06-04 23:14:53 +0000805
tom1e946682005-10-12 11:27:33 +0000806# does this compiler support -Wdeclaration-after-statement ?
807AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ])
808
809safe_CFLAGS=$CFLAGS
810CFLAGS="-Wdeclaration-after-statement"
811
812AC_TRY_COMPILE(, [
813int main () { return 0 ; }
814],
815[
tome9814c32005-10-12 11:30:43 +0000816declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +0000817FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +0000818AC_MSG_RESULT([yes])
819], [
tome9814c32005-10-12 11:30:43 +0000820declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +0000821FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +0000822AC_MSG_RESULT([no])
823])
824CFLAGS=$safe_CFLAGS
825
sewardj72a547e2006-01-25 02:58:28 +0000826AC_SUBST(FLAG_WDECL_AFTER_STMT)
827
tome9814c32005-10-12 11:30:43 +0000828if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +0000829 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
830fi
831
sewardj00f1e622006-03-12 16:47:10 +0000832
sewardja72c26d2007-05-01 13:44:08 +0000833# does this compiler support -fno-stack-protector ?
834AC_MSG_CHECKING([if gcc accepts -fno-stack-protector ])
835
836safe_CFLAGS=$CFLAGS
837CFLAGS="-fno-stack-protector"
838
839AC_TRY_COMPILE(, [
840int main () { return 0 ; }
841],
842[
843no_stack_protector=yes
844FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
845AC_MSG_RESULT([yes])
846], [
847no_stack_protector=no
848FLAG_FNO_STACK_PROTECTOR=""
849AC_MSG_RESULT([no])
850])
851CFLAGS=$safe_CFLAGS
852
853AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
854
855if test x$no_stack_protector = xyes; then
856 CFLAGS="$CFLAGS -fno-stack-protector"
857fi
858
859
tomd55121e2005-12-19 12:40:13 +0000860# does this compiler support __builtin_expect?
861AC_MSG_CHECKING([if gcc supports __builtin_expect])
862
863AC_TRY_LINK(, [
864return __builtin_expect(1, 1) ? 1 : 0
865],
866[
867ac_have_builtin_expect=yes
868AC_MSG_RESULT([yes])
869], [
870ac_have_builtin_expect=no
871AC_MSG_RESULT([no])
872])
873if test x$ac_have_builtin_expect = xyes ; then
874 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
875fi
876
tom1e946682005-10-12 11:27:33 +0000877
sewardj00f1e622006-03-12 16:47:10 +0000878# does the ppc assembler support "mtocrf" et al?
879AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
880
881AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +0000882__asm__ __volatile__("mtocrf 4,0");
883__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +0000884],
885[
886ac_have_as_ppc_mftocrf=yes
887AC_MSG_RESULT([yes])
888], [
889ac_have_as_ppc_mftocrf=no
890AC_MSG_RESULT([no])
891])
892if test x$ac_have_as_ppc_mftocrf = xyes ; then
893 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
894fi
895
896
sewardjf0aabf82007-03-22 00:24:21 +0000897# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +0000898# Note, this doesn't generate a C-level symbol. It generates a
899# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +0000900AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
901
902AC_TRY_COMPILE(, [
903 do { long long int x;
904 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
905 while (0)
906],
907[
908ac_have_as_sse3=yes
909AC_MSG_RESULT([yes])
910], [
911ac_have_as_sse3=no
912AC_MSG_RESULT([no])
913])
sewardjfa18a262007-03-22 12:13:13 +0000914
915AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +0000916
917
sewardj6d6da5b2008-02-09 12:07:40 +0000918# Ditto for SSSE3 instructions (note extra S)
919# Note, this doesn't generate a C-level symbol. It generates a
920# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
921AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
922
923AC_TRY_COMPILE(, [
924 do { long long int x;
925 __asm__ __volatile__(
926 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
927 while (0)
928],
929[
930ac_have_as_ssse3=yes
931AC_MSG_RESULT([yes])
932], [
933ac_have_as_ssse3=no
934AC_MSG_RESULT([no])
935])
936
937AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
938
939
sewardjb5f6f512005-03-10 23:59:00 +0000940# Check for TLS support in the compiler and linker
941AC_CACHE_CHECK([for TLS support], vg_cv_tls,
942 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
943 [vg_cv_tls=$enableval],
944 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
945 [[return foo;]])],
946 [vg_cv_tls=yes],
947 [vg_cv_tls=no])])])
948
949if test "$vg_cv_tls" = yes; then
950AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
951fi
sewardj5b754b42002-06-03 22:53:35 +0000952
sewardj535c50f2005-06-04 23:14:53 +0000953
sewardjde4a1d02002-03-22 01:27:54 +0000954# Checks for header files.
955AC_HEADER_STDC
nethercote3d260f62004-10-31 19:39:18 +0000956AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
sewardjde4a1d02002-03-22 01:27:54 +0000957
sewardj535c50f2005-06-04 23:14:53 +0000958
sewardjde4a1d02002-03-22 01:27:54 +0000959# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000960AC_TYPE_UID_T
961AC_TYPE_OFF_T
962AC_TYPE_SIZE_T
963AC_HEADER_TIME
964
sewardj535c50f2005-06-04 23:14:53 +0000965
sewardjde4a1d02002-03-22 01:27:54 +0000966# Checks for library functions.
967AC_FUNC_MEMCMP
968AC_FUNC_MMAP
969AC_TYPE_SIGNAL
970
thughesbeb6eb92004-06-14 12:33:43 +0000971AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
bartc411d1c2008-04-22 17:24:31 +0000972AC_CHECK_FUNCS([mallinfo])
sewardjde4a1d02002-03-22 01:27:54 +0000973
sewardj80637752006-03-02 13:48:21 +0000974
sewardj03d86f22006-10-17 00:57:24 +0000975# Do we have a useable MPI setup on the primary and/or secondary targets?
976# On Linux, by default, assumes mpicc and -m32/-m64
977# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +0000978# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +0000979# understands -m32/-m64/-q32/-q64 regardless of what is specified using
980# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +0000981MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +0000982if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
983 -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
984 MPI_CC="mpxlc"
985fi
986
sewardje9fa5062006-03-12 18:29:18 +0000987mflag_primary=
988if test x$VG_PLATFORM_PRI = xX86_LINUX \
989 -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then
990 mflag_primary=$FLAG_M32
991elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \
992 -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then
993 mflag_primary=$FLAG_M64
sewardj03d86f22006-10-17 00:57:24 +0000994elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then
995 mflag_primary=-q32
996elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
997 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +0000998fi
999
sewardj03d86f22006-10-17 00:57:24 +00001000mflag_secondary=
1001if test x$VG_PLATFORM_SEC = xX86_LINUX \
1002 -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then
1003 mflag_secondary=$FLAG_M32
1004elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then
1005 mflag_secondary=-q32
1006fi
1007
1008
sewardj0ad46092006-03-02 17:09:16 +00001009AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001010 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001011 MPI_CC=$withval
1012)
sewardj03d86f22006-10-17 00:57:24 +00001013AC_SUBST(MPI_CC)
1014
1015## See if MPI_CC works for the primary target
1016##
1017AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001018saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001019saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001020CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001021CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001022AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001023#include <mpi.h>
1024#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001025],[
1026 int r = MPI_Init(NULL,NULL);
1027 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1028 return r;
1029], [
sewardj03d86f22006-10-17 00:57:24 +00001030ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001031AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001032], [
sewardj03d86f22006-10-17 00:57:24 +00001033ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001034AC_MSG_RESULT([no])
1035])
sewardj0ad46092006-03-02 17:09:16 +00001036CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001037CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001038AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001039
sewardj03d86f22006-10-17 00:57:24 +00001040## See if MPI_CC works for the secondary target. Complication: what if
1041## there is no secondary target? We need this to then fail.
1042## Kludge this by making MPI_CC something which will surely fail in
1043## such a case.
1044##
1045AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1046saved_CC=$CC
1047saved_CFLAGS=$CFLAGS
1048if test x$VG_PLATFORM_SEC = x ; then
1049 CC="$MPI_CC this will surely fail"
1050else
1051 CC=$MPI_CC
1052fi
1053CFLAGS=$mflag_secondary
1054AC_TRY_LINK([
1055#include <mpi.h>
1056#include <stdio.h>
1057],[
1058 int r = MPI_Init(NULL,NULL);
1059 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1060 return r;
1061], [
1062ac_have_mpi2_sec=yes
1063AC_MSG_RESULT([yes, $MPI_CC])
1064], [
1065ac_have_mpi2_sec=no
1066AC_MSG_RESULT([no])
1067])
1068CC=$saved_CC
1069CFLAGS=$saved_CFLAGS
1070AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001071
1072
1073# -------------------- ok. We're done. --------------------
1074
gobrye721a522002-03-22 13:38:30 +00001075AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001076 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001077 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001078 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001079 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001080 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001081 docs/lib/Makefile
1082 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001083 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001084 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001085 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001086 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001087 perf/Makefile
1088 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001089 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001090 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001091 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001092 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001093 memcheck/Makefile
1094 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001095 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001096 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001097 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001098 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001099 memcheck/docs/Makefile
1100 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001101 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001102 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001103 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001104 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001105 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001106 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001107 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001108 callgrind/Makefile
1109 callgrind/callgrind_annotate
1110 callgrind/callgrind_control
1111 callgrind/tests/Makefile
1112 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001113 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001114 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001115 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001116 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001117 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001118 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001119 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001120 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001121 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001122 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001123 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001124 none/Makefile
1125 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001126 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001127 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001128 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001129 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +00001130 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001131 exp-omega/Makefile
1132 exp-omega/tests/Makefile
1133 exp-omega/docs/Makefile
sewardjbbec7722007-11-25 14:08:53 +00001134 exp-drd/Makefile
1135 exp-drd/docs/Makefile
1136 exp-drd/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001137)
gobry3b777892002-04-04 09:18:39 +00001138
1139cat<<EOF
1140
sewardj01262142006-01-04 01:20:28 +00001141 Primary build target: ${VG_PLATFORM_PRI}
sewardj80637752006-03-02 13:48:21 +00001142 Secondary build target: ${VG_PLATFORM_SEC}
sewardj01262142006-01-04 01:20:28 +00001143 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001144
gobry3b777892002-04-04 09:18:39 +00001145EOF
1146
1147cat<<EOF > default.supp
1148# This is a generated file, composed of the following suppression rules:
1149#
1150# ${DEFAULT_SUPP}
1151#
1152
1153EOF
1154
1155for file in ${DEFAULT_SUPP} ; do
1156 cat ${srcdir}/$file >> default.supp
1157done