blob: 91f0e8dd44e3cf9d1ac51a46c947bfddd3777418 [file] [log] [blame]
sewardjde4a1d02002-03-22 01:27:54 +00001# Process this file with autoconf to produce a configure script.
2AC_INIT(vg_clientmalloc.c)
3AM_CONFIG_HEADER(config.h)
sewardjca2a7212002-05-16 23:42:39 +00004AM_INIT_AUTOMAKE(valgrind, 20020516)
sewardjde4a1d02002-03-22 01:27:54 +00005
gobryb0ed4672002-03-27 20:58:58 +00006AM_MAINTAINER_MODE
7
sewardjde4a1d02002-03-22 01:27:54 +00008# Checks for programs.
gobrye721a522002-03-22 13:38:30 +00009CFLAGS=""
10
sewardjde4a1d02002-03-22 01:27:54 +000011AC_PROG_LN_S
12AC_PROG_CC
13AC_PROG_CPP
14AC_PROG_RANLIB
15
gobrye721a522002-03-22 13:38:30 +000016# Check for the compiler support
17if test "${GCC}" != "yes" ; then
18 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
19fi
20
daywalker48ccca52002-04-15 00:31:58 +000021# some older automake's don't have it so try something on our own
22ifdef([AM_PROG_AS],[AM_PROG_AS],
23[
gobry1be19852002-03-26 20:44:55 +000024AS="${CC}"
25AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000026
gobry1be19852002-03-26 20:44:55 +000027ASFLAGS=""
28AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000029])
gobry3b777892002-04-04 09:18:39 +000030
31# This variable will collect the individual suppression files
32# depending on the results of autoconf
33
34DEFAULT_SUPP=""
35
36
gobrye721a522002-03-22 13:38:30 +000037# We don't want gcc 2.7
38AC_MSG_CHECKING([for a supported version of gcc])
39
40gcc_version=`${CC} --version`
41
42case "${gcc_version}" in
43 gcc-2.7.*)
44 AC_MSG_RESULT([no (${gcc_version})])
45 AC_MSG_ERROR([please use a recent (>= gcc-2.95) version of gcc])
46 ;;
47
48 *)
49 AC_MSG_RESULT([ok (${gcc_version})])
50 ;;
51esac
52
53# does this compiler support -mpreferred-stack-boundary=2 ?
54AC_MSG_CHECKING([for extra compiler options])
55
56CFLAGS="-mpreferred-stack-boundary=2"
57
58AC_TRY_COMPILE(, [
59
60int main () { return 0 ; }
61
62],
63[
64PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
65AC_MSG_RESULT([$PREFERRED_STACK_BOUNDARY])
66], [
67PREFERRED_STACK_BOUNDARY=""
68AC_MSG_RESULT([none])
69])
70
71AC_SUBST(PREFERRED_STACK_BOUNDARY)
72
sewardjde4a1d02002-03-22 01:27:54 +000073# Checks for the platform
74AC_CANONICAL_HOST
75
76AC_MSG_CHECKING([for a supported CPU])
77
gobrye721a522002-03-22 13:38:30 +000078case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +000079 i?86)
80 AC_MSG_RESULT([ok (${host_cpu})])
81 ;;
82
83 *)
84 AC_MSG_RESULT([no (${host_cpu})])
85 AC_MSG_ERROR([Valgrind is ix86 specific. Sorry])
86 ;;
87esac
88
89AC_MSG_CHECKING([for a supported OS])
90
gobrye721a522002-03-22 13:38:30 +000091case "${host_os}" in
sewardjde4a1d02002-03-22 01:27:54 +000092 *linux*)
93 AC_MSG_RESULT([ok (${host_os})])
94 ;;
95
96 *)
97 AC_MSG_RESULT([no (${host_os})])
98 AC_MSG_ERROR([Valgrind is Linux specific. Sorry])
99 ;;
100esac
101
102
103# Ok, this is linux. Check the kernel version
104AC_MSG_CHECKING([for the kernel version])
105
106kernel=`uname -r`
107
gobrye721a522002-03-22 13:38:30 +0000108case "${kernel}" in
sewardjde4a1d02002-03-22 01:27:54 +0000109 2.4.*)
110 AC_MSG_RESULT([2.4 family (${kernel})])
111 AC_DEFINE(KERNEL_2_4)
sewardjde4a1d02002-03-22 01:27:54 +0000112 ;;
113
114 2.2.*)
115 AC_MSG_RESULT([2.2 family (${kernel})])
116 AC_DEFINE(KERNEL_2_2)
sewardjde4a1d02002-03-22 01:27:54 +0000117 ;;
118
119 *)
120 AC_MSG_RESULT([unsupported (${kernel})])
121 AC_MSG_ERROR([Valgrind works on kernels 2.2 and 2.4])
122 ;;
123esac
124
125AC_SUBST(DEFAULT_SUPP)
126
127
128# Ok, this is linux. Check the kernel version
129AC_MSG_CHECKING([the glibc version])
130
131glibc=""
132
133AC_EGREP_CPP([GLIBC_21], [
134#include <features.h>
135#ifdef __GNU_LIBRARY__
136 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 1)
137 GLIBC_21
138 #endif
139#endif
140],
141glibc="2.1")
142
143AC_EGREP_CPP([GLIBC_22], [
144#include <features.h>
145#ifdef __GNU_LIBRARY__
146 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
147 GLIBC_22
148 #endif
149#endif
150],
151glibc="2.2")
152
gobrye721a522002-03-22 13:38:30 +0000153case "${glibc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000154 2.1)
155 AC_MSG_RESULT(2.1 family)
156 AC_DEFINE(GLIBC_2_1)
gobry3b777892002-04-04 09:18:39 +0000157 DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.1.supp"
sewardjde4a1d02002-03-22 01:27:54 +0000158 ;;
159
160 2.2)
161 AC_MSG_RESULT(2.2 family)
162 AC_DEFINE(GLIBC_2_2)
gobry3b777892002-04-04 09:18:39 +0000163 DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.2.supp"
sewardjde4a1d02002-03-22 01:27:54 +0000164 ;;
165
166 *)
167 AC_MSG_RESULT(unsupported version)
168 AC_MSG_ERROR([Valgrind requires the glibc version 2.1 or 2.2])
169 ;;
170esac
171
172# try to detect the XFree version
173
gobrye721a522002-03-22 13:38:30 +0000174AC_PATH_X
175
176if test "${no_x}" != 'yes' ; then
177
178 AC_MSG_CHECKING([XFree version])
179
180 cat<<EOF > conftest.c
181#include <X11/Xlib.h>
182
183int main (int argc, char * argv [])
184{
185 Display * display = XOpenDisplay (NULL);
186
187 if (display) {
188 printf ("%s version=%d\n", ServerVendor (display), VendorRelease (display));
189 }
190
191 return 0;
192}
193EOF
194
195 ${CC} -o conftest conftest.c -I${x_includes} -L${x_libraries} -lX11 >&5 2>&1
196
197 if test "$?" != 0 ; then
198 AC_MSG_RESULT([cannot compile test program])
199 else
200 xfree=`./conftest`
201
202 case "${xfree}" in
203 *XFree86*)
204 ;;
205
206 *) AC_MSG_RESULT([not a XFree86 server])
207 ;;
208 esac
209
210 case "${xfree}" in
211
212 *version=4*)
213 AC_MSG_RESULT([XFree 4.x family])
214 AC_DEFINE(XFREE_4)
gobry3b777892002-04-04 09:18:39 +0000215 DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
gobrye721a522002-03-22 13:38:30 +0000216 ;;
217
218 *version=3*)
219 AC_MSG_RESULT([XFree 3.x family])
220 AC_DEFINE(XFREE_3)
gobry3b777892002-04-04 09:18:39 +0000221 DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp"
gobrye721a522002-03-22 13:38:30 +0000222 ;;
223
224 *) AC_MSG_RESULT([unknown XFree86 server (${xfree})])
225 ;;
226 esac
227 fi
228
229 rm -f conftest conftest.c
230fi
231
sewardjde4a1d02002-03-22 01:27:54 +0000232# Checks for header files.
233AC_HEADER_STDC
234AC_CHECK_HEADERS([fcntl.h malloc.h stdlib.h string.h sys/socket.h sys/statfs.h sys/time.h termios.h unistd.h utime.h])
235
236# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +0000237AC_TYPE_UID_T
238AC_TYPE_OFF_T
239AC_TYPE_SIZE_T
240AC_HEADER_TIME
241
242# Checks for library functions.
243AC_FUNC_MEMCMP
244AC_FUNC_MMAP
245AC_TYPE_SIGNAL
246
247AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr])
248
gobrye721a522002-03-22 13:38:30 +0000249AC_OUTPUT(
sewardjaa6fecc2002-04-29 17:27:07 +0000250 vg_annotate
251 vg_cachegen
gobrye721a522002-03-22 13:38:30 +0000252 valgrind
253 valgrind.spec
sewardj83adf412002-05-01 01:25:45 +0000254 cachegrind
sewardjde4a1d02002-03-22 01:27:54 +0000255 Makefile
256 docs/Makefile
257 tests/Makefile
258 demangle/Makefile)
gobry3b777892002-04-04 09:18:39 +0000259
260cat<<EOF
261
262Using the following suppressions by default:
263
264 ${DEFAULT_SUPP}
265EOF
266
267cat<<EOF > default.supp
268# This is a generated file, composed of the following suppression rules:
269#
270# ${DEFAULT_SUPP}
271#
272
273EOF
274
275for file in ${DEFAULT_SUPP} ; do
276 cat ${srcdir}/$file >> default.supp
277done