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 | |
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 | |
bart | 76719bf | 2008-04-19 07:47:56 +0000 | [diff] [blame^] | 89 | [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] | 90 | |
| 91 | case "${gcc_version}" in |
bart | 76719bf | 2008-04-19 07:47:56 +0000 | [diff] [blame^] | 92 | 2.*) |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 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 | ;; |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 96 | *) |
| 97 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 98 | ;; |
| 99 | esac |
| 100 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 101 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 102 | # Checks for the platform, with the aim of setting VG_ARCH. Note |
| 103 | # that VG_ARCH must be set to reflect the most that this CPU can |
| 104 | # do: for example if it is a 64-bit capable PowerPC, then it must |
| 105 | # be set to ppc64 and not ppc32. Ditto for amd64. |
| 106 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 107 | AC_CANONICAL_HOST |
| 108 | |
| 109 | AC_MSG_CHECKING([for a supported CPU]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 110 | AC_SUBST(VG_ARCH) |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 111 | |
sewardj | 9b0567a | 2006-01-17 02:56:18 +0000 | [diff] [blame] | 112 | AC_SUBST(VG_ARCH_ALL) |
| 113 | VG_ARCH_ALL="amd64 ppc32 ppc64 x86" |
| 114 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 115 | AC_SUBST(VALT_LOAD_ADDRESS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 116 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 117 | case "${host_cpu}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 118 | i?86) |
| 119 | AC_MSG_RESULT([ok (${host_cpu})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 120 | VG_ARCH="x86" |
sewardj | d7baad4 | 2006-05-20 01:13:38 +0000 | [diff] [blame] | 121 | valt_load_address_normal="0x38000000" |
| 122 | valt_load_address_inner="0x28000000" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 123 | ;; |
| 124 | |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 125 | x86_64) |
| 126 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 127 | VG_ARCH="amd64" |
sewardj | d7baad4 | 2006-05-20 01:13:38 +0000 | [diff] [blame] | 128 | valt_load_address_normal="0x38000000" |
| 129 | valt_load_address_inner="0x28000000" |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 130 | ;; |
| 131 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 132 | powerpc64) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 133 | # This value can only happen on Linux, not on AIX |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 134 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 135 | VG_ARCH="ppc64" |
sewardj | d7baad4 | 2006-05-20 01:13:38 +0000 | [diff] [blame] | 136 | valt_load_address_normal="0x38000000" |
| 137 | valt_load_address_inner="0x28000000" |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 138 | ;; |
| 139 | |
| 140 | powerpc) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 141 | # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU. |
| 142 | # Whereas in Linux that means only a 32-bit capable CPU. |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 143 | AC_MSG_RESULT([ok (${host_cpu})]) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 144 | case "${host_os}" in |
| 145 | aix5.*) |
| 146 | VG_ARCH="ppc64" |
| 147 | ;; |
| 148 | *) |
| 149 | VG_ARCH="ppc32" |
| 150 | ;; |
| 151 | esac |
sewardj | d7baad4 | 2006-05-20 01:13:38 +0000 | [diff] [blame] | 152 | valt_load_address_normal="0x38000000" |
| 153 | valt_load_address_inner="0x28000000" |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 154 | ;; |
| 155 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 156 | *) |
| 157 | AC_MSG_RESULT([no (${host_cpu})]) |
nethercote | 81d5c66 | 2004-10-13 13:18:51 +0000 | [diff] [blame] | 158 | AC_MSG_ERROR([Unsupported host architecture. Sorry]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 159 | ;; |
| 160 | esac |
| 161 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 162 | # Check if this should be built as an inner Valgrind, to be run within |
| 163 | # another Valgrind. Choose the load address accordingly. |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 164 | AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner, |
| 165 | [AC_ARG_ENABLE(inner, |
| 166 | [ --enable-inner enables self-hosting], |
| 167 | [vg_cv_inner=$enableval], |
| 168 | [vg_cv_inner=no])]) |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 169 | if test "$vg_cv_inner" = yes; then |
| 170 | AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind]) |
| 171 | VALT_LOAD_ADDRESS=$valt_load_address_inner |
| 172 | else |
| 173 | VALT_LOAD_ADDRESS=$valt_load_address_normal |
| 174 | fi |
| 175 | |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 176 | # Sometimes it's convenient to subvert the bi-arch build system and |
| 177 | # just have a single build even though the underlying platform is |
| 178 | # capable of both. Hence handle --enable-only64bit and |
| 179 | # --enable-only32bit. Complain if both are issued :-) |
| 180 | |
| 181 | # Check if a 64-bit only build has been requested |
| 182 | AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit, |
| 183 | [AC_ARG_ENABLE(only64bit, |
| 184 | [ --enable-only64bit do a 64-bit only build], |
| 185 | [vg_cv_only64bit=$enableval], |
| 186 | [vg_cv_only64bit=no])]) |
| 187 | |
| 188 | # Check if a 32-bit only build has been requested |
| 189 | AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit, |
| 190 | [AC_ARG_ENABLE(only32bit, |
| 191 | [ --enable-only32bit do a 32-bit only build], |
| 192 | [vg_cv_only32bit=$enableval], |
| 193 | [vg_cv_only32bit=no])]) |
| 194 | |
| 195 | # Stay sane |
| 196 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 197 | AC_MSG_ERROR( |
| 198 | [Nonsensical: both --enable-only64bit and --enable-only32bit.]) |
| 199 | fi |
| 200 | |
| 201 | |
| 202 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 203 | AC_MSG_CHECKING([for a supported OS]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 204 | AC_SUBST(VG_OS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 205 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 206 | case "${host_os}" in |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 207 | *linux*) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 208 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 209 | VG_OS="linux" |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 210 | |
| 211 | # Ok, this is linux. Check the kernel version |
| 212 | AC_MSG_CHECKING([for the kernel version]) |
| 213 | |
| 214 | kernel=`uname -r` |
| 215 | |
| 216 | case "${kernel}" in |
| 217 | 2.6.*) |
| 218 | AC_MSG_RESULT([2.6 family (${kernel})]) |
| 219 | AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x]) |
| 220 | ;; |
| 221 | |
| 222 | 2.4.*) |
| 223 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 224 | AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) |
| 225 | ;; |
| 226 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 227 | *) |
| 228 | AC_MSG_RESULT([unsupported (${kernel})]) |
nethercote | 4fa681f | 2004-11-08 17:51:39 +0000 | [diff] [blame] | 229 | AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 230 | ;; |
| 231 | esac |
| 232 | |
| 233 | ;; |
| 234 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 235 | aix5.1.*) |
| 236 | AC_MSG_RESULT([ok (${host_os})]) |
| 237 | VG_OS="aix5" |
| 238 | ;; |
| 239 | aix5.2.*) |
| 240 | AC_MSG_RESULT([ok (${host_os})]) |
| 241 | VG_OS="aix5" |
| 242 | ;; |
| 243 | aix5.3.*) |
| 244 | AC_MSG_RESULT([ok (${host_os})]) |
| 245 | VG_OS="aix5" |
| 246 | ;; |
| 247 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 248 | *freebsd*) |
| 249 | AC_MSG_RESULT([ok (${host_os})]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 250 | VG_OS="freebsd" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 251 | ;; |
| 252 | |
| 253 | *) |
| 254 | AC_MSG_RESULT([no (${host_os})]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 255 | 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] | 256 | ;; |
| 257 | esac |
| 258 | |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 259 | # If we are building on a 64 bit platform test to see if the system |
| 260 | # supports building 32 bit programs and disable 32 bit support if it |
| 261 | # does not support building 32 bit programs |
| 262 | |
| 263 | case "$VG_ARCH-$VG_OS" in |
| 264 | amd64-linux|ppc64-linux) |
| 265 | AC_MSG_CHECKING([for 32 bit build support]) |
| 266 | safe_CFLAGS=$CFLAGS |
| 267 | CFLAGS="-m32" |
| 268 | AC_TRY_LINK(, [ |
| 269 | int main () { return 0 ; } |
| 270 | ], |
| 271 | [ |
| 272 | AC_MSG_RESULT([yes]) |
| 273 | ], [ |
| 274 | vg_cv_only64bit="yes" |
| 275 | AC_MSG_RESULT([no]) |
| 276 | ]) |
| 277 | CFLAGS=$safe_CFLAGS;; |
| 278 | esac |
| 279 | |
| 280 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 281 | AC_MSG_ERROR( |
| 282 | [--enable-only32bit was specified but system does not support 32 bit builds]) |
| 283 | fi |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 284 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 285 | # Establish VG_PLATFORM_PRI. This is the primary build target. The |
| 286 | # entire system, including regression and performance tests, will be |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 287 | # built for this target. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 288 | # |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 289 | # Also establish VG_PLATFORM_SEC, the secondary build target, if |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 290 | # possible. The system will also be built for this target, but not |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 291 | # the regression or performance tests. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 292 | # |
| 293 | AC_MSG_CHECKING([for a supported CPU/OS combination]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 294 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 295 | AC_SUBST(VG_PLATFORM_PRI) |
| 296 | AC_SUBST(VG_PLATFORM_SEC) |
| 297 | |
| 298 | case "$VG_ARCH-$VG_OS" in |
| 299 | x86-linux) |
| 300 | VG_PLATFORM_PRI="X86_LINUX" |
| 301 | VG_PLATFORM_SEC="" |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 302 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 303 | ;; |
| 304 | amd64-linux) |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 305 | if test x$vg_cv_only64bit = xyes; then |
| 306 | VG_PLATFORM_PRI="AMD64_LINUX" |
| 307 | VG_PLATFORM_SEC="" |
| 308 | elif test x$vg_cv_only32bit = xyes; then |
| 309 | VG_PLATFORM_PRI="X86_LINUX" |
| 310 | VG_PLATFORM_SEC="" |
| 311 | else |
| 312 | VG_PLATFORM_PRI="AMD64_LINUX" |
| 313 | VG_PLATFORM_SEC="X86_LINUX" |
| 314 | fi |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 315 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 316 | ;; |
| 317 | ppc32-linux) |
| 318 | VG_PLATFORM_PRI="PPC32_LINUX" |
| 319 | VG_PLATFORM_SEC="" |
| 320 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 321 | ;; |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 322 | ppc64-aix5) |
| 323 | if test x$vg_cv_only64bit = xyes; then |
| 324 | VG_PLATFORM_PRI="PPC64_AIX5" |
| 325 | VG_PLATFORM_SEC="" |
| 326 | elif test x$vg_cv_only32bit = xyes; then |
| 327 | VG_PLATFORM_PRI="PPC32_AIX5" |
| 328 | VG_PLATFORM_SEC="" |
| 329 | else |
| 330 | VG_PLATFORM_PRI="PPC64_AIX5" |
| 331 | VG_PLATFORM_SEC="PPC32_AIX5" |
| 332 | fi |
| 333 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 334 | ;; |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 335 | ppc64-linux) |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 336 | if test x$vg_cv_only64bit = xyes; then |
| 337 | VG_PLATFORM_PRI="PPC64_LINUX" |
| 338 | VG_PLATFORM_SEC="" |
| 339 | elif test x$vg_cv_only32bit = xyes; then |
| 340 | VG_PLATFORM_PRI="PPC32_LINUX" |
| 341 | VG_PLATFORM_SEC="" |
| 342 | else |
| 343 | VG_PLATFORM_PRI="PPC64_LINUX" |
| 344 | VG_PLATFORM_SEC="PPC32_LINUX" |
| 345 | fi |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 346 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 347 | ;; |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 348 | *) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 349 | VG_PLATFORM_PRI="unknown" |
| 350 | VG_PLATFORM_SEC="unknown" |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 351 | AC_MSG_RESULT([no (${host_cpu}-${host_os})]) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 352 | AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 353 | ;; |
| 354 | esac |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 355 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 356 | # Set up VGP_<platform>. Either one or two of these become defined. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 357 | # |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 358 | AM_CONDITIONAL(VGP_X86_LINUX, |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 359 | test x$VG_PLATFORM_PRI = xX86_LINUX \ |
| 360 | -o x$VG_PLATFORM_SEC = xX86_LINUX) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 361 | AM_CONDITIONAL(VGP_AMD64_LINUX, |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 362 | test x$VG_PLATFORM_PRI = xAMD64_LINUX) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 363 | AM_CONDITIONAL(VGP_PPC32_LINUX, |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 364 | test x$VG_PLATFORM_PRI = xPPC32_LINUX \ |
| 365 | -o x$VG_PLATFORM_SEC = xPPC32_LINUX) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 366 | AM_CONDITIONAL(VGP_PPC64_LINUX, |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 367 | test x$VG_PLATFORM_PRI = xPPC64_LINUX) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 368 | AM_CONDITIONAL(VGP_PPC32_AIX5, |
| 369 | test x$VG_PLATFORM_PRI = xPPC32_AIX5 \ |
| 370 | -o x$VG_PLATFORM_SEC = xPPC32_AIX5) |
| 371 | AM_CONDITIONAL(VGP_PPC64_AIX5, |
| 372 | test x$VG_PLATFORM_PRI = xPPC64_AIX5) |
| 373 | |
| 374 | # Similarly, set up VGO_<os>. Exactly one of these becomes defined. |
| 375 | # Relies on the assumption that the primary and secondary targets are |
| 376 | # for the same OS, so therefore only necessary to test the primary. |
| 377 | # |
| 378 | AM_CONDITIONAL(VGO_LINUX, |
| 379 | test x$VG_PLATFORM_PRI = xX86_LINUX \ |
| 380 | -o x$VG_PLATFORM_PRI = xAMD64_LINUX \ |
| 381 | -o x$VG_PLATFORM_PRI = xPPC32_LINUX \ |
| 382 | -o x$VG_PLATFORM_PRI = xPPC64_LINUX) |
| 383 | AM_CONDITIONAL(VGO_AIX5, |
| 384 | test x$VG_PLATFORM_PRI = xPPC32_AIX5 \ |
| 385 | -o x$VG_PLATFORM_PRI = xPPC64_AIX5) |
| 386 | |
| 387 | |
| 388 | # Sometimes, in the Makefile.am-s, it's useful to know |
| 389 | # whether or not there is a secondary target. |
| 390 | # |
| 391 | AM_CONDITIONAL(VGP_HAVE_SECONDARY, |
| 392 | test x$VG_PLATFORM_SEC != x) |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 393 | |
tom | b637bad | 2005-11-08 12:28:35 +0000 | [diff] [blame] | 394 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 395 | # This variable will collect the individual suppression files |
| 396 | # depending on the results of autoconf |
| 397 | DEFAULT_SUPP="" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 398 | AC_SUBST(DEFAULT_SUPP) |
| 399 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 400 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 401 | libc="" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 402 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 403 | AC_EGREP_CPP([GLIBC_22], [ |
| 404 | #include <features.h> |
| 405 | #ifdef __GNU_LIBRARY__ |
| 406 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2) |
| 407 | GLIBC_22 |
| 408 | #endif |
| 409 | #endif |
| 410 | ], |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 411 | libc="2.2") |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 412 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 413 | AC_EGREP_CPP([GLIBC_23], [ |
| 414 | #include <features.h> |
| 415 | #ifdef __GNU_LIBRARY__ |
| 416 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3) |
| 417 | GLIBC_23 |
| 418 | #endif |
| 419 | #endif |
| 420 | ], |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 421 | libc="2.3") |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 422 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 423 | AC_EGREP_CPP([GLIBC_24], [ |
| 424 | #include <features.h> |
| 425 | #ifdef __GNU_LIBRARY__ |
| 426 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4) |
| 427 | GLIBC_24 |
| 428 | #endif |
| 429 | #endif |
| 430 | ], |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 431 | libc="2.4") |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 432 | |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 433 | AC_EGREP_CPP([GLIBC_25], [ |
| 434 | #include <features.h> |
| 435 | #ifdef __GNU_LIBRARY__ |
| 436 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5) |
| 437 | GLIBC_25 |
| 438 | #endif |
| 439 | #endif |
| 440 | ], |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 441 | libc="2.5") |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 442 | |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 443 | AC_EGREP_CPP([GLIBC_26], [ |
| 444 | #include <features.h> |
| 445 | #ifdef __GNU_LIBRARY__ |
| 446 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6) |
| 447 | GLIBC_26 |
| 448 | #endif |
| 449 | #endif |
| 450 | ], |
| 451 | libc="2.6") |
| 452 | |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 453 | AC_EGREP_CPP([GLIBC_27], [ |
| 454 | #include <features.h> |
| 455 | #ifdef __GNU_LIBRARY__ |
| 456 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7) |
| 457 | GLIBC_27 |
| 458 | #endif |
| 459 | #endif |
| 460 | ], |
| 461 | libc="2.7") |
| 462 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 463 | AC_EGREP_CPP([AIX5_LIBC], [ |
| 464 | #include <standards.h> |
| 465 | #if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530) |
| 466 | AIX5_LIBC |
| 467 | #endif |
| 468 | ], |
| 469 | libc="aix5") |
daywalker | e9212b3 | 2003-06-15 22:39:15 +0000 | [diff] [blame] | 470 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 471 | AC_MSG_CHECKING([the libc version]) |
| 472 | |
| 473 | case "${libc}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 474 | 2.2) |
| 475 | AC_MSG_RESULT(2.2 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 476 | 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] | 477 | DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}" |
| 478 | DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 479 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 480 | ;; |
| 481 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 482 | 2.3) |
| 483 | AC_MSG_RESULT(2.3 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 484 | 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] | 485 | DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 486 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 487 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 488 | ;; |
| 489 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 490 | 2.4) |
| 491 | AC_MSG_RESULT(2.4 family) |
| 492 | 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] | 493 | DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 494 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 495 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 496 | ;; |
| 497 | |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 498 | 2.5) |
| 499 | AC_MSG_RESULT(2.5 family) |
| 500 | 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] | 501 | DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 502 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 503 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 504 | ;; |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 505 | 2.6) |
| 506 | AC_MSG_RESULT(2.6 family) |
| 507 | 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] | 508 | DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 509 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 510 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 511 | ;; |
| 512 | 2.7) |
| 513 | AC_MSG_RESULT(2.7 family) |
| 514 | AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x]) |
| 515 | DEFAULT_SUPP="glibc-2.7.supp ${DEFAULT_SUPP}" |
| 516 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 517 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 518 | ;; |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 519 | aix5) |
sewardj | 2f3bcd2 | 2006-12-12 01:38:15 +0000 | [diff] [blame] | 520 | AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3) |
| 521 | 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] | 522 | DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}" |
| 523 | ;; |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 524 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 525 | *) |
| 526 | AC_MSG_RESULT(unsupported version) |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 527 | AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.7]) |
sewardj | 2f3bcd2 | 2006-12-12 01:38:15 +0000 | [diff] [blame] | 528 | AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 libc]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 529 | ;; |
| 530 | esac |
| 531 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 532 | |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 533 | # We don't know how to detect the X client library version |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 534 | # (detecting the server version is easy, but no help). So we |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 535 | # just use a hack: always include the suppressions for both |
| 536 | # versions 3 and 4. |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 537 | AC_PATH_X |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 538 | if test "${no_x}" != 'yes' ; then |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 539 | DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}" |
| 540 | DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 541 | fi |
| 542 | |
sewardj | 2e10a68 | 2003-04-07 19:36:41 +0000 | [diff] [blame] | 543 | |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 544 | # Check whether pthread_mutex_t has a member called __m_kind. |
| 545 | |
| 546 | AC_MSG_CHECKING([for pthread_mutex_t::__m_kind]) |
| 547 | |
| 548 | AC_COMPILE_IFELSE( |
| 549 | [ |
| 550 | #include <pthread.h> |
| 551 | int main(int argc, char** argv) |
| 552 | { |
| 553 | pthread_mutex_t m; |
| 554 | return m.__m_kind; |
| 555 | } |
| 556 | ], |
| 557 | [ |
| 558 | AC_MSG_RESULT([yes]) |
| 559 | AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1, |
| 560 | [Define to 1 if pthread_mutex_t has a member called __m_kind.]) |
| 561 | ], [ |
| 562 | AC_MSG_RESULT([no]) |
| 563 | ]) |
| 564 | |
| 565 | |
| 566 | # Check whether pthread_mutex_t has a member called __data.__kind. |
| 567 | |
| 568 | AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind]) |
| 569 | |
| 570 | AC_COMPILE_IFELSE( |
| 571 | [ |
| 572 | #include <pthread.h> |
| 573 | int main(int argc, char** argv) |
| 574 | { |
| 575 | pthread_mutex_t m; |
| 576 | return m.__data.__kind; |
| 577 | } |
| 578 | ], |
| 579 | [ |
| 580 | AC_MSG_RESULT([yes]) |
| 581 | AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1, |
| 582 | [Define to 1 if pthread_mutex_t has a member __data.__kind.]) |
| 583 | ], [ |
| 584 | AC_MSG_RESULT([no]) |
| 585 | ]) |
| 586 | |
| 587 | |
bart | 6111133 | 2008-03-10 17:57:41 +0000 | [diff] [blame] | 588 | # does this compiler support -fopenmp, does it have the include file |
| 589 | # <omp.h> and does it have libgomp ? |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 590 | |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 591 | AC_MSG_CHECKING([for OpenMP]) |
| 592 | |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 593 | safe_CFLAGS=$CFLAGS |
| 594 | CFLAGS="-fopenmp" |
| 595 | |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 596 | AC_LINK_IFELSE( |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 597 | [ |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 598 | #include <omp.h> |
| 599 | int main(int argc, char** argv) |
| 600 | { |
| 601 | omp_set_dynamic(0); |
| 602 | return 0; |
| 603 | } |
| 604 | ], |
| 605 | [ |
| 606 | ac_have_openmp=yes |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 607 | AC_MSG_RESULT([yes]) |
| 608 | ], [ |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 609 | ac_have_openmp=no |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 610 | AC_MSG_RESULT([no]) |
| 611 | ]) |
| 612 | CFLAGS=$safe_CFLAGS |
| 613 | |
bart | 1f52b82 | 2008-03-12 17:11:48 +0000 | [diff] [blame] | 614 | AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes]) |
bart | 29cc9db | 2008-03-09 15:59:30 +0000 | [diff] [blame] | 615 | |
| 616 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 617 | # does this compiler support -m32 ? |
| 618 | AC_MSG_CHECKING([if gcc accepts -m32]) |
| 619 | |
| 620 | safe_CFLAGS=$CFLAGS |
| 621 | CFLAGS="-m32" |
| 622 | |
| 623 | AC_TRY_COMPILE(, [ |
| 624 | int main () { return 0 ; } |
| 625 | ], |
| 626 | [ |
| 627 | FLAG_M32="-m32" |
| 628 | AC_MSG_RESULT([yes]) |
| 629 | ], [ |
| 630 | FLAG_M32="" |
| 631 | AC_MSG_RESULT([no]) |
| 632 | ]) |
| 633 | CFLAGS=$safe_CFLAGS |
| 634 | |
| 635 | AC_SUBST(FLAG_M32) |
| 636 | |
| 637 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 638 | # does this compiler support -maix32 ? |
| 639 | AC_MSG_CHECKING([if gcc accepts -maix32]) |
| 640 | |
| 641 | safe_CFLAGS=$CFLAGS |
| 642 | CFLAGS="-maix32" |
| 643 | |
| 644 | AC_TRY_COMPILE(, [ |
| 645 | int main () { return 0 ; } |
| 646 | ], |
| 647 | [ |
| 648 | FLAG_MAIX32="-maix32" |
| 649 | AC_MSG_RESULT([yes]) |
| 650 | ], [ |
| 651 | FLAG_MAIX32="" |
| 652 | AC_MSG_RESULT([no]) |
| 653 | ]) |
| 654 | CFLAGS=$safe_CFLAGS |
| 655 | |
| 656 | AC_SUBST(FLAG_MAIX32) |
| 657 | |
| 658 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 659 | # does this compiler support -m64 ? |
| 660 | AC_MSG_CHECKING([if gcc accepts -m64]) |
| 661 | |
| 662 | safe_CFLAGS=$CFLAGS |
| 663 | CFLAGS="-m64" |
| 664 | |
| 665 | AC_TRY_COMPILE(, [ |
| 666 | int main () { return 0 ; } |
| 667 | ], |
| 668 | [ |
| 669 | FLAG_M64="-m64" |
| 670 | AC_MSG_RESULT([yes]) |
| 671 | ], [ |
| 672 | FLAG_M64="" |
| 673 | AC_MSG_RESULT([no]) |
| 674 | ]) |
| 675 | CFLAGS=$safe_CFLAGS |
| 676 | |
| 677 | AC_SUBST(FLAG_M64) |
| 678 | |
| 679 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 680 | # does this compiler support -maix64 ? |
| 681 | AC_MSG_CHECKING([if gcc accepts -maix64]) |
| 682 | |
| 683 | safe_CFLAGS=$CFLAGS |
| 684 | CFLAGS="-maix64" |
| 685 | |
| 686 | AC_TRY_COMPILE(, [ |
| 687 | int main () { return 0 ; } |
| 688 | ], |
| 689 | [ |
| 690 | FLAG_MAIX64="-maix64" |
| 691 | AC_MSG_RESULT([yes]) |
| 692 | ], [ |
| 693 | FLAG_MAIX64="" |
| 694 | AC_MSG_RESULT([no]) |
| 695 | ]) |
| 696 | CFLAGS=$safe_CFLAGS |
| 697 | |
| 698 | AC_SUBST(FLAG_MAIX64) |
| 699 | |
| 700 | |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 701 | # does this compiler support -mmmx ? |
| 702 | AC_MSG_CHECKING([if gcc accepts -mmmx]) |
| 703 | |
| 704 | safe_CFLAGS=$CFLAGS |
| 705 | CFLAGS="-mmmx" |
| 706 | |
| 707 | AC_TRY_COMPILE(, [ |
| 708 | int main () { return 0 ; } |
| 709 | ], |
| 710 | [ |
| 711 | FLAG_MMMX="-mmmx" |
| 712 | AC_MSG_RESULT([yes]) |
| 713 | ], [ |
| 714 | FLAG_MMMX="" |
| 715 | AC_MSG_RESULT([no]) |
| 716 | ]) |
| 717 | CFLAGS=$safe_CFLAGS |
| 718 | |
| 719 | AC_SUBST(FLAG_MMMX) |
| 720 | |
| 721 | |
| 722 | # does this compiler support -msse ? |
| 723 | AC_MSG_CHECKING([if gcc accepts -msse]) |
| 724 | |
| 725 | safe_CFLAGS=$CFLAGS |
| 726 | CFLAGS="-msse" |
| 727 | |
| 728 | AC_TRY_COMPILE(, [ |
| 729 | int main () { return 0 ; } |
| 730 | ], |
| 731 | [ |
| 732 | FLAG_MSSE="-msse" |
| 733 | AC_MSG_RESULT([yes]) |
| 734 | ], [ |
| 735 | FLAG_MSSE="" |
| 736 | AC_MSG_RESULT([no]) |
| 737 | ]) |
| 738 | CFLAGS=$safe_CFLAGS |
| 739 | |
| 740 | AC_SUBST(FLAG_MSSE) |
| 741 | |
| 742 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 743 | # does this compiler support -mpreferred-stack-boundary=2 ? |
| 744 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary]) |
| 745 | |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 746 | safe_CFLAGS=$CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 747 | CFLAGS="-mpreferred-stack-boundary=2" |
| 748 | |
| 749 | AC_TRY_COMPILE(, [ |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 750 | int main () { return 0 ; } |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 751 | ], |
| 752 | [ |
| 753 | PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2" |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 754 | AC_MSG_RESULT([yes]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 755 | ], [ |
| 756 | PREFERRED_STACK_BOUNDARY="" |
| 757 | AC_MSG_RESULT([no]) |
| 758 | ]) |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 759 | CFLAGS=$safe_CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 760 | |
| 761 | AC_SUBST(PREFERRED_STACK_BOUNDARY) |
| 762 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 763 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 764 | # does this compiler support -Wno-pointer-sign ? |
| 765 | AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ]) |
| 766 | |
| 767 | safe_CFLAGS=$CFLAGS |
| 768 | CFLAGS="-Wno-pointer-sign" |
| 769 | |
| 770 | AC_TRY_COMPILE(, [ |
| 771 | int main () { return 0 ; } |
| 772 | ], |
| 773 | [ |
| 774 | no_pointer_sign=yes |
| 775 | AC_MSG_RESULT([yes]) |
| 776 | ], [ |
| 777 | no_pointer_sign=no |
| 778 | AC_MSG_RESULT([no]) |
| 779 | ]) |
| 780 | CFLAGS=$safe_CFLAGS |
| 781 | |
| 782 | if test x$no_pointer_sign = xyes; then |
| 783 | CFLAGS="$CFLAGS -Wno-pointer-sign" |
| 784 | fi |
| 785 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 786 | |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 787 | # does this compiler support -Wdeclaration-after-statement ? |
| 788 | AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement ]) |
| 789 | |
| 790 | safe_CFLAGS=$CFLAGS |
| 791 | CFLAGS="-Wdeclaration-after-statement" |
| 792 | |
| 793 | AC_TRY_COMPILE(, [ |
| 794 | int main () { return 0 ; } |
| 795 | ], |
| 796 | [ |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 797 | declaration_after_statement=yes |
sewardj | 72a547e | 2006-01-25 02:58:28 +0000 | [diff] [blame] | 798 | FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement" |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 799 | AC_MSG_RESULT([yes]) |
| 800 | ], [ |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 801 | declaration_after_statement=no |
sewardj | 72a547e | 2006-01-25 02:58:28 +0000 | [diff] [blame] | 802 | FLAG_WDECL_AFTER_STMT="" |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 803 | AC_MSG_RESULT([no]) |
| 804 | ]) |
| 805 | CFLAGS=$safe_CFLAGS |
| 806 | |
sewardj | 72a547e | 2006-01-25 02:58:28 +0000 | [diff] [blame] | 807 | AC_SUBST(FLAG_WDECL_AFTER_STMT) |
| 808 | |
tom | e9814c3 | 2005-10-12 11:30:43 +0000 | [diff] [blame] | 809 | if test x$declaration_after_statement = xyes; then |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 810 | CFLAGS="$CFLAGS -Wdeclaration-after-statement" |
| 811 | fi |
| 812 | |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 813 | |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 814 | # does this compiler support -fno-stack-protector ? |
| 815 | AC_MSG_CHECKING([if gcc accepts -fno-stack-protector ]) |
| 816 | |
| 817 | safe_CFLAGS=$CFLAGS |
| 818 | CFLAGS="-fno-stack-protector" |
| 819 | |
| 820 | AC_TRY_COMPILE(, [ |
| 821 | int main () { return 0 ; } |
| 822 | ], |
| 823 | [ |
| 824 | no_stack_protector=yes |
| 825 | FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector" |
| 826 | AC_MSG_RESULT([yes]) |
| 827 | ], [ |
| 828 | no_stack_protector=no |
| 829 | FLAG_FNO_STACK_PROTECTOR="" |
| 830 | AC_MSG_RESULT([no]) |
| 831 | ]) |
| 832 | CFLAGS=$safe_CFLAGS |
| 833 | |
| 834 | AC_SUBST(FLAG_FNO_STACK_PROTECTOR) |
| 835 | |
| 836 | if test x$no_stack_protector = xyes; then |
| 837 | CFLAGS="$CFLAGS -fno-stack-protector" |
| 838 | fi |
| 839 | |
| 840 | |
tom | d55121e | 2005-12-19 12:40:13 +0000 | [diff] [blame] | 841 | # does this compiler support __builtin_expect? |
| 842 | AC_MSG_CHECKING([if gcc supports __builtin_expect]) |
| 843 | |
| 844 | AC_TRY_LINK(, [ |
| 845 | return __builtin_expect(1, 1) ? 1 : 0 |
| 846 | ], |
| 847 | [ |
| 848 | ac_have_builtin_expect=yes |
| 849 | AC_MSG_RESULT([yes]) |
| 850 | ], [ |
| 851 | ac_have_builtin_expect=no |
| 852 | AC_MSG_RESULT([no]) |
| 853 | ]) |
| 854 | if test x$ac_have_builtin_expect = xyes ; then |
| 855 | AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.]) |
| 856 | fi |
| 857 | |
tom | 1e94668 | 2005-10-12 11:27:33 +0000 | [diff] [blame] | 858 | |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 859 | # does the ppc assembler support "mtocrf" et al? |
| 860 | AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf]) |
| 861 | |
| 862 | AC_TRY_COMPILE(, [ |
sewardj | dd4cbe1 | 2006-03-12 17:27:44 +0000 | [diff] [blame] | 863 | __asm__ __volatile__("mtocrf 4,0"); |
| 864 | __asm__ __volatile__("mfocrf 0,4"); |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 865 | ], |
| 866 | [ |
| 867 | ac_have_as_ppc_mftocrf=yes |
| 868 | AC_MSG_RESULT([yes]) |
| 869 | ], [ |
| 870 | ac_have_as_ppc_mftocrf=no |
| 871 | AC_MSG_RESULT([no]) |
| 872 | ]) |
| 873 | if test x$ac_have_as_ppc_mftocrf = xyes ; then |
| 874 | AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.]) |
| 875 | fi |
| 876 | |
| 877 | |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 878 | # does the x86/amd64 assembler understand SSE3 instructions? |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 879 | # Note, this doesn't generate a C-level symbol. It generates a |
| 880 | # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 881 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3]) |
| 882 | |
| 883 | AC_TRY_COMPILE(, [ |
| 884 | do { long long int x; |
| 885 | __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); } |
| 886 | while (0) |
| 887 | ], |
| 888 | [ |
| 889 | ac_have_as_sse3=yes |
| 890 | AC_MSG_RESULT([yes]) |
| 891 | ], [ |
| 892 | ac_have_as_sse3=no |
| 893 | AC_MSG_RESULT([no]) |
| 894 | ]) |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 895 | |
| 896 | AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes) |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 897 | |
| 898 | |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 899 | # Ditto for SSSE3 instructions (note extra S) |
| 900 | # Note, this doesn't generate a C-level symbol. It generates a |
| 901 | # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's |
| 902 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3]) |
| 903 | |
| 904 | AC_TRY_COMPILE(, [ |
| 905 | do { long long int x; |
| 906 | __asm__ __volatile__( |
| 907 | "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); } |
| 908 | while (0) |
| 909 | ], |
| 910 | [ |
| 911 | ac_have_as_ssse3=yes |
| 912 | AC_MSG_RESULT([yes]) |
| 913 | ], [ |
| 914 | ac_have_as_ssse3=no |
| 915 | AC_MSG_RESULT([no]) |
| 916 | ]) |
| 917 | |
| 918 | AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes) |
| 919 | |
| 920 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 921 | # Check for TLS support in the compiler and linker |
| 922 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 923 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 924 | [vg_cv_tls=$enableval], |
| 925 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 926 | [[return foo;]])], |
| 927 | [vg_cv_tls=yes], |
| 928 | [vg_cv_tls=no])])]) |
| 929 | |
| 930 | if test "$vg_cv_tls" = yes; then |
| 931 | AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables]) |
| 932 | fi |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 933 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 934 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 935 | # Checks for header files. |
| 936 | AC_HEADER_STDC |
nethercote | 3d260f6 | 2004-10-31 19:39:18 +0000 | [diff] [blame] | 937 | AC_CHECK_HEADERS([sys/endian.h endian.h mqueue.h]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 938 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 939 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 940 | # Checks for typedefs, structures, and compiler characteristics. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 941 | AC_TYPE_UID_T |
| 942 | AC_TYPE_OFF_T |
| 943 | AC_TYPE_SIZE_T |
| 944 | AC_HEADER_TIME |
| 945 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 946 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 947 | # Checks for library functions. |
| 948 | AC_FUNC_MEMCMP |
| 949 | AC_FUNC_MMAP |
| 950 | AC_TYPE_SIGNAL |
| 951 | |
thughes | beb6eb9 | 2004-06-14 12:33:43 +0000 | [diff] [blame] | 952 | AC_CHECK_FUNCS([floor memchr memset mkdir strchr strdup strpbrk strrchr strstr semtimedop]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 953 | |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 954 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 955 | # Do we have a useable MPI setup on the primary and/or secondary targets? |
| 956 | # On Linux, by default, assumes mpicc and -m32/-m64 |
| 957 | # On AIX, by default, assumes mpxlc and -q32/-q64 |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 958 | # Note: this is a kludge in that it assumes the specified mpicc |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 959 | # understands -m32/-m64/-q32/-q64 regardless of what is specified using |
| 960 | # --with-mpicc=. |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 961 | MPI_CC="mpicc" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 962 | if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \ |
| 963 | -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then |
| 964 | MPI_CC="mpxlc" |
| 965 | fi |
| 966 | |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 967 | mflag_primary= |
| 968 | if test x$VG_PLATFORM_PRI = xX86_LINUX \ |
| 969 | -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then |
| 970 | mflag_primary=$FLAG_M32 |
| 971 | elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \ |
| 972 | -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then |
| 973 | mflag_primary=$FLAG_M64 |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 974 | elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then |
| 975 | mflag_primary=-q32 |
| 976 | elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then |
| 977 | mflag_primary=-q64 |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 978 | fi |
| 979 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 980 | mflag_secondary= |
| 981 | if test x$VG_PLATFORM_SEC = xX86_LINUX \ |
| 982 | -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then |
| 983 | mflag_secondary=$FLAG_M32 |
| 984 | elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then |
| 985 | mflag_secondary=-q32 |
| 986 | fi |
| 987 | |
| 988 | |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 989 | AC_ARG_WITH(mpicc, |
sewardj | b70a613 | 2006-05-27 21:14:09 +0000 | [diff] [blame] | 990 | [ --with-mpicc= Specify name of MPI2-ised C compiler], |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 991 | MPI_CC=$withval |
| 992 | ) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 993 | AC_SUBST(MPI_CC) |
| 994 | |
| 995 | ## See if MPI_CC works for the primary target |
| 996 | ## |
| 997 | 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] | 998 | saved_CC=$CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 999 | saved_CFLAGS=$CFLAGS |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1000 | CC=$MPI_CC |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1001 | CFLAGS=$mflag_primary |
sewardj | d3fcc64 | 2006-03-09 02:49:56 +0000 | [diff] [blame] | 1002 | AC_TRY_LINK([ |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 1003 | #include <mpi.h> |
| 1004 | #include <stdio.h> |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1005 | ],[ |
| 1006 | int r = MPI_Init(NULL,NULL); |
| 1007 | r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL ); |
| 1008 | return r; |
| 1009 | ], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1010 | ac_have_mpi2_pri=yes |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 1011 | AC_MSG_RESULT([yes, $MPI_CC]) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1012 | ], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1013 | ac_have_mpi2_pri=no |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1014 | AC_MSG_RESULT([no]) |
| 1015 | ]) |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1016 | CC=$saved_CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1017 | CFLAGS=$saved_CFLAGS |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1018 | AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1019 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1020 | ## See if MPI_CC works for the secondary target. Complication: what if |
| 1021 | ## there is no secondary target? We need this to then fail. |
| 1022 | ## Kludge this by making MPI_CC something which will surely fail in |
| 1023 | ## such a case. |
| 1024 | ## |
| 1025 | AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h]) |
| 1026 | saved_CC=$CC |
| 1027 | saved_CFLAGS=$CFLAGS |
| 1028 | if test x$VG_PLATFORM_SEC = x ; then |
| 1029 | CC="$MPI_CC this will surely fail" |
| 1030 | else |
| 1031 | CC=$MPI_CC |
| 1032 | fi |
| 1033 | CFLAGS=$mflag_secondary |
| 1034 | AC_TRY_LINK([ |
| 1035 | #include <mpi.h> |
| 1036 | #include <stdio.h> |
| 1037 | ],[ |
| 1038 | int r = MPI_Init(NULL,NULL); |
| 1039 | r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL ); |
| 1040 | return r; |
| 1041 | ], [ |
| 1042 | ac_have_mpi2_sec=yes |
| 1043 | AC_MSG_RESULT([yes, $MPI_CC]) |
| 1044 | ], [ |
| 1045 | ac_have_mpi2_sec=no |
| 1046 | AC_MSG_RESULT([no]) |
| 1047 | ]) |
| 1048 | CC=$saved_CC |
| 1049 | CFLAGS=$saved_CFLAGS |
| 1050 | AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1051 | |
| 1052 | |
| 1053 | # -------------------- ok. We're done. -------------------- |
| 1054 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 1055 | AC_OUTPUT( |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1056 | Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1057 | valgrind.spec |
mueller | bddd607 | 2003-11-19 21:50:07 +0000 | [diff] [blame] | 1058 | valgrind.pc |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 1059 | docs/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 1060 | docs/lib/Makefile |
| 1061 | docs/images/Makefile |
njn | f7c00b1 | 2005-07-19 21:46:19 +0000 | [diff] [blame] | 1062 | docs/internals/Makefile |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 1063 | docs/xml/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 1064 | tests/Makefile |
njn | c2e7f48 | 2002-09-27 08:44:17 +0000 | [diff] [blame] | 1065 | tests/vg_regtest |
njn | ec0c27a | 2005-12-10 23:11:28 +0000 | [diff] [blame] | 1066 | perf/Makefile |
| 1067 | perf/vg_perf |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 1068 | include/Makefile |
sewardj | 0f8881b | 2006-10-18 01:16:57 +0000 | [diff] [blame] | 1069 | include/vki/Makefile |
njn | 7a6e746 | 2002-11-09 17:53:30 +0000 | [diff] [blame] | 1070 | auxprogs/Makefile |
njn25 | ab72603 | 2002-09-23 16:24:41 +0000 | [diff] [blame] | 1071 | coregrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1072 | memcheck/Makefile |
| 1073 | memcheck/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1074 | memcheck/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 1075 | memcheck/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 1076 | memcheck/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1077 | memcheck/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1078 | memcheck/docs/Makefile |
| 1079 | cachegrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1080 | cachegrind/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1081 | cachegrind/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 1082 | cachegrind/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 1083 | cachegrind/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1084 | cachegrind/tests/x86/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1085 | cachegrind/docs/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1086 | cachegrind/cg_annotate |
weidendo | a17f2a3 | 2006-03-20 10:27:30 +0000 | [diff] [blame] | 1087 | callgrind/Makefile |
| 1088 | callgrind/callgrind_annotate |
| 1089 | callgrind/callgrind_control |
| 1090 | callgrind/tests/Makefile |
| 1091 | callgrind/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1092 | helgrind/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1093 | helgrind/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 1094 | helgrind/docs/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 1095 | massif/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 1096 | massif/tests/Makefile |
njn | 734b805 | 2007-11-01 04:40:37 +0000 | [diff] [blame] | 1097 | massif/perf/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 1098 | massif/docs/Makefile |
njn | d5a8d24 | 2007-11-02 20:44:57 +0000 | [diff] [blame] | 1099 | massif/ms_print |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1100 | lackey/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1101 | lackey/tests/Makefile |
njn | 83157fc | 2002-10-03 10:07:34 +0000 | [diff] [blame] | 1102 | lackey/docs/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1103 | none/Makefile |
| 1104 | none/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1105 | none/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 1106 | none/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 1107 | none/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1108 | none/tests/x86/Makefile |
njn | 9bc8c00 | 2002-10-02 13:49:13 +0000 | [diff] [blame] | 1109 | none/docs/Makefile |
sewardj | 99a2ceb | 2007-11-09 12:30:36 +0000 | [diff] [blame] | 1110 | exp-omega/Makefile |
| 1111 | exp-omega/tests/Makefile |
| 1112 | exp-omega/docs/Makefile |
sewardj | bbec772 | 2007-11-25 14:08:53 +0000 | [diff] [blame] | 1113 | exp-drd/Makefile |
| 1114 | exp-drd/docs/Makefile |
| 1115 | exp-drd/tests/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1116 | ) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 1117 | |
| 1118 | cat<<EOF |
| 1119 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1120 | Primary build target: ${VG_PLATFORM_PRI} |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1121 | Secondary build target: ${VG_PLATFORM_SEC} |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1122 | Default supp files: ${DEFAULT_SUPP} |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 1123 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 1124 | EOF |
| 1125 | |
| 1126 | cat<<EOF > default.supp |
| 1127 | # This is a generated file, composed of the following suppression rules: |
| 1128 | # |
| 1129 | # ${DEFAULT_SUPP} |
| 1130 | # |
| 1131 | |
| 1132 | EOF |
| 1133 | |
| 1134 | for file in ${DEFAULT_SUPP} ; do |
| 1135 | cat ${srcdir}/$file >> default.supp |
| 1136 | done |