blob: 568fa579f54b735b0cf8b6f4d4c610713b64b4f3 [file] [log] [blame]
sewardjde4a1d02002-03-22 01:27:54 +00001# Process this file with autoconf to produce a configure script.
jsewarddc0b4e82004-08-31 16:26:27 +00002AC_INIT(Valgrind, 2.3.0.CVS, valgrind-users@lists.sourceforge.net)
thughes6dbad732004-08-29 09:46:38 +00003AC_CONFIG_SRCDIR(coregrind/vg_main.c)
sewardjde4a1d02002-03-22 01:27:54 +00004AM_CONFIG_HEADER(config.h)
thughes6dbad732004-08-29 09:46:38 +00005AM_INIT_AUTOMAKE
sewardjde4a1d02002-03-22 01:27:54 +00006
gobryb0ed4672002-03-27 20:58:58 +00007AM_MAINTAINER_MODE
8
njn8738c282004-11-23 16:31:56 +00009# Where is VEX ?
10AC_ARG_WITH(vex,
11 AS_HELP_STRING([--with-vex], [Vex directory (must be specified!)]),
12[
13 AC_CHECK_FILE($withval/pub/libvex.h,
14 [VEX_DIR=$withval],
15 [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain Vex])])
16],
17[
18 AC_MSG_ERROR([You must specify --with-vex=<DIR>])
19])
sewardj50629ec2004-11-22 13:44:11 +000020AC_SUBST(VEX_DIR)
21
sewardjde4a1d02002-03-22 01:27:54 +000022# Checks for programs.
gobrye721a522002-03-22 13:38:30 +000023CFLAGS=""
24
sewardjde4a1d02002-03-22 01:27:54 +000025AC_PROG_LN_S
26AC_PROG_CC
thughesa92ffd52004-11-01 09:50:57 +000027AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000028AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000029AC_PROG_CXX
sewardjde4a1d02002-03-22 01:27:54 +000030AC_PROG_RANLIB
31
gobrye721a522002-03-22 13:38:30 +000032# Check for the compiler support
33if test "${GCC}" != "yes" ; then
34 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
35fi
36
sewardj2f685952002-12-22 19:32:23 +000037# figure out where perl lives
38AC_PATH_PROG(PERL, perl)
39
njn9315df32003-04-16 20:50:50 +000040# figure out where gdb lives
41AC_PATH_PROG(GDB, gdb)
njn17b85352003-04-18 12:54:24 +000042# autoheader tries to execute the 3rd string or something; I get warnings when
43# it's defined. So just leave it undefined. --njn 2002-Apr-18
44AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", "")
njn9315df32003-04-16 20:50:50 +000045
daywalker48ccca52002-04-15 00:31:58 +000046# some older automake's don't have it so try something on our own
47ifdef([AM_PROG_AS],[AM_PROG_AS],
48[
gobry1be19852002-03-26 20:44:55 +000049AS="${CC}"
50AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000051
gobry1be19852002-03-26 20:44:55 +000052ASFLAGS=""
53AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000054])
gobry3b777892002-04-04 09:18:39 +000055
56# This variable will collect the individual suppression files
57# depending on the results of autoconf
58
59DEFAULT_SUPP=""
60
61
gobrye721a522002-03-22 13:38:30 +000062# We don't want gcc 2.7
63AC_MSG_CHECKING([for a supported version of gcc])
64
daywalker870ac4c2002-05-21 00:09:48 +000065gcc_version=`${CC} --version | head -n 1`
gobrye721a522002-03-22 13:38:30 +000066
67case "${gcc_version}" in
68 gcc-2.7.*)
69 AC_MSG_RESULT([no (${gcc_version})])
70 AC_MSG_ERROR([please use a recent (>= gcc-2.95) version of gcc])
71 ;;
72
73 *)
74 AC_MSG_RESULT([ok (${gcc_version})])
75 ;;
76esac
77
gobrye721a522002-03-22 13:38:30 +000078
sewardjde4a1d02002-03-22 01:27:54 +000079# Checks for the platform
80AC_CANONICAL_HOST
81
82AC_MSG_CHECKING([for a supported CPU])
nethercote888ecb72004-08-23 14:54:40 +000083AC_SUBST(VG_ARCH)
nethercote2b72e942004-10-25 14:05:56 +000084AC_SUBST(KICKSTART_BASE)
nethercotecf4d9972004-10-25 15:21:00 +000085AC_SUBST(ARCH_CORE_AM_CFLAGS)
86AC_SUBST(ARCH_TOOL_AM_CFLAGS)
nethercote8df0a402004-10-25 19:20:14 +000087AC_SUBST(ARCH_CORE_AM_CCASFLAGS)
sewardjde4a1d02002-03-22 01:27:54 +000088
gobrye721a522002-03-22 13:38:30 +000089case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +000090 i?86)
91 AC_MSG_RESULT([ok (${host_cpu})])
nethercote888ecb72004-08-23 14:54:40 +000092 VG_ARCH="x86"
nethercote2b72e942004-10-25 14:05:56 +000093 KICKSTART_BASE="0xb0000000"
nethercotecf4d9972004-10-25 15:21:00 +000094 ARCH_CORE_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -DELFSZ=32"
95 ARCH_TOOL_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@"
nethercote8df0a402004-10-25 19:20:14 +000096 ARCH_CORE_AM_CCASFLAGS=""
sewardjde4a1d02002-03-22 01:27:54 +000097 ;;
98
sewardj3e38ce02004-11-23 01:17:29 +000099 arm*)
100 AC_MSG_RESULT([ok (${host_cpu})])
101 VG_ARCH="arm"
102 KICKSTART_BASE="0xb0000000"
103 ARCH_CORE_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -DELFSZ=32"
104 ARCH_TOOL_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@"
105 ARCH_CORE_AM_CCASFLAGS=""
106 ;;
107
nethercote9bcc9062004-10-13 13:50:01 +0000108 powerpc*)
109 AC_MSG_RESULT([no (${host_cpu})])
nethercoteda8735a2004-10-19 14:24:42 +0000110 VG_ARCH="ppc"
nethercote2b72e942004-10-25 14:05:56 +0000111 KICKSTART_BASE="0x70000000"
nethercotecf4d9972004-10-25 15:21:00 +0000112 ARCH_CORE_AM_CFLAGS="-DELFSZ=32"
113 ARCH_TOOL_AM_CFLAGS="-fpic"
nethercote8df0a402004-10-25 19:20:14 +0000114 ARCH_CORE_AM_CCASFLAGS="-Wa,-maltivec"
nethercote9bcc9062004-10-13 13:50:01 +0000115 AC_MSG_ERROR([PowerPC not supported. Sorry])
116 ;;
117
sewardjde4a1d02002-03-22 01:27:54 +0000118 *)
119 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000120 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000121 ;;
122esac
123
124AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000125AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000126
gobrye721a522002-03-22 13:38:30 +0000127case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000128 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000129 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000130 VG_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000131
132 # Ok, this is linux. Check the kernel version
133 AC_MSG_CHECKING([for the kernel version])
134
135 kernel=`uname -r`
136
137 case "${kernel}" in
138 2.6.*)
139 AC_MSG_RESULT([2.6 family (${kernel})])
140 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
141 ;;
142
143 2.4.*)
144 AC_MSG_RESULT([2.4 family (${kernel})])
145 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
146 ;;
147
mueller8c68e042004-01-03 15:21:14 +0000148 *)
149 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000150 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000151 ;;
152 esac
153
154 ;;
155
156 *freebsd*)
157 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000158 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000159 ;;
160
161 *)
162 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000163 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000164 ;;
165esac
166
nethercote888ecb72004-08-23 14:54:40 +0000167AC_MSG_CHECKING([for a supported CPU/OS combination])
168AC_SUBST(VG_PLATFORM)
169
170VG_PLATFORM="$VG_ARCH-$VG_OS"
171
172case $VG_PLATFORM in
173 x86-linux)
174 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
175 ;;
176
sewardj3e38ce02004-11-23 01:17:29 +0000177 arm-linux)
178 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
179 ;;
180
nethercote888ecb72004-08-23 14:54:40 +0000181 *)
182 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000183 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000184 ;;
185esac
sewardjde4a1d02002-03-22 01:27:54 +0000186
sewardjde4a1d02002-03-22 01:27:54 +0000187AC_SUBST(DEFAULT_SUPP)
188
sewardjde4a1d02002-03-22 01:27:54 +0000189glibc=""
190
191AC_EGREP_CPP([GLIBC_21], [
192#include <features.h>
193#ifdef __GNU_LIBRARY__
194 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 1)
195 GLIBC_21
196 #endif
197#endif
198],
199glibc="2.1")
200
201AC_EGREP_CPP([GLIBC_22], [
202#include <features.h>
203#ifdef __GNU_LIBRARY__
204 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
205 GLIBC_22
206 #endif
207#endif
208],
209glibc="2.2")
210
sewardj08c7f012002-10-07 23:56:55 +0000211AC_EGREP_CPP([GLIBC_23], [
212#include <features.h>
213#ifdef __GNU_LIBRARY__
214 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
215 GLIBC_23
216 #endif
217#endif
218],
219glibc="2.3")
220
daywalkere9212b32003-06-15 22:39:15 +0000221AC_MSG_CHECKING([the glibc version])
222
gobrye721a522002-03-22 13:38:30 +0000223case "${glibc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000224 2.1)
225 AC_MSG_RESULT(2.1 family)
daywalker418c7482002-10-16 13:09:26 +0000226 AC_DEFINE([GLIBC_2_1], 1, [Define to 1 if you're using glibc 2.1.x])
gobry3b777892002-04-04 09:18:39 +0000227 DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.1.supp"
sewardjde4a1d02002-03-22 01:27:54 +0000228 ;;
229
230 2.2)
231 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000232 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
gobry3b777892002-04-04 09:18:39 +0000233 DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.2.supp"
sewardjde4a1d02002-03-22 01:27:54 +0000234 ;;
235
sewardj08c7f012002-10-07 23:56:55 +0000236 2.3)
237 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000238 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
daywalker63f6f782003-05-27 00:19:52 +0000239 DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.3.supp"
sewardj08c7f012002-10-07 23:56:55 +0000240 ;;
241
sewardjde4a1d02002-03-22 01:27:54 +0000242 *)
243 AC_MSG_RESULT(unsupported version)
sewardj08c7f012002-10-07 23:56:55 +0000244 AC_MSG_ERROR([Valgrind requires the glibc version 2.1, 2.2 or 2.3])
sewardjde4a1d02002-03-22 01:27:54 +0000245 ;;
246esac
247
sewardj3e909ce2002-06-03 13:27:15 +0000248# APIs introduced in recent glibc versions
249
250AC_MSG_CHECKING([whether sched_param has a sched_priority member])
251AC_CACHE_VAL(vg_have_sched_priority,
252[
253AC_TRY_COMPILE([#include <pthread.h>],[
254struct sched_param p; p.sched_priority=1;],
255vg_have_sched_priority=yes,
256vg_have_sched_priority=no)
257])
258AC_MSG_RESULT($vg_have_sched_priority)
259if test "$vg_have_sched_priority" = yes; then
daywalker418c7482002-10-16 13:09:26 +0000260AC_DEFINE([HAVE_SCHED_PRIORITY], 1, [pthread / sched_priority exists])
sewardj3e909ce2002-06-03 13:27:15 +0000261fi
262
nethercote3d260f62004-10-31 19:39:18 +0000263# We don't know how to detect the X client library version
264# (detecting the server version is easy, bu no help). So we
265# just use a hack: always include the suppressions for both
266# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000267AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000268if test "${no_x}" != 'yes' ; then
nethercote3d260f62004-10-31 19:39:18 +0000269 DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
270 DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp"
gobrye721a522002-03-22 13:38:30 +0000271fi
272
sewardj2e10a682003-04-07 19:36:41 +0000273
sewardj5b754b42002-06-03 22:53:35 +0000274# does this compiler support -mpreferred-stack-boundary=2 ?
275AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
276
daywalker3664f562003-10-17 13:43:46 +0000277safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000278CFLAGS="-mpreferred-stack-boundary=2"
279
280AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000281int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000282],
283[
284PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000285AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000286], [
287PREFERRED_STACK_BOUNDARY=""
288AC_MSG_RESULT([no])
289])
daywalker3664f562003-10-17 13:43:46 +0000290CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000291
292AC_SUBST(PREFERRED_STACK_BOUNDARY)
293
294
nethercote7f390022004-10-25 17:18:24 +0000295# Check for PIE support in the compiler and linker
296AC_CACHE_CHECK([for PIE support], vg_cv_pie,
297 [safe_CFLAGS=$CFLAGS
298 CFLAGS="$CFLAGS -fpie"
299 safe_LDFLAGS=$LDFLAGS
300 LDFLAGS="$LDFLAGS -pie"
301 AC_TRY_LINK([int foo;],
302 [],
303 [vg_cv_pie=yes],
304 [vg_cv_pie=no])
305 CFLAGS=$safe_CFLAGS
306 LDFLAGS=$safe_LDFLAGS])
307if test "$vg_cv_pie" = yes; then
308AC_DEFINE([HAVE_PIE], 1, [can create position-independent executables])
309fi
310AM_CONDITIONAL(USE_PIE, test "$vg_cv_pie" = "yes")
311
sewardj5b754b42002-06-03 22:53:35 +0000312
sewardjde4a1d02002-03-22 01:27:54 +0000313# Checks for header files.
314AC_HEADER_STDC
nethercote3d260f62004-10-31 19:39:18 +0000315AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
sewardjde4a1d02002-03-22 01:27:54 +0000316
317# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000318AC_TYPE_UID_T
319AC_TYPE_OFF_T
320AC_TYPE_SIZE_T
321AC_HEADER_TIME
thughesebed9982004-06-12 17:25:25 +0000322AC_CHECK_TYPES(__pthread_unwind_buf_t,,,[#include <pthread.h>])
sewardjde4a1d02002-03-22 01:27:54 +0000323
324# Checks for library functions.
325AC_FUNC_MEMCMP
326AC_FUNC_MMAP
327AC_TYPE_SIGNAL
328
thughesbeb6eb92004-06-14 12:33:43 +0000329AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
sewardjde4a1d02002-03-22 01:27:54 +0000330
gobrye721a522002-03-22 13:38:30 +0000331AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +0000332 Makefile
njn25cac76cb2002-09-23 11:21:57 +0000333 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +0000334 valgrind.pc
njn254d542432002-09-23 16:09:39 +0000335 docs/Makefile
336 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +0000337 tests/vg_regtest
njn251ffab942002-09-23 16:42:19 +0000338 tests/unused/Makefile
nethercotee90c6832004-10-18 18:07:49 +0000339 include/valgrind.h
njn254d542432002-09-23 16:09:39 +0000340 include/Makefile
nethercotec06e2132004-09-03 13:45:29 +0000341 include/x86/Makefile
nethercote73b526f2004-10-31 18:48:21 +0000342 include/linux/Makefile
343 include/x86-linux/Makefile
njn7a6e7462002-11-09 17:53:30 +0000344 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +0000345 coregrind/Makefile
346 coregrind/demangle/Makefile
347 coregrind/docs/Makefile
fitzhardinge98abfc72003-12-16 02:05:15 +0000348 coregrind/x86/Makefile
nethercote8ff888f2004-11-17 17:11:45 +0000349 coregrind/linux/Makefile
nethercotef94fe2f2004-09-10 14:23:59 +0000350 coregrind/x86-linux/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000351 addrcheck/Makefile
njnf2df9b52002-10-04 11:35:47 +0000352 addrcheck/tests/Makefile
nethercotebfd20192004-10-19 18:54:11 +0000353 addrcheck/tests/x86/Makefile
njn7da8fa72002-10-03 10:38:40 +0000354 addrcheck/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000355 memcheck/Makefile
356 memcheck/tests/Makefile
nethercotebfd20192004-10-19 18:54:11 +0000357 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000358 memcheck/docs/Makefile
359 cachegrind/Makefile
nethercoteb35a8b92004-09-11 16:45:27 +0000360 cachegrind/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000361 cachegrind/tests/Makefile
nethercotea255d802004-10-19 17:00:59 +0000362 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000363 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +0000364 cachegrind/cg_annotate
njn25cac76cb2002-09-23 11:21:57 +0000365 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +0000366 helgrind/tests/Makefile
nethercotebfd20192004-10-19 18:54:11 +0000367 helgrind/tests/x86/Makefile
njn83157fc2002-10-03 10:07:34 +0000368 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +0000369 massif/Makefile
370 massif/hp2ps/Makefile
371 massif/tests/Makefile
372 massif/docs/Makefile
373 corecheck/Makefile
374 corecheck/tests/Makefile
375 corecheck/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000376 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +0000377 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +0000378 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000379 none/Makefile
380 none/tests/Makefile
nethercotebfd20192004-10-19 18:54:11 +0000381 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +0000382 none/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000383)
gobry3b777892002-04-04 09:18:39 +0000384
385cat<<EOF
386
387Using the following suppressions by default:
388
389 ${DEFAULT_SUPP}
390EOF
391
392cat<<EOF > default.supp
393# This is a generated file, composed of the following suppression rules:
394#
395# ${DEFAULT_SUPP}
396#
397
398EOF
399
400for file in ${DEFAULT_SUPP} ; do
401 cat ${srcdir}/$file >> default.supp
402done