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. |
sewardj | 17c4eb1 | 2007-12-11 00:50:54 +0000 | [diff] [blame] | 11 | AC_INIT(Valgrind, 3.4.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) |
bart | 3a2dac0 | 2008-03-18 17:40:38 +0000 | [diff] [blame] | 14 | AM_INIT_AUTOMAKE([foreign]) |
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 |
bart | 0affa49 | 2008-03-18 17:53:09 +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 | |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 63 | # If no AR variable was specified, look up the name of the archiver. Otherwise |
| 64 | # do not touch the AR variable. |
| 65 | if test "x$AR" = "x"; then |
| 66 | AC_PATH_PROGS([AR], ["${LD%ld}ar" "ar"], [ar]) |
| 67 | fi |
| 68 | AC_ARG_VAR([AR],[Archiver command]) |
| 69 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 70 | # Check for the compiler support |
| 71 | if test "${GCC}" != "yes" ; then |
| 72 | AC_MSG_ERROR([Valgrind relies on GCC to be compiled]) |
| 73 | fi |
| 74 | |
sewardj | 2f68595 | 2002-12-22 19:32:23 +0000 | [diff] [blame] | 75 | # figure out where perl lives |
| 76 | AC_PATH_PROG(PERL, perl) |
| 77 | |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 78 | # figure out where gdb lives |
| 79 | AC_PATH_PROG(GDB, gdb) |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 80 | AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB]) |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 81 | |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 82 | # some older automake's don't have it so try something on our own |
| 83 | ifdef([AM_PROG_AS],[AM_PROG_AS], |
| 84 | [ |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 85 | AS="${CC}" |
| 86 | AC_SUBST(AS) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 87 | |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 88 | ASFLAGS="" |
| 89 | AC_SUBST(ASFLAGS) |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 90 | ]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 91 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 92 | |
sewardj | f33b433 | 2008-07-18 18:20:42 +0000 | [diff] [blame] | 93 | # Check we have GNU sed: some of the stuff done by "make install" relies |
| 94 | # on some pretty fancy sed expressions, and AIX sed doesn't produce the |
| 95 | # same results, causing install to fail |
| 96 | |
| 97 | AC_MSG_CHECKING([for GNU sed]) |
| 98 | |
| 99 | [sed_firstline=`sed --version | head -n 1`] |
| 100 | |
| 101 | case "${sed_firstline}" in |
| 102 | GNU*) |
| 103 | AC_MSG_RESULT([ok, looks like GNU sed]) |
| 104 | ;; |
| 105 | *) |
| 106 | AC_MSG_RESULT([please ensure first 'sed' in your path is GNU sed]) |
| 107 | AC_MSG_RESULT([note: GNU sed is only required at build/install time]) |
| 108 | AC_MSG_ERROR([build/install requires that 'sed' is GNU sed]) |
| 109 | ;; |
| 110 | esac |
| 111 | |
| 112 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 113 | # We don't want gcc < 3.0 |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 114 | AC_MSG_CHECKING([for a supported version of gcc]) |
| 115 | |
sewardj | f33b433 | 2008-07-18 18:20:42 +0000 | [diff] [blame] | 116 | [gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`] |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 117 | |
| 118 | case "${gcc_version}" in |
bart | 76719bf | 2008-04-19 07:47:56 +0000 | [diff] [blame] | 119 | 2.*) |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 120 | AC_MSG_RESULT([no (${gcc_version})]) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 121 | AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc]) |
| 122 | ;; |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 123 | *) |
| 124 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 125 | ;; |
| 126 | esac |
| 127 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 128 | |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 129 | # Checks for the platform, with the aim of setting VG_ARCH_MAX. Note |
| 130 | # that VG_ARCH_MAX must be set to reflect the most that this CPU can |
| 131 | # do: for example if it is a 64-bit capable PowerPC, then it must be |
| 132 | # set to ppc64 and not ppc32. Ditto for amd64. |
| 133 | # |
| 134 | # We will later in this file set VG_ARCH_PRI, which is the arch for |
| 135 | # the primary target. For example, suppose we do a build on an amd64 |
| 136 | # machine, but --enable-only32bit has been requested. Then |
| 137 | # VG_ARCH_MAX will be "amd64" since that reflects the most that this |
| 138 | # cpu can do, but VG_ARCH_PRI will be "x86", since that reflects the |
| 139 | # arch corresponding to the primary build (VG_PLATFORM_PRI). |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 140 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 141 | AC_CANONICAL_HOST |
| 142 | |
| 143 | AC_MSG_CHECKING([for a supported CPU]) |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 144 | AC_SUBST(VG_ARCH_MAX) |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 145 | |
sewardj | 9b0567a | 2006-01-17 02:56:18 +0000 | [diff] [blame] | 146 | AC_SUBST(VG_ARCH_ALL) |
| 147 | VG_ARCH_ALL="amd64 ppc32 ppc64 x86" |
| 148 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 149 | AC_SUBST(VALT_LOAD_ADDRESS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 150 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 151 | case "${host_cpu}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 152 | i?86) |
| 153 | AC_MSG_RESULT([ok (${host_cpu})]) |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 154 | VG_ARCH_MAX="x86" |
sewardj | d7baad4 | 2006-05-20 01:13:38 +0000 | [diff] [blame] | 155 | valt_load_address_normal="0x38000000" |
| 156 | valt_load_address_inner="0x28000000" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 157 | ;; |
| 158 | |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 159 | x86_64) |
| 160 | AC_MSG_RESULT([ok (${host_cpu})]) |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 161 | VG_ARCH_MAX="amd64" |
sewardj | d7baad4 | 2006-05-20 01:13:38 +0000 | [diff] [blame] | 162 | valt_load_address_normal="0x38000000" |
| 163 | valt_load_address_inner="0x28000000" |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 164 | ;; |
| 165 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 166 | powerpc64) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 167 | # This value can only happen on Linux, not on AIX |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 168 | AC_MSG_RESULT([ok (${host_cpu})]) |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 169 | VG_ARCH_MAX="ppc64" |
sewardj | d7baad4 | 2006-05-20 01:13:38 +0000 | [diff] [blame] | 170 | valt_load_address_normal="0x38000000" |
| 171 | valt_load_address_inner="0x28000000" |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 172 | ;; |
| 173 | |
| 174 | powerpc) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 175 | # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU. |
| 176 | # Whereas in Linux that means only a 32-bit capable CPU. |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 177 | AC_MSG_RESULT([ok (${host_cpu})]) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 178 | case "${host_os}" in |
| 179 | aix5.*) |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 180 | VG_ARCH_MAX="ppc64" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 181 | ;; |
| 182 | *) |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 183 | VG_ARCH_MAX="ppc32" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 184 | ;; |
| 185 | esac |
sewardj | d7baad4 | 2006-05-20 01:13:38 +0000 | [diff] [blame] | 186 | valt_load_address_normal="0x38000000" |
| 187 | valt_load_address_inner="0x28000000" |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 188 | ;; |
| 189 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 190 | *) |
| 191 | AC_MSG_RESULT([no (${host_cpu})]) |
nethercote | 81d5c66 | 2004-10-13 13:18:51 +0000 | [diff] [blame] | 192 | AC_MSG_ERROR([Unsupported host architecture. Sorry]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 193 | ;; |
| 194 | esac |
| 195 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 196 | # Check if this should be built as an inner Valgrind, to be run within |
| 197 | # another Valgrind. Choose the load address accordingly. |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 198 | AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner, |
| 199 | [AC_ARG_ENABLE(inner, |
| 200 | [ --enable-inner enables self-hosting], |
| 201 | [vg_cv_inner=$enableval], |
| 202 | [vg_cv_inner=no])]) |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 203 | if test "$vg_cv_inner" = yes; then |
| 204 | AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind]) |
| 205 | VALT_LOAD_ADDRESS=$valt_load_address_inner |
| 206 | else |
| 207 | VALT_LOAD_ADDRESS=$valt_load_address_normal |
| 208 | fi |
| 209 | |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 210 | # Sometimes it's convenient to subvert the bi-arch build system and |
| 211 | # just have a single build even though the underlying platform is |
| 212 | # capable of both. Hence handle --enable-only64bit and |
| 213 | # --enable-only32bit. Complain if both are issued :-) |
| 214 | |
| 215 | # Check if a 64-bit only build has been requested |
| 216 | AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit, |
| 217 | [AC_ARG_ENABLE(only64bit, |
| 218 | [ --enable-only64bit do a 64-bit only build], |
| 219 | [vg_cv_only64bit=$enableval], |
| 220 | [vg_cv_only64bit=no])]) |
| 221 | |
| 222 | # Check if a 32-bit only build has been requested |
| 223 | AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit, |
| 224 | [AC_ARG_ENABLE(only32bit, |
| 225 | [ --enable-only32bit do a 32-bit only build], |
| 226 | [vg_cv_only32bit=$enableval], |
| 227 | [vg_cv_only32bit=no])]) |
| 228 | |
| 229 | # Stay sane |
| 230 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 231 | AC_MSG_ERROR( |
| 232 | [Nonsensical: both --enable-only64bit and --enable-only32bit.]) |
| 233 | fi |
| 234 | |
| 235 | |
| 236 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 237 | AC_MSG_CHECKING([for a supported OS]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 238 | AC_SUBST(VG_OS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 239 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 240 | case "${host_os}" in |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 241 | *linux*) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 242 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 243 | VG_OS="linux" |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 244 | |
| 245 | # Ok, this is linux. Check the kernel version |
| 246 | AC_MSG_CHECKING([for the kernel version]) |
| 247 | |
| 248 | kernel=`uname -r` |
| 249 | |
| 250 | case "${kernel}" in |
| 251 | 2.6.*) |
| 252 | AC_MSG_RESULT([2.6 family (${kernel})]) |
| 253 | AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x]) |
| 254 | ;; |
| 255 | |
| 256 | 2.4.*) |
| 257 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 258 | AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) |
| 259 | ;; |
| 260 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 261 | *) |
| 262 | AC_MSG_RESULT([unsupported (${kernel})]) |
nethercote | 4fa681f | 2004-11-08 17:51:39 +0000 | [diff] [blame] | 263 | AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 264 | ;; |
| 265 | esac |
| 266 | |
| 267 | ;; |
| 268 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 269 | aix5.1.*) |
| 270 | AC_MSG_RESULT([ok (${host_os})]) |
| 271 | VG_OS="aix5" |
| 272 | ;; |
| 273 | aix5.2.*) |
| 274 | AC_MSG_RESULT([ok (${host_os})]) |
| 275 | VG_OS="aix5" |
| 276 | ;; |
| 277 | aix5.3.*) |
| 278 | AC_MSG_RESULT([ok (${host_os})]) |
| 279 | VG_OS="aix5" |
| 280 | ;; |
| 281 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 282 | *freebsd*) |
| 283 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 284 | VG_OS="freebsd" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 285 | ;; |
| 286 | |
| 287 | *) |
| 288 | AC_MSG_RESULT([no (${host_os})]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 289 | 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] | 290 | ;; |
| 291 | esac |
| 292 | |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 293 | # If we are building on a 64 bit platform test to see if the system |
| 294 | # supports building 32 bit programs and disable 32 bit support if it |
| 295 | # does not support building 32 bit programs |
| 296 | |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 297 | case "$VG_ARCH_MAX-$VG_OS" in |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 298 | amd64-linux|ppc64-linux) |
| 299 | AC_MSG_CHECKING([for 32 bit build support]) |
| 300 | safe_CFLAGS=$CFLAGS |
| 301 | CFLAGS="-m32" |
| 302 | AC_TRY_LINK(, [ |
| 303 | int main () { return 0 ; } |
| 304 | ], |
| 305 | [ |
| 306 | AC_MSG_RESULT([yes]) |
| 307 | ], [ |
| 308 | vg_cv_only64bit="yes" |
| 309 | AC_MSG_RESULT([no]) |
| 310 | ]) |
| 311 | CFLAGS=$safe_CFLAGS;; |
| 312 | esac |
| 313 | |
| 314 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 315 | AC_MSG_ERROR( |
| 316 | [--enable-only32bit was specified but system does not support 32 bit builds]) |
| 317 | fi |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 318 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 319 | # Establish VG_PLATFORM_PRI. This is the primary build target. The |
| 320 | # entire system, including regression and performance tests, will be |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 321 | # built for this target. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 322 | # |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 323 | # Also establish VG_PLATFORM_SEC, the secondary build target, if |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 324 | # possible. The system will also be built for this target, but not |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 325 | # the regression or performance tests. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 326 | # |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 327 | # Also establish VG_ARCH_PRI, which is the arch for the primary |
| 328 | # build target. The various makefiles building regression tests |
| 329 | # sometimes need to see this. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 330 | AC_MSG_CHECKING([for a supported CPU/OS combination]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 331 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 332 | AC_SUBST(VG_PLATFORM_PRI) |
| 333 | AC_SUBST(VG_PLATFORM_SEC) |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 334 | AC_SUBST(VG_ARCH_PRI) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 335 | |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 336 | # By default, the primary arch is the same as the "max" arch, as |
| 337 | # commented above (at the definition of VG_ARCH_MAX). We may choose |
| 338 | # to downgrade it in the big case statement just below here, in the |
| 339 | # case where we're building on a 64 bit machine but have been |
| 340 | # requested only to do a 32 bit build. |
| 341 | VG_ARCH_PRI=$VG_ARCH_MAX |
| 342 | |
| 343 | case "$VG_ARCH_MAX-$VG_OS" in |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 344 | x86-linux) |
| 345 | VG_PLATFORM_PRI="X86_LINUX" |
| 346 | VG_PLATFORM_SEC="" |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 347 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 348 | ;; |
| 349 | amd64-linux) |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 350 | if test x$vg_cv_only64bit = xyes; then |
| 351 | VG_PLATFORM_PRI="AMD64_LINUX" |
| 352 | VG_PLATFORM_SEC="" |
| 353 | elif test x$vg_cv_only32bit = xyes; then |
| 354 | VG_PLATFORM_PRI="X86_LINUX" |
| 355 | VG_PLATFORM_SEC="" |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 356 | VG_ARCH_PRI="x86" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 357 | else |
| 358 | VG_PLATFORM_PRI="AMD64_LINUX" |
| 359 | VG_PLATFORM_SEC="X86_LINUX" |
| 360 | fi |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 361 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 362 | ;; |
| 363 | ppc32-linux) |
| 364 | VG_PLATFORM_PRI="PPC32_LINUX" |
| 365 | VG_PLATFORM_SEC="" |
| 366 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 367 | ;; |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 368 | ppc64-aix5) |
| 369 | if test x$vg_cv_only64bit = xyes; then |
| 370 | VG_PLATFORM_PRI="PPC64_AIX5" |
| 371 | VG_PLATFORM_SEC="" |
| 372 | elif test x$vg_cv_only32bit = xyes; then |
| 373 | VG_PLATFORM_PRI="PPC32_AIX5" |
| 374 | VG_PLATFORM_SEC="" |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 375 | VG_ARCH_PRI="ppc32" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 376 | else |
| 377 | VG_PLATFORM_PRI="PPC64_AIX5" |
| 378 | VG_PLATFORM_SEC="PPC32_AIX5" |
| 379 | fi |
| 380 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 381 | ;; |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 382 | ppc64-linux) |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 383 | if test x$vg_cv_only64bit = xyes; then |
| 384 | VG_PLATFORM_PRI="PPC64_LINUX" |
| 385 | VG_PLATFORM_SEC="" |
| 386 | elif test x$vg_cv_only32bit = xyes; then |
| 387 | VG_PLATFORM_PRI="PPC32_LINUX" |
| 388 | VG_PLATFORM_SEC="" |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 389 | VG_ARCH_PRI="ppc32" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 390 | else |
| 391 | VG_PLATFORM_PRI="PPC64_LINUX" |
| 392 | VG_PLATFORM_SEC="PPC32_LINUX" |
| 393 | fi |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 394 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 395 | ;; |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 396 | *) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 397 | VG_PLATFORM_PRI="unknown" |
| 398 | VG_PLATFORM_SEC="unknown" |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 399 | AC_MSG_RESULT([no (${host_cpu}-${host_os})]) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 400 | AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 401 | ;; |
| 402 | esac |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 403 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 404 | # Set up VGP_<platform>. Either one or two of these become defined. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 405 | # |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 406 | AM_CONDITIONAL(VGP_X86_LINUX, |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 407 | test x$VG_PLATFORM_PRI = xX86_LINUX \ |
| 408 | -o x$VG_PLATFORM_SEC = xX86_LINUX) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 409 | AM_CONDITIONAL(VGP_AMD64_LINUX, |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 410 | test x$VG_PLATFORM_PRI = xAMD64_LINUX) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 411 | AM_CONDITIONAL(VGP_PPC32_LINUX, |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 412 | test x$VG_PLATFORM_PRI = xPPC32_LINUX \ |
| 413 | -o x$VG_PLATFORM_SEC = xPPC32_LINUX) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 414 | AM_CONDITIONAL(VGP_PPC64_LINUX, |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 415 | test x$VG_PLATFORM_PRI = xPPC64_LINUX) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 416 | AM_CONDITIONAL(VGP_PPC32_AIX5, |
| 417 | test x$VG_PLATFORM_PRI = xPPC32_AIX5 \ |
| 418 | -o x$VG_PLATFORM_SEC = xPPC32_AIX5) |
| 419 | AM_CONDITIONAL(VGP_PPC64_AIX5, |
| 420 | test x$VG_PLATFORM_PRI = xPPC64_AIX5) |
| 421 | |
| 422 | # Similarly, set up VGO_<os>. Exactly one of these becomes defined. |
| 423 | # Relies on the assumption that the primary and secondary targets are |
| 424 | # for the same OS, so therefore only necessary to test the primary. |
| 425 | # |
| 426 | AM_CONDITIONAL(VGO_LINUX, |
| 427 | test x$VG_PLATFORM_PRI = xX86_LINUX \ |
| 428 | -o x$VG_PLATFORM_PRI = xAMD64_LINUX \ |
| 429 | -o x$VG_PLATFORM_PRI = xPPC32_LINUX \ |
| 430 | -o x$VG_PLATFORM_PRI = xPPC64_LINUX) |
| 431 | AM_CONDITIONAL(VGO_AIX5, |
| 432 | test x$VG_PLATFORM_PRI = xPPC32_AIX5 \ |
| 433 | -o x$VG_PLATFORM_PRI = xPPC64_AIX5) |
| 434 | |
| 435 | |
| 436 | # Sometimes, in the Makefile.am-s, it's useful to know |
| 437 | # whether or not there is a secondary target. |
| 438 | # |
| 439 | AM_CONDITIONAL(VGP_HAVE_SECONDARY, |
| 440 | test x$VG_PLATFORM_SEC != x) |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 441 | |
tom | b637bad | 2005-11-08 12:28:35 +0000 | [diff] [blame] | 442 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 443 | # This variable will collect the individual suppression files |
| 444 | # depending on the results of autoconf |
| 445 | DEFAULT_SUPP="" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 446 | AC_SUBST(DEFAULT_SUPP) |
| 447 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 448 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 449 | GLIBC_VERSION="" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 450 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 451 | AC_EGREP_CPP([GLIBC_22], [ |
| 452 | #include <features.h> |
| 453 | #ifdef __GNU_LIBRARY__ |
| 454 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2) |
| 455 | GLIBC_22 |
| 456 | #endif |
| 457 | #endif |
| 458 | ], |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 459 | GLIBC_VERSION="2.2") |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 460 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 461 | AC_EGREP_CPP([GLIBC_23], [ |
| 462 | #include <features.h> |
| 463 | #ifdef __GNU_LIBRARY__ |
| 464 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3) |
| 465 | GLIBC_23 |
| 466 | #endif |
| 467 | #endif |
| 468 | ], |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 469 | GLIBC_VERSION="2.3") |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 470 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 471 | AC_EGREP_CPP([GLIBC_24], [ |
| 472 | #include <features.h> |
| 473 | #ifdef __GNU_LIBRARY__ |
| 474 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4) |
| 475 | GLIBC_24 |
| 476 | #endif |
| 477 | #endif |
| 478 | ], |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 479 | GLIBC_VERSION="2.4") |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 480 | |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 481 | AC_EGREP_CPP([GLIBC_25], [ |
| 482 | #include <features.h> |
| 483 | #ifdef __GNU_LIBRARY__ |
| 484 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5) |
| 485 | GLIBC_25 |
| 486 | #endif |
| 487 | #endif |
| 488 | ], |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 489 | GLIBC_VERSION="2.5") |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 490 | |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 491 | AC_EGREP_CPP([GLIBC_26], [ |
| 492 | #include <features.h> |
| 493 | #ifdef __GNU_LIBRARY__ |
| 494 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6) |
| 495 | GLIBC_26 |
| 496 | #endif |
| 497 | #endif |
| 498 | ], |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 499 | GLIBC_VERSION="2.6") |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 500 | |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 501 | AC_EGREP_CPP([GLIBC_27], [ |
| 502 | #include <features.h> |
| 503 | #ifdef __GNU_LIBRARY__ |
| 504 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7) |
| 505 | GLIBC_27 |
| 506 | #endif |
| 507 | #endif |
| 508 | ], |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 509 | GLIBC_VERSION="2.7") |
| 510 | |
| 511 | AC_EGREP_CPP([GLIBC_28], [ |
| 512 | #include <features.h> |
| 513 | #ifdef __GNU_LIBRARY__ |
| 514 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8) |
| 515 | GLIBC_28 |
| 516 | #endif |
| 517 | #endif |
| 518 | ], |
| 519 | GLIBC_VERSION="2.8") |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 520 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 521 | AC_EGREP_CPP([AIX5_LIBC], [ |
| 522 | #include <standards.h> |
| 523 | #if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530) |
| 524 | AIX5_LIBC |
| 525 | #endif |
| 526 | ], |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 527 | GLIBC_VERSION="aix5") |
daywalker | e9212b3 | 2003-06-15 22:39:15 +0000 | [diff] [blame] | 528 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 529 | AC_MSG_CHECKING([the GLIBC_VERSION version]) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 530 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 531 | case "${GLIBC_VERSION}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 532 | 2.2) |
| 533 | AC_MSG_RESULT(2.2 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 534 | AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x]) |
sewardj | 2c4f3dd | 2007-11-11 06:13:01 +0000 | [diff] [blame] | 535 | DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}" |
| 536 | DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 537 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 538 | ;; |
| 539 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 540 | 2.3) |
| 541 | AC_MSG_RESULT(2.3 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 542 | AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x]) |
sewardj | 2c4f3dd | 2007-11-11 06:13:01 +0000 | [diff] [blame] | 543 | DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 544 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 545 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 546 | ;; |
| 547 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 548 | 2.4) |
| 549 | AC_MSG_RESULT(2.4 family) |
| 550 | AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x]) |
sewardj | 2c4f3dd | 2007-11-11 06:13:01 +0000 | [diff] [blame] | 551 | DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 552 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 553 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 554 | ;; |
| 555 | |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 556 | 2.5) |
| 557 | AC_MSG_RESULT(2.5 family) |
| 558 | AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x]) |
sewardj | 2c4f3dd | 2007-11-11 06:13:01 +0000 | [diff] [blame] | 559 | DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 560 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 561 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 562 | ;; |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 563 | 2.6) |
| 564 | AC_MSG_RESULT(2.6 family) |
| 565 | AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x]) |
sewardj | 2c4f3dd | 2007-11-11 06:13:01 +0000 | [diff] [blame] | 566 | DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 567 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 568 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 569 | ;; |
| 570 | 2.7) |
| 571 | AC_MSG_RESULT(2.7 family) |
| 572 | AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x]) |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 573 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 574 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 575 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 576 | ;; |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 577 | 2.8) |
| 578 | AC_MSG_RESULT(2.8 family) |
dirk | eb939fc | 2008-04-27 20:38:47 +0000 | [diff] [blame] | 579 | AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x]) |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 580 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 581 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 582 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 583 | ;; |
| 584 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 585 | aix5) |
sewardj | 2f3bcd2 | 2006-12-12 01:38:15 +0000 | [diff] [blame] | 586 | AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3) |
| 587 | AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3]) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 588 | DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}" |
| 589 | ;; |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 590 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 591 | *) |
| 592 | AC_MSG_RESULT(unsupported version) |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 593 | AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.8]) |
| 594 | AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 595 | ;; |
| 596 | esac |
| 597 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 598 | AC_SUBST(GLIBC_VERSION) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 599 | |
sewardj | 414f358 | 2008-07-18 20:46:00 +0000 | [diff] [blame] | 600 | |
| 601 | # Add default suppressions for the X client libraries. Make no |
| 602 | # attempt to detect whether such libraries are installed on the |
| 603 | # build machine (or even if any X facilities are present); just |
| 604 | # add the suppressions antidisirregardless. |
| 605 | DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}" |
| 606 | DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 607 | |
sewardj | 2e10a68 | 2003-04-07 19:36:41 +0000 | [diff] [blame] | 608 | |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 609 | # Check for CLOCK_MONOTONIC |
| 610 | |
| 611 | AC_MSG_CHECKING([for CLOCK_MONOTONIC]) |
| 612 | |
| 613 | AC_TRY_COMPILE( |
| 614 | [ |
| 615 | #include <time.h> |
| 616 | ], [ |
| 617 | struct timespec t; |
| 618 | clock_gettime(CLOCK_MONOTONIC, &t); |
| 619 | return 0; |
| 620 | ], |
| 621 | [ |
| 622 | AC_MSG_RESULT([yes]) |
| 623 | AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1, |
| 624 | [Define to 1 if you have the `CLOCK_MONOTONIC' constant.]) |
| 625 | ], [ |
| 626 | AC_MSG_RESULT([no]) |
| 627 | ]) |
| 628 | |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 629 | |
| 630 | # Check for PTHREAD_MUTEX_ADAPTIVE_NP |
| 631 | |
| 632 | AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP]) |
| 633 | |
| 634 | AC_TRY_COMPILE( |
| 635 | [ |
| 636 | #define _GNU_SOURCE |
| 637 | #include <pthread.h> |
| 638 | ], [ |
| 639 | return (PTHREAD_MUTEX_ADAPTIVE_NP); |
| 640 | ], |
| 641 | [ |
| 642 | AC_MSG_RESULT([yes]) |
| 643 | AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1, |
| 644 | [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.]) |
| 645 | ], [ |
| 646 | AC_MSG_RESULT([no]) |
| 647 | ]) |
| 648 | |
| 649 | |
| 650 | # Check for PTHREAD_MUTEX_ERRORCHECK_NP |
| 651 | |
| 652 | AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP]) |
| 653 | |
| 654 | AC_TRY_COMPILE( |
| 655 | [ |
| 656 | #define _GNU_SOURCE |
| 657 | #include <pthread.h> |
| 658 | ], [ |
| 659 | return (PTHREAD_MUTEX_ERRORCHECK_NP); |
| 660 | ], |
| 661 | [ |
| 662 | AC_MSG_RESULT([yes]) |
| 663 | AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1, |
| 664 | [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.]) |
| 665 | ], [ |
| 666 | AC_MSG_RESULT([no]) |
| 667 | ]) |
| 668 | |
| 669 | |
| 670 | # Check for PTHREAD_MUTEX_RECURSIVE_NP |
| 671 | |
| 672 | AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP]) |
| 673 | |
| 674 | AC_TRY_COMPILE( |
| 675 | [ |
| 676 | #define _GNU_SOURCE |
| 677 | #include <pthread.h> |
| 678 | ], [ |
| 679 | return (PTHREAD_MUTEX_RECURSIVE_NP); |
| 680 | ], |
| 681 | [ |
| 682 | AC_MSG_RESULT([yes]) |
| 683 | AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, |
| 684 | [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.]) |
| 685 | ], [ |
| 686 | AC_MSG_RESULT([no]) |
| 687 | ]) |
| 688 | |
| 689 | |
| 690 | # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP |
| 691 | |
| 692 | AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP]) |
| 693 | |
| 694 | AC_TRY_COMPILE( |
| 695 | [ |
| 696 | #define _GNU_SOURCE |
| 697 | #include <pthread.h> |
| 698 | ], [ |
| 699 | pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; |
| 700 | return 0; |
| 701 | ], |
| 702 | [ |
| 703 | AC_MSG_RESULT([yes]) |
| 704 | AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1, |
| 705 | [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.]) |
| 706 | ], [ |
| 707 | AC_MSG_RESULT([no]) |
| 708 | ]) |
| 709 | |
| 710 | |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 711 | # Check whether pthread_mutex_t has a member called __m_kind. |
| 712 | |
| 713 | AC_MSG_CHECKING([for pthread_mutex_t::__m_kind]) |
| 714 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 715 | AC_TRY_COMPILE( |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 716 | [ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 717 | #include <pthread.h> |
| 718 | ], [ |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 719 | pthread_mutex_t m; |
| 720 | return m.__m_kind; |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 721 | ], [ |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 722 | AC_MSG_RESULT([yes]) |
| 723 | AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1, |
| 724 | [Define to 1 if pthread_mutex_t has a member called __m_kind.]) |
| 725 | ], [ |
| 726 | AC_MSG_RESULT([no]) |
| 727 | ]) |
| 728 | |
| 729 | |
| 730 | # Check whether pthread_mutex_t has a member called __data.__kind. |
| 731 | |
| 732 | AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind]) |
| 733 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 734 | AC_TRY_COMPILE( |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 735 | [ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 736 | #include <pthread.h> |
| 737 | ], [ |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 738 | pthread_mutex_t m; |
| 739 | return m.__data.__kind; |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 740 | ], [ |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 741 | AC_MSG_RESULT([yes]) |
| 742 | AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1, |
| 743 | [Define to 1 if pthread_mutex_t has a member __data.__kind.]) |
| 744 | ], [ |
| 745 | AC_MSG_RESULT([no]) |
| 746 | ]) |
| 747 | |
| 748 | |
bart | 6111133 | 2008-03-10 17:57:41 +0000 | [diff] [blame] | 749 | # does this compiler support -fopenmp, does it have the include file |
| 750 | # <omp.h> and does it have libgomp ? |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 751 | |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 752 | AC_MSG_CHECKING([for OpenMP]) |
| 753 | |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 754 | safe_CFLAGS=$CFLAGS |
| 755 | CFLAGS="-fopenmp" |
| 756 | |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 757 | AC_LINK_IFELSE( |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 758 | [ |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 759 | #include <omp.h> |
| 760 | int main(int argc, char** argv) |
| 761 | { |
| 762 | omp_set_dynamic(0); |
| 763 | return 0; |
| 764 | } |
| 765 | ], |
| 766 | [ |
| 767 | ac_have_openmp=yes |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 768 | AC_MSG_RESULT([yes]) |
| 769 | ], [ |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 770 | ac_have_openmp=no |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 771 | AC_MSG_RESULT([no]) |
| 772 | ]) |
| 773 | CFLAGS=$safe_CFLAGS |
| 774 | |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 775 | AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes]) |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 776 | |
| 777 | |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 778 | # does this compiler support -maltivec and does it have the include file |
| 779 | # <altivec.h> ? |
| 780 | |
| 781 | AC_MSG_CHECKING([for Altivec]) |
| 782 | |
| 783 | safe_CFLAGS=$CFLAGS |
| 784 | CFLAGS="-maltivec" |
| 785 | |
| 786 | AC_TRY_COMPILE( |
| 787 | [ |
| 788 | #include <altivec.h> |
| 789 | ], [ |
| 790 | vector unsigned int v; |
| 791 | ], |
| 792 | [ |
| 793 | ac_have_altivec=yes |
| 794 | AC_MSG_RESULT([yes]) |
| 795 | ], [ |
| 796 | ac_have_altivec=no |
| 797 | AC_MSG_RESULT([no]) |
| 798 | ]) |
| 799 | CFLAGS=$safe_CFLAGS |
| 800 | |
| 801 | AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes]) |
| 802 | AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes]) |
| 803 | |
| 804 | |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 805 | # Check for eventfd_t, eventfd() and eventfd_read() |
| 806 | AC_MSG_CHECKING([for eventfd()]) |
| 807 | |
| 808 | AC_TRY_LINK( |
| 809 | [ |
| 810 | #include <sys/eventfd.h> |
| 811 | ], [ |
| 812 | eventfd_t ev; |
| 813 | int fd; |
| 814 | |
| 815 | fd = eventfd(5, 0); |
| 816 | eventfd_read(fd, &ev); |
| 817 | return 0; |
| 818 | ], |
| 819 | [ |
| 820 | AC_MSG_RESULT([yes]) |
| 821 | AC_DEFINE([HAVE_EVENTFD], 1, |
| 822 | [Define to 1 if you have the `eventfd' function.]) |
| 823 | AC_DEFINE([HAVE_EVENTFD_READ], 1, |
| 824 | [Define to 1 if you have the `eventfd_read' function.]) |
| 825 | ], [ |
| 826 | AC_MSG_RESULT([no]) |
| 827 | ]) |
| 828 | |
| 829 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 830 | # does this compiler support -m32 ? |
| 831 | AC_MSG_CHECKING([if gcc accepts -m32]) |
| 832 | |
| 833 | safe_CFLAGS=$CFLAGS |
| 834 | CFLAGS="-m32" |
| 835 | |
| 836 | AC_TRY_COMPILE(, [ |
| 837 | int main () { return 0 ; } |
| 838 | ], |
| 839 | [ |
| 840 | FLAG_M32="-m32" |
| 841 | AC_MSG_RESULT([yes]) |
| 842 | ], [ |
| 843 | FLAG_M32="" |
| 844 | AC_MSG_RESULT([no]) |
| 845 | ]) |
| 846 | CFLAGS=$safe_CFLAGS |
| 847 | |
| 848 | AC_SUBST(FLAG_M32) |
| 849 | |
| 850 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 851 | # does this compiler support -maix32 ? |
| 852 | AC_MSG_CHECKING([if gcc accepts -maix32]) |
| 853 | |
| 854 | safe_CFLAGS=$CFLAGS |
| 855 | CFLAGS="-maix32" |
| 856 | |
| 857 | AC_TRY_COMPILE(, [ |
| 858 | int main () { return 0 ; } |
| 859 | ], |
| 860 | [ |
| 861 | FLAG_MAIX32="-maix32" |
| 862 | AC_MSG_RESULT([yes]) |
| 863 | ], [ |
| 864 | FLAG_MAIX32="" |
| 865 | AC_MSG_RESULT([no]) |
| 866 | ]) |
| 867 | CFLAGS=$safe_CFLAGS |
| 868 | |
| 869 | AC_SUBST(FLAG_MAIX32) |
| 870 | |
| 871 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 872 | # does this compiler support -m64 ? |
| 873 | AC_MSG_CHECKING([if gcc accepts -m64]) |
| 874 | |
| 875 | safe_CFLAGS=$CFLAGS |
| 876 | CFLAGS="-m64" |
| 877 | |
| 878 | AC_TRY_COMPILE(, [ |
| 879 | int main () { return 0 ; } |
| 880 | ], |
| 881 | [ |
| 882 | FLAG_M64="-m64" |
| 883 | AC_MSG_RESULT([yes]) |
| 884 | ], [ |
| 885 | FLAG_M64="" |
| 886 | AC_MSG_RESULT([no]) |
| 887 | ]) |
| 888 | CFLAGS=$safe_CFLAGS |
| 889 | |
| 890 | AC_SUBST(FLAG_M64) |
| 891 | |
| 892 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 893 | # does this compiler support -maix64 ? |
| 894 | AC_MSG_CHECKING([if gcc accepts -maix64]) |
| 895 | |
| 896 | safe_CFLAGS=$CFLAGS |
| 897 | CFLAGS="-maix64" |
| 898 | |
| 899 | AC_TRY_COMPILE(, [ |
| 900 | int main () { return 0 ; } |
| 901 | ], |
| 902 | [ |
| 903 | FLAG_MAIX64="-maix64" |
| 904 | AC_MSG_RESULT([yes]) |
| 905 | ], [ |
| 906 | FLAG_MAIX64="" |
| 907 | AC_MSG_RESULT([no]) |
| 908 | ]) |
| 909 | CFLAGS=$safe_CFLAGS |
| 910 | |
| 911 | AC_SUBST(FLAG_MAIX64) |
| 912 | |
| 913 | |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 914 | # does this compiler support -mmmx ? |
| 915 | AC_MSG_CHECKING([if gcc accepts -mmmx]) |
| 916 | |
| 917 | safe_CFLAGS=$CFLAGS |
| 918 | CFLAGS="-mmmx" |
| 919 | |
| 920 | AC_TRY_COMPILE(, [ |
| 921 | int main () { return 0 ; } |
| 922 | ], |
| 923 | [ |
| 924 | FLAG_MMMX="-mmmx" |
| 925 | AC_MSG_RESULT([yes]) |
| 926 | ], [ |
| 927 | FLAG_MMMX="" |
| 928 | AC_MSG_RESULT([no]) |
| 929 | ]) |
| 930 | CFLAGS=$safe_CFLAGS |
| 931 | |
| 932 | AC_SUBST(FLAG_MMMX) |
| 933 | |
| 934 | |
| 935 | # does this compiler support -msse ? |
| 936 | AC_MSG_CHECKING([if gcc accepts -msse]) |
| 937 | |
| 938 | safe_CFLAGS=$CFLAGS |
| 939 | CFLAGS="-msse" |
| 940 | |
| 941 | AC_TRY_COMPILE(, [ |
| 942 | int main () { return 0 ; } |
| 943 | ], |
| 944 | [ |
| 945 | FLAG_MSSE="-msse" |
| 946 | AC_MSG_RESULT([yes]) |
| 947 | ], [ |
| 948 | FLAG_MSSE="" |
| 949 | AC_MSG_RESULT([no]) |
| 950 | ]) |
| 951 | CFLAGS=$safe_CFLAGS |
| 952 | |
| 953 | AC_SUBST(FLAG_MSSE) |
| 954 | |
| 955 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 956 | # does this compiler support -mpreferred-stack-boundary=2 ? |
| 957 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary]) |
| 958 | |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 959 | safe_CFLAGS=$CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 960 | CFLAGS="-mpreferred-stack-boundary=2" |
| 961 | |
| 962 | AC_TRY_COMPILE(, [ |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 963 | int main () { return 0 ; } |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 964 | ], |
| 965 | [ |
| 966 | PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2" |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 967 | AC_MSG_RESULT([yes]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 968 | ], [ |
| 969 | PREFERRED_STACK_BOUNDARY="" |
| 970 | AC_MSG_RESULT([no]) |
| 971 | ]) |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 972 | CFLAGS=$safe_CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 973 | |
| 974 | AC_SUBST(PREFERRED_STACK_BOUNDARY) |
| 975 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 976 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 977 | # does this compiler support -Wno-pointer-sign ? |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 978 | AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign]) |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 979 | |
| 980 | safe_CFLAGS=$CFLAGS |
| 981 | CFLAGS="-Wno-pointer-sign" |
| 982 | |
| 983 | AC_TRY_COMPILE(, [ |
| 984 | int main () { return 0 ; } |
| 985 | ], |
| 986 | [ |
| 987 | no_pointer_sign=yes |
| 988 | AC_MSG_RESULT([yes]) |
| 989 | ], [ |
| 990 | no_pointer_sign=no |
| 991 | AC_MSG_RESULT([no]) |
| 992 | ]) |
| 993 | CFLAGS=$safe_CFLAGS |
| 994 | |
| 995 | if test x$no_pointer_sign = xyes; then |
| 996 | CFLAGS="$CFLAGS -Wno-pointer-sign" |
| 997 | fi |
| 998 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 999 | |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 1000 | # does this compiler support -Wdeclaration-after-statement ? |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1001 | AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement]) |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 1002 | |
| 1003 | safe_CFLAGS=$CFLAGS |
| 1004 | CFLAGS="-Wdeclaration-after-statement" |
| 1005 | |
| 1006 | AC_TRY_COMPILE(, [ |
| 1007 | int main () { return 0 ; } |
| 1008 | ], |
| 1009 | [ |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 1010 | declaration_after_statement=yes |
sewardj | 72a547e | 2006-01-25 02:58:28 +0000 | [diff] [blame] | 1011 | FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement" |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 1012 | AC_MSG_RESULT([yes]) |
| 1013 | ], [ |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 1014 | declaration_after_statement=no |
sewardj | 72a547e | 2006-01-25 02:58:28 +0000 | [diff] [blame] | 1015 | FLAG_WDECL_AFTER_STMT="" |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 1016 | AC_MSG_RESULT([no]) |
| 1017 | ]) |
| 1018 | CFLAGS=$safe_CFLAGS |
| 1019 | |
sewardj | 72a547e | 2006-01-25 02:58:28 +0000 | [diff] [blame] | 1020 | AC_SUBST(FLAG_WDECL_AFTER_STMT) |
| 1021 | |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 1022 | if test x$declaration_after_statement = xyes; then |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 1023 | CFLAGS="$CFLAGS -Wdeclaration-after-statement" |
| 1024 | fi |
| 1025 | |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 1026 | |
bart | 9d865fa | 2008-06-23 12:11:49 +0000 | [diff] [blame] | 1027 | # does this compiler support -Wno-format-zero-length ? |
| 1028 | |
| 1029 | AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length]) |
| 1030 | |
| 1031 | safe_CFLAGS=$CFLAGS |
| 1032 | CFLAGS="-Wno-format-zero-length" |
| 1033 | |
| 1034 | AC_TRY_COMPILE( |
| 1035 | [ ], |
| 1036 | [ |
| 1037 | return 0; |
| 1038 | ], |
| 1039 | [ |
| 1040 | AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length]) |
| 1041 | AC_MSG_RESULT([yes]) |
| 1042 | ], |
| 1043 | [ |
| 1044 | AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], []) |
| 1045 | AC_MSG_RESULT([no]) |
| 1046 | ]) |
| 1047 | CFLAGS=$safe_CFLAGS |
| 1048 | |
| 1049 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1050 | # does this compiler support -Wextra or the older -W ? |
| 1051 | |
| 1052 | AC_MSG_CHECKING([if gcc accepts -Wextra or -W]) |
| 1053 | |
| 1054 | safe_CFLAGS=$CFLAGS |
| 1055 | CFLAGS="-Wextra" |
| 1056 | |
| 1057 | AC_TRY_COMPILE( |
| 1058 | [ ], |
| 1059 | [ |
| 1060 | return 0; |
| 1061 | ], |
| 1062 | [ |
| 1063 | AC_SUBST([FLAG_W_EXTRA], [-Wextra]) |
| 1064 | AC_MSG_RESULT([-Wextra]) |
| 1065 | ], [ |
| 1066 | CFLAGS="-W" |
| 1067 | AC_TRY_COMPILE( |
| 1068 | [ ], |
| 1069 | [ |
| 1070 | return 0; |
| 1071 | ], |
| 1072 | [ |
| 1073 | AC_SUBST([FLAG_W_EXTRA], [-W]) |
| 1074 | AC_MSG_RESULT([-W]) |
| 1075 | ], [ |
| 1076 | AC_SUBST([FLAG_W_EXTRA], []) |
| 1077 | AC_MSG_RESULT([not supported]) |
| 1078 | ]) |
| 1079 | ]) |
| 1080 | CFLAGS=$safe_CFLAGS |
| 1081 | |
| 1082 | |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1083 | # does this compiler support -fno-stack-protector ? |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1084 | AC_MSG_CHECKING([if gcc accepts -fno-stack-protector]) |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1085 | |
| 1086 | safe_CFLAGS=$CFLAGS |
| 1087 | CFLAGS="-fno-stack-protector" |
| 1088 | |
| 1089 | AC_TRY_COMPILE(, [ |
| 1090 | int main () { return 0 ; } |
| 1091 | ], |
| 1092 | [ |
| 1093 | no_stack_protector=yes |
| 1094 | FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector" |
| 1095 | AC_MSG_RESULT([yes]) |
| 1096 | ], [ |
| 1097 | no_stack_protector=no |
| 1098 | FLAG_FNO_STACK_PROTECTOR="" |
| 1099 | AC_MSG_RESULT([no]) |
| 1100 | ]) |
| 1101 | CFLAGS=$safe_CFLAGS |
| 1102 | |
| 1103 | AC_SUBST(FLAG_FNO_STACK_PROTECTOR) |
| 1104 | |
| 1105 | if test x$no_stack_protector = xyes; then |
| 1106 | CFLAGS="$CFLAGS -fno-stack-protector" |
| 1107 | fi |
| 1108 | |
| 1109 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1110 | # does this compiler support --param inline-unit-growth=... ? |
| 1111 | |
| 1112 | AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth]) |
| 1113 | |
| 1114 | safe_CFLAGS=$CFLAGS |
| 1115 | CFLAGS="--param inline-unit-growth=900" |
| 1116 | |
| 1117 | AC_TRY_COMPILE( |
| 1118 | [ ], |
| 1119 | [ |
| 1120 | return 0; |
| 1121 | ], |
| 1122 | [ |
| 1123 | AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], |
| 1124 | ["--param inline-unit-growth=900"]) |
| 1125 | AC_MSG_RESULT([yes]) |
| 1126 | ], [ |
| 1127 | AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""]) |
| 1128 | AC_MSG_RESULT([no]) |
| 1129 | ]) |
| 1130 | CFLAGS=$safe_CFLAGS |
| 1131 | |
| 1132 | |
tom | d55121e | 2005-12-19 12:40:13 +0000 | [diff] [blame] | 1133 | # does this compiler support __builtin_expect? |
| 1134 | AC_MSG_CHECKING([if gcc supports __builtin_expect]) |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1135 | |
tom | d55121e | 2005-12-19 12:40:13 +0000 | [diff] [blame] | 1136 | AC_TRY_LINK(, [ |
| 1137 | return __builtin_expect(1, 1) ? 1 : 0 |
| 1138 | ], |
| 1139 | [ |
| 1140 | ac_have_builtin_expect=yes |
| 1141 | AC_MSG_RESULT([yes]) |
| 1142 | ], [ |
| 1143 | ac_have_builtin_expect=no |
| 1144 | AC_MSG_RESULT([no]) |
| 1145 | ]) |
| 1146 | if test x$ac_have_builtin_expect = xyes ; then |
| 1147 | AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.]) |
| 1148 | fi |
| 1149 | |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 1150 | |
bart | cd529dc | 2008-06-26 08:43:12 +0000 | [diff] [blame] | 1151 | # does this compiler have built-in functions for atomic memory access ? |
| 1152 | AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap]) |
| 1153 | |
| 1154 | AC_TRY_LINK(, |
| 1155 | [ |
| 1156 | int variable = 1; |
bart | 99ae610 | 2008-09-21 11:24:00 +0000 | [diff] [blame^] | 1157 | return (__sync_bool_compare_and_swap(&variable, 1, 2) |
| 1158 | && __sync_add_and_fetch(&variable, 1) ? 1 : 0 |
bart | cd529dc | 2008-06-26 08:43:12 +0000 | [diff] [blame] | 1159 | ], |
| 1160 | [ |
| 1161 | AC_MSG_RESULT([yes]) |
| 1162 | AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.]) |
| 1163 | ], |
| 1164 | [ |
| 1165 | AC_MSG_RESULT([no]) |
| 1166 | ]) |
| 1167 | |
| 1168 | |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 1169 | # does the ppc assembler support "mtocrf" et al? |
| 1170 | AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf]) |
| 1171 | |
| 1172 | AC_TRY_COMPILE(, [ |
sewardj | dd4cbe1 | 2006-03-12 17:27:44 +0000 | [diff] [blame] | 1173 | __asm__ __volatile__("mtocrf 4,0"); |
| 1174 | __asm__ __volatile__("mfocrf 0,4"); |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 1175 | ], |
| 1176 | [ |
| 1177 | ac_have_as_ppc_mftocrf=yes |
| 1178 | AC_MSG_RESULT([yes]) |
| 1179 | ], [ |
| 1180 | ac_have_as_ppc_mftocrf=no |
| 1181 | AC_MSG_RESULT([no]) |
| 1182 | ]) |
| 1183 | if test x$ac_have_as_ppc_mftocrf = xyes ; then |
| 1184 | AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.]) |
| 1185 | fi |
| 1186 | |
| 1187 | |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1188 | # does the x86/amd64 assembler understand SSE3 instructions? |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 1189 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1190 | # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1191 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3]) |
| 1192 | |
| 1193 | AC_TRY_COMPILE(, [ |
| 1194 | do { long long int x; |
| 1195 | __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); } |
| 1196 | while (0) |
| 1197 | ], |
| 1198 | [ |
| 1199 | ac_have_as_sse3=yes |
| 1200 | AC_MSG_RESULT([yes]) |
| 1201 | ], [ |
| 1202 | ac_have_as_sse3=no |
| 1203 | AC_MSG_RESULT([no]) |
| 1204 | ]) |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 1205 | |
| 1206 | AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes) |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1207 | |
| 1208 | |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 1209 | # Ditto for SSSE3 instructions (note extra S) |
| 1210 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1211 | # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's |
| 1212 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3]) |
| 1213 | |
| 1214 | AC_TRY_COMPILE(, [ |
| 1215 | do { long long int x; |
| 1216 | __asm__ __volatile__( |
| 1217 | "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); } |
| 1218 | while (0) |
| 1219 | ], |
| 1220 | [ |
| 1221 | ac_have_as_ssse3=yes |
| 1222 | AC_MSG_RESULT([yes]) |
| 1223 | ], [ |
| 1224 | ac_have_as_ssse3=no |
| 1225 | AC_MSG_RESULT([no]) |
| 1226 | ]) |
| 1227 | |
| 1228 | AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes) |
| 1229 | |
| 1230 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1231 | # Check for TLS support in the compiler and linker |
bart | ca9f2ad | 2008-06-02 07:14:20 +0000 | [diff] [blame] | 1232 | if test "x${cross_compiling}" = "xno"; then |
| 1233 | # Native compilation: check whether running a program using TLS succeeds. |
| 1234 | # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs |
| 1235 | # succeeds but running programs using TLS fails. |
| 1236 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 1237 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 1238 | [vg_cv_tls=$enableval], |
| 1239 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 1240 | [[return foo;]])], |
| 1241 | [vg_cv_tls=yes], |
| 1242 | [vg_cv_tls=no])])]) |
| 1243 | else |
| 1244 | # Cross-compiling: check whether linking a program using TLS succeeds. |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1245 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 1246 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 1247 | [vg_cv_tls=$enableval], |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 1248 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1249 | [[return foo;]])], |
| 1250 | [vg_cv_tls=yes], |
| 1251 | [vg_cv_tls=no])])]) |
bart | ca9f2ad | 2008-06-02 07:14:20 +0000 | [diff] [blame] | 1252 | fi |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1253 | |
| 1254 | if test "$vg_cv_tls" = yes; then |
| 1255 | AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables]) |
| 1256 | fi |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1257 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1258 | |
bart | 62f54e4 | 2008-07-28 11:35:10 +0000 | [diff] [blame] | 1259 | # Checks for C header files. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1260 | AC_HEADER_STDC |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1261 | AC_CHECK_HEADERS([ \ |
| 1262 | endian.h \ |
| 1263 | mqueue.h \ |
| 1264 | sys/endian.h \ |
| 1265 | sys/epoll.h \ |
| 1266 | sys/eventfd.h \ |
bart | ce48fa9 | 2008-04-26 10:59:46 +0000 | [diff] [blame] | 1267 | sys/klog.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1268 | sys/poll.h \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1269 | sys/signal.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1270 | sys/signalfd.h \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1271 | sys/syscall.h \ |
| 1272 | sys/time.h \ |
| 1273 | sys/types.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1274 | ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1275 | |
| 1276 | # Checks for typedefs, structures, and compiler characteristics. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1277 | AC_TYPE_UID_T |
| 1278 | AC_TYPE_OFF_T |
| 1279 | AC_TYPE_SIZE_T |
| 1280 | AC_HEADER_TIME |
| 1281 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1282 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1283 | # Checks for library functions. |
| 1284 | AC_FUNC_MEMCMP |
| 1285 | AC_FUNC_MMAP |
| 1286 | AC_TYPE_SIGNAL |
| 1287 | |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1288 | AC_CHECK_LIB([rt], [clock_gettime]) |
bart | 41ac62a | 2008-07-07 16:58:03 +0000 | [diff] [blame] | 1289 | |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1290 | AC_CHECK_FUNCS([ \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1291 | clock_gettime\ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1292 | epoll_create \ |
| 1293 | epoll_pwait \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1294 | floor \ |
bart | ce48fa9 | 2008-04-26 10:59:46 +0000 | [diff] [blame] | 1295 | klogctl \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1296 | mallinfo \ |
| 1297 | memchr \ |
| 1298 | memset \ |
| 1299 | mkdir \ |
| 1300 | ppoll \ |
| 1301 | semtimedop \ |
| 1302 | signalfd \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1303 | syscall \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1304 | strchr \ |
| 1305 | strdup \ |
| 1306 | strpbrk \ |
| 1307 | strrchr \ |
| 1308 | strstr \ |
| 1309 | timerfd \ |
| 1310 | utimensat \ |
| 1311 | ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1312 | |
bart | 623eec3 | 2008-07-29 17:54:49 +0000 | [diff] [blame] | 1313 | # AC_CHECK_LIB adds any library found to the variable LIBS, and links these |
| 1314 | # libraries with any shared object and/or executable. This is NOT what we |
| 1315 | # want for e.g. vgpreload_core-x86-linux.so |
| 1316 | LIBS="" |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1317 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1318 | # Do we have a useable MPI setup on the primary and/or secondary targets? |
| 1319 | # On Linux, by default, assumes mpicc and -m32/-m64 |
| 1320 | # On AIX, by default, assumes mpxlc and -q32/-q64 |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1321 | # Note: this is a kludge in that it assumes the specified mpicc |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1322 | # understands -m32/-m64/-q32/-q64 regardless of what is specified using |
| 1323 | # --with-mpicc=. |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1324 | MPI_CC="mpicc" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1325 | if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \ |
| 1326 | -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then |
| 1327 | MPI_CC="mpxlc" |
| 1328 | fi |
| 1329 | |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1330 | mflag_primary= |
| 1331 | if test x$VG_PLATFORM_PRI = xX86_LINUX \ |
| 1332 | -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then |
| 1333 | mflag_primary=$FLAG_M32 |
| 1334 | elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \ |
| 1335 | -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then |
| 1336 | mflag_primary=$FLAG_M64 |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1337 | elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then |
| 1338 | mflag_primary=-q32 |
| 1339 | elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then |
| 1340 | mflag_primary=-q64 |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1341 | fi |
| 1342 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1343 | mflag_secondary= |
| 1344 | if test x$VG_PLATFORM_SEC = xX86_LINUX \ |
| 1345 | -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then |
| 1346 | mflag_secondary=$FLAG_M32 |
| 1347 | elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then |
| 1348 | mflag_secondary=-q32 |
| 1349 | fi |
| 1350 | |
| 1351 | |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1352 | AC_ARG_WITH(mpicc, |
sewardj | b70a613 | 2006-05-27 21:14:09 +0000 | [diff] [blame] | 1353 | [ --with-mpicc= Specify name of MPI2-ised C compiler], |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1354 | MPI_CC=$withval |
| 1355 | ) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1356 | AC_SUBST(MPI_CC) |
| 1357 | |
| 1358 | ## See if MPI_CC works for the primary target |
| 1359 | ## |
| 1360 | AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h]) |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1361 | saved_CC=$CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1362 | saved_CFLAGS=$CFLAGS |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1363 | CC=$MPI_CC |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1364 | CFLAGS=$mflag_primary |
sewardj | d3fcc64 | 2006-03-09 02:49:56 +0000 | [diff] [blame] | 1365 | AC_TRY_LINK([ |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 1366 | #include <mpi.h> |
| 1367 | #include <stdio.h> |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1368 | ],[ |
| 1369 | int r = MPI_Init(NULL,NULL); |
| 1370 | r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL ); |
| 1371 | return r; |
| 1372 | ], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1373 | ac_have_mpi2_pri=yes |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 1374 | AC_MSG_RESULT([yes, $MPI_CC]) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1375 | ], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1376 | ac_have_mpi2_pri=no |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1377 | AC_MSG_RESULT([no]) |
| 1378 | ]) |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1379 | CC=$saved_CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1380 | CFLAGS=$saved_CFLAGS |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1381 | AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1382 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1383 | ## See if MPI_CC works for the secondary target. Complication: what if |
| 1384 | ## there is no secondary target? We need this to then fail. |
| 1385 | ## Kludge this by making MPI_CC something which will surely fail in |
| 1386 | ## such a case. |
| 1387 | ## |
| 1388 | AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h]) |
| 1389 | saved_CC=$CC |
| 1390 | saved_CFLAGS=$CFLAGS |
| 1391 | if test x$VG_PLATFORM_SEC = x ; then |
| 1392 | CC="$MPI_CC this will surely fail" |
| 1393 | else |
| 1394 | CC=$MPI_CC |
| 1395 | fi |
| 1396 | CFLAGS=$mflag_secondary |
| 1397 | AC_TRY_LINK([ |
| 1398 | #include <mpi.h> |
| 1399 | #include <stdio.h> |
| 1400 | ],[ |
| 1401 | int r = MPI_Init(NULL,NULL); |
| 1402 | r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL ); |
| 1403 | return r; |
| 1404 | ], [ |
| 1405 | ac_have_mpi2_sec=yes |
| 1406 | AC_MSG_RESULT([yes, $MPI_CC]) |
| 1407 | ], [ |
| 1408 | ac_have_mpi2_sec=no |
| 1409 | AC_MSG_RESULT([no]) |
| 1410 | ]) |
| 1411 | CC=$saved_CC |
| 1412 | CFLAGS=$saved_CFLAGS |
| 1413 | AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1414 | |
| 1415 | |
bart | 21d3cfc | 2008-08-02 09:08:17 +0000 | [diff] [blame] | 1416 | # The test below verifies whether the QtCore package been installed. |
| 1417 | # This test works as follows: |
| 1418 | # - If pkg-config was not installed at the time autogen.sh was run, |
| 1419 | # the definition of the PKG_CHECK_EXISTS() macro will not be found by |
| 1420 | # autogen.sh. Augogen.sh will generate a configure script that prints |
| 1421 | # a warning about pkg-config and proceeds as if Qt4 has not been installed. |
| 1422 | # - If pkg-config was installed at the time autogen.sh was run, |
| 1423 | # the generated configure script will try to detect the presence of the |
| 1424 | # Qt4 QtCore library by looking up compile and linker flags in the file |
| 1425 | # called QtCore.pc. |
| 1426 | # - pkg-config settings can be overridden via the configure variables |
| 1427 | # QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the |
| 1428 | # configure script -- see also ./configure --help). |
| 1429 | # - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if |
| 1430 | # the pkg-config executable is not present on the system on which the |
| 1431 | # configure script is run. |
bart | 41ac62a | 2008-07-07 16:58:03 +0000 | [diff] [blame] | 1432 | |
bart | 21d3cfc | 2008-08-02 09:08:17 +0000 | [diff] [blame] | 1433 | ifdef( |
| 1434 | [PKG_CHECK_EXISTS], |
| 1435 | [PKG_CHECK_EXISTS( |
| 1436 | [QtCore], |
| 1437 | [ |
| 1438 | PKG_CHECK_MODULES([QTCORE], [QtCore]) |
| 1439 | ac_have_qtcore=yes |
| 1440 | ], |
| 1441 | [ |
| 1442 | ac_have_qtcore=no |
| 1443 | ] |
| 1444 | ) |
| 1445 | ], |
| 1446 | AC_MSG_WARN([pkg-config has not been installed or is too old.]) |
| 1447 | AC_MSG_WARN([Detection of Qt4 will be skipped.]) |
| 1448 | [ac_have_qtcore=no] |
| 1449 | ) |
bart | 41ac62a | 2008-07-07 16:58:03 +0000 | [diff] [blame] | 1450 | |
| 1451 | AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes]) |
| 1452 | |
| 1453 | |
bart | 62f54e4 | 2008-07-28 11:35:10 +0000 | [diff] [blame] | 1454 | # Test for QMutex::tryLock(int), which has been introduced in Qt 4.3. |
| 1455 | # See also http://doc.trolltech.com/4.3/qmutex.html. |
| 1456 | if test x$ac_have_qtcore = xyes; then |
| 1457 | AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)]) |
| 1458 | AC_LANG(C++) |
bart | 21d3cfc | 2008-08-02 09:08:17 +0000 | [diff] [blame] | 1459 | safe_CXXFLAGS="${CXXFLAGS}" |
| 1460 | CXXFLAGS="${pkg_cv_QTCORE_CFLAGS}" |
bart | 62f54e4 | 2008-07-28 11:35:10 +0000 | [diff] [blame] | 1461 | AC_TRY_COMPILE([ |
| 1462 | #include <QtCore/QMutex> |
| 1463 | ], |
| 1464 | [ |
| 1465 | QMutex M; |
| 1466 | M.tryLock(1); |
| 1467 | M.unlock(); |
| 1468 | return 0; |
| 1469 | ], |
| 1470 | [ |
| 1471 | AC_MSG_RESULT([yes]) |
| 1472 | AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).]) |
| 1473 | ], |
| 1474 | [ |
| 1475 | AC_MSG_RESULT([no]) |
| 1476 | ]) |
bart | 21d3cfc | 2008-08-02 09:08:17 +0000 | [diff] [blame] | 1477 | CXXFLAGS="${safe_CXXFLAGS}" |
bart | 62f54e4 | 2008-07-28 11:35:10 +0000 | [diff] [blame] | 1478 | AC_LANG(C) |
| 1479 | fi |
| 1480 | |
| 1481 | |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1482 | # -------------------- ok. We're done. -------------------- |
| 1483 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 1484 | AC_OUTPUT( |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1485 | Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1486 | valgrind.spec |
mueller | bddd607 | 2003-11-19 21:50:07 +0000 | [diff] [blame] | 1487 | valgrind.pc |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 1488 | glibc-2.X.supp |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 1489 | docs/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 1490 | docs/lib/Makefile |
| 1491 | docs/images/Makefile |
njn | f7c00b1 | 2005-07-19 21:46:19 +0000 | [diff] [blame] | 1492 | docs/internals/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 1493 | docs/xml/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 1494 | tests/Makefile |
njn | c2e7f48 | 2002-09-27 08:44:17 +0000 | [diff] [blame] | 1495 | tests/vg_regtest |
njn | ec0c27a | 2005-12-10 23:11:28 +0000 | [diff] [blame] | 1496 | perf/Makefile |
| 1497 | perf/vg_perf |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 1498 | include/Makefile |
sewardj | 0f8881b | 2006-10-18 01:16:57 +0000 | [diff] [blame] | 1499 | include/vki/Makefile |
njn | 7a6e746 | 2002-11-09 17:53:30 +0000 | [diff] [blame] | 1500 | auxprogs/Makefile |
njn25 | ab72603 | 2002-09-23 16:24:41 +0000 | [diff] [blame] | 1501 | coregrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1502 | memcheck/Makefile |
| 1503 | memcheck/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1504 | memcheck/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 1505 | memcheck/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 1506 | memcheck/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1507 | memcheck/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1508 | memcheck/docs/Makefile |
| 1509 | cachegrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1510 | cachegrind/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1511 | cachegrind/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 1512 | cachegrind/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 1513 | cachegrind/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1514 | cachegrind/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1515 | cachegrind/docs/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1516 | cachegrind/cg_annotate |
weidendo | a17f2a3 | 2006-03-20 10:27:30 +0000 | [diff] [blame] | 1517 | callgrind/Makefile |
| 1518 | callgrind/callgrind_annotate |
| 1519 | callgrind/callgrind_control |
| 1520 | callgrind/tests/Makefile |
| 1521 | callgrind/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1522 | helgrind/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1523 | helgrind/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 1524 | helgrind/docs/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 1525 | massif/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 1526 | massif/tests/Makefile |
njn | 734b805 | 2007-11-01 04:40:37 +0000 | [diff] [blame] | 1527 | massif/perf/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 1528 | massif/docs/Makefile |
njn | d5a8d24 | 2007-11-02 20:44:57 +0000 | [diff] [blame] | 1529 | massif/ms_print |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1530 | lackey/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1531 | lackey/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 1532 | lackey/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1533 | none/Makefile |
| 1534 | none/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1535 | none/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 1536 | none/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 1537 | none/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1538 | none/tests/x86/Makefile |
njn | 9bc8c00 | 2002-10-02 13:49:13 +0000 | [diff] [blame] | 1539 | none/docs/Makefile |
sewardj | 99a2ceb | 2007-11-09 12:30:36 +0000 | [diff] [blame] | 1540 | exp-omega/Makefile |
| 1541 | exp-omega/tests/Makefile |
| 1542 | exp-omega/docs/Makefile |
sewardj | 9c606bd | 2008-09-18 18:12:50 +0000 | [diff] [blame] | 1543 | exp-ptrcheck/Makefile |
| 1544 | exp-ptrcheck/tests/Makefile |
| 1545 | exp-ptrcheck/docs/Makefile |
bart | ccf17de | 2008-07-04 15:14:35 +0000 | [diff] [blame] | 1546 | drd/Makefile |
| 1547 | drd/docs/Makefile |
| 1548 | drd/scripts/download-and-build-splash2 |
| 1549 | drd/tests/Makefile |
bart | 0b2b462 | 2008-06-17 19:19:16 +0000 | [diff] [blame] | 1550 | ) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 1551 | |
| 1552 | cat<<EOF |
| 1553 | |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 1554 | configure.in: VG_ARCH_MAX = ${VG_ARCH_MAX} |
| 1555 | configure.in: VG_ARCH_PRI = ${VG_ARCH_PRI} |
| 1556 | |
| 1557 | Primary build target: ${VG_PLATFORM_PRI} |
| 1558 | Secondary build target: ${VG_PLATFORM_SEC} |
| 1559 | Default supp files: ${DEFAULT_SUPP} |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 1560 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 1561 | EOF |
| 1562 | |
| 1563 | cat<<EOF > default.supp |
| 1564 | # This is a generated file, composed of the following suppression rules: |
| 1565 | # |
| 1566 | # ${DEFAULT_SUPP} |
| 1567 | # |
| 1568 | |
| 1569 | EOF |
| 1570 | |
| 1571 | for file in ${DEFAULT_SUPP} ; do |
| 1572 | cat ${srcdir}/$file >> default.supp |
| 1573 | done |