blob: 90f729c7acb540f83523130205e9cde3456c0bf0 [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
sewardj03d86f22006-10-17 00:57:24 +0000401libc=""
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],
sewardj03d86f22006-10-17 00:57:24 +0000411libc="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],
sewardj03d86f22006-10-17 00:57:24 +0000421libc="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],
sewardj03d86f22006-10-17 00:57:24 +0000431libc="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],
sewardj03d86f22006-10-17 00:57:24 +0000441libc="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],
451libc="2.6")
452
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],
461libc="2.7")
462
sewardj03d86f22006-10-17 00:57:24 +0000463AC_EGREP_CPP([AIX5_LIBC], [
464#include <standards.h>
465#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
466 AIX5_LIBC
467#endif
468],
469libc="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000470
sewardj03d86f22006-10-17 00:57:24 +0000471AC_MSG_CHECKING([the libc version])
472
473case "${libc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000474 2.2)
475 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000476 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000477 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
478 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000479 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000480 ;;
481
sewardj08c7f012002-10-07 23:56:55 +0000482 2.3)
483 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000484 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000485 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000486 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000487 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000488 ;;
489
njn781dba52005-06-30 04:06:38 +0000490 2.4)
491 AC_MSG_RESULT(2.4 family)
492 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000493 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000494 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000495 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000496 ;;
497
dirkaece45c2006-10-12 08:17:49 +0000498 2.5)
499 AC_MSG_RESULT(2.5 family)
500 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000501 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000502 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000503 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000504 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000505 2.6)
506 AC_MSG_RESULT(2.6 family)
507 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000508 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000509 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000510 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000511 ;;
512 2.7)
513 AC_MSG_RESULT(2.7 family)
514 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
515 DEFAULT_SUPP="glibc-2.7.supp ${DEFAULT_SUPP}"
516 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000517 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000518 ;;
sewardj03d86f22006-10-17 00:57:24 +0000519 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000520 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
521 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 +0000522 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
523 ;;
dirkaece45c2006-10-12 08:17:49 +0000524
sewardjde4a1d02002-03-22 01:27:54 +0000525 *)
526 AC_MSG_RESULT(unsupported version)
sewardj68c80c12007-11-18 14:40:02 +0000527 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.7])
sewardj2f3bcd22006-12-12 01:38:15 +0000528 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 libc])
sewardjde4a1d02002-03-22 01:27:54 +0000529 ;;
530esac
531
sewardj535c50f2005-06-04 23:14:53 +0000532
nethercote3d260f62004-10-31 19:39:18 +0000533# We don't know how to detect the X client library version
sewardj03d86f22006-10-17 00:57:24 +0000534# (detecting the server version is easy, but no help). So we
nethercote3d260f62004-10-31 19:39:18 +0000535# just use a hack: always include the suppressions for both
536# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000537AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000538if test "${no_x}" != 'yes' ; then
sewardj01262142006-01-04 01:20:28 +0000539 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
540 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000541fi
542
sewardj2e10a682003-04-07 19:36:41 +0000543
bart5e389f12008-04-05 12:53:15 +0000544# Check whether pthread_mutex_t has a member called __m_kind.
545
546AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
547
548AC_COMPILE_IFELSE(
549[
550#include <pthread.h>
551int main(int argc, char** argv)
552{
553 pthread_mutex_t m;
554 return m.__m_kind;
555}
556],
557[
558AC_MSG_RESULT([yes])
559AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
560 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
561], [
562AC_MSG_RESULT([no])
563])
564
565
566# Check whether pthread_mutex_t has a member called __data.__kind.
567
568AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
569
570AC_COMPILE_IFELSE(
571[
572#include <pthread.h>
573int main(int argc, char** argv)
574{
575 pthread_mutex_t m;
576 return m.__data.__kind;
577}
578],
579[
580AC_MSG_RESULT([yes])
581AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
582 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
583], [
584AC_MSG_RESULT([no])
585])
586
587
bart61111332008-03-10 17:57:41 +0000588# does this compiler support -fopenmp, does it have the include file
589# <omp.h> and does it have libgomp ?
bart29cc9db2008-03-09 15:59:30 +0000590
bart1f52b822008-03-12 17:11:48 +0000591AC_MSG_CHECKING([for OpenMP])
592
bart29cc9db2008-03-09 15:59:30 +0000593safe_CFLAGS=$CFLAGS
594CFLAGS="-fopenmp"
595
bart1f52b822008-03-12 17:11:48 +0000596AC_LINK_IFELSE(
bart29cc9db2008-03-09 15:59:30 +0000597[
bart1f52b822008-03-12 17:11:48 +0000598#include <omp.h>
599int main(int argc, char** argv)
600{
601 omp_set_dynamic(0);
602 return 0;
603}
604],
605[
606ac_have_openmp=yes
bart29cc9db2008-03-09 15:59:30 +0000607AC_MSG_RESULT([yes])
608], [
bart1f52b822008-03-12 17:11:48 +0000609ac_have_openmp=no
bart29cc9db2008-03-09 15:59:30 +0000610AC_MSG_RESULT([no])
611])
612CFLAGS=$safe_CFLAGS
613
bart1f52b822008-03-12 17:11:48 +0000614AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
bart29cc9db2008-03-09 15:59:30 +0000615
616
sewardj535c50f2005-06-04 23:14:53 +0000617# does this compiler support -m32 ?
618AC_MSG_CHECKING([if gcc accepts -m32])
619
620safe_CFLAGS=$CFLAGS
621CFLAGS="-m32"
622
623AC_TRY_COMPILE(, [
624int main () { return 0 ; }
625],
626[
627FLAG_M32="-m32"
628AC_MSG_RESULT([yes])
629], [
630FLAG_M32=""
631AC_MSG_RESULT([no])
632])
633CFLAGS=$safe_CFLAGS
634
635AC_SUBST(FLAG_M32)
636
637
sewardj03d86f22006-10-17 00:57:24 +0000638# does this compiler support -maix32 ?
639AC_MSG_CHECKING([if gcc accepts -maix32])
640
641safe_CFLAGS=$CFLAGS
642CFLAGS="-maix32"
643
644AC_TRY_COMPILE(, [
645int main () { return 0 ; }
646],
647[
648FLAG_MAIX32="-maix32"
649AC_MSG_RESULT([yes])
650], [
651FLAG_MAIX32=""
652AC_MSG_RESULT([no])
653])
654CFLAGS=$safe_CFLAGS
655
656AC_SUBST(FLAG_MAIX32)
657
658
sewardj01262142006-01-04 01:20:28 +0000659# does this compiler support -m64 ?
660AC_MSG_CHECKING([if gcc accepts -m64])
661
662safe_CFLAGS=$CFLAGS
663CFLAGS="-m64"
664
665AC_TRY_COMPILE(, [
666int main () { return 0 ; }
667],
668[
669FLAG_M64="-m64"
670AC_MSG_RESULT([yes])
671], [
672FLAG_M64=""
673AC_MSG_RESULT([no])
674])
675CFLAGS=$safe_CFLAGS
676
677AC_SUBST(FLAG_M64)
678
679
sewardj03d86f22006-10-17 00:57:24 +0000680# does this compiler support -maix64 ?
681AC_MSG_CHECKING([if gcc accepts -maix64])
682
683safe_CFLAGS=$CFLAGS
684CFLAGS="-maix64"
685
686AC_TRY_COMPILE(, [
687int main () { return 0 ; }
688],
689[
690FLAG_MAIX64="-maix64"
691AC_MSG_RESULT([yes])
692], [
693FLAG_MAIX64=""
694AC_MSG_RESULT([no])
695])
696CFLAGS=$safe_CFLAGS
697
698AC_SUBST(FLAG_MAIX64)
699
700
sewardj67f1fcc2005-07-03 10:41:02 +0000701# does this compiler support -mmmx ?
702AC_MSG_CHECKING([if gcc accepts -mmmx])
703
704safe_CFLAGS=$CFLAGS
705CFLAGS="-mmmx"
706
707AC_TRY_COMPILE(, [
708int main () { return 0 ; }
709],
710[
711FLAG_MMMX="-mmmx"
712AC_MSG_RESULT([yes])
713], [
714FLAG_MMMX=""
715AC_MSG_RESULT([no])
716])
717CFLAGS=$safe_CFLAGS
718
719AC_SUBST(FLAG_MMMX)
720
721
722# does this compiler support -msse ?
723AC_MSG_CHECKING([if gcc accepts -msse])
724
725safe_CFLAGS=$CFLAGS
726CFLAGS="-msse"
727
728AC_TRY_COMPILE(, [
729int main () { return 0 ; }
730],
731[
732FLAG_MSSE="-msse"
733AC_MSG_RESULT([yes])
734], [
735FLAG_MSSE=""
736AC_MSG_RESULT([no])
737])
738CFLAGS=$safe_CFLAGS
739
740AC_SUBST(FLAG_MSSE)
741
742
sewardj5b754b42002-06-03 22:53:35 +0000743# does this compiler support -mpreferred-stack-boundary=2 ?
744AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
745
daywalker3664f562003-10-17 13:43:46 +0000746safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000747CFLAGS="-mpreferred-stack-boundary=2"
748
749AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000750int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000751],
752[
753PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000754AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000755], [
756PREFERRED_STACK_BOUNDARY=""
757AC_MSG_RESULT([no])
758])
daywalker3664f562003-10-17 13:43:46 +0000759CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000760
761AC_SUBST(PREFERRED_STACK_BOUNDARY)
762
sewardj535c50f2005-06-04 23:14:53 +0000763
sewardjb5f6f512005-03-10 23:59:00 +0000764# does this compiler support -Wno-pointer-sign ?
765AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
766
767safe_CFLAGS=$CFLAGS
768CFLAGS="-Wno-pointer-sign"
769
770AC_TRY_COMPILE(, [
771int main () { return 0 ; }
772],
773[
774no_pointer_sign=yes
775AC_MSG_RESULT([yes])
776], [
777no_pointer_sign=no
778AC_MSG_RESULT([no])
779])
780CFLAGS=$safe_CFLAGS
781
782if test x$no_pointer_sign = xyes; then
783 CFLAGS="$CFLAGS -Wno-pointer-sign"
784fi
785
sewardj535c50f2005-06-04 23:14:53 +0000786
tom1e946682005-10-12 11:27:33 +0000787# does this compiler support -Wdeclaration-after-statement ?
788AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ])
789
790safe_CFLAGS=$CFLAGS
791CFLAGS="-Wdeclaration-after-statement"
792
793AC_TRY_COMPILE(, [
794int main () { return 0 ; }
795],
796[
tome9814c32005-10-12 11:30:43 +0000797declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +0000798FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +0000799AC_MSG_RESULT([yes])
800], [
tome9814c32005-10-12 11:30:43 +0000801declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +0000802FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +0000803AC_MSG_RESULT([no])
804])
805CFLAGS=$safe_CFLAGS
806
sewardj72a547e2006-01-25 02:58:28 +0000807AC_SUBST(FLAG_WDECL_AFTER_STMT)
808
tome9814c32005-10-12 11:30:43 +0000809if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +0000810 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
811fi
812
sewardj00f1e622006-03-12 16:47:10 +0000813
sewardja72c26d2007-05-01 13:44:08 +0000814# does this compiler support -fno-stack-protector ?
815AC_MSG_CHECKING([if gcc accepts -fno-stack-protector ])
816
817safe_CFLAGS=$CFLAGS
818CFLAGS="-fno-stack-protector"
819
820AC_TRY_COMPILE(, [
821int main () { return 0 ; }
822],
823[
824no_stack_protector=yes
825FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
826AC_MSG_RESULT([yes])
827], [
828no_stack_protector=no
829FLAG_FNO_STACK_PROTECTOR=""
830AC_MSG_RESULT([no])
831])
832CFLAGS=$safe_CFLAGS
833
834AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
835
836if test x$no_stack_protector = xyes; then
837 CFLAGS="$CFLAGS -fno-stack-protector"
838fi
839
840
tomd55121e2005-12-19 12:40:13 +0000841# does this compiler support __builtin_expect?
842AC_MSG_CHECKING([if gcc supports __builtin_expect])
843
844AC_TRY_LINK(, [
845return __builtin_expect(1, 1) ? 1 : 0
846],
847[
848ac_have_builtin_expect=yes
849AC_MSG_RESULT([yes])
850], [
851ac_have_builtin_expect=no
852AC_MSG_RESULT([no])
853])
854if test x$ac_have_builtin_expect = xyes ; then
855 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
856fi
857
tom1e946682005-10-12 11:27:33 +0000858
sewardj00f1e622006-03-12 16:47:10 +0000859# does the ppc assembler support "mtocrf" et al?
860AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
861
862AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +0000863__asm__ __volatile__("mtocrf 4,0");
864__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +0000865],
866[
867ac_have_as_ppc_mftocrf=yes
868AC_MSG_RESULT([yes])
869], [
870ac_have_as_ppc_mftocrf=no
871AC_MSG_RESULT([no])
872])
873if test x$ac_have_as_ppc_mftocrf = xyes ; then
874 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
875fi
876
877
sewardjf0aabf82007-03-22 00:24:21 +0000878# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +0000879# Note, this doesn't generate a C-level symbol. It generates a
880# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +0000881AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
882
883AC_TRY_COMPILE(, [
884 do { long long int x;
885 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
886 while (0)
887],
888[
889ac_have_as_sse3=yes
890AC_MSG_RESULT([yes])
891], [
892ac_have_as_sse3=no
893AC_MSG_RESULT([no])
894])
sewardjfa18a262007-03-22 12:13:13 +0000895
896AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +0000897
898
sewardj6d6da5b2008-02-09 12:07:40 +0000899# Ditto for SSSE3 instructions (note extra S)
900# Note, this doesn't generate a C-level symbol. It generates a
901# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
902AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
903
904AC_TRY_COMPILE(, [
905 do { long long int x;
906 __asm__ __volatile__(
907 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
908 while (0)
909],
910[
911ac_have_as_ssse3=yes
912AC_MSG_RESULT([yes])
913], [
914ac_have_as_ssse3=no
915AC_MSG_RESULT([no])
916])
917
918AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
919
920
sewardjb5f6f512005-03-10 23:59:00 +0000921# Check for TLS support in the compiler and linker
922AC_CACHE_CHECK([for TLS support], vg_cv_tls,
923 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
924 [vg_cv_tls=$enableval],
925 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
926 [[return foo;]])],
927 [vg_cv_tls=yes],
928 [vg_cv_tls=no])])])
929
930if test "$vg_cv_tls" = yes; then
931AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
932fi
sewardj5b754b42002-06-03 22:53:35 +0000933
sewardj535c50f2005-06-04 23:14:53 +0000934
sewardjde4a1d02002-03-22 01:27:54 +0000935# Checks for header files.
936AC_HEADER_STDC
nethercote3d260f62004-10-31 19:39:18 +0000937AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
sewardjde4a1d02002-03-22 01:27:54 +0000938
sewardj535c50f2005-06-04 23:14:53 +0000939
sewardjde4a1d02002-03-22 01:27:54 +0000940# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000941AC_TYPE_UID_T
942AC_TYPE_OFF_T
943AC_TYPE_SIZE_T
944AC_HEADER_TIME
945
sewardj535c50f2005-06-04 23:14:53 +0000946
sewardjde4a1d02002-03-22 01:27:54 +0000947# Checks for library functions.
948AC_FUNC_MEMCMP
949AC_FUNC_MMAP
950AC_TYPE_SIGNAL
951
thughesbeb6eb92004-06-14 12:33:43 +0000952AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
sewardjde4a1d02002-03-22 01:27:54 +0000953
sewardj80637752006-03-02 13:48:21 +0000954
sewardj03d86f22006-10-17 00:57:24 +0000955# Do we have a useable MPI setup on the primary and/or secondary targets?
956# On Linux, by default, assumes mpicc and -m32/-m64
957# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +0000958# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +0000959# understands -m32/-m64/-q32/-q64 regardless of what is specified using
960# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +0000961MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +0000962if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
963 -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
964 MPI_CC="mpxlc"
965fi
966
sewardje9fa5062006-03-12 18:29:18 +0000967mflag_primary=
968if test x$VG_PLATFORM_PRI = xX86_LINUX \
969 -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then
970 mflag_primary=$FLAG_M32
971elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \
972 -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then
973 mflag_primary=$FLAG_M64
sewardj03d86f22006-10-17 00:57:24 +0000974elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then
975 mflag_primary=-q32
976elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
977 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +0000978fi
979
sewardj03d86f22006-10-17 00:57:24 +0000980mflag_secondary=
981if test x$VG_PLATFORM_SEC = xX86_LINUX \
982 -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then
983 mflag_secondary=$FLAG_M32
984elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then
985 mflag_secondary=-q32
986fi
987
988
sewardj0ad46092006-03-02 17:09:16 +0000989AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +0000990 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +0000991 MPI_CC=$withval
992)
sewardj03d86f22006-10-17 00:57:24 +0000993AC_SUBST(MPI_CC)
994
995## See if MPI_CC works for the primary target
996##
997AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +0000998saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +0000999saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001000CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001001CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001002AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001003#include <mpi.h>
1004#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001005],[
1006 int r = MPI_Init(NULL,NULL);
1007 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1008 return r;
1009], [
sewardj03d86f22006-10-17 00:57:24 +00001010ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001011AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001012], [
sewardj03d86f22006-10-17 00:57:24 +00001013ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001014AC_MSG_RESULT([no])
1015])
sewardj0ad46092006-03-02 17:09:16 +00001016CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001017CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001018AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001019
sewardj03d86f22006-10-17 00:57:24 +00001020## See if MPI_CC works for the secondary target. Complication: what if
1021## there is no secondary target? We need this to then fail.
1022## Kludge this by making MPI_CC something which will surely fail in
1023## such a case.
1024##
1025AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1026saved_CC=$CC
1027saved_CFLAGS=$CFLAGS
1028if test x$VG_PLATFORM_SEC = x ; then
1029 CC="$MPI_CC this will surely fail"
1030else
1031 CC=$MPI_CC
1032fi
1033CFLAGS=$mflag_secondary
1034AC_TRY_LINK([
1035#include <mpi.h>
1036#include <stdio.h>
1037],[
1038 int r = MPI_Init(NULL,NULL);
1039 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1040 return r;
1041], [
1042ac_have_mpi2_sec=yes
1043AC_MSG_RESULT([yes, $MPI_CC])
1044], [
1045ac_have_mpi2_sec=no
1046AC_MSG_RESULT([no])
1047])
1048CC=$saved_CC
1049CFLAGS=$saved_CFLAGS
1050AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001051
1052
1053# -------------------- ok. We're done. --------------------
1054
gobrye721a522002-03-22 13:38:30 +00001055AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001056 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001057 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001058 valgrind.pc
njn254d542432002-09-23 16:09:39 +00001059 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001060 docs/lib/Makefile
1061 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001062 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001063 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001064 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001065 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001066 perf/Makefile
1067 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001068 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001069 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001070 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001071 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001072 memcheck/Makefile
1073 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001074 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001075 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001076 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001077 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001078 memcheck/docs/Makefile
1079 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001080 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001081 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001082 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001083 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001084 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001085 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001086 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001087 callgrind/Makefile
1088 callgrind/callgrind_annotate
1089 callgrind/callgrind_control
1090 callgrind/tests/Makefile
1091 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001092 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001093 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001094 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001095 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001096 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001097 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001098 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001099 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001100 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001101 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001102 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001103 none/Makefile
1104 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001105 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001106 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001107 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001108 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +00001109 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001110 exp-omega/Makefile
1111 exp-omega/tests/Makefile
1112 exp-omega/docs/Makefile
sewardjbbec7722007-11-25 14:08:53 +00001113 exp-drd/Makefile
1114 exp-drd/docs/Makefile
1115 exp-drd/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001116)
gobry3b777892002-04-04 09:18:39 +00001117
1118cat<<EOF
1119
sewardj01262142006-01-04 01:20:28 +00001120 Primary build target: ${VG_PLATFORM_PRI}
sewardj80637752006-03-02 13:48:21 +00001121 Secondary build target: ${VG_PLATFORM_SEC}
sewardj01262142006-01-04 01:20:28 +00001122 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001123
gobry3b777892002-04-04 09:18:39 +00001124EOF
1125
1126cat<<EOF > default.supp
1127# This is a generated file, composed of the following suppression rules:
1128#
1129# ${DEFAULT_SUPP}
1130#
1131
1132EOF
1133
1134for file in ${DEFAULT_SUPP} ; do
1135 cat ${srcdir}/$file >> default.supp
1136done