blob: 16e5c7f52596cac656fd6301c4e4ac50956c69f1 [file] [log] [blame]
sewardj01262142006-01-04 01:20:28 +00001
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
sewardjde4a1d02002-03-22 01:27:54 +000010# Process this file with autoconf to produce a configure script.
sewardj45a1fd02010-10-15 08:52:43 +000011AC_INIT(Valgrind, 3.7.0.SVN, valgrind-users@lists.sourceforge.net)
njn04e16982005-05-31 00:23:43 +000012AC_CONFIG_SRCDIR(coregrind/m_main.c)
sewardjde4a1d02002-03-22 01:27:54 +000013AM_CONFIG_HEADER(config.h)
bart3a2dac02008-03-18 17:40:38 +000014AM_INIT_AUTOMAKE([foreign])
sewardjde4a1d02002-03-22 01:27:54 +000015
gobryb0ed4672002-03-27 20:58:58 +000016AM_MAINTAINER_MODE
17
njn7fd6d382009-01-22 21:56:32 +000018#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +000019# Checks for various programs.
20#----------------------------------------------------------------------------
bartaca399a2010-08-15 18:54:15 +000021CFLAGS="-Wno-long-long $CFLAGS"
gobrye721a522002-03-22 13:38:30 +000022
sewardjde4a1d02002-03-22 01:27:54 +000023AC_PROG_LN_S
24AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000025AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000026AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000027AC_PROG_CXX
njn629a5ec2009-07-14 01:29:39 +000028# 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:
njn0cd26892009-07-12 23:07:13 +000032# - 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# ])
sewardjde4a1d02002-03-22 01:27:54 +000041AC_PROG_RANLIB
bart07de2c92010-05-29 06:44:28 +000042# provide a very basic definition for AC_PROG_SED if it's not provided by
43# autoconf (as e.g. in autoconf 2.59).
44m4_ifndef([AC_PROG_SED],
45 [AC_DEFUN([AC_PROG_SED],
46 [AC_ARG_VAR([SED])
47 AC_CHECK_PROGS([SED],[gsed sed])])])
bart12e91122010-05-15 08:37:24 +000048AC_PROG_SED
sewardjde4a1d02002-03-22 01:27:54 +000049
bartcddeaf52008-05-25 15:58:11 +000050# If no AR variable was specified, look up the name of the archiver. Otherwise
51# do not touch the AR variable.
52if test "x$AR" = "x"; then
bart07de2c92010-05-29 06:44:28 +000053 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000054fi
55AC_ARG_VAR([AR],[Archiver command])
56
gobrye721a522002-03-22 13:38:30 +000057# Check for the compiler support
58if test "${GCC}" != "yes" ; then
59 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
60fi
61
sewardj2f685952002-12-22 19:32:23 +000062# figure out where perl lives
63AC_PATH_PROG(PERL, perl)
64
njn9315df32003-04-16 20:50:50 +000065# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000066AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000067AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000068
daywalker48ccca52002-04-15 00:31:58 +000069# some older automake's don't have it so try something on our own
70ifdef([AM_PROG_AS],[AM_PROG_AS],
71[
gobry1be19852002-03-26 20:44:55 +000072AS="${CC}"
73AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000074
gobry1be19852002-03-26 20:44:55 +000075ASFLAGS=""
76AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000077])
gobry3b777892002-04-04 09:18:39 +000078
gobry3b777892002-04-04 09:18:39 +000079
njn0d2e58f2009-02-25 04:57:56 +000080# Check if 'diff' supports -u (universal diffs) and use it if possible.
81
82AC_MSG_CHECKING([for diff -u])
83AC_SUBST(DIFF)
84
85# Comparing two identical files results in 0, unless -u isn't supported (as
86# it's not on AIX).
njn31f665e2009-02-26 21:25:50 +000087tmpfile="tmp-xxx-yyy-zzz"
88touch $tmpfile;
89if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000090 AC_MSG_RESULT([yes])
91 DIFF="diff -u"
92else
93 AC_MSG_RESULT([no])
94 DIFF="diff"
95fi
njn31f665e2009-02-26 21:25:50 +000096rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000097
98
sewardj535c50f2005-06-04 23:14:53 +000099# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +0000100AC_MSG_CHECKING([for a supported version of gcc])
101
bart07de2c92010-05-29 06:44:28 +0000102[gcc_version=`${CC} --version | head -n 1 | $SED 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +0000103
104case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +0000105 2.*)
gobrye721a522002-03-22 13:38:30 +0000106 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000107 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
108 ;;
gobrye721a522002-03-22 13:38:30 +0000109 *)
110 AC_MSG_RESULT([ok (${gcc_version})])
111 ;;
112esac
113
njn7fd6d382009-01-22 21:56:32 +0000114#----------------------------------------------------------------------------
115# Arch/OS/platform tests.
116#----------------------------------------------------------------------------
117# We create a number of arch/OS/platform-related variables. We prefix them
118# all with "VGCONF_" which indicates that they are defined at
119# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
120# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000121
sewardjde4a1d02002-03-22 01:27:54 +0000122AC_CANONICAL_HOST
123
124AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000125
njn7fd6d382009-01-22 21:56:32 +0000126# ARCH_MAX reflects the most that this CPU can do: for example if it
127# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
128# Ditto for amd64. It is used for more configuration below, but is not used
129# outside this file.
gobrye721a522002-03-22 13:38:30 +0000130case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000131 i?86)
132 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000133 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000134 ;;
135
njnfe408942004-11-23 17:52:24 +0000136 x86_64)
137 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000138 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000139 ;;
140
sewardj2c48c7b2005-11-29 13:05:56 +0000141 powerpc64)
njn7fd6d382009-01-22 21:56:32 +0000142 # This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000143 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000144 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000145 ;;
146
147 powerpc)
njn7fd6d382009-01-22 21:56:32 +0000148 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
149 # Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000150 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000151 case "${host_os}" in
152 aix5.*)
njn7fd6d382009-01-22 21:56:32 +0000153 ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000154 ;;
155 *)
njn7fd6d382009-01-22 21:56:32 +0000156 ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000157 ;;
158 esac
nethercote9bcc9062004-10-13 13:50:01 +0000159 ;;
160
sewardjb5b87402011-03-07 16:05:35 +0000161 s390x)
162 AC_MSG_RESULT([ok (${host_cpu})])
163 ARCH_MAX="s390x"
164 ;;
165
sewardj59570ff2010-01-01 11:59:33 +0000166 armv7*)
167 AC_MSG_RESULT([ok (${host_cpu})])
168 ARCH_MAX="arm"
169 ;;
170
sewardjde4a1d02002-03-22 01:27:54 +0000171 *)
172 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000173 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000174 ;;
175esac
176
njn7fd6d382009-01-22 21:56:32 +0000177#----------------------------------------------------------------------------
178
sewardj86e992f2006-01-28 18:39:09 +0000179# Sometimes it's convenient to subvert the bi-arch build system and
180# just have a single build even though the underlying platform is
181# capable of both. Hence handle --enable-only64bit and
182# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000183# [Actually, if either of these options are used, I think both get built,
184# but only one gets installed. So if you use an in-place build, both can be
185# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000186
187# Check if a 64-bit only build has been requested
188AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
189 [AC_ARG_ENABLE(only64bit,
190 [ --enable-only64bit do a 64-bit only build],
191 [vg_cv_only64bit=$enableval],
192 [vg_cv_only64bit=no])])
193
194# Check if a 32-bit only build has been requested
195AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
196 [AC_ARG_ENABLE(only32bit,
197 [ --enable-only32bit do a 32-bit only build],
198 [vg_cv_only32bit=$enableval],
199 [vg_cv_only32bit=no])])
200
201# Stay sane
202if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
203 AC_MSG_ERROR(
204 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
205fi
206
njn7fd6d382009-01-22 21:56:32 +0000207#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000208
njn311303f2009-02-06 03:46:50 +0000209# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
210# compilation of many C files via -VGO_$(VGCONF_OS) and
211# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000212AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000213AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000214
njnf76d27a2009-05-28 01:53:07 +0000215DEFAULT_SUPP=""
216
gobrye721a522002-03-22 13:38:30 +0000217case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000218 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000219 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000220 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000221
222 # Ok, this is linux. Check the kernel version
223 AC_MSG_CHECKING([for the kernel version])
224
225 kernel=`uname -r`
226
227 case "${kernel}" in
bart0419e512011-06-05 08:51:47 +0000228 2.6.*|3.*)
bart2d6e6e72011-06-05 10:01:48 +0000229 AC_MSG_RESULT([2.6.x/3.x family (${kernel})])
230 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x or Linux 3.x])
mueller8c68e042004-01-03 15:21:14 +0000231 ;;
232
233 2.4.*)
234 AC_MSG_RESULT([2.4 family (${kernel})])
235 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
236 ;;
237
mueller8c68e042004-01-03 15:21:14 +0000238 *)
239 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000240 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000241 ;;
242 esac
243
244 ;;
245
sewardj03d86f22006-10-17 00:57:24 +0000246 aix5.1.*)
247 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000248 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000249 ;;
250 aix5.2.*)
251 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000252 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000253 ;;
254 aix5.3.*)
255 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000256 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000257 ;;
258
njnf76d27a2009-05-28 01:53:07 +0000259 *darwin*)
260 AC_MSG_RESULT([ok (${host_os})])
261 VGCONF_OS="darwin"
njnea2d6fd2010-07-01 00:20:20 +0000262 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
263 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
264 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
njnf76d27a2009-05-28 01:53:07 +0000265
266 AC_MSG_CHECKING([for the kernel version])
267 kernel=`uname -r`
268
269 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
270 # has only one relevant version, the OS version. The `uname` check
271 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
njnea2d6fd2010-07-01 00:20:20 +0000272 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard),
273 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000274 #
275 # XXX: `uname -r` won't do the right thing for cross-compiles, but
276 # that's not a problem yet.
277 case "${kernel}" in
278 9.*)
279 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000280 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000281 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000282 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000283 ;;
njnea2d6fd2010-07-01 00:20:20 +0000284 10.*)
285 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
286 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
287 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
288 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
289 ;;
njnf76d27a2009-05-28 01:53:07 +0000290 *)
291 AC_MSG_RESULT([unsupported (${kernel})])
njnea2d6fd2010-07-01 00:20:20 +0000292 AC_MSG_ERROR([Valgrind works on Darwin 9.x and 10.x (Mac OS X 10.5 and 10.6)])
njnf76d27a2009-05-28 01:53:07 +0000293 ;;
294 esac
295 ;;
296
sewardjde4a1d02002-03-22 01:27:54 +0000297 *)
298 AC_MSG_RESULT([no (${host_os})])
njncc58cea2010-07-05 07:21:22 +0000299 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
sewardjde4a1d02002-03-22 01:27:54 +0000300 ;;
301esac
302
njn7fd6d382009-01-22 21:56:32 +0000303#----------------------------------------------------------------------------
304
tomd6398392006-06-07 17:44:36 +0000305# If we are building on a 64 bit platform test to see if the system
306# supports building 32 bit programs and disable 32 bit support if it
307# does not support building 32 bit programs
308
njn7fd6d382009-01-22 21:56:32 +0000309case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000310 amd64-linux|ppc64-linux)
311 AC_MSG_CHECKING([for 32 bit build support])
312 safe_CFLAGS=$CFLAGS
313 CFLAGS="-m32"
314 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000315 return 0;
tomd6398392006-06-07 17:44:36 +0000316 ],
317 [
318 AC_MSG_RESULT([yes])
319 ], [
320 vg_cv_only64bit="yes"
321 AC_MSG_RESULT([no])
322 ])
323 CFLAGS=$safe_CFLAGS;;
324esac
325
326if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
327 AC_MSG_ERROR(
328 [--enable-only32bit was specified but system does not support 32 bit builds])
329fi
nethercote888ecb72004-08-23 14:54:40 +0000330
njn7fd6d382009-01-22 21:56:32 +0000331#----------------------------------------------------------------------------
332
njn311303f2009-02-06 03:46:50 +0000333# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
334# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
335# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
336# above) will be "amd64" since that reflects the most that this cpu can do,
337# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
338# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000339# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
340# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
341AC_SUBST(VGCONF_ARCH_PRI)
342
njn3f8a6e92009-06-02 00:20:47 +0000343# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
344# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
345# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
346# It is empty if there is no secondary target.
347AC_SUBST(VGCONF_ARCH_SEC)
348
njn311303f2009-02-06 03:46:50 +0000349# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
350# The entire system, including regression and performance tests, will be
351# built for this target. The "_CAPS" indicates that the name is in capital
352# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000353# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000354# convention and cannot contain '-' characters. This is in contrast to
355# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000356AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
357
358# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
359# Valgrind and tools will also be built for this target, but not the
360# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000361#
njn7fd6d382009-01-22 21:56:32 +0000362# By default, the primary arch is the same as the "max" arch, as commented
363# above (at the definition of ARCH_MAX). We may choose to downgrade it in
364# the big case statement just below here, in the case where we're building
365# on a 64 bit machine but have been requested only to do a 32 bit build.
366AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
367
sewardj01262142006-01-04 01:20:28 +0000368AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000369
njnea2d6fd2010-07-01 00:20:20 +0000370# NB. The load address for a given platform may be specified in more
371# than one place, in some cases, depending on whether we're doing a biarch,
372# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
373# Be careful to give consistent values in all subcases. Also, all four
374# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
375# even if it is to "0xUNSET".
376#
njn7fd6d382009-01-22 21:56:32 +0000377case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000378 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000379 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000380 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000381 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
382 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000383 valt_load_address_pri_norml="0x38000000"
384 valt_load_address_pri_inner="0x28000000"
385 valt_load_address_sec_norml="0xUNSET"
386 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000387 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000388 ;;
389 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000390 valt_load_address_sec_norml="0xUNSET"
391 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000392 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000393 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000394 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000395 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
396 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000397 valt_load_address_pri_norml="0x38000000"
398 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000399 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000400 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000401 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000402 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
403 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000404 valt_load_address_pri_norml="0x38000000"
405 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000406 else
njn7fd6d382009-01-22 21:56:32 +0000407 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000408 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000409 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
410 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000411 valt_load_address_pri_norml="0x38000000"
412 valt_load_address_pri_inner="0x28000000"
413 valt_load_address_sec_norml="0x38000000"
414 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000415 fi
njn377c43f2009-05-19 07:39:22 +0000416 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000417 ;;
418 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000419 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000420 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000421 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
422 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000423 valt_load_address_pri_norml="0x38000000"
424 valt_load_address_pri_inner="0x28000000"
425 valt_load_address_sec_norml="0xUNSET"
426 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000427 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000428 ;;
sewardj03d86f22006-10-17 00:57:24 +0000429 ppc64-aix5)
njnea2d6fd2010-07-01 00:20:20 +0000430 valt_load_address_pri_norml="0xUNSET"
431 valt_load_address_pri_inner="0xUNSET"
432 valt_load_address_sec_norml="0xUNSET"
433 valt_load_address_sec_inner="0xUNSET"
sewardj03d86f22006-10-17 00:57:24 +0000434 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000435 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000436 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000437 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
438 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000439 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000440 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000441 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000442 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
443 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000444 else
njn7fd6d382009-01-22 21:56:32 +0000445 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000446 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000447 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
448 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000449 fi
njn377c43f2009-05-19 07:39:22 +0000450 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000451 ;;
sewardj01262142006-01-04 01:20:28 +0000452 ppc64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000453 valt_load_address_sec_norml="0xUNSET"
454 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000455 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000456 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000457 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000458 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
459 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000460 valt_load_address_pri_norml="0x38000000"
461 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000462 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000463 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000464 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000465 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
466 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000467 valt_load_address_pri_norml="0x38000000"
468 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000469 else
njn7fd6d382009-01-22 21:56:32 +0000470 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000471 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000472 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
473 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000474 valt_load_address_pri_norml="0x38000000"
475 valt_load_address_pri_inner="0x28000000"
476 valt_load_address_sec_norml="0x38000000"
477 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000478 fi
njn377c43f2009-05-19 07:39:22 +0000479 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000480 ;;
njncc58cea2010-07-05 07:21:22 +0000481 # Darwin gets identified as 32-bit even when it supports 64-bit.
482 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
483 # all Macs support both 32-bit and 64-bit, so we just build both. If
484 # someone has a really old 32-bit only machine they can (hopefully?)
485 # build with --enable-only32bit. See bug 243362.
486 x86-darwin|amd64-darwin)
487 ARCH_MAX="amd64"
njnea2d6fd2010-07-01 00:20:20 +0000488 valt_load_address_sec_norml="0xUNSET"
489 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000490 if test x$vg_cv_only64bit = xyes; then
491 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000492 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000493 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
494 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000495 valt_load_address_pri_norml="0x138000000"
496 valt_load_address_pri_inner="0x128000000"
njnf76d27a2009-05-28 01:53:07 +0000497 elif test x$vg_cv_only32bit = xyes; then
498 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000499 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000500 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
501 VGCONF_PLATFORM_SEC_CAPS=""
502 VGCONF_ARCH_PRI_CAPS="x86"
njnea2d6fd2010-07-01 00:20:20 +0000503 valt_load_address_pri_norml="0x38000000"
504 valt_load_address_pri_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000505 else
506 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000507 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000508 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
509 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
njnea2d6fd2010-07-01 00:20:20 +0000510 valt_load_address_pri_norml="0x138000000"
511 valt_load_address_pri_inner="0x128000000"
512 valt_load_address_sec_norml="0x38000000"
513 valt_load_address_sec_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000514 fi
njnf76d27a2009-05-28 01:53:07 +0000515 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
516 ;;
sewardj59570ff2010-01-01 11:59:33 +0000517 arm-linux)
518 VGCONF_ARCH_PRI="arm"
519 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
520 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000521 valt_load_address_pri_norml="0x38000000"
522 valt_load_address_pri_inner="0x28000000"
523 valt_load_address_sec_norml="0xUNSET"
524 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000525 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
526 ;;
sewardjb5b87402011-03-07 16:05:35 +0000527 s390x-linux)
528 VGCONF_ARCH_PRI="s390x"
529 VGCONF_ARCH_SEC=""
530 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
531 VGCONF_PLATFORM_SEC_CAPS=""
532 # we want to have the generated code close to the dispatcher
533 valt_load_address_pri_norml="0x401000000"
534 valt_load_address_pri_inner="0x410000000"
535 valt_load_address_sec_norml="0xUNSET"
536 valt_load_address_sec_inner="0xUNSET"
537 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
538 ;;
nethercote888ecb72004-08-23 14:54:40 +0000539 *)
njn7fd6d382009-01-22 21:56:32 +0000540 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000541 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000542 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
543 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000544 valt_load_address_pri_norml="0xUNSET"
545 valt_load_address_pri_inner="0xUNSET"
546 valt_load_address_sec_norml="0xUNSET"
547 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000548 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000549 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000550 ;;
551esac
sewardjde4a1d02002-03-22 01:27:54 +0000552
njn7fd6d382009-01-22 21:56:32 +0000553#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000554
njn7fd6d382009-01-22 21:56:32 +0000555# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
556# defined.
557AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
558 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000559 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
560 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
561 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000562AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000563 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
564 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000565AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
566 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
567 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
568 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
569 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
570AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
571 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
572 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj59570ff2010-01-01 11:59:33 +0000573AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
574 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardjb5b87402011-03-07 16:05:35 +0000575AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
576 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000577
njn7fd6d382009-01-22 21:56:32 +0000578# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
579# become defined.
580AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
581 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
582 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
583AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
584 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
585AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
586 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
587 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
588AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
589 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000590AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
591 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
sewardjb5b87402011-03-07 16:05:35 +0000592AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
593 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
594 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000595
njn7fd6d382009-01-22 21:56:32 +0000596AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
597 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
598 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
599AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
600 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
601
njnf76d27a2009-05-28 01:53:07 +0000602AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
603 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
604 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
605AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
606 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
607
608
sewardj72a2d802010-07-29 05:24:20 +0000609# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000610# Relies on the assumption that the primary and secondary targets are
611# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000612AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
613 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
614 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
615 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000616 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +0000617 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
618 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX)
njn7fd6d382009-01-22 21:56:32 +0000619AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
620 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
621 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000622AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
623 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
624 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000625
626
njn7fd6d382009-01-22 21:56:32 +0000627# Sometimes, in the Makefile.am files, it's useful to know whether or not
628# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000629AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000630 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000631
tomb637bad2005-11-08 12:28:35 +0000632
njn7fd6d382009-01-22 21:56:32 +0000633#----------------------------------------------------------------------------
634# Inner Valgrind?
635#----------------------------------------------------------------------------
636
njnd74b0ef2009-01-20 06:06:52 +0000637# Check if this should be built as an inner Valgrind, to be run within
638# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000639AC_SUBST(VALT_LOAD_ADDRESS_PRI)
640AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000641AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
642 [AC_ARG_ENABLE(inner,
643 [ --enable-inner enables self-hosting],
644 [vg_cv_inner=$enableval],
645 [vg_cv_inner=no])])
646if test "$vg_cv_inner" = yes; then
647 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000648 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
649 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000650else
njnea2d6fd2010-07-01 00:20:20 +0000651 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
652 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000653fi
654
655
njn7fd6d382009-01-22 21:56:32 +0000656#----------------------------------------------------------------------------
657# Libc and suppressions
658#----------------------------------------------------------------------------
659# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000660AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000661
bart12e91122010-05-15 08:37:24 +0000662AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000663
bart12e91122010-05-15 08:37:24 +0000664if test x$ac_cv_header_features_h = xyes; then
665 rm -f conftest.$ac_ext
666 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000667#include <features.h>
bart12e91122010-05-15 08:37:24 +0000668#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
669glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000670#endif
bart12e91122010-05-15 08:37:24 +0000671_ACEOF
672 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
673fi
bartb7c3f082010-05-13 06:32:36 +0000674
sewardj03d86f22006-10-17 00:57:24 +0000675AC_EGREP_CPP([AIX5_LIBC], [
676#include <standards.h>
677#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
678 AIX5_LIBC
679#endif
680],
dirk07596a22008-04-25 11:33:30 +0000681GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000682
njnf76d27a2009-05-28 01:53:07 +0000683# not really a version check
684AC_EGREP_CPP([DARWIN_LIBC], [
685#include <sys/cdefs.h>
686#if defined(__DARWIN_VERS_1050)
687 DARWIN_LIBC
688#endif
689],
690GLIBC_VERSION="darwin")
691
dirk07596a22008-04-25 11:33:30 +0000692AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000693
dirk07596a22008-04-25 11:33:30 +0000694case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000695 2.2)
696 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000697 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000698 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
699 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000700 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000701 ;;
702
sewardj08c7f012002-10-07 23:56:55 +0000703 2.3)
704 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000705 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000706 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000707 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000708 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000709 ;;
710
njn781dba52005-06-30 04:06:38 +0000711 2.4)
712 AC_MSG_RESULT(2.4 family)
713 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000714 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000715 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000716 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000717 ;;
718
dirkaece45c2006-10-12 08:17:49 +0000719 2.5)
720 AC_MSG_RESULT(2.5 family)
721 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000722 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000723 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000724 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000725 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000726 2.6)
727 AC_MSG_RESULT(2.6 family)
728 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000729 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000730 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000731 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000732 ;;
733 2.7)
734 AC_MSG_RESULT(2.7 family)
735 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000736 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000737 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000738 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000739 ;;
dirk07596a22008-04-25 11:33:30 +0000740 2.8)
741 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000742 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000743 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
744 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
745 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
746 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000747 2.9)
748 AC_MSG_RESULT(2.9 family)
749 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
750 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
751 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
752 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
753 ;;
sewardj5d425e82009-02-01 19:01:11 +0000754 2.10)
755 AC_MSG_RESULT(2.10 family)
756 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
757 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
758 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
759 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
760 ;;
bart0fac7ff2009-11-15 19:11:19 +0000761 2.11)
762 AC_MSG_RESULT(2.11 family)
763 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
764 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
765 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
766 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000767 ;;
768 2.12)
769 AC_MSG_RESULT(2.12 family)
770 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
771 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
772 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
773 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000774 ;;
tomebd619b2011-02-10 09:09:09 +0000775 2.13)
776 AC_MSG_RESULT(2.13 family)
777 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
778 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
779 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
780 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
781 ;;
tomcc077412011-06-07 21:52:26 +0000782 2.14)
783 AC_MSG_RESULT(2.14 family)
784 AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x])
785 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
786 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
787 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
788 ;;
sewardj03d86f22006-10-17 00:57:24 +0000789 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000790 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
791 AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
sewardj03d86f22006-10-17 00:57:24 +0000792 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
793 ;;
njnf76d27a2009-05-28 01:53:07 +0000794 darwin)
795 AC_MSG_RESULT(Darwin)
796 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
797 # DEFAULT_SUPP set by kernel version check above.
798 ;;
dirkaece45c2006-10-12 08:17:49 +0000799
sewardjde4a1d02002-03-22 01:27:54 +0000800 *)
bart12e91122010-05-15 08:37:24 +0000801 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
tomcc077412011-06-07 21:52:26 +0000802 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.14])
dirk07596a22008-04-25 11:33:30 +0000803 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000804 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000805 ;;
806esac
807
dirk07596a22008-04-25 11:33:30 +0000808AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000809
sewardj414f3582008-07-18 20:46:00 +0000810
811# Add default suppressions for the X client libraries. Make no
812# attempt to detect whether such libraries are installed on the
813# build machine (or even if any X facilities are present); just
814# add the suppressions antidisirregardless.
815DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
816DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000817
sewardjd2f95a02011-05-11 16:04:28 +0000818# Add glibc and X11 suppressions for exp-sgcheck
819DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
sewardj5744c022008-10-19 18:58:13 +0000820
sewardj2e10a682003-04-07 19:36:41 +0000821
njn7fd6d382009-01-22 21:56:32 +0000822#----------------------------------------------------------------------------
823# Checking for various library functions and other definitions
824#----------------------------------------------------------------------------
825
bart59e2f182008-04-28 16:22:53 +0000826# Check for CLOCK_MONOTONIC
827
828AC_MSG_CHECKING([for CLOCK_MONOTONIC])
829
830AC_TRY_COMPILE(
831[
832#include <time.h>
833], [
834 struct timespec t;
835 clock_gettime(CLOCK_MONOTONIC, &t);
836 return 0;
837],
838[
839AC_MSG_RESULT([yes])
840AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
841 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
842], [
843AC_MSG_RESULT([no])
844])
845
bartfea06922008-05-03 09:12:15 +0000846
847# Check for PTHREAD_MUTEX_ADAPTIVE_NP
848
849AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
850
851AC_TRY_COMPILE(
852[
853#define _GNU_SOURCE
854#include <pthread.h>
855], [
856 return (PTHREAD_MUTEX_ADAPTIVE_NP);
857],
858[
859AC_MSG_RESULT([yes])
860AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
861 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
862], [
863AC_MSG_RESULT([no])
864])
865
866
867# Check for PTHREAD_MUTEX_ERRORCHECK_NP
868
869AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
870
871AC_TRY_COMPILE(
872[
873#define _GNU_SOURCE
874#include <pthread.h>
875], [
876 return (PTHREAD_MUTEX_ERRORCHECK_NP);
877],
878[
879AC_MSG_RESULT([yes])
880AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
881 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
882], [
883AC_MSG_RESULT([no])
884])
885
886
887# Check for PTHREAD_MUTEX_RECURSIVE_NP
888
889AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
890
891AC_TRY_COMPILE(
892[
893#define _GNU_SOURCE
894#include <pthread.h>
895], [
896 return (PTHREAD_MUTEX_RECURSIVE_NP);
897],
898[
899AC_MSG_RESULT([yes])
900AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
901 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
902], [
903AC_MSG_RESULT([no])
904])
905
906
907# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
908
909AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
910
911AC_TRY_COMPILE(
912[
913#define _GNU_SOURCE
914#include <pthread.h>
915], [
916 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
917 return 0;
918],
919[
920AC_MSG_RESULT([yes])
921AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
922 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
923], [
924AC_MSG_RESULT([no])
925])
926
927
bart5e389f12008-04-05 12:53:15 +0000928# Check whether pthread_mutex_t has a member called __m_kind.
929
bartb11355c2010-04-29 16:37:26 +0000930AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
931 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
932 1,
933 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
934 ],
935 [],
936 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000937
938
939# Check whether pthread_mutex_t has a member called __data.__kind.
940
bartb11355c2010-04-29 16:37:26 +0000941AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
942 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
943 1,
944 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
945 ],
946 [],
947 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000948
949
bart62c370e2008-05-12 18:50:51 +0000950# does this compiler support -maltivec and does it have the include file
951# <altivec.h> ?
952
953AC_MSG_CHECKING([for Altivec])
954
955safe_CFLAGS=$CFLAGS
956CFLAGS="-maltivec"
957
958AC_TRY_COMPILE(
959[
960#include <altivec.h>
961], [
962 vector unsigned int v;
963],
964[
965ac_have_altivec=yes
966AC_MSG_RESULT([yes])
sewardjf9fe6022010-09-03 14:36:50 +0000967AC_DEFINE([HAS_ALTIVEC], 1,
sewardj6467a152010-09-03 14:02:22 +0000968 [Define to 1 if gcc/as can do Altivec.])
bart62c370e2008-05-12 18:50:51 +0000969], [
970ac_have_altivec=no
971AC_MSG_RESULT([no])
972])
973CFLAGS=$safe_CFLAGS
974
sewardj0e342a02010-09-03 23:49:33 +0000975AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
bart62c370e2008-05-12 18:50:51 +0000976
977
sewardjf34eb492011-04-15 11:57:05 +0000978# Check that both: the compiler supports -mvsx and that the assembler
979# understands VSX instructions. If either of those doesn't work,
980# conclude that we can't do VSX. NOTE: basically this is a kludge
981# in that it conflates two things that should be separate -- whether
982# the compiler understands the flag vs whether the assembler
983# understands the opcodes. This really ought to be cleaned up
984# and done properly, like it is for x86/x86_64.
985
986AC_MSG_CHECKING([for VSX])
987
988safe_CFLAGS=$CFLAGS
989CFLAGS="-mvsx"
990
991AC_TRY_COMPILE(
992[
993#include <altivec.h>
994], [
995 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +0000996 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
sewardjf34eb492011-04-15 11:57:05 +0000997],
998[
999ac_have_vsx=yes
1000AC_MSG_RESULT([yes])
1001], [
1002ac_have_vsx=no
1003AC_MSG_RESULT([no])
1004])
1005CFLAGS=$safe_CFLAGS
1006
1007AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1008
1009
bart36dd85a2009-04-26 07:11:48 +00001010# Check for pthread_create@GLIBC2.0
1011AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1012
bart16e1c5a2009-04-26 07:38:53 +00001013safe_CFLAGS=$CFLAGS
1014CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +00001015AC_TRY_LINK(
1016[
1017extern int pthread_create_glibc_2_0(void*, const void*,
1018 void *(*)(void*), void*);
1019__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1020], [
bart276ed3a2009-05-10 15:41:45 +00001021#ifdef __powerpc__
1022/*
1023 * Apparently on PowerPC linking this program succeeds and generates an
1024 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1025 */
1026#error This test does not work properly on PowerPC.
1027#else
bart16e1c5a2009-04-26 07:38:53 +00001028 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001029#endif
bart16e1c5a2009-04-26 07:38:53 +00001030 return 0;
bart36dd85a2009-04-26 07:11:48 +00001031],
1032[
1033ac_have_pthread_create_glibc_2_0=yes
1034AC_MSG_RESULT([yes])
1035AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1036 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1037], [
1038ac_have_pthread_create_glibc_2_0=no
1039AC_MSG_RESULT([no])
1040])
bart16e1c5a2009-04-26 07:38:53 +00001041CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001042
1043AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001044 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001045
1046
barta50aa8a2008-04-27 06:06:57 +00001047# Check for eventfd_t, eventfd() and eventfd_read()
1048AC_MSG_CHECKING([for eventfd()])
1049
1050AC_TRY_LINK(
1051[
1052#include <sys/eventfd.h>
1053], [
1054 eventfd_t ev;
1055 int fd;
1056
1057 fd = eventfd(5, 0);
1058 eventfd_read(fd, &ev);
1059 return 0;
1060],
1061[
1062AC_MSG_RESULT([yes])
1063AC_DEFINE([HAVE_EVENTFD], 1,
1064 [Define to 1 if you have the `eventfd' function.])
1065AC_DEFINE([HAVE_EVENTFD_READ], 1,
1066 [Define to 1 if you have the `eventfd_read' function.])
1067], [
1068AC_MSG_RESULT([no])
1069])
1070
1071
njn7fd6d382009-01-22 21:56:32 +00001072#----------------------------------------------------------------------------
1073# Checking for supported compiler flags.
1074#----------------------------------------------------------------------------
1075
sewardj535c50f2005-06-04 23:14:53 +00001076# does this compiler support -m32 ?
1077AC_MSG_CHECKING([if gcc accepts -m32])
1078
1079safe_CFLAGS=$CFLAGS
1080CFLAGS="-m32"
1081
1082AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001083 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001084],
1085[
1086FLAG_M32="-m32"
1087AC_MSG_RESULT([yes])
1088], [
1089FLAG_M32=""
1090AC_MSG_RESULT([no])
1091])
1092CFLAGS=$safe_CFLAGS
1093
1094AC_SUBST(FLAG_M32)
1095
1096
sewardj03d86f22006-10-17 00:57:24 +00001097# does this compiler support -maix32 ?
1098AC_MSG_CHECKING([if gcc accepts -maix32])
1099
1100safe_CFLAGS=$CFLAGS
1101CFLAGS="-maix32"
1102
1103AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001104 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001105],
1106[
1107FLAG_MAIX32="-maix32"
1108AC_MSG_RESULT([yes])
1109], [
1110FLAG_MAIX32=""
1111AC_MSG_RESULT([no])
1112])
1113CFLAGS=$safe_CFLAGS
1114
1115AC_SUBST(FLAG_MAIX32)
1116
1117
sewardj01262142006-01-04 01:20:28 +00001118# does this compiler support -m64 ?
1119AC_MSG_CHECKING([if gcc accepts -m64])
1120
1121safe_CFLAGS=$CFLAGS
1122CFLAGS="-m64"
1123
1124AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001125 return 0;
sewardj01262142006-01-04 01:20:28 +00001126],
1127[
1128FLAG_M64="-m64"
1129AC_MSG_RESULT([yes])
1130], [
1131FLAG_M64=""
1132AC_MSG_RESULT([no])
1133])
1134CFLAGS=$safe_CFLAGS
1135
1136AC_SUBST(FLAG_M64)
1137
1138
sewardj03d86f22006-10-17 00:57:24 +00001139# does this compiler support -maix64 ?
1140AC_MSG_CHECKING([if gcc accepts -maix64])
1141
1142safe_CFLAGS=$CFLAGS
1143CFLAGS="-maix64"
1144
1145AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001146 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001147],
1148[
1149FLAG_MAIX64="-maix64"
1150AC_MSG_RESULT([yes])
1151], [
1152FLAG_MAIX64=""
1153AC_MSG_RESULT([no])
1154])
1155CFLAGS=$safe_CFLAGS
1156
1157AC_SUBST(FLAG_MAIX64)
1158
1159
sewardj67f1fcc2005-07-03 10:41:02 +00001160# does this compiler support -mmmx ?
1161AC_MSG_CHECKING([if gcc accepts -mmmx])
1162
1163safe_CFLAGS=$CFLAGS
1164CFLAGS="-mmmx"
1165
1166AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001167 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001168],
1169[
1170FLAG_MMMX="-mmmx"
1171AC_MSG_RESULT([yes])
1172], [
1173FLAG_MMMX=""
1174AC_MSG_RESULT([no])
1175])
1176CFLAGS=$safe_CFLAGS
1177
1178AC_SUBST(FLAG_MMMX)
1179
1180
1181# does this compiler support -msse ?
1182AC_MSG_CHECKING([if gcc accepts -msse])
1183
1184safe_CFLAGS=$CFLAGS
1185CFLAGS="-msse"
1186
1187AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001188 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001189],
1190[
1191FLAG_MSSE="-msse"
1192AC_MSG_RESULT([yes])
1193], [
1194FLAG_MSSE=""
1195AC_MSG_RESULT([no])
1196])
1197CFLAGS=$safe_CFLAGS
1198
1199AC_SUBST(FLAG_MSSE)
1200
1201
sewardj5b754b42002-06-03 22:53:35 +00001202# does this compiler support -mpreferred-stack-boundary=2 ?
1203AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1204
daywalker3664f562003-10-17 13:43:46 +00001205safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001206CFLAGS="-mpreferred-stack-boundary=2"
1207
1208AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001209 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001210],
1211[
1212PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001213AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001214], [
1215PREFERRED_STACK_BOUNDARY=""
1216AC_MSG_RESULT([no])
1217])
daywalker3664f562003-10-17 13:43:46 +00001218CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001219
1220AC_SUBST(PREFERRED_STACK_BOUNDARY)
1221
sewardj535c50f2005-06-04 23:14:53 +00001222
sewardjb5f6f512005-03-10 23:59:00 +00001223# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001224AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001225
1226safe_CFLAGS=$CFLAGS
1227CFLAGS="-Wno-pointer-sign"
1228
1229AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001230 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001231],
1232[
1233no_pointer_sign=yes
1234AC_MSG_RESULT([yes])
1235], [
1236no_pointer_sign=no
1237AC_MSG_RESULT([no])
1238])
1239CFLAGS=$safe_CFLAGS
1240
1241if test x$no_pointer_sign = xyes; then
1242 CFLAGS="$CFLAGS -Wno-pointer-sign"
1243fi
1244
sewardj535c50f2005-06-04 23:14:53 +00001245
barte026bd22009-07-04 12:17:07 +00001246# does this compiler support -Wno-empty-body ?
1247
1248AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1249
1250safe_CFLAGS=$CFLAGS
1251CFLAGS="-Wno-empty-body"
1252
1253AC_TRY_COMPILE(
1254[ ],
1255[
1256 return 0;
1257],
1258[
1259AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1260AC_MSG_RESULT([yes])
1261],
1262[
1263AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1264AC_MSG_RESULT([no])
1265])
1266CFLAGS=$safe_CFLAGS
1267
1268
bart9d865fa2008-06-23 12:11:49 +00001269# does this compiler support -Wno-format-zero-length ?
1270
1271AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1272
1273safe_CFLAGS=$CFLAGS
1274CFLAGS="-Wno-format-zero-length"
1275
1276AC_TRY_COMPILE(
1277[ ],
1278[
1279 return 0;
1280],
1281[
1282AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1283AC_MSG_RESULT([yes])
1284],
1285[
1286AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1287AC_MSG_RESULT([no])
1288])
1289CFLAGS=$safe_CFLAGS
1290
1291
bart8e216312011-05-15 17:05:36 +00001292# does this compiler support -Wno-nonnull ?
1293
1294AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
1295
1296safe_CFLAGS=$CFLAGS
1297CFLAGS="-Wno-nonnull"
1298
1299AC_TRY_COMPILE(
1300[ ],
1301[
1302 return 0;
1303],
1304[
1305AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
1306AC_MSG_RESULT([yes])
1307],
1308[
1309AC_SUBST([FLAG_W_NO_NONNULL], [])
1310AC_MSG_RESULT([no])
1311])
1312CFLAGS=$safe_CFLAGS
1313
1314
1315# does this compiler support -Wno-overflow ?
1316
1317AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
1318
1319safe_CFLAGS=$CFLAGS
1320CFLAGS="-Wno-overflow"
1321
1322AC_TRY_COMPILE(
1323[ ],
1324[
1325 return 0;
1326],
1327[
1328AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
1329AC_MSG_RESULT([yes])
1330],
1331[
1332AC_SUBST([FLAG_W_NO_OVERFLOW], [])
1333AC_MSG_RESULT([no])
1334])
1335CFLAGS=$safe_CFLAGS
1336
1337
bartbf9b85c2009-08-12 12:55:56 +00001338# does this compiler support -Wno-uninitialized ?
1339
1340AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1341
1342safe_CFLAGS=$CFLAGS
1343CFLAGS="-Wno-uninitialized"
1344
1345AC_TRY_COMPILE(
1346[ ],
1347[
1348 return 0;
1349],
1350[
1351AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1352AC_MSG_RESULT([yes])
1353],
1354[
1355AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1356AC_MSG_RESULT([no])
1357])
1358CFLAGS=$safe_CFLAGS
1359
1360
bart56730cd2008-05-11 06:41:46 +00001361# does this compiler support -Wextra or the older -W ?
1362
1363AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1364
1365safe_CFLAGS=$CFLAGS
1366CFLAGS="-Wextra"
1367
1368AC_TRY_COMPILE(
1369[ ],
1370[
1371 return 0;
1372],
1373[
1374AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1375AC_MSG_RESULT([-Wextra])
1376], [
1377 CFLAGS="-W"
1378 AC_TRY_COMPILE(
1379 [ ],
1380 [
1381 return 0;
1382 ],
1383 [
1384 AC_SUBST([FLAG_W_EXTRA], [-W])
1385 AC_MSG_RESULT([-W])
1386 ], [
1387 AC_SUBST([FLAG_W_EXTRA], [])
1388 AC_MSG_RESULT([not supported])
1389 ])
1390])
1391CFLAGS=$safe_CFLAGS
1392
1393
sewardja72c26d2007-05-01 13:44:08 +00001394# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001395AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001396
1397safe_CFLAGS=$CFLAGS
1398CFLAGS="-fno-stack-protector"
1399
1400AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001401 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001402],
1403[
1404no_stack_protector=yes
1405FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1406AC_MSG_RESULT([yes])
1407], [
1408no_stack_protector=no
1409FLAG_FNO_STACK_PROTECTOR=""
1410AC_MSG_RESULT([no])
1411])
1412CFLAGS=$safe_CFLAGS
1413
1414AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1415
1416if test x$no_stack_protector = xyes; then
1417 CFLAGS="$CFLAGS -fno-stack-protector"
1418fi
1419
1420
bart56730cd2008-05-11 06:41:46 +00001421# does this compiler support --param inline-unit-growth=... ?
1422
1423AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1424
1425safe_CFLAGS=$CFLAGS
1426CFLAGS="--param inline-unit-growth=900"
1427
1428AC_TRY_COMPILE(
1429[ ],
1430[
1431 return 0;
1432],
1433[
1434AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1435 ["--param inline-unit-growth=900"])
1436AC_MSG_RESULT([yes])
1437], [
1438AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1439AC_MSG_RESULT([no])
1440])
1441CFLAGS=$safe_CFLAGS
1442
1443
sewardjd3645802010-06-13 22:13:58 +00001444# does the linker support -Wl,--build-id=none ? Note, it's
1445# important that we test indirectly via whichever C compiler
1446# is selected, rather than testing /usr/bin/ld or whatever
1447# directly.
bart699fbac2010-06-08 18:23:59 +00001448
sewardjd3645802010-06-13 22:13:58 +00001449AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
bart699fbac2010-06-08 18:23:59 +00001450
1451safe_CFLAGS=$CFLAGS
1452CFLAGS="-Wl,--build-id=none"
1453
bart8508c752010-06-10 06:26:21 +00001454AC_LINK_IFELSE(
1455[AC_LANG_PROGRAM([ ], [return 0;])],
bart699fbac2010-06-08 18:23:59 +00001456[
1457 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1458 AC_MSG_RESULT([yes])
1459], [
1460 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1461 AC_MSG_RESULT([no])
1462])
1463CFLAGS=$safe_CFLAGS
1464
1465
sewardj00f1e622006-03-12 16:47:10 +00001466# does the ppc assembler support "mtocrf" et al?
1467AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1468
1469AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001470__asm__ __volatile__("mtocrf 4,0");
1471__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001472],
1473[
1474ac_have_as_ppc_mftocrf=yes
1475AC_MSG_RESULT([yes])
1476], [
1477ac_have_as_ppc_mftocrf=no
1478AC_MSG_RESULT([no])
1479])
1480if test x$ac_have_as_ppc_mftocrf = xyes ; then
1481 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1482fi
1483
1484
sewardjb5b87402011-03-07 16:05:35 +00001485CFLAGS=$safe_CFLAGS
1486
sewardjf0aabf82007-03-22 00:24:21 +00001487# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001488# Note, this doesn't generate a C-level symbol. It generates a
1489# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001490AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1491
1492AC_TRY_COMPILE(, [
1493 do { long long int x;
1494 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1495 while (0)
1496],
1497[
1498ac_have_as_sse3=yes
1499AC_MSG_RESULT([yes])
1500], [
1501ac_have_as_sse3=no
1502AC_MSG_RESULT([no])
1503])
sewardjfa18a262007-03-22 12:13:13 +00001504
1505AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001506
1507
sewardj6d6da5b2008-02-09 12:07:40 +00001508# Ditto for SSSE3 instructions (note extra S)
1509# Note, this doesn't generate a C-level symbol. It generates a
1510# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1511AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1512
1513AC_TRY_COMPILE(, [
1514 do { long long int x;
1515 __asm__ __volatile__(
1516 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1517 while (0)
1518],
1519[
1520ac_have_as_ssse3=yes
1521AC_MSG_RESULT([yes])
1522], [
1523ac_have_as_ssse3=no
1524AC_MSG_RESULT([no])
1525])
1526
1527AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1528
1529
sewardj27d176a2011-01-17 11:15:48 +00001530# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1531# Note, this doesn't generate a C-level symbol. It generates a
1532# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00001533AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
1534AC_TRY_COMPILE(, [
1535 do {
1536 __asm__ __volatile__(
1537 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1538 while (0)
1539],
1540[
1541ac_have_as_pclmulqdq=yes
1542AC_MSG_RESULT([yes])
1543], [
1544ac_have_as_pclmulqdq=no
1545AC_MSG_RESULT([no])
1546])
1547
1548AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1549
1550
sewardj27d176a2011-01-17 11:15:48 +00001551# does the x86/amd64 assembler understand the LZCNT instruction?
1552# Note, this doesn't generate a C-level symbol. It generates a
1553# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00001554AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1555
1556AC_TRY_COMPILE([], [
1557 do {
1558 __asm__ __volatile__("lzcnt %rax,%rax");
1559 } while (0)
1560],
1561[
1562 ac_have_as_lzcnt=yes
1563 AC_MSG_RESULT([yes])
1564], [
1565 ac_have_as_lzcnt=no
1566 AC_MSG_RESULT([no])
1567])
1568
1569AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1570
sewardj27d176a2011-01-17 11:15:48 +00001571
1572# does the x86/amd64 assembler understand SSE 4.2 instructions?
1573# Note, this doesn't generate a C-level symbol. It generates a
1574# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
1575AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
1576
1577AC_TRY_COMPILE(, [
1578 do { long long int x;
1579 __asm__ __volatile__(
1580 "crc32q %%r15,%%r15" : : : "r15" ); }
1581 while (0)
1582],
1583[
1584ac_have_as_sse42=yes
1585AC_MSG_RESULT([yes])
1586], [
1587ac_have_as_sse42=no
1588AC_MSG_RESULT([no])
1589])
1590
1591AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
1592
1593
sewardje089f012010-10-13 21:47:29 +00001594# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
1595# when building the tool executables. I think we should get rid of it.
1596#
sewardjb5f6f512005-03-10 23:59:00 +00001597# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001598if test "x${cross_compiling}" = "xno"; then
1599# Native compilation: check whether running a program using TLS succeeds.
1600# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1601# succeeds but running programs using TLS fails.
1602AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1603 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1604 [vg_cv_tls=$enableval],
1605 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1606 [[return foo;]])],
1607 [vg_cv_tls=yes],
1608 [vg_cv_tls=no])])])
1609else
1610# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001611AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1612 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1613 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001614 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001615 [[return foo;]])],
1616 [vg_cv_tls=yes],
1617 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001618fi
sewardjb5f6f512005-03-10 23:59:00 +00001619
1620if test "$vg_cv_tls" = yes; then
1621AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1622fi
sewardj5b754b42002-06-03 22:53:35 +00001623
sewardj535c50f2005-06-04 23:14:53 +00001624
njn7fd6d382009-01-22 21:56:32 +00001625#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001626# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001627#----------------------------------------------------------------------------
1628
sewardjde4a1d02002-03-22 01:27:54 +00001629AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001630AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001631 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001632 endian.h \
1633 mqueue.h \
1634 sys/endian.h \
1635 sys/epoll.h \
1636 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001637 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001638 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001639 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001640 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001641 sys/syscall.h \
1642 sys/time.h \
1643 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001644 ])
sewardjde4a1d02002-03-22 01:27:54 +00001645
njn7fd6d382009-01-22 21:56:32 +00001646#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001647# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001648#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001649AC_TYPE_UID_T
1650AC_TYPE_OFF_T
1651AC_TYPE_SIZE_T
1652AC_HEADER_TIME
1653
sewardj535c50f2005-06-04 23:14:53 +00001654
njn7fd6d382009-01-22 21:56:32 +00001655#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001656# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001657#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001658AC_FUNC_MEMCMP
1659AC_FUNC_MMAP
1660AC_TYPE_SIGNAL
1661
bart26288e42011-04-03 16:46:01 +00001662AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00001663AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001664
bartf5ceec82008-04-26 07:45:10 +00001665AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001666 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001667 epoll_create \
1668 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00001669 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001670 mallinfo \
1671 memchr \
1672 memset \
1673 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001674 mremap \
bartf5ceec82008-04-26 07:45:10 +00001675 ppoll \
bart6d45e922009-01-20 13:45:38 +00001676 pthread_barrier_init \
1677 pthread_condattr_setclock \
1678 pthread_mutex_timedlock \
1679 pthread_rwlock_timedrdlock \
1680 pthread_rwlock_timedwrlock \
1681 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001682 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001683 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001684 semtimedop \
1685 signalfd \
njn6cc22472009-03-16 03:46:48 +00001686 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001687 strchr \
1688 strdup \
1689 strpbrk \
1690 strrchr \
1691 strstr \
barta72a27b2010-04-29 06:22:17 +00001692 syscall \
bartf5ceec82008-04-26 07:45:10 +00001693 utimensat \
1694 ])
sewardjde4a1d02002-03-22 01:27:54 +00001695
bart623eec32008-07-29 17:54:49 +00001696# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1697# libraries with any shared object and/or executable. This is NOT what we
1698# want for e.g. vgpreload_core-x86-linux.so
1699LIBS=""
sewardj80637752006-03-02 13:48:21 +00001700
bart6d45e922009-01-20 13:45:38 +00001701AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1702 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001703AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1704 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001705AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1706 [test x$ac_cv_func_pthread_spin_lock = xyes])
1707
njn7fd6d382009-01-22 21:56:32 +00001708
1709#----------------------------------------------------------------------------
1710# MPI checks
1711#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001712# Do we have a useable MPI setup on the primary and/or secondary targets?
1713# On Linux, by default, assumes mpicc and -m32/-m64
1714# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001715# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001716# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1717# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001718MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001719if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1720 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001721 MPI_CC="mpxlc"
1722fi
1723
sewardje9fa5062006-03-12 18:29:18 +00001724mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001725if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1726 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001727 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001728elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00001729 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
1730 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001731 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001732elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001733 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001734elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001735 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001736fi
1737
sewardj03d86f22006-10-17 00:57:24 +00001738mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001739if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1740 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001741 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001742elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001743 mflag_secondary=-q32
1744fi
1745
1746
sewardj0ad46092006-03-02 17:09:16 +00001747AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001748 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001749 MPI_CC=$withval
1750)
sewardj03d86f22006-10-17 00:57:24 +00001751AC_SUBST(MPI_CC)
1752
1753## See if MPI_CC works for the primary target
1754##
1755AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001756saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001757saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001758CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001759CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001760AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001761#include <mpi.h>
1762#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001763],[
1764 int r = MPI_Init(NULL,NULL);
1765 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1766 return r;
1767], [
sewardj03d86f22006-10-17 00:57:24 +00001768ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001769AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001770], [
sewardj03d86f22006-10-17 00:57:24 +00001771ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001772AC_MSG_RESULT([no])
1773])
sewardj0ad46092006-03-02 17:09:16 +00001774CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001775CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001776AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001777
sewardj03d86f22006-10-17 00:57:24 +00001778## See if MPI_CC works for the secondary target. Complication: what if
1779## there is no secondary target? We need this to then fail.
1780## Kludge this by making MPI_CC something which will surely fail in
1781## such a case.
1782##
1783AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1784saved_CC=$CC
1785saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001786if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001787 CC="$MPI_CC this will surely fail"
1788else
1789 CC=$MPI_CC
1790fi
1791CFLAGS=$mflag_secondary
1792AC_TRY_LINK([
1793#include <mpi.h>
1794#include <stdio.h>
1795],[
1796 int r = MPI_Init(NULL,NULL);
1797 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1798 return r;
1799], [
1800ac_have_mpi2_sec=yes
1801AC_MSG_RESULT([yes, $MPI_CC])
1802], [
1803ac_have_mpi2_sec=no
1804AC_MSG_RESULT([no])
1805])
1806CC=$saved_CC
1807CFLAGS=$saved_CFLAGS
1808AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001809
1810
njn7fd6d382009-01-22 21:56:32 +00001811#----------------------------------------------------------------------------
1812# Other library checks
1813#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00001814# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00001815# tests are present because Drd has some regression tests that use
1816# these packages. All regression test programs all compiled only
1817# for the primary target. And so it is important that the configure
1818# checks that follow, use the correct -m32 or -m64 flag for the
1819# primary target (called $mflag_primary). Otherwise, we can end up
1820# in a situation (eg) where, on amd64-linux, the test for Boost checks
1821# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1822# only build (meaning, the primary target is x86-linux), the build
1823# of the regtest programs that use Boost fails, because they are
1824# build as 32-bit (IN THIS EXAMPLE).
1825#
1826# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1827# NEEDED BY THE REGRESSION TEST PROGRAMS.
1828
1829
sewardj493c4ef2008-12-13 16:45:19 +00001830# Check whether the boost library 1.35 or later has been installed.
1831# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1832
1833AC_MSG_CHECKING([for boost])
1834
1835AC_LANG(C++)
1836safe_CXXFLAGS=$CXXFLAGS
1837CXXFLAGS="-lboost_thread-mt $mflag_primary"
1838
bart128fc522011-03-12 10:36:35 +00001839AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001840#include <boost/thread.hpp>
1841static void thread_func(void)
1842{ }
1843int main(int argc, char** argv)
1844{
1845 boost::thread t(thread_func);
1846 return 0;
1847}
bart128fc522011-03-12 10:36:35 +00001848])],
sewardj493c4ef2008-12-13 16:45:19 +00001849[
1850ac_have_boost_1_35=yes
1851AC_SUBST([BOOST_CFLAGS], [])
1852AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1853AC_MSG_RESULT([yes])
1854], [
1855ac_have_boost_1_35=no
1856AC_MSG_RESULT([no])
1857])
1858
1859CXXFLAGS=$safe_CXXFLAGS
1860AC_LANG(C)
1861
1862AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1863
1864
1865# does this compiler support -fopenmp, does it have the include file
1866# <omp.h> and does it have libgomp ?
1867
1868AC_MSG_CHECKING([for OpenMP])
1869
1870safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001871CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001872
bart128fc522011-03-12 10:36:35 +00001873AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001874#include <omp.h>
1875int main(int argc, char** argv)
1876{
1877 omp_set_dynamic(0);
1878 return 0;
1879}
bart128fc522011-03-12 10:36:35 +00001880])],
sewardj493c4ef2008-12-13 16:45:19 +00001881[
1882ac_have_openmp=yes
1883AC_MSG_RESULT([yes])
1884], [
1885ac_have_openmp=no
1886AC_MSG_RESULT([no])
1887])
1888CFLAGS=$safe_CFLAGS
1889
1890AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1891
1892
sewardjc876a2f2009-01-22 22:44:30 +00001893# does this compiler have built-in functions for atomic memory access ?
1894AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1895
1896safe_CFLAGS=$CFLAGS
1897CFLAGS="$mflag_primary"
1898
1899AC_TRY_LINK(,
1900[
1901 int variable = 1;
1902 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1903 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1904],
1905[
bartc82d1372009-05-31 16:21:23 +00001906 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001907 AC_MSG_RESULT([yes])
barte8740422011-03-24 20:27:54 +00001908 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
sewardjc876a2f2009-01-22 22:44:30 +00001909],
1910[
bartc82d1372009-05-31 16:21:23 +00001911 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001912 AC_MSG_RESULT([no])
1913])
1914
1915CFLAGS=$safe_CFLAGS
1916
bartc82d1372009-05-31 16:21:23 +00001917AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1918
barte8740422011-03-24 20:27:54 +00001919# does g++ have built-in functions for atomic memory access ?
1920AC_MSG_CHECKING([if g++ supports __sync_bool_compare_and_swap])
1921
1922safe_CXXFLAGS=$CXXFLAGS
1923CXXFLAGS="$mflag_primary"
1924
1925AC_LANG_PUSH(C++)
1926AC_TRY_LINK(,
1927[
1928 int variable = 1;
1929 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1930 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1931],
1932[
1933 ac_have_builtin_atomic_cxx=yes
1934 AC_MSG_RESULT([yes])
1935 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
1936],
1937[
1938 ac_have_builtin_atomic_cxx=no
1939 AC_MSG_RESULT([no])
1940])
1941AC_LANG_POP(C++)
1942
1943CXXFLAGS=$safe_CXXFLAGS
1944
1945AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00001946
njn7fd6d382009-01-22 21:56:32 +00001947#----------------------------------------------------------------------------
1948# Ok. We're done checking.
1949#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001950
njn8b68b642009-06-24 00:37:09 +00001951# Nb: VEX/Makefile is generated from Makefile.vex.in.
1952AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001953 Makefile
njn8b68b642009-06-24 00:37:09 +00001954 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001955 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001956 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001957 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001958 docs/Makefile
1959 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001960 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001961 perf/Makefile
1962 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00001963 gdbserver_tests/Makefile
njn254d542432002-09-23 16:09:39 +00001964 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001965 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001966 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001967 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001968 memcheck/Makefile
1969 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001970 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001971 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001972 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001973 memcheck/tests/darwin/Makefile
njnea2d6fd2010-07-01 00:20:20 +00001974 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00001975 memcheck/tests/x86-linux/Makefile
sewardj0e342a02010-09-03 23:49:33 +00001976 memcheck/tests/ppc32/Makefile
1977 memcheck/tests/ppc64/Makefile
njn29a5c012009-05-06 06:15:55 +00001978 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001979 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001980 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001981 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00001982 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00001983 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00001984 callgrind/Makefile
1985 callgrind/callgrind_annotate
1986 callgrind/callgrind_control
1987 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001988 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001989 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001990 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001991 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001992 massif/perf/Makefile
njnd5a8d242007-11-02 20:44:57 +00001993 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001994 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001995 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001996 none/Makefile
1997 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001998 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001999 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00002000 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00002001 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00002002 none/tests/arm/Makefile
sewardjb5b87402011-03-07 16:05:35 +00002003 none/tests/s390x/Makefile
njn0458a122009-02-13 06:23:46 +00002004 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00002005 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00002006 none/tests/x86-linux/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00002007 exp-sgcheck/Makefile
2008 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00002009 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00002010 drd/scripts/download-and-build-splash2
2011 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00002012 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00002013 exp-bbv/tests/Makefile
2014 exp-bbv/tests/x86/Makefile
2015 exp-bbv/tests/x86-linux/Makefile
2016 exp-bbv/tests/amd64-linux/Makefile
2017 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00002018 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00002019 exp-dhat/Makefile
2020 exp-dhat/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00002021])
sewardjd3645802010-06-13 22:13:58 +00002022AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
2023 [chmod +x coregrind/link_tool_exe_linux])
2024AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
2025 [chmod +x coregrind/link_tool_exe_darwin])
2026AC_CONFIG_FILES([coregrind/link_tool_exe_aix5],
2027 [chmod +x coregrind/link_tool_exe_aix5])
njn8b68b642009-06-24 00:37:09 +00002028AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00002029
2030cat<<EOF
2031
njn311303f2009-02-06 03:46:50 +00002032 Maximum build arch: ${ARCH_MAX}
2033 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00002034 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00002035 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00002036 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
2037 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00002038 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00002039
gobry3b777892002-04-04 09:18:39 +00002040EOF