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