blob: 318f9e4eaed535fa41690412066a41f57a9e80de [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.
njn0181c772005-11-28 16:45:45 +000011AC_INIT(Valgrind, 3.2.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)
thughes6dbad732004-08-29 09:46:38 +000014AM_INIT_AUTOMAKE
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
njnca0518d2004-11-26 19:34:36 +000058##AM_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
sewardjde4a1d02002-03-22 01:27:54 +0000111# Checks for the platform
112AC_CANONICAL_HOST
113
114AC_MSG_CHECKING([for a supported CPU])
nethercote888ecb72004-08-23 14:54:40 +0000115AC_SUBST(VG_ARCH)
sewardjbc692db2006-01-04 03:31:07 +0000116
sewardj9b0567a2006-01-17 02:56:18 +0000117AC_SUBST(VG_ARCH_ALL)
118VG_ARCH_ALL="amd64 ppc32 ppc64 x86"
119
sewardj45f4e7c2005-09-27 19:20:21 +0000120AC_SUBST(VALT_LOAD_ADDRESS)
sewardjde4a1d02002-03-22 01:27:54 +0000121
gobrye721a522002-03-22 13:38:30 +0000122case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000123 i?86)
124 AC_MSG_RESULT([ok (${host_cpu})])
nethercote888ecb72004-08-23 14:54:40 +0000125 VG_ARCH="x86"
sewardj45f4e7c2005-09-27 19:20:21 +0000126 valt_load_address_normal="0xb0000000"
127 valt_load_address_inner="0xa0000000"
sewardjde4a1d02002-03-22 01:27:54 +0000128 ;;
129
njnfe408942004-11-23 17:52:24 +0000130 x86_64)
131 AC_MSG_RESULT([ok (${host_cpu})])
132 VG_ARCH="amd64"
njnc6168192004-11-29 13:54:10 +0000133 # XXX: relocations under amd64's "small model" are 32-bit signed
njnfe408942004-11-23 17:52:24 +0000134 # quantities; therefore going above 0x7fffffff doesn't work... this is
135 # a problem.
sewardj45f4e7c2005-09-27 19:20:21 +0000136 valt_load_address_normal="0x70000000"
137 valt_load_address_inner="0x60000000"
njnfe408942004-11-23 17:52:24 +0000138 ;;
139
sewardj2c48c7b2005-11-29 13:05:56 +0000140 powerpc64)
141 AC_MSG_RESULT([ok (${host_cpu})])
142 VG_ARCH="ppc64"
143 valt_load_address_normal="0x70000000"
144 valt_load_address_inner="0x60000000"
145 ;;
146
147 powerpc)
cerion85665ca2005-06-20 15:51:07 +0000148 AC_MSG_RESULT([ok (${host_cpu})])
149 VG_ARCH="ppc32"
sewardj45f4e7c2005-09-27 19:20:21 +0000150 valt_load_address_normal="0x70000000"
151 valt_load_address_inner="0x60000000"
nethercote9bcc9062004-10-13 13:50:01 +0000152 ;;
153
sewardjde4a1d02002-03-22 01:27:54 +0000154 *)
155 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000156 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000157 ;;
158esac
159
sewardj45f4e7c2005-09-27 19:20:21 +0000160# Check if this should be built as an inner Valgrind, to be run within
161# another Valgrind. Choose the load address accordingly.
sewardj86e992f2006-01-28 18:39:09 +0000162AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
163 [AC_ARG_ENABLE(inner,
164 [ --enable-inner enables self-hosting],
165 [vg_cv_inner=$enableval],
166 [vg_cv_inner=no])])
sewardj45f4e7c2005-09-27 19:20:21 +0000167if test "$vg_cv_inner" = yes; then
168 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
169 VALT_LOAD_ADDRESS=$valt_load_address_inner
170else
171 VALT_LOAD_ADDRESS=$valt_load_address_normal
172fi
173
sewardj86e992f2006-01-28 18:39:09 +0000174# Sometimes it's convenient to subvert the bi-arch build system and
175# just have a single build even though the underlying platform is
176# capable of both. Hence handle --enable-only64bit and
177# --enable-only32bit. Complain if both are issued :-)
178
179# Check if a 64-bit only build has been requested
180AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
181 [AC_ARG_ENABLE(only64bit,
182 [ --enable-only64bit do a 64-bit only build],
183 [vg_cv_only64bit=$enableval],
184 [vg_cv_only64bit=no])])
185
186# Check if a 32-bit only build has been requested
187AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
188 [AC_ARG_ENABLE(only32bit,
189 [ --enable-only32bit do a 32-bit only build],
190 [vg_cv_only32bit=$enableval],
191 [vg_cv_only32bit=no])])
192
193# Stay sane
194if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
195 AC_MSG_ERROR(
196 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
197fi
198
199
200
sewardjde4a1d02002-03-22 01:27:54 +0000201AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000202AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000203
gobrye721a522002-03-22 13:38:30 +0000204case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000205 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000206 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000207 VG_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000208
209 # Ok, this is linux. Check the kernel version
210 AC_MSG_CHECKING([for the kernel version])
211
212 kernel=`uname -r`
213
214 case "${kernel}" in
215 2.6.*)
216 AC_MSG_RESULT([2.6 family (${kernel})])
217 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
218 ;;
219
220 2.4.*)
221 AC_MSG_RESULT([2.4 family (${kernel})])
222 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
223 ;;
224
mueller8c68e042004-01-03 15:21:14 +0000225 *)
226 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000227 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000228 ;;
229 esac
230
231 ;;
232
233 *freebsd*)
234 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000235 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000236 ;;
237
238 *)
239 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000240 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000241 ;;
242esac
243
nethercote888ecb72004-08-23 14:54:40 +0000244
sewardj01262142006-01-04 01:20:28 +0000245# Establish VG_PLATFORM_PRI. This is the primary build target. The
246# entire system, including regression and performance tests, will be
sewardjbc692db2006-01-04 03:31:07 +0000247# built for this target.
sewardj01262142006-01-04 01:20:28 +0000248#
sewardjbc692db2006-01-04 03:31:07 +0000249# Also establish VG_PLATFORM_SEC, the secondary build target, if
sewardj01262142006-01-04 01:20:28 +0000250# possible. The system will also be built for this target, but not
sewardjbc692db2006-01-04 03:31:07 +0000251# the regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000252#
253AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000254
sewardj01262142006-01-04 01:20:28 +0000255AC_SUBST(VG_PLATFORM_PRI)
256AC_SUBST(VG_PLATFORM_SEC)
257
258case "$VG_ARCH-$VG_OS" in
259 x86-linux)
260 VG_PLATFORM_PRI="X86_LINUX"
261 VG_PLATFORM_SEC=""
sewardj3e38ce02004-11-23 01:17:29 +0000262 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000263 ;;
264 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000265 if test x$vg_cv_only64bit = xyes; then
266 VG_PLATFORM_PRI="AMD64_LINUX"
267 VG_PLATFORM_SEC=""
268 elif test x$vg_cv_only32bit = xyes; then
269 VG_PLATFORM_PRI="X86_LINUX"
270 VG_PLATFORM_SEC=""
271 else
272 VG_PLATFORM_PRI="AMD64_LINUX"
273 VG_PLATFORM_SEC="X86_LINUX"
274 fi
sewardj01262142006-01-04 01:20:28 +0000275 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
276 ;;
277 ppc32-linux)
278 VG_PLATFORM_PRI="PPC32_LINUX"
279 VG_PLATFORM_SEC=""
280 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
281 ;;
282 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000283 if test x$vg_cv_only64bit = xyes; then
284 VG_PLATFORM_PRI="PPC64_LINUX"
285 VG_PLATFORM_SEC=""
286 elif test x$vg_cv_only32bit = xyes; then
287 VG_PLATFORM_PRI="PPC32_LINUX"
288 VG_PLATFORM_SEC=""
289 else
290 VG_PLATFORM_PRI="PPC64_LINUX"
291 VG_PLATFORM_SEC="PPC32_LINUX"
292 fi
sewardj01262142006-01-04 01:20:28 +0000293 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
294 ;;
nethercote888ecb72004-08-23 14:54:40 +0000295 *)
sewardj01262142006-01-04 01:20:28 +0000296 VG_PLATFORM_PRI="unknown"
297 VG_PLATFORM_SEC="unknown"
nethercote888ecb72004-08-23 14:54:40 +0000298 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000299 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000300 ;;
301esac
sewardjde4a1d02002-03-22 01:27:54 +0000302
sewardj01262142006-01-04 01:20:28 +0000303# Set up VG_<platform>. Either one or two of these become defined.
304#
305AM_CONDITIONAL(VG_X86_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000306 test x$VG_PLATFORM_PRI = xX86_LINUX \
307 -o x$VG_PLATFORM_SEC = xX86_LINUX)
sewardj01262142006-01-04 01:20:28 +0000308AM_CONDITIONAL(VG_AMD64_LINUX,
309 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
310AM_CONDITIONAL(VG_PPC32_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000311 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
312 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
sewardj01262142006-01-04 01:20:28 +0000313AM_CONDITIONAL(VG_PPC64_LINUX,
314 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
tomfb7bcde2005-11-07 15:24:38 +0000315
tomb637bad2005-11-08 12:28:35 +0000316
sewardj01262142006-01-04 01:20:28 +0000317# This variable will collect the individual suppression files
318# depending on the results of autoconf
319DEFAULT_SUPP=""
sewardjde4a1d02002-03-22 01:27:54 +0000320AC_SUBST(DEFAULT_SUPP)
321
sewardj01262142006-01-04 01:20:28 +0000322
sewardjde4a1d02002-03-22 01:27:54 +0000323glibc=""
324
sewardjde4a1d02002-03-22 01:27:54 +0000325AC_EGREP_CPP([GLIBC_22], [
326#include <features.h>
327#ifdef __GNU_LIBRARY__
328 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
329 GLIBC_22
330 #endif
331#endif
332],
333glibc="2.2")
334
sewardj08c7f012002-10-07 23:56:55 +0000335AC_EGREP_CPP([GLIBC_23], [
336#include <features.h>
337#ifdef __GNU_LIBRARY__
338 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
339 GLIBC_23
340 #endif
341#endif
342],
343glibc="2.3")
344
njn781dba52005-06-30 04:06:38 +0000345AC_EGREP_CPP([GLIBC_24], [
346#include <features.h>
347#ifdef __GNU_LIBRARY__
348 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
349 GLIBC_24
350 #endif
351#endif
352],
353glibc="2.4")
354
daywalkere9212b32003-06-15 22:39:15 +0000355AC_MSG_CHECKING([the glibc version])
356
gobrye721a522002-03-22 13:38:30 +0000357case "${glibc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000358 2.2)
359 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000360 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj01262142006-01-04 01:20:28 +0000361 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000362 ;;
363
sewardj08c7f012002-10-07 23:56:55 +0000364 2.3)
365 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000366 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj01262142006-01-04 01:20:28 +0000367 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000368 ;;
369
njn781dba52005-06-30 04:06:38 +0000370 2.4)
371 AC_MSG_RESULT(2.4 family)
372 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj01262142006-01-04 01:20:28 +0000373 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000374 ;;
375
sewardjde4a1d02002-03-22 01:27:54 +0000376 *)
377 AC_MSG_RESULT(unsupported version)
sewardj3080a862005-07-03 10:18:33 +0000378 AC_MSG_ERROR([Valgrind requires glibc version 2.2, 2.3 or 2.4])
sewardjde4a1d02002-03-22 01:27:54 +0000379 ;;
380esac
381
sewardj535c50f2005-06-04 23:14:53 +0000382
nethercote3d260f62004-10-31 19:39:18 +0000383# We don't know how to detect the X client library version
384# (detecting the server version is easy, bu no help). So we
385# just use a hack: always include the suppressions for both
386# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000387AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000388if test "${no_x}" != 'yes' ; then
sewardj01262142006-01-04 01:20:28 +0000389 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
390 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000391fi
392
sewardj2e10a682003-04-07 19:36:41 +0000393
sewardj535c50f2005-06-04 23:14:53 +0000394# does this compiler support -m32 ?
395AC_MSG_CHECKING([if gcc accepts -m32])
396
397safe_CFLAGS=$CFLAGS
398CFLAGS="-m32"
399
400AC_TRY_COMPILE(, [
401int main () { return 0 ; }
402],
403[
404FLAG_M32="-m32"
405AC_MSG_RESULT([yes])
406], [
407FLAG_M32=""
408AC_MSG_RESULT([no])
409])
410CFLAGS=$safe_CFLAGS
411
412AC_SUBST(FLAG_M32)
413
414
sewardj01262142006-01-04 01:20:28 +0000415# does this compiler support -m64 ?
416AC_MSG_CHECKING([if gcc accepts -m64])
417
418safe_CFLAGS=$CFLAGS
419CFLAGS="-m64"
420
421AC_TRY_COMPILE(, [
422int main () { return 0 ; }
423],
424[
425FLAG_M64="-m64"
426AC_MSG_RESULT([yes])
427], [
428FLAG_M64=""
429AC_MSG_RESULT([no])
430])
431CFLAGS=$safe_CFLAGS
432
433AC_SUBST(FLAG_M64)
434
435
sewardj67f1fcc2005-07-03 10:41:02 +0000436# does this compiler support -mmmx ?
437AC_MSG_CHECKING([if gcc accepts -mmmx])
438
439safe_CFLAGS=$CFLAGS
440CFLAGS="-mmmx"
441
442AC_TRY_COMPILE(, [
443int main () { return 0 ; }
444],
445[
446FLAG_MMMX="-mmmx"
447AC_MSG_RESULT([yes])
448], [
449FLAG_MMMX=""
450AC_MSG_RESULT([no])
451])
452CFLAGS=$safe_CFLAGS
453
454AC_SUBST(FLAG_MMMX)
455
456
457# does this compiler support -msse ?
458AC_MSG_CHECKING([if gcc accepts -msse])
459
460safe_CFLAGS=$CFLAGS
461CFLAGS="-msse"
462
463AC_TRY_COMPILE(, [
464int main () { return 0 ; }
465],
466[
467FLAG_MSSE="-msse"
468AC_MSG_RESULT([yes])
469], [
470FLAG_MSSE=""
471AC_MSG_RESULT([no])
472])
473CFLAGS=$safe_CFLAGS
474
475AC_SUBST(FLAG_MSSE)
476
477
sewardj5b754b42002-06-03 22:53:35 +0000478# does this compiler support -mpreferred-stack-boundary=2 ?
479AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
480
daywalker3664f562003-10-17 13:43:46 +0000481safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000482CFLAGS="-mpreferred-stack-boundary=2"
483
484AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000485int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000486],
487[
488PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000489AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000490], [
491PREFERRED_STACK_BOUNDARY=""
492AC_MSG_RESULT([no])
493])
daywalker3664f562003-10-17 13:43:46 +0000494CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000495
496AC_SUBST(PREFERRED_STACK_BOUNDARY)
497
sewardj535c50f2005-06-04 23:14:53 +0000498
sewardjb5f6f512005-03-10 23:59:00 +0000499# does this compiler support -Wno-pointer-sign ?
500AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
501
502safe_CFLAGS=$CFLAGS
503CFLAGS="-Wno-pointer-sign"
504
505AC_TRY_COMPILE(, [
506int main () { return 0 ; }
507],
508[
509no_pointer_sign=yes
510AC_MSG_RESULT([yes])
511], [
512no_pointer_sign=no
513AC_MSG_RESULT([no])
514])
515CFLAGS=$safe_CFLAGS
516
517if test x$no_pointer_sign = xyes; then
518 CFLAGS="$CFLAGS -Wno-pointer-sign"
519fi
520
sewardj535c50f2005-06-04 23:14:53 +0000521
tom1e946682005-10-12 11:27:33 +0000522# does this compiler support -Wdeclaration-after-statement ?
523AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ])
524
525safe_CFLAGS=$CFLAGS
526CFLAGS="-Wdeclaration-after-statement"
527
528AC_TRY_COMPILE(, [
529int main () { return 0 ; }
530],
531[
tome9814c32005-10-12 11:30:43 +0000532declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +0000533FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +0000534AC_MSG_RESULT([yes])
535], [
tome9814c32005-10-12 11:30:43 +0000536declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +0000537FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +0000538AC_MSG_RESULT([no])
539])
540CFLAGS=$safe_CFLAGS
541
sewardj72a547e2006-01-25 02:58:28 +0000542AC_SUBST(FLAG_WDECL_AFTER_STMT)
543
tome9814c32005-10-12 11:30:43 +0000544if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +0000545 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
546fi
547
tomd55121e2005-12-19 12:40:13 +0000548# does this compiler support __builtin_expect?
549AC_MSG_CHECKING([if gcc supports __builtin_expect])
550
551AC_TRY_LINK(, [
552return __builtin_expect(1, 1) ? 1 : 0
553],
554[
555ac_have_builtin_expect=yes
556AC_MSG_RESULT([yes])
557], [
558ac_have_builtin_expect=no
559AC_MSG_RESULT([no])
560])
561if test x$ac_have_builtin_expect = xyes ; then
562 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
563fi
564
tom1e946682005-10-12 11:27:33 +0000565
sewardjb5f6f512005-03-10 23:59:00 +0000566# Check for TLS support in the compiler and linker
567AC_CACHE_CHECK([for TLS support], vg_cv_tls,
568 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
569 [vg_cv_tls=$enableval],
570 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
571 [[return foo;]])],
572 [vg_cv_tls=yes],
573 [vg_cv_tls=no])])])
574
575if test "$vg_cv_tls" = yes; then
576AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
577fi
sewardj5b754b42002-06-03 22:53:35 +0000578
sewardj535c50f2005-06-04 23:14:53 +0000579
sewardjde4a1d02002-03-22 01:27:54 +0000580# Checks for header files.
581AC_HEADER_STDC
nethercote3d260f62004-10-31 19:39:18 +0000582AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
sewardjde4a1d02002-03-22 01:27:54 +0000583
sewardj535c50f2005-06-04 23:14:53 +0000584
sewardjde4a1d02002-03-22 01:27:54 +0000585# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000586AC_TYPE_UID_T
587AC_TYPE_OFF_T
588AC_TYPE_SIZE_T
589AC_HEADER_TIME
590
sewardj535c50f2005-06-04 23:14:53 +0000591
sewardjde4a1d02002-03-22 01:27:54 +0000592# Checks for library functions.
593AC_FUNC_MEMCMP
594AC_FUNC_MMAP
595AC_TYPE_SIGNAL
596
thughesbeb6eb92004-06-14 12:33:43 +0000597AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
sewardjde4a1d02002-03-22 01:27:54 +0000598
sewardj80637752006-03-02 13:48:21 +0000599
sewardj1a85e602006-03-08 15:26:10 +0000600# Do we have a useable MPI setup (mpicc, and suitable MPI2 headers?)
sewardj0ad46092006-03-02 17:09:16 +0000601MPI_CC="mpicc"
602AC_ARG_WITH(mpicc,
sewardj1a85e602006-03-08 15:26:10 +0000603 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +0000604 MPI_CC=$withval
605)
sewardj1a85e602006-03-08 15:26:10 +0000606AC_MSG_CHECKING([for usable MPI2-compliant mpicc and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +0000607saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +0000608saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +0000609CC=$MPI_CC
sewardjde4f3842006-03-09 02:41:41 +0000610CFLAGS=
sewardjd3fcc642006-03-09 02:49:56 +0000611AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +0000612#include <mpi.h>
613#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +0000614],[
615 int r = MPI_Init(NULL,NULL);
616 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
617 return r;
618], [
sewardj1a85e602006-03-08 15:26:10 +0000619ac_have_mpi2=yes
620AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +0000621], [
sewardj1a85e602006-03-08 15:26:10 +0000622ac_have_mpi2=no
sewardj80637752006-03-02 13:48:21 +0000623AC_MSG_RESULT([no])
624])
sewardj0ad46092006-03-02 17:09:16 +0000625CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +0000626CFLAGS=$saved_CFLAGS
sewardj80637752006-03-02 13:48:21 +0000627
sewardj1a85e602006-03-08 15:26:10 +0000628AM_CONDITIONAL(BUILD_MPIWRAP, test x$ac_have_mpi2 = xyes)
sewardj0ad46092006-03-02 17:09:16 +0000629AC_SUBST(MPI_CC)
sewardj80637752006-03-02 13:48:21 +0000630
631
632# -------------------- ok. We're done. --------------------
633
gobrye721a522002-03-22 13:38:30 +0000634AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +0000635 Makefile
njn25cac76cb2002-09-23 11:21:57 +0000636 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +0000637 valgrind.pc
njn254d542432002-09-23 16:09:39 +0000638 docs/Makefile
njn3e986b22004-11-30 10:43:45 +0000639 docs/lib/Makefile
640 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +0000641 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +0000642 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +0000643 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +0000644 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +0000645 perf/Makefile
646 perf/vg_perf
njn254d542432002-09-23 16:09:39 +0000647 include/Makefile
njn7a6e7462002-11-09 17:53:30 +0000648 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +0000649 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000650 addrcheck/Makefile
njnf2df9b52002-10-04 11:35:47 +0000651 addrcheck/tests/Makefile
njn7da8fa72002-10-03 10:38:40 +0000652 addrcheck/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000653 memcheck/Makefile
654 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000655 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000656 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000657 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000658 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000659 memcheck/docs/Makefile
660 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000661 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000662 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000663 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000664 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000665 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000666 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +0000667 cachegrind/cg_annotate
njn25cac76cb2002-09-23 11:21:57 +0000668 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +0000669 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +0000670 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +0000671 massif/Makefile
672 massif/hp2ps/Makefile
673 massif/tests/Makefile
674 massif/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000675 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +0000676 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +0000677 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000678 none/Makefile
679 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000680 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000681 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000682 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000683 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +0000684 none/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000685)
gobry3b777892002-04-04 09:18:39 +0000686
687cat<<EOF
688
sewardj01262142006-01-04 01:20:28 +0000689 Primary build target: ${VG_PLATFORM_PRI}
sewardj80637752006-03-02 13:48:21 +0000690 Secondary build target: ${VG_PLATFORM_SEC}
sewardj01262142006-01-04 01:20:28 +0000691 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +0000692
gobry3b777892002-04-04 09:18:39 +0000693EOF
694
695cat<<EOF > default.supp
696# This is a generated file, composed of the following suppression rules:
697#
698# ${DEFAULT_SUPP}
699#
700
701EOF
702
703for file in ${DEFAULT_SUPP} ; do
704 cat ${srcdir}/$file >> default.supp
705done