sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | # Process this file with autoconf to produce a configure script. |
| 2 | AC_INIT(vg_clientmalloc.c) |
| 3 | AM_CONFIG_HEADER(config.h) |
sewardj | 9b9e10a | 2002-06-14 10:40:16 +0000 | [diff] [blame] | 4 | AM_INIT_AUTOMAKE(valgrind, 1.0pre1) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 5 | |
gobry | b0ed467 | 2002-03-27 20:58:58 +0000 | [diff] [blame] | 6 | AM_MAINTAINER_MODE |
| 7 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 8 | # Checks for programs. |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 9 | CFLAGS="" |
| 10 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 11 | AC_PROG_LN_S |
| 12 | AC_PROG_CC |
| 13 | AC_PROG_CPP |
| 14 | AC_PROG_RANLIB |
| 15 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 16 | # Check for the compiler support |
| 17 | if test "${GCC}" != "yes" ; then |
| 18 | AC_MSG_ERROR([Valgrind relies on GCC to be compiled]) |
| 19 | fi |
| 20 | |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 21 | # some older automake's don't have it so try something on our own |
| 22 | ifdef([AM_PROG_AS],[AM_PROG_AS], |
| 23 | [ |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 24 | AS="${CC}" |
| 25 | AC_SUBST(AS) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 26 | |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 27 | ASFLAGS="" |
| 28 | AC_SUBST(ASFLAGS) |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 29 | ]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 30 | |
| 31 | # This variable will collect the individual suppression files |
| 32 | # depending on the results of autoconf |
| 33 | |
| 34 | DEFAULT_SUPP="" |
| 35 | |
| 36 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 37 | # We don't want gcc 2.7 |
| 38 | AC_MSG_CHECKING([for a supported version of gcc]) |
| 39 | |
daywalker | 870ac4c | 2002-05-21 00:09:48 +0000 | [diff] [blame] | 40 | gcc_version=`${CC} --version | head -n 1` |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 41 | |
| 42 | case "${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 | ;; |
| 51 | esac |
| 52 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 53 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 54 | # Checks for the platform |
| 55 | AC_CANONICAL_HOST |
| 56 | |
| 57 | AC_MSG_CHECKING([for a supported CPU]) |
| 58 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 59 | case "${host_cpu}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 60 | i?86) |
| 61 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 62 | ;; |
| 63 | |
| 64 | *) |
| 65 | AC_MSG_RESULT([no (${host_cpu})]) |
| 66 | AC_MSG_ERROR([Valgrind is ix86 specific. Sorry]) |
| 67 | ;; |
| 68 | esac |
| 69 | |
| 70 | AC_MSG_CHECKING([for a supported OS]) |
| 71 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 72 | case "${host_os}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 73 | *linux*) |
| 74 | AC_MSG_RESULT([ok (${host_os})]) |
| 75 | ;; |
| 76 | |
| 77 | *) |
| 78 | AC_MSG_RESULT([no (${host_os})]) |
| 79 | AC_MSG_ERROR([Valgrind is Linux specific. Sorry]) |
| 80 | ;; |
| 81 | esac |
| 82 | |
| 83 | |
| 84 | # Ok, this is linux. Check the kernel version |
| 85 | AC_MSG_CHECKING([for the kernel version]) |
| 86 | |
| 87 | kernel=`uname -r` |
| 88 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 89 | case "${kernel}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 90 | 2.4.*) |
| 91 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 92 | AC_DEFINE(KERNEL_2_4) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 93 | ;; |
| 94 | |
| 95 | 2.2.*) |
| 96 | AC_MSG_RESULT([2.2 family (${kernel})]) |
| 97 | AC_DEFINE(KERNEL_2_2) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 98 | ;; |
| 99 | |
| 100 | *) |
| 101 | AC_MSG_RESULT([unsupported (${kernel})]) |
| 102 | AC_MSG_ERROR([Valgrind works on kernels 2.2 and 2.4]) |
| 103 | ;; |
| 104 | esac |
| 105 | |
| 106 | AC_SUBST(DEFAULT_SUPP) |
| 107 | |
| 108 | |
| 109 | # Ok, this is linux. Check the kernel version |
| 110 | AC_MSG_CHECKING([the glibc version]) |
| 111 | |
| 112 | glibc="" |
| 113 | |
| 114 | AC_EGREP_CPP([GLIBC_21], [ |
| 115 | #include <features.h> |
| 116 | #ifdef __GNU_LIBRARY__ |
| 117 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 1) |
| 118 | GLIBC_21 |
| 119 | #endif |
| 120 | #endif |
| 121 | ], |
| 122 | glibc="2.1") |
| 123 | |
| 124 | AC_EGREP_CPP([GLIBC_22], [ |
| 125 | #include <features.h> |
| 126 | #ifdef __GNU_LIBRARY__ |
| 127 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2) |
| 128 | GLIBC_22 |
| 129 | #endif |
| 130 | #endif |
| 131 | ], |
| 132 | glibc="2.2") |
| 133 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 134 | case "${glibc}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 135 | 2.1) |
| 136 | AC_MSG_RESULT(2.1 family) |
| 137 | AC_DEFINE(GLIBC_2_1) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 138 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.1.supp" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 139 | ;; |
| 140 | |
| 141 | 2.2) |
| 142 | AC_MSG_RESULT(2.2 family) |
| 143 | AC_DEFINE(GLIBC_2_2) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 144 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.2.supp" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 145 | ;; |
| 146 | |
| 147 | *) |
| 148 | AC_MSG_RESULT(unsupported version) |
| 149 | AC_MSG_ERROR([Valgrind requires the glibc version 2.1 or 2.2]) |
| 150 | ;; |
| 151 | esac |
| 152 | |
sewardj | 3e909ce | 2002-06-03 13:27:15 +0000 | [diff] [blame] | 153 | # APIs introduced in recent glibc versions |
| 154 | |
| 155 | AC_MSG_CHECKING([whether sched_param has a sched_priority member]) |
| 156 | AC_CACHE_VAL(vg_have_sched_priority, |
| 157 | [ |
| 158 | AC_TRY_COMPILE([#include <pthread.h>],[ |
| 159 | struct sched_param p; p.sched_priority=1;], |
| 160 | vg_have_sched_priority=yes, |
| 161 | vg_have_sched_priority=no) |
| 162 | ]) |
| 163 | AC_MSG_RESULT($vg_have_sched_priority) |
| 164 | if test "$vg_have_sched_priority" = yes; then |
| 165 | AC_DEFINE(HAVE_SCHED_PRIORITY) |
| 166 | fi |
| 167 | |
| 168 | AC_MSG_CHECKING([whether nfds_t is defined]) |
| 169 | AC_CACHE_VAL(vg_have_nfds_t, |
| 170 | [ |
| 171 | AC_TRY_COMPILE([#include <sys/poll.h>],[ |
| 172 | nfds_t i=0;], |
| 173 | vg_have_nfds_t=yes, |
| 174 | vg_have_nfds_t=no) |
| 175 | ]) |
| 176 | AC_MSG_RESULT($vg_have_nfds_t) |
| 177 | if test "$vg_have_nfds_t" = yes; then |
| 178 | AC_DEFINE(HAVE_NFDS_T) |
| 179 | fi |
| 180 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 181 | # try to detect the XFree version |
sewardj | 8ce25cd | 2002-06-18 01:05:58 +0000 | [diff] [blame^] | 182 | # JRS 2002-06-17: this is completely bogus because it |
| 183 | # detects the server version, whereas we need to know the |
| 184 | # client library version. So what follows is hacked to |
| 185 | # use all the X supp files regardless of what is detected. |
| 186 | # This is really stoooopid and should be fixed properly. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 187 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 188 | AC_PATH_X |
| 189 | |
| 190 | if test "${no_x}" != 'yes' ; then |
| 191 | |
| 192 | AC_MSG_CHECKING([XFree version]) |
| 193 | |
| 194 | cat<<EOF > conftest.c |
| 195 | #include <X11/Xlib.h> |
| 196 | |
| 197 | int main (int argc, char * argv []) |
| 198 | { |
| 199 | Display * display = XOpenDisplay (NULL); |
| 200 | |
| 201 | if (display) { |
| 202 | printf ("%s version=%d\n", ServerVendor (display), VendorRelease (display)); |
| 203 | } |
| 204 | |
| 205 | return 0; |
| 206 | } |
| 207 | EOF |
| 208 | |
| 209 | ${CC} -o conftest conftest.c -I${x_includes} -L${x_libraries} -lX11 >&5 2>&1 |
| 210 | |
| 211 | if test "$?" != 0 ; then |
| 212 | AC_MSG_RESULT([cannot compile test program]) |
| 213 | else |
| 214 | xfree=`./conftest` |
| 215 | |
| 216 | case "${xfree}" in |
| 217 | *XFree86*) |
| 218 | ;; |
| 219 | |
| 220 | *) AC_MSG_RESULT([not a XFree86 server]) |
| 221 | ;; |
| 222 | esac |
| 223 | |
| 224 | case "${xfree}" in |
| 225 | |
| 226 | *version=4*) |
| 227 | AC_MSG_RESULT([XFree 4.x family]) |
| 228 | AC_DEFINE(XFREE_4) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 229 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp" |
sewardj | 8ce25cd | 2002-06-18 01:05:58 +0000 | [diff] [blame^] | 230 | # haaaaaaack! |
| 231 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 232 | ;; |
| 233 | |
| 234 | *version=3*) |
| 235 | AC_MSG_RESULT([XFree 3.x family]) |
| 236 | AC_DEFINE(XFREE_3) |
sewardj | 19e6a4d | 2002-05-22 11:58:25 +0000 | [diff] [blame] | 237 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp" |
sewardj | 8ce25cd | 2002-06-18 01:05:58 +0000 | [diff] [blame^] | 238 | # haaaaaaack! |
| 239 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 240 | ;; |
| 241 | |
| 242 | *) AC_MSG_RESULT([unknown XFree86 server (${xfree})]) |
sewardj | 8ce25cd | 2002-06-18 01:05:58 +0000 | [diff] [blame^] | 243 | # haaaaaaack! |
| 244 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp" |
| 245 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 246 | ;; |
| 247 | esac |
| 248 | fi |
| 249 | |
| 250 | rm -f conftest conftest.c |
| 251 | fi |
| 252 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 253 | # does this compiler support -mpreferred-stack-boundary=2 ? |
| 254 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary]) |
| 255 | |
| 256 | CFLAGS="-mpreferred-stack-boundary=2" |
| 257 | |
| 258 | AC_TRY_COMPILE(, [ |
| 259 | |
| 260 | int main () { return 0 ; } |
| 261 | |
| 262 | ], |
| 263 | [ |
| 264 | PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2" |
| 265 | AC_MSG_RESULT([$PREFERRED_STACK_BOUNDARY]) |
| 266 | ], [ |
| 267 | PREFERRED_STACK_BOUNDARY="" |
| 268 | AC_MSG_RESULT([no]) |
| 269 | ]) |
| 270 | |
| 271 | AC_SUBST(PREFERRED_STACK_BOUNDARY) |
| 272 | |
| 273 | |
| 274 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 275 | # Checks for header files. |
| 276 | AC_HEADER_STDC |
sewardj | a83005f | 2002-06-13 16:07:51 +0000 | [diff] [blame] | 277 | AC_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]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 278 | |
| 279 | # Checks for typedefs, structures, and compiler characteristics. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 280 | AC_TYPE_UID_T |
| 281 | AC_TYPE_OFF_T |
| 282 | AC_TYPE_SIZE_T |
| 283 | AC_HEADER_TIME |
| 284 | |
| 285 | # Checks for library functions. |
| 286 | AC_FUNC_MEMCMP |
| 287 | AC_FUNC_MMAP |
| 288 | AC_TYPE_SIGNAL |
| 289 | |
| 290 | AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr]) |
| 291 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 292 | AC_OUTPUT( |
sewardj | aa6fecc | 2002-04-29 17:27:07 +0000 | [diff] [blame] | 293 | vg_annotate |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 294 | valgrind |
| 295 | valgrind.spec |
sewardj | 83adf41 | 2002-05-01 01:25:45 +0000 | [diff] [blame] | 296 | cachegrind |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 297 | Makefile |
| 298 | docs/Makefile |
| 299 | tests/Makefile |
| 300 | demangle/Makefile) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 301 | |
| 302 | cat<<EOF |
| 303 | |
| 304 | Using the following suppressions by default: |
| 305 | |
| 306 | ${DEFAULT_SUPP} |
| 307 | EOF |
| 308 | |
| 309 | cat<<EOF > default.supp |
| 310 | # This is a generated file, composed of the following suppression rules: |
| 311 | # |
| 312 | # ${DEFAULT_SUPP} |
| 313 | # |
| 314 | |
| 315 | EOF |
| 316 | |
| 317 | for file in ${DEFAULT_SUPP} ; do |
| 318 | cat ${srcdir}/$file >> default.supp |
| 319 | done |