sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | # Process this file with autoconf to produce a configure script. |
sewardj | c62cc06 | 2005-03-19 23:45:04 +0000 | [diff] [blame] | 2 | AC_INIT(Valgrind, 3.0.0.SVN, valgrind-users@lists.sourceforge.net) |
njn | 04e1698 | 2005-05-31 00:23:43 +0000 | [diff] [blame] | 3 | AC_CONFIG_SRCDIR(coregrind/m_main.c) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 4 | AM_CONFIG_HEADER(config.h) |
thughes | 6dbad73 | 2004-08-29 09:46:38 +0000 | [diff] [blame] | 5 | AM_INIT_AUTOMAKE |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 6 | |
gobry | b0ed467 | 2002-03-27 20:58:58 +0000 | [diff] [blame] | 7 | AM_MAINTAINER_MODE |
| 8 | |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 9 | # Where is VEX ? |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 10 | # Nb: For the 2nd arg, the help string, AS_HELP_STRING is the proper way, but |
| 11 | # older autoconfs don't support it... here's what it would say: |
| 12 | # |
| 13 | # AS_HELP_STRING([--with-vex], [Vex directory (must be specified!)]), |
| 14 | # |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 15 | AC_ARG_WITH(vex, |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 16 | [ --with-vex=/path/to/vex/dir Vex directory (must be specified!)], |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 17 | [ |
| 18 | AC_CHECK_FILE($withval/pub/libvex.h, |
| 19 | [VEX_DIR=$withval], |
| 20 | [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain Vex])]) |
| 21 | ], |
| 22 | [ |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 23 | AC_MSG_ERROR([You must specify --with-vex=/path/to/vex/dir]) |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 24 | ]) |
sewardj | 50629ec | 2004-11-22 13:44:11 +0000 | [diff] [blame] | 25 | AC_SUBST(VEX_DIR) |
| 26 | |
njn | 657d951 | 2005-06-24 15:20:52 +0000 | [diff] [blame] | 27 | # "make distcheck" first builds a tarball, then extracts it. |
| 28 | # Then it creates a build directory different from the extracted sources |
| 29 | # (called _build), and issues |
| 30 | # |
| 31 | # ../configure $(DISTCHECK_CONFIGURE_FLAGS) |
| 32 | # |
| 33 | # and then builds, runs "make check", installs using DESTDIR, runs make |
| 34 | # installcheck, uninstalls, checks whether the installed base is empty |
| 35 | # again, then does yet another "make dist" and compares the resulting |
| 36 | # tarball with the one it started off with for identical content. Then it |
| 37 | # tests "make distclean" for no leftover files. |
| 38 | # |
| 39 | # So this line means: when doing "make dist", use the same --with-vex value |
| 40 | # that you used when running configure to configure this tree in the first |
| 41 | # place. |
| 42 | AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], [--with-vex=$VEX_DIR]) |
| 43 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 44 | # Checks for programs. |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 45 | CFLAGS="-Wno-long-long" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 46 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 47 | AC_PROG_LN_S |
| 48 | AC_PROG_CC |
njn | ca0518d | 2004-11-26 19:34:36 +0000 | [diff] [blame] | 49 | ##AM_PROG_CC_C_O |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 50 | AC_PROG_CPP |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 51 | AC_PROG_CXX |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 52 | AC_PROG_RANLIB |
| 53 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 54 | # Check for the compiler support |
| 55 | if test "${GCC}" != "yes" ; then |
| 56 | AC_MSG_ERROR([Valgrind relies on GCC to be compiled]) |
| 57 | fi |
| 58 | |
sewardj | 2f68595 | 2002-12-22 19:32:23 +0000 | [diff] [blame] | 59 | # figure out where perl lives |
| 60 | AC_PATH_PROG(PERL, perl) |
| 61 | |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 62 | # figure out where gdb lives |
| 63 | AC_PATH_PROG(GDB, gdb) |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 64 | AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB]) |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 65 | |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 66 | # some older automake's don't have it so try something on our own |
| 67 | ifdef([AM_PROG_AS],[AM_PROG_AS], |
| 68 | [ |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 69 | AS="${CC}" |
| 70 | AC_SUBST(AS) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 71 | |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 72 | ASFLAGS="" |
| 73 | AC_SUBST(ASFLAGS) |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 74 | ]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 75 | |
| 76 | # This variable will collect the individual suppression files |
| 77 | # depending on the results of autoconf |
| 78 | |
| 79 | DEFAULT_SUPP="" |
| 80 | |
| 81 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 82 | # We don't want gcc < 3.0 |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 83 | AC_MSG_CHECKING([for a supported version of gcc]) |
| 84 | |
daywalker | 870ac4c | 2002-05-21 00:09:48 +0000 | [diff] [blame] | 85 | gcc_version=`${CC} --version | head -n 1` |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 86 | |
| 87 | case "${gcc_version}" in |
| 88 | gcc-2.7.*) |
| 89 | AC_MSG_RESULT([no (${gcc_version})]) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 90 | AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc]) |
| 91 | ;; |
| 92 | gcc-2.8.*) |
| 93 | AC_MSG_RESULT([no (${gcc_version})]) |
| 94 | AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc]) |
| 95 | ;; |
| 96 | gcc-2.9*) |
| 97 | AC_MSG_RESULT([no (${gcc_version})]) |
| 98 | AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc]) |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 99 | ;; |
| 100 | |
| 101 | *) |
| 102 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 103 | ;; |
| 104 | esac |
| 105 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 106 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 107 | # Checks for the platform |
| 108 | AC_CANONICAL_HOST |
| 109 | |
| 110 | AC_MSG_CHECKING([for a supported CPU]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 111 | AC_SUBST(VG_ARCH) |
njn | a5f1bcd | 2004-11-27 16:47:42 +0000 | [diff] [blame] | 112 | AC_SUBST(VG_ARCH_ALL) |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 113 | VG_ARCH_ALL="amd64 arm ppc32 x86" |
nethercote | 2b72e94 | 2004-10-25 14:05:56 +0000 | [diff] [blame] | 114 | AC_SUBST(KICKSTART_BASE) |
nethercote | cf4d997 | 2004-10-25 15:21:00 +0000 | [diff] [blame] | 115 | AC_SUBST(ARCH_CORE_AM_CFLAGS) |
| 116 | AC_SUBST(ARCH_TOOL_AM_CFLAGS) |
nethercote | 8df0a40 | 2004-10-25 19:20:14 +0000 | [diff] [blame] | 117 | AC_SUBST(ARCH_CORE_AM_CCASFLAGS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 118 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 119 | case "${host_cpu}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 120 | i?86) |
| 121 | AC_MSG_RESULT([ok (${host_cpu})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 122 | VG_ARCH="x86" |
nethercote | 2b72e94 | 2004-10-25 14:05:56 +0000 | [diff] [blame] | 123 | KICKSTART_BASE="0xb0000000" |
sewardj | fbd78b2 | 2005-06-19 16:14:06 +0000 | [diff] [blame] | 124 | ARCH_CORE_AM_CFLAGS="@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@" |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 125 | ARCH_TOOL_AM_CFLAGS="@FLAG_M32@ @PREFERRED_STACK_BOUNDARY@" |
| 126 | ARCH_CORE_AM_CCASFLAGS="@FLAG_M32@" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 127 | ;; |
| 128 | |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 129 | x86_64) |
| 130 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 131 | VG_ARCH="amd64" |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 132 | # XXX: relocations under amd64's "small model" are 32-bit signed |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 133 | # quantities; therefore going above 0x7fffffff doesn't work... this is |
| 134 | # a problem. |
| 135 | KICKSTART_BASE="0x70000000" |
sewardj | fbd78b2 | 2005-06-19 16:14:06 +0000 | [diff] [blame] | 136 | ARCH_CORE_AM_CFLAGS="-m64 -fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@" |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 137 | # XXX: need to use -fpic, otherwise when linking tools I get this error |
| 138 | # message: |
| 139 | # relocation R_X86_64_32 can not be used when making a shared object; |
| 140 | # recompile with -fPIC |
| 141 | # |
| 142 | # I don't understand... --njn |
tom | 0064ee3 | 2005-05-17 16:13:15 +0000 | [diff] [blame] | 143 | ARCH_TOOL_AM_CFLAGS="-m64 -fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@ -fpic" |
| 144 | ARCH_CORE_AM_CCASFLAGS="-m64" |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 145 | ;; |
| 146 | |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 147 | arm*) |
| 148 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 149 | VG_ARCH="arm" |
| 150 | KICKSTART_BASE="0xb0000000" |
sewardj | fbd78b2 | 2005-06-19 16:14:06 +0000 | [diff] [blame] | 151 | ARCH_CORE_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@" |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 152 | ARCH_TOOL_AM_CFLAGS="-fomit-frame-pointer @PREFERRED_STACK_BOUNDARY@" |
| 153 | ARCH_CORE_AM_CCASFLAGS="" |
| 154 | ;; |
| 155 | |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 156 | powerpc*) |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 157 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 158 | VG_ARCH="ppc32" |
sewardj | ed0c4cb | 2005-06-21 10:07:25 +0000 | [diff] [blame] | 159 | KICKSTART_BASE="0x70000000" |
sewardj | fbd78b2 | 2005-06-19 16:14:06 +0000 | [diff] [blame] | 160 | ARCH_CORE_AM_CFLAGS="" |
nethercote | cf4d997 | 2004-10-25 15:21:00 +0000 | [diff] [blame] | 161 | ARCH_TOOL_AM_CFLAGS="-fpic" |
nethercote | 8df0a40 | 2004-10-25 19:20:14 +0000 | [diff] [blame] | 162 | ARCH_CORE_AM_CCASFLAGS="-Wa,-maltivec" |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 163 | ;; |
| 164 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 165 | *) |
| 166 | AC_MSG_RESULT([no (${host_cpu})]) |
nethercote | 81d5c66 | 2004-10-13 13:18:51 +0000 | [diff] [blame] | 167 | AC_MSG_ERROR([Unsupported host architecture. Sorry]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 168 | ;; |
| 169 | esac |
| 170 | |
| 171 | AC_MSG_CHECKING([for a supported OS]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 172 | AC_SUBST(VG_OS) |
njn | a5f1bcd | 2004-11-27 16:47:42 +0000 | [diff] [blame] | 173 | AC_SUBST(VG_OS_ALL) |
| 174 | VG_OS_ALL="linux" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 175 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 176 | case "${host_os}" in |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 177 | *linux*) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 178 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 179 | VG_OS="linux" |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 180 | |
| 181 | # Ok, this is linux. Check the kernel version |
| 182 | AC_MSG_CHECKING([for the kernel version]) |
| 183 | |
| 184 | kernel=`uname -r` |
| 185 | |
| 186 | case "${kernel}" in |
| 187 | 2.6.*) |
| 188 | AC_MSG_RESULT([2.6 family (${kernel})]) |
| 189 | AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x]) |
| 190 | ;; |
| 191 | |
| 192 | 2.4.*) |
| 193 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 194 | AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) |
| 195 | ;; |
| 196 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 197 | *) |
| 198 | AC_MSG_RESULT([unsupported (${kernel})]) |
nethercote | 4fa681f | 2004-11-08 17:51:39 +0000 | [diff] [blame] | 199 | AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 200 | ;; |
| 201 | esac |
| 202 | |
| 203 | ;; |
| 204 | |
| 205 | *freebsd*) |
| 206 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 207 | VG_OS="freebsd" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 208 | ;; |
| 209 | |
| 210 | *) |
| 211 | AC_MSG_RESULT([no (${host_os})]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 212 | AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 213 | ;; |
| 214 | esac |
| 215 | |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 216 | AC_MSG_CHECKING([for a supported CPU/OS combination]) |
| 217 | AC_SUBST(VG_PLATFORM) |
njn | a5f1bcd | 2004-11-27 16:47:42 +0000 | [diff] [blame] | 218 | AC_SUBST(VG_PLATFORM_ALL) |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 219 | VG_PLATFORM_ALL="amd64-linux arm-linux ppc32-linux x86-linux" |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 220 | |
| 221 | VG_PLATFORM="$VG_ARCH-$VG_OS" |
| 222 | |
| 223 | case $VG_PLATFORM in |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 224 | x86-linux|amd64-linux|arm-linux|ppc32-linux) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 225 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 226 | ;; |
| 227 | |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 228 | *) |
| 229 | AC_MSG_RESULT([no (${host_cpu}-${host_os})]) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 230 | AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 231 | ;; |
| 232 | esac |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 233 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 234 | AC_SUBST(DEFAULT_SUPP) |
| 235 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 236 | glibc="" |
| 237 | |
| 238 | AC_EGREP_CPP([GLIBC_21], [ |
| 239 | #include <features.h> |
| 240 | #ifdef __GNU_LIBRARY__ |
| 241 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 1) |
| 242 | GLIBC_21 |
| 243 | #endif |
| 244 | #endif |
| 245 | ], |
| 246 | glibc="2.1") |
| 247 | |
| 248 | AC_EGREP_CPP([GLIBC_22], [ |
| 249 | #include <features.h> |
| 250 | #ifdef __GNU_LIBRARY__ |
| 251 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2) |
| 252 | GLIBC_22 |
| 253 | #endif |
| 254 | #endif |
| 255 | ], |
| 256 | glibc="2.2") |
| 257 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 258 | AC_EGREP_CPP([GLIBC_23], [ |
| 259 | #include <features.h> |
| 260 | #ifdef __GNU_LIBRARY__ |
| 261 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3) |
| 262 | GLIBC_23 |
| 263 | #endif |
| 264 | #endif |
| 265 | ], |
| 266 | glibc="2.3") |
| 267 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame^] | 268 | AC_EGREP_CPP([GLIBC_24], [ |
| 269 | #include <features.h> |
| 270 | #ifdef __GNU_LIBRARY__ |
| 271 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4) |
| 272 | GLIBC_24 |
| 273 | #endif |
| 274 | #endif |
| 275 | ], |
| 276 | glibc="2.4") |
| 277 | |
daywalker | e9212b3 | 2003-06-15 22:39:15 +0000 | [diff] [blame] | 278 | AC_MSG_CHECKING([the glibc version]) |
| 279 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 280 | case "${glibc}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 281 | 2.1) |
| 282 | AC_MSG_RESULT(2.1 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 283 | AC_DEFINE([GLIBC_2_1], 1, [Define to 1 if you're using glibc 2.1.x]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 284 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.1.supp" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 285 | ;; |
| 286 | |
| 287 | 2.2) |
| 288 | AC_MSG_RESULT(2.2 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 289 | AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 290 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.2.supp" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 291 | ;; |
| 292 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 293 | 2.3) |
| 294 | AC_MSG_RESULT(2.3 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 295 | AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x]) |
daywalker | 63f6f78 | 2003-05-27 00:19:52 +0000 | [diff] [blame] | 296 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.3.supp" |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 297 | ;; |
| 298 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame^] | 299 | 2.4) |
| 300 | AC_MSG_RESULT(2.4 family) |
| 301 | AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x]) |
| 302 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.4.supp" |
| 303 | ;; |
| 304 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 305 | *) |
| 306 | AC_MSG_RESULT(unsupported version) |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame^] | 307 | AC_MSG_ERROR([Valgrind requires glibc version 2.1, 2.2, 2.3 or 2.4]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 308 | ;; |
| 309 | esac |
| 310 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 311 | |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 312 | # We don't know how to detect the X client library version |
| 313 | # (detecting the server version is easy, bu no help). So we |
| 314 | # just use a hack: always include the suppressions for both |
| 315 | # versions 3 and 4. |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 316 | AC_PATH_X |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 317 | if test "${no_x}" != 'yes' ; then |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 318 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp" |
| 319 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 320 | fi |
| 321 | |
sewardj | 2e10a68 | 2003-04-07 19:36:41 +0000 | [diff] [blame] | 322 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 323 | # does this compiler support -m32 ? |
| 324 | AC_MSG_CHECKING([if gcc accepts -m32]) |
| 325 | |
| 326 | safe_CFLAGS=$CFLAGS |
| 327 | CFLAGS="-m32" |
| 328 | |
| 329 | AC_TRY_COMPILE(, [ |
| 330 | int main () { return 0 ; } |
| 331 | ], |
| 332 | [ |
| 333 | FLAG_M32="-m32" |
| 334 | AC_MSG_RESULT([yes]) |
| 335 | ], [ |
| 336 | FLAG_M32="" |
| 337 | AC_MSG_RESULT([no]) |
| 338 | ]) |
| 339 | CFLAGS=$safe_CFLAGS |
| 340 | |
| 341 | AC_SUBST(FLAG_M32) |
| 342 | |
| 343 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 344 | # does this compiler support -mpreferred-stack-boundary=2 ? |
| 345 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary]) |
| 346 | |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 347 | safe_CFLAGS=$CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 348 | CFLAGS="-mpreferred-stack-boundary=2" |
| 349 | |
| 350 | AC_TRY_COMPILE(, [ |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 351 | int main () { return 0 ; } |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 352 | ], |
| 353 | [ |
| 354 | PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2" |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 355 | AC_MSG_RESULT([yes]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 356 | ], [ |
| 357 | PREFERRED_STACK_BOUNDARY="" |
| 358 | AC_MSG_RESULT([no]) |
| 359 | ]) |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 360 | CFLAGS=$safe_CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 361 | |
| 362 | AC_SUBST(PREFERRED_STACK_BOUNDARY) |
| 363 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 364 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 365 | # does this compiler support -Wno-pointer-sign ? |
| 366 | AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ]) |
| 367 | |
| 368 | safe_CFLAGS=$CFLAGS |
| 369 | CFLAGS="-Wno-pointer-sign" |
| 370 | |
| 371 | AC_TRY_COMPILE(, [ |
| 372 | int main () { return 0 ; } |
| 373 | ], |
| 374 | [ |
| 375 | no_pointer_sign=yes |
| 376 | AC_MSG_RESULT([yes]) |
| 377 | ], [ |
| 378 | no_pointer_sign=no |
| 379 | AC_MSG_RESULT([no]) |
| 380 | ]) |
| 381 | CFLAGS=$safe_CFLAGS |
| 382 | |
| 383 | if test x$no_pointer_sign = xyes; then |
| 384 | CFLAGS="$CFLAGS -Wno-pointer-sign" |
| 385 | fi |
| 386 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 387 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 388 | # Check for TLS support in the compiler and linker |
| 389 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 390 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 391 | [vg_cv_tls=$enableval], |
| 392 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 393 | [[return foo;]])], |
| 394 | [vg_cv_tls=yes], |
| 395 | [vg_cv_tls=no])])]) |
| 396 | |
| 397 | if test "$vg_cv_tls" = yes; then |
| 398 | AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables]) |
| 399 | fi |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 400 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 401 | |
nethercote | 7f39002 | 2004-10-25 17:18:24 +0000 | [diff] [blame] | 402 | # Check for PIE support in the compiler and linker |
tom | 7860441 | 2005-05-17 16:11:40 +0000 | [diff] [blame] | 403 | AC_SUBST(PIE_AM_CFLAGS) |
nethercote | 7f39002 | 2004-10-25 17:18:24 +0000 | [diff] [blame] | 404 | AC_CACHE_CHECK([for PIE support], vg_cv_pie, |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 405 | [AC_ARG_ENABLE(pie, [ --enable-pie platform supports PIE linking], |
| 406 | [vg_cv_pie=$enableval], |
| 407 | [safe_CFLAGS=$CFLAGS |
| 408 | CFLAGS="$CFLAGS -fpie" |
| 409 | safe_LDFLAGS=$LDFLAGS |
| 410 | LDFLAGS="$LDFLAGS -pie" |
| 411 | AC_TRY_LINK([int foo;], |
| 412 | [], |
| 413 | [vg_cv_pie=yes], |
| 414 | [vg_cv_pie=no]) |
| 415 | CFLAGS=$safe_CFLAGS |
| 416 | LDFLAGS=$safe_LDFLAGS])]) |
nethercote | 7f39002 | 2004-10-25 17:18:24 +0000 | [diff] [blame] | 417 | if test "$vg_cv_pie" = yes; then |
| 418 | AC_DEFINE([HAVE_PIE], 1, [can create position-independent executables]) |
tom | 7860441 | 2005-05-17 16:11:40 +0000 | [diff] [blame] | 419 | PIE_AM_CFLAGS="-fpie" |
nethercote | 7f39002 | 2004-10-25 17:18:24 +0000 | [diff] [blame] | 420 | fi |
| 421 | AM_CONDITIONAL(USE_PIE, test "$vg_cv_pie" = "yes") |
| 422 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 423 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 424 | # Checks for header files. |
| 425 | AC_HEADER_STDC |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 426 | AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 427 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 428 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 429 | # Checks for typedefs, structures, and compiler characteristics. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 430 | AC_TYPE_UID_T |
| 431 | AC_TYPE_OFF_T |
| 432 | AC_TYPE_SIZE_T |
| 433 | AC_HEADER_TIME |
| 434 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 435 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 436 | # Checks for library functions. |
| 437 | AC_FUNC_MEMCMP |
| 438 | AC_FUNC_MMAP |
| 439 | AC_TYPE_SIGNAL |
| 440 | |
thughes | beb6eb9 | 2004-06-14 12:33:43 +0000 | [diff] [blame] | 441 | AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 442 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 443 | AC_OUTPUT( |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 444 | Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 445 | valgrind.spec |
mueller | bddd607 | 2003-11-19 21:50:07 +0000 | [diff] [blame] | 446 | valgrind.pc |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 447 | docs/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 448 | docs/lib/Makefile |
| 449 | docs/images/Makefile |
| 450 | docs/xml/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 451 | tests/Makefile |
njn | c2e7f48 | 2002-09-27 08:44:17 +0000 | [diff] [blame] | 452 | tests/vg_regtest |
njn25 | 1ffab94 | 2002-09-23 16:42:19 +0000 | [diff] [blame] | 453 | tests/unused/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 454 | include/Makefile |
njn | 7a6e746 | 2002-11-09 17:53:30 +0000 | [diff] [blame] | 455 | auxprogs/Makefile |
njn25 | ab72603 | 2002-09-23 16:24:41 +0000 | [diff] [blame] | 456 | coregrind/Makefile |
sewardj | 55f9d1a | 2005-04-25 11:11:44 +0000 | [diff] [blame] | 457 | coregrind/m_aspacemgr/Makefile |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 458 | coregrind/m_debuginfo/Makefile |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 459 | coregrind/m_demangle/Makefile |
| 460 | coregrind/m_dispatch/Makefile |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 461 | coregrind/m_replacemalloc/Makefile |
njn | 278b3d6 | 2005-05-30 23:20:51 +0000 | [diff] [blame] | 462 | coregrind/m_scheduler/Makefile |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 463 | coregrind/m_sigframe/Makefile |
njn | 8a4eeaf | 2005-06-17 22:27:21 +0000 | [diff] [blame] | 464 | coregrind/m_syswrap/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 465 | addrcheck/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 466 | addrcheck/tests/Makefile |
njn | 7da8fa7 | 2002-10-03 10:38:40 +0000 | [diff] [blame] | 467 | addrcheck/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 468 | memcheck/Makefile |
| 469 | memcheck/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 470 | memcheck/tests/amd64/Makefile |
njn | ca0518d | 2004-11-26 19:34:36 +0000 | [diff] [blame] | 471 | memcheck/tests/arm/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 472 | memcheck/tests/ppc32/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 473 | memcheck/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 474 | memcheck/docs/Makefile |
| 475 | cachegrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 476 | cachegrind/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 477 | cachegrind/tests/amd64/Makefile |
njn | ca0518d | 2004-11-26 19:34:36 +0000 | [diff] [blame] | 478 | cachegrind/tests/arm/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 479 | cachegrind/tests/ppc32/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 480 | cachegrind/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 481 | cachegrind/docs/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 482 | cachegrind/cg_annotate |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 483 | helgrind/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 484 | helgrind/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 485 | helgrind/docs/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 486 | massif/Makefile |
| 487 | massif/hp2ps/Makefile |
| 488 | massif/tests/Makefile |
| 489 | massif/docs/Makefile |
| 490 | corecheck/Makefile |
| 491 | corecheck/tests/Makefile |
| 492 | corecheck/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 493 | lackey/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 494 | lackey/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 495 | lackey/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 496 | none/Makefile |
| 497 | none/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 498 | none/tests/amd64/Makefile |
njn | ca0518d | 2004-11-26 19:34:36 +0000 | [diff] [blame] | 499 | none/tests/arm/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 500 | none/tests/ppc32/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 501 | none/tests/x86/Makefile |
njn | 9bc8c00 | 2002-10-02 13:49:13 +0000 | [diff] [blame] | 502 | none/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 503 | ) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 504 | |
| 505 | cat<<EOF |
| 506 | |
| 507 | Using the following suppressions by default: |
| 508 | |
| 509 | ${DEFAULT_SUPP} |
| 510 | EOF |
| 511 | |
| 512 | cat<<EOF > default.supp |
| 513 | # This is a generated file, composed of the following suppression rules: |
| 514 | # |
| 515 | # ${DEFAULT_SUPP} |
| 516 | # |
| 517 | |
| 518 | EOF |
| 519 | |
| 520 | for file in ${DEFAULT_SUPP} ; do |
| 521 | cat ${srcdir}/$file >> default.supp |
| 522 | done |