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