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