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