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 | 45a1fd0 | 2010-10-15 08:52:43 +0000 | [diff] [blame] | 11 | AC_INIT(Valgrind, 3.7.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 | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 19 | # Checks for various programs. |
| 20 | #---------------------------------------------------------------------------- |
bart | aca399a | 2010-08-15 18:54:15 +0000 | [diff] [blame] | 21 | CFLAGS="-Wno-long-long $CFLAGS" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 22 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 23 | AC_PROG_LN_S |
| 24 | AC_PROG_CC |
bart | 0affa49 | 2008-03-18 17:53:09 +0000 | [diff] [blame] | 25 | AM_PROG_CC_C_O |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 26 | AC_PROG_CPP |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 27 | AC_PROG_CXX |
njn | 629a5ec | 2009-07-14 01:29:39 +0000 | [diff] [blame] | 28 | # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with |
| 29 | # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code |
| 30 | # base (eg. most likely as Darwin-specific tests) we'll need one of the |
| 31 | # following: |
njn | 0cd2689 | 2009-07-12 23:07:13 +0000 | [diff] [blame] | 32 | # - put AC_PROG_OBJC in a Darwin-specific part of this file |
| 33 | # - Use AC_PROG_OBJC here and up the minimum autoconf version |
| 34 | # - Use the following, which is apparently equivalent: |
| 35 | # m4_ifdef([AC_PROG_OBJC], |
| 36 | # [AC_PROG_OBJC], |
| 37 | # [AC_CHECK_TOOL([OBJC], [gcc]) |
| 38 | # AC_SUBST([OBJC]) |
| 39 | # AC_SUBST([OBJCFLAGS]) |
| 40 | # ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 41 | AC_PROG_RANLIB |
bart | 07de2c9 | 2010-05-29 06:44:28 +0000 | [diff] [blame] | 42 | # provide a very basic definition for AC_PROG_SED if it's not provided by |
| 43 | # autoconf (as e.g. in autoconf 2.59). |
| 44 | m4_ifndef([AC_PROG_SED], |
| 45 | [AC_DEFUN([AC_PROG_SED], |
| 46 | [AC_ARG_VAR([SED]) |
| 47 | AC_CHECK_PROGS([SED],[gsed sed])])]) |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 48 | AC_PROG_SED |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 49 | |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 50 | # If no AR variable was specified, look up the name of the archiver. Otherwise |
| 51 | # do not touch the AR variable. |
| 52 | if test "x$AR" = "x"; then |
bart | 07de2c9 | 2010-05-29 06:44:28 +0000 | [diff] [blame] | 53 | AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar]) |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 54 | fi |
| 55 | AC_ARG_VAR([AR],[Archiver command]) |
| 56 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 57 | # Check for the compiler support |
| 58 | if test "${GCC}" != "yes" ; then |
| 59 | AC_MSG_ERROR([Valgrind relies on GCC to be compiled]) |
| 60 | fi |
| 61 | |
sewardj | 2f68595 | 2002-12-22 19:32:23 +0000 | [diff] [blame] | 62 | # figure out where perl lives |
| 63 | AC_PATH_PROG(PERL, perl) |
| 64 | |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 65 | # figure out where gdb lives |
sewardj | f8722ca | 2008-11-17 00:20:45 +0000 | [diff] [blame] | 66 | AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time") |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 67 | AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB]) |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 68 | |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 69 | # some older automake's don't have it so try something on our own |
| 70 | ifdef([AM_PROG_AS],[AM_PROG_AS], |
| 71 | [ |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 72 | AS="${CC}" |
| 73 | AC_SUBST(AS) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 74 | |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 75 | ASFLAGS="" |
| 76 | AC_SUBST(ASFLAGS) |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 77 | ]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 78 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 79 | |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 80 | # Check if 'diff' supports -u (universal diffs) and use it if possible. |
| 81 | |
| 82 | AC_MSG_CHECKING([for diff -u]) |
| 83 | AC_SUBST(DIFF) |
| 84 | |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 85 | # Comparing two identical files results in 0. |
njn | 31f665e | 2009-02-26 21:25:50 +0000 | [diff] [blame] | 86 | tmpfile="tmp-xxx-yyy-zzz" |
| 87 | touch $tmpfile; |
| 88 | if diff -u $tmpfile $tmpfile ; then |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 89 | AC_MSG_RESULT([yes]) |
| 90 | DIFF="diff -u" |
| 91 | else |
| 92 | AC_MSG_RESULT([no]) |
| 93 | DIFF="diff" |
| 94 | fi |
njn | 31f665e | 2009-02-26 21:25:50 +0000 | [diff] [blame] | 95 | rm $tmpfile |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 96 | |
| 97 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 98 | # We don't want gcc < 3.0 |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 99 | AC_MSG_CHECKING([for a supported version of gcc]) |
| 100 | |
bart | 07de2c9 | 2010-05-29 06:44:28 +0000 | [diff] [blame] | 101 | [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] | 102 | |
| 103 | case "${gcc_version}" in |
bart | 76719bf | 2008-04-19 07:47:56 +0000 | [diff] [blame] | 104 | 2.*) |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 105 | AC_MSG_RESULT([no (${gcc_version})]) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 106 | AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc]) |
| 107 | ;; |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 108 | *) |
| 109 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 110 | ;; |
| 111 | esac |
| 112 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 113 | #---------------------------------------------------------------------------- |
| 114 | # Arch/OS/platform tests. |
| 115 | #---------------------------------------------------------------------------- |
| 116 | # We create a number of arch/OS/platform-related variables. We prefix them |
| 117 | # all with "VGCONF_" which indicates that they are defined at |
| 118 | # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_* |
| 119 | # variables used when compiling C files. |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 120 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 121 | AC_CANONICAL_HOST |
| 122 | |
| 123 | AC_MSG_CHECKING([for a supported CPU]) |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 124 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 125 | # ARCH_MAX reflects the most that this CPU can do: for example if it |
| 126 | # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32. |
| 127 | # Ditto for amd64. It is used for more configuration below, but is not used |
| 128 | # outside this file. |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 129 | case "${host_cpu}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 130 | i?86) |
| 131 | AC_MSG_RESULT([ok (${host_cpu})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 132 | ARCH_MAX="x86" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 133 | ;; |
| 134 | |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 135 | x86_64) |
| 136 | AC_MSG_RESULT([ok (${host_cpu})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 137 | ARCH_MAX="amd64" |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 138 | ;; |
| 139 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 140 | powerpc64) |
| 141 | AC_MSG_RESULT([ok (${host_cpu})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 142 | ARCH_MAX="ppc64" |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 143 | ;; |
| 144 | |
| 145 | powerpc) |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 146 | # On Linux this means only a 32-bit capable CPU. |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 147 | AC_MSG_RESULT([ok (${host_cpu})]) |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 148 | ARCH_MAX="ppc32" |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 149 | ;; |
| 150 | |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 151 | s390x) |
| 152 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 153 | ARCH_MAX="s390x" |
| 154 | ;; |
| 155 | |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 156 | armv7*) |
| 157 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 158 | ARCH_MAX="arm" |
| 159 | ;; |
| 160 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 161 | *) |
| 162 | AC_MSG_RESULT([no (${host_cpu})]) |
nethercote | 81d5c66 | 2004-10-13 13:18:51 +0000 | [diff] [blame] | 163 | AC_MSG_ERROR([Unsupported host architecture. Sorry]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 164 | ;; |
| 165 | esac |
| 166 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 167 | #---------------------------------------------------------------------------- |
| 168 | |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 169 | # Sometimes it's convenient to subvert the bi-arch build system and |
| 170 | # just have a single build even though the underlying platform is |
| 171 | # capable of both. Hence handle --enable-only64bit and |
| 172 | # --enable-only32bit. Complain if both are issued :-) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 173 | # [Actually, if either of these options are used, I think both get built, |
| 174 | # but only one gets installed. So if you use an in-place build, both can be |
| 175 | # used. --njn] |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 176 | |
| 177 | # Check if a 64-bit only build has been requested |
| 178 | AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit, |
| 179 | [AC_ARG_ENABLE(only64bit, |
| 180 | [ --enable-only64bit do a 64-bit only build], |
| 181 | [vg_cv_only64bit=$enableval], |
| 182 | [vg_cv_only64bit=no])]) |
| 183 | |
| 184 | # Check if a 32-bit only build has been requested |
| 185 | AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit, |
| 186 | [AC_ARG_ENABLE(only32bit, |
| 187 | [ --enable-only32bit do a 32-bit only build], |
| 188 | [vg_cv_only32bit=$enableval], |
| 189 | [vg_cv_only32bit=no])]) |
| 190 | |
| 191 | # Stay sane |
| 192 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 193 | AC_MSG_ERROR( |
| 194 | [Nonsensical: both --enable-only64bit and --enable-only32bit.]) |
| 195 | fi |
| 196 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 197 | #---------------------------------------------------------------------------- |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 198 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 199 | # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to |
| 200 | # compilation of many C files via -VGO_$(VGCONF_OS) and |
| 201 | # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS). |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 202 | AC_MSG_CHECKING([for a supported OS]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 203 | AC_SUBST(VGCONF_OS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 204 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 205 | DEFAULT_SUPP="" |
| 206 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 207 | case "${host_os}" in |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 208 | *linux*) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 209 | AC_MSG_RESULT([ok (${host_os})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 210 | VGCONF_OS="linux" |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 211 | |
| 212 | # Ok, this is linux. Check the kernel version |
| 213 | AC_MSG_CHECKING([for the kernel version]) |
| 214 | |
| 215 | kernel=`uname -r` |
| 216 | |
| 217 | case "${kernel}" in |
bart | 0419e51 | 2011-06-05 08:51:47 +0000 | [diff] [blame] | 218 | 2.6.*|3.*) |
bart | 2d6e6e7 | 2011-06-05 10:01:48 +0000 | [diff] [blame] | 219 | AC_MSG_RESULT([2.6.x/3.x family (${kernel})]) |
| 220 | AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x or Linux 3.x]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 221 | ;; |
| 222 | |
| 223 | 2.4.*) |
| 224 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 225 | AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) |
| 226 | ;; |
| 227 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 228 | *) |
| 229 | AC_MSG_RESULT([unsupported (${kernel})]) |
nethercote | 4fa681f | 2004-11-08 17:51:39 +0000 | [diff] [blame] | 230 | AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 231 | ;; |
| 232 | esac |
| 233 | |
| 234 | ;; |
| 235 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 236 | *darwin*) |
| 237 | AC_MSG_RESULT([ok (${host_os})]) |
| 238 | VGCONF_OS="darwin" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 239 | AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5]) |
| 240 | AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6]) |
| 241 | AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 242 | |
| 243 | AC_MSG_CHECKING([for the kernel version]) |
| 244 | kernel=`uname -r` |
| 245 | |
| 246 | # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin |
| 247 | # has only one relevant version, the OS version. The `uname` check |
| 248 | # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 249 | # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard), |
| 250 | # and we don't know of an macros similar to __GLIBC__ to get that info. |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 251 | # |
| 252 | # XXX: `uname -r` won't do the right thing for cross-compiles, but |
| 253 | # that's not a problem yet. |
| 254 | case "${kernel}" in |
| 255 | 9.*) |
| 256 | AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard]) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 257 | AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 258 | DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}" |
bart | 6ccda14 | 2009-07-23 07:37:32 +0000 | [diff] [blame] | 259 | DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 260 | ;; |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 261 | 10.*) |
| 262 | AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard]) |
| 263 | AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version]) |
| 264 | DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}" |
| 265 | DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" |
| 266 | ;; |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 267 | *) |
| 268 | AC_MSG_RESULT([unsupported (${kernel})]) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 269 | AC_MSG_ERROR([Valgrind works on Darwin 9.x and 10.x (Mac OS X 10.5 and 10.6)]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 270 | ;; |
| 271 | esac |
| 272 | ;; |
| 273 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 274 | *) |
| 275 | AC_MSG_RESULT([no (${host_os})]) |
njn | cc58cea | 2010-07-05 07:21:22 +0000 | [diff] [blame] | 276 | AC_MSG_ERROR([Valgrind is operating system specific. Sorry.]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 277 | ;; |
| 278 | esac |
| 279 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 280 | #---------------------------------------------------------------------------- |
| 281 | |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 282 | # If we are building on a 64 bit platform test to see if the system |
| 283 | # supports building 32 bit programs and disable 32 bit support if it |
| 284 | # does not support building 32 bit programs |
| 285 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 286 | case "$ARCH_MAX-$VGCONF_OS" in |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 287 | amd64-linux|ppc64-linux) |
| 288 | AC_MSG_CHECKING([for 32 bit build support]) |
| 289 | safe_CFLAGS=$CFLAGS |
| 290 | CFLAGS="-m32" |
| 291 | AC_TRY_LINK(, [ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 292 | return 0; |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 293 | ], |
| 294 | [ |
| 295 | AC_MSG_RESULT([yes]) |
| 296 | ], [ |
| 297 | vg_cv_only64bit="yes" |
| 298 | AC_MSG_RESULT([no]) |
| 299 | ]) |
| 300 | CFLAGS=$safe_CFLAGS;; |
| 301 | esac |
| 302 | |
| 303 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 304 | AC_MSG_ERROR( |
| 305 | [--enable-only32bit was specified but system does not support 32 bit builds]) |
| 306 | fi |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 307 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 308 | #---------------------------------------------------------------------------- |
| 309 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 310 | # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By |
| 311 | # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64 |
| 312 | # machine, but --enable-only32bit has been requested, then ARCH_MAX (see |
| 313 | # above) will be "amd64" since that reflects the most that this cpu can do, |
| 314 | # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the |
| 315 | # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 316 | # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and |
| 317 | # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS). |
| 318 | AC_SUBST(VGCONF_ARCH_PRI) |
| 319 | |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 320 | # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86". |
| 321 | # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC) |
| 322 | # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target. |
| 323 | # It is empty if there is no secondary target. |
| 324 | AC_SUBST(VGCONF_ARCH_SEC) |
| 325 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 326 | # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX". |
| 327 | # The entire system, including regression and performance tests, will be |
| 328 | # built for this target. The "_CAPS" indicates that the name is in capital |
| 329 | # letters, and it also uses '_' rather than '-' as a separator, because it's |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 330 | # used to create various Makefile variables, which are all in caps by |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 331 | # convention and cannot contain '-' characters. This is in contrast to |
| 332 | # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 333 | AC_SUBST(VGCONF_PLATFORM_PRI_CAPS) |
| 334 | |
| 335 | # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one. |
| 336 | # Valgrind and tools will also be built for this target, but not the |
| 337 | # regression or performance tests. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 338 | # |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 339 | # By default, the primary arch is the same as the "max" arch, as commented |
| 340 | # above (at the definition of ARCH_MAX). We may choose to downgrade it in |
| 341 | # the big case statement just below here, in the case where we're building |
| 342 | # on a 64 bit machine but have been requested only to do a 32 bit build. |
| 343 | AC_SUBST(VGCONF_PLATFORM_SEC_CAPS) |
| 344 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 345 | AC_MSG_CHECKING([for a supported CPU/OS combination]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 346 | |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 347 | # NB. The load address for a given platform may be specified in more |
| 348 | # than one place, in some cases, depending on whether we're doing a biarch, |
| 349 | # 32-bit only or 64-bit only build. eg see case for amd64-linux below. |
| 350 | # Be careful to give consistent values in all subcases. Also, all four |
| 351 | # valt_load_addres_{pri,sec}_{norml,inner} values must always be set, |
| 352 | # even if it is to "0xUNSET". |
| 353 | # |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 354 | case "$ARCH_MAX-$VGCONF_OS" in |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 355 | x86-linux) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 356 | VGCONF_ARCH_PRI="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 357 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 358 | VGCONF_PLATFORM_PRI_CAPS="X86_LINUX" |
| 359 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 360 | valt_load_address_pri_norml="0x38000000" |
| 361 | valt_load_address_pri_inner="0x28000000" |
| 362 | valt_load_address_sec_norml="0xUNSET" |
| 363 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 364 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 365 | ;; |
| 366 | amd64-linux) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 367 | valt_load_address_sec_norml="0xUNSET" |
| 368 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 369 | if test x$vg_cv_only64bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 370 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 371 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 372 | VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX" |
| 373 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 374 | valt_load_address_pri_norml="0x38000000" |
| 375 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +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="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 378 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 379 | VGCONF_PLATFORM_PRI_CAPS="X86_LINUX" |
| 380 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 381 | valt_load_address_pri_norml="0x38000000" |
| 382 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 383 | else |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 384 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 385 | VGCONF_ARCH_SEC="x86" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 386 | VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX" |
| 387 | VGCONF_PLATFORM_SEC_CAPS="X86_LINUX" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 388 | valt_load_address_pri_norml="0x38000000" |
| 389 | valt_load_address_pri_inner="0x28000000" |
| 390 | valt_load_address_sec_norml="0x38000000" |
| 391 | valt_load_address_sec_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 392 | fi |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 393 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 394 | ;; |
| 395 | ppc32-linux) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 396 | VGCONF_ARCH_PRI="ppc32" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 397 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 398 | VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX" |
| 399 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 400 | valt_load_address_pri_norml="0x38000000" |
| 401 | valt_load_address_pri_inner="0x28000000" |
| 402 | valt_load_address_sec_norml="0xUNSET" |
| 403 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 404 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 405 | ;; |
| 406 | ppc64-linux) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 407 | valt_load_address_sec_norml="0xUNSET" |
| 408 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 409 | if test x$vg_cv_only64bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 410 | VGCONF_ARCH_PRI="ppc64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 411 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 412 | VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX" |
| 413 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 414 | valt_load_address_pri_norml="0x38000000" |
| 415 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 416 | elif test x$vg_cv_only32bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 417 | VGCONF_ARCH_PRI="ppc32" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 418 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 419 | VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX" |
| 420 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 421 | valt_load_address_pri_norml="0x38000000" |
| 422 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 423 | else |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 424 | VGCONF_ARCH_PRI="ppc64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 425 | VGCONF_ARCH_SEC="ppc32" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 426 | VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX" |
| 427 | VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 428 | valt_load_address_pri_norml="0x38000000" |
| 429 | valt_load_address_pri_inner="0x28000000" |
| 430 | valt_load_address_sec_norml="0x38000000" |
| 431 | valt_load_address_sec_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 432 | fi |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 433 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 434 | ;; |
njn | cc58cea | 2010-07-05 07:21:22 +0000 | [diff] [blame] | 435 | # Darwin gets identified as 32-bit even when it supports 64-bit. |
| 436 | # (Not sure why, possibly because 'uname' returns "i386"?) Just about |
| 437 | # all Macs support both 32-bit and 64-bit, so we just build both. If |
| 438 | # someone has a really old 32-bit only machine they can (hopefully?) |
| 439 | # build with --enable-only32bit. See bug 243362. |
| 440 | x86-darwin|amd64-darwin) |
| 441 | ARCH_MAX="amd64" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 442 | valt_load_address_sec_norml="0xUNSET" |
| 443 | valt_load_address_sec_inner="0xUNSET" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 444 | if test x$vg_cv_only64bit = xyes; then |
| 445 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 446 | VGCONF_ARCH_SEC="" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 447 | VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN" |
| 448 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 449 | valt_load_address_pri_norml="0x138000000" |
| 450 | valt_load_address_pri_inner="0x128000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 451 | elif test x$vg_cv_only32bit = xyes; then |
| 452 | VGCONF_ARCH_PRI="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 453 | VGCONF_ARCH_SEC="" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 454 | VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN" |
| 455 | VGCONF_PLATFORM_SEC_CAPS="" |
| 456 | VGCONF_ARCH_PRI_CAPS="x86" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 457 | valt_load_address_pri_norml="0x38000000" |
| 458 | valt_load_address_pri_inner="0x28000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 459 | else |
| 460 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 461 | VGCONF_ARCH_SEC="x86" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 462 | VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN" |
| 463 | VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 464 | valt_load_address_pri_norml="0x138000000" |
| 465 | valt_load_address_pri_inner="0x128000000" |
| 466 | valt_load_address_sec_norml="0x38000000" |
| 467 | valt_load_address_sec_inner="0x28000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 468 | fi |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 469 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
| 470 | ;; |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 471 | arm-linux) |
| 472 | VGCONF_ARCH_PRI="arm" |
| 473 | VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX" |
| 474 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 475 | valt_load_address_pri_norml="0x38000000" |
| 476 | valt_load_address_pri_inner="0x28000000" |
| 477 | valt_load_address_sec_norml="0xUNSET" |
| 478 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 479 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 480 | ;; |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 481 | s390x-linux) |
| 482 | VGCONF_ARCH_PRI="s390x" |
| 483 | VGCONF_ARCH_SEC="" |
| 484 | VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX" |
| 485 | VGCONF_PLATFORM_SEC_CAPS="" |
| 486 | # we want to have the generated code close to the dispatcher |
| 487 | valt_load_address_pri_norml="0x401000000" |
| 488 | valt_load_address_pri_inner="0x410000000" |
| 489 | valt_load_address_sec_norml="0xUNSET" |
| 490 | valt_load_address_sec_inner="0xUNSET" |
| 491 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
| 492 | ;; |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 493 | *) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 494 | VGCONF_ARCH_PRI="unknown" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 495 | VGCONF_ARCH_SEC="unknown" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 496 | VGCONF_PLATFORM_PRI_CAPS="UNKNOWN" |
| 497 | VGCONF_PLATFORM_SEC_CAPS="UNKNOWN" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 498 | valt_load_address_pri_norml="0xUNSET" |
| 499 | valt_load_address_pri_inner="0xUNSET" |
| 500 | valt_load_address_sec_norml="0xUNSET" |
| 501 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 502 | AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 503 | AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 504 | ;; |
| 505 | esac |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 506 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 507 | #---------------------------------------------------------------------------- |
njn | a454ec0 | 2009-01-19 03:16:59 +0000 | [diff] [blame] | 508 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 509 | # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become |
| 510 | # defined. |
| 511 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86, |
| 512 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 513 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \ |
| 514 | -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 515 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 516 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64, |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 517 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
| 518 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 519 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32, |
| 520 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 521 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 522 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64, |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 523 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ) |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 524 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM, |
| 525 | test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ) |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 526 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X, |
| 527 | test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 528 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 529 | # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these |
| 530 | # become defined. |
| 531 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX, |
| 532 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
| 533 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX) |
| 534 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX, |
| 535 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX) |
| 536 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX, |
| 537 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
| 538 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX) |
| 539 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX, |
| 540 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX) |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 541 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX, |
| 542 | test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX) |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 543 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX, |
| 544 | test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \ |
| 545 | -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 546 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 547 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN, |
| 548 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 549 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN) |
| 550 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN, |
| 551 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN) |
| 552 | |
| 553 | |
sewardj | 72a2d80 | 2010-07-29 05:24:20 +0000 | [diff] [blame] | 554 | # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined. |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 555 | # Relies on the assumption that the primary and secondary targets are |
| 556 | # for the same OS, so therefore only necessary to test the primary. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 557 | AM_CONDITIONAL(VGCONF_OS_IS_LINUX, |
| 558 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
| 559 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
| 560 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 561 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \ |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 562 | -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ |
| 563 | -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 564 | AM_CONDITIONAL(VGCONF_OS_IS_DARWIN, |
| 565 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 566 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 567 | |
| 568 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 569 | # Sometimes, in the Makefile.am files, it's useful to know whether or not |
| 570 | # there is a secondary target. |
njn | ee0c66a | 2009-06-01 23:59:20 +0000 | [diff] [blame] | 571 | AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC, |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 572 | test x$VGCONF_PLATFORM_SEC_CAPS != x) |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 573 | |
tom | b637bad | 2005-11-08 12:28:35 +0000 | [diff] [blame] | 574 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 575 | #---------------------------------------------------------------------------- |
| 576 | # Inner Valgrind? |
| 577 | #---------------------------------------------------------------------------- |
| 578 | |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 579 | # Check if this should be built as an inner Valgrind, to be run within |
| 580 | # another Valgrind. Choose the load address accordingly. |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 581 | AC_SUBST(VALT_LOAD_ADDRESS_PRI) |
| 582 | AC_SUBST(VALT_LOAD_ADDRESS_SEC) |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 583 | AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner, |
| 584 | [AC_ARG_ENABLE(inner, |
| 585 | [ --enable-inner enables self-hosting], |
| 586 | [vg_cv_inner=$enableval], |
| 587 | [vg_cv_inner=no])]) |
| 588 | if test "$vg_cv_inner" = yes; then |
| 589 | AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind]) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 590 | VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner |
| 591 | VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 592 | else |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 593 | VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml |
| 594 | VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 595 | fi |
| 596 | |
| 597 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 598 | #---------------------------------------------------------------------------- |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 599 | # Extra fine-tuning of installation directories |
| 600 | #---------------------------------------------------------------------------- |
| 601 | AC_ARG_WITH(tmpdir, |
| 602 | [ --with-tmpdir=PATH Specify path for temporary files], |
| 603 | tmpdir="$withval", |
| 604 | tmpdir="/tmp") |
| 605 | AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory]) |
| 606 | |
sewardj | 0ba37c9 | 2011-07-12 11:46:24 +0000 | [diff] [blame] | 607 | |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 608 | #---------------------------------------------------------------------------- |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 609 | # Libc and suppressions |
| 610 | #---------------------------------------------------------------------------- |
| 611 | # This variable will collect the suppression files to be used. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 612 | AC_SUBST(DEFAULT_SUPP) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 613 | |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 614 | AC_CHECK_HEADER([features.h]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 615 | |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 616 | if test x$ac_cv_header_features_h = xyes; then |
| 617 | rm -f conftest.$ac_ext |
| 618 | cat <<_ACEOF >conftest.$ac_ext |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 619 | #include <features.h> |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 620 | #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) |
| 621 | glibc version is: __GLIBC__ __GLIBC_MINOR__ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 622 | #endif |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 623 | _ACEOF |
| 624 | GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`" |
| 625 | fi |
bart | b7c3f08 | 2010-05-13 06:32:36 +0000 | [diff] [blame] | 626 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 627 | # not really a version check |
| 628 | AC_EGREP_CPP([DARWIN_LIBC], [ |
| 629 | #include <sys/cdefs.h> |
| 630 | #if defined(__DARWIN_VERS_1050) |
| 631 | DARWIN_LIBC |
| 632 | #endif |
| 633 | ], |
| 634 | GLIBC_VERSION="darwin") |
| 635 | |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 636 | # not really a version check |
| 637 | AC_EGREP_CPP([BIONIC_LIBC], [ |
| 638 | #if defined(__ANDROID__) |
| 639 | BIONIC_LIBC |
| 640 | #endif |
| 641 | ], |
| 642 | GLIBC_VERSION="bionic") |
| 643 | |
| 644 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 645 | AC_MSG_CHECKING([the GLIBC_VERSION version]) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 646 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 647 | case "${GLIBC_VERSION}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 648 | 2.2) |
| 649 | AC_MSG_RESULT(2.2 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 650 | 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] | 651 | DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}" |
| 652 | DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 653 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 654 | ;; |
| 655 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 656 | 2.3) |
| 657 | AC_MSG_RESULT(2.3 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 658 | 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] | 659 | DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 660 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 661 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 662 | ;; |
| 663 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 664 | 2.4) |
| 665 | AC_MSG_RESULT(2.4 family) |
| 666 | 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] | 667 | DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 668 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 669 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 670 | ;; |
| 671 | |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 672 | 2.5) |
| 673 | AC_MSG_RESULT(2.5 family) |
| 674 | 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] | 675 | DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 676 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 677 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 678 | ;; |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 679 | 2.6) |
| 680 | AC_MSG_RESULT(2.6 family) |
| 681 | 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] | 682 | DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 683 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 684 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 685 | ;; |
| 686 | 2.7) |
| 687 | AC_MSG_RESULT(2.7 family) |
| 688 | 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] | 689 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 690 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 691 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 692 | ;; |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 693 | 2.8) |
| 694 | AC_MSG_RESULT(2.8 family) |
dirk | eb939fc | 2008-04-27 20:38:47 +0000 | [diff] [blame] | 695 | 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] | 696 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 697 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 698 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 699 | ;; |
dirk | d2e31eb | 2008-11-19 23:58:36 +0000 | [diff] [blame] | 700 | 2.9) |
| 701 | AC_MSG_RESULT(2.9 family) |
| 702 | AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x]) |
| 703 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 704 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 705 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 706 | ;; |
sewardj | 5d425e8 | 2009-02-01 19:01:11 +0000 | [diff] [blame] | 707 | 2.10) |
| 708 | AC_MSG_RESULT(2.10 family) |
| 709 | AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x]) |
| 710 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 711 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 712 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 713 | ;; |
bart | 0fac7ff | 2009-11-15 19:11:19 +0000 | [diff] [blame] | 714 | 2.11) |
| 715 | AC_MSG_RESULT(2.11 family) |
| 716 | AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x]) |
| 717 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 718 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 719 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
bart | b7c3f08 | 2010-05-13 06:32:36 +0000 | [diff] [blame] | 720 | ;; |
| 721 | 2.12) |
| 722 | AC_MSG_RESULT(2.12 family) |
| 723 | AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x]) |
| 724 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 725 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 726 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
bart | 0fac7ff | 2009-11-15 19:11:19 +0000 | [diff] [blame] | 727 | ;; |
tom | ebd619b | 2011-02-10 09:09:09 +0000 | [diff] [blame] | 728 | 2.13) |
| 729 | AC_MSG_RESULT(2.13 family) |
| 730 | AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x]) |
| 731 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 732 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 733 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 734 | ;; |
tom | cc07741 | 2011-06-07 21:52:26 +0000 | [diff] [blame] | 735 | 2.14) |
| 736 | AC_MSG_RESULT(2.14 family) |
| 737 | AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x]) |
| 738 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 739 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 740 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 741 | ;; |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 742 | darwin) |
| 743 | AC_MSG_RESULT(Darwin) |
| 744 | AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin]) |
| 745 | # DEFAULT_SUPP set by kernel version check above. |
| 746 | ;; |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 747 | bionic) |
| 748 | AC_MSG_RESULT(Bionic) |
| 749 | AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic]) |
| 750 | DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}" |
| 751 | ;; |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 752 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 753 | *) |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 754 | AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}]) |
tom | cc07741 | 2011-06-07 21:52:26 +0000 | [diff] [blame] | 755 | AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.14]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 756 | AC_MSG_ERROR([or Darwin libc]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 757 | ;; |
| 758 | esac |
| 759 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 760 | AC_SUBST(GLIBC_VERSION) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 761 | |
sewardj | 414f358 | 2008-07-18 20:46:00 +0000 | [diff] [blame] | 762 | |
| 763 | # Add default suppressions for the X client libraries. Make no |
| 764 | # attempt to detect whether such libraries are installed on the |
| 765 | # build machine (or even if any X facilities are present); just |
| 766 | # add the suppressions antidisirregardless. |
| 767 | DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}" |
| 768 | DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 769 | |
sewardj | d2f95a0 | 2011-05-11 16:04:28 +0000 | [diff] [blame] | 770 | # Add glibc and X11 suppressions for exp-sgcheck |
| 771 | DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}" |
sewardj | 5744c02 | 2008-10-19 18:58:13 +0000 | [diff] [blame] | 772 | |
sewardj | 2e10a68 | 2003-04-07 19:36:41 +0000 | [diff] [blame] | 773 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 774 | #---------------------------------------------------------------------------- |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 775 | # Platform variants? |
| 776 | #---------------------------------------------------------------------------- |
| 777 | |
| 778 | # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough. |
| 779 | # But there are times where we need a bit more control. The motivating |
| 780 | # and currently only case is Android: this is almost identical to arm-linux, |
| 781 | # but not quite. So this introduces the concept of platform variant tags, |
| 782 | # which get passed in the compile as -DVGPV_<arch>_<os>_<variant> along |
| 783 | # with the main -DVGP_<arch>_<os> definition. |
| 784 | # |
| 785 | # In almost all cases, the <variant> bit is "vanilla". But for Android |
| 786 | # it is "android" instead. |
| 787 | # |
| 788 | # Consequently (eg), plain arm-linux would build with |
| 789 | # |
| 790 | # -DVGP_arm_linux -DVGPV_arm_linux_vanilla |
| 791 | # |
| 792 | # whilst an Android build would have |
| 793 | # |
| 794 | # -DVGP_arm_linux -DVGPV_arm_linux_android |
| 795 | # |
| 796 | # The setup of the platform variant is pushed relatively far down this |
| 797 | # file in order that we can inspect any of the variables set above. |
| 798 | |
| 799 | # In the normal case .. |
| 800 | VGCONF_PLATVARIANT="vanilla" |
| 801 | |
| 802 | # Android on ARM ? |
| 803 | if test "$VGCONF_ARCH_PRI-$VGCONF_OS" = "arm-linux" \ |
| 804 | -a "$GLIBC_VERSION" = "bionic"; |
| 805 | then |
| 806 | VGCONF_PLATVARIANT="android" |
| 807 | fi |
| 808 | |
| 809 | AC_SUBST(VGCONF_PLATVARIANT) |
| 810 | |
| 811 | |
| 812 | # FIXME: do we also want to define automake variables |
| 813 | # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently) |
| 814 | # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE, |
| 815 | # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough |
| 816 | # do that. Problem is that we can't do and-ing in Makefile.am's, but |
| 817 | # that's what we'd need to do to use this, since what we'd want to write |
| 818 | # is something like |
| 819 | # |
| 820 | # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID |
| 821 | # |
sewardj | 0ba37c9 | 2011-07-12 11:46:24 +0000 | [diff] [blame] | 822 | # Hmm. Can't think of a nice clean solution to this. |
| 823 | |
| 824 | AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA, |
| 825 | test x$VGCONF_PLATVARIANT = xvanilla) |
| 826 | AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID, |
| 827 | test x$VGCONF_PLATVARIANT = xandroid) |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 828 | |
| 829 | |
| 830 | #---------------------------------------------------------------------------- |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 831 | # Checking for various library functions and other definitions |
| 832 | #---------------------------------------------------------------------------- |
| 833 | |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 834 | # Check for CLOCK_MONOTONIC |
| 835 | |
| 836 | AC_MSG_CHECKING([for CLOCK_MONOTONIC]) |
| 837 | |
| 838 | AC_TRY_COMPILE( |
| 839 | [ |
| 840 | #include <time.h> |
| 841 | ], [ |
| 842 | struct timespec t; |
| 843 | clock_gettime(CLOCK_MONOTONIC, &t); |
| 844 | return 0; |
| 845 | ], |
| 846 | [ |
| 847 | AC_MSG_RESULT([yes]) |
| 848 | AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1, |
| 849 | [Define to 1 if you have the `CLOCK_MONOTONIC' constant.]) |
| 850 | ], [ |
| 851 | AC_MSG_RESULT([no]) |
| 852 | ]) |
| 853 | |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 854 | |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 855 | # Check for PTHREAD_RWLOCK_T |
| 856 | |
| 857 | AC_MSG_CHECKING([for pthread_rwlock_t]) |
| 858 | |
| 859 | AC_TRY_COMPILE( |
| 860 | [ |
| 861 | #define _GNU_SOURCE |
| 862 | #include <pthread.h> |
| 863 | ], [ |
| 864 | pthread_rwlock_t rwl; |
| 865 | ], |
| 866 | [ |
| 867 | AC_MSG_RESULT([yes]) |
| 868 | AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1, |
| 869 | [Define to 1 if you have the `pthread_rwlock_t' type.]) |
| 870 | ], [ |
| 871 | AC_MSG_RESULT([no]) |
| 872 | ]) |
| 873 | |
| 874 | |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 875 | # Check for PTHREAD_MUTEX_ADAPTIVE_NP |
| 876 | |
| 877 | AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP]) |
| 878 | |
| 879 | AC_TRY_COMPILE( |
| 880 | [ |
| 881 | #define _GNU_SOURCE |
| 882 | #include <pthread.h> |
| 883 | ], [ |
| 884 | return (PTHREAD_MUTEX_ADAPTIVE_NP); |
| 885 | ], |
| 886 | [ |
| 887 | AC_MSG_RESULT([yes]) |
| 888 | AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1, |
| 889 | [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.]) |
| 890 | ], [ |
| 891 | AC_MSG_RESULT([no]) |
| 892 | ]) |
| 893 | |
| 894 | |
| 895 | # Check for PTHREAD_MUTEX_ERRORCHECK_NP |
| 896 | |
| 897 | AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP]) |
| 898 | |
| 899 | AC_TRY_COMPILE( |
| 900 | [ |
| 901 | #define _GNU_SOURCE |
| 902 | #include <pthread.h> |
| 903 | ], [ |
| 904 | return (PTHREAD_MUTEX_ERRORCHECK_NP); |
| 905 | ], |
| 906 | [ |
| 907 | AC_MSG_RESULT([yes]) |
| 908 | AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1, |
| 909 | [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.]) |
| 910 | ], [ |
| 911 | AC_MSG_RESULT([no]) |
| 912 | ]) |
| 913 | |
| 914 | |
| 915 | # Check for PTHREAD_MUTEX_RECURSIVE_NP |
| 916 | |
| 917 | AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP]) |
| 918 | |
| 919 | AC_TRY_COMPILE( |
| 920 | [ |
| 921 | #define _GNU_SOURCE |
| 922 | #include <pthread.h> |
| 923 | ], [ |
| 924 | return (PTHREAD_MUTEX_RECURSIVE_NP); |
| 925 | ], |
| 926 | [ |
| 927 | AC_MSG_RESULT([yes]) |
| 928 | AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, |
| 929 | [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.]) |
| 930 | ], [ |
| 931 | AC_MSG_RESULT([no]) |
| 932 | ]) |
| 933 | |
| 934 | |
| 935 | # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP |
| 936 | |
| 937 | AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP]) |
| 938 | |
| 939 | AC_TRY_COMPILE( |
| 940 | [ |
| 941 | #define _GNU_SOURCE |
| 942 | #include <pthread.h> |
| 943 | ], [ |
| 944 | pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; |
| 945 | return 0; |
| 946 | ], |
| 947 | [ |
| 948 | AC_MSG_RESULT([yes]) |
| 949 | AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1, |
| 950 | [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.]) |
| 951 | ], [ |
| 952 | AC_MSG_RESULT([no]) |
| 953 | ]) |
| 954 | |
| 955 | |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 956 | # Check whether pthread_mutex_t has a member called __m_kind. |
| 957 | |
bart | b11355c | 2010-04-29 16:37:26 +0000 | [diff] [blame] | 958 | AC_CHECK_MEMBER([pthread_mutex_t.__m_kind], |
| 959 | [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], |
| 960 | 1, |
| 961 | [Define to 1 if pthread_mutex_t has a member called __m_kind.]) |
| 962 | ], |
| 963 | [], |
| 964 | [#include <pthread.h>]) |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 965 | |
| 966 | |
| 967 | # Check whether pthread_mutex_t has a member called __data.__kind. |
| 968 | |
bart | b11355c | 2010-04-29 16:37:26 +0000 | [diff] [blame] | 969 | AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind], |
| 970 | [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], |
| 971 | 1, |
| 972 | [Define to 1 if pthread_mutex_t has a member __data.__kind.]) |
| 973 | ], |
| 974 | [], |
| 975 | [#include <pthread.h>]) |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 976 | |
| 977 | |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 978 | # does this compiler support -maltivec and does it have the include file |
| 979 | # <altivec.h> ? |
| 980 | |
| 981 | AC_MSG_CHECKING([for Altivec]) |
| 982 | |
| 983 | safe_CFLAGS=$CFLAGS |
| 984 | CFLAGS="-maltivec" |
| 985 | |
| 986 | AC_TRY_COMPILE( |
| 987 | [ |
| 988 | #include <altivec.h> |
| 989 | ], [ |
| 990 | vector unsigned int v; |
| 991 | ], |
| 992 | [ |
| 993 | ac_have_altivec=yes |
| 994 | AC_MSG_RESULT([yes]) |
sewardj | f9fe602 | 2010-09-03 14:36:50 +0000 | [diff] [blame] | 995 | AC_DEFINE([HAS_ALTIVEC], 1, |
sewardj | 6467a15 | 2010-09-03 14:02:22 +0000 | [diff] [blame] | 996 | [Define to 1 if gcc/as can do Altivec.]) |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 997 | ], [ |
| 998 | ac_have_altivec=no |
| 999 | AC_MSG_RESULT([no]) |
| 1000 | ]) |
| 1001 | CFLAGS=$safe_CFLAGS |
| 1002 | |
sewardj | 0e342a0 | 2010-09-03 23:49:33 +0000 | [diff] [blame] | 1003 | AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes]) |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1004 | |
| 1005 | |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1006 | # Check that both: the compiler supports -mvsx and that the assembler |
| 1007 | # understands VSX instructions. If either of those doesn't work, |
| 1008 | # conclude that we can't do VSX. NOTE: basically this is a kludge |
| 1009 | # in that it conflates two things that should be separate -- whether |
| 1010 | # the compiler understands the flag vs whether the assembler |
| 1011 | # understands the opcodes. This really ought to be cleaned up |
| 1012 | # and done properly, like it is for x86/x86_64. |
| 1013 | |
| 1014 | AC_MSG_CHECKING([for VSX]) |
| 1015 | |
| 1016 | safe_CFLAGS=$CFLAGS |
| 1017 | CFLAGS="-mvsx" |
| 1018 | |
| 1019 | AC_TRY_COMPILE( |
| 1020 | [ |
| 1021 | #include <altivec.h> |
| 1022 | ], [ |
| 1023 | vector unsigned int v; |
sewardj | 9b80ebb | 2011-04-15 21:16:00 +0000 | [diff] [blame] | 1024 | __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc"); |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1025 | ], |
| 1026 | [ |
| 1027 | ac_have_vsx=yes |
| 1028 | AC_MSG_RESULT([yes]) |
| 1029 | ], [ |
| 1030 | ac_have_vsx=no |
| 1031 | AC_MSG_RESULT([no]) |
| 1032 | ]) |
| 1033 | CFLAGS=$safe_CFLAGS |
| 1034 | |
| 1035 | AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes) |
| 1036 | |
| 1037 | |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1038 | # Check for pthread_create@GLIBC2.0 |
| 1039 | AC_MSG_CHECKING([for pthread_create@GLIBC2.0()]) |
| 1040 | |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1041 | safe_CFLAGS=$CFLAGS |
| 1042 | CFLAGS="-lpthread" |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1043 | AC_TRY_LINK( |
| 1044 | [ |
| 1045 | extern int pthread_create_glibc_2_0(void*, const void*, |
| 1046 | void *(*)(void*), void*); |
| 1047 | __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0"); |
| 1048 | ], [ |
bart | 276ed3a | 2009-05-10 15:41:45 +0000 | [diff] [blame] | 1049 | #ifdef __powerpc__ |
| 1050 | /* |
| 1051 | * Apparently on PowerPC linking this program succeeds and generates an |
| 1052 | * executable with the undefined symbol pthread_create@GLIBC_2.0. |
| 1053 | */ |
| 1054 | #error This test does not work properly on PowerPC. |
| 1055 | #else |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1056 | pthread_create_glibc_2_0(0, 0, 0, 0); |
bart | 276ed3a | 2009-05-10 15:41:45 +0000 | [diff] [blame] | 1057 | #endif |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1058 | return 0; |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1059 | ], |
| 1060 | [ |
| 1061 | ac_have_pthread_create_glibc_2_0=yes |
| 1062 | AC_MSG_RESULT([yes]) |
| 1063 | AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1, |
| 1064 | [Define to 1 if you have the `pthread_create@glibc2.0' function.]) |
| 1065 | ], [ |
| 1066 | ac_have_pthread_create_glibc_2_0=no |
| 1067 | AC_MSG_RESULT([no]) |
| 1068 | ]) |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1069 | CFLAGS=$safe_CFLAGS |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1070 | |
| 1071 | AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0, |
bart | 24f5390 | 2009-04-26 11:29:02 +0000 | [diff] [blame] | 1072 | test x$ac_have_pthread_create_glibc_2_0 = xyes) |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1073 | |
| 1074 | |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1075 | # Check for eventfd_t, eventfd() and eventfd_read() |
| 1076 | AC_MSG_CHECKING([for eventfd()]) |
| 1077 | |
| 1078 | AC_TRY_LINK( |
| 1079 | [ |
| 1080 | #include <sys/eventfd.h> |
| 1081 | ], [ |
| 1082 | eventfd_t ev; |
| 1083 | int fd; |
| 1084 | |
| 1085 | fd = eventfd(5, 0); |
| 1086 | eventfd_read(fd, &ev); |
| 1087 | return 0; |
| 1088 | ], |
| 1089 | [ |
| 1090 | AC_MSG_RESULT([yes]) |
| 1091 | AC_DEFINE([HAVE_EVENTFD], 1, |
| 1092 | [Define to 1 if you have the `eventfd' function.]) |
| 1093 | AC_DEFINE([HAVE_EVENTFD_READ], 1, |
| 1094 | [Define to 1 if you have the `eventfd_read' function.]) |
| 1095 | ], [ |
| 1096 | AC_MSG_RESULT([no]) |
| 1097 | ]) |
| 1098 | |
| 1099 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1100 | #---------------------------------------------------------------------------- |
| 1101 | # Checking for supported compiler flags. |
| 1102 | #---------------------------------------------------------------------------- |
| 1103 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1104 | # does this compiler support -m32 ? |
| 1105 | AC_MSG_CHECKING([if gcc accepts -m32]) |
| 1106 | |
| 1107 | safe_CFLAGS=$CFLAGS |
| 1108 | CFLAGS="-m32" |
| 1109 | |
| 1110 | AC_TRY_COMPILE(, [ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1111 | return 0; |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1112 | ], |
| 1113 | [ |
| 1114 | FLAG_M32="-m32" |
| 1115 | AC_MSG_RESULT([yes]) |
| 1116 | ], [ |
| 1117 | FLAG_M32="" |
| 1118 | AC_MSG_RESULT([no]) |
| 1119 | ]) |
| 1120 | CFLAGS=$safe_CFLAGS |
| 1121 | |
| 1122 | AC_SUBST(FLAG_M32) |
| 1123 | |
| 1124 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1125 | # does this compiler support -m64 ? |
| 1126 | AC_MSG_CHECKING([if gcc accepts -m64]) |
| 1127 | |
| 1128 | safe_CFLAGS=$CFLAGS |
| 1129 | CFLAGS="-m64" |
| 1130 | |
| 1131 | AC_TRY_COMPILE(, [ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1132 | return 0; |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1133 | ], |
| 1134 | [ |
| 1135 | FLAG_M64="-m64" |
| 1136 | AC_MSG_RESULT([yes]) |
| 1137 | ], [ |
| 1138 | FLAG_M64="" |
| 1139 | AC_MSG_RESULT([no]) |
| 1140 | ]) |
| 1141 | CFLAGS=$safe_CFLAGS |
| 1142 | |
| 1143 | AC_SUBST(FLAG_M64) |
| 1144 | |
| 1145 | |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1146 | # does this compiler support -mmmx ? |
| 1147 | AC_MSG_CHECKING([if gcc accepts -mmmx]) |
| 1148 | |
| 1149 | safe_CFLAGS=$CFLAGS |
| 1150 | CFLAGS="-mmmx" |
| 1151 | |
| 1152 | AC_TRY_COMPILE(, [ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1153 | return 0; |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1154 | ], |
| 1155 | [ |
| 1156 | FLAG_MMMX="-mmmx" |
| 1157 | AC_MSG_RESULT([yes]) |
| 1158 | ], [ |
| 1159 | FLAG_MMMX="" |
| 1160 | AC_MSG_RESULT([no]) |
| 1161 | ]) |
| 1162 | CFLAGS=$safe_CFLAGS |
| 1163 | |
| 1164 | AC_SUBST(FLAG_MMMX) |
| 1165 | |
| 1166 | |
| 1167 | # does this compiler support -msse ? |
| 1168 | AC_MSG_CHECKING([if gcc accepts -msse]) |
| 1169 | |
| 1170 | safe_CFLAGS=$CFLAGS |
| 1171 | CFLAGS="-msse" |
| 1172 | |
| 1173 | AC_TRY_COMPILE(, [ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1174 | return 0; |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1175 | ], |
| 1176 | [ |
| 1177 | FLAG_MSSE="-msse" |
| 1178 | AC_MSG_RESULT([yes]) |
| 1179 | ], [ |
| 1180 | FLAG_MSSE="" |
| 1181 | AC_MSG_RESULT([no]) |
| 1182 | ]) |
| 1183 | CFLAGS=$safe_CFLAGS |
| 1184 | |
| 1185 | AC_SUBST(FLAG_MSSE) |
| 1186 | |
| 1187 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1188 | # does this compiler support -mpreferred-stack-boundary=2 ? |
| 1189 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary]) |
| 1190 | |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1191 | safe_CFLAGS=$CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1192 | CFLAGS="-mpreferred-stack-boundary=2" |
| 1193 | |
| 1194 | AC_TRY_COMPILE(, [ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1195 | return 0; |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1196 | ], |
| 1197 | [ |
| 1198 | PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2" |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1199 | AC_MSG_RESULT([yes]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1200 | ], [ |
| 1201 | PREFERRED_STACK_BOUNDARY="" |
| 1202 | AC_MSG_RESULT([no]) |
| 1203 | ]) |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1204 | CFLAGS=$safe_CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1205 | |
| 1206 | AC_SUBST(PREFERRED_STACK_BOUNDARY) |
| 1207 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1208 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1209 | # does this compiler support -Wno-pointer-sign ? |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1210 | AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign]) |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1211 | |
| 1212 | safe_CFLAGS=$CFLAGS |
| 1213 | CFLAGS="-Wno-pointer-sign" |
| 1214 | |
| 1215 | AC_TRY_COMPILE(, [ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1216 | return 0; |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1217 | ], |
| 1218 | [ |
| 1219 | no_pointer_sign=yes |
| 1220 | AC_MSG_RESULT([yes]) |
| 1221 | ], [ |
| 1222 | no_pointer_sign=no |
| 1223 | AC_MSG_RESULT([no]) |
| 1224 | ]) |
| 1225 | CFLAGS=$safe_CFLAGS |
| 1226 | |
| 1227 | if test x$no_pointer_sign = xyes; then |
| 1228 | CFLAGS="$CFLAGS -Wno-pointer-sign" |
| 1229 | fi |
| 1230 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1231 | |
bart | e026bd2 | 2009-07-04 12:17:07 +0000 | [diff] [blame] | 1232 | # does this compiler support -Wno-empty-body ? |
| 1233 | |
| 1234 | AC_MSG_CHECKING([if gcc accepts -Wno-empty-body]) |
| 1235 | |
| 1236 | safe_CFLAGS=$CFLAGS |
| 1237 | CFLAGS="-Wno-empty-body" |
| 1238 | |
| 1239 | AC_TRY_COMPILE( |
| 1240 | [ ], |
| 1241 | [ |
| 1242 | return 0; |
| 1243 | ], |
| 1244 | [ |
| 1245 | AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body]) |
| 1246 | AC_MSG_RESULT([yes]) |
| 1247 | ], |
| 1248 | [ |
| 1249 | AC_SUBST([FLAG_W_NO_EMPTY_BODY], []) |
| 1250 | AC_MSG_RESULT([no]) |
| 1251 | ]) |
| 1252 | CFLAGS=$safe_CFLAGS |
| 1253 | |
| 1254 | |
bart | 9d865fa | 2008-06-23 12:11:49 +0000 | [diff] [blame] | 1255 | # does this compiler support -Wno-format-zero-length ? |
| 1256 | |
| 1257 | AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length]) |
| 1258 | |
| 1259 | safe_CFLAGS=$CFLAGS |
| 1260 | CFLAGS="-Wno-format-zero-length" |
| 1261 | |
| 1262 | AC_TRY_COMPILE( |
| 1263 | [ ], |
| 1264 | [ |
| 1265 | return 0; |
| 1266 | ], |
| 1267 | [ |
| 1268 | AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length]) |
| 1269 | AC_MSG_RESULT([yes]) |
| 1270 | ], |
| 1271 | [ |
| 1272 | AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], []) |
| 1273 | AC_MSG_RESULT([no]) |
| 1274 | ]) |
| 1275 | CFLAGS=$safe_CFLAGS |
| 1276 | |
| 1277 | |
bart | 8e21631 | 2011-05-15 17:05:36 +0000 | [diff] [blame] | 1278 | # does this compiler support -Wno-nonnull ? |
| 1279 | |
| 1280 | AC_MSG_CHECKING([if gcc accepts -Wno-nonnull]) |
| 1281 | |
| 1282 | safe_CFLAGS=$CFLAGS |
| 1283 | CFLAGS="-Wno-nonnull" |
| 1284 | |
| 1285 | AC_TRY_COMPILE( |
| 1286 | [ ], |
| 1287 | [ |
| 1288 | return 0; |
| 1289 | ], |
| 1290 | [ |
| 1291 | AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull]) |
| 1292 | AC_MSG_RESULT([yes]) |
| 1293 | ], |
| 1294 | [ |
| 1295 | AC_SUBST([FLAG_W_NO_NONNULL], []) |
| 1296 | AC_MSG_RESULT([no]) |
| 1297 | ]) |
| 1298 | CFLAGS=$safe_CFLAGS |
| 1299 | |
| 1300 | |
| 1301 | # does this compiler support -Wno-overflow ? |
| 1302 | |
| 1303 | AC_MSG_CHECKING([if gcc accepts -Wno-overflow]) |
| 1304 | |
| 1305 | safe_CFLAGS=$CFLAGS |
| 1306 | CFLAGS="-Wno-overflow" |
| 1307 | |
| 1308 | AC_TRY_COMPILE( |
| 1309 | [ ], |
| 1310 | [ |
| 1311 | return 0; |
| 1312 | ], |
| 1313 | [ |
| 1314 | AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow]) |
| 1315 | AC_MSG_RESULT([yes]) |
| 1316 | ], |
| 1317 | [ |
| 1318 | AC_SUBST([FLAG_W_NO_OVERFLOW], []) |
| 1319 | AC_MSG_RESULT([no]) |
| 1320 | ]) |
| 1321 | CFLAGS=$safe_CFLAGS |
| 1322 | |
| 1323 | |
bart | bf9b85c | 2009-08-12 12:55:56 +0000 | [diff] [blame] | 1324 | # does this compiler support -Wno-uninitialized ? |
| 1325 | |
| 1326 | AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized]) |
| 1327 | |
| 1328 | safe_CFLAGS=$CFLAGS |
| 1329 | CFLAGS="-Wno-uninitialized" |
| 1330 | |
| 1331 | AC_TRY_COMPILE( |
| 1332 | [ ], |
| 1333 | [ |
| 1334 | return 0; |
| 1335 | ], |
| 1336 | [ |
| 1337 | AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized]) |
| 1338 | AC_MSG_RESULT([yes]) |
| 1339 | ], |
| 1340 | [ |
| 1341 | AC_SUBST([FLAG_W_NO_UNINITIALIZED], []) |
| 1342 | AC_MSG_RESULT([no]) |
| 1343 | ]) |
| 1344 | CFLAGS=$safe_CFLAGS |
| 1345 | |
| 1346 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1347 | # does this compiler support -Wextra or the older -W ? |
| 1348 | |
| 1349 | AC_MSG_CHECKING([if gcc accepts -Wextra or -W]) |
| 1350 | |
| 1351 | safe_CFLAGS=$CFLAGS |
| 1352 | CFLAGS="-Wextra" |
| 1353 | |
| 1354 | AC_TRY_COMPILE( |
| 1355 | [ ], |
| 1356 | [ |
| 1357 | return 0; |
| 1358 | ], |
| 1359 | [ |
| 1360 | AC_SUBST([FLAG_W_EXTRA], [-Wextra]) |
| 1361 | AC_MSG_RESULT([-Wextra]) |
| 1362 | ], [ |
| 1363 | CFLAGS="-W" |
| 1364 | AC_TRY_COMPILE( |
| 1365 | [ ], |
| 1366 | [ |
| 1367 | return 0; |
| 1368 | ], |
| 1369 | [ |
| 1370 | AC_SUBST([FLAG_W_EXTRA], [-W]) |
| 1371 | AC_MSG_RESULT([-W]) |
| 1372 | ], [ |
| 1373 | AC_SUBST([FLAG_W_EXTRA], []) |
| 1374 | AC_MSG_RESULT([not supported]) |
| 1375 | ]) |
| 1376 | ]) |
| 1377 | CFLAGS=$safe_CFLAGS |
| 1378 | |
| 1379 | |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1380 | # does this compiler support -fno-stack-protector ? |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1381 | AC_MSG_CHECKING([if gcc accepts -fno-stack-protector]) |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1382 | |
| 1383 | safe_CFLAGS=$CFLAGS |
| 1384 | CFLAGS="-fno-stack-protector" |
| 1385 | |
| 1386 | AC_TRY_COMPILE(, [ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1387 | return 0; |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1388 | ], |
| 1389 | [ |
| 1390 | no_stack_protector=yes |
| 1391 | FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector" |
| 1392 | AC_MSG_RESULT([yes]) |
| 1393 | ], [ |
| 1394 | no_stack_protector=no |
| 1395 | FLAG_FNO_STACK_PROTECTOR="" |
| 1396 | AC_MSG_RESULT([no]) |
| 1397 | ]) |
| 1398 | CFLAGS=$safe_CFLAGS |
| 1399 | |
| 1400 | AC_SUBST(FLAG_FNO_STACK_PROTECTOR) |
| 1401 | |
| 1402 | if test x$no_stack_protector = xyes; then |
| 1403 | CFLAGS="$CFLAGS -fno-stack-protector" |
| 1404 | fi |
| 1405 | |
| 1406 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1407 | # does this compiler support --param inline-unit-growth=... ? |
| 1408 | |
| 1409 | AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth]) |
| 1410 | |
| 1411 | safe_CFLAGS=$CFLAGS |
| 1412 | CFLAGS="--param inline-unit-growth=900" |
| 1413 | |
| 1414 | AC_TRY_COMPILE( |
| 1415 | [ ], |
| 1416 | [ |
| 1417 | return 0; |
| 1418 | ], |
| 1419 | [ |
| 1420 | AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], |
| 1421 | ["--param inline-unit-growth=900"]) |
| 1422 | AC_MSG_RESULT([yes]) |
| 1423 | ], [ |
| 1424 | AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""]) |
| 1425 | AC_MSG_RESULT([no]) |
| 1426 | ]) |
| 1427 | CFLAGS=$safe_CFLAGS |
| 1428 | |
| 1429 | |
sewardj | d364580 | 2010-06-13 22:13:58 +0000 | [diff] [blame] | 1430 | # does the linker support -Wl,--build-id=none ? Note, it's |
| 1431 | # important that we test indirectly via whichever C compiler |
| 1432 | # is selected, rather than testing /usr/bin/ld or whatever |
| 1433 | # directly. |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1434 | |
sewardj | d364580 | 2010-06-13 22:13:58 +0000 | [diff] [blame] | 1435 | AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none]) |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1436 | |
| 1437 | safe_CFLAGS=$CFLAGS |
| 1438 | CFLAGS="-Wl,--build-id=none" |
| 1439 | |
bart | 8508c75 | 2010-06-10 06:26:21 +0000 | [diff] [blame] | 1440 | AC_LINK_IFELSE( |
| 1441 | [AC_LANG_PROGRAM([ ], [return 0;])], |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1442 | [ |
| 1443 | AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"]) |
| 1444 | AC_MSG_RESULT([yes]) |
| 1445 | ], [ |
| 1446 | AC_SUBST([FLAG_NO_BUILD_ID], [""]) |
| 1447 | AC_MSG_RESULT([no]) |
| 1448 | ]) |
| 1449 | CFLAGS=$safe_CFLAGS |
| 1450 | |
| 1451 | |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 1452 | # does the ppc assembler support "mtocrf" et al? |
| 1453 | AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf]) |
| 1454 | |
| 1455 | AC_TRY_COMPILE(, [ |
sewardj | dd4cbe1 | 2006-03-12 17:27:44 +0000 | [diff] [blame] | 1456 | __asm__ __volatile__("mtocrf 4,0"); |
| 1457 | __asm__ __volatile__("mfocrf 0,4"); |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 1458 | ], |
| 1459 | [ |
| 1460 | ac_have_as_ppc_mftocrf=yes |
| 1461 | AC_MSG_RESULT([yes]) |
| 1462 | ], [ |
| 1463 | ac_have_as_ppc_mftocrf=no |
| 1464 | AC_MSG_RESULT([no]) |
| 1465 | ]) |
| 1466 | if test x$ac_have_as_ppc_mftocrf = xyes ; then |
| 1467 | AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.]) |
| 1468 | fi |
| 1469 | |
| 1470 | |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 1471 | CFLAGS=$safe_CFLAGS |
| 1472 | |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1473 | # does the x86/amd64 assembler understand SSE3 instructions? |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 1474 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1475 | # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1476 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3]) |
| 1477 | |
| 1478 | AC_TRY_COMPILE(, [ |
| 1479 | do { long long int x; |
| 1480 | __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); } |
| 1481 | while (0) |
| 1482 | ], |
| 1483 | [ |
| 1484 | ac_have_as_sse3=yes |
| 1485 | AC_MSG_RESULT([yes]) |
| 1486 | ], [ |
| 1487 | ac_have_as_sse3=no |
| 1488 | AC_MSG_RESULT([no]) |
| 1489 | ]) |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 1490 | |
| 1491 | AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes) |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1492 | |
| 1493 | |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 1494 | # Ditto for SSSE3 instructions (note extra S) |
| 1495 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1496 | # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's |
| 1497 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3]) |
| 1498 | |
| 1499 | AC_TRY_COMPILE(, [ |
| 1500 | do { long long int x; |
| 1501 | __asm__ __volatile__( |
| 1502 | "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); } |
| 1503 | while (0) |
| 1504 | ], |
| 1505 | [ |
| 1506 | ac_have_as_ssse3=yes |
| 1507 | AC_MSG_RESULT([yes]) |
| 1508 | ], [ |
| 1509 | ac_have_as_ssse3=no |
| 1510 | AC_MSG_RESULT([no]) |
| 1511 | ]) |
| 1512 | |
| 1513 | AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes) |
| 1514 | |
| 1515 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1516 | # does the x86/amd64 assembler understand the PCLMULQDQ instruction? |
| 1517 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1518 | # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's |
sewardj | e3ae8a3 | 2010-09-28 19:59:47 +0000 | [diff] [blame] | 1519 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq']) |
| 1520 | AC_TRY_COMPILE(, [ |
| 1521 | do { |
| 1522 | __asm__ __volatile__( |
| 1523 | "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); } |
| 1524 | while (0) |
| 1525 | ], |
| 1526 | [ |
| 1527 | ac_have_as_pclmulqdq=yes |
| 1528 | AC_MSG_RESULT([yes]) |
| 1529 | ], [ |
| 1530 | ac_have_as_pclmulqdq=no |
| 1531 | AC_MSG_RESULT([no]) |
| 1532 | ]) |
| 1533 | |
| 1534 | AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes) |
| 1535 | |
| 1536 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1537 | # does the x86/amd64 assembler understand the LZCNT instruction? |
| 1538 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1539 | # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's |
bart | 55e438b | 2010-09-14 10:53:57 +0000 | [diff] [blame] | 1540 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt']) |
| 1541 | |
| 1542 | AC_TRY_COMPILE([], [ |
| 1543 | do { |
| 1544 | __asm__ __volatile__("lzcnt %rax,%rax"); |
| 1545 | } while (0) |
| 1546 | ], |
| 1547 | [ |
| 1548 | ac_have_as_lzcnt=yes |
| 1549 | AC_MSG_RESULT([yes]) |
| 1550 | ], [ |
| 1551 | ac_have_as_lzcnt=no |
| 1552 | AC_MSG_RESULT([no]) |
| 1553 | ]) |
| 1554 | |
| 1555 | AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes]) |
| 1556 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1557 | |
| 1558 | # does the x86/amd64 assembler understand SSE 4.2 instructions? |
| 1559 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1560 | # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's |
| 1561 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2]) |
| 1562 | |
| 1563 | AC_TRY_COMPILE(, [ |
| 1564 | do { long long int x; |
| 1565 | __asm__ __volatile__( |
| 1566 | "crc32q %%r15,%%r15" : : : "r15" ); } |
| 1567 | while (0) |
| 1568 | ], |
| 1569 | [ |
| 1570 | ac_have_as_sse42=yes |
| 1571 | AC_MSG_RESULT([yes]) |
| 1572 | ], [ |
| 1573 | ac_have_as_sse42=no |
| 1574 | AC_MSG_RESULT([no]) |
| 1575 | ]) |
| 1576 | |
| 1577 | AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes) |
| 1578 | |
| 1579 | |
sewardj | e089f01 | 2010-10-13 21:47:29 +0000 | [diff] [blame] | 1580 | # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this |
| 1581 | # when building the tool executables. I think we should get rid of it. |
| 1582 | # |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1583 | # Check for TLS support in the compiler and linker |
bart | ca9f2ad | 2008-06-02 07:14:20 +0000 | [diff] [blame] | 1584 | if test "x${cross_compiling}" = "xno"; then |
| 1585 | # Native compilation: check whether running a program using TLS succeeds. |
| 1586 | # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs |
| 1587 | # succeeds but running programs using TLS fails. |
| 1588 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 1589 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 1590 | [vg_cv_tls=$enableval], |
| 1591 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 1592 | [[return foo;]])], |
| 1593 | [vg_cv_tls=yes], |
| 1594 | [vg_cv_tls=no])])]) |
| 1595 | else |
| 1596 | # Cross-compiling: check whether linking a program using TLS succeeds. |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1597 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 1598 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 1599 | [vg_cv_tls=$enableval], |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 1600 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1601 | [[return foo;]])], |
| 1602 | [vg_cv_tls=yes], |
| 1603 | [vg_cv_tls=no])])]) |
bart | ca9f2ad | 2008-06-02 07:14:20 +0000 | [diff] [blame] | 1604 | fi |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1605 | |
| 1606 | if test "$vg_cv_tls" = yes; then |
| 1607 | AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables]) |
| 1608 | fi |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1609 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1610 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1611 | #---------------------------------------------------------------------------- |
bart | 62f54e4 | 2008-07-28 11:35:10 +0000 | [diff] [blame] | 1612 | # Checks for C header files. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1613 | #---------------------------------------------------------------------------- |
| 1614 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1615 | AC_HEADER_STDC |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1616 | AC_CHECK_HEADERS([ \ |
bart | 1f2b143 | 2009-01-16 12:06:54 +0000 | [diff] [blame] | 1617 | asm/unistd.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1618 | endian.h \ |
| 1619 | mqueue.h \ |
| 1620 | sys/endian.h \ |
| 1621 | sys/epoll.h \ |
| 1622 | sys/eventfd.h \ |
bart | ce48fa9 | 2008-04-26 10:59:46 +0000 | [diff] [blame] | 1623 | sys/klog.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1624 | sys/poll.h \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1625 | sys/signal.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1626 | sys/signalfd.h \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1627 | sys/syscall.h \ |
| 1628 | sys/time.h \ |
| 1629 | sys/types.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1630 | ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1631 | |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame^] | 1632 | # Verify whether the <linux/futex.h> header is usable. |
| 1633 | AC_MSG_CHECKING([if <linux/futex.h> is usable]) |
| 1634 | |
| 1635 | AC_TRY_COMPILE([ |
| 1636 | #include <linux/futex.h> |
| 1637 | ], [ |
| 1638 | return FUTEX_WAIT; |
| 1639 | ], |
| 1640 | [ |
| 1641 | AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1, |
| 1642 | [Define to 1 if you have a usable <linux/futex.h> header file.]) |
| 1643 | AC_MSG_RESULT([yes]) |
| 1644 | ], [ |
| 1645 | AC_MSG_RESULT([no]) |
| 1646 | ]) |
| 1647 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1648 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1649 | # Checks for typedefs, structures, and compiler characteristics. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1650 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1651 | AC_TYPE_UID_T |
| 1652 | AC_TYPE_OFF_T |
| 1653 | AC_TYPE_SIZE_T |
| 1654 | AC_HEADER_TIME |
| 1655 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1656 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1657 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1658 | # Checks for library functions. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1659 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1660 | AC_FUNC_MEMCMP |
| 1661 | AC_FUNC_MMAP |
| 1662 | AC_TYPE_SIGNAL |
| 1663 | |
bart | 26288e4 | 2011-04-03 16:46:01 +0000 | [diff] [blame] | 1664 | AC_CHECK_LIB([pthread], [pthread_create]) |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1665 | AC_CHECK_LIB([rt], [clock_gettime]) |
bart | 41ac62a | 2008-07-07 16:58:03 +0000 | [diff] [blame] | 1666 | |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1667 | AC_CHECK_FUNCS([ \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1668 | clock_gettime\ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1669 | epoll_create \ |
| 1670 | epoll_pwait \ |
bart | ce48fa9 | 2008-04-26 10:59:46 +0000 | [diff] [blame] | 1671 | klogctl \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1672 | mallinfo \ |
| 1673 | memchr \ |
| 1674 | memset \ |
| 1675 | mkdir \ |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 1676 | mremap \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1677 | ppoll \ |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 1678 | pthread_barrier_init \ |
| 1679 | pthread_condattr_setclock \ |
| 1680 | pthread_mutex_timedlock \ |
| 1681 | pthread_rwlock_timedrdlock \ |
| 1682 | pthread_rwlock_timedwrlock \ |
| 1683 | pthread_spin_lock \ |
bart | a72a27b | 2010-04-29 06:22:17 +0000 | [diff] [blame] | 1684 | pthread_yield \ |
bart | d1f724c | 2009-08-26 18:11:18 +0000 | [diff] [blame] | 1685 | readlinkat \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1686 | semtimedop \ |
| 1687 | signalfd \ |
njn | 6cc2247 | 2009-03-16 03:46:48 +0000 | [diff] [blame] | 1688 | sigwaitinfo \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1689 | strchr \ |
| 1690 | strdup \ |
| 1691 | strpbrk \ |
| 1692 | strrchr \ |
| 1693 | strstr \ |
bart | a72a27b | 2010-04-29 06:22:17 +0000 | [diff] [blame] | 1694 | syscall \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1695 | utimensat \ |
| 1696 | ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1697 | |
bart | 623eec3 | 2008-07-29 17:54:49 +0000 | [diff] [blame] | 1698 | # AC_CHECK_LIB adds any library found to the variable LIBS, and links these |
| 1699 | # libraries with any shared object and/or executable. This is NOT what we |
| 1700 | # want for e.g. vgpreload_core-x86-linux.so |
| 1701 | LIBS="" |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1702 | |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 1703 | AM_CONDITIONAL([HAVE_PTHREAD_BARRIER], |
| 1704 | [test x$ac_cv_func_pthread_barrier_init = xyes]) |
bart | 2eaa8f2 | 2009-01-20 14:01:16 +0000 | [diff] [blame] | 1705 | AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK], |
| 1706 | [test x$ac_cv_func_pthread_mutex_timedlock = xyes]) |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 1707 | AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK], |
| 1708 | [test x$ac_cv_func_pthread_spin_lock = xyes]) |
| 1709 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1710 | |
| 1711 | #---------------------------------------------------------------------------- |
| 1712 | # MPI checks |
| 1713 | #---------------------------------------------------------------------------- |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1714 | # Do we have a useable MPI setup on the primary and/or secondary targets? |
| 1715 | # On Linux, by default, assumes mpicc and -m32/-m64 |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1716 | # Note: this is a kludge in that it assumes the specified mpicc |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 1717 | # understands -m32/-m64 regardless of what is specified using |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1718 | # --with-mpicc=. |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1719 | MPI_CC="mpicc" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1720 | |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1721 | mflag_primary= |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1722 | if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 1723 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
| 1724 | -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ; then |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1725 | mflag_primary=$FLAG_M32 |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1726 | elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 1727 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \ |
| 1728 | -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1729 | mflag_primary=$FLAG_M64 |
| 1730 | fi |
| 1731 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1732 | mflag_secondary= |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1733 | if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \ |
| 1734 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1735 | mflag_secondary=$FLAG_M32 |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1736 | fi |
| 1737 | |
| 1738 | |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1739 | AC_ARG_WITH(mpicc, |
sewardj | b70a613 | 2006-05-27 21:14:09 +0000 | [diff] [blame] | 1740 | [ --with-mpicc= Specify name of MPI2-ised C compiler], |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1741 | MPI_CC=$withval |
| 1742 | ) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1743 | AC_SUBST(MPI_CC) |
| 1744 | |
| 1745 | ## See if MPI_CC works for the primary target |
| 1746 | ## |
| 1747 | 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] | 1748 | saved_CC=$CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1749 | saved_CFLAGS=$CFLAGS |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1750 | CC=$MPI_CC |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1751 | CFLAGS=$mflag_primary |
sewardj | d3fcc64 | 2006-03-09 02:49:56 +0000 | [diff] [blame] | 1752 | AC_TRY_LINK([ |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 1753 | #include <mpi.h> |
| 1754 | #include <stdio.h> |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1755 | ],[ |
| 1756 | int r = MPI_Init(NULL,NULL); |
| 1757 | r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL ); |
| 1758 | return r; |
| 1759 | ], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1760 | ac_have_mpi2_pri=yes |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 1761 | AC_MSG_RESULT([yes, $MPI_CC]) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1762 | ], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1763 | ac_have_mpi2_pri=no |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1764 | AC_MSG_RESULT([no]) |
| 1765 | ]) |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1766 | CC=$saved_CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1767 | CFLAGS=$saved_CFLAGS |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1768 | AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1769 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1770 | ## See if MPI_CC works for the secondary target. Complication: what if |
| 1771 | ## there is no secondary target? We need this to then fail. |
| 1772 | ## Kludge this by making MPI_CC something which will surely fail in |
| 1773 | ## such a case. |
| 1774 | ## |
| 1775 | AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h]) |
| 1776 | saved_CC=$CC |
| 1777 | saved_CFLAGS=$CFLAGS |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1778 | if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1779 | CC="$MPI_CC this will surely fail" |
| 1780 | else |
| 1781 | CC=$MPI_CC |
| 1782 | fi |
| 1783 | CFLAGS=$mflag_secondary |
| 1784 | AC_TRY_LINK([ |
| 1785 | #include <mpi.h> |
| 1786 | #include <stdio.h> |
| 1787 | ],[ |
| 1788 | int r = MPI_Init(NULL,NULL); |
| 1789 | r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL ); |
| 1790 | return r; |
| 1791 | ], [ |
| 1792 | ac_have_mpi2_sec=yes |
| 1793 | AC_MSG_RESULT([yes, $MPI_CC]) |
| 1794 | ], [ |
| 1795 | ac_have_mpi2_sec=no |
| 1796 | AC_MSG_RESULT([no]) |
| 1797 | ]) |
| 1798 | CC=$saved_CC |
| 1799 | CFLAGS=$saved_CFLAGS |
| 1800 | AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1801 | |
| 1802 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1803 | #---------------------------------------------------------------------------- |
| 1804 | # Other library checks |
| 1805 | #---------------------------------------------------------------------------- |
bart | 2ef12d4 | 2010-10-18 16:32:11 +0000 | [diff] [blame] | 1806 | # There now follow some tests for Boost, and OpenMP. These |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1807 | # tests are present because Drd has some regression tests that use |
| 1808 | # these packages. All regression test programs all compiled only |
| 1809 | # for the primary target. And so it is important that the configure |
| 1810 | # checks that follow, use the correct -m32 or -m64 flag for the |
| 1811 | # primary target (called $mflag_primary). Otherwise, we can end up |
| 1812 | # in a situation (eg) where, on amd64-linux, the test for Boost checks |
| 1813 | # for usable 64-bit Boost facilities, but because we are doing a 32-bit |
| 1814 | # only build (meaning, the primary target is x86-linux), the build |
| 1815 | # of the regtest programs that use Boost fails, because they are |
| 1816 | # build as 32-bit (IN THIS EXAMPLE). |
| 1817 | # |
| 1818 | # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES |
| 1819 | # NEEDED BY THE REGRESSION TEST PROGRAMS. |
| 1820 | |
| 1821 | |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1822 | # Check whether the boost library 1.35 or later has been installed. |
| 1823 | # The Boost.Threads library has undergone a major rewrite in version 1.35.0. |
| 1824 | |
| 1825 | AC_MSG_CHECKING([for boost]) |
| 1826 | |
| 1827 | AC_LANG(C++) |
| 1828 | safe_CXXFLAGS=$CXXFLAGS |
| 1829 | CXXFLAGS="-lboost_thread-mt $mflag_primary" |
| 1830 | |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 1831 | AC_LINK_IFELSE([AC_LANG_SOURCE([ |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1832 | #include <boost/thread.hpp> |
| 1833 | static void thread_func(void) |
| 1834 | { } |
| 1835 | int main(int argc, char** argv) |
| 1836 | { |
| 1837 | boost::thread t(thread_func); |
| 1838 | return 0; |
| 1839 | } |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 1840 | ])], |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1841 | [ |
| 1842 | ac_have_boost_1_35=yes |
| 1843 | AC_SUBST([BOOST_CFLAGS], []) |
| 1844 | AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"]) |
| 1845 | AC_MSG_RESULT([yes]) |
| 1846 | ], [ |
| 1847 | ac_have_boost_1_35=no |
| 1848 | AC_MSG_RESULT([no]) |
| 1849 | ]) |
| 1850 | |
| 1851 | CXXFLAGS=$safe_CXXFLAGS |
| 1852 | AC_LANG(C) |
| 1853 | |
| 1854 | AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes]) |
| 1855 | |
| 1856 | |
| 1857 | # does this compiler support -fopenmp, does it have the include file |
| 1858 | # <omp.h> and does it have libgomp ? |
| 1859 | |
| 1860 | AC_MSG_CHECKING([for OpenMP]) |
| 1861 | |
| 1862 | safe_CFLAGS=$CFLAGS |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1863 | CFLAGS="-fopenmp $mflag_primary" |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1864 | |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 1865 | AC_LINK_IFELSE([AC_LANG_SOURCE([ |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1866 | #include <omp.h> |
| 1867 | int main(int argc, char** argv) |
| 1868 | { |
| 1869 | omp_set_dynamic(0); |
| 1870 | return 0; |
| 1871 | } |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 1872 | ])], |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1873 | [ |
| 1874 | ac_have_openmp=yes |
| 1875 | AC_MSG_RESULT([yes]) |
| 1876 | ], [ |
| 1877 | ac_have_openmp=no |
| 1878 | AC_MSG_RESULT([no]) |
| 1879 | ]) |
| 1880 | CFLAGS=$safe_CFLAGS |
| 1881 | |
| 1882 | AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes]) |
| 1883 | |
| 1884 | |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1885 | # does this compiler have built-in functions for atomic memory access ? |
| 1886 | AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap]) |
| 1887 | |
| 1888 | safe_CFLAGS=$CFLAGS |
| 1889 | CFLAGS="$mflag_primary" |
| 1890 | |
| 1891 | AC_TRY_LINK(, |
| 1892 | [ |
| 1893 | int variable = 1; |
| 1894 | return (__sync_bool_compare_and_swap(&variable, 1, 2) |
| 1895 | && __sync_add_and_fetch(&variable, 1) ? 1 : 0) |
| 1896 | ], |
| 1897 | [ |
bart | c82d137 | 2009-05-31 16:21:23 +0000 | [diff] [blame] | 1898 | ac_have_builtin_atomic=yes |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1899 | AC_MSG_RESULT([yes]) |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 1900 | AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()]) |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1901 | ], |
| 1902 | [ |
bart | c82d137 | 2009-05-31 16:21:23 +0000 | [diff] [blame] | 1903 | ac_have_builtin_atomic=no |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1904 | AC_MSG_RESULT([no]) |
| 1905 | ]) |
| 1906 | |
| 1907 | CFLAGS=$safe_CFLAGS |
| 1908 | |
bart | c82d137 | 2009-05-31 16:21:23 +0000 | [diff] [blame] | 1909 | AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes]) |
| 1910 | |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 1911 | # does g++ have built-in functions for atomic memory access ? |
| 1912 | AC_MSG_CHECKING([if g++ supports __sync_bool_compare_and_swap]) |
| 1913 | |
| 1914 | safe_CXXFLAGS=$CXXFLAGS |
| 1915 | CXXFLAGS="$mflag_primary" |
| 1916 | |
| 1917 | AC_LANG_PUSH(C++) |
| 1918 | AC_TRY_LINK(, |
| 1919 | [ |
| 1920 | int variable = 1; |
| 1921 | return (__sync_bool_compare_and_swap(&variable, 1, 2) |
| 1922 | && __sync_add_and_fetch(&variable, 1) ? 1 : 0) |
| 1923 | ], |
| 1924 | [ |
| 1925 | ac_have_builtin_atomic_cxx=yes |
| 1926 | AC_MSG_RESULT([yes]) |
| 1927 | AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()]) |
| 1928 | ], |
| 1929 | [ |
| 1930 | ac_have_builtin_atomic_cxx=no |
| 1931 | AC_MSG_RESULT([no]) |
| 1932 | ]) |
| 1933 | AC_LANG_POP(C++) |
| 1934 | |
| 1935 | CXXFLAGS=$safe_CXXFLAGS |
| 1936 | |
| 1937 | AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes]) |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1938 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1939 | #---------------------------------------------------------------------------- |
| 1940 | # Ok. We're done checking. |
| 1941 | #---------------------------------------------------------------------------- |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1942 | |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 1943 | # Nb: VEX/Makefile is generated from Makefile.vex.in. |
| 1944 | AC_CONFIG_FILES([ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1945 | Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 1946 | VEX/Makefile:Makefile.vex.in |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1947 | valgrind.spec |
mueller | bddd607 | 2003-11-19 21:50:07 +0000 | [diff] [blame] | 1948 | valgrind.pc |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 1949 | glibc-2.X.supp |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 1950 | docs/Makefile |
| 1951 | tests/Makefile |
njn | c2e7f48 | 2002-09-27 08:44:17 +0000 | [diff] [blame] | 1952 | tests/vg_regtest |
njn | ec0c27a | 2005-12-10 23:11:28 +0000 | [diff] [blame] | 1953 | perf/Makefile |
| 1954 | perf/vg_perf |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 1955 | gdbserver_tests/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 1956 | include/Makefile |
njn | 7a6e746 | 2002-11-09 17:53:30 +0000 | [diff] [blame] | 1957 | auxprogs/Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 1958 | mpi/Makefile |
njn25 | ab72603 | 2002-09-23 16:24:41 +0000 | [diff] [blame] | 1959 | coregrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1960 | memcheck/Makefile |
| 1961 | memcheck/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1962 | memcheck/tests/amd64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1963 | memcheck/tests/x86/Makefile |
njn | 3b3b76d | 2009-01-19 03:44:19 +0000 | [diff] [blame] | 1964 | memcheck/tests/linux/Makefile |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 1965 | memcheck/tests/darwin/Makefile |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 1966 | memcheck/tests/amd64-linux/Makefile |
njn | a454ec0 | 2009-01-19 03:16:59 +0000 | [diff] [blame] | 1967 | memcheck/tests/x86-linux/Makefile |
sewardj | 0e342a0 | 2010-09-03 23:49:33 +0000 | [diff] [blame] | 1968 | memcheck/tests/ppc32/Makefile |
| 1969 | memcheck/tests/ppc64/Makefile |
njn | 29a5c01 | 2009-05-06 06:15:55 +0000 | [diff] [blame] | 1970 | memcheck/perf/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1971 | cachegrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1972 | cachegrind/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1973 | cachegrind/tests/x86/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1974 | cachegrind/cg_annotate |
njn | 69d495d | 2010-06-30 05:23:34 +0000 | [diff] [blame] | 1975 | cachegrind/cg_diff |
weidendo | a17f2a3 | 2006-03-20 10:27:30 +0000 | [diff] [blame] | 1976 | callgrind/Makefile |
| 1977 | callgrind/callgrind_annotate |
| 1978 | callgrind/callgrind_control |
| 1979 | callgrind/tests/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1980 | helgrind/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1981 | helgrind/tests/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 1982 | massif/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 1983 | massif/tests/Makefile |
njn | 734b805 | 2007-11-01 04:40:37 +0000 | [diff] [blame] | 1984 | massif/perf/Makefile |
njn | d5a8d24 | 2007-11-02 20:44:57 +0000 | [diff] [blame] | 1985 | massif/ms_print |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1986 | lackey/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 1987 | lackey/tests/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 1988 | none/Makefile |
| 1989 | none/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1990 | none/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 1991 | none/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 1992 | none/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1993 | none/tests/x86/Makefile |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 1994 | none/tests/arm/Makefile |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 1995 | none/tests/s390x/Makefile |
njn | 0458a12 | 2009-02-13 06:23:46 +0000 | [diff] [blame] | 1996 | none/tests/linux/Makefile |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 1997 | none/tests/darwin/Makefile |
njn | 06ca332 | 2009-04-15 23:10:04 +0000 | [diff] [blame] | 1998 | none/tests/x86-linux/Makefile |
sewardj | d2f95a0 | 2011-05-11 16:04:28 +0000 | [diff] [blame] | 1999 | exp-sgcheck/Makefile |
| 2000 | exp-sgcheck/tests/Makefile |
bart | ccf17de | 2008-07-04 15:14:35 +0000 | [diff] [blame] | 2001 | drd/Makefile |
bart | ccf17de | 2008-07-04 15:14:35 +0000 | [diff] [blame] | 2002 | drd/scripts/download-and-build-splash2 |
| 2003 | drd/tests/Makefile |
njn | dbebecc | 2009-07-14 01:39:54 +0000 | [diff] [blame] | 2004 | exp-bbv/Makefile |
njn | dbebecc | 2009-07-14 01:39:54 +0000 | [diff] [blame] | 2005 | exp-bbv/tests/Makefile |
| 2006 | exp-bbv/tests/x86/Makefile |
| 2007 | exp-bbv/tests/x86-linux/Makefile |
| 2008 | exp-bbv/tests/amd64-linux/Makefile |
| 2009 | exp-bbv/tests/ppc32-linux/Makefile |
vince | 226e078 | 2010-01-06 15:22:11 +0000 | [diff] [blame] | 2010 | exp-bbv/tests/arm-linux/Makefile |
sewardj | 4d7d8f5 | 2010-10-12 10:09:15 +0000 | [diff] [blame] | 2011 | exp-dhat/Makefile |
| 2012 | exp-dhat/tests/Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2013 | ]) |
sewardj | d364580 | 2010-06-13 22:13:58 +0000 | [diff] [blame] | 2014 | AC_CONFIG_FILES([coregrind/link_tool_exe_linux], |
| 2015 | [chmod +x coregrind/link_tool_exe_linux]) |
| 2016 | AC_CONFIG_FILES([coregrind/link_tool_exe_darwin], |
| 2017 | [chmod +x coregrind/link_tool_exe_darwin]) |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2018 | AC_OUTPUT |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 2019 | |
| 2020 | cat<<EOF |
| 2021 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 2022 | Maximum build arch: ${ARCH_MAX} |
| 2023 | Primary build arch: ${VGCONF_ARCH_PRI} |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 2024 | Secondary build arch: ${VGCONF_ARCH_SEC} |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 2025 | Build OS: ${VGCONF_OS} |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2026 | Primary build target: ${VGCONF_PLATFORM_PRI_CAPS} |
| 2027 | Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS} |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 2028 | Platform variant: ${VGCONF_PLATVARIANT} |
| 2029 | Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1 |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 2030 | Default supp files: ${DEFAULT_SUPP} |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 2031 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 2032 | EOF |