blob: 18274151d47abdd5f322ee84d8823de5c879ee17 [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
daywalker870ac4c2002-05-21 00:09:48 +000089gcc_version=`${CC} --version | head -n 1`
gobrye721a522002-03-22 13:38:30 +000090
91case "${gcc_version}" in
92 gcc-2.7.*)
93 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 ;;
96 gcc-2.8.*)
97 AC_MSG_RESULT([no (${gcc_version})])
98 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
99 ;;
100 gcc-2.9*)
101 AC_MSG_RESULT([no (${gcc_version})])
102 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
gobrye721a522002-03-22 13:38:30 +0000103 ;;
104
105 *)
106 AC_MSG_RESULT([ok (${gcc_version})])
107 ;;
108esac
109
gobrye721a522002-03-22 13:38:30 +0000110
sewardj03d86f22006-10-17 00:57:24 +0000111# Checks for the platform, with the aim of setting VG_ARCH. Note
112# that VG_ARCH must be set to reflect the most that this CPU can
113# do: for example if it is a 64-bit capable PowerPC, then it must
114# be set to ppc64 and not ppc32. Ditto for amd64.
115
sewardjde4a1d02002-03-22 01:27:54 +0000116AC_CANONICAL_HOST
117
118AC_MSG_CHECKING([for a supported CPU])
nethercote888ecb72004-08-23 14:54:40 +0000119AC_SUBST(VG_ARCH)
sewardjbc692db2006-01-04 03:31:07 +0000120
sewardj9b0567a2006-01-17 02:56:18 +0000121AC_SUBST(VG_ARCH_ALL)
122VG_ARCH_ALL="amd64 ppc32 ppc64 x86"
123
sewardj45f4e7c2005-09-27 19:20:21 +0000124AC_SUBST(VALT_LOAD_ADDRESS)
sewardjde4a1d02002-03-22 01:27:54 +0000125
gobrye721a522002-03-22 13:38:30 +0000126case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000127 i?86)
128 AC_MSG_RESULT([ok (${host_cpu})])
nethercote888ecb72004-08-23 14:54:40 +0000129 VG_ARCH="x86"
sewardjd7baad42006-05-20 01:13:38 +0000130 valt_load_address_normal="0x38000000"
131 valt_load_address_inner="0x28000000"
sewardjde4a1d02002-03-22 01:27:54 +0000132 ;;
133
njnfe408942004-11-23 17:52:24 +0000134 x86_64)
135 AC_MSG_RESULT([ok (${host_cpu})])
136 VG_ARCH="amd64"
sewardjd7baad42006-05-20 01:13:38 +0000137 valt_load_address_normal="0x38000000"
138 valt_load_address_inner="0x28000000"
njnfe408942004-11-23 17:52:24 +0000139 ;;
140
sewardj2c48c7b2005-11-29 13:05:56 +0000141 powerpc64)
sewardj03d86f22006-10-17 00:57:24 +0000142# This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000143 AC_MSG_RESULT([ok (${host_cpu})])
144 VG_ARCH="ppc64"
sewardjd7baad42006-05-20 01:13:38 +0000145 valt_load_address_normal="0x38000000"
146 valt_load_address_inner="0x28000000"
sewardj2c48c7b2005-11-29 13:05:56 +0000147 ;;
148
149 powerpc)
sewardj03d86f22006-10-17 00:57:24 +0000150# Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
151# Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000152 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000153 case "${host_os}" in
154 aix5.*)
155 VG_ARCH="ppc64"
156 ;;
157 *)
158 VG_ARCH="ppc32"
159 ;;
160 esac
sewardjd7baad42006-05-20 01:13:38 +0000161 valt_load_address_normal="0x38000000"
162 valt_load_address_inner="0x28000000"
nethercote9bcc9062004-10-13 13:50:01 +0000163 ;;
164
sewardjde4a1d02002-03-22 01:27:54 +0000165 *)
166 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000167 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000168 ;;
169esac
170
sewardj45f4e7c2005-09-27 19:20:21 +0000171# Check if this should be built as an inner Valgrind, to be run within
172# another Valgrind. Choose the load address accordingly.
sewardj86e992f2006-01-28 18:39:09 +0000173AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
174 [AC_ARG_ENABLE(inner,
175 [ --enable-inner enables self-hosting],
176 [vg_cv_inner=$enableval],
177 [vg_cv_inner=no])])
sewardj45f4e7c2005-09-27 19:20:21 +0000178if test "$vg_cv_inner" = yes; then
179 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
180 VALT_LOAD_ADDRESS=$valt_load_address_inner
181else
182 VALT_LOAD_ADDRESS=$valt_load_address_normal
183fi
184
sewardj86e992f2006-01-28 18:39:09 +0000185# Sometimes it's convenient to subvert the bi-arch build system and
186# just have a single build even though the underlying platform is
187# capable of both. Hence handle --enable-only64bit and
188# --enable-only32bit. Complain if both are issued :-)
189
190# Check if a 64-bit only build has been requested
191AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
192 [AC_ARG_ENABLE(only64bit,
193 [ --enable-only64bit do a 64-bit only build],
194 [vg_cv_only64bit=$enableval],
195 [vg_cv_only64bit=no])])
196
197# Check if a 32-bit only build has been requested
198AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
199 [AC_ARG_ENABLE(only32bit,
200 [ --enable-only32bit do a 32-bit only build],
201 [vg_cv_only32bit=$enableval],
202 [vg_cv_only32bit=no])])
203
204# Stay sane
205if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
206 AC_MSG_ERROR(
207 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
208fi
209
210
211
sewardjde4a1d02002-03-22 01:27:54 +0000212AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000213AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000214
gobrye721a522002-03-22 13:38:30 +0000215case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000216 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000217 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000218 VG_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000219
220 # Ok, this is linux. Check the kernel version
221 AC_MSG_CHECKING([for the kernel version])
222
223 kernel=`uname -r`
224
225 case "${kernel}" in
226 2.6.*)
227 AC_MSG_RESULT([2.6 family (${kernel})])
228 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
229 ;;
230
231 2.4.*)
232 AC_MSG_RESULT([2.4 family (${kernel})])
233 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
234 ;;
235
mueller8c68e042004-01-03 15:21:14 +0000236 *)
237 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000238 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000239 ;;
240 esac
241
242 ;;
243
sewardj03d86f22006-10-17 00:57:24 +0000244 aix5.1.*)
245 AC_MSG_RESULT([ok (${host_os})])
246 VG_OS="aix5"
247 ;;
248 aix5.2.*)
249 AC_MSG_RESULT([ok (${host_os})])
250 VG_OS="aix5"
251 ;;
252 aix5.3.*)
253 AC_MSG_RESULT([ok (${host_os})])
254 VG_OS="aix5"
255 ;;
256
mueller8c68e042004-01-03 15:21:14 +0000257 *freebsd*)
258 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000259 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000260 ;;
261
262 *)
263 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000264 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000265 ;;
266esac
267
tomd6398392006-06-07 17:44:36 +0000268# If we are building on a 64 bit platform test to see if the system
269# supports building 32 bit programs and disable 32 bit support if it
270# does not support building 32 bit programs
271
272case "$VG_ARCH-$VG_OS" in
273 amd64-linux|ppc64-linux)
274 AC_MSG_CHECKING([for 32 bit build support])
275 safe_CFLAGS=$CFLAGS
276 CFLAGS="-m32"
277 AC_TRY_LINK(, [
278 int main () { return 0 ; }
279 ],
280 [
281 AC_MSG_RESULT([yes])
282 ], [
283 vg_cv_only64bit="yes"
284 AC_MSG_RESULT([no])
285 ])
286 CFLAGS=$safe_CFLAGS;;
287esac
288
289if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
290 AC_MSG_ERROR(
291 [--enable-only32bit was specified but system does not support 32 bit builds])
292fi
nethercote888ecb72004-08-23 14:54:40 +0000293
sewardj01262142006-01-04 01:20:28 +0000294# Establish VG_PLATFORM_PRI. This is the primary build target. The
295# entire system, including regression and performance tests, will be
sewardjbc692db2006-01-04 03:31:07 +0000296# built for this target.
sewardj01262142006-01-04 01:20:28 +0000297#
sewardjbc692db2006-01-04 03:31:07 +0000298# Also establish VG_PLATFORM_SEC, the secondary build target, if
sewardj01262142006-01-04 01:20:28 +0000299# possible. The system will also be built for this target, but not
sewardjbc692db2006-01-04 03:31:07 +0000300# the regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000301#
302AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000303
sewardj01262142006-01-04 01:20:28 +0000304AC_SUBST(VG_PLATFORM_PRI)
305AC_SUBST(VG_PLATFORM_SEC)
306
307case "$VG_ARCH-$VG_OS" in
308 x86-linux)
309 VG_PLATFORM_PRI="X86_LINUX"
310 VG_PLATFORM_SEC=""
sewardj3e38ce02004-11-23 01:17:29 +0000311 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000312 ;;
313 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000314 if test x$vg_cv_only64bit = xyes; then
315 VG_PLATFORM_PRI="AMD64_LINUX"
316 VG_PLATFORM_SEC=""
317 elif test x$vg_cv_only32bit = xyes; then
318 VG_PLATFORM_PRI="X86_LINUX"
319 VG_PLATFORM_SEC=""
320 else
321 VG_PLATFORM_PRI="AMD64_LINUX"
322 VG_PLATFORM_SEC="X86_LINUX"
323 fi
sewardj01262142006-01-04 01:20:28 +0000324 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
325 ;;
326 ppc32-linux)
327 VG_PLATFORM_PRI="PPC32_LINUX"
328 VG_PLATFORM_SEC=""
329 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
330 ;;
sewardj03d86f22006-10-17 00:57:24 +0000331 ppc64-aix5)
332 if test x$vg_cv_only64bit = xyes; then
333 VG_PLATFORM_PRI="PPC64_AIX5"
334 VG_PLATFORM_SEC=""
335 elif test x$vg_cv_only32bit = xyes; then
336 VG_PLATFORM_PRI="PPC32_AIX5"
337 VG_PLATFORM_SEC=""
338 else
339 VG_PLATFORM_PRI="PPC64_AIX5"
340 VG_PLATFORM_SEC="PPC32_AIX5"
341 fi
342 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
343 ;;
sewardj01262142006-01-04 01:20:28 +0000344 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000345 if test x$vg_cv_only64bit = xyes; then
346 VG_PLATFORM_PRI="PPC64_LINUX"
347 VG_PLATFORM_SEC=""
348 elif test x$vg_cv_only32bit = xyes; then
349 VG_PLATFORM_PRI="PPC32_LINUX"
350 VG_PLATFORM_SEC=""
351 else
352 VG_PLATFORM_PRI="PPC64_LINUX"
353 VG_PLATFORM_SEC="PPC32_LINUX"
354 fi
sewardj01262142006-01-04 01:20:28 +0000355 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
356 ;;
nethercote888ecb72004-08-23 14:54:40 +0000357 *)
sewardj01262142006-01-04 01:20:28 +0000358 VG_PLATFORM_PRI="unknown"
359 VG_PLATFORM_SEC="unknown"
nethercote888ecb72004-08-23 14:54:40 +0000360 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000361 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000362 ;;
363esac
sewardjde4a1d02002-03-22 01:27:54 +0000364
sewardj03d86f22006-10-17 00:57:24 +0000365# Set up VGP_<platform>. Either one or two of these become defined.
sewardj01262142006-01-04 01:20:28 +0000366#
sewardj03d86f22006-10-17 00:57:24 +0000367AM_CONDITIONAL(VGP_X86_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000368 test x$VG_PLATFORM_PRI = xX86_LINUX \
369 -o x$VG_PLATFORM_SEC = xX86_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000370AM_CONDITIONAL(VGP_AMD64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000371 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000372AM_CONDITIONAL(VGP_PPC32_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000373 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
374 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000375AM_CONDITIONAL(VGP_PPC64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000376 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000377AM_CONDITIONAL(VGP_PPC32_AIX5,
378 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
379 -o x$VG_PLATFORM_SEC = xPPC32_AIX5)
380AM_CONDITIONAL(VGP_PPC64_AIX5,
381 test x$VG_PLATFORM_PRI = xPPC64_AIX5)
382
383# Similarly, set up VGO_<os>. Exactly one of these becomes defined.
384# Relies on the assumption that the primary and secondary targets are
385# for the same OS, so therefore only necessary to test the primary.
386#
387AM_CONDITIONAL(VGO_LINUX,
388 test x$VG_PLATFORM_PRI = xX86_LINUX \
389 -o x$VG_PLATFORM_PRI = xAMD64_LINUX \
390 -o x$VG_PLATFORM_PRI = xPPC32_LINUX \
391 -o x$VG_PLATFORM_PRI = xPPC64_LINUX)
392AM_CONDITIONAL(VGO_AIX5,
393 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
394 -o x$VG_PLATFORM_PRI = xPPC64_AIX5)
395
396
397# Sometimes, in the Makefile.am-s, it's useful to know
398# whether or not there is a secondary target.
399#
400AM_CONDITIONAL(VGP_HAVE_SECONDARY,
401 test x$VG_PLATFORM_SEC != x)
tomfb7bcde2005-11-07 15:24:38 +0000402
tomb637bad2005-11-08 12:28:35 +0000403
sewardj01262142006-01-04 01:20:28 +0000404# This variable will collect the individual suppression files
405# depending on the results of autoconf
406DEFAULT_SUPP=""
sewardjde4a1d02002-03-22 01:27:54 +0000407AC_SUBST(DEFAULT_SUPP)
408
sewardj01262142006-01-04 01:20:28 +0000409
sewardj03d86f22006-10-17 00:57:24 +0000410libc=""
sewardjde4a1d02002-03-22 01:27:54 +0000411
sewardjde4a1d02002-03-22 01:27:54 +0000412AC_EGREP_CPP([GLIBC_22], [
413#include <features.h>
414#ifdef __GNU_LIBRARY__
415 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
416 GLIBC_22
417 #endif
418#endif
419],
sewardj03d86f22006-10-17 00:57:24 +0000420libc="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000421
sewardj08c7f012002-10-07 23:56:55 +0000422AC_EGREP_CPP([GLIBC_23], [
423#include <features.h>
424#ifdef __GNU_LIBRARY__
425 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
426 GLIBC_23
427 #endif
428#endif
429],
sewardj03d86f22006-10-17 00:57:24 +0000430libc="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000431
njn781dba52005-06-30 04:06:38 +0000432AC_EGREP_CPP([GLIBC_24], [
433#include <features.h>
434#ifdef __GNU_LIBRARY__
435 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
436 GLIBC_24
437 #endif
438#endif
439],
sewardj03d86f22006-10-17 00:57:24 +0000440libc="2.4")
njn781dba52005-06-30 04:06:38 +0000441
dirkaece45c2006-10-12 08:17:49 +0000442AC_EGREP_CPP([GLIBC_25], [
443#include <features.h>
444#ifdef __GNU_LIBRARY__
445 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
446 GLIBC_25
447 #endif
448#endif
449],
sewardj03d86f22006-10-17 00:57:24 +0000450libc="2.5")
dirkaece45c2006-10-12 08:17:49 +0000451
dirkc8bd0c52007-05-23 17:39:08 +0000452AC_EGREP_CPP([GLIBC_26], [
453#include <features.h>
454#ifdef __GNU_LIBRARY__
455 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
456 GLIBC_26
457 #endif
458#endif
459],
460libc="2.6")
461
sewardj68c80c12007-11-18 14:40:02 +0000462AC_EGREP_CPP([GLIBC_27], [
463#include <features.h>
464#ifdef __GNU_LIBRARY__
465 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
466 GLIBC_27
467 #endif
468#endif
469],
470libc="2.7")
471
sewardj03d86f22006-10-17 00:57:24 +0000472AC_EGREP_CPP([AIX5_LIBC], [
473#include <standards.h>
474#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
475 AIX5_LIBC
476#endif
477],
478libc="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000479
sewardj03d86f22006-10-17 00:57:24 +0000480AC_MSG_CHECKING([the libc version])
481
482case "${libc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000483 2.2)
484 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000485 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000486 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
487 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000488 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000489 ;;
490
sewardj08c7f012002-10-07 23:56:55 +0000491 2.3)
492 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000493 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000494 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000495 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000496 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000497 ;;
498
njn781dba52005-06-30 04:06:38 +0000499 2.4)
500 AC_MSG_RESULT(2.4 family)
501 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000502 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000503 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000504 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000505 ;;
506
dirkaece45c2006-10-12 08:17:49 +0000507 2.5)
508 AC_MSG_RESULT(2.5 family)
509 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000510 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000511 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000512 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000513 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000514 2.6)
515 AC_MSG_RESULT(2.6 family)
516 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000517 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000518 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000519 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000520 ;;
521 2.7)
522 AC_MSG_RESULT(2.7 family)
523 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
524 DEFAULT_SUPP="glibc-2.7.supp ${DEFAULT_SUPP}"
525 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000526 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000527 ;;
sewardj03d86f22006-10-17 00:57:24 +0000528 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000529 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
530 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 +0000531 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
532 ;;
dirkaece45c2006-10-12 08:17:49 +0000533
sewardjde4a1d02002-03-22 01:27:54 +0000534 *)
535 AC_MSG_RESULT(unsupported version)
sewardj68c80c12007-11-18 14:40:02 +0000536 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.7])
sewardj2f3bcd22006-12-12 01:38:15 +0000537 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 libc])
sewardjde4a1d02002-03-22 01:27:54 +0000538 ;;
539esac
540
sewardj535c50f2005-06-04 23:14:53 +0000541
nethercote3d260f62004-10-31 19:39:18 +0000542# We don't know how to detect the X client library version
sewardj03d86f22006-10-17 00:57:24 +0000543# (detecting the server version is easy, but no help). So we
nethercote3d260f62004-10-31 19:39:18 +0000544# just use a hack: always include the suppressions for both
545# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000546AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000547if test "${no_x}" != 'yes' ; then
sewardj01262142006-01-04 01:20:28 +0000548 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
549 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000550fi
551
sewardj2e10a682003-04-07 19:36:41 +0000552
bart5e389f12008-04-05 12:53:15 +0000553# Check whether pthread_mutex_t has a member called __m_kind.
554
555AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
556
557AC_COMPILE_IFELSE(
558[
559#include <pthread.h>
560int main(int argc, char** argv)
561{
562 pthread_mutex_t m;
563 return m.__m_kind;
564}
565],
566[
567AC_MSG_RESULT([yes])
568AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
569 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
570], [
571AC_MSG_RESULT([no])
572])
573
574
575# Check whether pthread_mutex_t has a member called __data.__kind.
576
577AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
578
579AC_COMPILE_IFELSE(
580[
581#include <pthread.h>
582int main(int argc, char** argv)
583{
584 pthread_mutex_t m;
585 return m.__data.__kind;
586}
587],
588[
589AC_MSG_RESULT([yes])
590AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
591 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
592], [
593AC_MSG_RESULT([no])
594])
595
596
bart61111332008-03-10 17:57:41 +0000597# does this compiler support -fopenmp, does it have the include file
598# <omp.h> and does it have libgomp ?
bart29cc9db2008-03-09 15:59:30 +0000599
bart1f52b822008-03-12 17:11:48 +0000600AC_MSG_CHECKING([for OpenMP])
601
bart29cc9db2008-03-09 15:59:30 +0000602safe_CFLAGS=$CFLAGS
603CFLAGS="-fopenmp"
604
bart1f52b822008-03-12 17:11:48 +0000605AC_LINK_IFELSE(
bart29cc9db2008-03-09 15:59:30 +0000606[
bart1f52b822008-03-12 17:11:48 +0000607#include <omp.h>
608int main(int argc, char** argv)
609{
610 omp_set_dynamic(0);
611 return 0;
612}
613],
614[
615ac_have_openmp=yes
bart29cc9db2008-03-09 15:59:30 +0000616AC_MSG_RESULT([yes])
617], [
bart1f52b822008-03-12 17:11:48 +0000618ac_have_openmp=no
bart29cc9db2008-03-09 15:59:30 +0000619AC_MSG_RESULT([no])
620])
621CFLAGS=$safe_CFLAGS
622
bart1f52b822008-03-12 17:11:48 +0000623AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
bart29cc9db2008-03-09 15:59:30 +0000624
625
sewardj535c50f2005-06-04 23:14:53 +0000626# does this compiler support -m32 ?
627AC_MSG_CHECKING([if gcc accepts -m32])
628
629safe_CFLAGS=$CFLAGS
630CFLAGS="-m32"
631
632AC_TRY_COMPILE(, [
633int main () { return 0 ; }
634],
635[
636FLAG_M32="-m32"
637AC_MSG_RESULT([yes])
638], [
639FLAG_M32=""
640AC_MSG_RESULT([no])
641])
642CFLAGS=$safe_CFLAGS
643
644AC_SUBST(FLAG_M32)
645
646
sewardj03d86f22006-10-17 00:57:24 +0000647# does this compiler support -maix32 ?
648AC_MSG_CHECKING([if gcc accepts -maix32])
649
650safe_CFLAGS=$CFLAGS
651CFLAGS="-maix32"
652
653AC_TRY_COMPILE(, [
654int main () { return 0 ; }
655],
656[
657FLAG_MAIX32="-maix32"
658AC_MSG_RESULT([yes])
659], [
660FLAG_MAIX32=""
661AC_MSG_RESULT([no])
662])
663CFLAGS=$safe_CFLAGS
664
665AC_SUBST(FLAG_MAIX32)
666
667
sewardj01262142006-01-04 01:20:28 +0000668# does this compiler support -m64 ?
669AC_MSG_CHECKING([if gcc accepts -m64])
670
671safe_CFLAGS=$CFLAGS
672CFLAGS="-m64"
673
674AC_TRY_COMPILE(, [
675int main () { return 0 ; }
676],
677[
678FLAG_M64="-m64"
679AC_MSG_RESULT([yes])
680], [
681FLAG_M64=""
682AC_MSG_RESULT([no])
683])
684CFLAGS=$safe_CFLAGS
685
686AC_SUBST(FLAG_M64)
687
688
sewardj03d86f22006-10-17 00:57:24 +0000689# does this compiler support -maix64 ?
690AC_MSG_CHECKING([if gcc accepts -maix64])
691
692safe_CFLAGS=$CFLAGS
693CFLAGS="-maix64"
694
695AC_TRY_COMPILE(, [
696int main () { return 0 ; }
697],
698[
699FLAG_MAIX64="-maix64"
700AC_MSG_RESULT([yes])
701], [
702FLAG_MAIX64=""
703AC_MSG_RESULT([no])
704])
705CFLAGS=$safe_CFLAGS
706
707AC_SUBST(FLAG_MAIX64)
708
709
sewardj67f1fcc2005-07-03 10:41:02 +0000710# does this compiler support -mmmx ?
711AC_MSG_CHECKING([if gcc accepts -mmmx])
712
713safe_CFLAGS=$CFLAGS
714CFLAGS="-mmmx"
715
716AC_TRY_COMPILE(, [
717int main () { return 0 ; }
718],
719[
720FLAG_MMMX="-mmmx"
721AC_MSG_RESULT([yes])
722], [
723FLAG_MMMX=""
724AC_MSG_RESULT([no])
725])
726CFLAGS=$safe_CFLAGS
727
728AC_SUBST(FLAG_MMMX)
729
730
731# does this compiler support -msse ?
732AC_MSG_CHECKING([if gcc accepts -msse])
733
734safe_CFLAGS=$CFLAGS
735CFLAGS="-msse"
736
737AC_TRY_COMPILE(, [
738int main () { return 0 ; }
739],
740[
741FLAG_MSSE="-msse"
742AC_MSG_RESULT([yes])
743], [
744FLAG_MSSE=""
745AC_MSG_RESULT([no])
746])
747CFLAGS=$safe_CFLAGS
748
749AC_SUBST(FLAG_MSSE)
750
751
sewardj5b754b42002-06-03 22:53:35 +0000752# does this compiler support -mpreferred-stack-boundary=2 ?
753AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
754
daywalker3664f562003-10-17 13:43:46 +0000755safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000756CFLAGS="-mpreferred-stack-boundary=2"
757
758AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000759int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000760],
761[
762PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000763AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000764], [
765PREFERRED_STACK_BOUNDARY=""
766AC_MSG_RESULT([no])
767])
daywalker3664f562003-10-17 13:43:46 +0000768CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000769
770AC_SUBST(PREFERRED_STACK_BOUNDARY)
771
sewardj535c50f2005-06-04 23:14:53 +0000772
sewardjb5f6f512005-03-10 23:59:00 +0000773# does this compiler support -Wno-pointer-sign ?
774AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
775
776safe_CFLAGS=$CFLAGS
777CFLAGS="-Wno-pointer-sign"
778
779AC_TRY_COMPILE(, [
780int main () { return 0 ; }
781],
782[
783no_pointer_sign=yes
784AC_MSG_RESULT([yes])
785], [
786no_pointer_sign=no
787AC_MSG_RESULT([no])
788])
789CFLAGS=$safe_CFLAGS
790
791if test x$no_pointer_sign = xyes; then
792 CFLAGS="$CFLAGS -Wno-pointer-sign"
793fi
794
sewardj535c50f2005-06-04 23:14:53 +0000795
tom1e946682005-10-12 11:27:33 +0000796# does this compiler support -Wdeclaration-after-statement ?
797AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ])
798
799safe_CFLAGS=$CFLAGS
800CFLAGS="-Wdeclaration-after-statement"
801
802AC_TRY_COMPILE(, [
803int main () { return 0 ; }
804],
805[
tome9814c32005-10-12 11:30:43 +0000806declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +0000807FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +0000808AC_MSG_RESULT([yes])
809], [
tome9814c32005-10-12 11:30:43 +0000810declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +0000811FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +0000812AC_MSG_RESULT([no])
813])
814CFLAGS=$safe_CFLAGS
815
sewardj72a547e2006-01-25 02:58:28 +0000816AC_SUBST(FLAG_WDECL_AFTER_STMT)
817
tome9814c32005-10-12 11:30:43 +0000818if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +0000819 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
820fi
821
sewardj00f1e622006-03-12 16:47:10 +0000822
sewardja72c26d2007-05-01 13:44:08 +0000823# does this compiler support -fno-stack-protector ?
824AC_MSG_CHECKING([if gcc accepts -fno-stack-protector ])
825
826safe_CFLAGS=$CFLAGS
827CFLAGS="-fno-stack-protector"
828
829AC_TRY_COMPILE(, [
830int main () { return 0 ; }
831],
832[
833no_stack_protector=yes
834FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
835AC_MSG_RESULT([yes])
836], [
837no_stack_protector=no
838FLAG_FNO_STACK_PROTECTOR=""
839AC_MSG_RESULT([no])
840])
841CFLAGS=$safe_CFLAGS
842
843AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
844
845if test x$no_stack_protector = xyes; then
846 CFLAGS="$CFLAGS -fno-stack-protector"
847fi
848
849
tomd55121e2005-12-19 12:40:13 +0000850# does this compiler support __builtin_expect?
851AC_MSG_CHECKING([if gcc supports __builtin_expect])
852
853AC_TRY_LINK(, [
854return __builtin_expect(1, 1) ? 1 : 0
855],
856[
857ac_have_builtin_expect=yes
858AC_MSG_RESULT([yes])
859], [
860ac_have_builtin_expect=no
861AC_MSG_RESULT([no])
862])
863if test x$ac_have_builtin_expect = xyes ; then
864 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
865fi
866
tom1e946682005-10-12 11:27:33 +0000867
sewardj00f1e622006-03-12 16:47:10 +0000868# does the ppc assembler support "mtocrf" et al?
869AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
870
871AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +0000872__asm__ __volatile__("mtocrf 4,0");
873__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +0000874],
875[
876ac_have_as_ppc_mftocrf=yes
877AC_MSG_RESULT([yes])
878], [
879ac_have_as_ppc_mftocrf=no
880AC_MSG_RESULT([no])
881])
882if test x$ac_have_as_ppc_mftocrf = xyes ; then
883 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
884fi
885
886
sewardjf0aabf82007-03-22 00:24:21 +0000887# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +0000888# Note, this doesn't generate a C-level symbol. It generates a
889# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +0000890AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
891
892AC_TRY_COMPILE(, [
893 do { long long int x;
894 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
895 while (0)
896],
897[
898ac_have_as_sse3=yes
899AC_MSG_RESULT([yes])
900], [
901ac_have_as_sse3=no
902AC_MSG_RESULT([no])
903])
sewardjfa18a262007-03-22 12:13:13 +0000904
905AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +0000906
907
sewardj6d6da5b2008-02-09 12:07:40 +0000908# Ditto for SSSE3 instructions (note extra S)
909# Note, this doesn't generate a C-level symbol. It generates a
910# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
911AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
912
913AC_TRY_COMPILE(, [
914 do { long long int x;
915 __asm__ __volatile__(
916 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
917 while (0)
918],
919[
920ac_have_as_ssse3=yes
921AC_MSG_RESULT([yes])
922], [
923ac_have_as_ssse3=no
924AC_MSG_RESULT([no])
925])
926
927AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
928
929
sewardjb5f6f512005-03-10 23:59:00 +0000930# Check for TLS support in the compiler and linker
931AC_CACHE_CHECK([for TLS support], vg_cv_tls,
932 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
933 [vg_cv_tls=$enableval],
934 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
935 [[return foo;]])],
936 [vg_cv_tls=yes],
937 [vg_cv_tls=no])])])
938
939if test "$vg_cv_tls" = yes; then
940AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
941fi
sewardj5b754b42002-06-03 22:53:35 +0000942
sewardj535c50f2005-06-04 23:14:53 +0000943
sewardjde4a1d02002-03-22 01:27:54 +0000944# Checks for header files.
945AC_HEADER_STDC
nethercote3d260f62004-10-31 19:39:18 +0000946AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
sewardjde4a1d02002-03-22 01:27:54 +0000947
sewardj535c50f2005-06-04 23:14:53 +0000948
sewardjde4a1d02002-03-22 01:27:54 +0000949# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000950AC_TYPE_UID_T
951AC_TYPE_OFF_T
952AC_TYPE_SIZE_T
953AC_HEADER_TIME
954
sewardj535c50f2005-06-04 23:14:53 +0000955
sewardjde4a1d02002-03-22 01:27:54 +0000956# Checks for library functions.
957AC_FUNC_MEMCMP
958AC_FUNC_MMAP
959AC_TYPE_SIGNAL
960
thughesbeb6eb92004-06-14 12:33:43 +0000961AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
sewardjde4a1d02002-03-22 01:27:54 +0000962
sewardj80637752006-03-02 13:48:21 +0000963
sewardj03d86f22006-10-17 00:57:24 +0000964# Do we have a useable MPI setup on the primary and/or secondary targets?
965# On Linux, by default, assumes mpicc and -m32/-m64
966# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +0000967# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +0000968# understands -m32/-m64/-q32/-q64 regardless of what is specified using
969# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +0000970MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +0000971if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
972 -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
973 MPI_CC="mpxlc"
974fi
975
sewardje9fa5062006-03-12 18:29:18 +0000976mflag_primary=
977if test x$VG_PLATFORM_PRI = xX86_LINUX \
978 -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then
979 mflag_primary=$FLAG_M32
980elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \
981 -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then
982 mflag_primary=$FLAG_M64
sewardj03d86f22006-10-17 00:57:24 +0000983elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then
984 mflag_primary=-q32
985elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
986 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +0000987fi
988
sewardj03d86f22006-10-17 00:57:24 +0000989mflag_secondary=
990if test x$VG_PLATFORM_SEC = xX86_LINUX \
991 -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then
992 mflag_secondary=$FLAG_M32
993elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then
994 mflag_secondary=-q32
995fi
996
997
sewardj0ad46092006-03-02 17:09:16 +0000998AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +0000999 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001000 MPI_CC=$withval
1001)
sewardj03d86f22006-10-17 00:57:24 +00001002AC_SUBST(MPI_CC)
1003
1004## See if MPI_CC works for the primary target
1005##
1006AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001007saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001008saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001009CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001010CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001011AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001012#include <mpi.h>
1013#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001014],[
1015 int r = MPI_Init(NULL,NULL);
1016 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1017 return r;
1018], [
sewardj03d86f22006-10-17 00:57:24 +00001019ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001020AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001021], [
sewardj03d86f22006-10-17 00:57:24 +00001022ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001023AC_MSG_RESULT([no])
1024])
sewardj0ad46092006-03-02 17:09:16 +00001025CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001026CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001027AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001028
sewardj03d86f22006-10-17 00:57:24 +00001029## See if MPI_CC works for the secondary target. Complication: what if
1030## there is no secondary target? We need this to then fail.
1031## Kludge this by making MPI_CC something which will surely fail in
1032## such a case.
1033##
1034AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1035saved_CC=$CC
1036saved_CFLAGS=$CFLAGS
1037if test x$VG_PLATFORM_SEC = x ; then
1038 CC="$MPI_CC this will surely fail"
1039else
1040 CC=$MPI_CC
1041fi
1042CFLAGS=$mflag_secondary
1043AC_TRY_LINK([
1044#include <mpi.h>
1045#include <stdio.h>
1046],[
1047 int r = MPI_Init(NULL,NULL);
1048 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1049 return r;
1050], [
1051ac_have_mpi2_sec=yes
1052AC_MSG_RESULT([yes, $MPI_CC])
1053], [
1054ac_have_mpi2_sec=no
1055AC_MSG_RESULT([no])
1056])
1057CC=$saved_CC
1058CFLAGS=$saved_CFLAGS
1059AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001060
1061
1062# -------------------- ok. We're done. --------------------
1063
gobrye721a522002-03-22 13:38:30 +00001064AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001065 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001066 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001067 valgrind.pc
njn254d542432002-09-23 16:09:39 +00001068 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001069 docs/lib/Makefile
1070 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001071 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001072 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001073 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001074 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001075 perf/Makefile
1076 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001077 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001078 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001079 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001080 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001081 memcheck/Makefile
1082 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001083 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001084 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001085 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001086 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001087 memcheck/docs/Makefile
1088 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001089 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001090 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001091 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001092 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001093 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001094 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001095 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001096 callgrind/Makefile
1097 callgrind/callgrind_annotate
1098 callgrind/callgrind_control
1099 callgrind/tests/Makefile
1100 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001101 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001102 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001103 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001104 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001105 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001106 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001107 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001108 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001109 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001110 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001111 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001112 none/Makefile
1113 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001114 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001115 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001116 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001117 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +00001118 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001119 exp-omega/Makefile
1120 exp-omega/tests/Makefile
1121 exp-omega/docs/Makefile
sewardjbbec7722007-11-25 14:08:53 +00001122 exp-drd/Makefile
1123 exp-drd/docs/Makefile
1124 exp-drd/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001125)
gobry3b777892002-04-04 09:18:39 +00001126
1127cat<<EOF
1128
sewardj01262142006-01-04 01:20:28 +00001129 Primary build target: ${VG_PLATFORM_PRI}
sewardj80637752006-03-02 13:48:21 +00001130 Secondary build target: ${VG_PLATFORM_SEC}
sewardj01262142006-01-04 01:20:28 +00001131 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001132
gobry3b777892002-04-04 09:18:39 +00001133EOF
1134
1135cat<<EOF > default.supp
1136# This is a generated file, composed of the following suppression rules:
1137#
1138# ${DEFAULT_SUPP}
1139#
1140
1141EOF
1142
1143for file in ${DEFAULT_SUPP} ; do
1144 cat ${srcdir}/$file >> default.supp
1145done