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