blob: 015acc189a0fe83ed06fb451167ba42ade4c2064 [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
sewardj50629ec2004-11-22 13:44:11 +00009# Where is VEX ? ToDo: --with-vex=
sewardj3e38ce02004-11-23 01:17:29 +000010VEX_DIR=/home/sewardj/VEX/vex/trunk
sewardj50629ec2004-11-22 13:44:11 +000011AC_SUBST(VEX_DIR)
12
sewardjde4a1d02002-03-22 01:27:54 +000013# Checks for programs.
gobrye721a522002-03-22 13:38:30 +000014CFLAGS=""
15
sewardjde4a1d02002-03-22 01:27:54 +000016AC_PROG_LN_S
17AC_PROG_CC
thughesa92ffd52004-11-01 09:50:57 +000018AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000019AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000020AC_PROG_CXX
sewardjde4a1d02002-03-22 01:27:54 +000021AC_PROG_RANLIB
22
gobrye721a522002-03-22 13:38:30 +000023# Check for the compiler support
24if test "${GCC}" != "yes" ; then
25 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
26fi
27
sewardj2f685952002-12-22 19:32:23 +000028# figure out where perl lives
29AC_PATH_PROG(PERL, perl)
30
njn9315df32003-04-16 20:50:50 +000031# figure out where gdb lives
32AC_PATH_PROG(GDB, gdb)
njn17b85352003-04-18 12:54:24 +000033# autoheader tries to execute the 3rd string or something; I get warnings when
34# it's defined. So just leave it undefined. --njn 2002-Apr-18
35AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", "")
njn9315df32003-04-16 20:50:50 +000036
daywalker48ccca52002-04-15 00:31:58 +000037# some older automake's don't have it so try something on our own
38ifdef([AM_PROG_AS],[AM_PROG_AS],
39[
gobry1be19852002-03-26 20:44:55 +000040AS="${CC}"
41AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000042
gobry1be19852002-03-26 20:44:55 +000043ASFLAGS=""
44AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000045])
gobry3b777892002-04-04 09:18:39 +000046
47# This variable will collect the individual suppression files
48# depending on the results of autoconf
49
50DEFAULT_SUPP=""
51
52
gobrye721a522002-03-22 13:38:30 +000053# We don't want gcc 2.7
54AC_MSG_CHECKING([for a supported version of gcc])
55
daywalker870ac4c2002-05-21 00:09:48 +000056gcc_version=`${CC} --version | head -n 1`
gobrye721a522002-03-22 13:38:30 +000057
58case "${gcc_version}" in
59 gcc-2.7.*)
60 AC_MSG_RESULT([no (${gcc_version})])
61 AC_MSG_ERROR([please use a recent (>= gcc-2.95) version of gcc])
62 ;;
63
64 *)
65 AC_MSG_RESULT([ok (${gcc_version})])
66 ;;
67esac
68
gobrye721a522002-03-22 13:38:30 +000069
sewardjde4a1d02002-03-22 01:27:54 +000070# Checks for the platform
71AC_CANONICAL_HOST
72
73AC_MSG_CHECKING([for a supported CPU])
nethercote888ecb72004-08-23 14:54:40 +000074AC_SUBST(VG_ARCH)
nethercote2b72e942004-10-25 14:05:56 +000075AC_SUBST(KICKSTART_BASE)
nethercotecf4d9972004-10-25 15:21:00 +000076AC_SUBST(ARCH_CORE_AM_CFLAGS)
77AC_SUBST(ARCH_TOOL_AM_CFLAGS)
nethercote8df0a402004-10-25 19:20:14 +000078AC_SUBST(ARCH_CORE_AM_CCASFLAGS)
sewardjde4a1d02002-03-22 01:27:54 +000079
gobrye721a522002-03-22 13:38:30 +000080case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +000081 i?86)
82 AC_MSG_RESULT([ok (${host_cpu})])
nethercote888ecb72004-08-23 14:54:40 +000083 VG_ARCH="x86"
nethercote2b72e942004-10-25 14:05:56 +000084 KICKSTART_BASE="0xb0000000"
nethercotecf4d9972004-10-25 15:21:00 +000085 ARCH_CORE_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -DELFSZ=32"
86 ARCH_TOOL_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@"
nethercote8df0a402004-10-25 19:20:14 +000087 ARCH_CORE_AM_CCASFLAGS=""
sewardjde4a1d02002-03-22 01:27:54 +000088 ;;
89
sewardj3e38ce02004-11-23 01:17:29 +000090 arm*)
91 AC_MSG_RESULT([ok (${host_cpu})])
92 VG_ARCH="arm"
93 KICKSTART_BASE="0xb0000000"
94 ARCH_CORE_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -DELFSZ=32"
95 ARCH_TOOL_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@"
96 ARCH_CORE_AM_CCASFLAGS=""
97 ;;
98
nethercote9bcc9062004-10-13 13:50:01 +000099 powerpc*)
100 AC_MSG_RESULT([no (${host_cpu})])
nethercoteda8735a2004-10-19 14:24:42 +0000101 VG_ARCH="ppc"
nethercote2b72e942004-10-25 14:05:56 +0000102 KICKSTART_BASE="0x70000000"
nethercotecf4d9972004-10-25 15:21:00 +0000103 ARCH_CORE_AM_CFLAGS="-DELFSZ=32"
104 ARCH_TOOL_AM_CFLAGS="-fpic"
nethercote8df0a402004-10-25 19:20:14 +0000105 ARCH_CORE_AM_CCASFLAGS="-Wa,-maltivec"
nethercote9bcc9062004-10-13 13:50:01 +0000106 AC_MSG_ERROR([PowerPC not supported. Sorry])
107 ;;
108
sewardjde4a1d02002-03-22 01:27:54 +0000109 *)
110 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000111 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000112 ;;
113esac
114
115AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000116AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000117
gobrye721a522002-03-22 13:38:30 +0000118case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000119 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000120 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000121 VG_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000122
123 # Ok, this is linux. Check the kernel version
124 AC_MSG_CHECKING([for the kernel version])
125
126 kernel=`uname -r`
127
128 case "${kernel}" in
129 2.6.*)
130 AC_MSG_RESULT([2.6 family (${kernel})])
131 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
132 ;;
133
134 2.4.*)
135 AC_MSG_RESULT([2.4 family (${kernel})])
136 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
137 ;;
138
mueller8c68e042004-01-03 15:21:14 +0000139 *)
140 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000141 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000142 ;;
143 esac
144
145 ;;
146
147 *freebsd*)
148 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000149 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000150 ;;
151
152 *)
153 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000154 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000155 ;;
156esac
157
nethercote888ecb72004-08-23 14:54:40 +0000158AC_MSG_CHECKING([for a supported CPU/OS combination])
159AC_SUBST(VG_PLATFORM)
160
161VG_PLATFORM="$VG_ARCH-$VG_OS"
162
163case $VG_PLATFORM in
164 x86-linux)
165 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
166 ;;
167
sewardj3e38ce02004-11-23 01:17:29 +0000168 arm-linux)
169 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
170 ;;
171
nethercote888ecb72004-08-23 14:54:40 +0000172 *)
173 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000174 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000175 ;;
176esac
sewardjde4a1d02002-03-22 01:27:54 +0000177
sewardjde4a1d02002-03-22 01:27:54 +0000178AC_SUBST(DEFAULT_SUPP)
179
sewardjde4a1d02002-03-22 01:27:54 +0000180glibc=""
181
182AC_EGREP_CPP([GLIBC_21], [
183#include <features.h>
184#ifdef __GNU_LIBRARY__
185 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 1)
186 GLIBC_21
187 #endif
188#endif
189],
190glibc="2.1")
191
192AC_EGREP_CPP([GLIBC_22], [
193#include <features.h>
194#ifdef __GNU_LIBRARY__
195 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
196 GLIBC_22
197 #endif
198#endif
199],
200glibc="2.2")
201
sewardj08c7f012002-10-07 23:56:55 +0000202AC_EGREP_CPP([GLIBC_23], [
203#include <features.h>
204#ifdef __GNU_LIBRARY__
205 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
206 GLIBC_23
207 #endif
208#endif
209],
210glibc="2.3")
211
daywalkere9212b32003-06-15 22:39:15 +0000212AC_MSG_CHECKING([the glibc version])
213
gobrye721a522002-03-22 13:38:30 +0000214case "${glibc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000215 2.1)
216 AC_MSG_RESULT(2.1 family)
daywalker418c7482002-10-16 13:09:26 +0000217 AC_DEFINE([GLIBC_2_1], 1, [Define to 1 if you're using glibc 2.1.x])
gobry3b777892002-04-04 09:18:39 +0000218 DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.1.supp"
sewardjde4a1d02002-03-22 01:27:54 +0000219 ;;
220
221 2.2)
222 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000223 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
gobry3b777892002-04-04 09:18:39 +0000224 DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.2.supp"
sewardjde4a1d02002-03-22 01:27:54 +0000225 ;;
226
sewardj08c7f012002-10-07 23:56:55 +0000227 2.3)
228 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000229 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
daywalker63f6f782003-05-27 00:19:52 +0000230 DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.3.supp"
sewardj08c7f012002-10-07 23:56:55 +0000231 ;;
232
sewardjde4a1d02002-03-22 01:27:54 +0000233 *)
234 AC_MSG_RESULT(unsupported version)
sewardj08c7f012002-10-07 23:56:55 +0000235 AC_MSG_ERROR([Valgrind requires the glibc version 2.1, 2.2 or 2.3])
sewardjde4a1d02002-03-22 01:27:54 +0000236 ;;
237esac
238
sewardj3e909ce2002-06-03 13:27:15 +0000239# APIs introduced in recent glibc versions
240
241AC_MSG_CHECKING([whether sched_param has a sched_priority member])
242AC_CACHE_VAL(vg_have_sched_priority,
243[
244AC_TRY_COMPILE([#include <pthread.h>],[
245struct sched_param p; p.sched_priority=1;],
246vg_have_sched_priority=yes,
247vg_have_sched_priority=no)
248])
249AC_MSG_RESULT($vg_have_sched_priority)
250if test "$vg_have_sched_priority" = yes; then
daywalker418c7482002-10-16 13:09:26 +0000251AC_DEFINE([HAVE_SCHED_PRIORITY], 1, [pthread / sched_priority exists])
sewardj3e909ce2002-06-03 13:27:15 +0000252fi
253
nethercote3d260f62004-10-31 19:39:18 +0000254# We don't know how to detect the X client library version
255# (detecting the server version is easy, bu no help). So we
256# just use a hack: always include the suppressions for both
257# versions 3 and 4.
gobrye721a522002-03-22 13:38:30 +0000258AC_PATH_X
gobrye721a522002-03-22 13:38:30 +0000259if test "${no_x}" != 'yes' ; then
nethercote3d260f62004-10-31 19:39:18 +0000260 DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
261 DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp"
gobrye721a522002-03-22 13:38:30 +0000262fi
263
sewardj2e10a682003-04-07 19:36:41 +0000264
sewardj5b754b42002-06-03 22:53:35 +0000265# does this compiler support -mpreferred-stack-boundary=2 ?
266AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
267
daywalker3664f562003-10-17 13:43:46 +0000268safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000269CFLAGS="-mpreferred-stack-boundary=2"
270
271AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000272int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000273],
274[
275PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000276AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000277], [
278PREFERRED_STACK_BOUNDARY=""
279AC_MSG_RESULT([no])
280])
daywalker3664f562003-10-17 13:43:46 +0000281CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000282
283AC_SUBST(PREFERRED_STACK_BOUNDARY)
284
285
nethercote7f390022004-10-25 17:18:24 +0000286# Check for PIE support in the compiler and linker
287AC_CACHE_CHECK([for PIE support], vg_cv_pie,
288 [safe_CFLAGS=$CFLAGS
289 CFLAGS="$CFLAGS -fpie"
290 safe_LDFLAGS=$LDFLAGS
291 LDFLAGS="$LDFLAGS -pie"
292 AC_TRY_LINK([int foo;],
293 [],
294 [vg_cv_pie=yes],
295 [vg_cv_pie=no])
296 CFLAGS=$safe_CFLAGS
297 LDFLAGS=$safe_LDFLAGS])
298if test "$vg_cv_pie" = yes; then
299AC_DEFINE([HAVE_PIE], 1, [can create position-independent executables])
300fi
301AM_CONDITIONAL(USE_PIE, test "$vg_cv_pie" = "yes")
302
sewardj5b754b42002-06-03 22:53:35 +0000303
sewardjde4a1d02002-03-22 01:27:54 +0000304# Checks for header files.
305AC_HEADER_STDC
nethercote3d260f62004-10-31 19:39:18 +0000306AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h])
sewardjde4a1d02002-03-22 01:27:54 +0000307
308# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000309AC_TYPE_UID_T
310AC_TYPE_OFF_T
311AC_TYPE_SIZE_T
312AC_HEADER_TIME
thughesebed9982004-06-12 17:25:25 +0000313AC_CHECK_TYPES(__pthread_unwind_buf_t,,,[#include <pthread.h>])
sewardjde4a1d02002-03-22 01:27:54 +0000314
315# Checks for library functions.
316AC_FUNC_MEMCMP
317AC_FUNC_MMAP
318AC_TYPE_SIGNAL
319
thughesbeb6eb92004-06-14 12:33:43 +0000320AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop])
sewardjde4a1d02002-03-22 01:27:54 +0000321
gobrye721a522002-03-22 13:38:30 +0000322AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +0000323 Makefile
njn25cac76cb2002-09-23 11:21:57 +0000324 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +0000325 valgrind.pc
njn254d542432002-09-23 16:09:39 +0000326 docs/Makefile
327 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +0000328 tests/vg_regtest
njn251ffab942002-09-23 16:42:19 +0000329 tests/unused/Makefile
nethercotee90c6832004-10-18 18:07:49 +0000330 include/valgrind.h
njn254d542432002-09-23 16:09:39 +0000331 include/Makefile
nethercotec06e2132004-09-03 13:45:29 +0000332 include/x86/Makefile
nethercote73b526f2004-10-31 18:48:21 +0000333 include/linux/Makefile
334 include/x86-linux/Makefile
njn7a6e7462002-11-09 17:53:30 +0000335 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +0000336 coregrind/Makefile
337 coregrind/demangle/Makefile
338 coregrind/docs/Makefile
fitzhardinge98abfc72003-12-16 02:05:15 +0000339 coregrind/x86/Makefile
nethercote8ff888f2004-11-17 17:11:45 +0000340 coregrind/linux/Makefile
nethercotef94fe2f2004-09-10 14:23:59 +0000341 coregrind/x86-linux/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000342 addrcheck/Makefile
njnf2df9b52002-10-04 11:35:47 +0000343 addrcheck/tests/Makefile
nethercotebfd20192004-10-19 18:54:11 +0000344 addrcheck/tests/x86/Makefile
njn7da8fa72002-10-03 10:38:40 +0000345 addrcheck/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000346 memcheck/Makefile
347 memcheck/tests/Makefile
nethercotebfd20192004-10-19 18:54:11 +0000348 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000349 memcheck/docs/Makefile
350 cachegrind/Makefile
nethercoteb35a8b92004-09-11 16:45:27 +0000351 cachegrind/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000352 cachegrind/tests/Makefile
nethercotea255d802004-10-19 17:00:59 +0000353 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000354 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +0000355 cachegrind/cg_annotate
njn25cac76cb2002-09-23 11:21:57 +0000356 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +0000357 helgrind/tests/Makefile
nethercotebfd20192004-10-19 18:54:11 +0000358 helgrind/tests/x86/Makefile
njn83157fc2002-10-03 10:07:34 +0000359 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +0000360 massif/Makefile
361 massif/hp2ps/Makefile
362 massif/tests/Makefile
363 massif/docs/Makefile
364 corecheck/Makefile
365 corecheck/tests/Makefile
366 corecheck/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000367 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +0000368 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +0000369 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000370 none/Makefile
371 none/tests/Makefile
nethercotebfd20192004-10-19 18:54:11 +0000372 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +0000373 none/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +0000374)
gobry3b777892002-04-04 09:18:39 +0000375
376cat<<EOF
377
378Using the following suppressions by default:
379
380 ${DEFAULT_SUPP}
381EOF
382
383cat<<EOF > default.supp
384# This is a generated file, composed of the following suppression rules:
385#
386# ${DEFAULT_SUPP}
387#
388
389EOF
390
391for file in ${DEFAULT_SUPP} ; do
392 cat ${srcdir}/$file >> default.supp
393done