blob: cf78a90d20b9c19e2d4b0eba8c6859c79642ad65 [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.
162AC_CACHE_CHECK([enable use as an inner Valgrind], vg_cv_inner,
163 [AC_ARG_ENABLE(inner, [ --enable-inner enables self-hosting],
164 [vg_cv_inner=$enableval],
165 [vg_cv_inner=no])])
166if test "$vg_cv_inner" = yes; then
167 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
168 VALT_LOAD_ADDRESS=$valt_load_address_inner
169else
170 VALT_LOAD_ADDRESS=$valt_load_address_normal
171fi
172
sewardjde4a1d02002-03-22 01:27:54 +0000173AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000174AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000175
gobrye721a522002-03-22 13:38:30 +0000176case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000177 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000178 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000179 VG_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000180
181 # Ok, this is linux. Check the kernel version
182 AC_MSG_CHECKING([for the kernel version])
183
184 kernel=`uname -r`
185
186 case "${kernel}" in
187 2.6.*)
188 AC_MSG_RESULT([2.6 family (${kernel})])
189 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
190 ;;
191
192 2.4.*)
193 AC_MSG_RESULT([2.4 family (${kernel})])
194 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
195 ;;
196
mueller8c68e042004-01-03 15:21:14 +0000197 *)
198 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000199 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000200 ;;
201 esac
202
203 ;;
204
205 *freebsd*)
206 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000207 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000208 ;;
209
210 *)
211 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000212 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000213 ;;
214esac
215
nethercote888ecb72004-08-23 14:54:40 +0000216
sewardj01262142006-01-04 01:20:28 +0000217# Establish VG_PLATFORM_PRI. This is the primary build target. The
218# entire system, including regression and performance tests, will be
sewardjbc692db2006-01-04 03:31:07 +0000219# built for this target.
sewardj01262142006-01-04 01:20:28 +0000220#
sewardjbc692db2006-01-04 03:31:07 +0000221# Also establish VG_PLATFORM_SEC, the secondary build target, if
sewardj01262142006-01-04 01:20:28 +0000222# possible. The system will also be built for this target, but not
sewardjbc692db2006-01-04 03:31:07 +0000223# the regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000224#
225AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000226
sewardj01262142006-01-04 01:20:28 +0000227AC_SUBST(VG_PLATFORM_PRI)
228AC_SUBST(VG_PLATFORM_SEC)
229
230case "$VG_ARCH-$VG_OS" in
231 x86-linux)
232 VG_PLATFORM_PRI="X86_LINUX"
233 VG_PLATFORM_SEC=""
sewardj3e38ce02004-11-23 01:17:29 +0000234 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000235 ;;
236 amd64-linux)
237 VG_PLATFORM_PRI="AMD64_LINUX"
238 VG_PLATFORM_SEC="X86_LINUX"
239 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
240 ;;
241 ppc32-linux)
242 VG_PLATFORM_PRI="PPC32_LINUX"
243 VG_PLATFORM_SEC=""
244 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
245 ;;
246 ppc64-linux)
247 VG_PLATFORM_PRI="PPC64_LINUX"
248 VG_PLATFORM_SEC="PPC32_LINUX"
249 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
250 ;;
nethercote888ecb72004-08-23 14:54:40 +0000251 *)
sewardj01262142006-01-04 01:20:28 +0000252 VG_PLATFORM_PRI="unknown"
253 VG_PLATFORM_SEC="unknown"
nethercote888ecb72004-08-23 14:54:40 +0000254 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000255 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000256 ;;
257esac
sewardjde4a1d02002-03-22 01:27:54 +0000258
sewardj01262142006-01-04 01:20:28 +0000259# Set up VG_<platform>. Either one or two of these become defined.
260#
261AM_CONDITIONAL(VG_X86_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000262 test x$VG_PLATFORM_PRI = xX86_LINUX \
263 -o x$VG_PLATFORM_SEC = xX86_LINUX)
sewardj01262142006-01-04 01:20:28 +0000264AM_CONDITIONAL(VG_AMD64_LINUX,
265 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
266AM_CONDITIONAL(VG_PPC32_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000267 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
268 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
sewardj01262142006-01-04 01:20:28 +0000269AM_CONDITIONAL(VG_PPC64_LINUX,
270 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
tomfb7bcde2005-11-07 15:24:38 +0000271
tomb637bad2005-11-08 12:28:35 +0000272
sewardj01262142006-01-04 01:20:28 +0000273# This variable will collect the individual suppression files
274# depending on the results of autoconf
275DEFAULT_SUPP=""
sewardjde4a1d02002-03-22 01:27:54 +0000276AC_SUBST(DEFAULT_SUPP)
277
sewardj01262142006-01-04 01:20:28 +0000278
sewardjde4a1d02002-03-22 01:27:54 +0000279glibc=""
280
sewardjde4a1d02002-03-22 01:27:54 +0000281AC_EGREP_CPP([GLIBC_22], [
282#include <features.h>
283#ifdef __GNU_LIBRARY__
284 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
285 GLIBC_22
286 #endif
287#endif
288],
289glibc="2.2")
290
sewardj08c7f012002-10-07 23:56:55 +0000291AC_EGREP_CPP([GLIBC_23], [
292#include <features.h>
293#ifdef __GNU_LIBRARY__
294 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
295 GLIBC_23
296 #endif
297#endif
298],
299glibc="2.3")
300
njn781dba52005-06-30 04:06:38 +0000301AC_EGREP_CPP([GLIBC_24], [
302#include <features.h>
303#ifdef __GNU_LIBRARY__
304 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
305 GLIBC_24
306 #endif
307#endif
308],
309glibc="2.4")
310
daywalkere9212b32003-06-15 22:39:15 +0000311AC_MSG_CHECKING([the glibc version])
312
gobrye721a522002-03-22 13:38:30 +0000313case "${glibc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000314 2.2)
315 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000316 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj01262142006-01-04 01:20:28 +0000317 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000318 ;;
319
sewardj08c7f012002-10-07 23:56:55 +0000320 2.3)
321 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000322 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj01262142006-01-04 01:20:28 +0000323 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000324 ;;
325
njn781dba52005-06-30 04:06:38 +0000326 2.4)
327 AC_MSG_RESULT(2.4 family)
328 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj01262142006-01-04 01:20:28 +0000329 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000330 ;;
331
sewardjde4a1d02002-03-22 01:27:54 +0000332 *)
333 AC_MSG_RESULT(unsupported version)
sewardj3080a862005-07-03 10:18:33 +0000334 AC_MSG_ERROR([Valgrind requires glibc version 2.2, 2.3 or 2.4])
sewardjde4a1d02002-03-22 01:27:54 +0000335 ;;
336esac
337
sewardj535c50f2005-06-04 23:14:53 +0000338
nethercote3d260f62004-10-31 19:39:18 +0000339# We don't know how to detect the X client library version
340# (detecting the server version is easy, bu no help). So we
341# just use a hack: always include the suppressions for both
342# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000343AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000344if test "${no_x}" != 'yes' ; then
sewardj01262142006-01-04 01:20:28 +0000345 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
346 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000347fi
348
sewardj2e10a682003-04-07 19:36:41 +0000349
sewardj535c50f2005-06-04 23:14:53 +0000350# does this compiler support -m32 ?
351AC_MSG_CHECKING([if gcc accepts -m32])
352
353safe_CFLAGS=$CFLAGS
354CFLAGS="-m32"
355
356AC_TRY_COMPILE(, [
357int main () { return 0 ; }
358],
359[
360FLAG_M32="-m32"
361AC_MSG_RESULT([yes])
362], [
363FLAG_M32=""
364AC_MSG_RESULT([no])
365])
366CFLAGS=$safe_CFLAGS
367
368AC_SUBST(FLAG_M32)
369
370
sewardj01262142006-01-04 01:20:28 +0000371# does this compiler support -m64 ?
372AC_MSG_CHECKING([if gcc accepts -m64])
373
374safe_CFLAGS=$CFLAGS
375CFLAGS="-m64"
376
377AC_TRY_COMPILE(, [
378int main () { return 0 ; }
379],
380[
381FLAG_M64="-m64"
382AC_MSG_RESULT([yes])
383], [
384FLAG_M64=""
385AC_MSG_RESULT([no])
386])
387CFLAGS=$safe_CFLAGS
388
389AC_SUBST(FLAG_M64)
390
391
sewardj67f1fcc2005-07-03 10:41:02 +0000392# does this compiler support -mmmx ?
393AC_MSG_CHECKING([if gcc accepts -mmmx])
394
395safe_CFLAGS=$CFLAGS
396CFLAGS="-mmmx"
397
398AC_TRY_COMPILE(, [
399int main () { return 0 ; }
400],
401[
402FLAG_MMMX="-mmmx"
403AC_MSG_RESULT([yes])
404], [
405FLAG_MMMX=""
406AC_MSG_RESULT([no])
407])
408CFLAGS=$safe_CFLAGS
409
410AC_SUBST(FLAG_MMMX)
411
412
413# does this compiler support -msse ?
414AC_MSG_CHECKING([if gcc accepts -msse])
415
416safe_CFLAGS=$CFLAGS
417CFLAGS="-msse"
418
419AC_TRY_COMPILE(, [
420int main () { return 0 ; }
421],
422[
423FLAG_MSSE="-msse"
424AC_MSG_RESULT([yes])
425], [
426FLAG_MSSE=""
427AC_MSG_RESULT([no])
428])
429CFLAGS=$safe_CFLAGS
430
431AC_SUBST(FLAG_MSSE)
432
433
sewardj5b754b42002-06-03 22:53:35 +0000434# does this compiler support -mpreferred-stack-boundary=2 ?
435AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
436
daywalker3664f562003-10-17 13:43:46 +0000437safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000438CFLAGS="-mpreferred-stack-boundary=2"
439
440AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000441int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000442],
443[
444PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000445AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000446], [
447PREFERRED_STACK_BOUNDARY=""
448AC_MSG_RESULT([no])
449])
daywalker3664f562003-10-17 13:43:46 +0000450CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000451
452AC_SUBST(PREFERRED_STACK_BOUNDARY)
453
sewardj535c50f2005-06-04 23:14:53 +0000454
sewardjb5f6f512005-03-10 23:59:00 +0000455# does this compiler support -Wno-pointer-sign ?
456AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
457
458safe_CFLAGS=$CFLAGS
459CFLAGS="-Wno-pointer-sign"
460
461AC_TRY_COMPILE(, [
462int main () { return 0 ; }
463],
464[
465no_pointer_sign=yes
466AC_MSG_RESULT([yes])
467], [
468no_pointer_sign=no
469AC_MSG_RESULT([no])
470])
471CFLAGS=$safe_CFLAGS
472
473if test x$no_pointer_sign = xyes; then
474 CFLAGS="$CFLAGS -Wno-pointer-sign"
475fi
476
sewardj535c50f2005-06-04 23:14:53 +0000477
tom1e946682005-10-12 11:27:33 +0000478# does this compiler support -Wdeclaration-after-statement ?
479AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ])
480
481safe_CFLAGS=$CFLAGS
482CFLAGS="-Wdeclaration-after-statement"
483
484AC_TRY_COMPILE(, [
485int main () { return 0 ; }
486],
487[
tome9814c32005-10-12 11:30:43 +0000488declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +0000489FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +0000490AC_MSG_RESULT([yes])
491], [
tome9814c32005-10-12 11:30:43 +0000492declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +0000493FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +0000494AC_MSG_RESULT([no])
495])
496CFLAGS=$safe_CFLAGS
497
sewardj72a547e2006-01-25 02:58:28 +0000498AC_SUBST(FLAG_WDECL_AFTER_STMT)
499
tome9814c32005-10-12 11:30:43 +0000500if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +0000501 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
502fi
503
tomd55121e2005-12-19 12:40:13 +0000504# does this compiler support __builtin_expect?
505AC_MSG_CHECKING([if gcc supports __builtin_expect])
506
507AC_TRY_LINK(, [
508return __builtin_expect(1, 1) ? 1 : 0
509],
510[
511ac_have_builtin_expect=yes
512AC_MSG_RESULT([yes])
513], [
514ac_have_builtin_expect=no
515AC_MSG_RESULT([no])
516])
517if test x$ac_have_builtin_expect = xyes ; then
518 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
519fi
520
tom1e946682005-10-12 11:27:33 +0000521
sewardjb5f6f512005-03-10 23:59:00 +0000522# Check for TLS support in the compiler and linker
523AC_CACHE_CHECK([for TLS support], vg_cv_tls,
524 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
525 [vg_cv_tls=$enableval],
526 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
527 [[return foo;]])],
528 [vg_cv_tls=yes],
529 [vg_cv_tls=no])])])
530
531if test "$vg_cv_tls" = yes; then
532AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
533fi
sewardj5b754b42002-06-03 22:53:35 +0000534
sewardj535c50f2005-06-04 23:14:53 +0000535
sewardjde4a1d02002-03-22 01:27:54 +0000536# Checks for header files.
537AC_HEADER_STDC
nethercote3d260f62004-10-31 19:39:18 +0000538AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
sewardjde4a1d02002-03-22 01:27:54 +0000539
sewardj535c50f2005-06-04 23:14:53 +0000540
sewardjde4a1d02002-03-22 01:27:54 +0000541# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000542AC_TYPE_UID_T
543AC_TYPE_OFF_T
544AC_TYPE_SIZE_T
545AC_HEADER_TIME
546
sewardj535c50f2005-06-04 23:14:53 +0000547
sewardjde4a1d02002-03-22 01:27:54 +0000548# Checks for library functions.
549AC_FUNC_MEMCMP
550AC_FUNC_MMAP
551AC_TYPE_SIGNAL
552
thughesbeb6eb92004-06-14 12:33:43 +0000553AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
sewardjde4a1d02002-03-22 01:27:54 +0000554
gobrye721a522002-03-22 13:38:30 +0000555AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +0000556 Makefile
njn25cac76cb2002-09-23 11:21:57 +0000557 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +0000558 valgrind.pc
njn254d542432002-09-23 16:09:39 +0000559 docs/Makefile
njn3e986b22004-11-30 10:43:45 +0000560 docs/lib/Makefile
561 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +0000562 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +0000563 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +0000564 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +0000565 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +0000566 perf/Makefile
567 perf/vg_perf
njn254d542432002-09-23 16:09:39 +0000568 include/Makefile
njn7a6e7462002-11-09 17:53:30 +0000569 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +0000570 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000571 addrcheck/Makefile
njnf2df9b52002-10-04 11:35:47 +0000572 addrcheck/tests/Makefile
njn7da8fa72002-10-03 10:38:40 +0000573 addrcheck/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000574 memcheck/Makefile
575 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000576 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000577 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000578 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000579 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000580 memcheck/docs/Makefile
581 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000582 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000583 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000584 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000585 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000586 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000587 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +0000588 cachegrind/cg_annotate
njn25cac76cb2002-09-23 11:21:57 +0000589 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +0000590 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +0000591 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +0000592 massif/Makefile
593 massif/hp2ps/Makefile
594 massif/tests/Makefile
595 massif/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000596 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +0000597 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +0000598 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000599 none/Makefile
600 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +0000601 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +0000602 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +0000603 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +0000604 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +0000605 none/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000606)
gobry3b777892002-04-04 09:18:39 +0000607
608cat<<EOF
609
sewardj01262142006-01-04 01:20:28 +0000610 Primary build target: ${VG_PLATFORM_PRI}
611 Secondary target: ${VG_PLATFORM_SEC}
612 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +0000613
gobry3b777892002-04-04 09:18:39 +0000614EOF
615
616cat<<EOF > default.supp
617# This is a generated file, composed of the following suppression rules:
618#
619# ${DEFAULT_SUPP}
620#
621
622EOF
623
624for file in ${DEFAULT_SUPP} ; do
625 cat ${srcdir}/$file >> default.supp
626done