blob: a157ac6e1e2bfefb153d52e07feecb064ae88691 [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)
njna5f1bcd2004-11-27 16:47:42 +0000116AC_SUBST(VG_ARCH_ALL)
sewardj2c48c7b2005-11-29 13:05:56 +0000117VG_ARCH_ALL="amd64 ppc32 ppc64 x86"
sewardj45f4e7c2005-09-27 19:20:21 +0000118AC_SUBST(VALT_LOAD_ADDRESS)
sewardjde4a1d02002-03-22 01:27:54 +0000119
gobrye721a522002-03-22 13:38:30 +0000120case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000121 i?86)
122 AC_MSG_RESULT([ok (${host_cpu})])
nethercote888ecb72004-08-23 14:54:40 +0000123 VG_ARCH="x86"
sewardj45f4e7c2005-09-27 19:20:21 +0000124 valt_load_address_normal="0xb0000000"
125 valt_load_address_inner="0xa0000000"
sewardjde4a1d02002-03-22 01:27:54 +0000126 ;;
127
njnfe408942004-11-23 17:52:24 +0000128 x86_64)
129 AC_MSG_RESULT([ok (${host_cpu})])
130 VG_ARCH="amd64"
njnc6168192004-11-29 13:54:10 +0000131 # XXX: relocations under amd64's "small model" are 32-bit signed
njnfe408942004-11-23 17:52:24 +0000132 # quantities; therefore going above 0x7fffffff doesn't work... this is
133 # a problem.
sewardj45f4e7c2005-09-27 19:20:21 +0000134 valt_load_address_normal="0x70000000"
135 valt_load_address_inner="0x60000000"
njnfe408942004-11-23 17:52:24 +0000136 ;;
137
sewardj2c48c7b2005-11-29 13:05:56 +0000138 powerpc64)
139 AC_MSG_RESULT([ok (${host_cpu})])
140 VG_ARCH="ppc64"
141 valt_load_address_normal="0x70000000"
142 valt_load_address_inner="0x60000000"
143 ;;
144
145 powerpc)
cerion85665ca2005-06-20 15:51:07 +0000146 AC_MSG_RESULT([ok (${host_cpu})])
147 VG_ARCH="ppc32"
sewardj45f4e7c2005-09-27 19:20:21 +0000148 valt_load_address_normal="0x70000000"
149 valt_load_address_inner="0x60000000"
nethercote9bcc9062004-10-13 13:50:01 +0000150 ;;
151
sewardjde4a1d02002-03-22 01:27:54 +0000152 *)
153 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000154 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000155 ;;
156esac
157
sewardj45f4e7c2005-09-27 19:20:21 +0000158# Check if this should be built as an inner Valgrind, to be run within
159# another Valgrind. Choose the load address accordingly.
160AC_CACHE_CHECK([enable use as an inner Valgrind], vg_cv_inner,
161 [AC_ARG_ENABLE(inner, [ --enable-inner enables self-hosting],
162 [vg_cv_inner=$enableval],
163 [vg_cv_inner=no])])
164if test "$vg_cv_inner" = yes; then
165 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
166 VALT_LOAD_ADDRESS=$valt_load_address_inner
167else
168 VALT_LOAD_ADDRESS=$valt_load_address_normal
169fi
170
sewardjde4a1d02002-03-22 01:27:54 +0000171AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000172AC_SUBST(VG_OS)
njna5f1bcd2004-11-27 16:47:42 +0000173AC_SUBST(VG_OS_ALL)
174VG_OS_ALL="linux"
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
sewardj01262142006-01-04 01:20:28 +0000216# What's this used for?
njna5f1bcd2004-11-27 16:47:42 +0000217AC_SUBST(VG_PLATFORM_ALL)
sewardj2c48c7b2005-11-29 13:05:56 +0000218VG_PLATFORM_ALL="amd64-linux ppc32-linux ppc64-linux x86-linux"
nethercote888ecb72004-08-23 14:54:40 +0000219
sewardj01262142006-01-04 01:20:28 +0000220# Establish VG_PLATFORM_PRI. This is the primary build target. The
221# entire system, including regression and performance tests, will be
222# built for this target. On 32-bit systems this is the only build
223# target.
224#
225# Now establish VG_PLATFORM_SEC, the secondary build target, if
226# possible. The system will also be built for this target, but not
227# the regression or performance tests. Also decide what -m32/-m64
228# flags are needed for the primary and secondary build targets.
229# XXXXXXXXXXXXX is this needed?
230#
231AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000232
sewardj01262142006-01-04 01:20:28 +0000233AC_SUBST(VG_PLATFORM_PRI)
234AC_SUBST(VG_PLATFORM_SEC)
235
236case "$VG_ARCH-$VG_OS" in
237 x86-linux)
238 VG_PLATFORM_PRI="X86_LINUX"
239 VG_PLATFORM_SEC=""
sewardj3e38ce02004-11-23 01:17:29 +0000240 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000241 ;;
242 amd64-linux)
243 VG_PLATFORM_PRI="AMD64_LINUX"
244 VG_PLATFORM_SEC="X86_LINUX"
245 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
246 ;;
247 ppc32-linux)
248 VG_PLATFORM_PRI="PPC32_LINUX"
249 VG_PLATFORM_SEC=""
250 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
251 ;;
252 ppc64-linux)
253 VG_PLATFORM_PRI="PPC64_LINUX"
254 VG_PLATFORM_SEC="PPC32_LINUX"
255 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
256 ;;
nethercote888ecb72004-08-23 14:54:40 +0000257 *)
sewardj01262142006-01-04 01:20:28 +0000258 VG_PLATFORM_PRI="unknown"
259 VG_PLATFORM_SEC="unknown"
nethercote888ecb72004-08-23 14:54:40 +0000260 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000261 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000262 ;;
263esac
sewardjde4a1d02002-03-22 01:27:54 +0000264
sewardj01262142006-01-04 01:20:28 +0000265# Set up VG_<platform>. Either one or two of these become defined.
266#
267AM_CONDITIONAL(VG_X86_LINUX,
268 test x$VG_PLATFORM_PRI = xX86_LINUX -o x$VG_PLATFORM_PRI = xAMD64_LINUX)
269AM_CONDITIONAL(VG_AMD64_LINUX,
270 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
271AM_CONDITIONAL(VG_PPC32_LINUX,
272 test x$VG_PLATFORM_PRI = xPPC32_LINUX -o x$VG_PLATFORM_PRI = xPPC64_LINUX)
273AM_CONDITIONAL(VG_PPC64_LINUX,
274 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
tomfb7bcde2005-11-07 15:24:38 +0000275
tomb637bad2005-11-08 12:28:35 +0000276
sewardj01262142006-01-04 01:20:28 +0000277# This variable will collect the individual suppression files
278# depending on the results of autoconf
279DEFAULT_SUPP=""
sewardjde4a1d02002-03-22 01:27:54 +0000280AC_SUBST(DEFAULT_SUPP)
281
sewardj01262142006-01-04 01:20:28 +0000282
sewardjde4a1d02002-03-22 01:27:54 +0000283glibc=""
284
sewardjde4a1d02002-03-22 01:27:54 +0000285AC_EGREP_CPP([GLIBC_22], [
286#include <features.h>
287#ifdef __GNU_LIBRARY__
288 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
289 GLIBC_22
290 #endif
291#endif
292],
293glibc="2.2")
294
sewardj08c7f012002-10-07 23:56:55 +0000295AC_EGREP_CPP([GLIBC_23], [
296#include <features.h>
297#ifdef __GNU_LIBRARY__
298 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
299 GLIBC_23
300 #endif
301#endif
302],
303glibc="2.3")
304
njn781dba52005-06-30 04:06:38 +0000305AC_EGREP_CPP([GLIBC_24], [
306#include <features.h>
307#ifdef __GNU_LIBRARY__
308 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
309 GLIBC_24
310 #endif
311#endif
312],
313glibc="2.4")
314
daywalkere9212b32003-06-15 22:39:15 +0000315AC_MSG_CHECKING([the glibc version])
316
gobrye721a522002-03-22 13:38:30 +0000317case "${glibc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000318 2.2)
319 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000320 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj01262142006-01-04 01:20:28 +0000321 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000322 ;;
323
sewardj08c7f012002-10-07 23:56:55 +0000324 2.3)
325 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000326 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj01262142006-01-04 01:20:28 +0000327 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000328 ;;
329
njn781dba52005-06-30 04:06:38 +0000330 2.4)
331 AC_MSG_RESULT(2.4 family)
332 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj01262142006-01-04 01:20:28 +0000333 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000334 ;;
335
sewardjde4a1d02002-03-22 01:27:54 +0000336 *)
337 AC_MSG_RESULT(unsupported version)
sewardj3080a862005-07-03 10:18:33 +0000338 AC_MSG_ERROR([Valgrind requires glibc version 2.2, 2.3 or 2.4])
sewardjde4a1d02002-03-22 01:27:54 +0000339 ;;
340esac
341
sewardj535c50f2005-06-04 23:14:53 +0000342
nethercote3d260f62004-10-31 19:39:18 +0000343# We don't know how to detect the X client library version
344# (detecting the server version is easy, bu no help). So we
345# just use a hack: always include the suppressions for both
346# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000347AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000348if test "${no_x}" != 'yes' ; then
sewardj01262142006-01-04 01:20:28 +0000349 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
350 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000351fi
352
sewardj2e10a682003-04-07 19:36:41 +0000353
sewardj535c50f2005-06-04 23:14:53 +0000354# does this compiler support -m32 ?
355AC_MSG_CHECKING([if gcc accepts -m32])
356
357safe_CFLAGS=$CFLAGS
358CFLAGS="-m32"
359
360AC_TRY_COMPILE(, [
361int main () { return 0 ; }
362],
363[
364FLAG_M32="-m32"
365AC_MSG_RESULT([yes])
366], [
367FLAG_M32=""
368AC_MSG_RESULT([no])
369])
370CFLAGS=$safe_CFLAGS
371
372AC_SUBST(FLAG_M32)
373
374
sewardj01262142006-01-04 01:20:28 +0000375# does this compiler support -m64 ?
376AC_MSG_CHECKING([if gcc accepts -m64])
377
378safe_CFLAGS=$CFLAGS
379CFLAGS="-m64"
380
381AC_TRY_COMPILE(, [
382int main () { return 0 ; }
383],
384[
385FLAG_M64="-m64"
386AC_MSG_RESULT([yes])
387], [
388FLAG_M64=""
389AC_MSG_RESULT([no])
390])
391CFLAGS=$safe_CFLAGS
392
393AC_SUBST(FLAG_M64)
394
395
sewardj67f1fcc2005-07-03 10:41:02 +0000396# does this compiler support -mmmx ?
397AC_MSG_CHECKING([if gcc accepts -mmmx])
398
399safe_CFLAGS=$CFLAGS
400CFLAGS="-mmmx"
401
402AC_TRY_COMPILE(, [
403int main () { return 0 ; }
404],
405[
406FLAG_MMMX="-mmmx"
407AC_MSG_RESULT([yes])
408], [
409FLAG_MMMX=""
410AC_MSG_RESULT([no])
411])
412CFLAGS=$safe_CFLAGS
413
414AC_SUBST(FLAG_MMMX)
415
416
417# does this compiler support -msse ?
418AC_MSG_CHECKING([if gcc accepts -msse])
419
420safe_CFLAGS=$CFLAGS
421CFLAGS="-msse"
422
423AC_TRY_COMPILE(, [
424int main () { return 0 ; }
425],
426[
427FLAG_MSSE="-msse"
428AC_MSG_RESULT([yes])
429], [
430FLAG_MSSE=""
431AC_MSG_RESULT([no])
432])
433CFLAGS=$safe_CFLAGS
434
435AC_SUBST(FLAG_MSSE)
436
437
sewardj5b754b42002-06-03 22:53:35 +0000438# does this compiler support -mpreferred-stack-boundary=2 ?
439AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
440
daywalker3664f562003-10-17 13:43:46 +0000441safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000442CFLAGS="-mpreferred-stack-boundary=2"
443
444AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000445int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000446],
447[
448PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000449AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000450], [
451PREFERRED_STACK_BOUNDARY=""
452AC_MSG_RESULT([no])
453])
daywalker3664f562003-10-17 13:43:46 +0000454CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000455
456AC_SUBST(PREFERRED_STACK_BOUNDARY)
457
sewardj535c50f2005-06-04 23:14:53 +0000458
sewardjb5f6f512005-03-10 23:59:00 +0000459# does this compiler support -Wno-pointer-sign ?
460AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
461
462safe_CFLAGS=$CFLAGS
463CFLAGS="-Wno-pointer-sign"
464
465AC_TRY_COMPILE(, [
466int main () { return 0 ; }
467],
468[
469no_pointer_sign=yes
470AC_MSG_RESULT([yes])
471], [
472no_pointer_sign=no
473AC_MSG_RESULT([no])
474])
475CFLAGS=$safe_CFLAGS
476
477if test x$no_pointer_sign = xyes; then
478 CFLAGS="$CFLAGS -Wno-pointer-sign"
479fi
480
sewardj535c50f2005-06-04 23:14:53 +0000481
tom1e946682005-10-12 11:27:33 +0000482# does this compiler support -Wdeclaration-after-statement ?
483AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ])
484
485safe_CFLAGS=$CFLAGS
486CFLAGS="-Wdeclaration-after-statement"
487
488AC_TRY_COMPILE(, [
489int main () { return 0 ; }
490],
491[
tome9814c32005-10-12 11:30:43 +0000492declaration_after_statement=yes
tom1e946682005-10-12 11:27:33 +0000493AC_MSG_RESULT([yes])
494], [
tome9814c32005-10-12 11:30:43 +0000495declaration_after_statement=no
tom1e946682005-10-12 11:27:33 +0000496AC_MSG_RESULT([no])
497])
498CFLAGS=$safe_CFLAGS
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