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 | 96e6aa6 | 2011-10-25 09:20:05 +0000 | [diff] [blame] | 11 | AC_INIT([Valgrind],[3.8.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]) |
bart | 3a2dac0 | 2008-03-18 17:40:38 +0000 | [diff] [blame] | 14 | AM_INIT_AUTOMAKE([foreign]) |
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" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 22 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 23 | AC_PROG_LN_S |
| 24 | AC_PROG_CC |
bart | 0affa49 | 2008-03-18 17:53:09 +0000 | [diff] [blame] | 25 | AM_PROG_CC_C_O |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 26 | AC_PROG_CPP |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 27 | AC_PROG_CXX |
njn | 629a5ec | 2009-07-14 01:29:39 +0000 | [diff] [blame] | 28 | # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with |
| 29 | # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code |
| 30 | # base (eg. most likely as Darwin-specific tests) we'll need one of the |
| 31 | # following: |
njn | 0cd2689 | 2009-07-12 23:07:13 +0000 | [diff] [blame] | 32 | # - put AC_PROG_OBJC in a Darwin-specific part of this file |
| 33 | # - Use AC_PROG_OBJC here and up the minimum autoconf version |
| 34 | # - Use the following, which is apparently equivalent: |
| 35 | # m4_ifdef([AC_PROG_OBJC], |
| 36 | # [AC_PROG_OBJC], |
| 37 | # [AC_CHECK_TOOL([OBJC], [gcc]) |
| 38 | # AC_SUBST([OBJC]) |
| 39 | # AC_SUBST([OBJCFLAGS]) |
| 40 | # ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 41 | AC_PROG_RANLIB |
bart | 07de2c9 | 2010-05-29 06:44:28 +0000 | [diff] [blame] | 42 | # provide a very basic definition for AC_PROG_SED if it's not provided by |
| 43 | # autoconf (as e.g. in autoconf 2.59). |
| 44 | m4_ifndef([AC_PROG_SED], |
| 45 | [AC_DEFUN([AC_PROG_SED], |
| 46 | [AC_ARG_VAR([SED]) |
| 47 | AC_CHECK_PROGS([SED],[gsed sed])])]) |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 48 | AC_PROG_SED |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 49 | |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 50 | # If no AR variable was specified, look up the name of the archiver. Otherwise |
| 51 | # do not touch the AR variable. |
| 52 | if test "x$AR" = "x"; then |
bart | 07de2c9 | 2010-05-29 06:44:28 +0000 | [diff] [blame] | 53 | AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar]) |
bart | cddeaf5 | 2008-05-25 15:58:11 +0000 | [diff] [blame] | 54 | fi |
| 55 | AC_ARG_VAR([AR],[Archiver command]) |
| 56 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 57 | # Check for the compiler support |
| 58 | if test "${GCC}" != "yes" ; then |
| 59 | AC_MSG_ERROR([Valgrind relies on GCC to be compiled]) |
| 60 | fi |
| 61 | |
sewardj | 2f68595 | 2002-12-22 19:32:23 +0000 | [diff] [blame] | 62 | # figure out where perl lives |
| 63 | AC_PATH_PROG(PERL, perl) |
| 64 | |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 65 | # figure out where gdb lives |
sewardj | f8722ca | 2008-11-17 00:20:45 +0000 | [diff] [blame] | 66 | AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time") |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 67 | AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB]) |
njn | 9315df3 | 2003-04-16 20:50:50 +0000 | [diff] [blame] | 68 | |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 69 | # some older automake's don't have it so try something on our own |
| 70 | ifdef([AM_PROG_AS],[AM_PROG_AS], |
| 71 | [ |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 72 | AS="${CC}" |
| 73 | AC_SUBST(AS) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 74 | |
gobry | 1be1985 | 2002-03-26 20:44:55 +0000 | [diff] [blame] | 75 | ASFLAGS="" |
| 76 | AC_SUBST(ASFLAGS) |
daywalker | 48ccca5 | 2002-04-15 00:31:58 +0000 | [diff] [blame] | 77 | ]) |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 78 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 79 | |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 80 | # Check if 'diff' supports -u (universal diffs) and use it if possible. |
| 81 | |
| 82 | AC_MSG_CHECKING([for diff -u]) |
| 83 | AC_SUBST(DIFF) |
| 84 | |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 85 | # Comparing two identical files results in 0. |
njn | 31f665e | 2009-02-26 21:25:50 +0000 | [diff] [blame] | 86 | tmpfile="tmp-xxx-yyy-zzz" |
| 87 | touch $tmpfile; |
| 88 | if diff -u $tmpfile $tmpfile ; then |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 89 | AC_MSG_RESULT([yes]) |
| 90 | DIFF="diff -u" |
| 91 | else |
| 92 | AC_MSG_RESULT([no]) |
| 93 | DIFF="diff" |
| 94 | fi |
njn | 31f665e | 2009-02-26 21:25:50 +0000 | [diff] [blame] | 95 | rm $tmpfile |
njn | 0d2e58f | 2009-02-25 04:57:56 +0000 | [diff] [blame] | 96 | |
| 97 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 98 | # We don't want gcc < 3.0 |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 99 | AC_MSG_CHECKING([for a supported version of gcc]) |
| 100 | |
bart | 8503744 | 2011-11-22 14:41:31 +0000 | [diff] [blame] | 101 | # Obtain the compiler version. |
sewardj | a8ca2c5 | 2011-09-29 18:18:37 +0000 | [diff] [blame] | 102 | # |
bart | 8503744 | 2011-11-22 14:41:31 +0000 | [diff] [blame] | 103 | # A few examples of how the ${CC} --version output looks like: |
| 104 | # |
| 105 | # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2 |
| 106 | # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2 |
| 107 | # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585] |
| 108 | # 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] | 109 | # 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] | 110 | # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) |
| 111 | # 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) |
| 112 | # Clang: clang version 2.9 (tags/RELEASE_29/final) |
sewardj | a8ca2c5 | 2011-09-29 18:18:37 +0000 | [diff] [blame] | 113 | # |
bart | c521406 | 2012-01-11 11:34:23 +0000 | [diff] [blame] | 114 | [ |
| 115 | gcc_version=`${CC} -dumpversion 2>/dev/null` |
| 116 | if test "x$gcc_version" = x; then |
| 117 | gcc_version=`${CC} --version \ |
| 118 | | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p' \ |
| 119 | -e 's/[^ ]*clang version \([0-9.]*\).*$/\1/p'` |
| 120 | fi |
| 121 | ] |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 122 | |
sewardj | 3ab7b66 | 2011-09-29 17:30:13 +0000 | [diff] [blame] | 123 | is_clang="notclang" |
| 124 | if test "x`${CC} --version | head -n 1 | $SED 's/\(clang\) version.*/\1/'`" = "xclang" ; then |
| 125 | is_clang="clang" |
| 126 | fi |
| 127 | |
| 128 | case "${is_clang}-${gcc_version}" in |
| 129 | notclang-3.*) |
| 130 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 131 | ;; |
| 132 | notclang-4.*) |
| 133 | AC_MSG_RESULT([ok (${gcc_version})]) |
| 134 | ;; |
| 135 | clang-2.9) |
| 136 | AC_MSG_RESULT([ok (clang-${gcc_version})]) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 137 | ;; |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 138 | *) |
sewardj | 3ab7b66 | 2011-09-29 17:30:13 +0000 | [diff] [blame] | 139 | AC_MSG_RESULT([no (${gcc_version})]) |
| 140 | AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9]) |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 141 | ;; |
| 142 | esac |
| 143 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 144 | #---------------------------------------------------------------------------- |
| 145 | # Arch/OS/platform tests. |
| 146 | #---------------------------------------------------------------------------- |
| 147 | # We create a number of arch/OS/platform-related variables. We prefix them |
| 148 | # all with "VGCONF_" which indicates that they are defined at |
| 149 | # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_* |
| 150 | # variables used when compiling C files. |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 151 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 152 | AC_CANONICAL_HOST |
| 153 | |
| 154 | AC_MSG_CHECKING([for a supported CPU]) |
sewardj | bc692db | 2006-01-04 03:31:07 +0000 | [diff] [blame] | 155 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 156 | # ARCH_MAX reflects the most that this CPU can do: for example if it |
| 157 | # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32. |
| 158 | # Ditto for amd64. It is used for more configuration below, but is not used |
| 159 | # outside this file. |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 160 | case "${host_cpu}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 161 | i?86) |
| 162 | AC_MSG_RESULT([ok (${host_cpu})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 163 | ARCH_MAX="x86" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 164 | ;; |
| 165 | |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 166 | x86_64) |
| 167 | AC_MSG_RESULT([ok (${host_cpu})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 168 | ARCH_MAX="amd64" |
njn | fe40894 | 2004-11-23 17:52:24 +0000 | [diff] [blame] | 169 | ;; |
| 170 | |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 171 | powerpc64) |
| 172 | AC_MSG_RESULT([ok (${host_cpu})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 173 | ARCH_MAX="ppc64" |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 174 | ;; |
| 175 | |
| 176 | powerpc) |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 177 | # On Linux this means only a 32-bit capable CPU. |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 178 | AC_MSG_RESULT([ok (${host_cpu})]) |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 179 | ARCH_MAX="ppc32" |
nethercote | 9bcc906 | 2004-10-13 13:50:01 +0000 | [diff] [blame] | 180 | ;; |
| 181 | |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 182 | s390x) |
| 183 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 184 | ARCH_MAX="s390x" |
| 185 | ;; |
| 186 | |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 187 | armv7*) |
| 188 | AC_MSG_RESULT([ok (${host_cpu})]) |
| 189 | ARCH_MAX="arm" |
| 190 | ;; |
| 191 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 192 | *) |
| 193 | AC_MSG_RESULT([no (${host_cpu})]) |
nethercote | 81d5c66 | 2004-10-13 13:18:51 +0000 | [diff] [blame] | 194 | AC_MSG_ERROR([Unsupported host architecture. Sorry]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 195 | ;; |
| 196 | esac |
| 197 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 198 | #---------------------------------------------------------------------------- |
| 199 | |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 200 | # Sometimes it's convenient to subvert the bi-arch build system and |
| 201 | # just have a single build even though the underlying platform is |
| 202 | # capable of both. Hence handle --enable-only64bit and |
| 203 | # --enable-only32bit. Complain if both are issued :-) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 204 | # [Actually, if either of these options are used, I think both get built, |
| 205 | # but only one gets installed. So if you use an in-place build, both can be |
| 206 | # used. --njn] |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 207 | |
| 208 | # Check if a 64-bit only build has been requested |
| 209 | AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit, |
| 210 | [AC_ARG_ENABLE(only64bit, |
| 211 | [ --enable-only64bit do a 64-bit only build], |
| 212 | [vg_cv_only64bit=$enableval], |
| 213 | [vg_cv_only64bit=no])]) |
| 214 | |
| 215 | # Check if a 32-bit only build has been requested |
| 216 | AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit, |
| 217 | [AC_ARG_ENABLE(only32bit, |
| 218 | [ --enable-only32bit do a 32-bit only build], |
| 219 | [vg_cv_only32bit=$enableval], |
| 220 | [vg_cv_only32bit=no])]) |
| 221 | |
| 222 | # Stay sane |
| 223 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 224 | AC_MSG_ERROR( |
| 225 | [Nonsensical: both --enable-only64bit and --enable-only32bit.]) |
| 226 | fi |
| 227 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 228 | #---------------------------------------------------------------------------- |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 229 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 230 | # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to |
| 231 | # compilation of many C files via -VGO_$(VGCONF_OS) and |
| 232 | # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS). |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 233 | AC_MSG_CHECKING([for a supported OS]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 234 | AC_SUBST(VGCONF_OS) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 235 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 236 | DEFAULT_SUPP="" |
| 237 | |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 238 | case "${host_os}" in |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 239 | *linux*) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 240 | AC_MSG_RESULT([ok (${host_os})]) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 241 | VGCONF_OS="linux" |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 242 | |
| 243 | # Ok, this is linux. Check the kernel version |
| 244 | AC_MSG_CHECKING([for the kernel version]) |
| 245 | |
| 246 | kernel=`uname -r` |
| 247 | |
| 248 | case "${kernel}" in |
bart | 0419e51 | 2011-06-05 08:51:47 +0000 | [diff] [blame] | 249 | 2.6.*|3.*) |
bart | 2d6e6e7 | 2011-06-05 10:01:48 +0000 | [diff] [blame] | 250 | AC_MSG_RESULT([2.6.x/3.x family (${kernel})]) |
| 251 | 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] | 252 | ;; |
| 253 | |
| 254 | 2.4.*) |
| 255 | AC_MSG_RESULT([2.4 family (${kernel})]) |
| 256 | AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x]) |
| 257 | ;; |
| 258 | |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 259 | *) |
| 260 | AC_MSG_RESULT([unsupported (${kernel})]) |
nethercote | 4fa681f | 2004-11-08 17:51:39 +0000 | [diff] [blame] | 261 | AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6]) |
mueller | 8c68e04 | 2004-01-03 15:21:14 +0000 | [diff] [blame] | 262 | ;; |
| 263 | esac |
| 264 | |
| 265 | ;; |
| 266 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 267 | *darwin*) |
| 268 | AC_MSG_RESULT([ok (${host_os})]) |
| 269 | VGCONF_OS="darwin" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 270 | AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5]) |
| 271 | AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6]) |
| 272 | AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 273 | |
| 274 | AC_MSG_CHECKING([for the kernel version]) |
| 275 | kernel=`uname -r` |
| 276 | |
| 277 | # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin |
| 278 | # has only one relevant version, the OS version. The `uname` check |
| 279 | # 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] | 280 | # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard, |
| 281 | # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion), |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 282 | # 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] | 283 | # |
| 284 | # XXX: `uname -r` won't do the right thing for cross-compiles, but |
| 285 | # that's not a problem yet. |
sewardj | 731f9cf | 2011-09-21 08:43:08 +0000 | [diff] [blame] | 286 | # |
| 287 | # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work |
| 288 | # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0 |
| 289 | # on 10.6.8 and 10.7.1. Although tempted to delete the configure |
| 290 | # time support for 10.5 (the 9.* pattern just below), I'll leave it |
| 291 | # in for now, just in case anybody wants to give it a try. But I'm |
| 292 | # assuming that 3.7.0 is a Snow Leopard and Lion-only release. |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 293 | case "${kernel}" in |
| 294 | 9.*) |
| 295 | AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard]) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 296 | AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 297 | DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}" |
bart | 6ccda14 | 2009-07-23 07:37:32 +0000 | [diff] [blame] | 298 | DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 299 | ;; |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 300 | 10.*) |
| 301 | AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard]) |
| 302 | AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version]) |
| 303 | DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}" |
| 304 | DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" |
| 305 | ;; |
sewardj | 731f9cf | 2011-09-21 08:43:08 +0000 | [diff] [blame] | 306 | 11.*) |
| 307 | AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion]) |
| 308 | AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version]) |
| 309 | # FIXME: change these to xx11.supp |
| 310 | DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}" |
| 311 | DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" |
| 312 | ;; |
| 313 | *) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 314 | AC_MSG_RESULT([unsupported (${kernel})]) |
sewardj | 731f9cf | 2011-09-21 08:43:08 +0000 | [diff] [blame] | 315 | 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] | 316 | ;; |
| 317 | esac |
| 318 | ;; |
| 319 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 320 | *) |
| 321 | AC_MSG_RESULT([no (${host_os})]) |
njn | cc58cea | 2010-07-05 07:21:22 +0000 | [diff] [blame] | 322 | AC_MSG_ERROR([Valgrind is operating system specific. Sorry.]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 323 | ;; |
| 324 | esac |
| 325 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 326 | #---------------------------------------------------------------------------- |
| 327 | |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 328 | # If we are building on a 64 bit platform test to see if the system |
| 329 | # supports building 32 bit programs and disable 32 bit support if it |
| 330 | # does not support building 32 bit programs |
| 331 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 332 | case "$ARCH_MAX-$VGCONF_OS" in |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 333 | amd64-linux|ppc64-linux) |
| 334 | AC_MSG_CHECKING([for 32 bit build support]) |
| 335 | safe_CFLAGS=$CFLAGS |
| 336 | CFLAGS="-m32" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 337 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 338 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 339 | ]])], [ |
tom | d639839 | 2006-06-07 17:44:36 +0000 | [diff] [blame] | 340 | AC_MSG_RESULT([yes]) |
| 341 | ], [ |
| 342 | vg_cv_only64bit="yes" |
| 343 | AC_MSG_RESULT([no]) |
| 344 | ]) |
| 345 | CFLAGS=$safe_CFLAGS;; |
| 346 | esac |
| 347 | |
| 348 | if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then |
| 349 | AC_MSG_ERROR( |
| 350 | [--enable-only32bit was specified but system does not support 32 bit builds]) |
| 351 | fi |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 352 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 353 | #---------------------------------------------------------------------------- |
| 354 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 355 | # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By |
| 356 | # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64 |
| 357 | # machine, but --enable-only32bit has been requested, then ARCH_MAX (see |
| 358 | # above) will be "amd64" since that reflects the most that this cpu can do, |
| 359 | # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the |
| 360 | # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 361 | # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and |
| 362 | # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS). |
| 363 | AC_SUBST(VGCONF_ARCH_PRI) |
| 364 | |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 365 | # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86". |
| 366 | # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC) |
| 367 | # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target. |
| 368 | # It is empty if there is no secondary target. |
| 369 | AC_SUBST(VGCONF_ARCH_SEC) |
| 370 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 371 | # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX". |
| 372 | # The entire system, including regression and performance tests, will be |
| 373 | # built for this target. The "_CAPS" indicates that the name is in capital |
| 374 | # letters, and it also uses '_' rather than '-' as a separator, because it's |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 375 | # used to create various Makefile variables, which are all in caps by |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 376 | # convention and cannot contain '-' characters. This is in contrast to |
| 377 | # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 378 | AC_SUBST(VGCONF_PLATFORM_PRI_CAPS) |
| 379 | |
| 380 | # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one. |
| 381 | # Valgrind and tools will also be built for this target, but not the |
| 382 | # regression or performance tests. |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 383 | # |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 384 | # By default, the primary arch is the same as the "max" arch, as commented |
| 385 | # above (at the definition of ARCH_MAX). We may choose to downgrade it in |
| 386 | # the big case statement just below here, in the case where we're building |
| 387 | # on a 64 bit machine but have been requested only to do a 32 bit build. |
| 388 | AC_SUBST(VGCONF_PLATFORM_SEC_CAPS) |
| 389 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 390 | AC_MSG_CHECKING([for a supported CPU/OS combination]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 391 | |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 392 | # NB. The load address for a given platform may be specified in more |
| 393 | # than one place, in some cases, depending on whether we're doing a biarch, |
| 394 | # 32-bit only or 64-bit only build. eg see case for amd64-linux below. |
| 395 | # Be careful to give consistent values in all subcases. Also, all four |
| 396 | # valt_load_addres_{pri,sec}_{norml,inner} values must always be set, |
| 397 | # even if it is to "0xUNSET". |
| 398 | # |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 399 | case "$ARCH_MAX-$VGCONF_OS" in |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 400 | x86-linux) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 401 | VGCONF_ARCH_PRI="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 402 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 403 | VGCONF_PLATFORM_PRI_CAPS="X86_LINUX" |
| 404 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 405 | valt_load_address_pri_norml="0x38000000" |
| 406 | valt_load_address_pri_inner="0x28000000" |
| 407 | valt_load_address_sec_norml="0xUNSET" |
| 408 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 409 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 410 | ;; |
| 411 | amd64-linux) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 412 | valt_load_address_sec_norml="0xUNSET" |
| 413 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 414 | if test x$vg_cv_only64bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 415 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 416 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 417 | VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX" |
| 418 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 419 | valt_load_address_pri_norml="0x38000000" |
| 420 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 421 | elif test x$vg_cv_only32bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 422 | VGCONF_ARCH_PRI="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 423 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 424 | VGCONF_PLATFORM_PRI_CAPS="X86_LINUX" |
| 425 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 426 | valt_load_address_pri_norml="0x38000000" |
| 427 | valt_load_address_pri_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 428 | else |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 429 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 430 | VGCONF_ARCH_SEC="x86" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 431 | VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX" |
| 432 | VGCONF_PLATFORM_SEC_CAPS="X86_LINUX" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 433 | valt_load_address_pri_norml="0x38000000" |
| 434 | valt_load_address_pri_inner="0x28000000" |
| 435 | valt_load_address_sec_norml="0x38000000" |
| 436 | valt_load_address_sec_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 437 | fi |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 438 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 439 | ;; |
| 440 | ppc32-linux) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 441 | VGCONF_ARCH_PRI="ppc32" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 442 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 443 | VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX" |
| 444 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 445 | valt_load_address_pri_norml="0x38000000" |
| 446 | valt_load_address_pri_inner="0x28000000" |
| 447 | valt_load_address_sec_norml="0xUNSET" |
| 448 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 449 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 450 | ;; |
| 451 | ppc64-linux) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 452 | valt_load_address_sec_norml="0xUNSET" |
| 453 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 454 | if test x$vg_cv_only64bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 455 | VGCONF_ARCH_PRI="ppc64" |
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="PPC64_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 | elif test x$vg_cv_only32bit = xyes; then |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 462 | VGCONF_ARCH_PRI="ppc32" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 463 | VGCONF_ARCH_SEC="" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 464 | VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX" |
| 465 | VGCONF_PLATFORM_SEC_CAPS="" |
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" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 468 | else |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 469 | VGCONF_ARCH_PRI="ppc64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 470 | VGCONF_ARCH_SEC="ppc32" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 471 | VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX" |
| 472 | VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 473 | valt_load_address_pri_norml="0x38000000" |
| 474 | valt_load_address_pri_inner="0x28000000" |
| 475 | valt_load_address_sec_norml="0x38000000" |
| 476 | valt_load_address_sec_inner="0x28000000" |
sewardj | 86e992f | 2006-01-28 18:39:09 +0000 | [diff] [blame] | 477 | fi |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 478 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 479 | ;; |
njn | cc58cea | 2010-07-05 07:21:22 +0000 | [diff] [blame] | 480 | # Darwin gets identified as 32-bit even when it supports 64-bit. |
| 481 | # (Not sure why, possibly because 'uname' returns "i386"?) Just about |
| 482 | # all Macs support both 32-bit and 64-bit, so we just build both. If |
| 483 | # someone has a really old 32-bit only machine they can (hopefully?) |
| 484 | # build with --enable-only32bit. See bug 243362. |
| 485 | x86-darwin|amd64-darwin) |
| 486 | ARCH_MAX="amd64" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 487 | valt_load_address_sec_norml="0xUNSET" |
| 488 | valt_load_address_sec_inner="0xUNSET" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 489 | if test x$vg_cv_only64bit = xyes; then |
| 490 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 491 | VGCONF_ARCH_SEC="" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 492 | VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN" |
| 493 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 494 | valt_load_address_pri_norml="0x138000000" |
| 495 | valt_load_address_pri_inner="0x128000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 496 | elif test x$vg_cv_only32bit = xyes; then |
| 497 | VGCONF_ARCH_PRI="x86" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 498 | VGCONF_ARCH_SEC="" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 499 | VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN" |
| 500 | VGCONF_PLATFORM_SEC_CAPS="" |
| 501 | VGCONF_ARCH_PRI_CAPS="x86" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 502 | valt_load_address_pri_norml="0x38000000" |
| 503 | valt_load_address_pri_inner="0x28000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 504 | else |
| 505 | VGCONF_ARCH_PRI="amd64" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 506 | VGCONF_ARCH_SEC="x86" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 507 | VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN" |
| 508 | VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 509 | valt_load_address_pri_norml="0x138000000" |
| 510 | valt_load_address_pri_inner="0x128000000" |
| 511 | valt_load_address_sec_norml="0x38000000" |
| 512 | valt_load_address_sec_inner="0x28000000" |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 513 | fi |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 514 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
| 515 | ;; |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 516 | arm-linux) |
| 517 | VGCONF_ARCH_PRI="arm" |
| 518 | VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX" |
| 519 | VGCONF_PLATFORM_SEC_CAPS="" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 520 | valt_load_address_pri_norml="0x38000000" |
| 521 | valt_load_address_pri_inner="0x28000000" |
| 522 | valt_load_address_sec_norml="0xUNSET" |
| 523 | valt_load_address_sec_inner="0xUNSET" |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 524 | AC_MSG_RESULT([ok (${host_cpu}-${host_os})]) |
| 525 | ;; |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 526 | s390x-linux) |
| 527 | VGCONF_ARCH_PRI="s390x" |
| 528 | VGCONF_ARCH_SEC="" |
| 529 | VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX" |
| 530 | VGCONF_PLATFORM_SEC_CAPS="" |
| 531 | # we want to have the generated code close to the dispatcher |
| 532 | valt_load_address_pri_norml="0x401000000" |
| 533 | valt_load_address_pri_inner="0x410000000" |
| 534 | valt_load_address_sec_norml="0xUNSET" |
| 535 | valt_load_address_sec_inner="0xUNSET" |
| 536 | AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})]) |
| 537 | ;; |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 538 | *) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 539 | VGCONF_ARCH_PRI="unknown" |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 540 | VGCONF_ARCH_SEC="unknown" |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 541 | VGCONF_PLATFORM_PRI_CAPS="UNKNOWN" |
| 542 | VGCONF_PLATFORM_SEC_CAPS="UNKNOWN" |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 543 | valt_load_address_pri_norml="0xUNSET" |
| 544 | valt_load_address_pri_inner="0xUNSET" |
| 545 | valt_load_address_sec_norml="0xUNSET" |
| 546 | valt_load_address_sec_inner="0xUNSET" |
njn | 377c43f | 2009-05-19 07:39:22 +0000 | [diff] [blame] | 547 | AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})]) |
sewardj | 3e38ce0 | 2004-11-23 01:17:29 +0000 | [diff] [blame] | 548 | AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.]) |
nethercote | 888ecb7 | 2004-08-23 14:54:40 +0000 | [diff] [blame] | 549 | ;; |
| 550 | esac |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 551 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 552 | #---------------------------------------------------------------------------- |
njn | a454ec0 | 2009-01-19 03:16:59 +0000 | [diff] [blame] | 553 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 554 | # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become |
| 555 | # defined. |
| 556 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86, |
| 557 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 558 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \ |
| 559 | -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 560 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 561 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64, |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 562 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
| 563 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 564 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32, |
| 565 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 566 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ) |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 567 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64, |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 568 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ) |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 569 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM, |
| 570 | test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ) |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 571 | AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X, |
| 572 | test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 573 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 574 | # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these |
| 575 | # become defined. |
| 576 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX, |
| 577 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
| 578 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX) |
| 579 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX, |
| 580 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX) |
| 581 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX, |
| 582 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
| 583 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX) |
| 584 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX, |
| 585 | test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX) |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 586 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX, |
| 587 | test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX) |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 588 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX, |
| 589 | test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \ |
| 590 | -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 591 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 592 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN, |
| 593 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 594 | -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN) |
| 595 | AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN, |
| 596 | test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN) |
| 597 | |
| 598 | |
sewardj | 72a2d80 | 2010-07-29 05:24:20 +0000 | [diff] [blame] | 599 | # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined. |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 600 | # Relies on the assumption that the primary and secondary targets are |
| 601 | # for the same OS, so therefore only necessary to test the primary. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 602 | AM_CONDITIONAL(VGCONF_OS_IS_LINUX, |
| 603 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
| 604 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
| 605 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 606 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \ |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 607 | -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \ |
| 608 | -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 609 | AM_CONDITIONAL(VGCONF_OS_IS_DARWIN, |
| 610 | test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \ |
| 611 | -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 612 | |
| 613 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 614 | # Sometimes, in the Makefile.am files, it's useful to know whether or not |
| 615 | # there is a secondary target. |
njn | ee0c66a | 2009-06-01 23:59:20 +0000 | [diff] [blame] | 616 | AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC, |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 617 | test x$VGCONF_PLATFORM_SEC_CAPS != x) |
tom | fb7bcde | 2005-11-07 15:24:38 +0000 | [diff] [blame] | 618 | |
tom | b637bad | 2005-11-08 12:28:35 +0000 | [diff] [blame] | 619 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 620 | #---------------------------------------------------------------------------- |
| 621 | # Inner Valgrind? |
| 622 | #---------------------------------------------------------------------------- |
| 623 | |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 624 | # Check if this should be built as an inner Valgrind, to be run within |
| 625 | # another Valgrind. Choose the load address accordingly. |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 626 | AC_SUBST(VALT_LOAD_ADDRESS_PRI) |
| 627 | AC_SUBST(VALT_LOAD_ADDRESS_SEC) |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 628 | AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner, |
| 629 | [AC_ARG_ENABLE(inner, |
| 630 | [ --enable-inner enables self-hosting], |
| 631 | [vg_cv_inner=$enableval], |
| 632 | [vg_cv_inner=no])]) |
| 633 | if test "$vg_cv_inner" = yes; then |
| 634 | AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind]) |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 635 | VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner |
| 636 | VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 637 | else |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 638 | VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml |
| 639 | VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml |
njn | d74b0ef | 2009-01-20 06:06:52 +0000 | [diff] [blame] | 640 | fi |
| 641 | |
| 642 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 643 | #---------------------------------------------------------------------------- |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 644 | # Extra fine-tuning of installation directories |
| 645 | #---------------------------------------------------------------------------- |
| 646 | AC_ARG_WITH(tmpdir, |
| 647 | [ --with-tmpdir=PATH Specify path for temporary files], |
| 648 | tmpdir="$withval", |
| 649 | tmpdir="/tmp") |
| 650 | AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory]) |
| 651 | |
sewardj | 0ba37c9 | 2011-07-12 11:46:24 +0000 | [diff] [blame] | 652 | |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 653 | #---------------------------------------------------------------------------- |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 654 | # Libc and suppressions |
| 655 | #---------------------------------------------------------------------------- |
| 656 | # This variable will collect the suppression files to be used. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 657 | AC_SUBST(DEFAULT_SUPP) |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 658 | |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 659 | AC_CHECK_HEADER([features.h]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 660 | |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 661 | if test x$ac_cv_header_features_h = xyes; then |
| 662 | rm -f conftest.$ac_ext |
| 663 | cat <<_ACEOF >conftest.$ac_ext |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 664 | #include <features.h> |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 665 | #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) |
| 666 | glibc version is: __GLIBC__ __GLIBC_MINOR__ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 667 | #endif |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 668 | _ACEOF |
| 669 | GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`" |
| 670 | fi |
bart | b7c3f08 | 2010-05-13 06:32:36 +0000 | [diff] [blame] | 671 | |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 672 | # not really a version check |
| 673 | AC_EGREP_CPP([DARWIN_LIBC], [ |
| 674 | #include <sys/cdefs.h> |
| 675 | #if defined(__DARWIN_VERS_1050) |
| 676 | DARWIN_LIBC |
| 677 | #endif |
| 678 | ], |
| 679 | GLIBC_VERSION="darwin") |
| 680 | |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 681 | # not really a version check |
| 682 | AC_EGREP_CPP([BIONIC_LIBC], [ |
| 683 | #if defined(__ANDROID__) |
| 684 | BIONIC_LIBC |
| 685 | #endif |
| 686 | ], |
| 687 | GLIBC_VERSION="bionic") |
| 688 | |
| 689 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 690 | AC_MSG_CHECKING([the GLIBC_VERSION version]) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 691 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 692 | case "${GLIBC_VERSION}" in |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 693 | 2.2) |
| 694 | AC_MSG_RESULT(2.2 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 695 | 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] | 696 | DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}" |
| 697 | DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 698 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 699 | ;; |
| 700 | |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 701 | 2.3) |
| 702 | AC_MSG_RESULT(2.3 family) |
daywalker | 418c748 | 2002-10-16 13:09:26 +0000 | [diff] [blame] | 703 | 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] | 704 | DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 705 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 706 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 08c7f01 | 2002-10-07 23:56:55 +0000 | [diff] [blame] | 707 | ;; |
| 708 | |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 709 | 2.4) |
| 710 | AC_MSG_RESULT(2.4 family) |
| 711 | 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] | 712 | DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 713 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 714 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
njn | 781dba5 | 2005-06-30 04:06:38 +0000 | [diff] [blame] | 715 | ;; |
| 716 | |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 717 | 2.5) |
| 718 | AC_MSG_RESULT(2.5 family) |
| 719 | 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] | 720 | DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 721 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 722 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 723 | ;; |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 724 | 2.6) |
| 725 | AC_MSG_RESULT(2.6 family) |
| 726 | 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] | 727 | DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 728 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 729 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 730 | ;; |
| 731 | 2.7) |
| 732 | AC_MSG_RESULT(2.7 family) |
| 733 | 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] | 734 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
sewardj | 68c80c1 | 2007-11-18 14:40:02 +0000 | [diff] [blame] | 735 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
tom | 0a0fcee | 2008-01-05 00:12:45 +0000 | [diff] [blame] | 736 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
dirk | c8bd0c5 | 2007-05-23 17:39:08 +0000 | [diff] [blame] | 737 | ;; |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 738 | 2.8) |
| 739 | AC_MSG_RESULT(2.8 family) |
dirk | eb939fc | 2008-04-27 20:38:47 +0000 | [diff] [blame] | 740 | 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] | 741 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 742 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 743 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 744 | ;; |
dirk | d2e31eb | 2008-11-19 23:58:36 +0000 | [diff] [blame] | 745 | 2.9) |
| 746 | AC_MSG_RESULT(2.9 family) |
| 747 | AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x]) |
| 748 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 749 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 750 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 751 | ;; |
sewardj | 5d425e8 | 2009-02-01 19:01:11 +0000 | [diff] [blame] | 752 | 2.10) |
| 753 | AC_MSG_RESULT(2.10 family) |
| 754 | AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x]) |
| 755 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 756 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 757 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 758 | ;; |
bart | 0fac7ff | 2009-11-15 19:11:19 +0000 | [diff] [blame] | 759 | 2.11) |
| 760 | AC_MSG_RESULT(2.11 family) |
| 761 | AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x]) |
| 762 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 763 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 764 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
bart | b7c3f08 | 2010-05-13 06:32:36 +0000 | [diff] [blame] | 765 | ;; |
| 766 | 2.12) |
| 767 | AC_MSG_RESULT(2.12 family) |
| 768 | AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x]) |
| 769 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 770 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 771 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
bart | 0fac7ff | 2009-11-15 19:11:19 +0000 | [diff] [blame] | 772 | ;; |
tom | ebd619b | 2011-02-10 09:09:09 +0000 | [diff] [blame] | 773 | 2.13) |
| 774 | AC_MSG_RESULT(2.13 family) |
| 775 | AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x]) |
| 776 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 777 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 778 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 779 | ;; |
tom | cc07741 | 2011-06-07 21:52:26 +0000 | [diff] [blame] | 780 | 2.14) |
| 781 | AC_MSG_RESULT(2.14 family) |
| 782 | AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x]) |
| 783 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 784 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 785 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 786 | ;; |
dirk | e75fdeb | 2011-12-29 08:24:55 +0000 | [diff] [blame] | 787 | 2.15) |
| 788 | AC_MSG_RESULT(2.15 family) |
| 789 | AC_DEFINE([GLIBC_2_15], 1, [Define to 1 if you're using glibc 2.15.x]) |
| 790 | DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" |
| 791 | DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}" |
| 792 | DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" |
| 793 | ;; |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 794 | darwin) |
| 795 | AC_MSG_RESULT(Darwin) |
| 796 | AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin]) |
| 797 | # DEFAULT_SUPP set by kernel version check above. |
| 798 | ;; |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 799 | bionic) |
| 800 | AC_MSG_RESULT(Bionic) |
| 801 | AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic]) |
| 802 | DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}" |
| 803 | ;; |
dirk | aece45c | 2006-10-12 08:17:49 +0000 | [diff] [blame] | 804 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 805 | *) |
bart | 12e9112 | 2010-05-15 08:37:24 +0000 | [diff] [blame] | 806 | AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}]) |
dirk | e75fdeb | 2011-12-29 08:24:55 +0000 | [diff] [blame] | 807 | AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.15]) |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 808 | AC_MSG_ERROR([or Darwin libc]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 809 | ;; |
| 810 | esac |
| 811 | |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 812 | AC_SUBST(GLIBC_VERSION) |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 813 | |
sewardj | 414f358 | 2008-07-18 20:46:00 +0000 | [diff] [blame] | 814 | |
| 815 | # Add default suppressions for the X client libraries. Make no |
| 816 | # attempt to detect whether such libraries are installed on the |
| 817 | # build machine (or even if any X facilities are present); just |
| 818 | # add the suppressions antidisirregardless. |
| 819 | DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}" |
| 820 | DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}" |
gobry | e721a52 | 2002-03-22 13:38:30 +0000 | [diff] [blame] | 821 | |
sewardj | d2f95a0 | 2011-05-11 16:04:28 +0000 | [diff] [blame] | 822 | # Add glibc and X11 suppressions for exp-sgcheck |
| 823 | DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}" |
sewardj | 5744c02 | 2008-10-19 18:58:13 +0000 | [diff] [blame] | 824 | |
sewardj | 2e10a68 | 2003-04-07 19:36:41 +0000 | [diff] [blame] | 825 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 826 | #---------------------------------------------------------------------------- |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 827 | # Platform variants? |
| 828 | #---------------------------------------------------------------------------- |
| 829 | |
| 830 | # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough. |
| 831 | # But there are times where we need a bit more control. The motivating |
| 832 | # and currently only case is Android: this is almost identical to arm-linux, |
| 833 | # but not quite. So this introduces the concept of platform variant tags, |
| 834 | # which get passed in the compile as -DVGPV_<arch>_<os>_<variant> along |
| 835 | # with the main -DVGP_<arch>_<os> definition. |
| 836 | # |
| 837 | # In almost all cases, the <variant> bit is "vanilla". But for Android |
| 838 | # it is "android" instead. |
| 839 | # |
| 840 | # Consequently (eg), plain arm-linux would build with |
| 841 | # |
| 842 | # -DVGP_arm_linux -DVGPV_arm_linux_vanilla |
| 843 | # |
| 844 | # whilst an Android build would have |
| 845 | # |
| 846 | # -DVGP_arm_linux -DVGPV_arm_linux_android |
| 847 | # |
| 848 | # The setup of the platform variant is pushed relatively far down this |
| 849 | # file in order that we can inspect any of the variables set above. |
| 850 | |
| 851 | # In the normal case .. |
| 852 | VGCONF_PLATVARIANT="vanilla" |
| 853 | |
| 854 | # Android on ARM ? |
| 855 | if test "$VGCONF_ARCH_PRI-$VGCONF_OS" = "arm-linux" \ |
| 856 | -a "$GLIBC_VERSION" = "bionic"; |
| 857 | then |
| 858 | VGCONF_PLATVARIANT="android" |
| 859 | fi |
| 860 | |
| 861 | AC_SUBST(VGCONF_PLATVARIANT) |
| 862 | |
| 863 | |
| 864 | # FIXME: do we also want to define automake variables |
| 865 | # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently) |
| 866 | # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE, |
| 867 | # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough |
| 868 | # do that. Problem is that we can't do and-ing in Makefile.am's, but |
| 869 | # that's what we'd need to do to use this, since what we'd want to write |
| 870 | # is something like |
| 871 | # |
| 872 | # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID |
| 873 | # |
sewardj | 0ba37c9 | 2011-07-12 11:46:24 +0000 | [diff] [blame] | 874 | # Hmm. Can't think of a nice clean solution to this. |
| 875 | |
| 876 | AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA, |
| 877 | test x$VGCONF_PLATVARIANT = xvanilla) |
| 878 | AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID, |
| 879 | test x$VGCONF_PLATVARIANT = xandroid) |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 880 | |
| 881 | |
| 882 | #---------------------------------------------------------------------------- |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 883 | # Checking for various library functions and other definitions |
| 884 | #---------------------------------------------------------------------------- |
| 885 | |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 886 | # Check for CLOCK_MONOTONIC |
| 887 | |
| 888 | AC_MSG_CHECKING([for CLOCK_MONOTONIC]) |
| 889 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 890 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 891 | #include <time.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 892 | ]], [[ |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 893 | struct timespec t; |
| 894 | clock_gettime(CLOCK_MONOTONIC, &t); |
| 895 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 896 | ]])], [ |
bart | 59e2f18 | 2008-04-28 16:22:53 +0000 | [diff] [blame] | 897 | AC_MSG_RESULT([yes]) |
| 898 | AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1, |
| 899 | [Define to 1 if you have the `CLOCK_MONOTONIC' constant.]) |
| 900 | ], [ |
| 901 | AC_MSG_RESULT([no]) |
| 902 | ]) |
| 903 | |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 904 | |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 905 | # Check for PTHREAD_RWLOCK_T |
| 906 | |
| 907 | AC_MSG_CHECKING([for pthread_rwlock_t]) |
| 908 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 909 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 910 | #define _GNU_SOURCE |
| 911 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 912 | ]], [[ |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 913 | pthread_rwlock_t rwl; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 914 | ]])], [ |
sewardj | 0c09bf0 | 2011-07-11 22:11:58 +0000 | [diff] [blame] | 915 | AC_MSG_RESULT([yes]) |
| 916 | AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1, |
| 917 | [Define to 1 if you have the `pthread_rwlock_t' type.]) |
| 918 | ], [ |
| 919 | AC_MSG_RESULT([no]) |
| 920 | ]) |
| 921 | |
| 922 | |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 923 | # Check for PTHREAD_MUTEX_ADAPTIVE_NP |
| 924 | |
| 925 | AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP]) |
| 926 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 927 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 928 | #define _GNU_SOURCE |
| 929 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 930 | ]], [[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 931 | return (PTHREAD_MUTEX_ADAPTIVE_NP); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 932 | ]])], [ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 933 | AC_MSG_RESULT([yes]) |
| 934 | AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1, |
| 935 | [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.]) |
| 936 | ], [ |
| 937 | AC_MSG_RESULT([no]) |
| 938 | ]) |
| 939 | |
| 940 | |
| 941 | # Check for PTHREAD_MUTEX_ERRORCHECK_NP |
| 942 | |
| 943 | AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP]) |
| 944 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 945 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 946 | #define _GNU_SOURCE |
| 947 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 948 | ]], [[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 949 | return (PTHREAD_MUTEX_ERRORCHECK_NP); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 950 | ]])], [ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 951 | AC_MSG_RESULT([yes]) |
| 952 | AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1, |
| 953 | [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.]) |
| 954 | ], [ |
| 955 | AC_MSG_RESULT([no]) |
| 956 | ]) |
| 957 | |
| 958 | |
| 959 | # Check for PTHREAD_MUTEX_RECURSIVE_NP |
| 960 | |
| 961 | AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP]) |
| 962 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 963 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 964 | #define _GNU_SOURCE |
| 965 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 966 | ]], [[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 967 | return (PTHREAD_MUTEX_RECURSIVE_NP); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 968 | ]])], [ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 969 | AC_MSG_RESULT([yes]) |
| 970 | AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, |
| 971 | [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.]) |
| 972 | ], [ |
| 973 | AC_MSG_RESULT([no]) |
| 974 | ]) |
| 975 | |
| 976 | |
| 977 | # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP |
| 978 | |
| 979 | AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP]) |
| 980 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 981 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 982 | #define _GNU_SOURCE |
| 983 | #include <pthread.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 984 | ]], [[ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 985 | pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; |
| 986 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 987 | ]])], [ |
bart | fea0692 | 2008-05-03 09:12:15 +0000 | [diff] [blame] | 988 | AC_MSG_RESULT([yes]) |
| 989 | AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1, |
| 990 | [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.]) |
| 991 | ], [ |
| 992 | AC_MSG_RESULT([no]) |
| 993 | ]) |
| 994 | |
| 995 | |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 996 | # Check whether pthread_mutex_t has a member called __m_kind. |
| 997 | |
bart | b11355c | 2010-04-29 16:37:26 +0000 | [diff] [blame] | 998 | AC_CHECK_MEMBER([pthread_mutex_t.__m_kind], |
| 999 | [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], |
| 1000 | 1, |
| 1001 | [Define to 1 if pthread_mutex_t has a member called __m_kind.]) |
| 1002 | ], |
| 1003 | [], |
| 1004 | [#include <pthread.h>]) |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 1005 | |
| 1006 | |
| 1007 | # Check whether pthread_mutex_t has a member called __data.__kind. |
| 1008 | |
bart | b11355c | 2010-04-29 16:37:26 +0000 | [diff] [blame] | 1009 | AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind], |
| 1010 | [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], |
| 1011 | 1, |
| 1012 | [Define to 1 if pthread_mutex_t has a member __data.__kind.]) |
| 1013 | ], |
| 1014 | [], |
| 1015 | [#include <pthread.h>]) |
bart | 5e389f1 | 2008-04-05 12:53:15 +0000 | [diff] [blame] | 1016 | |
| 1017 | |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1018 | # does this compiler support -maltivec and does it have the include file |
| 1019 | # <altivec.h> ? |
| 1020 | |
| 1021 | AC_MSG_CHECKING([for Altivec]) |
| 1022 | |
| 1023 | safe_CFLAGS=$CFLAGS |
| 1024 | CFLAGS="-maltivec" |
| 1025 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1026 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1027 | #include <altivec.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1028 | ]], [[ |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1029 | vector unsigned int v; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1030 | ]])], [ |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1031 | ac_have_altivec=yes |
| 1032 | AC_MSG_RESULT([yes]) |
sewardj | f9fe602 | 2010-09-03 14:36:50 +0000 | [diff] [blame] | 1033 | AC_DEFINE([HAS_ALTIVEC], 1, |
sewardj | 6467a15 | 2010-09-03 14:02:22 +0000 | [diff] [blame] | 1034 | [Define to 1 if gcc/as can do Altivec.]) |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1035 | ], [ |
| 1036 | ac_have_altivec=no |
| 1037 | AC_MSG_RESULT([no]) |
| 1038 | ]) |
| 1039 | CFLAGS=$safe_CFLAGS |
| 1040 | |
sewardj | 0e342a0 | 2010-09-03 23:49:33 +0000 | [diff] [blame] | 1041 | AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes]) |
bart | 62c370e | 2008-05-12 18:50:51 +0000 | [diff] [blame] | 1042 | |
| 1043 | |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1044 | # Check that both: the compiler supports -mvsx and that the assembler |
| 1045 | # understands VSX instructions. If either of those doesn't work, |
| 1046 | # conclude that we can't do VSX. NOTE: basically this is a kludge |
| 1047 | # in that it conflates two things that should be separate -- whether |
| 1048 | # the compiler understands the flag vs whether the assembler |
| 1049 | # understands the opcodes. This really ought to be cleaned up |
| 1050 | # and done properly, like it is for x86/x86_64. |
| 1051 | |
| 1052 | AC_MSG_CHECKING([for VSX]) |
| 1053 | |
| 1054 | safe_CFLAGS=$CFLAGS |
| 1055 | CFLAGS="-mvsx" |
| 1056 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1057 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1058 | #include <altivec.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1059 | ]], [[ |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1060 | vector unsigned int v; |
sewardj | 9b80ebb | 2011-04-15 21:16:00 +0000 | [diff] [blame] | 1061 | __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc"); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1062 | ]])], [ |
sewardj | f34eb49 | 2011-04-15 11:57:05 +0000 | [diff] [blame] | 1063 | ac_have_vsx=yes |
| 1064 | AC_MSG_RESULT([yes]) |
| 1065 | ], [ |
| 1066 | ac_have_vsx=no |
| 1067 | AC_MSG_RESULT([no]) |
| 1068 | ]) |
| 1069 | CFLAGS=$safe_CFLAGS |
| 1070 | |
| 1071 | AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes) |
| 1072 | |
| 1073 | |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1074 | # Check for pthread_create@GLIBC2.0 |
| 1075 | AC_MSG_CHECKING([for pthread_create@GLIBC2.0()]) |
| 1076 | |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1077 | safe_CFLAGS=$CFLAGS |
| 1078 | CFLAGS="-lpthread" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1079 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1080 | extern int pthread_create_glibc_2_0(void*, const void*, |
| 1081 | void *(*)(void*), void*); |
| 1082 | __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0"); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1083 | ]], [[ |
bart | 276ed3a | 2009-05-10 15:41:45 +0000 | [diff] [blame] | 1084 | #ifdef __powerpc__ |
| 1085 | /* |
| 1086 | * Apparently on PowerPC linking this program succeeds and generates an |
| 1087 | * executable with the undefined symbol pthread_create@GLIBC_2.0. |
| 1088 | */ |
| 1089 | #error This test does not work properly on PowerPC. |
| 1090 | #else |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1091 | pthread_create_glibc_2_0(0, 0, 0, 0); |
bart | 276ed3a | 2009-05-10 15:41:45 +0000 | [diff] [blame] | 1092 | #endif |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1093 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1094 | ]])], [ |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1095 | ac_have_pthread_create_glibc_2_0=yes |
| 1096 | AC_MSG_RESULT([yes]) |
| 1097 | AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1, |
| 1098 | [Define to 1 if you have the `pthread_create@glibc2.0' function.]) |
| 1099 | ], [ |
| 1100 | ac_have_pthread_create_glibc_2_0=no |
| 1101 | AC_MSG_RESULT([no]) |
| 1102 | ]) |
bart | 16e1c5a | 2009-04-26 07:38:53 +0000 | [diff] [blame] | 1103 | CFLAGS=$safe_CFLAGS |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1104 | |
| 1105 | AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0, |
bart | 24f5390 | 2009-04-26 11:29:02 +0000 | [diff] [blame] | 1106 | test x$ac_have_pthread_create_glibc_2_0 = xyes) |
bart | 36dd85a | 2009-04-26 07:11:48 +0000 | [diff] [blame] | 1107 | |
| 1108 | |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1109 | # Check for eventfd_t, eventfd() and eventfd_read() |
| 1110 | AC_MSG_CHECKING([for eventfd()]) |
| 1111 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1112 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1113 | #include <sys/eventfd.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1114 | ]], [[ |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1115 | eventfd_t ev; |
| 1116 | int fd; |
| 1117 | |
| 1118 | fd = eventfd(5, 0); |
| 1119 | eventfd_read(fd, &ev); |
| 1120 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1121 | ]])], [ |
bart | a50aa8a | 2008-04-27 06:06:57 +0000 | [diff] [blame] | 1122 | AC_MSG_RESULT([yes]) |
| 1123 | AC_DEFINE([HAVE_EVENTFD], 1, |
| 1124 | [Define to 1 if you have the `eventfd' function.]) |
| 1125 | AC_DEFINE([HAVE_EVENTFD_READ], 1, |
| 1126 | [Define to 1 if you have the `eventfd_read' function.]) |
| 1127 | ], [ |
| 1128 | AC_MSG_RESULT([no]) |
| 1129 | ]) |
| 1130 | |
| 1131 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1132 | #---------------------------------------------------------------------------- |
| 1133 | # Checking for supported compiler flags. |
| 1134 | #---------------------------------------------------------------------------- |
| 1135 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1136 | # does this compiler support -m32 ? |
| 1137 | AC_MSG_CHECKING([if gcc accepts -m32]) |
| 1138 | |
| 1139 | safe_CFLAGS=$CFLAGS |
| 1140 | CFLAGS="-m32" |
| 1141 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1142 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1143 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1144 | ]])], [ |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1145 | FLAG_M32="-m32" |
| 1146 | AC_MSG_RESULT([yes]) |
| 1147 | ], [ |
| 1148 | FLAG_M32="" |
| 1149 | AC_MSG_RESULT([no]) |
| 1150 | ]) |
| 1151 | CFLAGS=$safe_CFLAGS |
| 1152 | |
| 1153 | AC_SUBST(FLAG_M32) |
| 1154 | |
| 1155 | |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1156 | # does this compiler support -m64 ? |
| 1157 | AC_MSG_CHECKING([if gcc accepts -m64]) |
| 1158 | |
| 1159 | safe_CFLAGS=$CFLAGS |
| 1160 | CFLAGS="-m64" |
| 1161 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1162 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1163 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1164 | ]])], [ |
sewardj | 0126214 | 2006-01-04 01:20:28 +0000 | [diff] [blame] | 1165 | FLAG_M64="-m64" |
| 1166 | AC_MSG_RESULT([yes]) |
| 1167 | ], [ |
| 1168 | FLAG_M64="" |
| 1169 | AC_MSG_RESULT([no]) |
| 1170 | ]) |
| 1171 | CFLAGS=$safe_CFLAGS |
| 1172 | |
| 1173 | AC_SUBST(FLAG_M64) |
| 1174 | |
| 1175 | |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1176 | # does this compiler support -mmmx ? |
| 1177 | AC_MSG_CHECKING([if gcc accepts -mmmx]) |
| 1178 | |
| 1179 | safe_CFLAGS=$CFLAGS |
| 1180 | CFLAGS="-mmmx" |
| 1181 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1182 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1183 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1184 | ]])], [ |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1185 | FLAG_MMMX="-mmmx" |
| 1186 | AC_MSG_RESULT([yes]) |
| 1187 | ], [ |
| 1188 | FLAG_MMMX="" |
| 1189 | AC_MSG_RESULT([no]) |
| 1190 | ]) |
| 1191 | CFLAGS=$safe_CFLAGS |
| 1192 | |
| 1193 | AC_SUBST(FLAG_MMMX) |
| 1194 | |
| 1195 | |
| 1196 | # does this compiler support -msse ? |
| 1197 | AC_MSG_CHECKING([if gcc accepts -msse]) |
| 1198 | |
| 1199 | safe_CFLAGS=$CFLAGS |
| 1200 | CFLAGS="-msse" |
| 1201 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1202 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1203 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1204 | ]])], [ |
sewardj | 67f1fcc | 2005-07-03 10:41:02 +0000 | [diff] [blame] | 1205 | FLAG_MSSE="-msse" |
| 1206 | AC_MSG_RESULT([yes]) |
| 1207 | ], [ |
| 1208 | FLAG_MSSE="" |
| 1209 | AC_MSG_RESULT([no]) |
| 1210 | ]) |
| 1211 | CFLAGS=$safe_CFLAGS |
| 1212 | |
| 1213 | AC_SUBST(FLAG_MSSE) |
| 1214 | |
| 1215 | |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1216 | # does this compiler support -mpreferred-stack-boundary=2 ? |
| 1217 | AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary]) |
| 1218 | |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1219 | safe_CFLAGS=$CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1220 | CFLAGS="-mpreferred-stack-boundary=2" |
| 1221 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1222 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1223 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1224 | ]])], [ |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1225 | PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2" |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1226 | AC_MSG_RESULT([yes]) |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1227 | ], [ |
| 1228 | PREFERRED_STACK_BOUNDARY="" |
| 1229 | AC_MSG_RESULT([no]) |
| 1230 | ]) |
daywalker | 3664f56 | 2003-10-17 13:43:46 +0000 | [diff] [blame] | 1231 | CFLAGS=$safe_CFLAGS |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1232 | |
| 1233 | AC_SUBST(PREFERRED_STACK_BOUNDARY) |
| 1234 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1235 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1236 | # does this compiler support -Wno-pointer-sign ? |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1237 | AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign]) |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1238 | |
| 1239 | safe_CFLAGS=$CFLAGS |
| 1240 | CFLAGS="-Wno-pointer-sign" |
| 1241 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1242 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1243 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1244 | ]])], [ |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1245 | no_pointer_sign=yes |
| 1246 | AC_MSG_RESULT([yes]) |
| 1247 | ], [ |
| 1248 | no_pointer_sign=no |
| 1249 | AC_MSG_RESULT([no]) |
| 1250 | ]) |
| 1251 | CFLAGS=$safe_CFLAGS |
| 1252 | |
| 1253 | if test x$no_pointer_sign = xyes; then |
| 1254 | CFLAGS="$CFLAGS -Wno-pointer-sign" |
| 1255 | fi |
| 1256 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1257 | |
bart | e026bd2 | 2009-07-04 12:17:07 +0000 | [diff] [blame] | 1258 | # does this compiler support -Wno-empty-body ? |
| 1259 | |
| 1260 | AC_MSG_CHECKING([if gcc accepts -Wno-empty-body]) |
| 1261 | |
| 1262 | safe_CFLAGS=$CFLAGS |
| 1263 | CFLAGS="-Wno-empty-body" |
| 1264 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1265 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | e026bd2 | 2009-07-04 12:17:07 +0000 | [diff] [blame] | 1266 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1267 | ]])], [ |
bart | e026bd2 | 2009-07-04 12:17:07 +0000 | [diff] [blame] | 1268 | AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body]) |
| 1269 | AC_MSG_RESULT([yes]) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1270 | ], [ |
bart | e026bd2 | 2009-07-04 12:17:07 +0000 | [diff] [blame] | 1271 | AC_SUBST([FLAG_W_NO_EMPTY_BODY], []) |
| 1272 | AC_MSG_RESULT([no]) |
| 1273 | ]) |
| 1274 | CFLAGS=$safe_CFLAGS |
| 1275 | |
| 1276 | |
bart | 9d865fa | 2008-06-23 12:11:49 +0000 | [diff] [blame] | 1277 | # does this compiler support -Wno-format-zero-length ? |
| 1278 | |
| 1279 | AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length]) |
| 1280 | |
| 1281 | safe_CFLAGS=$CFLAGS |
| 1282 | CFLAGS="-Wno-format-zero-length" |
| 1283 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1284 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 9d865fa | 2008-06-23 12:11:49 +0000 | [diff] [blame] | 1285 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1286 | ]])], [ |
bart | 9d865fa | 2008-06-23 12:11:49 +0000 | [diff] [blame] | 1287 | AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length]) |
| 1288 | AC_MSG_RESULT([yes]) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1289 | ], [ |
bart | 9d865fa | 2008-06-23 12:11:49 +0000 | [diff] [blame] | 1290 | AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], []) |
| 1291 | AC_MSG_RESULT([no]) |
| 1292 | ]) |
| 1293 | CFLAGS=$safe_CFLAGS |
| 1294 | |
| 1295 | |
bart | 8e21631 | 2011-05-15 17:05:36 +0000 | [diff] [blame] | 1296 | # does this compiler support -Wno-nonnull ? |
| 1297 | |
| 1298 | AC_MSG_CHECKING([if gcc accepts -Wno-nonnull]) |
| 1299 | |
| 1300 | safe_CFLAGS=$CFLAGS |
| 1301 | CFLAGS="-Wno-nonnull" |
| 1302 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1303 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 8e21631 | 2011-05-15 17:05:36 +0000 | [diff] [blame] | 1304 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1305 | ]])], [ |
bart | 8e21631 | 2011-05-15 17:05:36 +0000 | [diff] [blame] | 1306 | AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull]) |
| 1307 | AC_MSG_RESULT([yes]) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1308 | ], [ |
bart | 8e21631 | 2011-05-15 17:05:36 +0000 | [diff] [blame] | 1309 | AC_SUBST([FLAG_W_NO_NONNULL], []) |
| 1310 | AC_MSG_RESULT([no]) |
| 1311 | ]) |
| 1312 | CFLAGS=$safe_CFLAGS |
| 1313 | |
| 1314 | |
| 1315 | # does this compiler support -Wno-overflow ? |
| 1316 | |
| 1317 | AC_MSG_CHECKING([if gcc accepts -Wno-overflow]) |
| 1318 | |
| 1319 | safe_CFLAGS=$CFLAGS |
| 1320 | CFLAGS="-Wno-overflow" |
| 1321 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1322 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 8e21631 | 2011-05-15 17:05:36 +0000 | [diff] [blame] | 1323 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1324 | ]])], [ |
bart | 8e21631 | 2011-05-15 17:05:36 +0000 | [diff] [blame] | 1325 | AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow]) |
| 1326 | AC_MSG_RESULT([yes]) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1327 | ], [ |
bart | 8e21631 | 2011-05-15 17:05:36 +0000 | [diff] [blame] | 1328 | AC_SUBST([FLAG_W_NO_OVERFLOW], []) |
| 1329 | AC_MSG_RESULT([no]) |
| 1330 | ]) |
| 1331 | CFLAGS=$safe_CFLAGS |
| 1332 | |
| 1333 | |
bart | bf9b85c | 2009-08-12 12:55:56 +0000 | [diff] [blame] | 1334 | # does this compiler support -Wno-uninitialized ? |
| 1335 | |
| 1336 | AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized]) |
| 1337 | |
| 1338 | safe_CFLAGS=$CFLAGS |
| 1339 | CFLAGS="-Wno-uninitialized" |
| 1340 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1341 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | bf9b85c | 2009-08-12 12:55:56 +0000 | [diff] [blame] | 1342 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1343 | ]])], [ |
bart | bf9b85c | 2009-08-12 12:55:56 +0000 | [diff] [blame] | 1344 | AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized]) |
| 1345 | AC_MSG_RESULT([yes]) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1346 | ], [ |
bart | bf9b85c | 2009-08-12 12:55:56 +0000 | [diff] [blame] | 1347 | AC_SUBST([FLAG_W_NO_UNINITIALIZED], []) |
| 1348 | AC_MSG_RESULT([no]) |
| 1349 | ]) |
| 1350 | CFLAGS=$safe_CFLAGS |
| 1351 | |
| 1352 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1353 | # does this compiler support -Wextra or the older -W ? |
| 1354 | |
| 1355 | AC_MSG_CHECKING([if gcc accepts -Wextra or -W]) |
| 1356 | |
| 1357 | safe_CFLAGS=$CFLAGS |
| 1358 | CFLAGS="-Wextra" |
| 1359 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1360 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1361 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1362 | ]])], [ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1363 | AC_SUBST([FLAG_W_EXTRA], [-Wextra]) |
| 1364 | AC_MSG_RESULT([-Wextra]) |
| 1365 | ], [ |
| 1366 | CFLAGS="-W" |
sewardj | 9bdf2a6 | 2011-10-27 06:22:23 +0000 | [diff] [blame] | 1367 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1368 | return 0; |
sewardj | 9bdf2a6 | 2011-10-27 06:22:23 +0000 | [diff] [blame] | 1369 | ]])], [ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1370 | AC_SUBST([FLAG_W_EXTRA], [-W]) |
| 1371 | AC_MSG_RESULT([-W]) |
| 1372 | ], [ |
| 1373 | AC_SUBST([FLAG_W_EXTRA], []) |
| 1374 | AC_MSG_RESULT([not supported]) |
| 1375 | ]) |
| 1376 | ]) |
| 1377 | CFLAGS=$safe_CFLAGS |
| 1378 | |
| 1379 | |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1380 | # does this compiler support -fno-stack-protector ? |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1381 | AC_MSG_CHECKING([if gcc accepts -fno-stack-protector]) |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1382 | |
| 1383 | safe_CFLAGS=$CFLAGS |
| 1384 | CFLAGS="-fno-stack-protector" |
| 1385 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1386 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
njn | 9890ee1 | 2009-01-21 22:25:50 +0000 | [diff] [blame] | 1387 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1388 | ]])], [ |
sewardj | a72c26d | 2007-05-01 13:44:08 +0000 | [diff] [blame] | 1389 | no_stack_protector=yes |
| 1390 | FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector" |
| 1391 | AC_MSG_RESULT([yes]) |
| 1392 | ], [ |
| 1393 | no_stack_protector=no |
| 1394 | FLAG_FNO_STACK_PROTECTOR="" |
| 1395 | AC_MSG_RESULT([no]) |
| 1396 | ]) |
| 1397 | CFLAGS=$safe_CFLAGS |
| 1398 | |
| 1399 | AC_SUBST(FLAG_FNO_STACK_PROTECTOR) |
| 1400 | |
| 1401 | if test x$no_stack_protector = xyes; then |
| 1402 | CFLAGS="$CFLAGS -fno-stack-protector" |
| 1403 | fi |
| 1404 | |
| 1405 | |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1406 | # does this compiler support --param inline-unit-growth=... ? |
| 1407 | |
| 1408 | AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth]) |
| 1409 | |
| 1410 | safe_CFLAGS=$CFLAGS |
| 1411 | CFLAGS="--param inline-unit-growth=900" |
| 1412 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1413 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1414 | return 0; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1415 | ]])], [ |
bart | 56730cd | 2008-05-11 06:41:46 +0000 | [diff] [blame] | 1416 | AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], |
| 1417 | ["--param inline-unit-growth=900"]) |
| 1418 | AC_MSG_RESULT([yes]) |
| 1419 | ], [ |
| 1420 | AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""]) |
| 1421 | AC_MSG_RESULT([no]) |
| 1422 | ]) |
| 1423 | CFLAGS=$safe_CFLAGS |
| 1424 | |
| 1425 | |
sewardj | d364580 | 2010-06-13 22:13:58 +0000 | [diff] [blame] | 1426 | # does the linker support -Wl,--build-id=none ? Note, it's |
| 1427 | # important that we test indirectly via whichever C compiler |
| 1428 | # is selected, rather than testing /usr/bin/ld or whatever |
| 1429 | # directly. |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1430 | |
sewardj | d364580 | 2010-06-13 22:13:58 +0000 | [diff] [blame] | 1431 | AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none]) |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1432 | |
| 1433 | safe_CFLAGS=$CFLAGS |
| 1434 | CFLAGS="-Wl,--build-id=none" |
| 1435 | |
bart | 8508c75 | 2010-06-10 06:26:21 +0000 | [diff] [blame] | 1436 | AC_LINK_IFELSE( |
| 1437 | [AC_LANG_PROGRAM([ ], [return 0;])], |
bart | 699fbac | 2010-06-08 18:23:59 +0000 | [diff] [blame] | 1438 | [ |
| 1439 | AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"]) |
| 1440 | AC_MSG_RESULT([yes]) |
| 1441 | ], [ |
| 1442 | AC_SUBST([FLAG_NO_BUILD_ID], [""]) |
| 1443 | AC_MSG_RESULT([no]) |
| 1444 | ]) |
| 1445 | CFLAGS=$safe_CFLAGS |
| 1446 | |
| 1447 | |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 1448 | # does the ppc assembler support "mtocrf" et al? |
| 1449 | AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf]) |
| 1450 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1451 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | dd4cbe1 | 2006-03-12 17:27:44 +0000 | [diff] [blame] | 1452 | __asm__ __volatile__("mtocrf 4,0"); |
| 1453 | __asm__ __volatile__("mfocrf 0,4"); |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1454 | ]])], [ |
sewardj | 00f1e62 | 2006-03-12 16:47:10 +0000 | [diff] [blame] | 1455 | ac_have_as_ppc_mftocrf=yes |
| 1456 | AC_MSG_RESULT([yes]) |
| 1457 | ], [ |
| 1458 | ac_have_as_ppc_mftocrf=no |
| 1459 | AC_MSG_RESULT([no]) |
| 1460 | ]) |
| 1461 | if test x$ac_have_as_ppc_mftocrf = xyes ; then |
| 1462 | AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.]) |
| 1463 | fi |
| 1464 | |
| 1465 | |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 1466 | CFLAGS=$safe_CFLAGS |
| 1467 | |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1468 | # does the x86/amd64 assembler understand SSE3 instructions? |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 1469 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1470 | # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1471 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3]) |
| 1472 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1473 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1474 | do { long long int x; |
| 1475 | __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); } |
| 1476 | while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1477 | ]])], [ |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1478 | ac_have_as_sse3=yes |
| 1479 | AC_MSG_RESULT([yes]) |
| 1480 | ], [ |
| 1481 | ac_have_as_sse3=no |
| 1482 | AC_MSG_RESULT([no]) |
| 1483 | ]) |
sewardj | fa18a26 | 2007-03-22 12:13:13 +0000 | [diff] [blame] | 1484 | |
| 1485 | AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes) |
sewardj | f0aabf8 | 2007-03-22 00:24:21 +0000 | [diff] [blame] | 1486 | |
| 1487 | |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 1488 | # Ditto for SSSE3 instructions (note extra S) |
| 1489 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1490 | # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's |
| 1491 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3]) |
| 1492 | |
florian | c443b96 | 2011-10-28 21:37:19 +0000 | [diff] [blame] | 1493 | save_CFLAGS="$CFLAGS" |
| 1494 | CFLAGS="$CFLAGS -msse" |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1495 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 1496 | do { long long int x; |
| 1497 | __asm__ __volatile__( |
| 1498 | "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); } |
| 1499 | while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1500 | ]])], [ |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 1501 | ac_have_as_ssse3=yes |
| 1502 | AC_MSG_RESULT([yes]) |
| 1503 | ], [ |
| 1504 | ac_have_as_ssse3=no |
| 1505 | AC_MSG_RESULT([no]) |
| 1506 | ]) |
florian | c443b96 | 2011-10-28 21:37:19 +0000 | [diff] [blame] | 1507 | CFLAGS="$save_CFLAGS" |
sewardj | 6d6da5b | 2008-02-09 12:07:40 +0000 | [diff] [blame] | 1508 | |
| 1509 | AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes) |
| 1510 | |
| 1511 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1512 | # does the x86/amd64 assembler understand the PCLMULQDQ instruction? |
| 1513 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1514 | # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's |
sewardj | e3ae8a3 | 2010-09-28 19:59:47 +0000 | [diff] [blame] | 1515 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq']) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1516 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | e3ae8a3 | 2010-09-28 19:59:47 +0000 | [diff] [blame] | 1517 | do { |
| 1518 | __asm__ __volatile__( |
| 1519 | "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); } |
| 1520 | while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1521 | ]])], [ |
sewardj | e3ae8a3 | 2010-09-28 19:59:47 +0000 | [diff] [blame] | 1522 | ac_have_as_pclmulqdq=yes |
| 1523 | AC_MSG_RESULT([yes]) |
| 1524 | ], [ |
| 1525 | ac_have_as_pclmulqdq=no |
| 1526 | AC_MSG_RESULT([no]) |
| 1527 | ]) |
| 1528 | |
| 1529 | AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes) |
| 1530 | |
| 1531 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1532 | # does the x86/amd64 assembler understand the LZCNT instruction? |
| 1533 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1534 | # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's |
bart | 55e438b | 2010-09-14 10:53:57 +0000 | [diff] [blame] | 1535 | AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt']) |
| 1536 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1537 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
bart | 55e438b | 2010-09-14 10:53:57 +0000 | [diff] [blame] | 1538 | do { |
| 1539 | __asm__ __volatile__("lzcnt %rax,%rax"); |
| 1540 | } while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1541 | ]])], [ |
bart | 55e438b | 2010-09-14 10:53:57 +0000 | [diff] [blame] | 1542 | ac_have_as_lzcnt=yes |
| 1543 | AC_MSG_RESULT([yes]) |
| 1544 | ], [ |
| 1545 | ac_have_as_lzcnt=no |
| 1546 | AC_MSG_RESULT([no]) |
| 1547 | ]) |
| 1548 | |
| 1549 | AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes]) |
| 1550 | |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1551 | |
| 1552 | # does the x86/amd64 assembler understand SSE 4.2 instructions? |
| 1553 | # Note, this doesn't generate a C-level symbol. It generates a |
| 1554 | # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's |
| 1555 | AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2]) |
| 1556 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1557 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1558 | do { long long int x; |
| 1559 | __asm__ __volatile__( |
florian | fdfca22 | 2012-01-17 13:16:50 +0000 | [diff] [blame] | 1560 | "crc32q %%r15,%%r15" : : : "r15" ); |
| 1561 | __asm__ __volatile__( |
| 1562 | "pblendvb (%rcx), %xmm11"); } |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1563 | while (0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1564 | ]])], [ |
sewardj | 27d176a | 2011-01-17 11:15:48 +0000 | [diff] [blame] | 1565 | ac_have_as_sse42=yes |
| 1566 | AC_MSG_RESULT([yes]) |
| 1567 | ], [ |
| 1568 | ac_have_as_sse42=no |
| 1569 | AC_MSG_RESULT([no]) |
| 1570 | ]) |
| 1571 | |
| 1572 | AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes) |
| 1573 | |
| 1574 | |
sewardj | e089f01 | 2010-10-13 21:47:29 +0000 | [diff] [blame] | 1575 | # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this |
| 1576 | # when building the tool executables. I think we should get rid of it. |
| 1577 | # |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1578 | # Check for TLS support in the compiler and linker |
bart | 2bd9a68 | 2011-10-22 09:46:16 +0000 | [diff] [blame] | 1579 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 1580 | [[return foo;]])], |
| 1581 | [vg_cv_linktime_tls=yes], |
| 1582 | [vg_cv_linktime_tls=no]) |
bart | ca9f2ad | 2008-06-02 07:14:20 +0000 | [diff] [blame] | 1583 | # Native compilation: check whether running a program using TLS succeeds. |
| 1584 | # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs |
| 1585 | # succeeds but running programs using TLS fails. |
bart | 2bd9a68 | 2011-10-22 09:46:16 +0000 | [diff] [blame] | 1586 | # Cross-compiling: check whether linking a program using TLS succeeds. |
bart | ca9f2ad | 2008-06-02 07:14:20 +0000 | [diff] [blame] | 1587 | AC_CACHE_CHECK([for TLS support], vg_cv_tls, |
| 1588 | [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS], |
| 1589 | [vg_cv_tls=$enableval], |
| 1590 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]], |
| 1591 | [[return foo;]])], |
| 1592 | [vg_cv_tls=yes], |
bart | 2bd9a68 | 2011-10-22 09:46:16 +0000 | [diff] [blame] | 1593 | [vg_cv_tls=no], |
| 1594 | [vg_cv_tls=$vg_cv_linktime_tls])])]) |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 1595 | |
| 1596 | if test "$vg_cv_tls" = yes; then |
| 1597 | AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables]) |
| 1598 | fi |
sewardj | 5b754b4 | 2002-06-03 22:53:35 +0000 | [diff] [blame] | 1599 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1600 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1601 | #---------------------------------------------------------------------------- |
bart | 62f54e4 | 2008-07-28 11:35:10 +0000 | [diff] [blame] | 1602 | # Checks for C header files. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1603 | #---------------------------------------------------------------------------- |
| 1604 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1605 | AC_HEADER_STDC |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1606 | AC_CHECK_HEADERS([ \ |
bart | 1f2b143 | 2009-01-16 12:06:54 +0000 | [diff] [blame] | 1607 | asm/unistd.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1608 | endian.h \ |
| 1609 | mqueue.h \ |
| 1610 | sys/endian.h \ |
| 1611 | sys/epoll.h \ |
| 1612 | sys/eventfd.h \ |
bart | ce48fa9 | 2008-04-26 10:59:46 +0000 | [diff] [blame] | 1613 | sys/klog.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1614 | sys/poll.h \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1615 | sys/signal.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1616 | sys/signalfd.h \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1617 | sys/syscall.h \ |
| 1618 | sys/time.h \ |
| 1619 | sys/types.h \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1620 | ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1621 | |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 1622 | # Verify whether the <linux/futex.h> header is usable. |
| 1623 | AC_MSG_CHECKING([if <linux/futex.h> is usable]) |
| 1624 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1625 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 1626 | #include <linux/futex.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1627 | ]], [[ |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 1628 | return FUTEX_WAIT; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1629 | ]])], [ |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 1630 | ac_have_usable_linux_futex_h=yes |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 1631 | AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1, |
| 1632 | [Define to 1 if you have a usable <linux/futex.h> header file.]) |
| 1633 | AC_MSG_RESULT([yes]) |
| 1634 | ], [ |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 1635 | ac_have_usable_linux_futex_h=no |
bart | 818f17e | 2011-09-17 06:24:49 +0000 | [diff] [blame] | 1636 | AC_MSG_RESULT([no]) |
| 1637 | ]) |
| 1638 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1639 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1640 | # Checks for typedefs, structures, and compiler characteristics. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1641 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1642 | AC_TYPE_UID_T |
| 1643 | AC_TYPE_OFF_T |
| 1644 | AC_TYPE_SIZE_T |
| 1645 | AC_HEADER_TIME |
| 1646 | |
sewardj | 535c50f | 2005-06-04 23:14:53 +0000 | [diff] [blame] | 1647 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1648 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1649 | # Checks for library functions. |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1650 | #---------------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1651 | AC_FUNC_MEMCMP |
| 1652 | AC_FUNC_MMAP |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1653 | |
bart | 26288e4 | 2011-04-03 16:46:01 +0000 | [diff] [blame] | 1654 | AC_CHECK_LIB([pthread], [pthread_create]) |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1655 | AC_CHECK_LIB([rt], [clock_gettime]) |
bart | 41ac62a | 2008-07-07 16:58:03 +0000 | [diff] [blame] | 1656 | |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1657 | AC_CHECK_FUNCS([ \ |
bart | 71bad29 | 2008-04-27 11:43:23 +0000 | [diff] [blame] | 1658 | clock_gettime\ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1659 | epoll_create \ |
| 1660 | epoll_pwait \ |
bart | ce48fa9 | 2008-04-26 10:59:46 +0000 | [diff] [blame] | 1661 | klogctl \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1662 | mallinfo \ |
| 1663 | memchr \ |
| 1664 | memset \ |
| 1665 | mkdir \ |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 1666 | mremap \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1667 | ppoll \ |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 1668 | pthread_barrier_init \ |
| 1669 | pthread_condattr_setclock \ |
| 1670 | pthread_mutex_timedlock \ |
| 1671 | pthread_rwlock_timedrdlock \ |
| 1672 | pthread_rwlock_timedwrlock \ |
| 1673 | pthread_spin_lock \ |
bart | a72a27b | 2010-04-29 06:22:17 +0000 | [diff] [blame] | 1674 | pthread_yield \ |
bart | d1f724c | 2009-08-26 18:11:18 +0000 | [diff] [blame] | 1675 | readlinkat \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1676 | semtimedop \ |
| 1677 | signalfd \ |
njn | 6cc2247 | 2009-03-16 03:46:48 +0000 | [diff] [blame] | 1678 | sigwaitinfo \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1679 | strchr \ |
| 1680 | strdup \ |
| 1681 | strpbrk \ |
| 1682 | strrchr \ |
| 1683 | strstr \ |
bart | a72a27b | 2010-04-29 06:22:17 +0000 | [diff] [blame] | 1684 | syscall \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1685 | utimensat \ |
tom | 9e4b636 | 2012-02-10 09:39:37 +0000 | [diff] [blame] | 1686 | process_vm_readv \ |
| 1687 | process_vm_writev \ |
bart | f5ceec8 | 2008-04-26 07:45:10 +0000 | [diff] [blame] | 1688 | ]) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1689 | |
bart | 623eec3 | 2008-07-29 17:54:49 +0000 | [diff] [blame] | 1690 | # AC_CHECK_LIB adds any library found to the variable LIBS, and links these |
| 1691 | # libraries with any shared object and/or executable. This is NOT what we |
| 1692 | # want for e.g. vgpreload_core-x86-linux.so |
| 1693 | LIBS="" |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1694 | |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 1695 | AM_CONDITIONAL([HAVE_PTHREAD_BARRIER], |
| 1696 | [test x$ac_cv_func_pthread_barrier_init = xyes]) |
bart | 2eaa8f2 | 2009-01-20 14:01:16 +0000 | [diff] [blame] | 1697 | AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK], |
| 1698 | [test x$ac_cv_func_pthread_mutex_timedlock = xyes]) |
bart | 6d45e92 | 2009-01-20 13:45:38 +0000 | [diff] [blame] | 1699 | AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK], |
| 1700 | [test x$ac_cv_func_pthread_spin_lock = xyes]) |
| 1701 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1702 | |
| 1703 | #---------------------------------------------------------------------------- |
| 1704 | # MPI checks |
| 1705 | #---------------------------------------------------------------------------- |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1706 | # Do we have a useable MPI setup on the primary and/or secondary targets? |
| 1707 | # On Linux, by default, assumes mpicc and -m32/-m64 |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1708 | # Note: this is a kludge in that it assumes the specified mpicc |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 1709 | # understands -m32/-m64 regardless of what is specified using |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1710 | # --with-mpicc=. |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1711 | MPI_CC="mpicc" |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1712 | |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1713 | mflag_primary= |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1714 | if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \ |
sewardj | 6e9de46 | 2011-06-28 07:25:29 +0000 | [diff] [blame] | 1715 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ |
| 1716 | -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ; then |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1717 | mflag_primary=$FLAG_M32 |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1718 | elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \ |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 1719 | -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \ |
| 1720 | -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1721 | mflag_primary=$FLAG_M64 |
| 1722 | fi |
| 1723 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1724 | mflag_secondary= |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1725 | if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \ |
| 1726 | -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1727 | mflag_secondary=$FLAG_M32 |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1728 | fi |
| 1729 | |
| 1730 | |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1731 | AC_ARG_WITH(mpicc, |
sewardj | b70a613 | 2006-05-27 21:14:09 +0000 | [diff] [blame] | 1732 | [ --with-mpicc= Specify name of MPI2-ised C compiler], |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1733 | MPI_CC=$withval |
| 1734 | ) |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1735 | AC_SUBST(MPI_CC) |
| 1736 | |
| 1737 | ## See if MPI_CC works for the primary target |
| 1738 | ## |
| 1739 | 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] | 1740 | saved_CC=$CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1741 | saved_CFLAGS=$CFLAGS |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1742 | CC=$MPI_CC |
sewardj | e9fa506 | 2006-03-12 18:29:18 +0000 | [diff] [blame] | 1743 | CFLAGS=$mflag_primary |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1744 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 1745 | #include <mpi.h> |
| 1746 | #include <stdio.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1747 | ]], [[ |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1748 | int r = MPI_Init(NULL,NULL); |
| 1749 | r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL ); |
| 1750 | return r; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1751 | ]])], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1752 | ac_have_mpi2_pri=yes |
sewardj | 1a85e60 | 2006-03-08 15:26:10 +0000 | [diff] [blame] | 1753 | AC_MSG_RESULT([yes, $MPI_CC]) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1754 | ], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1755 | ac_have_mpi2_pri=no |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1756 | AC_MSG_RESULT([no]) |
| 1757 | ]) |
sewardj | 0ad4609 | 2006-03-02 17:09:16 +0000 | [diff] [blame] | 1758 | CC=$saved_CC |
sewardj | de4f384 | 2006-03-09 02:41:41 +0000 | [diff] [blame] | 1759 | CFLAGS=$saved_CFLAGS |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1760 | AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1761 | |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1762 | ## See if MPI_CC works for the secondary target. Complication: what if |
| 1763 | ## there is no secondary target? We need this to then fail. |
| 1764 | ## Kludge this by making MPI_CC something which will surely fail in |
| 1765 | ## such a case. |
| 1766 | ## |
| 1767 | AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h]) |
| 1768 | saved_CC=$CC |
| 1769 | saved_CFLAGS=$CFLAGS |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1770 | if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1771 | CC="$MPI_CC this will surely fail" |
| 1772 | else |
| 1773 | CC=$MPI_CC |
| 1774 | fi |
| 1775 | CFLAGS=$mflag_secondary |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1776 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1777 | #include <mpi.h> |
| 1778 | #include <stdio.h> |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1779 | ]], [[ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1780 | int r = MPI_Init(NULL,NULL); |
| 1781 | r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL ); |
| 1782 | return r; |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1783 | ]])], [ |
sewardj | 03d86f2 | 2006-10-17 00:57:24 +0000 | [diff] [blame] | 1784 | ac_have_mpi2_sec=yes |
| 1785 | AC_MSG_RESULT([yes, $MPI_CC]) |
| 1786 | ], [ |
| 1787 | ac_have_mpi2_sec=no |
| 1788 | AC_MSG_RESULT([no]) |
| 1789 | ]) |
| 1790 | CC=$saved_CC |
| 1791 | CFLAGS=$saved_CFLAGS |
| 1792 | AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes) |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 1793 | |
| 1794 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 1795 | #---------------------------------------------------------------------------- |
| 1796 | # Other library checks |
| 1797 | #---------------------------------------------------------------------------- |
bart | 2ef12d4 | 2010-10-18 16:32:11 +0000 | [diff] [blame] | 1798 | # There now follow some tests for Boost, and OpenMP. These |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1799 | # tests are present because Drd has some regression tests that use |
| 1800 | # these packages. All regression test programs all compiled only |
| 1801 | # for the primary target. And so it is important that the configure |
| 1802 | # checks that follow, use the correct -m32 or -m64 flag for the |
| 1803 | # primary target (called $mflag_primary). Otherwise, we can end up |
| 1804 | # in a situation (eg) where, on amd64-linux, the test for Boost checks |
| 1805 | # for usable 64-bit Boost facilities, but because we are doing a 32-bit |
| 1806 | # only build (meaning, the primary target is x86-linux), the build |
| 1807 | # of the regtest programs that use Boost fails, because they are |
| 1808 | # build as 32-bit (IN THIS EXAMPLE). |
| 1809 | # |
| 1810 | # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES |
| 1811 | # NEEDED BY THE REGRESSION TEST PROGRAMS. |
| 1812 | |
| 1813 | |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1814 | # Check whether the boost library 1.35 or later has been installed. |
| 1815 | # The Boost.Threads library has undergone a major rewrite in version 1.35.0. |
| 1816 | |
| 1817 | AC_MSG_CHECKING([for boost]) |
| 1818 | |
| 1819 | AC_LANG(C++) |
| 1820 | safe_CXXFLAGS=$CXXFLAGS |
| 1821 | CXXFLAGS="-lboost_thread-mt $mflag_primary" |
| 1822 | |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 1823 | AC_LINK_IFELSE([AC_LANG_SOURCE([ |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1824 | #include <boost/thread.hpp> |
| 1825 | static void thread_func(void) |
| 1826 | { } |
| 1827 | int main(int argc, char** argv) |
| 1828 | { |
| 1829 | boost::thread t(thread_func); |
| 1830 | return 0; |
| 1831 | } |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 1832 | ])], |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1833 | [ |
| 1834 | ac_have_boost_1_35=yes |
| 1835 | AC_SUBST([BOOST_CFLAGS], []) |
| 1836 | AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"]) |
| 1837 | AC_MSG_RESULT([yes]) |
| 1838 | ], [ |
| 1839 | ac_have_boost_1_35=no |
| 1840 | AC_MSG_RESULT([no]) |
| 1841 | ]) |
| 1842 | |
| 1843 | CXXFLAGS=$safe_CXXFLAGS |
| 1844 | AC_LANG(C) |
| 1845 | |
| 1846 | AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes]) |
| 1847 | |
| 1848 | |
| 1849 | # does this compiler support -fopenmp, does it have the include file |
| 1850 | # <omp.h> and does it have libgomp ? |
| 1851 | |
| 1852 | AC_MSG_CHECKING([for OpenMP]) |
| 1853 | |
| 1854 | safe_CFLAGS=$CFLAGS |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1855 | CFLAGS="-fopenmp $mflag_primary" |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1856 | |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 1857 | AC_LINK_IFELSE([AC_LANG_SOURCE([ |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1858 | #include <omp.h> |
| 1859 | int main(int argc, char** argv) |
| 1860 | { |
| 1861 | omp_set_dynamic(0); |
| 1862 | return 0; |
| 1863 | } |
bart | 128fc52 | 2011-03-12 10:36:35 +0000 | [diff] [blame] | 1864 | ])], |
sewardj | 493c4ef | 2008-12-13 16:45:19 +0000 | [diff] [blame] | 1865 | [ |
| 1866 | ac_have_openmp=yes |
| 1867 | AC_MSG_RESULT([yes]) |
| 1868 | ], [ |
| 1869 | ac_have_openmp=no |
| 1870 | AC_MSG_RESULT([no]) |
| 1871 | ]) |
| 1872 | CFLAGS=$safe_CFLAGS |
| 1873 | |
| 1874 | AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes]) |
| 1875 | |
| 1876 | |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 1877 | # does this compiler have built-in functions for atomic memory access for the |
| 1878 | # primary target ? |
| 1879 | 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] | 1880 | |
| 1881 | safe_CFLAGS=$CFLAGS |
| 1882 | CFLAGS="$mflag_primary" |
| 1883 | |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1884 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1885 | int variable = 1; |
| 1886 | return (__sync_bool_compare_and_swap(&variable, 1, 2) |
| 1887 | && __sync_add_and_fetch(&variable, 1) ? 1 : 0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1888 | ]])], [ |
bart | b4ff782 | 2011-12-10 19:48:04 +0000 | [diff] [blame] | 1889 | ac_have_builtin_atomic_primary=yes |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1890 | AC_MSG_RESULT([yes]) |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 1891 | 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] | 1892 | ], [ |
bart | b4ff782 | 2011-12-10 19:48:04 +0000 | [diff] [blame] | 1893 | ac_have_builtin_atomic_primary=no |
sewardj | c876a2f | 2009-01-22 22:44:30 +0000 | [diff] [blame] | 1894 | AC_MSG_RESULT([no]) |
| 1895 | ]) |
| 1896 | |
| 1897 | CFLAGS=$safe_CFLAGS |
| 1898 | |
bart | b4ff782 | 2011-12-10 19:48:04 +0000 | [diff] [blame] | 1899 | AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], |
| 1900 | [test x$ac_have_builtin_atomic_primary = xyes]) |
bart | c82d137 | 2009-05-31 16:21:23 +0000 | [diff] [blame] | 1901 | |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 1902 | |
| 1903 | # does this compiler have built-in functions for atomic memory access for the |
| 1904 | # secondary target ? |
| 1905 | |
| 1906 | if test x$VGCONF_PLATFORM_SEC_CAPS != x; then |
| 1907 | |
| 1908 | AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target]) |
| 1909 | |
| 1910 | safe_CFLAGS=$CFLAGS |
| 1911 | CFLAGS="$mflag_secondary" |
| 1912 | |
| 1913 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
| 1914 | int variable = 1; |
| 1915 | return (__sync_add_and_fetch(&variable, 1) ? 1 : 0) |
| 1916 | ]])], [ |
| 1917 | ac_have_builtin_atomic_secondary=yes |
| 1918 | AC_MSG_RESULT([yes]) |
| 1919 | ], [ |
| 1920 | ac_have_builtin_atomic_secondary=no |
| 1921 | AC_MSG_RESULT([no]) |
| 1922 | ]) |
| 1923 | |
| 1924 | CFLAGS=$safe_CFLAGS |
| 1925 | |
| 1926 | fi |
| 1927 | |
| 1928 | AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY], |
| 1929 | [test x$ac_have_builtin_atomic_secondary = xyes]) |
| 1930 | |
bart | 1e856ea | 2011-12-17 12:53:23 +0000 | [diff] [blame] | 1931 | # does this compiler have built-in functions for atomic memory access on |
| 1932 | # 64-bit integers for all targets ? |
| 1933 | |
| 1934 | AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets]) |
| 1935 | |
| 1936 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 1937 | #include <stdint.h> |
| 1938 | ]], [[ |
| 1939 | uint64_t variable = 1; |
| 1940 | return __sync_add_and_fetch(&variable, 1) |
| 1941 | ]])], [ |
| 1942 | ac_have_builtin_atomic64_primary=yes |
| 1943 | ], [ |
| 1944 | ac_have_builtin_atomic64_primary=no |
| 1945 | ]) |
| 1946 | |
| 1947 | if test x$VGCONF_PLATFORM_SEC_CAPS != x; then |
| 1948 | |
| 1949 | safe_CFLAGS=$CFLAGS |
| 1950 | CFLAGS="$mflag_secondary" |
| 1951 | |
| 1952 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 1953 | #include <stdint.h> |
| 1954 | ]], [[ |
| 1955 | uint64_t variable = 1; |
| 1956 | return __sync_add_and_fetch(&variable, 1) |
| 1957 | ]])], [ |
| 1958 | ac_have_builtin_atomic64_secondary=yes |
| 1959 | ], [ |
| 1960 | ac_have_builtin_atomic64_secondary=no |
| 1961 | ]) |
| 1962 | |
| 1963 | CFLAGS=$safe_CFLAGS |
| 1964 | |
| 1965 | fi |
| 1966 | |
| 1967 | if test x$ac_have_builtin_atomic64_primary = xyes && \ |
| 1968 | test x$VGCONF_PLATFORM_SEC_CAPS = x \ |
| 1969 | -o x$ac_have_builtin_atomic64_secondary = xyes; then |
| 1970 | AC_MSG_RESULT([yes]) |
| 1971 | ac_have_builtin_atomic64=yes |
| 1972 | else |
| 1973 | AC_MSG_RESULT([no]) |
| 1974 | ac_have_builtin_atomic64=no |
| 1975 | fi |
| 1976 | |
| 1977 | AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64], |
| 1978 | [test x$ac_have_builtin_atomic64 = xyes]) |
| 1979 | |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 1980 | |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 1981 | # does g++ have built-in functions for atomic memory access ? |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 1982 | AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch]) |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 1983 | |
| 1984 | safe_CXXFLAGS=$CXXFLAGS |
| 1985 | CXXFLAGS="$mflag_primary" |
| 1986 | |
| 1987 | AC_LANG_PUSH(C++) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1988 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 1989 | int variable = 1; |
| 1990 | return (__sync_bool_compare_and_swap(&variable, 1, 2) |
| 1991 | && __sync_add_and_fetch(&variable, 1) ? 1 : 0) |
bart | 417cf3e | 2011-10-22 09:21:24 +0000 | [diff] [blame] | 1992 | ]])], [ |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 1993 | ac_have_builtin_atomic_cxx=yes |
| 1994 | AC_MSG_RESULT([yes]) |
| 1995 | 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] | 1996 | ], [ |
bart | e874042 | 2011-03-24 20:27:54 +0000 | [diff] [blame] | 1997 | ac_have_builtin_atomic_cxx=no |
| 1998 | AC_MSG_RESULT([no]) |
| 1999 | ]) |
| 2000 | AC_LANG_POP(C++) |
| 2001 | |
| 2002 | CXXFLAGS=$safe_CXXFLAGS |
| 2003 | |
| 2004 | 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] | 2005 | |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2006 | |
| 2007 | if test x$ac_have_usable_linux_futex_h = xyes \ |
bart | b4ff782 | 2011-12-10 19:48:04 +0000 | [diff] [blame] | 2008 | -a x$ac_have_builtin_atomic_primary = xyes; then |
bart | 78bfc71 | 2011-12-08 16:14:59 +0000 | [diff] [blame] | 2009 | ac_enable_linux_ticket_lock_primary=yes |
| 2010 | fi |
| 2011 | AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY], |
| 2012 | [test x$ac_enable_linux_ticket_lock_primary = xyes]) |
| 2013 | |
| 2014 | if test x$VGCONF_PLATFORM_SEC_CAPS != x \ |
| 2015 | -a x$ac_have_usable_linux_futex_h = xyes \ |
| 2016 | -a x$ac_have_builtin_atomic_secondary = xyes; then |
| 2017 | ac_enable_linux_ticket_lock_secondary=yes |
| 2018 | fi |
| 2019 | AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY], |
| 2020 | [test x$ac_enable_linux_ticket_lock_secondary = xyes]) |
| 2021 | |
| 2022 | |
bart | f68af88 | 2011-12-10 19:42:05 +0000 | [diff] [blame] | 2023 | # does libstdc++ support annotating shared pointers ? |
| 2024 | AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers]) |
| 2025 | |
| 2026 | safe_CXXFLAGS=$CFLAGS |
| 2027 | CXXFLAGS="-std=c++0x" |
| 2028 | |
| 2029 | AC_LANG_PUSH(C++) |
| 2030 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2031 | #include <memory> |
| 2032 | ]], [[ |
| 2033 | std::shared_ptr<int> p |
| 2034 | ]])], [ |
| 2035 | ac_have_shared_ptr=yes |
| 2036 | ], [ |
| 2037 | ac_have_shared_ptr=no |
| 2038 | ]) |
| 2039 | if test x$ac_have_shared_ptr = xyes; then |
| 2040 | # If compilation of the program below fails because of a syntax error |
| 2041 | # triggered by substituting one of the annotation macros then that |
| 2042 | # means that libstdc++ supports these macros. |
| 2043 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2044 | #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)---- |
| 2045 | #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)---- |
| 2046 | #include <memory> |
| 2047 | ]], [[ |
| 2048 | std::shared_ptr<int> p |
| 2049 | ]])], [ |
| 2050 | ac_have_shared_pointer_annotation=no |
| 2051 | AC_MSG_RESULT([no]) |
| 2052 | ], [ |
| 2053 | ac_have_shared_pointer_annotation=yes |
| 2054 | AC_MSG_RESULT([yes]) |
| 2055 | AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1, |
| 2056 | [Define to 1 if libstd++ supports annotating shared pointers]) |
| 2057 | ]) |
| 2058 | else |
| 2059 | ac_have_shared_pointer_annotation=no |
| 2060 | AC_MSG_RESULT([no]) |
| 2061 | fi |
| 2062 | AC_LANG_POP(C++) |
| 2063 | |
| 2064 | CXXFLAGS=$safe_CXXFLAGS |
| 2065 | |
| 2066 | AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION], |
| 2067 | [test x$ac_have_shared_pointer_annotation = xyes]) |
| 2068 | |
| 2069 | |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2070 | #---------------------------------------------------------------------------- |
| 2071 | # Ok. We're done checking. |
| 2072 | #---------------------------------------------------------------------------- |
sewardj | 8063775 | 2006-03-02 13:48:21 +0000 | [diff] [blame] | 2073 | |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2074 | # Nb: VEX/Makefile is generated from Makefile.vex.in. |
| 2075 | AC_CONFIG_FILES([ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 2076 | Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2077 | VEX/Makefile:Makefile.vex.in |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2078 | valgrind.spec |
mueller | bddd607 | 2003-11-19 21:50:07 +0000 | [diff] [blame] | 2079 | valgrind.pc |
dirk | 07596a2 | 2008-04-25 11:33:30 +0000 | [diff] [blame] | 2080 | glibc-2.X.supp |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 2081 | docs/Makefile |
| 2082 | tests/Makefile |
njn | c2e7f48 | 2002-09-27 08:44:17 +0000 | [diff] [blame] | 2083 | tests/vg_regtest |
njn | ec0c27a | 2005-12-10 23:11:28 +0000 | [diff] [blame] | 2084 | perf/Makefile |
| 2085 | perf/vg_perf |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 2086 | gdbserver_tests/Makefile |
njn25 | 4d54243 | 2002-09-23 16:09:39 +0000 | [diff] [blame] | 2087 | include/Makefile |
njn | 7a6e746 | 2002-11-09 17:53:30 +0000 | [diff] [blame] | 2088 | auxprogs/Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2089 | mpi/Makefile |
njn25 | ab72603 | 2002-09-23 16:24:41 +0000 | [diff] [blame] | 2090 | coregrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2091 | memcheck/Makefile |
| 2092 | memcheck/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 2093 | memcheck/tests/amd64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 2094 | memcheck/tests/x86/Makefile |
njn | 3b3b76d | 2009-01-19 03:44:19 +0000 | [diff] [blame] | 2095 | memcheck/tests/linux/Makefile |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 2096 | memcheck/tests/darwin/Makefile |
njn | ea2d6fd | 2010-07-01 00:20:20 +0000 | [diff] [blame] | 2097 | memcheck/tests/amd64-linux/Makefile |
njn | a454ec0 | 2009-01-19 03:16:59 +0000 | [diff] [blame] | 2098 | memcheck/tests/x86-linux/Makefile |
sewardj | 0e342a0 | 2010-09-03 23:49:33 +0000 | [diff] [blame] | 2099 | memcheck/tests/ppc32/Makefile |
| 2100 | memcheck/tests/ppc64/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2101 | cachegrind/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2102 | cachegrind/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 2103 | cachegrind/tests/x86/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 2104 | cachegrind/cg_annotate |
njn | 69d495d | 2010-06-30 05:23:34 +0000 | [diff] [blame] | 2105 | cachegrind/cg_diff |
weidendo | a17f2a3 | 2006-03-20 10:27:30 +0000 | [diff] [blame] | 2106 | callgrind/Makefile |
| 2107 | callgrind/callgrind_annotate |
| 2108 | callgrind/callgrind_control |
| 2109 | callgrind/tests/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2110 | helgrind/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 2111 | helgrind/tests/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 2112 | massif/Makefile |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 2113 | massif/tests/Makefile |
njn | d5a8d24 | 2007-11-02 20:44:57 +0000 | [diff] [blame] | 2114 | massif/ms_print |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2115 | lackey/Makefile |
njn | f2df9b5 | 2002-10-04 11:35:47 +0000 | [diff] [blame] | 2116 | lackey/tests/Makefile |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 2117 | none/Makefile |
| 2118 | none/tests/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 2119 | none/tests/amd64/Makefile |
cerion | 85665ca | 2005-06-20 15:51:07 +0000 | [diff] [blame] | 2120 | none/tests/ppc32/Makefile |
sewardj | 2c48c7b | 2005-11-29 13:05:56 +0000 | [diff] [blame] | 2121 | none/tests/ppc64/Makefile |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 2122 | none/tests/x86/Makefile |
sewardj | 59570ff | 2010-01-01 11:59:33 +0000 | [diff] [blame] | 2123 | none/tests/arm/Makefile |
sewardj | b5b8740 | 2011-03-07 16:05:35 +0000 | [diff] [blame] | 2124 | none/tests/s390x/Makefile |
njn | 0458a12 | 2009-02-13 06:23:46 +0000 | [diff] [blame] | 2125 | none/tests/linux/Makefile |
njn | f76d27a | 2009-05-28 01:53:07 +0000 | [diff] [blame] | 2126 | none/tests/darwin/Makefile |
njn | 06ca332 | 2009-04-15 23:10:04 +0000 | [diff] [blame] | 2127 | none/tests/x86-linux/Makefile |
sewardj | d2f95a0 | 2011-05-11 16:04:28 +0000 | [diff] [blame] | 2128 | exp-sgcheck/Makefile |
| 2129 | exp-sgcheck/tests/Makefile |
bart | ccf17de | 2008-07-04 15:14:35 +0000 | [diff] [blame] | 2130 | drd/Makefile |
bart | ccf17de | 2008-07-04 15:14:35 +0000 | [diff] [blame] | 2131 | drd/scripts/download-and-build-splash2 |
| 2132 | drd/tests/Makefile |
njn | dbebecc | 2009-07-14 01:39:54 +0000 | [diff] [blame] | 2133 | exp-bbv/Makefile |
njn | dbebecc | 2009-07-14 01:39:54 +0000 | [diff] [blame] | 2134 | exp-bbv/tests/Makefile |
| 2135 | exp-bbv/tests/x86/Makefile |
| 2136 | exp-bbv/tests/x86-linux/Makefile |
| 2137 | exp-bbv/tests/amd64-linux/Makefile |
| 2138 | exp-bbv/tests/ppc32-linux/Makefile |
vince | 226e078 | 2010-01-06 15:22:11 +0000 | [diff] [blame] | 2139 | exp-bbv/tests/arm-linux/Makefile |
sewardj | 4d7d8f5 | 2010-10-12 10:09:15 +0000 | [diff] [blame] | 2140 | exp-dhat/Makefile |
| 2141 | exp-dhat/tests/Makefile |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2142 | ]) |
sewardj | d364580 | 2010-06-13 22:13:58 +0000 | [diff] [blame] | 2143 | AC_CONFIG_FILES([coregrind/link_tool_exe_linux], |
| 2144 | [chmod +x coregrind/link_tool_exe_linux]) |
| 2145 | AC_CONFIG_FILES([coregrind/link_tool_exe_darwin], |
| 2146 | [chmod +x coregrind/link_tool_exe_darwin]) |
njn | 8b68b64 | 2009-06-24 00:37:09 +0000 | [diff] [blame] | 2147 | AC_OUTPUT |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 2148 | |
| 2149 | cat<<EOF |
| 2150 | |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 2151 | Maximum build arch: ${ARCH_MAX} |
| 2152 | Primary build arch: ${VGCONF_ARCH_PRI} |
njn | 3f8a6e9 | 2009-06-02 00:20:47 +0000 | [diff] [blame] | 2153 | Secondary build arch: ${VGCONF_ARCH_SEC} |
njn | 311303f | 2009-02-06 03:46:50 +0000 | [diff] [blame] | 2154 | Build OS: ${VGCONF_OS} |
njn | 7fd6d38 | 2009-01-22 21:56:32 +0000 | [diff] [blame] | 2155 | Primary build target: ${VGCONF_PLATFORM_PRI_CAPS} |
| 2156 | Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS} |
sewardj | cb495c8 | 2011-07-11 20:42:34 +0000 | [diff] [blame] | 2157 | Platform variant: ${VGCONF_PLATVARIANT} |
| 2158 | Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1 |
sewardj | e95d94f | 2008-09-19 09:02:19 +0000 | [diff] [blame] | 2159 | Default supp files: ${DEFAULT_SUPP} |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 2160 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 2161 | EOF |