blob: 6316ed156d9e94a07e096e637ebd7b0d68cd5776 [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
sewardj45f4e7c2005-09-27 19:20:21 +0000117AC_SUBST(VALT_LOAD_ADDRESS)
sewardjde4a1d02002-03-22 01:27:54 +0000118
gobrye721a522002-03-22 13:38:30 +0000119case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000120 i?86)
121 AC_MSG_RESULT([ok (${host_cpu})])
nethercote888ecb72004-08-23 14:54:40 +0000122 VG_ARCH="x86"
sewardj45f4e7c2005-09-27 19:20:21 +0000123 valt_load_address_normal="0xb0000000"
124 valt_load_address_inner="0xa0000000"
sewardjde4a1d02002-03-22 01:27:54 +0000125 ;;
126
njnfe408942004-11-23 17:52:24 +0000127 x86_64)
128 AC_MSG_RESULT([ok (${host_cpu})])
129 VG_ARCH="amd64"
njnc6168192004-11-29 13:54:10 +0000130 # XXX: relocations under amd64's "small model" are 32-bit signed
njnfe408942004-11-23 17:52:24 +0000131 # quantities; therefore going above 0x7fffffff doesn't work... this is
132 # a problem.
sewardj45f4e7c2005-09-27 19:20:21 +0000133 valt_load_address_normal="0x70000000"
134 valt_load_address_inner="0x60000000"
njnfe408942004-11-23 17:52:24 +0000135 ;;
136
sewardj2c48c7b2005-11-29 13:05:56 +0000137 powerpc64)
138 AC_MSG_RESULT([ok (${host_cpu})])
139 VG_ARCH="ppc64"
140 valt_load_address_normal="0x70000000"
141 valt_load_address_inner="0x60000000"
142 ;;
143
144 powerpc)
cerion85665ca2005-06-20 15:51:07 +0000145 AC_MSG_RESULT([ok (${host_cpu})])
146 VG_ARCH="ppc32"
sewardj45f4e7c2005-09-27 19:20:21 +0000147 valt_load_address_normal="0x70000000"
148 valt_load_address_inner="0x60000000"
nethercote9bcc9062004-10-13 13:50:01 +0000149 ;;
150
sewardjde4a1d02002-03-22 01:27:54 +0000151 *)
152 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000153 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000154 ;;
155esac
156
sewardj45f4e7c2005-09-27 19:20:21 +0000157# Check if this should be built as an inner Valgrind, to be run within
158# another Valgrind. Choose the load address accordingly.
159AC_CACHE_CHECK([enable use as an inner Valgrind], vg_cv_inner,
160 [AC_ARG_ENABLE(inner, [ --enable-inner enables self-hosting],
161 [vg_cv_inner=$enableval],
162 [vg_cv_inner=no])])
163if test "$vg_cv_inner" = yes; then
164 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
165 VALT_LOAD_ADDRESS=$valt_load_address_inner
166else
167 VALT_LOAD_ADDRESS=$valt_load_address_normal
168fi
169
sewardjde4a1d02002-03-22 01:27:54 +0000170AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000171AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000172
gobrye721a522002-03-22 13:38:30 +0000173case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000174 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000175 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000176 VG_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000177
178 # Ok, this is linux. Check the kernel version
179 AC_MSG_CHECKING([for the kernel version])
180
181 kernel=`uname -r`
182
183 case "${kernel}" in
184 2.6.*)
185 AC_MSG_RESULT([2.6 family (${kernel})])
186 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
187 ;;
188
189 2.4.*)
190 AC_MSG_RESULT([2.4 family (${kernel})])
191 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
192 ;;
193
mueller8c68e042004-01-03 15:21:14 +0000194 *)
195 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000196 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000197 ;;
198 esac
199
200 ;;
201
202 *freebsd*)
203 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000204 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000205 ;;
206
207 *)
208 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000209 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000210 ;;
211esac
212
nethercote888ecb72004-08-23 14:54:40 +0000213
sewardj01262142006-01-04 01:20:28 +0000214# Establish VG_PLATFORM_PRI. This is the primary build target. The
215# entire system, including regression and performance tests, will be
sewardjbc692db2006-01-04 03:31:07 +0000216# built for this target.
sewardj01262142006-01-04 01:20:28 +0000217#
sewardjbc692db2006-01-04 03:31:07 +0000218# Also establish VG_PLATFORM_SEC, the secondary build target, if
sewardj01262142006-01-04 01:20:28 +0000219# possible. The system will also be built for this target, but not
sewardjbc692db2006-01-04 03:31:07 +0000220# the regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000221#
222AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000223
sewardj01262142006-01-04 01:20:28 +0000224AC_SUBST(VG_PLATFORM_PRI)
225AC_SUBST(VG_PLATFORM_SEC)
226
227case "$VG_ARCH-$VG_OS" in
228 x86-linux)
229 VG_PLATFORM_PRI="X86_LINUX"
230 VG_PLATFORM_SEC=""
sewardj3e38ce02004-11-23 01:17:29 +0000231 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000232 ;;
233 amd64-linux)
234 VG_PLATFORM_PRI="AMD64_LINUX"
235 VG_PLATFORM_SEC="X86_LINUX"
236 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
237 ;;
238 ppc32-linux)
239 VG_PLATFORM_PRI="PPC32_LINUX"
240 VG_PLATFORM_SEC=""
241 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
242 ;;
243 ppc64-linux)
244 VG_PLATFORM_PRI="PPC64_LINUX"
245 VG_PLATFORM_SEC="PPC32_LINUX"
246 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
247 ;;
nethercote888ecb72004-08-23 14:54:40 +0000248 *)
sewardj01262142006-01-04 01:20:28 +0000249 VG_PLATFORM_PRI="unknown"
250 VG_PLATFORM_SEC="unknown"
nethercote888ecb72004-08-23 14:54:40 +0000251 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000252 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000253 ;;
254esac
sewardjde4a1d02002-03-22 01:27:54 +0000255
sewardj01262142006-01-04 01:20:28 +0000256# Set up VG_<platform>. Either one or two of these become defined.
257#
258AM_CONDITIONAL(VG_X86_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000259 test x$VG_PLATFORM_PRI = xX86_LINUX \
260 -o x$VG_PLATFORM_SEC = xX86_LINUX)
sewardj01262142006-01-04 01:20:28 +0000261AM_CONDITIONAL(VG_AMD64_LINUX,
262 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
263AM_CONDITIONAL(VG_PPC32_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000264 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
265 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
sewardj01262142006-01-04 01:20:28 +0000266AM_CONDITIONAL(VG_PPC64_LINUX,
267 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
tomfb7bcde2005-11-07 15:24:38 +0000268
tomb637bad2005-11-08 12:28:35 +0000269
sewardj01262142006-01-04 01:20:28 +0000270# This variable will collect the individual suppression files
271# depending on the results of autoconf
272DEFAULT_SUPP=""
sewardjde4a1d02002-03-22 01:27:54 +0000273AC_SUBST(DEFAULT_SUPP)
274
sewardj01262142006-01-04 01:20:28 +0000275
sewardjde4a1d02002-03-22 01:27:54 +0000276glibc=""
277
sewardjde4a1d02002-03-22 01:27:54 +0000278AC_EGREP_CPP([GLIBC_22], [
279#include <features.h>
280#ifdef __GNU_LIBRARY__
281 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
282 GLIBC_22
283 #endif
284#endif
285],
286glibc="2.2")
287
sewardj08c7f012002-10-07 23:56:55 +0000288AC_EGREP_CPP([GLIBC_23], [
289#include <features.h>
290#ifdef __GNU_LIBRARY__
291 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
292 GLIBC_23
293 #endif
294#endif
295],
296glibc="2.3")
297
njn781dba52005-06-30 04:06:38 +0000298AC_EGREP_CPP([GLIBC_24], [
299#include <features.h>
300#ifdef __GNU_LIBRARY__
301 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
302 GLIBC_24
303 #endif
304#endif
305],
306glibc="2.4")
307
daywalkere9212b32003-06-15 22:39:15 +0000308AC_MSG_CHECKING([the glibc version])
309
gobrye721a522002-03-22 13:38:30 +0000310case "${glibc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000311 2.2)
312 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000313 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj01262142006-01-04 01:20:28 +0000314 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000315 ;;
316
sewardj08c7f012002-10-07 23:56:55 +0000317 2.3)
318 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000319 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj01262142006-01-04 01:20:28 +0000320 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000321 ;;
322
njn781dba52005-06-30 04:06:38 +0000323 2.4)
324 AC_MSG_RESULT(2.4 family)
325 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj01262142006-01-04 01:20:28 +0000326 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000327 ;;
328
sewardjde4a1d02002-03-22 01:27:54 +0000329 *)
330 AC_MSG_RESULT(unsupported version)
sewardj3080a862005-07-03 10:18:33 +0000331 AC_MSG_ERROR([Valgrind requires glibc version 2.2, 2.3 or 2.4])
sewardjde4a1d02002-03-22 01:27:54 +0000332 ;;
333esac
334
sewardj535c50f2005-06-04 23:14:53 +0000335
nethercote3d260f62004-10-31 19:39:18 +0000336# We don't know how to detect the X client library version
337# (detecting the server version is easy, bu no help). So we
338# just use a hack: always include the suppressions for both
339# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000340AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000341if test "${no_x}" != 'yes' ; then
sewardj01262142006-01-04 01:20:28 +0000342 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
343 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000344fi
345
sewardj2e10a682003-04-07 19:36:41 +0000346
sewardj535c50f2005-06-04 23:14:53 +0000347# does this compiler support -m32 ?
348AC_MSG_CHECKING([if gcc accepts -m32])
349
350safe_CFLAGS=$CFLAGS
351CFLAGS="-m32"
352
353AC_TRY_COMPILE(, [
354int main () { return 0 ; }
355],
356[
357FLAG_M32="-m32"
358AC_MSG_RESULT([yes])
359], [
360FLAG_M32=""
361AC_MSG_RESULT([no])
362])
363CFLAGS=$safe_CFLAGS
364
365AC_SUBST(FLAG_M32)
366
367
sewardj01262142006-01-04 01:20:28 +0000368# does this compiler support -m64 ?
369AC_MSG_CHECKING([if gcc accepts -m64])
370
371safe_CFLAGS=$CFLAGS
372CFLAGS="-m64"
373
374AC_TRY_COMPILE(, [
375int main () { return 0 ; }
376],
377[
378FLAG_M64="-m64"
379AC_MSG_RESULT([yes])
380], [
381FLAG_M64=""
382AC_MSG_RESULT([no])
383])
384CFLAGS=$safe_CFLAGS
385
386AC_SUBST(FLAG_M64)
387
388
sewardj67f1fcc2005-07-03 10:41:02 +0000389# does this compiler support -mmmx ?
390AC_MSG_CHECKING([if gcc accepts -mmmx])
391
392safe_CFLAGS=$CFLAGS
393CFLAGS="-mmmx"
394
395AC_TRY_COMPILE(, [
396int main () { return 0 ; }
397],
398[
399FLAG_MMMX="-mmmx"
400AC_MSG_RESULT([yes])
401], [
402FLAG_MMMX=""
403AC_MSG_RESULT([no])
404])
405CFLAGS=$safe_CFLAGS
406
407AC_SUBST(FLAG_MMMX)
408
409
410# does this compiler support -msse ?
411AC_MSG_CHECKING([if gcc accepts -msse])
412
413safe_CFLAGS=$CFLAGS
414CFLAGS="-msse"
415
416AC_TRY_COMPILE(, [
417int main () { return 0 ; }
418],
419[
420FLAG_MSSE="-msse"
421AC_MSG_RESULT([yes])
422], [
423FLAG_MSSE=""
424AC_MSG_RESULT([no])
425])
426CFLAGS=$safe_CFLAGS
427
428AC_SUBST(FLAG_MSSE)
429
430
sewardj5b754b42002-06-03 22:53:35 +0000431# does this compiler support -mpreferred-stack-boundary=2 ?
432AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
433
daywalker3664f562003-10-17 13:43:46 +0000434safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000435CFLAGS="-mpreferred-stack-boundary=2"
436
437AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000438int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000439],
440[
441PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000442AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000443], [
444PREFERRED_STACK_BOUNDARY=""
445AC_MSG_RESULT([no])
446])
daywalker3664f562003-10-17 13:43:46 +0000447CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000448
449AC_SUBST(PREFERRED_STACK_BOUNDARY)
450
sewardj535c50f2005-06-04 23:14:53 +0000451
sewardjb5f6f512005-03-10 23:59:00 +0000452# does this compiler support -Wno-pointer-sign ?
453AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
454
455safe_CFLAGS=$CFLAGS
456CFLAGS="-Wno-pointer-sign"
457
458AC_TRY_COMPILE(, [
459int main () { return 0 ; }
460],
461[
462no_pointer_sign=yes
463AC_MSG_RESULT([yes])
464], [
465no_pointer_sign=no
466AC_MSG_RESULT([no])
467])
468CFLAGS=$safe_CFLAGS
469
470if test x$no_pointer_sign = xyes; then
471 CFLAGS="$CFLAGS -Wno-pointer-sign"
472fi
473
sewardj535c50f2005-06-04 23:14:53 +0000474
tom1e946682005-10-12 11:27:33 +0000475# does this compiler support -Wdeclaration-after-statement ?
476AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ])
477
478safe_CFLAGS=$CFLAGS
479CFLAGS="-Wdeclaration-after-statement"
480
481AC_TRY_COMPILE(, [
482int main () { return 0 ; }
483],
484[
tome9814c32005-10-12 11:30:43 +0000485declaration_after_statement=yes
tom1e946682005-10-12 11:27:33 +0000486AC_MSG_RESULT([yes])
487], [
tome9814c32005-10-12 11:30:43 +0000488declaration_after_statement=no
tom1e946682005-10-12 11:27:33 +0000489AC_MSG_RESULT([no])
490])
491CFLAGS=$safe_CFLAGS
492
tome9814c32005-10-12 11:30:43 +0000493if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +0000494 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
495fi
496
tomd55121e2005-12-19 12:40:13 +0000497# does this compiler support __builtin_expect?
498AC_MSG_CHECKING([if gcc supports __builtin_expect])
499
500AC_TRY_LINK(, [
501return __builtin_expect(1, 1) ? 1 : 0
502],
503[
504ac_have_builtin_expect=yes
505AC_MSG_RESULT([yes])
506], [
507ac_have_builtin_expect=no
508AC_MSG_RESULT([no])
509])
510if test x$ac_have_builtin_expect = xyes ; then
511 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
512fi
513
tom1e946682005-10-12 11:27:33 +0000514
sewardjb5f6f512005-03-10 23:59:00 +0000515# Check for TLS support in the compiler and linker
516AC_CACHE_CHECK([for TLS support], vg_cv_tls,
517 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
518 [vg_cv_tls=$enableval],
519 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
520 [[return foo;]])],
521 [vg_cv_tls=yes],
522 [vg_cv_tls=no])])])
523
524if test "$vg_cv_tls" = yes; then
525AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
526fi
sewardj5b754b42002-06-03 22:53:35 +0000527
sewardj535c50f2005-06-04 23:14:53 +0000528
sewardjde4a1d02002-03-22 01:27:54 +0000529# Checks for header files.
530AC_HEADER_STDC
nethercote3d260f62004-10-31 19:39:18 +0000531AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
sewardjde4a1d02002-03-22 01:27:54 +0000532
sewardj535c50f2005-06-04 23:14:53 +0000533
sewardjde4a1d02002-03-22 01:27:54 +0000534# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000535AC_TYPE_UID_T
536AC_TYPE_OFF_T
537AC_TYPE_SIZE_T
538AC_HEADER_TIME
539
sewardj535c50f2005-06-04 23:14:53 +0000540
sewardjde4a1d02002-03-22 01:27:54 +0000541# Checks for library functions.
542AC_FUNC_MEMCMP
543AC_FUNC_MMAP
544AC_TYPE_SIGNAL
545
thughesbeb6eb92004-06-14 12:33:43 +0000546AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
sewardjde4a1d02002-03-22 01:27:54 +0000547
gobrye721a522002-03-22 13:38:30 +0000548AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +0000549 Makefile
njn25cac76cb2002-09-23 11:21:57 +0000550 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +0000551 valgrind.pc
njn254d542432002-09-23 16:09:39 +0000552 docs/Makefile
njn3e986b22004-11-30 10:43:45 +0000553 docs/lib/Makefile
554 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +0000555 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +0000556 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +0000557 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +0000558 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +0000559 perf/Makefile
560 perf/vg_perf
njn254d542432002-09-23 16:09:39 +0000561 include/Makefile
njn7a6e7462002-11-09 17:53:30 +0000562 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +0000563 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000564 addrcheck/Makefile
njnf2df9b52002-10-04 11:35:47 +0000565 addrcheck/tests/Makefile
njn7da8fa72002-10-03 10:38:40 +0000566 addrcheck/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000567 memcheck/Makefile
568 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000569 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000570 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000571 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000572 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000573 memcheck/docs/Makefile
574 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000575 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000576 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000577 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000578 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000579 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000580 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +0000581 cachegrind/cg_annotate
njn25cac76cb2002-09-23 11:21:57 +0000582 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +0000583 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +0000584 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +0000585 massif/Makefile
586 massif/hp2ps/Makefile
587 massif/tests/Makefile
588 massif/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000589 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +0000590 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +0000591 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000592 none/Makefile
593 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000594 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000595 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000596 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000597 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +0000598 none/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000599)
gobry3b777892002-04-04 09:18:39 +0000600
601cat<<EOF
602
sewardj01262142006-01-04 01:20:28 +0000603 Primary build target: ${VG_PLATFORM_PRI}
604 Secondary target: ${VG_PLATFORM_SEC}
605 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +0000606
gobry3b777892002-04-04 09:18:39 +0000607EOF
608
609cat<<EOF > default.supp
610# This is a generated file, composed of the following suppression rules:
611#
612# ${DEFAULT_SUPP}
613#
614
615EOF
616
617for file in ${DEFAULT_SUPP} ; do
618 cat ${srcdir}/$file >> default.supp
619done