blob: 95093ed9de95ae3b5f05fa70df131d27a4b719e1 [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)
4AM_INIT_AUTOMAKE(valgrind, 20020317)
5
6# Checks for programs.
gobrye721a522002-03-22 13:38:30 +00007CFLAGS=""
8
sewardjde4a1d02002-03-22 01:27:54 +00009AC_PROG_LN_S
10AC_PROG_CC
11AC_PROG_CPP
12AC_PROG_RANLIB
13
gobrye721a522002-03-22 13:38:30 +000014# Check for the compiler support
15if test "${GCC}" != "yes" ; then
16 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
17fi
18
19# We don't want gcc 2.7
20AC_MSG_CHECKING([for a supported version of gcc])
21
22gcc_version=`${CC} --version`
23
24case "${gcc_version}" in
25 gcc-2.7.*)
26 AC_MSG_RESULT([no (${gcc_version})])
27 AC_MSG_ERROR([please use a recent (>= gcc-2.95) version of gcc])
28 ;;
29
30 *)
31 AC_MSG_RESULT([ok (${gcc_version})])
32 ;;
33esac
34
35# does this compiler support -mpreferred-stack-boundary=2 ?
36AC_MSG_CHECKING([for extra compiler options])
37
38CFLAGS="-mpreferred-stack-boundary=2"
39
40AC_TRY_COMPILE(, [
41
42int main () { return 0 ; }
43
44],
45[
46PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
47AC_MSG_RESULT([$PREFERRED_STACK_BOUNDARY])
48], [
49PREFERRED_STACK_BOUNDARY=""
50AC_MSG_RESULT([none])
51])
52
53AC_SUBST(PREFERRED_STACK_BOUNDARY)
54
sewardjde4a1d02002-03-22 01:27:54 +000055CFLAGS="-Winline -Wall -Wshadow -O -fomit-frame-pointer -g"
56AC_SUBST(CFLAGS)
57
58# Checks for the platform
59AC_CANONICAL_HOST
60
61AC_MSG_CHECKING([for a supported CPU])
62
gobrye721a522002-03-22 13:38:30 +000063case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +000064 i?86)
65 AC_MSG_RESULT([ok (${host_cpu})])
66 ;;
67
68 *)
69 AC_MSG_RESULT([no (${host_cpu})])
70 AC_MSG_ERROR([Valgrind is ix86 specific. Sorry])
71 ;;
72esac
73
74AC_MSG_CHECKING([for a supported OS])
75
gobrye721a522002-03-22 13:38:30 +000076case "${host_os}" in
sewardjde4a1d02002-03-22 01:27:54 +000077 *linux*)
78 AC_MSG_RESULT([ok (${host_os})])
79 ;;
80
81 *)
82 AC_MSG_RESULT([no (${host_os})])
83 AC_MSG_ERROR([Valgrind is Linux specific. Sorry])
84 ;;
85esac
86
87
88# Ok, this is linux. Check the kernel version
89AC_MSG_CHECKING([for the kernel version])
90
91kernel=`uname -r`
92
gobrye721a522002-03-22 13:38:30 +000093case "${kernel}" in
sewardjde4a1d02002-03-22 01:27:54 +000094 2.4.*)
95 AC_MSG_RESULT([2.4 family (${kernel})])
96 AC_DEFINE(KERNEL_2_4)
97 DEFAULT_SUPP="linux24.supp"
98 ;;
99
100 2.2.*)
101 AC_MSG_RESULT([2.2 family (${kernel})])
102 AC_DEFINE(KERNEL_2_2)
103 DEFAULT_SUPP="linux22.supp"
104 ;;
105
106 *)
107 AC_MSG_RESULT([unsupported (${kernel})])
108 AC_MSG_ERROR([Valgrind works on kernels 2.2 and 2.4])
109 ;;
110esac
111
112AC_SUBST(DEFAULT_SUPP)
113
114
115# Ok, this is linux. Check the kernel version
116AC_MSG_CHECKING([the glibc version])
117
118glibc=""
119
120AC_EGREP_CPP([GLIBC_21], [
121#include <features.h>
122#ifdef __GNU_LIBRARY__
123 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 1)
124 GLIBC_21
125 #endif
126#endif
127],
128glibc="2.1")
129
130AC_EGREP_CPP([GLIBC_22], [
131#include <features.h>
132#ifdef __GNU_LIBRARY__
133 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
134 GLIBC_22
135 #endif
136#endif
137],
138glibc="2.2")
139
gobrye721a522002-03-22 13:38:30 +0000140case "${glibc}" in
sewardjde4a1d02002-03-22 01:27:54 +0000141 2.1)
142 AC_MSG_RESULT(2.1 family)
143 AC_DEFINE(GLIBC_2_1)
144 ;;
145
146 2.2)
147 AC_MSG_RESULT(2.2 family)
148 AC_DEFINE(GLIBC_2_2)
149 ;;
150
151 *)
152 AC_MSG_RESULT(unsupported version)
153 AC_MSG_ERROR([Valgrind requires the glibc version 2.1 or 2.2])
154 ;;
155esac
156
157# try to detect the XFree version
158
gobrye721a522002-03-22 13:38:30 +0000159AC_PATH_X
160
161if test "${no_x}" != 'yes' ; then
162
163 AC_MSG_CHECKING([XFree version])
164
165 cat<<EOF > conftest.c
166#include <X11/Xlib.h>
167
168int main (int argc, char * argv [])
169{
170 Display * display = XOpenDisplay (NULL);
171
172 if (display) {
173 printf ("%s version=%d\n", ServerVendor (display), VendorRelease (display));
174 }
175
176 return 0;
177}
178EOF
179
180 ${CC} -o conftest conftest.c -I${x_includes} -L${x_libraries} -lX11 >&5 2>&1
181
182 if test "$?" != 0 ; then
183 AC_MSG_RESULT([cannot compile test program])
184 else
185 xfree=`./conftest`
186
187 case "${xfree}" in
188 *XFree86*)
189 ;;
190
191 *) AC_MSG_RESULT([not a XFree86 server])
192 ;;
193 esac
194
195 case "${xfree}" in
196
197 *version=4*)
198 AC_MSG_RESULT([XFree 4.x family])
199 AC_DEFINE(XFREE_4)
200 ;;
201
202 *version=3*)
203 AC_MSG_RESULT([XFree 3.x family])
204 AC_DEFINE(XFREE_3)
205 ;;
206
207 *) AC_MSG_RESULT([unknown XFree86 server (${xfree})])
208 ;;
209 esac
210 fi
211
212 rm -f conftest conftest.c
213fi
214
sewardjde4a1d02002-03-22 01:27:54 +0000215# Checks for header files.
216AC_HEADER_STDC
217AC_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])
218
219# Checks for typedefs, structures, and compiler characteristics.
220AC_C_CONST
221AC_TYPE_UID_T
222AC_TYPE_OFF_T
223AC_TYPE_SIZE_T
224AC_HEADER_TIME
225
226# Checks for library functions.
227AC_FUNC_MEMCMP
228AC_FUNC_MMAP
229AC_TYPE_SIGNAL
230
231AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr])
232
gobrye721a522002-03-22 13:38:30 +0000233AC_OUTPUT(
234 valgrind
235 valgrind.spec
sewardjde4a1d02002-03-22 01:27:54 +0000236 Makefile
237 docs/Makefile
238 tests/Makefile
239 demangle/Makefile)