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 | 956b6d2 | 2014-09-02 10:30:12 +0000 | [diff] [blame] | 11 | AC_INIT([Valgrind],[3.10.0.BETA1],[valgrind-users@lists.sourceforge.net]) |
njn | 04e1698 | 2005-05-31 00:23:43 +0000 | [diff] [blame] | 12 | AC_CONFIG_SRCDIR(coregrind/m_main.c) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 13 | AC_CONFIG_HEADERS([config.h]) |
sewardj | f9a698e | 2013-09-02 12:44:52 +0000 | [diff] [blame] | 14 | AM_INIT_AUTOMAKE([foreign subdir-objects]) |
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" |
florian | d79b3bf | 2013-10-02 15:14:59 +0000 | [diff] [blame] | 22 | CXXFLAGS="-Wno-long-long $CXXFLAGS" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 23 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 24 | AC_PROG_LN_S |
| 25 | AC_PROG_CC |
bart | 0affa49 | 2008-03-18 17:53:09 +0000 | [diff] [blame] | 26 | AM_PROG_CC_C_O |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 27 | AC_PROG_CPP |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 28 | AC_PROG_CXX |
njn | 629a5ec | 2009-07-14 01:29:39 +0000 | [diff] [blame] | 29 | # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with |
| 30 | # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code |
| 31 | # base (eg. most likely as Darwin-specific tests) we'll need one of the |
| 32 | # following: |
njn | 0cd2689 | 2009-07-12 23:07:13 +0000 | [diff] [blame] | 33 | # - put AC_PROG_OBJC in a Darwin-specific part of this file |
| 34 | # - Use AC_PROG_OBJC here and up the minimum autoconf version |
| 35 | # - Use the following, which is apparently equivalent: |
| 36 | # m4_ifdef([AC_PROG_OBJC], |
| 37 | # [AC_PROG_OBJC], |
| 38 | # [AC_CHECK_TOOL([OBJC], [gcc]) |
| 39 | # AC_SUBST([OBJC]) |
| 40 | # AC_SUBST([OBJCFLAGS]) |
| 41 | # ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 42 | AC_PROG_RANLIB |
bart | 07de2c9 | 2010-05-29 06:44:28 +0000 | [diff] [blame] | 43 | # provide a very basic definition for AC_PROG_SED if it's not provided by |
| 44 | # autoconf (as e.g. in autoconf 2.59). |
| 45 | m4_ifndef([AC_PROG_SED], |
| 46 | [AC_DEFUN([AC_PROG_SED], |
| 47 | [AC_ARG_VAR([SED]) |
| 48 | AC_CHECK_PROGS([SED],[gsed sed])])]) |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 49 | AC_PROG_SED |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 50 | |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 51 | # If no AR variable was specified, look up the name of the archiver. Otherwise |
| 52 | # do not touch the AR variable. |
| 53 | if test "x$AR" = "x"; then |
bart | 07de2c9 | 2010-05-29 06:44:28 +0000 | [diff] [blame] | 54 | AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar]) |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 55 | fi |
| 56 | AC_ARG_VAR([AR],[Archiver command]) |
| 57 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 58 | # Check for the compiler support |
| 59 | if test "${GCC}" != "yes" ; then |
| 60 | AC_MSG_ERROR([Valgrind relies on GCC to be compiled]) |
| 61 | fi |
| 62 | |
sewardj | 2f68595 | 2002-12-22 19:32:23 +0000 | [diff] [blame] | 63 | # figure out where perl lives |
| 64 | AC_PATH_PROG(PERL, perl) |
| 65 | |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 66 | # figure out where gdb lives |
sewardj | f8722ca | 2008-11-17 00:20:45 +0000 | [diff] [blame] | 67 | AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time") |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 68 | AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB]) |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 69 | |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 70 | # some older automake's don't have it so try something on our own |
| 71 | ifdef([AM_PROG_AS],[AM_PROG_AS], |
| 72 | [ |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 73 | AS="${CC}" |
| 74 | AC_SUBST(AS) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 75 | |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 76 | ASFLAGS="" |
| 77 | AC_SUBST(ASFLAGS) |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 78 | ]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 79 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 80 | |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 81 | # Check if 'diff' supports -u (universal diffs) and use it if possible. |
| 82 | |
| 83 | AC_MSG_CHECKING([for diff -u]) |
| 84 | AC_SUBST(DIFF) |
| 85 | |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 86 | # Comparing two identical files results in 0. |
njn | 31f665e | 2009-02-26 21:25:50 +0000 | [diff] [blame] | 87 | tmpfile="tmp-xxx-yyy-zzz" |
| 88 | touch $tmpfile; |
| 89 | if diff -u $tmpfile $tmpfile ; then |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 90 | AC_MSG_RESULT([yes]) |
| 91 | DIFF="diff -u" |
| 92 | else |
| 93 | AC_MSG_RESULT([no]) |
| 94 | DIFF="diff" |
| 95 | fi |
njn | 31f665e | 2009-02-26 21:25:50 +0000 | [diff] [blame] | 96 | rm $tmpfile |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 97 | |
| 98 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 99 | # We don't want gcc < 3.0 |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 100 | AC_MSG_CHECKING([for a supported version of gcc]) |
| 101 | |
bart | 8503744 | 2011-11-22 14:41:31 +0000 | [diff] [blame] | 102 | # Obtain the compiler version. |
sewardj | a8ca2c5 | 2011-09-29 18:18:37 +0000 | [diff] [blame] | 103 | # |
bart | 8503744 | 2011-11-22 14:41:31 +0000 | [diff] [blame] | 104 | # A few examples of how the ${CC} --version output looks like: |
| 105 | # |
| 106 | # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2 |
| 107 | # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2 |
| 108 | # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585] |
| 109 | # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2 |
bart | c521406 | 2012-01-11 11:34:23 +0000 | [diff] [blame] | 110 | # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3 |
bart | 8503744 | 2011-11-22 14:41:31 +0000 | [diff] [blame] | 111 | # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) |
| 112 | # OS/X 10.7: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) |
| 113 | # Clang: clang version 2.9 (tags/RELEASE_29/final) |
bart | 048081f | 2012-06-17 05:53:02 +0000 | [diff] [blame] | 114 | # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn) |
| 115 | # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523 |
sewardj | a8ca2c5 | 2011-09-29 18:18:37 +0000 | [diff] [blame] | 116 | # |
bart | c521406 | 2012-01-11 11:34:23 +0000 | [diff] [blame] | 117 | [ |
bart | 048081f | 2012-06-17 05:53:02 +0000 | [diff] [blame] | 118 | if test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ; then |
| 119 | is_clang="clang" |
| 120 | # Don't use -dumpversion with clang: it will always produce "4.2.1". |
| 121 | gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'` |
florian | 3d9368e | 2013-10-04 21:12:17 +0000 | [diff] [blame] | 122 | CFLAGS="$CFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign" |
| 123 | CXXFLAGS="$CXXFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign" |
bart | 048081f | 2012-06-17 05:53:02 +0000 | [diff] [blame] | 124 | else |
| 125 | is_clang="notclang" |
| 126 | gcc_version=`${CC} -dumpversion 2>/dev/null` |
| 127 | if test "x$gcc_version" = x; then |
| 128 | gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'` |
| 129 | fi |
sewardj | 3ab7b66 | 2011-09-29 17:30:13 +0000 | [diff] [blame] | 130 | fi |
bart | 048081f | 2012-06-17 05:53:02 +0000 | [diff] [blame] | 131 | ] |
florian | 3d9368e | 2013-10-04 21:12:17 +0000 | [diff] [blame] | 132 | AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang) |
sewardj | 3ab7b66 | 2011-09-29 17:30:13 +0000 | [diff] [blame] | 133 | |
| 134 | case "${is_clang}-${gcc_version}" in |
| 135 | notclang-3.*) |
| 136 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 137 | ;; |
| 138 | notclang-4.*) |
| 139 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 140 | ;; |
sewardj | ae284e5 | 2012-08-02 18:25:04 +0000 | [diff] [blame] | 141 | clang-2.9|clang-3.*|clang-4.*) |
sewardj | 3ab7b66 | 2011-09-29 17:30:13 +0000 | [diff] [blame] | 142 | AC_MSG_RESULT([ok (clang-${gcc_version})]) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 143 | ;; |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 144 | *) |
sewardj | 3ab7b66 | 2011-09-29 17:30:13 +0000 | [diff] [blame] | 145 | AC_MSG_RESULT([no (${gcc_version})]) |
| 146 | AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9]) |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 147 | ;; |
| 148 | esac |
| 149 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 150 | #---------------------------------------------------------------------------- |
| 151 | # Arch/OS/platform tests. |
| 152 | #---------------------------------------------------------------------------- |
| 153 | # We create a number of arch/OS/platform-related variables. We prefix them |
| 154 | # all with "VGCONF_" which indicates that they are defined at |
| 155 | # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_* |
| 156 | # variables used when compiling C files. |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 157 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 158 | AC_CANONICAL_HOST |
| 159 | |
| 160 | AC_MSG_CHECKING([for a supported CPU]) |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 161 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 162 | # ARCH_MAX reflects the most that this CPU can do: for example if it |
| 163 | # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32. |
| 164 | # Ditto for amd64. It is used for more configuration below, but is not used |
| 165 | # outside this file. |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 166 | # |
| 167 | # Power PC returns powerpc for Big Endian. This was not changed when Little |
| 168 | # Endian support was added to the 64-bit architecture. The 64-bit Little |
| 169 | # Endian systems explicitly state le in the host_cpu. For clarity in the |
| 170 | # Valgrind code, the ARCH_MAX name will state LE or BE for the endianess of |
| 171 | # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC. |
| 172 | # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either |
| 173 | # Endianess. The name PPC64 or ppc64 to 64-bit systems of either Endianess. |
| 174 | # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big |
| 175 | # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are |
| 176 | # Little Endian. |
| 177 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 178 | case "${host_cpu}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 179 | i?86) |
| 180 | AC_MSG_RESULT([ok (${host_cpu})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 181 | ARCH_MAX="x86" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 182 | ;; |
| 183 | |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 184 | x86_64) |
| 185 | AC_MSG_RESULT([ok (${host_cpu})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 186 | ARCH_MAX="amd64" |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 187 | ;; |
| 188 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 189 | powerpc64) |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 190 | # this only referrs to 64-bit Big Endian |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 191 | AC_MSG_RESULT([ok (${host_cpu})]) |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 192 | ARCH_MAX="ppc64be" |
| 193 | ;; |
| 194 | |
| 195 | powerpc64le) |
| 196 | # this only referrs to 64-bit Little Endian |
| 197 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 198 | ARCH_MAX="ppc64le" |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 199 | ;; |
| 200 | |
| 201 | powerpc) |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 202 | # On Linux this means only a 32-bit capable CPU. |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 203 | AC_MSG_RESULT([ok (${host_cpu})]) |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 204 | ARCH_MAX="ppc32" |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 205 | ;; |
| 206 | |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 207 | s390x) |
| 208 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 209 | ARCH_MAX="s390x" |
| 210 | ;; |
| 211 | |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 212 | armv7*) |
| 213 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 214 | ARCH_MAX="arm" |
| 215 | ;; |
| 216 | |
sewardj | f0c1250 | 2014-01-12 12:54:00 +0000 | [diff] [blame] | 217 | aarch64*) |
| 218 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 219 | ARCH_MAX="arm64" |
| 220 | ;; |
| 221 | |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 222 | mips) |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 223 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 224 | ARCH_MAX="mips32" |
| 225 | ;; |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 226 | |
| 227 | mipsel) |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 228 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 229 | ARCH_MAX="mips32" |
| 230 | ;; |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 231 | |
| 232 | mipsisa32r2) |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 233 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 234 | ARCH_MAX="mips32" |
| 235 | ;; |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 236 | |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 237 | mips64*) |
| 238 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 239 | ARCH_MAX="mips64" |
| 240 | ;; |
| 241 | |
| 242 | mipsisa64*) |
| 243 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 244 | ARCH_MAX="mips64" |
| 245 | ;; |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 246 | *) |
| 247 | AC_MSG_RESULT([no (${host_cpu})]) |
nethercote | 81d5c66 | 2004-10-13 13:18:51 +0000 | [diff] [blame] | 248 | AC_MSG_ERROR([Unsupported host architecture. Sorry]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 249 | ;; |
| 250 | esac |
| 251 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 252 | #---------------------------------------------------------------------------- |
| 253 | |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 254 | # Sometimes it's convenient to subvert the bi-arch build system and |
| 255 | # just have a single build even though the underlying platform is |
| 256 | # capable of both. Hence handle --enable-only64bit and |
| 257 | # --enable-only32bit. Complain if both are issued :-) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 258 | # [Actually, if either of these options are used, I think both get built, |
| 259 | # but only one gets installed. So if you use an in-place build, both can be |
| 260 | # used. --njn] |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 261 | |
| 262 | # Check if a 64-bit only build has been requested |
| 263 | AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit, |
| 264 | [AC_ARG_ENABLE(only64bit, |
| 265 | [ --enable-only64bit do a 64-bit only build], |
| 266 | [vg_cv_only64bit=$enableval], |
| 267 | [vg_cv_only64bit=no])]) |
| 268 | |
| 269 | # Check if a 32-bit only build has been requested |
| 270 | AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit, |
| 271 | [AC_ARG_ENABLE(only32bit, |
| 272 | [ --enable-only32bit do a 32-bit only build], |
| 273 | [vg_cv_only32bit=$enableval], |
| 274 | [vg_cv_only32bit=no])]) |
| 275 | |
| 276 | # Stay sane |
| 277 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 278 | AC_MSG_ERROR( |
| 279 | [Nonsensical: both --enable-only64bit and --enable-only32bit.]) |
| 280 | fi |
| 281 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 282 | #---------------------------------------------------------------------------- |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 283 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 284 | # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to |
| 285 | # compilation of many C files via -VGO_$(VGCONF_OS) and |
| 286 | # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS). |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 287 | AC_MSG_CHECKING([for a supported OS]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 288 | AC_SUBST(VGCONF_OS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 289 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 290 | DEFAULT_SUPP="" |
| 291 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 292 | case "${host_os}" in |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 293 | *linux*) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 294 | AC_MSG_RESULT([ok (${host_os})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 295 | VGCONF_OS="linux" |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 296 | |
| 297 | # Ok, this is linux. Check the kernel version |
| 298 | AC_MSG_CHECKING([for the kernel version]) |
| 299 | |
| 300 | kernel=`uname -r` |
| 301 | |
| 302 | case "${kernel}" in |
bart | 0419e51 | 2011-06-05 08:51:47 +0000 | [diff] [blame] | 303 | 2.6.*|3.*) |
bart | 2d6e6e7 | 2011-06-05 10:01:48 +0000 | [diff] [blame] | 304 | AC_MSG_RESULT([2.6.x/3.x family (${kernel})]) |
| 305 | 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] | 306 | ;; |
| 307 | |
| 308 | 2.4.*) |
| 309 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 310 | AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) |
| 311 | ;; |
| 312 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 313 | *) |
| 314 | AC_MSG_RESULT([unsupported (${kernel})]) |
nethercote | 4fa681f | 2004-11-08 17:51:39 +0000 | [diff] [blame] | 315 | AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 316 | ;; |
| 317 | esac |
| 318 | |
| 319 | ;; |
| 320 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 321 | *darwin*) |
| 322 | AC_MSG_RESULT([ok (${host_os})]) |
| 323 | VGCONF_OS="darwin" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 324 | AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5]) |
| 325 | AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6]) |
| 326 | AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7]) |
sewardj | ae284e5 | 2012-08-02 18:25:04 +0000 | [diff] [blame] | 327 | AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8]) |
sewardj | ec66ad5 | 2014-06-20 11:48:38 +0000 | [diff] [blame] | 328 | AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 329 | |
| 330 | AC_MSG_CHECKING([for the kernel version]) |
| 331 | kernel=`uname -r` |
| 332 | |
| 333 | # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin |
| 334 | # has only one relevant version, the OS version. The `uname` check |
| 335 | # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS |
sewardj | 731f9cf | 2011-09-21 08:43:08 +0000 | [diff] [blame] | 336 | # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard, |
| 337 | # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion), |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 338 | # 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] | 339 | # |
| 340 | # XXX: `uname -r` won't do the right thing for cross-compiles, but |
| 341 | # that's not a problem yet. |
sewardj | 731f9cf | 2011-09-21 08:43:08 +0000 | [diff] [blame] | 342 | # |
| 343 | # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work |
| 344 | # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0 |
| 345 | # on 10.6.8 and 10.7.1. Although tempted to delete the configure |
| 346 | # time support for 10.5 (the 9.* pattern just below), I'll leave it |
| 347 | # in for now, just in case anybody wants to give it a try. But I'm |
| 348 | # assuming that 3.7.0 is a Snow Leopard and Lion-only release. |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 349 | case "${kernel}" in |
| 350 | 9.*) |
| 351 | AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard]) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 352 | AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 353 | DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}" |
bart | 6ccda14 | 2009-07-23 07:37:32 +0000 | [diff] [blame] | 354 | DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 355 | ;; |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 356 | 10.*) |
| 357 | AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard]) |
| 358 | AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version]) |
| 359 | DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}" |
| 360 | DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" |
| 361 | ;; |
sewardj | 731f9cf | 2011-09-21 08:43:08 +0000 | [diff] [blame] | 362 | 11.*) |
| 363 | AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion]) |
| 364 | AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version]) |
sewardj | 731f9cf | 2011-09-21 08:43:08 +0000 | [diff] [blame] | 365 | DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}" |
| 366 | DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" |
| 367 | ;; |
sewardj | ae284e5 | 2012-08-02 18:25:04 +0000 | [diff] [blame] | 368 | 12.*) |
| 369 | AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion]) |
| 370 | AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version]) |
| 371 | DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}" |
| 372 | DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" |
| 373 | ;; |
sewardj | ec66ad5 | 2014-06-20 11:48:38 +0000 | [diff] [blame] | 374 | 13.*) |
| 375 | AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks]) |
| 376 | AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version]) |
| 377 | DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}" |
| 378 | DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" |
| 379 | ;; |
sewardj | 731f9cf | 2011-09-21 08:43:08 +0000 | [diff] [blame] | 380 | *) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 381 | AC_MSG_RESULT([unsupported (${kernel})]) |
sewardj | ec66ad5 | 2014-06-20 11:48:38 +0000 | [diff] [blame] | 382 | AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x and 13.x (Mac OS X 10.6/7/8/9)]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 383 | ;; |
| 384 | esac |
| 385 | ;; |
| 386 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 387 | *) |
| 388 | AC_MSG_RESULT([no (${host_os})]) |
njn | cc58cea | 2010-07-05 07:21:22 +0000 | [diff] [blame] | 389 | AC_MSG_ERROR([Valgrind is operating system specific. Sorry.]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 390 | ;; |
| 391 | esac |
| 392 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 393 | #---------------------------------------------------------------------------- |
| 394 | |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 395 | # If we are building on a 64 bit platform test to see if the system |
| 396 | # supports building 32 bit programs and disable 32 bit support if it |
| 397 | # does not support building 32 bit programs |
| 398 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 399 | case "$ARCH_MAX-$VGCONF_OS" in |
mjw | 676bf0d | 2014-08-27 18:29:34 +0000 | [diff] [blame] | 400 | amd64-linux|ppc64be-linux|arm64-linux) |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 401 | AC_MSG_CHECKING([for 32 bit build support]) |
| 402 | safe_CFLAGS=$CFLAGS |
| 403 | CFLAGS="-m32" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 404 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 405 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 406 | ]])], [ |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 407 | AC_MSG_RESULT([yes]) |
| 408 | ], [ |
| 409 | vg_cv_only64bit="yes" |
| 410 | AC_MSG_RESULT([no]) |
| 411 | ]) |
| 412 | CFLAGS=$safe_CFLAGS;; |
| 413 | esac |
| 414 | |
| 415 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 416 | AC_MSG_ERROR( |
| 417 | [--enable-only32bit was specified but system does not support 32 bit builds]) |
| 418 | fi |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 419 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 420 | #---------------------------------------------------------------------------- |
| 421 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 422 | # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By |
| 423 | # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64 |
| 424 | # machine, but --enable-only32bit has been requested, then ARCH_MAX (see |
| 425 | # above) will be "amd64" since that reflects the most that this cpu can do, |
| 426 | # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the |
| 427 | # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 428 | # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and |
| 429 | # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS). |
| 430 | AC_SUBST(VGCONF_ARCH_PRI) |
| 431 | |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 432 | # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86". |
| 433 | # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC) |
| 434 | # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target. |
| 435 | # It is empty if there is no secondary target. |
| 436 | AC_SUBST(VGCONF_ARCH_SEC) |
| 437 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 438 | # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX". |
| 439 | # The entire system, including regression and performance tests, will be |
| 440 | # built for this target. The "_CAPS" indicates that the name is in capital |
| 441 | # letters, and it also uses '_' rather than '-' as a separator, because it's |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 442 | # used to create various Makefile variables, which are all in caps by |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 443 | # convention and cannot contain '-' characters. This is in contrast to |
| 444 | # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 445 | AC_SUBST(VGCONF_PLATFORM_PRI_CAPS) |
| 446 | |
| 447 | # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one. |
| 448 | # Valgrind and tools will also be built for this target, but not the |
| 449 | # regression or performance tests. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 450 | # |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 451 | # By default, the primary arch is the same as the "max" arch, as commented |
| 452 | # above (at the definition of ARCH_MAX). We may choose to downgrade it in |
| 453 | # the big case statement just below here, in the case where we're building |
| 454 | # on a 64 bit machine but have been requested only to do a 32 bit build. |
| 455 | AC_SUBST(VGCONF_PLATFORM_SEC_CAPS) |
| 456 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 457 | AC_MSG_CHECKING([for a supported CPU/OS combination]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 458 | |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 459 | # NB. The load address for a given platform may be specified in more |
| 460 | # than one place, in some cases, depending on whether we're doing a biarch, |
| 461 | # 32-bit only or 64-bit only build. eg see case for amd64-linux below. |
| 462 | # Be careful to give consistent values in all subcases. Also, all four |
| 463 | # valt_load_addres_{pri,sec}_{norml,inner} values must always be set, |
| 464 | # even if it is to "0xUNSET". |
| 465 | # |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 466 | case "$ARCH_MAX-$VGCONF_OS" in |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 467 | x86-linux) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 468 | VGCONF_ARCH_PRI="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 469 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 470 | VGCONF_PLATFORM_PRI_CAPS="X86_LINUX" |
| 471 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 472 | valt_load_address_pri_norml="0x38000000" |
| 473 | valt_load_address_pri_inner="0x28000000" |
| 474 | valt_load_address_sec_norml="0xUNSET" |
| 475 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 476 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 477 | ;; |
| 478 | amd64-linux) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 479 | valt_load_address_sec_norml="0xUNSET" |
| 480 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 481 | if test x$vg_cv_only64bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 482 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 483 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 484 | VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX" |
| 485 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 486 | valt_load_address_pri_norml="0x38000000" |
| 487 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 488 | elif test x$vg_cv_only32bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 489 | VGCONF_ARCH_PRI="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 490 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 491 | VGCONF_PLATFORM_PRI_CAPS="X86_LINUX" |
| 492 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 493 | valt_load_address_pri_norml="0x38000000" |
| 494 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 495 | else |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 496 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 497 | VGCONF_ARCH_SEC="x86" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 498 | VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX" |
| 499 | VGCONF_PLATFORM_SEC_CAPS="X86_LINUX" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 500 | valt_load_address_pri_norml="0x38000000" |
| 501 | valt_load_address_pri_inner="0x28000000" |
| 502 | valt_load_address_sec_norml="0x38000000" |
| 503 | valt_load_address_sec_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 504 | fi |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 505 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 506 | ;; |
| 507 | ppc32-linux) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 508 | VGCONF_ARCH_PRI="ppc32" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 509 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 510 | VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX" |
| 511 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 512 | valt_load_address_pri_norml="0x38000000" |
| 513 | valt_load_address_pri_inner="0x28000000" |
| 514 | valt_load_address_sec_norml="0xUNSET" |
| 515 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 516 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 517 | ;; |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 518 | ppc64be-linux) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 519 | valt_load_address_sec_norml="0xUNSET" |
| 520 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 521 | if test x$vg_cv_only64bit = xyes; then |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 522 | VGCONF_ARCH_PRI="ppc64be" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 523 | VGCONF_ARCH_SEC="" |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 524 | VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 525 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 526 | valt_load_address_pri_norml="0x38000000" |
| 527 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 528 | elif test x$vg_cv_only32bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 529 | VGCONF_ARCH_PRI="ppc32" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 530 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 531 | VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX" |
| 532 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 533 | valt_load_address_pri_norml="0x38000000" |
| 534 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 535 | else |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 536 | VGCONF_ARCH_PRI="ppc64be" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 537 | VGCONF_ARCH_SEC="ppc32" |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 538 | VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 539 | VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 540 | valt_load_address_pri_norml="0x38000000" |
| 541 | valt_load_address_pri_inner="0x28000000" |
| 542 | valt_load_address_sec_norml="0x38000000" |
| 543 | valt_load_address_sec_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 544 | fi |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 545 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 546 | ;; |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 547 | ppc64le-linux) |
| 548 | # Little Endian is only supported on PPC64 |
| 549 | valt_load_address_sec_norml="0xUNSET" |
| 550 | valt_load_address_sec_inner="0xUNSET" |
| 551 | VGCONF_ARCH_PRI="ppc64le" |
| 552 | VGCONF_ARCH_SEC="" |
| 553 | VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX" |
| 554 | VGCONF_PLATFORM_SEC_CAPS="" |
| 555 | valt_load_address_pri_norml="0x38000000" |
| 556 | valt_load_address_pri_inner="0x28000000" |
| 557 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
| 558 | ;; |
njn | cc58cea | 2010-07-05 07:21:22 +0000 | [diff] [blame] | 559 | # Darwin gets identified as 32-bit even when it supports 64-bit. |
| 560 | # (Not sure why, possibly because 'uname' returns "i386"?) Just about |
| 561 | # all Macs support both 32-bit and 64-bit, so we just build both. If |
| 562 | # someone has a really old 32-bit only machine they can (hopefully?) |
| 563 | # build with --enable-only32bit. See bug 243362. |
| 564 | x86-darwin|amd64-darwin) |
| 565 | ARCH_MAX="amd64" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 566 | valt_load_address_sec_norml="0xUNSET" |
| 567 | valt_load_address_sec_inner="0xUNSET" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 568 | if test x$vg_cv_only64bit = xyes; then |
| 569 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 570 | VGCONF_ARCH_SEC="" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 571 | VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN" |
| 572 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 573 | valt_load_address_pri_norml="0x138000000" |
| 574 | valt_load_address_pri_inner="0x128000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 575 | elif test x$vg_cv_only32bit = xyes; then |
| 576 | VGCONF_ARCH_PRI="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 577 | VGCONF_ARCH_SEC="" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 578 | VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN" |
| 579 | VGCONF_PLATFORM_SEC_CAPS="" |
| 580 | VGCONF_ARCH_PRI_CAPS="x86" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 581 | valt_load_address_pri_norml="0x38000000" |
| 582 | valt_load_address_pri_inner="0x28000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 583 | else |
| 584 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 585 | VGCONF_ARCH_SEC="x86" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 586 | VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN" |
| 587 | VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 588 | valt_load_address_pri_norml="0x138000000" |
| 589 | valt_load_address_pri_inner="0x128000000" |
| 590 | valt_load_address_sec_norml="0x38000000" |
| 591 | valt_load_address_sec_inner="0x28000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 592 | fi |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 593 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
| 594 | ;; |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 595 | arm-linux) |
| 596 | VGCONF_ARCH_PRI="arm" |
| 597 | VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX" |
| 598 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 599 | valt_load_address_pri_norml="0x38000000" |
| 600 | valt_load_address_pri_inner="0x28000000" |
| 601 | valt_load_address_sec_norml="0xUNSET" |
| 602 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 603 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 604 | ;; |
sewardj | f0c1250 | 2014-01-12 12:54:00 +0000 | [diff] [blame] | 605 | arm64-linux) |
| 606 | valt_load_address_sec_norml="0xUNSET" |
| 607 | valt_load_address_sec_inner="0xUNSET" |
| 608 | if test x$vg_cv_only64bit = xyes; then |
| 609 | VGCONF_ARCH_PRI="arm64" |
| 610 | VGCONF_ARCH_SEC="" |
| 611 | VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX" |
| 612 | VGCONF_PLATFORM_SEC_CAPS="" |
| 613 | valt_load_address_pri_norml="0x38000000" |
| 614 | valt_load_address_pri_inner="0x28000000" |
| 615 | elif test x$vg_cv_only32bit = xyes; then |
| 616 | VGCONF_ARCH_PRI="arm" |
| 617 | VGCONF_ARCH_SEC="" |
| 618 | VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX" |
| 619 | VGCONF_PLATFORM_SEC_CAPS="" |
| 620 | valt_load_address_pri_norml="0x38000000" |
| 621 | valt_load_address_pri_inner="0x28000000" |
| 622 | else |
| 623 | VGCONF_ARCH_PRI="arm64" |
| 624 | VGCONF_ARCH_SEC="arm" |
| 625 | VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX" |
| 626 | VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX" |
| 627 | valt_load_address_pri_norml="0x38000000" |
| 628 | valt_load_address_pri_inner="0x28000000" |
| 629 | valt_load_address_sec_norml="0x38000000" |
| 630 | valt_load_address_sec_inner="0x28000000" |
| 631 | fi |
| 632 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
| 633 | ;; |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 634 | s390x-linux) |
| 635 | VGCONF_ARCH_PRI="s390x" |
| 636 | VGCONF_ARCH_SEC="" |
| 637 | VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX" |
| 638 | VGCONF_PLATFORM_SEC_CAPS="" |
cborntra | f4c4690 | 2013-10-23 16:23:30 +0000 | [diff] [blame] | 639 | # To improve branch prediction hit rate we want to have |
| 640 | # the generated code close to valgrind (host) code |
| 641 | valt_load_address_pri_norml="0x800000000" |
| 642 | valt_load_address_pri_inner="0x810000000" |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 643 | valt_load_address_sec_norml="0xUNSET" |
| 644 | valt_load_address_sec_inner="0xUNSET" |
| 645 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
| 646 | ;; |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 647 | mips32-linux) |
| 648 | VGCONF_ARCH_PRI="mips32" |
| 649 | VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX" |
| 650 | VGCONF_PLATFORM_SEC_CAPS="" |
| 651 | valt_load_address_pri_norml="0x38000000" |
| 652 | valt_load_address_pri_inner="0x28000000" |
| 653 | valt_load_address_sec_norml="0xUNSET" |
| 654 | valt_load_address_sec_inner="0xUNSET" |
| 655 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 656 | ;; |
| 657 | mips64-linux) |
| 658 | VGCONF_ARCH_PRI="mips64" |
| 659 | VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX" |
| 660 | VGCONF_PLATFORM_SEC_CAPS="" |
| 661 | valt_load_address_pri_norml="0x38000000" |
| 662 | valt_load_address_pri_inner="0x28000000" |
| 663 | valt_load_address_sec_norml="0xUNSET" |
| 664 | valt_load_address_sec_inner="0xUNSET" |
| 665 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 666 | ;; |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 667 | *) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 668 | VGCONF_ARCH_PRI="unknown" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 669 | VGCONF_ARCH_SEC="unknown" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 670 | VGCONF_PLATFORM_PRI_CAPS="UNKNOWN" |
| 671 | VGCONF_PLATFORM_SEC_CAPS="UNKNOWN" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 672 | valt_load_address_pri_norml="0xUNSET" |
| 673 | valt_load_address_pri_inner="0xUNSET" |
| 674 | valt_load_address_sec_norml="0xUNSET" |
| 675 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 676 | AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 677 | AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 678 | ;; |
| 679 | esac |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 680 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 681 | #---------------------------------------------------------------------------- |
njn | a454ec0 | 2009-01-19 03:16:59 +0000 | [diff] [blame] | 682 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 683 | # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become |
| 684 | # defined. |
| 685 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86, |
| 686 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 687 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \ |
| 688 | -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 689 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 690 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64, |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 691 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
| 692 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 693 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32, |
| 694 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 695 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 696 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64, |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 697 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \ |
| 698 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX ) |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 699 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM, |
sewardj | f0c1250 | 2014-01-12 12:54:00 +0000 | [diff] [blame] | 700 | test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ |
| 701 | -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX ) |
| 702 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64, |
| 703 | test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX ) |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 704 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X, |
| 705 | test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ) |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 706 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32, |
| 707 | test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX ) |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 708 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64, |
| 709 | test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 710 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 711 | # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these |
| 712 | # become defined. |
| 713 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX, |
| 714 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
| 715 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX) |
| 716 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX, |
| 717 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX) |
| 718 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX, |
| 719 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
| 720 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX) |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 721 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX, |
| 722 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX) |
| 723 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX, |
| 724 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX) |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 725 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX, |
sewardj | f0c1250 | 2014-01-12 12:54:00 +0000 | [diff] [blame] | 726 | test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ |
| 727 | -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX) |
| 728 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX, |
| 729 | test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX) |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 730 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX, |
| 731 | test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \ |
| 732 | -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX) |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 733 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX, |
| 734 | test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX) |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 735 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX, |
| 736 | test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 737 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN, |
| 738 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 739 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN) |
| 740 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN, |
| 741 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN) |
| 742 | |
| 743 | |
sewardj | 72a2d80 | 2010-07-29 05:24:20 +0000 | [diff] [blame] | 744 | # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined. |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 745 | # Relies on the assumption that the primary and secondary targets are |
| 746 | # for the same OS, so therefore only necessary to test the primary. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 747 | AM_CONDITIONAL(VGCONF_OS_IS_LINUX, |
| 748 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
| 749 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
| 750 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
carll | cae0cc2 | 2014-08-07 23:17:29 +0000 | [diff] [blame] | 751 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \ |
| 752 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \ |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 753 | -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ |
sewardj | f0c1250 | 2014-01-12 12:54:00 +0000 | [diff] [blame] | 754 | -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \ |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 755 | -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \ |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 756 | -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ |
| 757 | -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 758 | AM_CONDITIONAL(VGCONF_OS_IS_DARWIN, |
| 759 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 760 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 761 | |
| 762 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 763 | # Sometimes, in the Makefile.am files, it's useful to know whether or not |
| 764 | # there is a secondary target. |
njn | ee0c66a | 2009-06-01 23:59:20 +0000 | [diff] [blame] | 765 | AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC, |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 766 | test x$VGCONF_PLATFORM_SEC_CAPS != x) |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 767 | |
philippe | f32cbe8 | 2012-05-18 16:48:20 +0000 | [diff] [blame] | 768 | dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a |
| 769 | dnl fallback definition |
| 770 | dnl The macro is courtesy of Dave Hart: |
| 771 | dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html |
| 772 | m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [ |
| 773 | if test -z "$$1_TRUE"; then : |
| 774 | m4_n([$2])[]dnl |
| 775 | m4_ifval([$3], |
| 776 | [else |
| 777 | $3 |
| 778 | ])dnl |
| 779 | fi[]dnl |
| 780 | ])]) |
tom | b637bad | 2005-11-08 12:28:35 +0000 | [diff] [blame] | 781 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 782 | #---------------------------------------------------------------------------- |
| 783 | # Inner Valgrind? |
| 784 | #---------------------------------------------------------------------------- |
| 785 | |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 786 | # Check if this should be built as an inner Valgrind, to be run within |
| 787 | # another Valgrind. Choose the load address accordingly. |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 788 | AC_SUBST(VALT_LOAD_ADDRESS_PRI) |
| 789 | AC_SUBST(VALT_LOAD_ADDRESS_SEC) |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 790 | AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner, |
| 791 | [AC_ARG_ENABLE(inner, |
| 792 | [ --enable-inner enables self-hosting], |
| 793 | [vg_cv_inner=$enableval], |
| 794 | [vg_cv_inner=no])]) |
| 795 | if test "$vg_cv_inner" = yes; then |
| 796 | AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind]) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 797 | VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner |
| 798 | VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 799 | else |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 800 | VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml |
| 801 | VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 802 | fi |
| 803 | |
| 804 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 805 | #---------------------------------------------------------------------------- |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 806 | # Define MIPS_PAGE_SHIFT (--with-pagesize) |
| 807 | #---------------------------------------------------------------------------- |
| 808 | AC_ARG_WITH(pagesize, |
| 809 | [ --with-pagesize= override detected page size (4, 16 or 64)], |
| 810 | [psize=$withval], |
| 811 | [psize=0] |
| 812 | ) |
| 813 | |
| 814 | if test "$psize" = "0"; then |
| 815 | psizer=`getconf PAGESIZE` |
florian | 62477d2 | 2014-02-22 13:24:15 +0000 | [diff] [blame] | 816 | psize=$((${psizer}/1024)) |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 817 | fi |
| 818 | |
| 819 | if test "$psize" = "4"; then |
| 820 | AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured page size 4k]) |
| 821 | elif test "$psize" = "16"; then |
| 822 | AC_DEFINE([MIPS_PAGE_SHIFT], 14, [configured page size 16k]) |
| 823 | elif test "$psize" = "64"; then |
| 824 | AC_DEFINE([MIPS_PAGE_SHIFT], 16, [configured page size 64k]) |
| 825 | else |
| 826 | AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured default page size 4k]) |
| 827 | fi |
| 828 | AC_MSG_RESULT([checking for Pagesize... ${psize}k]) |
| 829 | |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 830 | |
| 831 | #---------------------------------------------------------------------------- |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 832 | # Extra fine-tuning of installation directories |
| 833 | #---------------------------------------------------------------------------- |
| 834 | AC_ARG_WITH(tmpdir, |
| 835 | [ --with-tmpdir=PATH Specify path for temporary files], |
| 836 | tmpdir="$withval", |
| 837 | tmpdir="/tmp") |
| 838 | AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory]) |
florian | 7fd2ec3 | 2014-06-21 20:25:30 +0000 | [diff] [blame] | 839 | AC_SUBST(VG_TMPDIR, [$tmpdir]) |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 840 | |
sewardj | 0ba37c9 | 2011-07-12 11:46:24 +0000 | [diff] [blame] | 841 | |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 842 | #---------------------------------------------------------------------------- |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 843 | # Libc and suppressions |
| 844 | #---------------------------------------------------------------------------- |
| 845 | # This variable will collect the suppression files to be used. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 846 | AC_SUBST(DEFAULT_SUPP) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 847 | |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 848 | AC_CHECK_HEADER([features.h]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 849 | |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 850 | if test x$ac_cv_header_features_h = xyes; then |
| 851 | rm -f conftest.$ac_ext |
| 852 | cat <<_ACEOF >conftest.$ac_ext |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 853 | #include <features.h> |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 854 | #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) |
| 855 | glibc version is: __GLIBC__ __GLIBC_MINOR__ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 856 | #endif |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 857 | _ACEOF |
| 858 | GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`" |
| 859 | fi |
bart | b7c3f08 | 2010-05-13 06:32:36 +0000 | [diff] [blame] | 860 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 861 | # not really a version check |
| 862 | AC_EGREP_CPP([DARWIN_LIBC], [ |
| 863 | #include <sys/cdefs.h> |
| 864 | #if defined(__DARWIN_VERS_1050) |
| 865 | DARWIN_LIBC |
| 866 | #endif |
| 867 | ], |
| 868 | GLIBC_VERSION="darwin") |
| 869 | |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 870 | # not really a version check |
| 871 | AC_EGREP_CPP([BIONIC_LIBC], [ |
| 872 | #if defined(__ANDROID__) |
| 873 | BIONIC_LIBC |
| 874 | #endif |
| 875 | ], |
| 876 | GLIBC_VERSION="bionic") |
| 877 | |
| 878 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 879 | AC_MSG_CHECKING([the GLIBC_VERSION version]) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 880 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 881 | case "${GLIBC_VERSION}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 882 | 2.2) |
| 883 | AC_MSG_RESULT(2.2 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 884 | 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] | 885 | DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}" |
| 886 | DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 887 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 888 | ;; |
| 889 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 890 | 2.3) |
| 891 | AC_MSG_RESULT(2.3 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 892 | 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] | 893 | DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 894 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 895 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 896 | ;; |
| 897 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 898 | 2.4) |
| 899 | AC_MSG_RESULT(2.4 family) |
| 900 | 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] | 901 | DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 902 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 903 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 904 | ;; |
| 905 | |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 906 | 2.5) |
| 907 | AC_MSG_RESULT(2.5 family) |
| 908 | 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] | 909 | DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 910 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 911 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 912 | ;; |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 913 | 2.6) |
| 914 | AC_MSG_RESULT(2.6 family) |
| 915 | 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] | 916 | DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 917 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 918 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 919 | ;; |
| 920 | 2.7) |
| 921 | AC_MSG_RESULT(2.7 family) |
| 922 | 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] | 923 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 924 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 925 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 926 | ;; |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 927 | 2.8) |
| 928 | AC_MSG_RESULT(2.8 family) |
dirk | eb939fc | 2008-04-27 20:38:47 +0000 | [diff] [blame] | 929 | 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] | 930 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 931 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 932 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 933 | ;; |
dirk | d2e31eb | 2008-11-19 23:58:36 +0000 | [diff] [blame] | 934 | 2.9) |
| 935 | AC_MSG_RESULT(2.9 family) |
| 936 | AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x]) |
| 937 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 938 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 939 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 940 | ;; |
sewardj | 5d425e8 | 2009-02-01 19:01:11 +0000 | [diff] [blame] | 941 | 2.10) |
| 942 | AC_MSG_RESULT(2.10 family) |
| 943 | AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x]) |
| 944 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 945 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 946 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 947 | ;; |
bart | 0fac7ff | 2009-11-15 19:11:19 +0000 | [diff] [blame] | 948 | 2.11) |
| 949 | AC_MSG_RESULT(2.11 family) |
| 950 | AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x]) |
| 951 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 952 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 953 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
bart | b7c3f08 | 2010-05-13 06:32:36 +0000 | [diff] [blame] | 954 | ;; |
| 955 | 2.12) |
| 956 | AC_MSG_RESULT(2.12 family) |
| 957 | AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x]) |
| 958 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 959 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 960 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
bart | 0fac7ff | 2009-11-15 19:11:19 +0000 | [diff] [blame] | 961 | ;; |
tom | ebd619b | 2011-02-10 09:09:09 +0000 | [diff] [blame] | 962 | 2.13) |
| 963 | AC_MSG_RESULT(2.13 family) |
| 964 | AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x]) |
| 965 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 966 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 967 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 968 | ;; |
tom | cc07741 | 2011-06-07 21:52:26 +0000 | [diff] [blame] | 969 | 2.14) |
| 970 | AC_MSG_RESULT(2.14 family) |
| 971 | AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x]) |
| 972 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 973 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 974 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 975 | ;; |
dirk | e75fdeb | 2011-12-29 08:24:55 +0000 | [diff] [blame] | 976 | 2.15) |
| 977 | AC_MSG_RESULT(2.15 family) |
| 978 | AC_DEFINE([GLIBC_2_15], 1, [Define to 1 if you're using glibc 2.15.x]) |
| 979 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 980 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 981 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 982 | ;; |
sewardj | c7188be | 2012-07-14 10:07:06 +0000 | [diff] [blame] | 983 | 2.16) |
| 984 | AC_MSG_RESULT(2.16 family) |
| 985 | AC_DEFINE([GLIBC_2_16], 1, [Define to 1 if you're using glibc 2.16.x]) |
| 986 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 987 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 988 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 989 | ;; |
tom | 3781ac1 | 2013-01-14 09:48:49 +0000 | [diff] [blame] | 990 | 2.17) |
| 991 | AC_MSG_RESULT(2.17 family) |
| 992 | AC_DEFINE([GLIBC_2_17], 1, [Define to 1 if you're using glibc 2.17.x]) |
| 993 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 994 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 995 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 996 | ;; |
mjw | 317f01b | 2013-08-21 14:47:52 +0000 | [diff] [blame] | 997 | 2.18) |
| 998 | AC_MSG_RESULT(2.18 family) |
| 999 | AC_DEFINE([GLIBC_2_18], 1, [Define to 1 if you're using glibc 2.18.x]) |
| 1000 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 1001 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 1002 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 1003 | ;; |
mjw | 28ae199 | 2014-02-21 21:13:55 +0000 | [diff] [blame] | 1004 | 2.19) |
| 1005 | AC_MSG_RESULT(2.19 family) |
| 1006 | AC_DEFINE([GLIBC_2_19], 1, [Define to 1 if you're using glibc 2.19.x]) |
| 1007 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 1008 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 1009 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 1010 | ;; |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 1011 | darwin) |
| 1012 | AC_MSG_RESULT(Darwin) |
| 1013 | AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin]) |
| 1014 | # DEFAULT_SUPP set by kernel version check above. |
| 1015 | ;; |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 1016 | bionic) |
| 1017 | AC_MSG_RESULT(Bionic) |
| 1018 | AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic]) |
| 1019 | DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}" |
| 1020 | ;; |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 1021 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1022 | *) |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 1023 | AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}]) |
mjw | 28ae199 | 2014-02-21 21:13:55 +0000 | [diff] [blame] | 1024 | AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.19]) |
| 1025 | AC_MSG_ERROR([or Darwin or Bionic libc]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1026 | ;; |
| 1027 | esac |
| 1028 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 1029 | AC_SUBST(GLIBC_VERSION) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1030 | |
sewardj | 414f358 | 2008-07-18 20:46:00 +0000 | [diff] [blame] | 1031 | |
| 1032 | # Add default suppressions for the X client libraries. Make no |
| 1033 | # attempt to detect whether such libraries are installed on the |
| 1034 | # build machine (or even if any X facilities are present); just |
| 1035 | # add the suppressions antidisirregardless. |
| 1036 | DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}" |
| 1037 | DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 1038 | |
sewardj | d2f95a0 | 2011-05-11 16:04:28 +0000 | [diff] [blame] | 1039 | # Add glibc and X11 suppressions for exp-sgcheck |
| 1040 | DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}" |
sewardj | 5744c02 | 2008-10-19 18:58:13 +0000 | [diff] [blame] | 1041 | |
sewardj | 2e10a68 | 2003-04-07 19:36:41 +0000 | [diff] [blame] | 1042 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1043 | #---------------------------------------------------------------------------- |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 1044 | # Platform variants? |
| 1045 | #---------------------------------------------------------------------------- |
| 1046 | |
| 1047 | # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough. |
| 1048 | # But there are times where we need a bit more control. The motivating |
philippe | 5d5dd8e | 2012-08-05 00:08:25 +0000 | [diff] [blame] | 1049 | # and currently only case is Android: this is almost identical to |
dejanj | 9c6b05d | 2013-12-27 09:06:55 +0000 | [diff] [blame] | 1050 | # {x86,arm,mips}-linux, but not quite. So this introduces the concept of |
| 1051 | # platform variant tags, which get passed in the compile as |
| 1052 | # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition. |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 1053 | # |
| 1054 | # In almost all cases, the <variant> bit is "vanilla". But for Android |
| 1055 | # it is "android" instead. |
| 1056 | # |
| 1057 | # Consequently (eg), plain arm-linux would build with |
| 1058 | # |
| 1059 | # -DVGP_arm_linux -DVGPV_arm_linux_vanilla |
| 1060 | # |
| 1061 | # whilst an Android build would have |
| 1062 | # |
| 1063 | # -DVGP_arm_linux -DVGPV_arm_linux_android |
| 1064 | # |
philippe | 5d5dd8e | 2012-08-05 00:08:25 +0000 | [diff] [blame] | 1065 | # Same for x86. The setup of the platform variant is pushed relatively far |
| 1066 | # down this file in order that we can inspect any of the variables set above. |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 1067 | |
| 1068 | # In the normal case .. |
| 1069 | VGCONF_PLATVARIANT="vanilla" |
| 1070 | |
philippe | 5d5dd8e | 2012-08-05 00:08:25 +0000 | [diff] [blame] | 1071 | # Android ? |
| 1072 | if test "$GLIBC_VERSION" = "bionic"; |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 1073 | then |
| 1074 | VGCONF_PLATVARIANT="android" |
| 1075 | fi |
| 1076 | |
| 1077 | AC_SUBST(VGCONF_PLATVARIANT) |
| 1078 | |
| 1079 | |
| 1080 | # FIXME: do we also want to define automake variables |
| 1081 | # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently) |
| 1082 | # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE, |
| 1083 | # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough |
| 1084 | # do that. Problem is that we can't do and-ing in Makefile.am's, but |
| 1085 | # that's what we'd need to do to use this, since what we'd want to write |
| 1086 | # is something like |
| 1087 | # |
| 1088 | # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID |
| 1089 | # |
sewardj | 0ba37c9 | 2011-07-12 11:46:24 +0000 | [diff] [blame] | 1090 | # Hmm. Can't think of a nice clean solution to this. |
| 1091 | |
| 1092 | AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA, |
| 1093 | test x$VGCONF_PLATVARIANT = xvanilla) |
| 1094 | AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID, |
| 1095 | test x$VGCONF_PLATVARIANT = xandroid) |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 1096 | |
| 1097 | |
| 1098 | #---------------------------------------------------------------------------- |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1099 | # Checking for various library functions and other definitions |
| 1100 | #---------------------------------------------------------------------------- |
| 1101 | |
florian | 28db75c | 2012-12-08 19:26:03 +0000 | [diff] [blame] | 1102 | # Check for AT_FDCWD |
| 1103 | |
| 1104 | AC_MSG_CHECKING([for AT_FDCWD]) |
| 1105 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1106 | #define _GNU_SOURCE |
| 1107 | #include <fcntl.h> |
| 1108 | #include <unistd.h> |
| 1109 | ]], [[ |
| 1110 | int a = AT_FDCWD; |
| 1111 | ]])], [ |
| 1112 | ac_have_at_fdcwd=yes |
| 1113 | AC_MSG_RESULT([yes]) |
| 1114 | ], [ |
| 1115 | ac_have_at_fdcwd=no |
florian | 28db75c | 2012-12-08 19:26:03 +0000 | [diff] [blame] | 1116 | AC_MSG_RESULT([no]) |
| 1117 | ]) |
| 1118 | |
| 1119 | AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes]) |
| 1120 | |
sewardj | 24cf8df | 2012-12-14 10:30:57 +0000 | [diff] [blame] | 1121 | # Check for stpncpy function definition in string.h |
| 1122 | # This explicitly checks with _GNU_SOURCE defined since that is also |
| 1123 | # used in the test case (some systems might define it without anyway |
| 1124 | # since stpncpy is part of The Open Group Base Specifications Issue 7 |
| 1125 | # IEEE Std 1003.1-2008. |
| 1126 | AC_MSG_CHECKING([for stpncpy]) |
| 1127 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 1128 | #define _GNU_SOURCE |
| 1129 | #include <string.h> |
| 1130 | ]], [[ |
| 1131 | char *d; |
| 1132 | char *s; |
| 1133 | size_t n = 0; |
| 1134 | char *r = stpncpy(d, s, n); |
| 1135 | ]])], [ |
| 1136 | ac_have_gnu_stpncpy=yes |
| 1137 | AC_MSG_RESULT([yes]) |
| 1138 | ], [ |
| 1139 | ac_have_gnu_stpncpy=no |
| 1140 | AC_MSG_RESULT([no]) |
| 1141 | ]) |
| 1142 | |
| 1143 | AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes]) |
florian | 28db75c | 2012-12-08 19:26:03 +0000 | [diff] [blame] | 1144 | |
philippe | 4e98f7c | 2013-08-03 20:34:58 +0000 | [diff] [blame] | 1145 | # Check for PTRACE_GETREGS |
| 1146 | |
| 1147 | AC_MSG_CHECKING([for PTRACE_GETREGS]) |
| 1148 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1149 | #include <stddef.h> |
| 1150 | #include <sys/ptrace.h> |
| 1151 | #include <sys/user.h> |
| 1152 | ]], [[ |
| 1153 | void *p; |
| 1154 | long res = ptrace (PTRACE_GETREGS, 0, p, p); |
| 1155 | ]])], [ |
| 1156 | AC_MSG_RESULT([yes]) |
| 1157 | AC_DEFINE([HAVE_PTRACE_GETREGS], 1, |
| 1158 | [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.]) |
| 1159 | ], [ |
| 1160 | AC_MSG_RESULT([no]) |
| 1161 | ]) |
| 1162 | |
| 1163 | |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 1164 | # Check for CLOCK_MONOTONIC |
| 1165 | |
| 1166 | AC_MSG_CHECKING([for CLOCK_MONOTONIC]) |
| 1167 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1168 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 1169 | #include <time.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1170 | ]], [[ |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 1171 | struct timespec t; |
| 1172 | clock_gettime(CLOCK_MONOTONIC, &t); |
| 1173 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1174 | ]])], [ |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 1175 | AC_MSG_RESULT([yes]) |
| 1176 | AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1, |
| 1177 | [Define to 1 if you have the `CLOCK_MONOTONIC' constant.]) |
| 1178 | ], [ |
| 1179 | AC_MSG_RESULT([no]) |
| 1180 | ]) |
| 1181 | |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1182 | |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 1183 | # Check for PTHREAD_RWLOCK_T |
| 1184 | |
| 1185 | AC_MSG_CHECKING([for pthread_rwlock_t]) |
| 1186 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1187 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 1188 | #define _GNU_SOURCE |
| 1189 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1190 | ]], [[ |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 1191 | pthread_rwlock_t rwl; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1192 | ]])], [ |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 1193 | AC_MSG_RESULT([yes]) |
| 1194 | AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1, |
| 1195 | [Define to 1 if you have the `pthread_rwlock_t' type.]) |
| 1196 | ], [ |
| 1197 | AC_MSG_RESULT([no]) |
| 1198 | ]) |
| 1199 | |
| 1200 | |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1201 | # Check for PTHREAD_MUTEX_ADAPTIVE_NP |
| 1202 | |
| 1203 | AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP]) |
| 1204 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1205 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1206 | #define _GNU_SOURCE |
| 1207 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1208 | ]], [[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1209 | return (PTHREAD_MUTEX_ADAPTIVE_NP); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1210 | ]])], [ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1211 | AC_MSG_RESULT([yes]) |
| 1212 | AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1, |
| 1213 | [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.]) |
| 1214 | ], [ |
| 1215 | AC_MSG_RESULT([no]) |
| 1216 | ]) |
| 1217 | |
| 1218 | |
| 1219 | # Check for PTHREAD_MUTEX_ERRORCHECK_NP |
| 1220 | |
| 1221 | AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP]) |
| 1222 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1223 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1224 | #define _GNU_SOURCE |
| 1225 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1226 | ]], [[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1227 | return (PTHREAD_MUTEX_ERRORCHECK_NP); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1228 | ]])], [ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1229 | AC_MSG_RESULT([yes]) |
| 1230 | AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1, |
| 1231 | [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.]) |
| 1232 | ], [ |
| 1233 | AC_MSG_RESULT([no]) |
| 1234 | ]) |
| 1235 | |
| 1236 | |
| 1237 | # Check for PTHREAD_MUTEX_RECURSIVE_NP |
| 1238 | |
| 1239 | AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP]) |
| 1240 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1241 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1242 | #define _GNU_SOURCE |
| 1243 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1244 | ]], [[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1245 | return (PTHREAD_MUTEX_RECURSIVE_NP); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1246 | ]])], [ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1247 | AC_MSG_RESULT([yes]) |
| 1248 | AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, |
| 1249 | [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.]) |
| 1250 | ], [ |
| 1251 | AC_MSG_RESULT([no]) |
| 1252 | ]) |
| 1253 | |
| 1254 | |
| 1255 | # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP |
| 1256 | |
| 1257 | AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP]) |
| 1258 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1259 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1260 | #define _GNU_SOURCE |
| 1261 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1262 | ]], [[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1263 | pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; |
| 1264 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1265 | ]])], [ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 1266 | AC_MSG_RESULT([yes]) |
| 1267 | AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1, |
| 1268 | [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.]) |
| 1269 | ], [ |
| 1270 | AC_MSG_RESULT([no]) |
| 1271 | ]) |
| 1272 | |
| 1273 | |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 1274 | # Check whether pthread_mutex_t has a member called __m_kind. |
| 1275 | |
bart | b11355c | 2010-04-29 16:37:26 +0000 | [diff] [blame] | 1276 | AC_CHECK_MEMBER([pthread_mutex_t.__m_kind], |
| 1277 | [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], |
| 1278 | 1, |
| 1279 | [Define to 1 if pthread_mutex_t has a member called __m_kind.]) |
| 1280 | ], |
| 1281 | [], |
| 1282 | [#include <pthread.h>]) |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 1283 | |
| 1284 | |
| 1285 | # Check whether pthread_mutex_t has a member called __data.__kind. |
| 1286 | |
bart | b11355c | 2010-04-29 16:37:26 +0000 | [diff] [blame] | 1287 | AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind], |
| 1288 | [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], |
| 1289 | 1, |
| 1290 | [Define to 1 if pthread_mutex_t has a member __data.__kind.]) |
| 1291 | ], |
| 1292 | [], |
| 1293 | [#include <pthread.h>]) |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 1294 | |
| 1295 | |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1296 | # does this compiler support -maltivec and does it have the include file |
| 1297 | # <altivec.h> ? |
| 1298 | |
| 1299 | AC_MSG_CHECKING([for Altivec]) |
| 1300 | |
| 1301 | safe_CFLAGS=$CFLAGS |
| 1302 | CFLAGS="-maltivec" |
| 1303 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1304 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1305 | #include <altivec.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1306 | ]], [[ |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1307 | vector unsigned int v; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1308 | ]])], [ |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1309 | ac_have_altivec=yes |
| 1310 | AC_MSG_RESULT([yes]) |
sewardj | f9fe602 | 2010-09-03 14:36:50 +0000 | [diff] [blame] | 1311 | AC_DEFINE([HAS_ALTIVEC], 1, |
sewardj | 6467a15 | 2010-09-03 14:02:22 +0000 | [diff] [blame] | 1312 | [Define to 1 if gcc/as can do Altivec.]) |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1313 | ], [ |
| 1314 | ac_have_altivec=no |
| 1315 | AC_MSG_RESULT([no]) |
| 1316 | ]) |
| 1317 | CFLAGS=$safe_CFLAGS |
| 1318 | |
sewardj | 0e342a0 | 2010-09-03 23:49:33 +0000 | [diff] [blame] | 1319 | AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes]) |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1320 | |
| 1321 | |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1322 | # Check that both: the compiler supports -mvsx and that the assembler |
| 1323 | # understands VSX instructions. If either of those doesn't work, |
| 1324 | # conclude that we can't do VSX. NOTE: basically this is a kludge |
| 1325 | # in that it conflates two things that should be separate -- whether |
| 1326 | # the compiler understands the flag vs whether the assembler |
| 1327 | # understands the opcodes. This really ought to be cleaned up |
| 1328 | # and done properly, like it is for x86/x86_64. |
| 1329 | |
| 1330 | AC_MSG_CHECKING([for VSX]) |
| 1331 | |
| 1332 | safe_CFLAGS=$CFLAGS |
| 1333 | CFLAGS="-mvsx" |
| 1334 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1335 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1336 | #include <altivec.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1337 | ]], [[ |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1338 | vector unsigned int v; |
sewardj | 9b80ebb | 2011-04-15 21:16:00 +0000 | [diff] [blame] | 1339 | __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc"); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1340 | ]])], [ |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1341 | ac_have_vsx=yes |
| 1342 | AC_MSG_RESULT([yes]) |
| 1343 | ], [ |
| 1344 | ac_have_vsx=no |
| 1345 | AC_MSG_RESULT([no]) |
| 1346 | ]) |
| 1347 | CFLAGS=$safe_CFLAGS |
| 1348 | |
| 1349 | AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes) |
| 1350 | |
sewardj | 4e1c191 | 2012-08-08 22:22:26 +0000 | [diff] [blame] | 1351 | |
sewardj | b0ccb4d | 2012-04-02 10:22:05 +0000 | [diff] [blame] | 1352 | AC_MSG_CHECKING([that assembler knows DFP]) |
| 1353 | |
| 1354 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1355 | ]], [[ |
| 1356 | __asm__ __volatile__("dadd 1, 2, 3"); |
sewardj | 4e1c191 | 2012-08-08 22:22:26 +0000 | [diff] [blame] | 1357 | __asm__ __volatile__("dcffix 1, 2"); |
sewardj | b0ccb4d | 2012-04-02 10:22:05 +0000 | [diff] [blame] | 1358 | ]])], [ |
| 1359 | ac_asm_have_dfp=yes |
| 1360 | AC_MSG_RESULT([yes]) |
| 1361 | ], [ |
| 1362 | ac_asm_have_dfp=no |
| 1363 | AC_MSG_RESULT([no]) |
| 1364 | ]) |
| 1365 | |
sewardj | 4e1c191 | 2012-08-08 22:22:26 +0000 | [diff] [blame] | 1366 | |
sewardj | b0ccb4d | 2012-04-02 10:22:05 +0000 | [diff] [blame] | 1367 | AC_MSG_CHECKING([that compiler knows -mhard-dfp switch]) |
| 1368 | safe_CFLAGS=$CFLAGS |
| 1369 | CFLAGS="-mhard-dfp" |
| 1370 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1371 | ]], [[ |
| 1372 | __asm__ __volatile__("dadd 1, 2, 3"); |
sewardj | 4e1c191 | 2012-08-08 22:22:26 +0000 | [diff] [blame] | 1373 | __asm__ __volatile__("dcffix 1, 2"); |
sewardj | b0ccb4d | 2012-04-02 10:22:05 +0000 | [diff] [blame] | 1374 | ]])], [ |
| 1375 | ac_gcc_have_dfp=yes |
| 1376 | AC_MSG_RESULT([yes]) |
| 1377 | ], [ |
| 1378 | ac_gcc_have_dfp=no |
| 1379 | AC_MSG_RESULT([no]) |
| 1380 | ]) |
| 1381 | |
sewardj | b0ccb4d | 2012-04-02 10:22:05 +0000 | [diff] [blame] | 1382 | CFLAGS=$safe_CFLAGS |
| 1383 | |
| 1384 | AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes -a x$ac_gcc_have_dfp = xyes) |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1385 | |
sewardj | 4e1c191 | 2012-08-08 22:22:26 +0000 | [diff] [blame] | 1386 | |
florian | 4682598 | 2012-11-10 22:35:24 +0000 | [diff] [blame] | 1387 | AC_MSG_CHECKING([that compiler knows DFP datatypes]) |
| 1388 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1389 | ]], [[ |
| 1390 | _Decimal64 x = 0.0DD; |
| 1391 | ]])], [ |
| 1392 | ac_gcc_have_dfp_type=yes |
| 1393 | AC_MSG_RESULT([yes]) |
| 1394 | ], [ |
| 1395 | ac_gcc_have_dfp_type=no |
| 1396 | AC_MSG_RESULT([no]) |
| 1397 | ]) |
| 1398 | |
| 1399 | AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_gcc_have_dfp_type = xyes) |
| 1400 | |
carll | dfbf294 | 2013-08-12 18:04:22 +0000 | [diff] [blame] | 1401 | # isa 2.07 checking |
| 1402 | AC_MSG_CHECKING([that assembler knows ISA 2.07 ]) |
| 1403 | |
| 1404 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1405 | ]], [[ |
| 1406 | __asm__ __volatile__("mtvsrd 1,2 "); |
| 1407 | ]])], [ |
| 1408 | ac_asm_have_isa_2_07=yes |
| 1409 | AC_MSG_RESULT([yes]) |
| 1410 | ], [ |
| 1411 | ac_asm_have_isa_2_07=no |
| 1412 | AC_MSG_RESULT([no]) |
| 1413 | ]) |
| 1414 | |
| 1415 | AM_CONDITIONAL(HAS_ISA_2_07, test x$ac_asm_have_isa_2_07 = xyes) |
florian | 4682598 | 2012-11-10 22:35:24 +0000 | [diff] [blame] | 1416 | |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1417 | # Check for pthread_create@GLIBC2.0 |
| 1418 | AC_MSG_CHECKING([for pthread_create@GLIBC2.0()]) |
| 1419 | |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1420 | safe_CFLAGS=$CFLAGS |
| 1421 | CFLAGS="-lpthread" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1422 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1423 | extern int pthread_create_glibc_2_0(void*, const void*, |
| 1424 | void *(*)(void*), void*); |
| 1425 | __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0"); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1426 | ]], [[ |
bart | 276ed3a | 2009-05-10 15:41:45 +0000 | [diff] [blame] | 1427 | #ifdef __powerpc__ |
| 1428 | /* |
| 1429 | * Apparently on PowerPC linking this program succeeds and generates an |
| 1430 | * executable with the undefined symbol pthread_create@GLIBC_2.0. |
| 1431 | */ |
| 1432 | #error This test does not work properly on PowerPC. |
| 1433 | #else |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1434 | pthread_create_glibc_2_0(0, 0, 0, 0); |
bart | 276ed3a | 2009-05-10 15:41:45 +0000 | [diff] [blame] | 1435 | #endif |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1436 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1437 | ]])], [ |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1438 | ac_have_pthread_create_glibc_2_0=yes |
| 1439 | AC_MSG_RESULT([yes]) |
| 1440 | AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1, |
| 1441 | [Define to 1 if you have the `pthread_create@glibc2.0' function.]) |
| 1442 | ], [ |
| 1443 | ac_have_pthread_create_glibc_2_0=no |
| 1444 | AC_MSG_RESULT([no]) |
| 1445 | ]) |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1446 | CFLAGS=$safe_CFLAGS |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1447 | |
| 1448 | AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0, |
bart | 24f5390 | 2009-04-26 11:29:02 +0000 | [diff] [blame] | 1449 | test x$ac_have_pthread_create_glibc_2_0 = xyes) |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1450 | |
| 1451 | |
philippe | 1670b05 | 2014-08-15 10:27:52 +0000 | [diff] [blame] | 1452 | # Check for dlinfo RTLD_DI_TLS_MODID |
| 1453 | AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID]) |
| 1454 | |
| 1455 | safe_LIBS="$LIBS" |
| 1456 | LIBS="-ldl" |
| 1457 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 1458 | #ifndef _GNU_SOURCE |
| 1459 | #define _GNU_SOURCE |
| 1460 | #endif |
| 1461 | #include <link.h> |
| 1462 | #include <dlfcn.h> |
| 1463 | ]], [[ |
| 1464 | size_t sizes[10000]; |
| 1465 | size_t modid_offset; |
| 1466 | (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset); |
| 1467 | return 0; |
| 1468 | ]])], [ |
| 1469 | ac_have_dlinfo_rtld_di_tls_modid=yes |
| 1470 | AC_MSG_RESULT([yes]) |
| 1471 | AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1, |
| 1472 | [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.]) |
| 1473 | ], [ |
| 1474 | ac_have_dlinfo_rtld_di_tls_modid=no |
| 1475 | AC_MSG_RESULT([no]) |
| 1476 | ]) |
| 1477 | LIBS=$safe_LIBS |
| 1478 | |
| 1479 | AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID, |
| 1480 | test x$ac_have_dlinfo_rtld_di_tls_modid = xyes) |
| 1481 | |
| 1482 | |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1483 | # Check for eventfd_t, eventfd() and eventfd_read() |
| 1484 | AC_MSG_CHECKING([for eventfd()]) |
| 1485 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1486 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1487 | #include <sys/eventfd.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1488 | ]], [[ |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1489 | eventfd_t ev; |
| 1490 | int fd; |
| 1491 | |
| 1492 | fd = eventfd(5, 0); |
| 1493 | eventfd_read(fd, &ev); |
| 1494 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1495 | ]])], [ |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1496 | AC_MSG_RESULT([yes]) |
| 1497 | AC_DEFINE([HAVE_EVENTFD], 1, |
| 1498 | [Define to 1 if you have the `eventfd' function.]) |
| 1499 | AC_DEFINE([HAVE_EVENTFD_READ], 1, |
| 1500 | [Define to 1 if you have the `eventfd_read' function.]) |
| 1501 | ], [ |
| 1502 | AC_MSG_RESULT([no]) |
| 1503 | ]) |
| 1504 | |
| 1505 | |
florian | 24fefb6 | 2013-10-08 13:04:00 +0000 | [diff] [blame] | 1506 | # Check whether compiler can process #include <thread> without errors |
| 1507 | # clang 3.3 cannot process <thread> from e.g. |
| 1508 | # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 |
| 1509 | |
| 1510 | AC_MSG_CHECKING([that C++ compiler can include <thread> header file]) |
| 1511 | AC_LANG(C++) |
| 1512 | safe_CXXFLAGS=$CXXFLAGS |
| 1513 | CXXFLAGS=-std=c++0x |
| 1514 | |
| 1515 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ |
| 1516 | #include <thread> |
| 1517 | ])], |
| 1518 | [ |
| 1519 | ac_cxx_can_include_thread_header=yes |
| 1520 | AC_MSG_RESULT([yes]) |
| 1521 | ], [ |
| 1522 | ac_cxx_can_include_thread_header=no |
| 1523 | AC_MSG_RESULT([no]) |
| 1524 | ]) |
| 1525 | CXXFLAGS=$safe_CXXFLAGS |
| 1526 | AC_LANG(C) |
| 1527 | |
| 1528 | AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes) |
| 1529 | |
mjw | 2a429f5 | 2014-07-18 20:45:37 +0000 | [diff] [blame] | 1530 | |
| 1531 | # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead |
| 1532 | # of the user_regs_struct from sys/user.h. They are structurally the same |
| 1533 | # but we get either one or the other. |
| 1534 | |
| 1535 | AC_CHECK_TYPE([struct user_regs_struct], |
| 1536 | [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no], |
| 1537 | [[#include <sys/ptrace.h>] |
| 1538 | [#include <sys/time.h>] |
| 1539 | [#include <sys/user.h>]]) |
| 1540 | if test "$sys_user_has_user_regs" = "yes"; then |
| 1541 | AC_DEFINE(HAVE_SYS_USER_REGS, 1, |
| 1542 | [Define to 1 if <sys/user.h> defines struct user_regs_struct]) |
| 1543 | fi |
| 1544 | |
| 1545 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1546 | #---------------------------------------------------------------------------- |
| 1547 | # Checking for supported compiler flags. |
| 1548 | #---------------------------------------------------------------------------- |
| 1549 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1550 | # does this compiler support -m32 ? |
| 1551 | AC_MSG_CHECKING([if gcc accepts -m32]) |
| 1552 | |
| 1553 | safe_CFLAGS=$CFLAGS |
| 1554 | CFLAGS="-m32" |
| 1555 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1556 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1557 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1558 | ]])], [ |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1559 | FLAG_M32="-m32" |
| 1560 | AC_MSG_RESULT([yes]) |
| 1561 | ], [ |
| 1562 | FLAG_M32="" |
| 1563 | AC_MSG_RESULT([no]) |
| 1564 | ]) |
| 1565 | CFLAGS=$safe_CFLAGS |
| 1566 | |
| 1567 | AC_SUBST(FLAG_M32) |
| 1568 | |
| 1569 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1570 | # does this compiler support -m64 ? |
| 1571 | AC_MSG_CHECKING([if gcc accepts -m64]) |
| 1572 | |
| 1573 | safe_CFLAGS=$CFLAGS |
| 1574 | CFLAGS="-m64" |
| 1575 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1576 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1577 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1578 | ]])], [ |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1579 | FLAG_M64="-m64" |
| 1580 | AC_MSG_RESULT([yes]) |
| 1581 | ], [ |
| 1582 | FLAG_M64="" |
| 1583 | AC_MSG_RESULT([no]) |
| 1584 | ]) |
| 1585 | CFLAGS=$safe_CFLAGS |
| 1586 | |
| 1587 | AC_SUBST(FLAG_M64) |
| 1588 | |
| 1589 | |
dejanj | f674e38 | 2014-02-18 16:40:25 +0000 | [diff] [blame] | 1590 | # does this compiler support -march=mips32 (mips32 default) ? |
| 1591 | AC_MSG_CHECKING([if gcc accepts -march=mips32]) |
| 1592 | |
| 1593 | safe_CFLAGS=$CFLAGS |
| 1594 | CFLAGS="$CFLAGS -march=mips32" |
| 1595 | |
| 1596 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 1597 | return 0; |
| 1598 | ]])], [ |
| 1599 | FLAG_MIPS32="-march=mips32" |
| 1600 | AC_MSG_RESULT([yes]) |
| 1601 | ], [ |
| 1602 | FLAG_MIPS32="" |
| 1603 | AC_MSG_RESULT([no]) |
| 1604 | ]) |
| 1605 | CFLAGS=$safe_CFLAGS |
| 1606 | |
| 1607 | AC_SUBST(FLAG_MIPS32) |
| 1608 | |
| 1609 | |
| 1610 | # does this compiler support -march=mips64 (mips64 default) ? |
| 1611 | AC_MSG_CHECKING([if gcc accepts -march=mips64]) |
| 1612 | |
| 1613 | safe_CFLAGS=$CFLAGS |
| 1614 | CFLAGS="$CFLAGS -march=mips64" |
| 1615 | |
| 1616 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 1617 | return 0; |
| 1618 | ]])], [ |
| 1619 | FLAG_MIPS64="-march=mips64" |
| 1620 | AC_MSG_RESULT([yes]) |
| 1621 | ], [ |
| 1622 | FLAG_MIPS64="" |
| 1623 | AC_MSG_RESULT([no]) |
| 1624 | ]) |
| 1625 | CFLAGS=$safe_CFLAGS |
| 1626 | |
| 1627 | AC_SUBST(FLAG_MIPS64) |
| 1628 | |
| 1629 | |
petarj | 1546c7a | 2014-01-29 18:08:50 +0000 | [diff] [blame] | 1630 | # does this compiler support -march=octeon (Cavium OCTEON I Specific) ? |
| 1631 | AC_MSG_CHECKING([if gcc accepts -march=octeon]) |
| 1632 | |
| 1633 | safe_CFLAGS=$CFLAGS |
| 1634 | CFLAGS="$CFLAGS -march=octeon" |
| 1635 | |
| 1636 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 1637 | return 0; |
| 1638 | ]])], [ |
| 1639 | FLAG_OCTEON="-march=octeon" |
| 1640 | AC_MSG_RESULT([yes]) |
| 1641 | ], [ |
| 1642 | FLAG_OCTEON="" |
| 1643 | AC_MSG_RESULT([no]) |
| 1644 | ]) |
| 1645 | CFLAGS=$safe_CFLAGS |
| 1646 | |
| 1647 | AC_SUBST(FLAG_OCTEON) |
| 1648 | |
dejanj | f674e38 | 2014-02-18 16:40:25 +0000 | [diff] [blame] | 1649 | |
petarj | 1546c7a | 2014-01-29 18:08:50 +0000 | [diff] [blame] | 1650 | # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ? |
| 1651 | AC_MSG_CHECKING([if gcc accepts -march=octeon2]) |
| 1652 | |
| 1653 | safe_CFLAGS=$CFLAGS |
| 1654 | CFLAGS="$CFLAGS -march=octeon2" |
| 1655 | |
| 1656 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 1657 | return 0; |
| 1658 | ]])], [ |
| 1659 | FLAG_OCTEON2="-march=octeon2" |
| 1660 | AC_MSG_RESULT([yes]) |
| 1661 | ], [ |
| 1662 | FLAG_OCTEON2="" |
| 1663 | AC_MSG_RESULT([no]) |
| 1664 | ]) |
| 1665 | CFLAGS=$safe_CFLAGS |
| 1666 | |
| 1667 | AC_SUBST(FLAG_OCTEON2) |
| 1668 | |
| 1669 | |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1670 | # does this compiler support -mmmx ? |
| 1671 | AC_MSG_CHECKING([if gcc accepts -mmmx]) |
| 1672 | |
| 1673 | safe_CFLAGS=$CFLAGS |
| 1674 | CFLAGS="-mmmx" |
| 1675 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1676 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1677 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1678 | ]])], [ |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1679 | FLAG_MMMX="-mmmx" |
| 1680 | AC_MSG_RESULT([yes]) |
| 1681 | ], [ |
| 1682 | FLAG_MMMX="" |
| 1683 | AC_MSG_RESULT([no]) |
| 1684 | ]) |
| 1685 | CFLAGS=$safe_CFLAGS |
| 1686 | |
| 1687 | AC_SUBST(FLAG_MMMX) |
| 1688 | |
| 1689 | |
| 1690 | # does this compiler support -msse ? |
| 1691 | AC_MSG_CHECKING([if gcc accepts -msse]) |
| 1692 | |
| 1693 | safe_CFLAGS=$CFLAGS |
| 1694 | CFLAGS="-msse" |
| 1695 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1696 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1697 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1698 | ]])], [ |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1699 | FLAG_MSSE="-msse" |
| 1700 | AC_MSG_RESULT([yes]) |
| 1701 | ], [ |
| 1702 | FLAG_MSSE="" |
| 1703 | AC_MSG_RESULT([no]) |
| 1704 | ]) |
| 1705 | CFLAGS=$safe_CFLAGS |
| 1706 | |
| 1707 | AC_SUBST(FLAG_MSSE) |
| 1708 | |
| 1709 | |
sewardj | 98977e0 | 2014-09-05 20:00:22 +0000 | [diff] [blame] | 1710 | # does this compiler support -mpreferred-stack-boundary=2 when |
| 1711 | # generating code for a 32-bit target? Note that we only care about |
| 1712 | # this when generating code for (32-bit) x86, so if the compiler |
| 1713 | # doesn't recognise -m32 it's no big deal. We'll just get code for |
| 1714 | # the Memcheck and other helper functions, that is a bit slower than |
| 1715 | # it could be, on x86; and no difference at all on any other platform. |
| 1716 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1717 | |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1718 | safe_CFLAGS=$CFLAGS |
sewardj | 98977e0 | 2014-09-05 20:00:22 +0000 | [diff] [blame] | 1719 | CFLAGS="-mpreferred-stack-boundary=2 -m32" |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1720 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1721 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1722 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1723 | ]])], [ |
sewardj | 98977e0 | 2014-09-05 20:00:22 +0000 | [diff] [blame] | 1724 | PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2" |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1725 | AC_MSG_RESULT([yes]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1726 | ], [ |
sewardj | 98977e0 | 2014-09-05 20:00:22 +0000 | [diff] [blame] | 1727 | PREFERRED_STACK_BOUNDARY_2="" |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1728 | AC_MSG_RESULT([no]) |
| 1729 | ]) |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1730 | CFLAGS=$safe_CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1731 | |
sewardj | 98977e0 | 2014-09-05 20:00:22 +0000 | [diff] [blame] | 1732 | AC_SUBST(PREFERRED_STACK_BOUNDARY_2) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1733 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1734 | |
mjw | ab69b4a | 2014-08-20 16:11:53 +0000 | [diff] [blame] | 1735 | # Convenience function to check whether GCC supports a particular |
| 1736 | # warning option. Takes two arguments, first the warning flag name |
| 1737 | # to check (without -W), then the conditional name to set if that |
| 1738 | # warning flag is supported. |
| 1739 | AC_DEFUN([AC_GCC_WARNING_COND],[ |
sewardj | a3a27fe | 2014-09-01 21:16:02 +0000 | [diff] [blame] | 1740 | AC_MSG_CHECKING([if gcc accepts -W$1]) |
| 1741 | safe_CFLAGS=$CFLAGS |
| 1742 | CFLAGS="-W$1" |
| 1743 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [ |
| 1744 | has_warning_flag=yes |
| 1745 | AC_MSG_RESULT([yes])], [ |
| 1746 | has_warning_flag=no |
| 1747 | AC_MSG_RESULT([no])]) |
| 1748 | CFLAGS=$safe_CFLAGS |
| 1749 | AM_CONDITIONAL([$2], test x$has_warning_flag = xyes) |
| 1750 | ]) |
florian | da8c126 | 2012-11-18 14:39:11 +0000 | [diff] [blame] | 1751 | |
mjw | ab69b4a | 2014-08-20 16:11:53 +0000 | [diff] [blame] | 1752 | AC_GCC_WARNING_COND([pointer-sign], [HAS_POINTER_SIGN_WARNING]) |
| 1753 | AC_GCC_WARNING_COND([write-strings], [HAS_WRITE_STRINGS_WARNING]) |
florian | da8c126 | 2012-11-18 14:39:11 +0000 | [diff] [blame] | 1754 | |
mjw | ab69b4a | 2014-08-20 16:11:53 +0000 | [diff] [blame] | 1755 | # Convenience function to check whether GCC supports a particular |
| 1756 | # warning option. Similar to AC_GCC_WARNING_COND, but does a |
| 1757 | # substitution instead of setting an conditional. Takes two arguments, |
| 1758 | # first the warning flag name to check (without -W), then the |
| 1759 | # substitution name to set with -Wno-warning-flag if the flag exists, |
| 1760 | # or the empty string if the compiler doesn't accept the flag. Note |
| 1761 | # that checking is done against the warning flag itself, but the |
| 1762 | # substitution is then done to cancel the warning flag. |
| 1763 | AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[ |
sewardj | a3a27fe | 2014-09-01 21:16:02 +0000 | [diff] [blame] | 1764 | AC_MSG_CHECKING([if gcc accepts -W$1]) |
| 1765 | safe_CFLAGS=$CFLAGS |
| 1766 | CFLAGS="-W$1" |
| 1767 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [ |
| 1768 | AC_SUBST([$2], [-Wno-$1]) |
| 1769 | AC_MSG_RESULT([yes])], [ |
| 1770 | AC_SUBST([$2], []) |
| 1771 | AC_MSG_RESULT([no])]) |
| 1772 | CFLAGS=$safe_CFLAGS |
bart | e026bd2 | 2009-07-04 12:17:07 +0000 | [diff] [blame] | 1773 | ]) |
bart | e026bd2 | 2009-07-04 12:17:07 +0000 | [diff] [blame] | 1774 | |
mjw | ab69b4a | 2014-08-20 16:11:53 +0000 | [diff] [blame] | 1775 | AC_GCC_WARNING_SUBST_NO([empty-body], [FLAG_W_NO_EMPTY_BODY]) |
| 1776 | AC_GCC_WARNING_SUBST_NO([format-zero-length], [FLAG_W_NO_FORMAT_ZERO_LENGTH]) |
| 1777 | AC_GCC_WARNING_SUBST_NO([tautological-compare], [FLAG_W_NO_TAUTOLOGICAL_COMPARE]) |
| 1778 | AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL]) |
| 1779 | AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW]) |
| 1780 | AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED]) |
florian | 807c454 | 2014-09-05 18:30:05 +0000 | [diff] [blame] | 1781 | AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION]) |
| 1782 | AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE]) |
bart | bf9b85c | 2009-08-12 12:55:56 +0000 | [diff] [blame] | 1783 | |
sewardj | a3a27fe | 2014-09-01 21:16:02 +0000 | [diff] [blame] | 1784 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1785 | # does this compiler support -Wextra or the older -W ? |
| 1786 | |
| 1787 | AC_MSG_CHECKING([if gcc accepts -Wextra or -W]) |
| 1788 | |
| 1789 | safe_CFLAGS=$CFLAGS |
| 1790 | CFLAGS="-Wextra" |
| 1791 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1792 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1793 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1794 | ]])], [ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1795 | AC_SUBST([FLAG_W_EXTRA], [-Wextra]) |
| 1796 | AC_MSG_RESULT([-Wextra]) |
| 1797 | ], [ |
| 1798 | CFLAGS="-W" |
sewardj | 9bdf2a6 | 2011-10-27 06:22:23 +0000 | [diff] [blame] | 1799 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1800 | return 0; |
sewardj | 9bdf2a6 | 2011-10-27 06:22:23 +0000 | [diff] [blame] | 1801 | ]])], [ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1802 | AC_SUBST([FLAG_W_EXTRA], [-W]) |
| 1803 | AC_MSG_RESULT([-W]) |
| 1804 | ], [ |
| 1805 | AC_SUBST([FLAG_W_EXTRA], []) |
| 1806 | AC_MSG_RESULT([not supported]) |
| 1807 | ]) |
| 1808 | ]) |
| 1809 | CFLAGS=$safe_CFLAGS |
| 1810 | |
| 1811 | |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1812 | # does this compiler support -fno-stack-protector ? |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1813 | AC_MSG_CHECKING([if gcc accepts -fno-stack-protector]) |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1814 | |
| 1815 | safe_CFLAGS=$CFLAGS |
| 1816 | CFLAGS="-fno-stack-protector" |
| 1817 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1818 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1819 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1820 | ]])], [ |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1821 | no_stack_protector=yes |
| 1822 | FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector" |
| 1823 | AC_MSG_RESULT([yes]) |
| 1824 | ], [ |
| 1825 | no_stack_protector=no |
| 1826 | FLAG_FNO_STACK_PROTECTOR="" |
| 1827 | AC_MSG_RESULT([no]) |
| 1828 | ]) |
| 1829 | CFLAGS=$safe_CFLAGS |
| 1830 | |
| 1831 | AC_SUBST(FLAG_FNO_STACK_PROTECTOR) |
| 1832 | |
| 1833 | if test x$no_stack_protector = xyes; then |
| 1834 | CFLAGS="$CFLAGS -fno-stack-protector" |
florian | d79b3bf | 2013-10-02 15:14:59 +0000 | [diff] [blame] | 1835 | CXXFLAGS="$CXXFLAGS -fno-stack-protector" |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1836 | fi |
| 1837 | |
| 1838 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1839 | # does this compiler support --param inline-unit-growth=... ? |
| 1840 | |
| 1841 | AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth]) |
| 1842 | |
| 1843 | safe_CFLAGS=$CFLAGS |
| 1844 | CFLAGS="--param inline-unit-growth=900" |
| 1845 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1846 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1847 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1848 | ]])], [ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1849 | AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], |
| 1850 | ["--param inline-unit-growth=900"]) |
| 1851 | AC_MSG_RESULT([yes]) |
| 1852 | ], [ |
| 1853 | AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""]) |
| 1854 | AC_MSG_RESULT([no]) |
| 1855 | ]) |
| 1856 | CFLAGS=$safe_CFLAGS |
| 1857 | |
| 1858 | |
sewardj | d935068 | 2012-04-05 07:55:47 +0000 | [diff] [blame] | 1859 | # does this compiler support -gdwarf-4 -fdebug-types-section ? |
| 1860 | |
| 1861 | AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section]) |
| 1862 | |
| 1863 | safe_CFLAGS=$CFLAGS |
| 1864 | CFLAGS="-gdwarf-4 -fdebug-types-section" |
| 1865 | |
| 1866 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
| 1867 | return 0; |
| 1868 | ]])], [ |
| 1869 | ac_have_dwarf4=yes |
| 1870 | AC_MSG_RESULT([yes]) |
| 1871 | ], [ |
| 1872 | ac_have_dwarf4=no |
| 1873 | AC_MSG_RESULT([no]) |
| 1874 | ]) |
| 1875 | AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes) |
| 1876 | CFLAGS=$safe_CFLAGS |
| 1877 | |
| 1878 | |
florian | 3df0211 | 2013-10-04 11:35:50 +0000 | [diff] [blame] | 1879 | # does this compiler support -gstabs ? |
| 1880 | |
| 1881 | AC_MSG_CHECKING([if gcc accepts -gstabs]) |
| 1882 | |
| 1883 | safe_CFLAGS=$CFLAGS |
| 1884 | CFLAGS="-gstabs" |
| 1885 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 1886 | return 0; |
| 1887 | ]])], [ |
| 1888 | ac_have_gstabs=yes |
| 1889 | AC_MSG_RESULT([yes]) |
| 1890 | ], [ |
| 1891 | ac_have_gstabs=no |
| 1892 | AC_MSG_RESULT([no]) |
| 1893 | ]) |
| 1894 | CFLAGS=$safe_CFLAGS |
| 1895 | AM_CONDITIONAL([HAVE_GSTABS], [test x$ac_have_gstabs = xyes]) |
| 1896 | |
| 1897 | |
| 1898 | # does this compiler support nested functions ? |
| 1899 | |
| 1900 | AC_MSG_CHECKING([if gcc accepts nested functions]) |
| 1901 | |
| 1902 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 1903 | int foo() { return 1; } |
| 1904 | return foo(); |
| 1905 | ]])], [ |
| 1906 | ac_have_nested_functions=yes |
| 1907 | AC_MSG_RESULT([yes]) |
| 1908 | ], [ |
| 1909 | ac_have_nested_functions=no |
| 1910 | AC_MSG_RESULT([no]) |
| 1911 | ]) |
| 1912 | AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes]) |
| 1913 | |
| 1914 | |
| 1915 | # does this compiler support the 'p' constraint in ASM statements ? |
| 1916 | |
| 1917 | AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements]) |
| 1918 | |
| 1919 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 1920 | char *p; |
| 1921 | __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p)); |
| 1922 | ]])], [ |
| 1923 | ac_have_asm_constraint_p=yes |
| 1924 | AC_MSG_RESULT([yes]) |
| 1925 | ], [ |
| 1926 | ac_have_asm_constraint_p=no |
| 1927 | AC_MSG_RESULT([no]) |
| 1928 | ]) |
| 1929 | AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes]) |
| 1930 | |
| 1931 | |
sewardj | e4bc703 | 2013-03-22 11:49:46 +0000 | [diff] [blame] | 1932 | # We want to use use the -Ttext-segment option to the linker. |
| 1933 | # GNU (bfd) ld supports this directly. Newer GNU gold linkers |
| 1934 | # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext |
| 1935 | # semantics are NOT what we want (GNU gold -Ttext is fine). |
| 1936 | # |
| 1937 | # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers |
| 1938 | # will reside. -Ttext aligns just the .text section start (but not any |
| 1939 | # other section). |
| 1940 | # |
| 1941 | # So test for -Ttext-segment which is supported by all bfd ld versions |
| 1942 | # and use that if it exists. If it doesn't exist it must be an older |
| 1943 | # version of gold and we can fall back to using -Ttext which has the |
| 1944 | # right semantics. |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1945 | |
sewardj | e4bc703 | 2013-03-22 11:49:46 +0000 | [diff] [blame] | 1946 | AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment]) |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1947 | |
| 1948 | safe_CFLAGS=$CFLAGS |
mjw | 941277a | 2013-04-17 19:11:05 +0000 | [diff] [blame] | 1949 | CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml" |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1950 | |
bart | 8508c75 | 2010-06-10 06:26:21 +0000 | [diff] [blame] | 1951 | AC_LINK_IFELSE( |
mjw | 941277a | 2013-04-17 19:11:05 +0000 | [diff] [blame] | 1952 | [AC_LANG_SOURCE([int _start () { return 0; }])], |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1953 | [ |
tom | 04ce9f5 | 2013-03-28 15:53:21 +0000 | [diff] [blame] | 1954 | linker_using_t_text="no" |
sewardj | e4bc703 | 2013-03-22 11:49:46 +0000 | [diff] [blame] | 1955 | AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"]) |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1956 | AC_MSG_RESULT([yes]) |
| 1957 | ], [ |
tom | 04ce9f5 | 2013-03-28 15:53:21 +0000 | [diff] [blame] | 1958 | linker_using_t_text="yes" |
sewardj | e4bc703 | 2013-03-22 11:49:46 +0000 | [diff] [blame] | 1959 | AC_SUBST([FLAG_T_TEXT], ["-Ttext"]) |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1960 | AC_MSG_RESULT([no]) |
| 1961 | ]) |
| 1962 | CFLAGS=$safe_CFLAGS |
| 1963 | |
tom | 04ce9f5 | 2013-03-28 15:53:21 +0000 | [diff] [blame] | 1964 | # If the linker only supports -Ttext (not -Ttext-segment) then we will |
| 1965 | # have to strip any build-id ELF NOTEs from the staticly linked tools. |
| 1966 | # Otherwise the build-id NOTE might end up at the default load address. |
| 1967 | # (Pedantically if the linker is gold then -Ttext is fine, but newer |
| 1968 | # gold versions also support -Ttext-segment. So just assume that unless |
| 1969 | # we can use -Ttext-segment we need to strip the build-id NOTEs. |
florian | 51b14ee | 2014-02-22 18:38:32 +0000 | [diff] [blame] | 1970 | if test "x${linker_using_t_text}" = "xyes"; then |
tom | 04ce9f5 | 2013-03-28 15:53:21 +0000 | [diff] [blame] | 1971 | AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.]) |
| 1972 | # does the linker support -Wl,--build-id=none ? Note, it's |
| 1973 | # important that we test indirectly via whichever C compiler |
| 1974 | # is selected, rather than testing /usr/bin/ld or whatever |
| 1975 | # directly. |
| 1976 | AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none]) |
| 1977 | safe_CFLAGS=$CFLAGS |
| 1978 | CFLAGS="-Wl,--build-id=none" |
| 1979 | |
| 1980 | AC_LINK_IFELSE( |
| 1981 | [AC_LANG_PROGRAM([ ], [return 0;])], |
| 1982 | [ |
| 1983 | AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"]) |
| 1984 | AC_MSG_RESULT([yes]) |
| 1985 | ], [ |
| 1986 | AC_SUBST([FLAG_NO_BUILD_ID], [""]) |
| 1987 | AC_MSG_RESULT([no]) |
| 1988 | ]) |
| 1989 | else |
| 1990 | AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.]) |
| 1991 | AC_SUBST([FLAG_NO_BUILD_ID], [""]) |
| 1992 | fi |
| 1993 | CFLAGS=$safe_CFLAGS |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1994 | |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 1995 | # does the ppc assembler support "mtocrf" et al? |
| 1996 | AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf]) |
| 1997 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1998 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | dd4cbe1 | 2006-03-12 17:27:44 +0000 | [diff] [blame] | 1999 | __asm__ __volatile__("mtocrf 4,0"); |
| 2000 | __asm__ __volatile__("mfocrf 0,4"); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2001 | ]])], [ |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 2002 | ac_have_as_ppc_mftocrf=yes |
| 2003 | AC_MSG_RESULT([yes]) |
| 2004 | ], [ |
| 2005 | ac_have_as_ppc_mftocrf=no |
| 2006 | AC_MSG_RESULT([no]) |
| 2007 | ]) |
| 2008 | if test x$ac_have_as_ppc_mftocrf = xyes ; then |
| 2009 | AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.]) |
| 2010 | fi |
| 2011 | |
| 2012 | |
carll | 1e5fa2f | 2013-08-09 21:55:45 +0000 | [diff] [blame] | 2013 | # does the ppc assembler support "lfdp" and other phased out floating point insns? |
| 2014 | AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions]) |
| 2015 | |
| 2016 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2017 | do { typedef struct { |
| 2018 | double hi; |
| 2019 | double lo; |
| 2020 | } dbl_pair_t; |
| 2021 | dbl_pair_t dbl_pair[3]; |
| 2022 | __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0])); |
| 2023 | } while (0) |
| 2024 | ]])], [ |
| 2025 | ac_have_as_ppc_fpPO=yes |
| 2026 | AC_MSG_RESULT([yes]) |
| 2027 | ], [ |
| 2028 | ac_have_as_ppc_fpPO=no |
| 2029 | AC_MSG_RESULT([no]) |
| 2030 | ]) |
| 2031 | if test x$ac_have_as_ppc_fpPO = xyes ; then |
| 2032 | AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.]) |
| 2033 | fi |
| 2034 | |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 2035 | |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 2036 | # does the x86/amd64 assembler understand SSE3 instructions? |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 2037 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2038 | # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 2039 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3]) |
| 2040 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2041 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 2042 | do { long long int x; |
| 2043 | __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); } |
| 2044 | while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2045 | ]])], [ |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 2046 | ac_have_as_sse3=yes |
| 2047 | AC_MSG_RESULT([yes]) |
| 2048 | ], [ |
| 2049 | ac_have_as_sse3=no |
| 2050 | AC_MSG_RESULT([no]) |
| 2051 | ]) |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 2052 | |
| 2053 | AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes) |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 2054 | |
| 2055 | |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 2056 | # Ditto for SSSE3 instructions (note extra S) |
| 2057 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2058 | # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's |
| 2059 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3]) |
| 2060 | |
florian | c443b96 | 2011-10-28 21:37:19 +0000 | [diff] [blame] | 2061 | save_CFLAGS="$CFLAGS" |
| 2062 | CFLAGS="$CFLAGS -msse" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2063 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 2064 | do { long long int x; |
| 2065 | __asm__ __volatile__( |
| 2066 | "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); } |
| 2067 | while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2068 | ]])], [ |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 2069 | ac_have_as_ssse3=yes |
| 2070 | AC_MSG_RESULT([yes]) |
| 2071 | ], [ |
| 2072 | ac_have_as_ssse3=no |
| 2073 | AC_MSG_RESULT([no]) |
| 2074 | ]) |
florian | c443b96 | 2011-10-28 21:37:19 +0000 | [diff] [blame] | 2075 | CFLAGS="$save_CFLAGS" |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 2076 | |
| 2077 | AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes) |
| 2078 | |
| 2079 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 2080 | # does the x86/amd64 assembler understand the PCLMULQDQ instruction? |
| 2081 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2082 | # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's |
sewardj | e3ae8a3 | 2010-09-28 19:59:47 +0000 | [diff] [blame] | 2083 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq']) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2084 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | e3ae8a3 | 2010-09-28 19:59:47 +0000 | [diff] [blame] | 2085 | do { |
| 2086 | __asm__ __volatile__( |
| 2087 | "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); } |
| 2088 | while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2089 | ]])], [ |
sewardj | e3ae8a3 | 2010-09-28 19:59:47 +0000 | [diff] [blame] | 2090 | ac_have_as_pclmulqdq=yes |
| 2091 | AC_MSG_RESULT([yes]) |
| 2092 | ], [ |
| 2093 | ac_have_as_pclmulqdq=no |
| 2094 | AC_MSG_RESULT([no]) |
| 2095 | ]) |
| 2096 | |
| 2097 | AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes) |
| 2098 | |
| 2099 | |
bart | 9bbe2bb | 2012-08-03 19:37:02 +0000 | [diff] [blame] | 2100 | # does the x86/amd64 assembler understand the VPCLMULQDQ instruction? |
| 2101 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2102 | # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's |
| 2103 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq']) |
| 2104 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2105 | do { |
| 2106 | /* |
| 2107 | * Carry-less multiplication of xmm1 with xmm2 and store the result in |
| 2108 | * xmm3. The immediate is used to determine which quadwords of xmm1 and |
| 2109 | * xmm2 should be used. |
| 2110 | */ |
| 2111 | __asm__ __volatile__( |
| 2112 | "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : ); |
| 2113 | } while (0) |
| 2114 | ]])], [ |
| 2115 | ac_have_as_vpclmulqdq=yes |
| 2116 | AC_MSG_RESULT([yes]) |
| 2117 | ], [ |
| 2118 | ac_have_as_vpclmulqdq=no |
| 2119 | AC_MSG_RESULT([no]) |
| 2120 | ]) |
| 2121 | |
| 2122 | AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes) |
| 2123 | |
| 2124 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 2125 | # does the x86/amd64 assembler understand the LZCNT instruction? |
| 2126 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2127 | # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's |
bart | 55e438b | 2010-09-14 10:53:57 +0000 | [diff] [blame] | 2128 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt']) |
| 2129 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2130 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
bart | 55e438b | 2010-09-14 10:53:57 +0000 | [diff] [blame] | 2131 | do { |
sewardj | c62291c | 2012-07-22 11:10:08 +0000 | [diff] [blame] | 2132 | __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax"); |
bart | 55e438b | 2010-09-14 10:53:57 +0000 | [diff] [blame] | 2133 | } while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2134 | ]])], [ |
bart | 55e438b | 2010-09-14 10:53:57 +0000 | [diff] [blame] | 2135 | ac_have_as_lzcnt=yes |
| 2136 | AC_MSG_RESULT([yes]) |
| 2137 | ], [ |
| 2138 | ac_have_as_lzcnt=no |
| 2139 | AC_MSG_RESULT([no]) |
| 2140 | ]) |
| 2141 | |
| 2142 | AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes]) |
| 2143 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 2144 | |
florian | 3df0211 | 2013-10-04 11:35:50 +0000 | [diff] [blame] | 2145 | # does the x86/amd64 assembler understand the LOOPNEL instruction? |
| 2146 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2147 | # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's |
| 2148 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel']) |
| 2149 | |
| 2150 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2151 | do { |
| 2152 | __asm__ __volatile__("1: loopnel 1b\n"); |
| 2153 | } while (0) |
| 2154 | ]])], [ |
| 2155 | ac_have_as_loopnel=yes |
| 2156 | AC_MSG_RESULT([yes]) |
| 2157 | ], [ |
| 2158 | ac_have_as_loopnel=no |
| 2159 | AC_MSG_RESULT([no]) |
| 2160 | ]) |
| 2161 | |
| 2162 | AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes]) |
| 2163 | |
| 2164 | |
| 2165 | # does the x86/amd64 assembler understand ADDR32 ? |
| 2166 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2167 | # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's |
| 2168 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32']) |
| 2169 | |
| 2170 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2171 | do { |
| 2172 | asm volatile ("addr32 rep movsb"); |
| 2173 | } while (0) |
| 2174 | ]])], [ |
| 2175 | ac_have_as_addr32=yes |
| 2176 | AC_MSG_RESULT([yes]) |
| 2177 | ], [ |
| 2178 | ac_have_as_addr32=no |
| 2179 | AC_MSG_RESULT([no]) |
| 2180 | ]) |
| 2181 | |
| 2182 | AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes]) |
| 2183 | |
| 2184 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 2185 | # does the x86/amd64 assembler understand SSE 4.2 instructions? |
| 2186 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2187 | # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's |
| 2188 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2]) |
| 2189 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2190 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 2191 | do { long long int x; |
| 2192 | __asm__ __volatile__( |
florian | fdfca22 | 2012-01-17 13:16:50 +0000 | [diff] [blame] | 2193 | "crc32q %%r15,%%r15" : : : "r15" ); |
| 2194 | __asm__ __volatile__( |
sewardj | c62291c | 2012-07-22 11:10:08 +0000 | [diff] [blame] | 2195 | "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11"); |
| 2196 | __asm__ __volatile__( |
| 2197 | "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); } |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 2198 | while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2199 | ]])], [ |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 2200 | ac_have_as_sse42=yes |
| 2201 | AC_MSG_RESULT([yes]) |
| 2202 | ], [ |
| 2203 | ac_have_as_sse42=no |
| 2204 | AC_MSG_RESULT([no]) |
| 2205 | ]) |
| 2206 | |
| 2207 | AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes) |
| 2208 | |
| 2209 | |
sewardj | 9fb31ca | 2012-06-05 00:31:49 +0000 | [diff] [blame] | 2210 | # does the x86/amd64 assembler understand AVX instructions? |
| 2211 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2212 | # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's |
| 2213 | AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX]) |
| 2214 | |
| 2215 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2216 | do { long long int x; |
| 2217 | __asm__ __volatile__( |
| 2218 | "vmovupd (%%rsp), %%ymm7" : : : "xmm7" ); |
| 2219 | __asm__ __volatile__( |
| 2220 | "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); } |
| 2221 | while (0) |
| 2222 | ]])], [ |
| 2223 | ac_have_as_avx=yes |
| 2224 | AC_MSG_RESULT([yes]) |
| 2225 | ], [ |
| 2226 | ac_have_as_avx=no |
| 2227 | AC_MSG_RESULT([no]) |
| 2228 | ]) |
| 2229 | |
| 2230 | AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes) |
| 2231 | |
| 2232 | |
sewardj | fda50af | 2013-03-27 11:43:20 +0000 | [diff] [blame] | 2233 | # does the x86/amd64 assembler understand AVX2 instructions? |
| 2234 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2235 | # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's |
| 2236 | AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2]) |
| 2237 | |
| 2238 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2239 | do { long long int x; |
| 2240 | __asm__ __volatile__( |
| 2241 | "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" ); |
| 2242 | __asm__ __volatile__( |
| 2243 | "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); } |
| 2244 | while (0) |
| 2245 | ]])], [ |
| 2246 | ac_have_as_avx2=yes |
| 2247 | AC_MSG_RESULT([yes]) |
| 2248 | ], [ |
| 2249 | ac_have_as_avx2=no |
| 2250 | AC_MSG_RESULT([no]) |
| 2251 | ]) |
| 2252 | |
| 2253 | AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes) |
| 2254 | |
| 2255 | |
sewardj | 9ea080b | 2013-10-16 08:53:07 +0000 | [diff] [blame] | 2256 | # does the x86/amd64 assembler understand TSX instructions and |
| 2257 | # the XACQUIRE/XRELEASE prefixes? |
florian | 364c365 | 2013-09-30 16:32:53 +0000 | [diff] [blame] | 2258 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2259 | # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's |
| 2260 | AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX]) |
| 2261 | |
| 2262 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2263 | do { |
| 2264 | __asm__ __volatile__( |
| 2265 | " xbegin Lfoo \n\t" |
sewardj | 9ea080b | 2013-10-16 08:53:07 +0000 | [diff] [blame] | 2266 | "Lfoo: xend \n\t" |
| 2267 | " xacquire lock incq 0(%rsp) \n\t" |
| 2268 | " xrelease lock incq 0(%rsp) \n" |
| 2269 | ); |
florian | 364c365 | 2013-09-30 16:32:53 +0000 | [diff] [blame] | 2270 | } while (0) |
| 2271 | ]])], [ |
| 2272 | ac_have_as_tsx=yes |
| 2273 | AC_MSG_RESULT([yes]) |
| 2274 | ], [ |
| 2275 | ac_have_as_tsx=no |
| 2276 | AC_MSG_RESULT([no]) |
| 2277 | ]) |
| 2278 | |
| 2279 | AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes) |
| 2280 | |
| 2281 | |
sewardj | fda50af | 2013-03-27 11:43:20 +0000 | [diff] [blame] | 2282 | # does the x86/amd64 assembler understand BMI1 and BMI2 instructions? |
| 2283 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2284 | # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's |
| 2285 | AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2]) |
| 2286 | |
| 2287 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2288 | do { unsigned int h, l; |
| 2289 | __asm__ __volatile__( |
sewardj | e222efc | 2013-03-27 21:59:21 +0000 | [diff] [blame] | 2290 | "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) ); |
sewardj | fda50af | 2013-03-27 11:43:20 +0000 | [diff] [blame] | 2291 | __asm__ __volatile__( |
sewardj | e222efc | 2013-03-27 21:59:21 +0000 | [diff] [blame] | 2292 | "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); } |
sewardj | fda50af | 2013-03-27 11:43:20 +0000 | [diff] [blame] | 2293 | while (0) |
| 2294 | ]])], [ |
| 2295 | ac_have_as_bmi=yes |
| 2296 | AC_MSG_RESULT([yes]) |
| 2297 | ], [ |
| 2298 | ac_have_as_bmi=no |
| 2299 | AC_MSG_RESULT([no]) |
| 2300 | ]) |
| 2301 | |
| 2302 | AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes) |
| 2303 | |
| 2304 | |
| 2305 | # does the x86/amd64 assembler understand FMA instructions? |
| 2306 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2307 | # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's |
| 2308 | AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA]) |
| 2309 | |
| 2310 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2311 | do { unsigned int h, l; |
| 2312 | __asm__ __volatile__( |
| 2313 | "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" ); |
| 2314 | __asm__ __volatile__( |
| 2315 | "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); |
| 2316 | __asm__ __volatile__( |
| 2317 | "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); } |
| 2318 | while (0) |
| 2319 | ]])], [ |
| 2320 | ac_have_as_fma=yes |
| 2321 | AC_MSG_RESULT([yes]) |
| 2322 | ], [ |
| 2323 | ac_have_as_fma=no |
| 2324 | AC_MSG_RESULT([no]) |
| 2325 | ]) |
| 2326 | |
| 2327 | AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes) |
| 2328 | |
| 2329 | |
mjw | 20bafc2 | 2014-05-09 11:41:46 +0000 | [diff] [blame] | 2330 | # does the amd64 assembler understand MPX instructions? |
| 2331 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2332 | # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's |
| 2333 | AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions]) |
| 2334 | |
| 2335 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2336 | asm ("bndmov %bnd0,(%rsp)") |
| 2337 | ]])], [ |
| 2338 | ac_have_as_mpx=yes |
| 2339 | AC_MSG_RESULT([yes]) |
| 2340 | ], [ |
| 2341 | ac_have_as_mpx=no |
| 2342 | AC_MSG_RESULT([no]) |
| 2343 | ]) |
| 2344 | |
| 2345 | AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes) |
| 2346 | |
| 2347 | |
| 2348 | # Does the C compiler support the "ifunc" attribute |
| 2349 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2350 | # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's |
sewardj | b08d84d | 2012-07-16 08:23:26 +0000 | [diff] [blame] | 2351 | # does the x86/amd64 assembler understand MOVBE? |
| 2352 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2353 | # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's |
| 2354 | AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn]) |
| 2355 | |
| 2356 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2357 | do { long long int x; |
| 2358 | __asm__ __volatile__( |
sewardj | c62291c | 2012-07-22 11:10:08 +0000 | [diff] [blame] | 2359 | "movbe (%%rsp), %%r15" : : : "memory", "r15" ); } |
sewardj | b08d84d | 2012-07-16 08:23:26 +0000 | [diff] [blame] | 2360 | while (0) |
| 2361 | ]])], [ |
| 2362 | ac_have_as_movbe=yes |
| 2363 | AC_MSG_RESULT([yes]) |
| 2364 | ], [ |
| 2365 | ac_have_as_movbe=no |
| 2366 | AC_MSG_RESULT([no]) |
| 2367 | ]) |
| 2368 | |
| 2369 | AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes) |
| 2370 | |
| 2371 | |
florian | 251c2f9 | 2012-07-05 21:21:37 +0000 | [diff] [blame] | 2372 | # Does the C compiler support the "ifunc" attribute |
| 2373 | # Note, this doesn't generate a C-level symbol. It generates a |
| 2374 | # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's |
| 2375 | AC_MSG_CHECKING([if gcc supports the ifunc attribute]) |
| 2376 | |
florian | f78a503 | 2012-07-06 09:17:29 +0000 | [diff] [blame] | 2377 | AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
| 2378 | static void mytest(void) {} |
| 2379 | |
| 2380 | static void (*resolve_test(void))(void) |
| 2381 | { |
| 2382 | return (void (*)(void))&mytest; |
| 2383 | } |
| 2384 | |
| 2385 | void test(void) __attribute__((ifunc("resolve_test"))); |
| 2386 | |
| 2387 | int main() |
| 2388 | { |
| 2389 | test(); |
| 2390 | return 0; |
| 2391 | } |
florian | 251c2f9 | 2012-07-05 21:21:37 +0000 | [diff] [blame] | 2392 | ]])], [ |
| 2393 | ac_have_ifunc_attr=yes |
| 2394 | AC_MSG_RESULT([yes]) |
| 2395 | ], [ |
| 2396 | ac_have_ifunc_attr=no |
| 2397 | AC_MSG_RESULT([no]) |
| 2398 | ]) |
| 2399 | |
| 2400 | AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes) |
| 2401 | |
| 2402 | |
sewardj | e089f01 | 2010-10-13 21:47:29 +0000 | [diff] [blame] | 2403 | # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this |
| 2404 | # when building the tool executables. I think we should get rid of it. |
| 2405 | # |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 2406 | # Check for TLS support in the compiler and linker |
bart | 2bd9a68 | 2011-10-22 09:46:16 +0000 | [diff] [blame] | 2407 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 2408 | [[return foo;]])], |
| 2409 | [vg_cv_linktime_tls=yes], |
| 2410 | [vg_cv_linktime_tls=no]) |
bart | ca9f2ad | 2008-06-02 07:14:20 +0000 | [diff] [blame] | 2411 | # Native compilation: check whether running a program using TLS succeeds. |
| 2412 | # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs |
| 2413 | # succeeds but running programs using TLS fails. |
bart | 2bd9a68 | 2011-10-22 09:46:16 +0000 | [diff] [blame] | 2414 | # Cross-compiling: check whether linking a program using TLS succeeds. |
bart | ca9f2ad | 2008-06-02 07:14:20 +0000 | [diff] [blame] | 2415 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 2416 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 2417 | [vg_cv_tls=$enableval], |
| 2418 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 2419 | [[return foo;]])], |
| 2420 | [vg_cv_tls=yes], |
bart | 2bd9a68 | 2011-10-22 09:46:16 +0000 | [diff] [blame] | 2421 | [vg_cv_tls=no], |
| 2422 | [vg_cv_tls=$vg_cv_linktime_tls])])]) |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 2423 | |
| 2424 | if test "$vg_cv_tls" = yes; then |
| 2425 | AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables]) |
| 2426 | fi |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 2427 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 2428 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2429 | #---------------------------------------------------------------------------- |
bart | 62f54e4 | 2008-07-28 11:35:10 +0000 | [diff] [blame] | 2430 | # Checks for C header files. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2431 | #---------------------------------------------------------------------------- |
| 2432 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2433 | AC_HEADER_STDC |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2434 | AC_CHECK_HEADERS([ \ |
bart | 1f2b143 | 2009-01-16 12:06:54 +0000 | [diff] [blame] | 2435 | asm/unistd.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2436 | endian.h \ |
| 2437 | mqueue.h \ |
| 2438 | sys/endian.h \ |
| 2439 | sys/epoll.h \ |
| 2440 | sys/eventfd.h \ |
bart | ce48fa9 | 2008-04-26 10:59:46 +0000 | [diff] [blame] | 2441 | sys/klog.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2442 | sys/poll.h \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 2443 | sys/signal.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2444 | sys/signalfd.h \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 2445 | sys/syscall.h \ |
| 2446 | sys/time.h \ |
| 2447 | sys/types.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2448 | ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2449 | |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 2450 | # Verify whether the <linux/futex.h> header is usable. |
| 2451 | AC_MSG_CHECKING([if <linux/futex.h> is usable]) |
| 2452 | |
sewardj | c12486b | 2012-12-17 14:46:48 +0000 | [diff] [blame] | 2453 | save_CFLAGS="$CFLAGS" |
| 2454 | CFLAGS="$CFLAGS -D__user=" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2455 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 2456 | #include <linux/futex.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2457 | ]], [[ |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 2458 | return FUTEX_WAIT; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2459 | ]])], [ |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2460 | ac_have_usable_linux_futex_h=yes |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 2461 | AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1, |
| 2462 | [Define to 1 if you have a usable <linux/futex.h> header file.]) |
| 2463 | AC_MSG_RESULT([yes]) |
| 2464 | ], [ |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2465 | ac_have_usable_linux_futex_h=no |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 2466 | AC_MSG_RESULT([no]) |
| 2467 | ]) |
sewardj | c12486b | 2012-12-17 14:46:48 +0000 | [diff] [blame] | 2468 | CFLAGS="$save_CFLAGS" |
| 2469 | |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 2470 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2471 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2472 | # Checks for typedefs, structures, and compiler characteristics. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2473 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2474 | AC_TYPE_UID_T |
| 2475 | AC_TYPE_OFF_T |
| 2476 | AC_TYPE_SIZE_T |
| 2477 | AC_HEADER_TIME |
| 2478 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 2479 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2480 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2481 | # Checks for library functions. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2482 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2483 | AC_FUNC_MEMCMP |
| 2484 | AC_FUNC_MMAP |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2485 | |
bart | 26288e4 | 2011-04-03 16:46:01 +0000 | [diff] [blame] | 2486 | AC_CHECK_LIB([pthread], [pthread_create]) |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 2487 | AC_CHECK_LIB([rt], [clock_gettime]) |
bart | 41ac62a | 2008-07-07 16:58:03 +0000 | [diff] [blame] | 2488 | |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2489 | AC_CHECK_FUNCS([ \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 2490 | clock_gettime\ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2491 | epoll_create \ |
| 2492 | epoll_pwait \ |
bart | ce48fa9 | 2008-04-26 10:59:46 +0000 | [diff] [blame] | 2493 | klogctl \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2494 | mallinfo \ |
| 2495 | memchr \ |
| 2496 | memset \ |
| 2497 | mkdir \ |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 2498 | mremap \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2499 | ppoll \ |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 2500 | pthread_barrier_init \ |
| 2501 | pthread_condattr_setclock \ |
| 2502 | pthread_mutex_timedlock \ |
| 2503 | pthread_rwlock_timedrdlock \ |
| 2504 | pthread_rwlock_timedwrlock \ |
| 2505 | pthread_spin_lock \ |
bart | a72a27b | 2010-04-29 06:22:17 +0000 | [diff] [blame] | 2506 | pthread_yield \ |
florian | c5325ef | 2013-09-17 20:15:36 +0000 | [diff] [blame] | 2507 | pthread_setname_np \ |
bart | d1f724c | 2009-08-26 18:11:18 +0000 | [diff] [blame] | 2508 | readlinkat \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2509 | semtimedop \ |
| 2510 | signalfd \ |
njn | 6cc2247 | 2009-03-16 03:46:48 +0000 | [diff] [blame] | 2511 | sigwaitinfo \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2512 | strchr \ |
| 2513 | strdup \ |
| 2514 | strpbrk \ |
| 2515 | strrchr \ |
| 2516 | strstr \ |
bart | a72a27b | 2010-04-29 06:22:17 +0000 | [diff] [blame] | 2517 | syscall \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2518 | utimensat \ |
tom | 9e4b636 | 2012-02-10 09:39:37 +0000 | [diff] [blame] | 2519 | process_vm_readv \ |
| 2520 | process_vm_writev \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 2521 | ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2522 | |
bart | 623eec3 | 2008-07-29 17:54:49 +0000 | [diff] [blame] | 2523 | # AC_CHECK_LIB adds any library found to the variable LIBS, and links these |
| 2524 | # libraries with any shared object and/or executable. This is NOT what we |
| 2525 | # want for e.g. vgpreload_core-x86-linux.so |
| 2526 | LIBS="" |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 2527 | |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 2528 | AM_CONDITIONAL([HAVE_PTHREAD_BARRIER], |
| 2529 | [test x$ac_cv_func_pthread_barrier_init = xyes]) |
bart | 2eaa8f2 | 2009-01-20 14:01:16 +0000 | [diff] [blame] | 2530 | AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK], |
| 2531 | [test x$ac_cv_func_pthread_mutex_timedlock = xyes]) |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 2532 | AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK], |
| 2533 | [test x$ac_cv_func_pthread_spin_lock = xyes]) |
florian | c5325ef | 2013-09-17 20:15:36 +0000 | [diff] [blame] | 2534 | AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP], |
| 2535 | [test x$ac_cv_func_pthread_setname_np = xyes]) |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 2536 | |
petarj | c37cea6 | 2013-06-02 18:08:04 +0000 | [diff] [blame] | 2537 | if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ |
| 2538 | -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then |
petarj | 6d79b74 | 2012-12-20 18:56:57 +0000 | [diff] [blame] | 2539 | AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1, |
petarj | c37cea6 | 2013-06-02 18:08:04 +0000 | [diff] [blame] | 2540 | [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.]) |
petarj | 6d79b74 | 2012-12-20 18:56:57 +0000 | [diff] [blame] | 2541 | fi |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2542 | |
| 2543 | #---------------------------------------------------------------------------- |
| 2544 | # MPI checks |
| 2545 | #---------------------------------------------------------------------------- |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2546 | # Do we have a useable MPI setup on the primary and/or secondary targets? |
| 2547 | # On Linux, by default, assumes mpicc and -m32/-m64 |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 2548 | # Note: this is a kludge in that it assumes the specified mpicc |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 2549 | # understands -m32/-m64 regardless of what is specified using |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2550 | # --with-mpicc=. |
mjw | 46f2504 | 2014-08-21 10:04:04 +0000 | [diff] [blame] | 2551 | AC_PATH_PROG([MPI_CC], [mpicc], [mpicc], |
| 2552 | [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin]) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2553 | |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 2554 | mflag_primary= |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2555 | if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 2556 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 2557 | -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ |
petarj | 4df0bfc | 2013-02-27 23:17:33 +0000 | [diff] [blame] | 2558 | -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ |
| 2559 | -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 2560 | mflag_primary=$FLAG_M32 |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2561 | elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 2562 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \ |
sewardj | f0c1250 | 2014-01-12 12:54:00 +0000 | [diff] [blame] | 2563 | -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \ |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 2564 | -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 2565 | mflag_primary=$FLAG_M64 |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2566 | elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then |
| 2567 | mflag_primary="$FLAG_M32 -arch i386" |
| 2568 | elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then |
| 2569 | mflag_primary="$FLAG_M64 -arch x86_64" |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 2570 | fi |
| 2571 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2572 | mflag_secondary= |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2573 | if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \ |
| 2574 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2575 | mflag_secondary=$FLAG_M32 |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2576 | elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then |
| 2577 | mflag_secondary="$FLAG_M32 -arch i386" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2578 | fi |
| 2579 | |
| 2580 | |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 2581 | AC_ARG_WITH(mpicc, |
sewardj | b70a613 | 2006-05-27 21:14:09 +0000 | [diff] [blame] | 2582 | [ --with-mpicc= Specify name of MPI2-ised C compiler], |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 2583 | MPI_CC=$withval |
| 2584 | ) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2585 | AC_SUBST(MPI_CC) |
| 2586 | |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2587 | ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can |
| 2588 | ## use these values in the check for a functioning mpicc. |
| 2589 | ## |
| 2590 | ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that |
| 2591 | ## mflag_primary/mflag_secondary are sufficient approximations of that behavior |
| 2592 | AM_COND_IF([VGCONF_OS_IS_LINUX], |
| 2593 | [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic" |
| 2594 | LDFLAGS_MPI="-fpic -shared"]) |
| 2595 | AM_COND_IF([VGCONF_OS_IS_DARWIN], |
| 2596 | [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic" |
| 2597 | LDFLAGS_MPI="-dynamic -dynamiclib -all_load"]) |
| 2598 | |
| 2599 | AC_SUBST([CFLAGS_MPI]) |
| 2600 | AC_SUBST([LDFLAGS_MPI]) |
| 2601 | |
| 2602 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2603 | ## See if MPI_CC works for the primary target |
| 2604 | ## |
| 2605 | 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] | 2606 | saved_CC=$CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 2607 | saved_CFLAGS=$CFLAGS |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 2608 | CC=$MPI_CC |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2609 | CFLAGS="$CFLAGS_MPI $mflag_primary" |
| 2610 | saved_LDFLAGS="$LDFLAGS" |
| 2611 | LDFLAGS="$LDFLAGS_MPI $mflag_primary" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2612 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 2613 | #include <mpi.h> |
| 2614 | #include <stdio.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2615 | ]], [[ |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2616 | int ni, na, nd, comb; |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 2617 | int r = MPI_Init(NULL,NULL); |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2618 | r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb ); |
| 2619 | r |= MPI_Finalize(); |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 2620 | return r; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2621 | ]])], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2622 | ac_have_mpi2_pri=yes |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 2623 | AC_MSG_RESULT([yes, $MPI_CC]) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 2624 | ], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2625 | ac_have_mpi2_pri=no |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 2626 | AC_MSG_RESULT([no]) |
| 2627 | ]) |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 2628 | CC=$saved_CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 2629 | CFLAGS=$saved_CFLAGS |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2630 | LDFLAGS="$saved_LDFLAGS" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2631 | AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 2632 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2633 | ## See if MPI_CC works for the secondary target. Complication: what if |
| 2634 | ## there is no secondary target? We need this to then fail. |
| 2635 | ## Kludge this by making MPI_CC something which will surely fail in |
| 2636 | ## such a case. |
| 2637 | ## |
| 2638 | AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h]) |
| 2639 | saved_CC=$CC |
| 2640 | saved_CFLAGS=$CFLAGS |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2641 | saved_LDFLAGS="$LDFLAGS" |
| 2642 | LDFLAGS="$LDFLAGS_MPI $mflag_secondary" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2643 | if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2644 | CC="$MPI_CC this will surely fail" |
| 2645 | else |
| 2646 | CC=$MPI_CC |
| 2647 | fi |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2648 | CFLAGS="$CFLAGS_MPI $mflag_secondary" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2649 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2650 | #include <mpi.h> |
| 2651 | #include <stdio.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2652 | ]], [[ |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2653 | int ni, na, nd, comb; |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2654 | int r = MPI_Init(NULL,NULL); |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2655 | r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb ); |
| 2656 | r |= MPI_Finalize(); |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2657 | return r; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2658 | ]])], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2659 | ac_have_mpi2_sec=yes |
| 2660 | AC_MSG_RESULT([yes, $MPI_CC]) |
| 2661 | ], [ |
| 2662 | ac_have_mpi2_sec=no |
| 2663 | AC_MSG_RESULT([no]) |
| 2664 | ]) |
| 2665 | CC=$saved_CC |
| 2666 | CFLAGS=$saved_CFLAGS |
philippe | f7c5433 | 2012-05-17 15:32:54 +0000 | [diff] [blame] | 2667 | LDFLAGS="$saved_LDFLAGS" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 2668 | AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 2669 | |
| 2670 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2671 | #---------------------------------------------------------------------------- |
| 2672 | # Other library checks |
| 2673 | #---------------------------------------------------------------------------- |
bart | 2ef12d4 | 2010-10-18 16:32:11 +0000 | [diff] [blame] | 2674 | # There now follow some tests for Boost, and OpenMP. These |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2675 | # tests are present because Drd has some regression tests that use |
| 2676 | # these packages. All regression test programs all compiled only |
| 2677 | # for the primary target. And so it is important that the configure |
| 2678 | # checks that follow, use the correct -m32 or -m64 flag for the |
| 2679 | # primary target (called $mflag_primary). Otherwise, we can end up |
| 2680 | # in a situation (eg) where, on amd64-linux, the test for Boost checks |
| 2681 | # for usable 64-bit Boost facilities, but because we are doing a 32-bit |
| 2682 | # only build (meaning, the primary target is x86-linux), the build |
| 2683 | # of the regtest programs that use Boost fails, because they are |
| 2684 | # build as 32-bit (IN THIS EXAMPLE). |
| 2685 | # |
| 2686 | # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES |
| 2687 | # NEEDED BY THE REGRESSION TEST PROGRAMS. |
| 2688 | |
| 2689 | |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2690 | # Check whether the boost library 1.35 or later has been installed. |
| 2691 | # The Boost.Threads library has undergone a major rewrite in version 1.35.0. |
| 2692 | |
| 2693 | AC_MSG_CHECKING([for boost]) |
| 2694 | |
| 2695 | AC_LANG(C++) |
| 2696 | safe_CXXFLAGS=$CXXFLAGS |
bart | 7129c72 | 2012-04-18 18:34:22 +0000 | [diff] [blame] | 2697 | CXXFLAGS="$mflag_primary" |
| 2698 | safe_LIBS="$LIBS" |
bart | ce93f9e | 2014-06-12 07:45:23 +0000 | [diff] [blame] | 2699 | LIBS="-lboost_thread-mt -lboost_system-mt $LIBS" |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2700 | |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 2701 | AC_LINK_IFELSE([AC_LANG_SOURCE([ |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2702 | #include <boost/thread.hpp> |
| 2703 | static void thread_func(void) |
| 2704 | { } |
| 2705 | int main(int argc, char** argv) |
| 2706 | { |
| 2707 | boost::thread t(thread_func); |
| 2708 | return 0; |
| 2709 | } |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 2710 | ])], |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2711 | [ |
| 2712 | ac_have_boost_1_35=yes |
| 2713 | AC_SUBST([BOOST_CFLAGS], []) |
bart | ce93f9e | 2014-06-12 07:45:23 +0000 | [diff] [blame] | 2714 | AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"]) |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2715 | AC_MSG_RESULT([yes]) |
| 2716 | ], [ |
| 2717 | ac_have_boost_1_35=no |
| 2718 | AC_MSG_RESULT([no]) |
| 2719 | ]) |
| 2720 | |
bart | 7129c72 | 2012-04-18 18:34:22 +0000 | [diff] [blame] | 2721 | LIBS="$safe_LIBS" |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2722 | CXXFLAGS=$safe_CXXFLAGS |
| 2723 | AC_LANG(C) |
| 2724 | |
| 2725 | AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes]) |
| 2726 | |
| 2727 | |
| 2728 | # does this compiler support -fopenmp, does it have the include file |
| 2729 | # <omp.h> and does it have libgomp ? |
| 2730 | |
| 2731 | AC_MSG_CHECKING([for OpenMP]) |
| 2732 | |
| 2733 | safe_CFLAGS=$CFLAGS |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 2734 | CFLAGS="-fopenmp $mflag_primary" |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2735 | |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 2736 | AC_LINK_IFELSE([AC_LANG_SOURCE([ |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2737 | #include <omp.h> |
| 2738 | int main(int argc, char** argv) |
| 2739 | { |
| 2740 | omp_set_dynamic(0); |
| 2741 | return 0; |
| 2742 | } |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 2743 | ])], |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 2744 | [ |
| 2745 | ac_have_openmp=yes |
| 2746 | AC_MSG_RESULT([yes]) |
| 2747 | ], [ |
| 2748 | ac_have_openmp=no |
| 2749 | AC_MSG_RESULT([no]) |
| 2750 | ]) |
| 2751 | CFLAGS=$safe_CFLAGS |
| 2752 | |
| 2753 | AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes]) |
| 2754 | |
| 2755 | |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2756 | # does this compiler have built-in functions for atomic memory access for the |
| 2757 | # primary target ? |
| 2758 | AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target]) |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 2759 | |
| 2760 | safe_CFLAGS=$CFLAGS |
| 2761 | CFLAGS="$mflag_primary" |
| 2762 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2763 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 2764 | int variable = 1; |
| 2765 | return (__sync_bool_compare_and_swap(&variable, 1, 2) |
| 2766 | && __sync_add_and_fetch(&variable, 1) ? 1 : 0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2767 | ]])], [ |
bart | b4ff782 | 2011-12-10 19:48:04 +0000 | [diff] [blame] | 2768 | ac_have_builtin_atomic_primary=yes |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 2769 | AC_MSG_RESULT([yes]) |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2770 | AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch() for the primary target]) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2771 | ], [ |
bart | b4ff782 | 2011-12-10 19:48:04 +0000 | [diff] [blame] | 2772 | ac_have_builtin_atomic_primary=no |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 2773 | AC_MSG_RESULT([no]) |
| 2774 | ]) |
| 2775 | |
| 2776 | CFLAGS=$safe_CFLAGS |
| 2777 | |
bart | b4ff782 | 2011-12-10 19:48:04 +0000 | [diff] [blame] | 2778 | AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], |
| 2779 | [test x$ac_have_builtin_atomic_primary = xyes]) |
bart | c82d137 | 2009-05-31 16:21:23 +0000 | [diff] [blame] | 2780 | |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2781 | |
| 2782 | # does this compiler have built-in functions for atomic memory access for the |
| 2783 | # secondary target ? |
| 2784 | |
| 2785 | if test x$VGCONF_PLATFORM_SEC_CAPS != x; then |
| 2786 | |
| 2787 | AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target]) |
| 2788 | |
| 2789 | safe_CFLAGS=$CFLAGS |
| 2790 | CFLAGS="$mflag_secondary" |
| 2791 | |
| 2792 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 2793 | int variable = 1; |
| 2794 | return (__sync_add_and_fetch(&variable, 1) ? 1 : 0) |
| 2795 | ]])], [ |
| 2796 | ac_have_builtin_atomic_secondary=yes |
| 2797 | AC_MSG_RESULT([yes]) |
| 2798 | ], [ |
| 2799 | ac_have_builtin_atomic_secondary=no |
| 2800 | AC_MSG_RESULT([no]) |
| 2801 | ]) |
| 2802 | |
| 2803 | CFLAGS=$safe_CFLAGS |
| 2804 | |
| 2805 | fi |
| 2806 | |
| 2807 | AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY], |
| 2808 | [test x$ac_have_builtin_atomic_secondary = xyes]) |
| 2809 | |
bart | 1e856ea | 2011-12-17 12:53:23 +0000 | [diff] [blame] | 2810 | # does this compiler have built-in functions for atomic memory access on |
| 2811 | # 64-bit integers for all targets ? |
| 2812 | |
| 2813 | AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets]) |
| 2814 | |
| 2815 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2816 | #include <stdint.h> |
| 2817 | ]], [[ |
| 2818 | uint64_t variable = 1; |
| 2819 | return __sync_add_and_fetch(&variable, 1) |
| 2820 | ]])], [ |
| 2821 | ac_have_builtin_atomic64_primary=yes |
| 2822 | ], [ |
| 2823 | ac_have_builtin_atomic64_primary=no |
| 2824 | ]) |
| 2825 | |
| 2826 | if test x$VGCONF_PLATFORM_SEC_CAPS != x; then |
| 2827 | |
| 2828 | safe_CFLAGS=$CFLAGS |
| 2829 | CFLAGS="$mflag_secondary" |
| 2830 | |
| 2831 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2832 | #include <stdint.h> |
| 2833 | ]], [[ |
| 2834 | uint64_t variable = 1; |
| 2835 | return __sync_add_and_fetch(&variable, 1) |
| 2836 | ]])], [ |
| 2837 | ac_have_builtin_atomic64_secondary=yes |
| 2838 | ], [ |
| 2839 | ac_have_builtin_atomic64_secondary=no |
| 2840 | ]) |
| 2841 | |
| 2842 | CFLAGS=$safe_CFLAGS |
| 2843 | |
| 2844 | fi |
| 2845 | |
| 2846 | if test x$ac_have_builtin_atomic64_primary = xyes && \ |
| 2847 | test x$VGCONF_PLATFORM_SEC_CAPS = x \ |
| 2848 | -o x$ac_have_builtin_atomic64_secondary = xyes; then |
| 2849 | AC_MSG_RESULT([yes]) |
| 2850 | ac_have_builtin_atomic64=yes |
| 2851 | else |
| 2852 | AC_MSG_RESULT([no]) |
| 2853 | ac_have_builtin_atomic64=no |
| 2854 | fi |
| 2855 | |
| 2856 | AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64], |
| 2857 | [test x$ac_have_builtin_atomic64 = xyes]) |
| 2858 | |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2859 | |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 2860 | # does g++ have built-in functions for atomic memory access ? |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2861 | AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch]) |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 2862 | |
| 2863 | safe_CXXFLAGS=$CXXFLAGS |
| 2864 | CXXFLAGS="$mflag_primary" |
| 2865 | |
| 2866 | AC_LANG_PUSH(C++) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2867 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 2868 | int variable = 1; |
| 2869 | return (__sync_bool_compare_and_swap(&variable, 1, 2) |
| 2870 | && __sync_add_and_fetch(&variable, 1) ? 1 : 0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2871 | ]])], [ |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 2872 | ac_have_builtin_atomic_cxx=yes |
| 2873 | AC_MSG_RESULT([yes]) |
| 2874 | AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()]) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 2875 | ], [ |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 2876 | ac_have_builtin_atomic_cxx=no |
| 2877 | AC_MSG_RESULT([no]) |
| 2878 | ]) |
| 2879 | AC_LANG_POP(C++) |
| 2880 | |
| 2881 | CXXFLAGS=$safe_CXXFLAGS |
| 2882 | |
| 2883 | 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] | 2884 | |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2885 | |
| 2886 | if test x$ac_have_usable_linux_futex_h = xyes \ |
bart | b4ff782 | 2011-12-10 19:48:04 +0000 | [diff] [blame] | 2887 | -a x$ac_have_builtin_atomic_primary = xyes; then |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2888 | ac_enable_linux_ticket_lock_primary=yes |
| 2889 | fi |
| 2890 | AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY], |
| 2891 | [test x$ac_enable_linux_ticket_lock_primary = xyes]) |
| 2892 | |
| 2893 | if test x$VGCONF_PLATFORM_SEC_CAPS != x \ |
| 2894 | -a x$ac_have_usable_linux_futex_h = xyes \ |
| 2895 | -a x$ac_have_builtin_atomic_secondary = xyes; then |
| 2896 | ac_enable_linux_ticket_lock_secondary=yes |
| 2897 | fi |
| 2898 | AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY], |
| 2899 | [test x$ac_enable_linux_ticket_lock_secondary = xyes]) |
| 2900 | |
| 2901 | |
bart | f68af88 | 2011-12-10 19:42:05 +0000 | [diff] [blame] | 2902 | # does libstdc++ support annotating shared pointers ? |
| 2903 | AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers]) |
| 2904 | |
florian | d79b3bf | 2013-10-02 15:14:59 +0000 | [diff] [blame] | 2905 | safe_CXXFLAGS=$CXXFLAGS |
bart | f68af88 | 2011-12-10 19:42:05 +0000 | [diff] [blame] | 2906 | CXXFLAGS="-std=c++0x" |
| 2907 | |
| 2908 | AC_LANG_PUSH(C++) |
| 2909 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2910 | #include <memory> |
| 2911 | ]], [[ |
| 2912 | std::shared_ptr<int> p |
| 2913 | ]])], [ |
| 2914 | ac_have_shared_ptr=yes |
| 2915 | ], [ |
| 2916 | ac_have_shared_ptr=no |
| 2917 | ]) |
| 2918 | if test x$ac_have_shared_ptr = xyes; then |
| 2919 | # If compilation of the program below fails because of a syntax error |
| 2920 | # triggered by substituting one of the annotation macros then that |
| 2921 | # means that libstdc++ supports these macros. |
| 2922 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2923 | #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)---- |
| 2924 | #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)---- |
| 2925 | #include <memory> |
| 2926 | ]], [[ |
| 2927 | std::shared_ptr<int> p |
| 2928 | ]])], [ |
| 2929 | ac_have_shared_pointer_annotation=no |
| 2930 | AC_MSG_RESULT([no]) |
| 2931 | ], [ |
| 2932 | ac_have_shared_pointer_annotation=yes |
| 2933 | AC_MSG_RESULT([yes]) |
| 2934 | AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1, |
| 2935 | [Define to 1 if libstd++ supports annotating shared pointers]) |
| 2936 | ]) |
| 2937 | else |
| 2938 | ac_have_shared_pointer_annotation=no |
| 2939 | AC_MSG_RESULT([no]) |
| 2940 | fi |
| 2941 | AC_LANG_POP(C++) |
| 2942 | |
| 2943 | CXXFLAGS=$safe_CXXFLAGS |
| 2944 | |
| 2945 | AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION], |
| 2946 | [test x$ac_have_shared_pointer_annotation = xyes]) |
| 2947 | |
| 2948 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2949 | #---------------------------------------------------------------------------- |
| 2950 | # Ok. We're done checking. |
| 2951 | #---------------------------------------------------------------------------- |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 2952 | |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2953 | # Nb: VEX/Makefile is generated from Makefile.vex.in. |
| 2954 | AC_CONFIG_FILES([ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2955 | Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2956 | VEX/Makefile:Makefile.vex.in |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2957 | valgrind.spec |
mueller | bddd607 | 2003-11-19 21:50:07 +0000 | [diff] [blame] | 2958 | valgrind.pc |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 2959 | glibc-2.X.supp |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 2960 | docs/Makefile |
| 2961 | tests/Makefile |
njn | c2e7f48 | 2002-09-27 08:44:17 +0000 | [diff] [blame] | 2962 | tests/vg_regtest |
njn | ec0c27a | 2005-12-10 23:11:28 +0000 | [diff] [blame] | 2963 | perf/Makefile |
| 2964 | perf/vg_perf |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 2965 | gdbserver_tests/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 2966 | include/Makefile |
njn | 7a6e746 | 2002-11-09 17:53:30 +0000 | [diff] [blame] | 2967 | auxprogs/Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2968 | mpi/Makefile |
njn25 | ab72603 | 2002-09-23 16:24:41 +0000 | [diff] [blame] | 2969 | coregrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2970 | memcheck/Makefile |
| 2971 | memcheck/tests/Makefile |
florian | e42cca5 | 2013-08-29 17:59:27 +0000 | [diff] [blame] | 2972 | memcheck/tests/common/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 2973 | memcheck/tests/amd64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 2974 | memcheck/tests/x86/Makefile |
njn | 3b3b76d | 2009-01-19 03:44:19 +0000 | [diff] [blame] | 2975 | memcheck/tests/linux/Makefile |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 2976 | memcheck/tests/darwin/Makefile |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 2977 | memcheck/tests/amd64-linux/Makefile |
njn | a454ec0 | 2009-01-19 03:16:59 +0000 | [diff] [blame] | 2978 | memcheck/tests/x86-linux/Makefile |
sewardj | 0e342a0 | 2010-09-03 23:49:33 +0000 | [diff] [blame] | 2979 | memcheck/tests/ppc32/Makefile |
| 2980 | memcheck/tests/ppc64/Makefile |
florian | 0bb707e | 2012-05-30 20:46:58 +0000 | [diff] [blame] | 2981 | memcheck/tests/s390x/Makefile |
florian | bb913cd | 2012-08-28 16:50:39 +0000 | [diff] [blame] | 2982 | memcheck/tests/vbit-test/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2983 | cachegrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2984 | cachegrind/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 2985 | cachegrind/tests/x86/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 2986 | cachegrind/cg_annotate |
njn | 69d495d | 2010-06-30 05:23:34 +0000 | [diff] [blame] | 2987 | cachegrind/cg_diff |
weidendo | a17f2a3 | 2006-03-20 10:27:30 +0000 | [diff] [blame] | 2988 | callgrind/Makefile |
| 2989 | callgrind/callgrind_annotate |
| 2990 | callgrind/callgrind_control |
| 2991 | callgrind/tests/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2992 | helgrind/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 2993 | helgrind/tests/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 2994 | massif/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 2995 | massif/tests/Makefile |
njn | d5a8d24 | 2007-11-02 20:44:57 +0000 | [diff] [blame] | 2996 | massif/ms_print |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2997 | lackey/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 2998 | lackey/tests/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2999 | none/Makefile |
| 3000 | none/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 3001 | none/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 3002 | none/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 3003 | none/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 3004 | none/tests/x86/Makefile |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 3005 | none/tests/arm/Makefile |
sewardj | f02d2ec | 2014-08-26 19:28:09 +0000 | [diff] [blame] | 3006 | none/tests/arm64/Makefile |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 3007 | none/tests/s390x/Makefile |
sewardj | 5db1540 | 2012-06-07 09:13:21 +0000 | [diff] [blame] | 3008 | none/tests/mips32/Makefile |
petarj | 8bea867 | 2013-05-10 13:14:54 +0000 | [diff] [blame] | 3009 | none/tests/mips64/Makefile |
njn | 0458a12 | 2009-02-13 06:23:46 +0000 | [diff] [blame] | 3010 | none/tests/linux/Makefile |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 3011 | none/tests/darwin/Makefile |
njn | 06ca332 | 2009-04-15 23:10:04 +0000 | [diff] [blame] | 3012 | none/tests/x86-linux/Makefile |
sewardj | d2f95a0 | 2011-05-11 16:04:28 +0000 | [diff] [blame] | 3013 | exp-sgcheck/Makefile |
| 3014 | exp-sgcheck/tests/Makefile |
bart | ccf17de | 2008-07-04 15:14:35 +0000 | [diff] [blame] | 3015 | drd/Makefile |
bart | ccf17de | 2008-07-04 15:14:35 +0000 | [diff] [blame] | 3016 | drd/scripts/download-and-build-splash2 |
| 3017 | drd/tests/Makefile |
njn | dbebecc | 2009-07-14 01:39:54 +0000 | [diff] [blame] | 3018 | exp-bbv/Makefile |
njn | dbebecc | 2009-07-14 01:39:54 +0000 | [diff] [blame] | 3019 | exp-bbv/tests/Makefile |
| 3020 | exp-bbv/tests/x86/Makefile |
| 3021 | exp-bbv/tests/x86-linux/Makefile |
| 3022 | exp-bbv/tests/amd64-linux/Makefile |
| 3023 | exp-bbv/tests/ppc32-linux/Makefile |
vince | 226e078 | 2010-01-06 15:22:11 +0000 | [diff] [blame] | 3024 | exp-bbv/tests/arm-linux/Makefile |
sewardj | 4d7d8f5 | 2010-10-12 10:09:15 +0000 | [diff] [blame] | 3025 | exp-dhat/Makefile |
| 3026 | exp-dhat/tests/Makefile |
mjw | aeacd28 | 2014-03-11 19:30:32 +0000 | [diff] [blame] | 3027 | shared/Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 3028 | ]) |
sewardj | d364580 | 2010-06-13 22:13:58 +0000 | [diff] [blame] | 3029 | AC_CONFIG_FILES([coregrind/link_tool_exe_linux], |
| 3030 | [chmod +x coregrind/link_tool_exe_linux]) |
| 3031 | AC_CONFIG_FILES([coregrind/link_tool_exe_darwin], |
| 3032 | [chmod +x coregrind/link_tool_exe_darwin]) |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 3033 | AC_OUTPUT |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 3034 | |
| 3035 | cat<<EOF |
| 3036 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 3037 | Maximum build arch: ${ARCH_MAX} |
| 3038 | Primary build arch: ${VGCONF_ARCH_PRI} |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 3039 | Secondary build arch: ${VGCONF_ARCH_SEC} |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 3040 | Build OS: ${VGCONF_OS} |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 3041 | Primary build target: ${VGCONF_PLATFORM_PRI_CAPS} |
| 3042 | Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS} |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 3043 | Platform variant: ${VGCONF_PLATVARIANT} |
| 3044 | Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1 |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 3045 | Default supp files: ${DEFAULT_SUPP} |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 3046 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 3047 | EOF |