sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1 | |
| 2 | ##------------------------------------------------------------## |
| 3 | # |
| 4 | # The multiple-architecture stuff in this file is pretty |
| 5 | # cryptic. Read docs/internals/multiple-architectures.txt |
| 6 | # for at least a partial explanation of what is going on. |
| 7 | # |
| 8 | ##------------------------------------------------------------## |
| 9 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 10 | # Process this file with autoconf to produce a configure script. |
njn | 0181c77 | 2005-11-28 16:45:45 +0000 | [diff] [blame] | 11 | AC_INIT(Valgrind, 3.2.0.SVN, valgrind-users@lists.sourceforge.net) |
njn | 04e1698 | 2005-05-31 00:23:43 +0000 | [diff] [blame] | 12 | AC_CONFIG_SRCDIR(coregrind/m_main.c) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 13 | AM_CONFIG_HEADER(config.h) |
thughes | 6dbad73 | 2004-08-29 09:46:38 +0000 | [diff] [blame] | 14 | AM_INIT_AUTOMAKE |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 15 | |
gobry | b0ed467 | 2002-03-27 20:58:58 +0000 | [diff] [blame] | 16 | AM_MAINTAINER_MODE |
| 17 | |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 18 | # Where is VEX ? |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 19 | # Nb: For the 2nd arg, the help string, AS_HELP_STRING is the proper way, but |
| 20 | # older autoconfs don't support it... here's what it would say: |
| 21 | # |
sewardj | 85a9dca | 2005-07-26 10:42:57 +0000 | [diff] [blame] | 22 | # AS_HELP_STRING([--with-vex], [Vex directory]), |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 23 | # |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 24 | AC_ARG_WITH(vex, |
sewardj | 85a9dca | 2005-07-26 10:42:57 +0000 | [diff] [blame] | 25 | [ --with-vex=/path/to/vex/dir Vex directory], |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 26 | [ |
| 27 | AC_CHECK_FILE($withval/pub/libvex.h, |
| 28 | [VEX_DIR=$withval], |
| 29 | [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain Vex])]) |
| 30 | ], |
| 31 | [ |
njn | 17adf1e | 2005-09-16 03:59:37 +0000 | [diff] [blame] | 32 | VEX_DIR='$(top_srcdir)/VEX' |
njn | 8738c28 | 2004-11-23 16:31:56 +0000 | [diff] [blame] | 33 | ]) |
sewardj | 50629ec | 2004-11-22 13:44:11 +0000 | [diff] [blame] | 34 | AC_SUBST(VEX_DIR) |
| 35 | |
njn | 657d951 | 2005-06-24 15:20:52 +0000 | [diff] [blame] | 36 | # "make distcheck" first builds a tarball, then extracts it. |
| 37 | # Then it creates a build directory different from the extracted sources |
| 38 | # (called _build), and issues |
| 39 | # |
| 40 | # ../configure $(DISTCHECK_CONFIGURE_FLAGS) |
| 41 | # |
| 42 | # and then builds, runs "make check", installs using DESTDIR, runs make |
| 43 | # installcheck, uninstalls, checks whether the installed base is empty |
| 44 | # again, then does yet another "make dist" and compares the resulting |
| 45 | # tarball with the one it started off with for identical content. Then it |
| 46 | # tests "make distclean" for no leftover files. |
| 47 | # |
| 48 | # So this line means: when doing "make dist", use the same --with-vex value |
| 49 | # that you used when running configure to configure this tree in the first |
| 50 | # place. |
| 51 | AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], [--with-vex=$VEX_DIR]) |
| 52 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 53 | # Checks for programs. |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 54 | CFLAGS="-Wno-long-long" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 55 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 56 | AC_PROG_LN_S |
| 57 | AC_PROG_CC |
njn | ca0518d | 2004-11-26 19:34:36 +0000 | [diff] [blame] | 58 | ##AM_PROG_CC_C_O |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 59 | AC_PROG_CPP |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 60 | AC_PROG_CXX |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 61 | AC_PROG_RANLIB |
| 62 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 63 | # Check for the compiler support |
| 64 | if test "${GCC}" != "yes" ; then |
| 65 | AC_MSG_ERROR([Valgrind relies on GCC to be compiled]) |
| 66 | fi |
| 67 | |
sewardj | 2f68595 | 2002-12-22 19:32:23 +0000 | [diff] [blame] | 68 | # figure out where perl lives |
| 69 | AC_PATH_PROG(PERL, perl) |
| 70 | |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 71 | # figure out where gdb lives |
| 72 | AC_PATH_PROG(GDB, gdb) |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 73 | AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB]) |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 74 | |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 75 | # some older automake's don't have it so try something on our own |
| 76 | ifdef([AM_PROG_AS],[AM_PROG_AS], |
| 77 | [ |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 78 | AS="${CC}" |
| 79 | AC_SUBST(AS) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 80 | |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 81 | ASFLAGS="" |
| 82 | AC_SUBST(ASFLAGS) |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 83 | ]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 84 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 85 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 86 | # We don't want gcc < 3.0 |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 87 | AC_MSG_CHECKING([for a supported version of gcc]) |
| 88 | |
daywalker | 870ac4c | 2002-05-21 00:09:48 +0000 | [diff] [blame] | 89 | gcc_version=`${CC} --version | head -n 1` |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 90 | |
| 91 | case "${gcc_version}" in |
| 92 | gcc-2.7.*) |
| 93 | AC_MSG_RESULT([no (${gcc_version})]) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 94 | AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc]) |
| 95 | ;; |
| 96 | gcc-2.8.*) |
| 97 | AC_MSG_RESULT([no (${gcc_version})]) |
| 98 | AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc]) |
| 99 | ;; |
| 100 | gcc-2.9*) |
| 101 | AC_MSG_RESULT([no (${gcc_version})]) |
| 102 | AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc]) |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 103 | ;; |
| 104 | |
| 105 | *) |
| 106 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 107 | ;; |
| 108 | esac |
| 109 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 110 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 111 | # Checks for the platform |
| 112 | AC_CANONICAL_HOST |
| 113 | |
| 114 | AC_MSG_CHECKING([for a supported CPU]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 115 | AC_SUBST(VG_ARCH) |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame^] | 116 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 117 | AC_SUBST(VALT_LOAD_ADDRESS) |
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" |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 123 | valt_load_address_normal="0xb0000000" |
| 124 | valt_load_address_inner="0xa0000000" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 125 | ;; |
| 126 | |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 127 | x86_64) |
| 128 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 129 | VG_ARCH="amd64" |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 130 | # XXX: relocations under amd64's "small model" are 32-bit signed |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 131 | # quantities; therefore going above 0x7fffffff doesn't work... this is |
| 132 | # a problem. |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 133 | valt_load_address_normal="0x70000000" |
| 134 | valt_load_address_inner="0x60000000" |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 135 | ;; |
| 136 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 137 | powerpc64) |
| 138 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 139 | VG_ARCH="ppc64" |
| 140 | valt_load_address_normal="0x70000000" |
| 141 | valt_load_address_inner="0x60000000" |
| 142 | ;; |
| 143 | |
| 144 | powerpc) |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 145 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 146 | VG_ARCH="ppc32" |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 147 | valt_load_address_normal="0x70000000" |
| 148 | valt_load_address_inner="0x60000000" |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 149 | ;; |
| 150 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 151 | *) |
| 152 | AC_MSG_RESULT([no (${host_cpu})]) |
nethercote | 81d5c66 | 2004-10-13 13:18:51 +0000 | [diff] [blame] | 153 | AC_MSG_ERROR([Unsupported host architecture. Sorry]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 154 | ;; |
| 155 | esac |
| 156 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 157 | # Check if this should be built as an inner Valgrind, to be run within |
| 158 | # another Valgrind. Choose the load address accordingly. |
| 159 | AC_CACHE_CHECK([enable use as an inner Valgrind], vg_cv_inner, |
| 160 | [AC_ARG_ENABLE(inner, [ --enable-inner enables self-hosting], |
| 161 | [vg_cv_inner=$enableval], |
| 162 | [vg_cv_inner=no])]) |
| 163 | if test "$vg_cv_inner" = yes; then |
| 164 | AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind]) |
| 165 | VALT_LOAD_ADDRESS=$valt_load_address_inner |
| 166 | else |
| 167 | VALT_LOAD_ADDRESS=$valt_load_address_normal |
| 168 | fi |
| 169 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 170 | AC_MSG_CHECKING([for a supported OS]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 171 | AC_SUBST(VG_OS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 172 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 173 | case "${host_os}" in |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 174 | *linux*) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 175 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 176 | VG_OS="linux" |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 177 | |
| 178 | # Ok, this is linux. Check the kernel version |
| 179 | AC_MSG_CHECKING([for the kernel version]) |
| 180 | |
| 181 | kernel=`uname -r` |
| 182 | |
| 183 | case "${kernel}" in |
| 184 | 2.6.*) |
| 185 | AC_MSG_RESULT([2.6 family (${kernel})]) |
| 186 | AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x]) |
| 187 | ;; |
| 188 | |
| 189 | 2.4.*) |
| 190 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 191 | AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) |
| 192 | ;; |
| 193 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 194 | *) |
| 195 | AC_MSG_RESULT([unsupported (${kernel})]) |
nethercote | 4fa681f | 2004-11-08 17:51:39 +0000 | [diff] [blame] | 196 | AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 197 | ;; |
| 198 | esac |
| 199 | |
| 200 | ;; |
| 201 | |
| 202 | *freebsd*) |
| 203 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 204 | VG_OS="freebsd" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 205 | ;; |
| 206 | |
| 207 | *) |
| 208 | AC_MSG_RESULT([no (${host_os})]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 209 | 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] | 210 | ;; |
| 211 | esac |
| 212 | |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 213 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 214 | # Establish VG_PLATFORM_PRI. This is the primary build target. The |
| 215 | # entire system, including regression and performance tests, will be |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame^] | 216 | # built for this target. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 217 | # |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame^] | 218 | # Also establish VG_PLATFORM_SEC, the secondary build target, if |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 219 | # possible. The system will also be built for this target, but not |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame^] | 220 | # the regression or performance tests. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 221 | # |
| 222 | AC_MSG_CHECKING([for a supported CPU/OS combination]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 223 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 224 | AC_SUBST(VG_PLATFORM_PRI) |
| 225 | AC_SUBST(VG_PLATFORM_SEC) |
| 226 | |
| 227 | case "$VG_ARCH-$VG_OS" in |
| 228 | x86-linux) |
| 229 | VG_PLATFORM_PRI="X86_LINUX" |
| 230 | VG_PLATFORM_SEC="" |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 231 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 232 | ;; |
| 233 | amd64-linux) |
| 234 | VG_PLATFORM_PRI="AMD64_LINUX" |
| 235 | VG_PLATFORM_SEC="X86_LINUX" |
| 236 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 237 | ;; |
| 238 | ppc32-linux) |
| 239 | VG_PLATFORM_PRI="PPC32_LINUX" |
| 240 | VG_PLATFORM_SEC="" |
| 241 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 242 | ;; |
| 243 | ppc64-linux) |
| 244 | VG_PLATFORM_PRI="PPC64_LINUX" |
| 245 | VG_PLATFORM_SEC="PPC32_LINUX" |
| 246 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 247 | ;; |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 248 | *) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 249 | VG_PLATFORM_PRI="unknown" |
| 250 | VG_PLATFORM_SEC="unknown" |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 251 | AC_MSG_RESULT([no (${host_cpu}-${host_os})]) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 252 | AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 253 | ;; |
| 254 | esac |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 255 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 256 | # Set up VG_<platform>. Either one or two of these become defined. |
| 257 | # |
| 258 | AM_CONDITIONAL(VG_X86_LINUX, |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame^] | 259 | test x$VG_PLATFORM_PRI = xX86_LINUX \ |
| 260 | -o x$VG_PLATFORM_SEC = xX86_LINUX) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 261 | AM_CONDITIONAL(VG_AMD64_LINUX, |
| 262 | test x$VG_PLATFORM_PRI = xAMD64_LINUX) |
| 263 | AM_CONDITIONAL(VG_PPC32_LINUX, |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame^] | 264 | test x$VG_PLATFORM_PRI = xPPC32_LINUX \ |
| 265 | -o x$VG_PLATFORM_SEC = xPPC32_LINUX) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 266 | AM_CONDITIONAL(VG_PPC64_LINUX, |
| 267 | test x$VG_PLATFORM_PRI = xPPC64_LINUX) |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 268 | |
tom | b637bad | 2005-11-08 12:28:35 +0000 | [diff] [blame] | 269 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 270 | # This variable will collect the individual suppression files |
| 271 | # depending on the results of autoconf |
| 272 | DEFAULT_SUPP="" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 273 | AC_SUBST(DEFAULT_SUPP) |
| 274 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 275 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 276 | glibc="" |
| 277 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 278 | AC_EGREP_CPP([GLIBC_22], [ |
| 279 | #include <features.h> |
| 280 | #ifdef __GNU_LIBRARY__ |
| 281 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2) |
| 282 | GLIBC_22 |
| 283 | #endif |
| 284 | #endif |
| 285 | ], |
| 286 | glibc="2.2") |
| 287 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 288 | AC_EGREP_CPP([GLIBC_23], [ |
| 289 | #include <features.h> |
| 290 | #ifdef __GNU_LIBRARY__ |
| 291 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3) |
| 292 | GLIBC_23 |
| 293 | #endif |
| 294 | #endif |
| 295 | ], |
| 296 | glibc="2.3") |
| 297 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 298 | AC_EGREP_CPP([GLIBC_24], [ |
| 299 | #include <features.h> |
| 300 | #ifdef __GNU_LIBRARY__ |
| 301 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4) |
| 302 | GLIBC_24 |
| 303 | #endif |
| 304 | #endif |
| 305 | ], |
| 306 | glibc="2.4") |
| 307 | |
daywalker | e9212b3 | 2003-06-15 22:39:15 +0000 | [diff] [blame] | 308 | AC_MSG_CHECKING([the glibc version]) |
| 309 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 310 | case "${glibc}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 311 | 2.2) |
| 312 | AC_MSG_RESULT(2.2 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 313 | AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 314 | DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 315 | ;; |
| 316 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 317 | 2.3) |
| 318 | AC_MSG_RESULT(2.3 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 319 | AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 320 | DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}" |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 321 | ;; |
| 322 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 323 | 2.4) |
| 324 | AC_MSG_RESULT(2.4 family) |
| 325 | AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 326 | DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}" |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 327 | ;; |
| 328 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 329 | *) |
| 330 | AC_MSG_RESULT(unsupported version) |
sewardj | 3080a86 | 2005-07-03 10:18:33 +0000 | [diff] [blame] | 331 | 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] | 332 | ;; |
| 333 | esac |
| 334 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 335 | |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 336 | # We don't know how to detect the X client library version |
| 337 | # (detecting the server version is easy, bu no help). So we |
| 338 | # just use a hack: always include the suppressions for both |
| 339 | # versions 3 and 4. |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 340 | AC_PATH_X |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 341 | if test "${no_x}" != 'yes' ; then |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 342 | DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}" |
| 343 | DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 344 | fi |
| 345 | |
sewardj | 2e10a68 | 2003-04-07 19:36:41 +0000 | [diff] [blame] | 346 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 347 | # does this compiler support -m32 ? |
| 348 | AC_MSG_CHECKING([if gcc accepts -m32]) |
| 349 | |
| 350 | safe_CFLAGS=$CFLAGS |
| 351 | CFLAGS="-m32" |
| 352 | |
| 353 | AC_TRY_COMPILE(, [ |
| 354 | int main () { return 0 ; } |
| 355 | ], |
| 356 | [ |
| 357 | FLAG_M32="-m32" |
| 358 | AC_MSG_RESULT([yes]) |
| 359 | ], [ |
| 360 | FLAG_M32="" |
| 361 | AC_MSG_RESULT([no]) |
| 362 | ]) |
| 363 | CFLAGS=$safe_CFLAGS |
| 364 | |
| 365 | AC_SUBST(FLAG_M32) |
| 366 | |
| 367 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 368 | # does this compiler support -m64 ? |
| 369 | AC_MSG_CHECKING([if gcc accepts -m64]) |
| 370 | |
| 371 | safe_CFLAGS=$CFLAGS |
| 372 | CFLAGS="-m64" |
| 373 | |
| 374 | AC_TRY_COMPILE(, [ |
| 375 | int main () { return 0 ; } |
| 376 | ], |
| 377 | [ |
| 378 | FLAG_M64="-m64" |
| 379 | AC_MSG_RESULT([yes]) |
| 380 | ], [ |
| 381 | FLAG_M64="" |
| 382 | AC_MSG_RESULT([no]) |
| 383 | ]) |
| 384 | CFLAGS=$safe_CFLAGS |
| 385 | |
| 386 | AC_SUBST(FLAG_M64) |
| 387 | |
| 388 | |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 389 | # does this compiler support -mmmx ? |
| 390 | AC_MSG_CHECKING([if gcc accepts -mmmx]) |
| 391 | |
| 392 | safe_CFLAGS=$CFLAGS |
| 393 | CFLAGS="-mmmx" |
| 394 | |
| 395 | AC_TRY_COMPILE(, [ |
| 396 | int main () { return 0 ; } |
| 397 | ], |
| 398 | [ |
| 399 | FLAG_MMMX="-mmmx" |
| 400 | AC_MSG_RESULT([yes]) |
| 401 | ], [ |
| 402 | FLAG_MMMX="" |
| 403 | AC_MSG_RESULT([no]) |
| 404 | ]) |
| 405 | CFLAGS=$safe_CFLAGS |
| 406 | |
| 407 | AC_SUBST(FLAG_MMMX) |
| 408 | |
| 409 | |
| 410 | # does this compiler support -msse ? |
| 411 | AC_MSG_CHECKING([if gcc accepts -msse]) |
| 412 | |
| 413 | safe_CFLAGS=$CFLAGS |
| 414 | CFLAGS="-msse" |
| 415 | |
| 416 | AC_TRY_COMPILE(, [ |
| 417 | int main () { return 0 ; } |
| 418 | ], |
| 419 | [ |
| 420 | FLAG_MSSE="-msse" |
| 421 | AC_MSG_RESULT([yes]) |
| 422 | ], [ |
| 423 | FLAG_MSSE="" |
| 424 | AC_MSG_RESULT([no]) |
| 425 | ]) |
| 426 | CFLAGS=$safe_CFLAGS |
| 427 | |
| 428 | AC_SUBST(FLAG_MSSE) |
| 429 | |
| 430 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 431 | # does this compiler support -mpreferred-stack-boundary=2 ? |
| 432 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary]) |
| 433 | |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 434 | safe_CFLAGS=$CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 435 | CFLAGS="-mpreferred-stack-boundary=2" |
| 436 | |
| 437 | AC_TRY_COMPILE(, [ |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 438 | int main () { return 0 ; } |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 439 | ], |
| 440 | [ |
| 441 | PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2" |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 442 | AC_MSG_RESULT([yes]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 443 | ], [ |
| 444 | PREFERRED_STACK_BOUNDARY="" |
| 445 | AC_MSG_RESULT([no]) |
| 446 | ]) |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 447 | CFLAGS=$safe_CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 448 | |
| 449 | AC_SUBST(PREFERRED_STACK_BOUNDARY) |
| 450 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 451 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 452 | # does this compiler support -Wno-pointer-sign ? |
| 453 | AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ]) |
| 454 | |
| 455 | safe_CFLAGS=$CFLAGS |
| 456 | CFLAGS="-Wno-pointer-sign" |
| 457 | |
| 458 | AC_TRY_COMPILE(, [ |
| 459 | int main () { return 0 ; } |
| 460 | ], |
| 461 | [ |
| 462 | no_pointer_sign=yes |
| 463 | AC_MSG_RESULT([yes]) |
| 464 | ], [ |
| 465 | no_pointer_sign=no |
| 466 | AC_MSG_RESULT([no]) |
| 467 | ]) |
| 468 | CFLAGS=$safe_CFLAGS |
| 469 | |
| 470 | if test x$no_pointer_sign = xyes; then |
| 471 | CFLAGS="$CFLAGS -Wno-pointer-sign" |
| 472 | fi |
| 473 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 474 | |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 475 | # does this compiler support -Wdeclaration-after-statement ? |
| 476 | AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ]) |
| 477 | |
| 478 | safe_CFLAGS=$CFLAGS |
| 479 | CFLAGS="-Wdeclaration-after-statement" |
| 480 | |
| 481 | AC_TRY_COMPILE(, [ |
| 482 | int main () { return 0 ; } |
| 483 | ], |
| 484 | [ |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 485 | declaration_after_statement=yes |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 486 | AC_MSG_RESULT([yes]) |
| 487 | ], [ |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 488 | declaration_after_statement=no |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 489 | AC_MSG_RESULT([no]) |
| 490 | ]) |
| 491 | CFLAGS=$safe_CFLAGS |
| 492 | |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 493 | if test x$declaration_after_statement = xyes; then |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 494 | CFLAGS="$CFLAGS -Wdeclaration-after-statement" |
| 495 | fi |
| 496 | |
tom | d55121e | 2005-12-19 12:40:13 +0000 | [diff] [blame] | 497 | # does this compiler support __builtin_expect? |
| 498 | AC_MSG_CHECKING([if gcc supports __builtin_expect]) |
| 499 | |
| 500 | AC_TRY_LINK(, [ |
| 501 | return __builtin_expect(1, 1) ? 1 : 0 |
| 502 | ], |
| 503 | [ |
| 504 | ac_have_builtin_expect=yes |
| 505 | AC_MSG_RESULT([yes]) |
| 506 | ], [ |
| 507 | ac_have_builtin_expect=no |
| 508 | AC_MSG_RESULT([no]) |
| 509 | ]) |
| 510 | if test x$ac_have_builtin_expect = xyes ; then |
| 511 | AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.]) |
| 512 | fi |
| 513 | |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 514 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 515 | # Check for TLS support in the compiler and linker |
| 516 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 517 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 518 | [vg_cv_tls=$enableval], |
| 519 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 520 | [[return foo;]])], |
| 521 | [vg_cv_tls=yes], |
| 522 | [vg_cv_tls=no])])]) |
| 523 | |
| 524 | if test "$vg_cv_tls" = yes; then |
| 525 | AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables]) |
| 526 | fi |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 527 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 528 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 529 | # Checks for header files. |
| 530 | AC_HEADER_STDC |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 531 | AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 532 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 533 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 534 | # Checks for typedefs, structures, and compiler characteristics. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 535 | AC_TYPE_UID_T |
| 536 | AC_TYPE_OFF_T |
| 537 | AC_TYPE_SIZE_T |
| 538 | AC_HEADER_TIME |
| 539 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 540 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 541 | # Checks for library functions. |
| 542 | AC_FUNC_MEMCMP |
| 543 | AC_FUNC_MMAP |
| 544 | AC_TYPE_SIGNAL |
| 545 | |
thughes | beb6eb9 | 2004-06-14 12:33:43 +0000 | [diff] [blame] | 546 | AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 547 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 548 | AC_OUTPUT( |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 549 | Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 550 | valgrind.spec |
mueller | bddd607 | 2003-11-19 21:50:07 +0000 | [diff] [blame] | 551 | valgrind.pc |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 552 | docs/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 553 | docs/lib/Makefile |
| 554 | docs/images/Makefile |
njn | f7c00b1 | 2005-07-19 21:46:19 +0000 | [diff] [blame] | 555 | docs/internals/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 556 | docs/xml/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 557 | tests/Makefile |
njn | c2e7f48 | 2002-09-27 08:44:17 +0000 | [diff] [blame] | 558 | tests/vg_regtest |
njn | ec0c27a | 2005-12-10 23:11:28 +0000 | [diff] [blame] | 559 | perf/Makefile |
| 560 | perf/vg_perf |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 561 | include/Makefile |
njn | 7a6e746 | 2002-11-09 17:53:30 +0000 | [diff] [blame] | 562 | auxprogs/Makefile |
njn25 | ab72603 | 2002-09-23 16:24:41 +0000 | [diff] [blame] | 563 | coregrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 564 | addrcheck/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 565 | addrcheck/tests/Makefile |
njn | 7da8fa7 | 2002-10-03 10:38:40 +0000 | [diff] [blame] | 566 | addrcheck/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 567 | memcheck/Makefile |
| 568 | memcheck/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 569 | memcheck/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 570 | memcheck/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 571 | memcheck/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 572 | memcheck/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 573 | memcheck/docs/Makefile |
| 574 | cachegrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 575 | cachegrind/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 576 | cachegrind/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 577 | cachegrind/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 578 | cachegrind/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 579 | cachegrind/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 580 | cachegrind/docs/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 581 | cachegrind/cg_annotate |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 582 | helgrind/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 583 | helgrind/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 584 | helgrind/docs/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 585 | massif/Makefile |
| 586 | massif/hp2ps/Makefile |
| 587 | massif/tests/Makefile |
| 588 | massif/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 589 | lackey/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 590 | lackey/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 591 | lackey/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 592 | none/Makefile |
| 593 | none/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 594 | none/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 595 | none/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 596 | none/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 597 | none/tests/x86/Makefile |
njn | 9bc8c00 | 2002-10-02 13:49:13 +0000 | [diff] [blame] | 598 | none/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 599 | ) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 600 | |
| 601 | cat<<EOF |
| 602 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 603 | Primary build target: ${VG_PLATFORM_PRI} |
| 604 | Secondary target: ${VG_PLATFORM_SEC} |
| 605 | Default supp files: ${DEFAULT_SUPP} |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 606 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 607 | EOF |
| 608 | |
| 609 | cat<<EOF > default.supp |
| 610 | # This is a generated file, composed of the following suppression rules: |
| 611 | # |
| 612 | # ${DEFAULT_SUPP} |
| 613 | # |
| 614 | |
| 615 | EOF |
| 616 | |
| 617 | for file in ${DEFAULT_SUPP} ; do |
| 618 | cat ${srcdir}/$file >> default.supp |
| 619 | done |