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