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