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