sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | # Process this file with autoconf to produce a configure script. |
njn | 0181c77 | 2005-11-28 16:45:45 +0000 | [diff] [blame] | 2 | AC_INIT(Valgrind, 3.2.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 | # |
sewardj | 85a9dca | 2005-07-26 10:42:57 +0000 | [diff] [blame] | 13 | # AS_HELP_STRING([--with-vex], [Vex directory]), |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 14 | # |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 15 | AC_ARG_WITH(vex, |
sewardj | 85a9dca | 2005-07-26 10:42:57 +0000 | [diff] [blame] | 16 | [ --with-vex=/path/to/vex/dir Vex directory], |
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 | [ |
njn | 17adf1e | 2005-09-16 03:59:37 +0000 | [diff] [blame] | 23 | VEX_DIR='$(top_srcdir)/VEX' |
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) |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 113 | VG_ARCH_ALL="amd64 ppc32 ppc64 x86" |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 114 | AC_SUBST(VALT_LOAD_ADDRESS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 115 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 116 | case "${host_cpu}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 117 | i?86) |
| 118 | AC_MSG_RESULT([ok (${host_cpu})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 119 | VG_ARCH="x86" |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 120 | valt_load_address_normal="0xb0000000" |
| 121 | valt_load_address_inner="0xa0000000" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 122 | ;; |
| 123 | |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 124 | x86_64) |
| 125 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 126 | VG_ARCH="amd64" |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 127 | # XXX: relocations under amd64's "small model" are 32-bit signed |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 128 | # quantities; therefore going above 0x7fffffff doesn't work... this is |
| 129 | # a problem. |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 130 | valt_load_address_normal="0x70000000" |
| 131 | valt_load_address_inner="0x60000000" |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 132 | ;; |
| 133 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 134 | powerpc64) |
| 135 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 136 | VG_ARCH="ppc64" |
| 137 | valt_load_address_normal="0x70000000" |
| 138 | valt_load_address_inner="0x60000000" |
| 139 | ;; |
| 140 | |
| 141 | powerpc) |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 142 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 143 | VG_ARCH="ppc32" |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 144 | valt_load_address_normal="0x70000000" |
| 145 | valt_load_address_inner="0x60000000" |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 146 | ;; |
| 147 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 148 | *) |
| 149 | AC_MSG_RESULT([no (${host_cpu})]) |
nethercote | 81d5c66 | 2004-10-13 13:18:51 +0000 | [diff] [blame] | 150 | AC_MSG_ERROR([Unsupported host architecture. Sorry]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 151 | ;; |
| 152 | esac |
| 153 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 154 | # Check if this should be built as an inner Valgrind, to be run within |
| 155 | # another Valgrind. Choose the load address accordingly. |
| 156 | AC_CACHE_CHECK([enable use as an inner Valgrind], vg_cv_inner, |
| 157 | [AC_ARG_ENABLE(inner, [ --enable-inner enables self-hosting], |
| 158 | [vg_cv_inner=$enableval], |
| 159 | [vg_cv_inner=no])]) |
| 160 | if test "$vg_cv_inner" = yes; then |
| 161 | AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind]) |
| 162 | VALT_LOAD_ADDRESS=$valt_load_address_inner |
| 163 | else |
| 164 | VALT_LOAD_ADDRESS=$valt_load_address_normal |
| 165 | fi |
| 166 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 167 | AC_MSG_CHECKING([for a supported OS]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 168 | AC_SUBST(VG_OS) |
njn | a5f1bcd | 2004-11-27 16:47:42 +0000 | [diff] [blame] | 169 | AC_SUBST(VG_OS_ALL) |
| 170 | VG_OS_ALL="linux" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 171 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 172 | case "${host_os}" in |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 173 | *linux*) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 174 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 175 | VG_OS="linux" |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 176 | |
| 177 | # Ok, this is linux. Check the kernel version |
| 178 | AC_MSG_CHECKING([for the kernel version]) |
| 179 | |
| 180 | kernel=`uname -r` |
| 181 | |
| 182 | case "${kernel}" in |
| 183 | 2.6.*) |
| 184 | AC_MSG_RESULT([2.6 family (${kernel})]) |
| 185 | AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x]) |
| 186 | ;; |
| 187 | |
| 188 | 2.4.*) |
| 189 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 190 | AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) |
| 191 | ;; |
| 192 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 193 | *) |
| 194 | AC_MSG_RESULT([unsupported (${kernel})]) |
nethercote | 4fa681f | 2004-11-08 17:51:39 +0000 | [diff] [blame] | 195 | AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 196 | ;; |
| 197 | esac |
| 198 | |
| 199 | ;; |
| 200 | |
| 201 | *freebsd*) |
| 202 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 203 | VG_OS="freebsd" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 204 | ;; |
| 205 | |
| 206 | *) |
| 207 | AC_MSG_RESULT([no (${host_os})]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 208 | 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] | 209 | ;; |
| 210 | esac |
| 211 | |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 212 | AC_MSG_CHECKING([for a supported CPU/OS combination]) |
| 213 | AC_SUBST(VG_PLATFORM) |
njn | a5f1bcd | 2004-11-27 16:47:42 +0000 | [diff] [blame] | 214 | AC_SUBST(VG_PLATFORM_ALL) |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 215 | VG_PLATFORM_ALL="amd64-linux ppc32-linux ppc64-linux x86-linux" |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 216 | |
| 217 | VG_PLATFORM="$VG_ARCH-$VG_OS" |
| 218 | |
| 219 | case $VG_PLATFORM in |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 220 | x86-linux|amd64-linux|ppc32-linux|ppc64-linux) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 221 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 222 | ;; |
| 223 | |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 224 | *) |
| 225 | AC_MSG_RESULT([no (${host_cpu}-${host_os})]) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 226 | AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 227 | ;; |
| 228 | esac |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 229 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 230 | AM_CONDITIONAL(VG_X86_LINUX, test x$VG_PLATFORM = xx86-linux -o x$VG_PLATFORM = xamd64-linux) |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 231 | AM_CONDITIONAL(VG_AMD64_LINUX, test x$VG_PLATFORM = xamd64-linux) |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 232 | AM_CONDITIONAL(VG_PPC32_LINUX, test x$VG_PLATFORM = xppc32-linux -o x$VG_PLATFORM = xppc64-linux) |
| 233 | AM_CONDITIONAL(VG_PPC64_LINUX, test x$VG_PLATFORM = xppc64-linux) |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 234 | |
tom | b637bad | 2005-11-08 12:28:35 +0000 | [diff] [blame] | 235 | AC_SUBST(VG_MAKE_PLATFORM) |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 236 | case $VG_PLATFORM in |
| 237 | x86-linux) |
| 238 | VG_MAKE_PLATFORM=X86_LINUX |
| 239 | ;; |
| 240 | amd64-linux) |
| 241 | VG_MAKE_PLATFORM=AMD64_LINUX |
| 242 | ;; |
| 243 | ppc32-linux|ppc64-linux) |
| 244 | VG_MAKE_PLATFORM=PPC32_LINUX |
| 245 | ;; |
| 246 | *) |
| 247 | AC_MSG_ERROR([VG_PLATFORM is not known -- configure script bug]) |
| 248 | ;; |
| 249 | esac |
| 250 | ##VG_MAKE_PLATFORM=`echo $VG_PLATFORM | tr [a-z-] [A-Z_]` |
tom | b637bad | 2005-11-08 12:28:35 +0000 | [diff] [blame] | 251 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 252 | AC_SUBST(DEFAULT_SUPP) |
| 253 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 254 | glibc="" |
| 255 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 256 | AC_EGREP_CPP([GLIBC_22], [ |
| 257 | #include <features.h> |
| 258 | #ifdef __GNU_LIBRARY__ |
| 259 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2) |
| 260 | GLIBC_22 |
| 261 | #endif |
| 262 | #endif |
| 263 | ], |
| 264 | glibc="2.2") |
| 265 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 266 | AC_EGREP_CPP([GLIBC_23], [ |
| 267 | #include <features.h> |
| 268 | #ifdef __GNU_LIBRARY__ |
| 269 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3) |
| 270 | GLIBC_23 |
| 271 | #endif |
| 272 | #endif |
| 273 | ], |
| 274 | glibc="2.3") |
| 275 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 276 | AC_EGREP_CPP([GLIBC_24], [ |
| 277 | #include <features.h> |
| 278 | #ifdef __GNU_LIBRARY__ |
| 279 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4) |
| 280 | GLIBC_24 |
| 281 | #endif |
| 282 | #endif |
| 283 | ], |
| 284 | glibc="2.4") |
| 285 | |
daywalker | e9212b3 | 2003-06-15 22:39:15 +0000 | [diff] [blame] | 286 | AC_MSG_CHECKING([the glibc version]) |
| 287 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 288 | case "${glibc}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 289 | 2.2) |
| 290 | AC_MSG_RESULT(2.2 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 291 | 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] | 292 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.2.supp" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 293 | ;; |
| 294 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 295 | 2.3) |
| 296 | AC_MSG_RESULT(2.3 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 297 | 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] | 298 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.3.supp" |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 299 | ;; |
| 300 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 301 | 2.4) |
| 302 | AC_MSG_RESULT(2.4 family) |
| 303 | AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x]) |
| 304 | DEFAULT_SUPP="${DEFAULT_SUPP} glibc-2.4.supp" |
| 305 | ;; |
| 306 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 307 | *) |
| 308 | AC_MSG_RESULT(unsupported version) |
sewardj | 3080a86 | 2005-07-03 10:18:33 +0000 | [diff] [blame] | 309 | AC_MSG_ERROR([Valgrind requires glibc version 2.2, 2.3 or 2.4]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 310 | ;; |
| 311 | esac |
| 312 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 313 | |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 314 | # We don't know how to detect the X client library version |
| 315 | # (detecting the server version is easy, bu no help). So we |
| 316 | # just use a hack: always include the suppressions for both |
| 317 | # versions 3 and 4. |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 318 | AC_PATH_X |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 319 | if test "${no_x}" != 'yes' ; then |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 320 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-4.supp" |
| 321 | DEFAULT_SUPP="${DEFAULT_SUPP} xfree-3.supp" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 322 | fi |
| 323 | |
sewardj | 2e10a68 | 2003-04-07 19:36:41 +0000 | [diff] [blame] | 324 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 325 | # does this compiler support -m32 ? |
| 326 | AC_MSG_CHECKING([if gcc accepts -m32]) |
| 327 | |
| 328 | safe_CFLAGS=$CFLAGS |
| 329 | CFLAGS="-m32" |
| 330 | |
| 331 | AC_TRY_COMPILE(, [ |
| 332 | int main () { return 0 ; } |
| 333 | ], |
| 334 | [ |
| 335 | FLAG_M32="-m32" |
| 336 | AC_MSG_RESULT([yes]) |
| 337 | ], [ |
| 338 | FLAG_M32="" |
| 339 | AC_MSG_RESULT([no]) |
| 340 | ]) |
| 341 | CFLAGS=$safe_CFLAGS |
| 342 | |
| 343 | AC_SUBST(FLAG_M32) |
| 344 | |
| 345 | |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 346 | # does this compiler support -mmmx ? |
| 347 | AC_MSG_CHECKING([if gcc accepts -mmmx]) |
| 348 | |
| 349 | safe_CFLAGS=$CFLAGS |
| 350 | CFLAGS="-mmmx" |
| 351 | |
| 352 | AC_TRY_COMPILE(, [ |
| 353 | int main () { return 0 ; } |
| 354 | ], |
| 355 | [ |
| 356 | FLAG_MMMX="-mmmx" |
| 357 | AC_MSG_RESULT([yes]) |
| 358 | ], [ |
| 359 | FLAG_MMMX="" |
| 360 | AC_MSG_RESULT([no]) |
| 361 | ]) |
| 362 | CFLAGS=$safe_CFLAGS |
| 363 | |
| 364 | AC_SUBST(FLAG_MMMX) |
| 365 | |
| 366 | |
| 367 | # does this compiler support -msse ? |
| 368 | AC_MSG_CHECKING([if gcc accepts -msse]) |
| 369 | |
| 370 | safe_CFLAGS=$CFLAGS |
| 371 | CFLAGS="-msse" |
| 372 | |
| 373 | AC_TRY_COMPILE(, [ |
| 374 | int main () { return 0 ; } |
| 375 | ], |
| 376 | [ |
| 377 | FLAG_MSSE="-msse" |
| 378 | AC_MSG_RESULT([yes]) |
| 379 | ], [ |
| 380 | FLAG_MSSE="" |
| 381 | AC_MSG_RESULT([no]) |
| 382 | ]) |
| 383 | CFLAGS=$safe_CFLAGS |
| 384 | |
| 385 | AC_SUBST(FLAG_MSSE) |
| 386 | |
| 387 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 388 | # does this compiler support -mpreferred-stack-boundary=2 ? |
| 389 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary]) |
| 390 | |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 391 | safe_CFLAGS=$CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 392 | CFLAGS="-mpreferred-stack-boundary=2" |
| 393 | |
| 394 | AC_TRY_COMPILE(, [ |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 395 | int main () { return 0 ; } |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 396 | ], |
| 397 | [ |
| 398 | PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2" |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 399 | AC_MSG_RESULT([yes]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 400 | ], [ |
| 401 | PREFERRED_STACK_BOUNDARY="" |
| 402 | AC_MSG_RESULT([no]) |
| 403 | ]) |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 404 | CFLAGS=$safe_CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 405 | |
| 406 | AC_SUBST(PREFERRED_STACK_BOUNDARY) |
| 407 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 408 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 409 | # does this compiler support -Wno-pointer-sign ? |
| 410 | AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ]) |
| 411 | |
| 412 | safe_CFLAGS=$CFLAGS |
| 413 | CFLAGS="-Wno-pointer-sign" |
| 414 | |
| 415 | AC_TRY_COMPILE(, [ |
| 416 | int main () { return 0 ; } |
| 417 | ], |
| 418 | [ |
| 419 | no_pointer_sign=yes |
| 420 | AC_MSG_RESULT([yes]) |
| 421 | ], [ |
| 422 | no_pointer_sign=no |
| 423 | AC_MSG_RESULT([no]) |
| 424 | ]) |
| 425 | CFLAGS=$safe_CFLAGS |
| 426 | |
| 427 | if test x$no_pointer_sign = xyes; then |
| 428 | CFLAGS="$CFLAGS -Wno-pointer-sign" |
| 429 | fi |
| 430 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 431 | |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 432 | # does this compiler support -Wdeclaration-after-statement ? |
| 433 | AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ]) |
| 434 | |
| 435 | safe_CFLAGS=$CFLAGS |
| 436 | CFLAGS="-Wdeclaration-after-statement" |
| 437 | |
| 438 | AC_TRY_COMPILE(, [ |
| 439 | int main () { return 0 ; } |
| 440 | ], |
| 441 | [ |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 442 | declaration_after_statement=yes |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 443 | AC_MSG_RESULT([yes]) |
| 444 | ], [ |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 445 | declaration_after_statement=no |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 446 | AC_MSG_RESULT([no]) |
| 447 | ]) |
| 448 | CFLAGS=$safe_CFLAGS |
| 449 | |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 450 | if test x$declaration_after_statement = xyes; then |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 451 | CFLAGS="$CFLAGS -Wdeclaration-after-statement" |
| 452 | fi |
| 453 | |
tom | d55121e | 2005-12-19 12:40:13 +0000 | [diff] [blame] | 454 | # does this compiler support __builtin_expect? |
| 455 | AC_MSG_CHECKING([if gcc supports __builtin_expect]) |
| 456 | |
| 457 | AC_TRY_LINK(, [ |
| 458 | return __builtin_expect(1, 1) ? 1 : 0 |
| 459 | ], |
| 460 | [ |
| 461 | ac_have_builtin_expect=yes |
| 462 | AC_MSG_RESULT([yes]) |
| 463 | ], [ |
| 464 | ac_have_builtin_expect=no |
| 465 | AC_MSG_RESULT([no]) |
| 466 | ]) |
| 467 | if test x$ac_have_builtin_expect = xyes ; then |
| 468 | AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.]) |
| 469 | fi |
| 470 | |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 471 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 472 | # Check for TLS support in the compiler and linker |
| 473 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 474 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 475 | [vg_cv_tls=$enableval], |
| 476 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 477 | [[return foo;]])], |
| 478 | [vg_cv_tls=yes], |
| 479 | [vg_cv_tls=no])])]) |
| 480 | |
| 481 | if test "$vg_cv_tls" = yes; then |
| 482 | AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables]) |
| 483 | fi |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 484 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 485 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 486 | # Checks for header files. |
| 487 | AC_HEADER_STDC |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 488 | AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 489 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 490 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 491 | # Checks for typedefs, structures, and compiler characteristics. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 492 | AC_TYPE_UID_T |
| 493 | AC_TYPE_OFF_T |
| 494 | AC_TYPE_SIZE_T |
| 495 | AC_HEADER_TIME |
| 496 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 497 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 498 | # Checks for library functions. |
| 499 | AC_FUNC_MEMCMP |
| 500 | AC_FUNC_MMAP |
| 501 | AC_TYPE_SIGNAL |
| 502 | |
thughes | beb6eb9 | 2004-06-14 12:33:43 +0000 | [diff] [blame] | 503 | AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 504 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 505 | AC_OUTPUT( |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 506 | Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 507 | valgrind.spec |
mueller | bddd607 | 2003-11-19 21:50:07 +0000 | [diff] [blame] | 508 | valgrind.pc |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 509 | docs/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 510 | docs/lib/Makefile |
| 511 | docs/images/Makefile |
njn | f7c00b1 | 2005-07-19 21:46:19 +0000 | [diff] [blame] | 512 | docs/internals/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 513 | docs/xml/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 514 | tests/Makefile |
njn | c2e7f48 | 2002-09-27 08:44:17 +0000 | [diff] [blame] | 515 | tests/vg_regtest |
njn | ec0c27a | 2005-12-10 23:11:28 +0000 | [diff] [blame] | 516 | perf/Makefile |
| 517 | perf/vg_perf |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 518 | include/Makefile |
njn | 7a6e746 | 2002-11-09 17:53:30 +0000 | [diff] [blame] | 519 | auxprogs/Makefile |
njn25 | ab72603 | 2002-09-23 16:24:41 +0000 | [diff] [blame] | 520 | coregrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 521 | addrcheck/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 522 | addrcheck/tests/Makefile |
njn | 7da8fa7 | 2002-10-03 10:38:40 +0000 | [diff] [blame] | 523 | addrcheck/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 524 | memcheck/Makefile |
| 525 | memcheck/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 526 | memcheck/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 527 | memcheck/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 528 | memcheck/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 529 | memcheck/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 530 | memcheck/docs/Makefile |
| 531 | cachegrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 532 | cachegrind/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 533 | cachegrind/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 534 | cachegrind/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 535 | cachegrind/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 536 | cachegrind/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 537 | cachegrind/docs/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 538 | cachegrind/cg_annotate |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 539 | helgrind/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 540 | helgrind/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 541 | helgrind/docs/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 542 | massif/Makefile |
| 543 | massif/hp2ps/Makefile |
| 544 | massif/tests/Makefile |
| 545 | massif/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 546 | lackey/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 547 | lackey/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 548 | lackey/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 549 | none/Makefile |
| 550 | none/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 551 | none/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 552 | none/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 553 | none/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 554 | none/tests/x86/Makefile |
njn | 9bc8c00 | 2002-10-02 13:49:13 +0000 | [diff] [blame] | 555 | none/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 556 | ) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 557 | |
| 558 | cat<<EOF |
| 559 | |
| 560 | Using the following suppressions by default: |
| 561 | |
| 562 | ${DEFAULT_SUPP} |
| 563 | EOF |
| 564 | |
| 565 | cat<<EOF > default.supp |
| 566 | # This is a generated file, composed of the following suppression rules: |
| 567 | # |
| 568 | # ${DEFAULT_SUPP} |
| 569 | # |
| 570 | |
| 571 | EOF |
| 572 | |
| 573 | for file in ${DEFAULT_SUPP} ; do |
| 574 | cat ${srcdir}/$file >> default.supp |
| 575 | done |