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