blob: 13d75e3a9d059148c6ce900798b5243473abe265 [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
sewardj6e9de462011-06-28 07:25:29 +000085# Comparing two identical files results in 0.
njn31f665e2009-02-26 21:25:50 +000086tmpfile="tmp-xxx-yyy-zzz"
87touch $tmpfile;
88if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000089 AC_MSG_RESULT([yes])
90 DIFF="diff -u"
91else
92 AC_MSG_RESULT([no])
93 DIFF="diff"
94fi
njn31f665e2009-02-26 21:25:50 +000095rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000096
97
sewardj535c50f2005-06-04 23:14:53 +000098# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +000099AC_MSG_CHECKING([for a supported version of gcc])
100
bart07de2c92010-05-29 06:44:28 +0000101[gcc_version=`${CC} --version | head -n 1 | $SED 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +0000102
103case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +0000104 2.*)
gobrye721a522002-03-22 13:38:30 +0000105 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000106 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
107 ;;
gobrye721a522002-03-22 13:38:30 +0000108 *)
109 AC_MSG_RESULT([ok (${gcc_version})])
110 ;;
111esac
112
njn7fd6d382009-01-22 21:56:32 +0000113#----------------------------------------------------------------------------
114# Arch/OS/platform tests.
115#----------------------------------------------------------------------------
116# We create a number of arch/OS/platform-related variables. We prefix them
117# all with "VGCONF_" which indicates that they are defined at
118# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
119# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000120
sewardjde4a1d02002-03-22 01:27:54 +0000121AC_CANONICAL_HOST
122
123AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000124
njn7fd6d382009-01-22 21:56:32 +0000125# ARCH_MAX reflects the most that this CPU can do: for example if it
126# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
127# Ditto for amd64. It is used for more configuration below, but is not used
128# outside this file.
gobrye721a522002-03-22 13:38:30 +0000129case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000130 i?86)
131 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000132 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000133 ;;
134
njnfe408942004-11-23 17:52:24 +0000135 x86_64)
136 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000137 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000138 ;;
139
sewardj2c48c7b2005-11-29 13:05:56 +0000140 powerpc64)
141 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000142 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000143 ;;
144
145 powerpc)
sewardj6e9de462011-06-28 07:25:29 +0000146 # On Linux this means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000147 AC_MSG_RESULT([ok (${host_cpu})])
sewardj6e9de462011-06-28 07:25:29 +0000148 ARCH_MAX="ppc32"
nethercote9bcc9062004-10-13 13:50:01 +0000149 ;;
150
sewardjb5b87402011-03-07 16:05:35 +0000151 s390x)
152 AC_MSG_RESULT([ok (${host_cpu})])
153 ARCH_MAX="s390x"
154 ;;
155
sewardj59570ff2010-01-01 11:59:33 +0000156 armv7*)
157 AC_MSG_RESULT([ok (${host_cpu})])
158 ARCH_MAX="arm"
159 ;;
160
sewardjde4a1d02002-03-22 01:27:54 +0000161 *)
162 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000163 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000164 ;;
165esac
166
njn7fd6d382009-01-22 21:56:32 +0000167#----------------------------------------------------------------------------
168
sewardj86e992f2006-01-28 18:39:09 +0000169# Sometimes it's convenient to subvert the bi-arch build system and
170# just have a single build even though the underlying platform is
171# capable of both. Hence handle --enable-only64bit and
172# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000173# [Actually, if either of these options are used, I think both get built,
174# but only one gets installed. So if you use an in-place build, both can be
175# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000176
177# Check if a 64-bit only build has been requested
178AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
179 [AC_ARG_ENABLE(only64bit,
180 [ --enable-only64bit do a 64-bit only build],
181 [vg_cv_only64bit=$enableval],
182 [vg_cv_only64bit=no])])
183
184# Check if a 32-bit only build has been requested
185AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
186 [AC_ARG_ENABLE(only32bit,
187 [ --enable-only32bit do a 32-bit only build],
188 [vg_cv_only32bit=$enableval],
189 [vg_cv_only32bit=no])])
190
191# Stay sane
192if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
193 AC_MSG_ERROR(
194 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
195fi
196
njn7fd6d382009-01-22 21:56:32 +0000197#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000198
njn311303f2009-02-06 03:46:50 +0000199# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
200# compilation of many C files via -VGO_$(VGCONF_OS) and
201# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000202AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000203AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000204
njnf76d27a2009-05-28 01:53:07 +0000205DEFAULT_SUPP=""
206
gobrye721a522002-03-22 13:38:30 +0000207case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000208 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000209 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000210 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000211
212 # Ok, this is linux. Check the kernel version
213 AC_MSG_CHECKING([for the kernel version])
214
215 kernel=`uname -r`
216
217 case "${kernel}" in
bart0419e512011-06-05 08:51:47 +0000218 2.6.*|3.*)
bart2d6e6e72011-06-05 10:01:48 +0000219 AC_MSG_RESULT([2.6.x/3.x family (${kernel})])
220 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 +0000221 ;;
222
223 2.4.*)
224 AC_MSG_RESULT([2.4 family (${kernel})])
225 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
226 ;;
227
mueller8c68e042004-01-03 15:21:14 +0000228 *)
229 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000230 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000231 ;;
232 esac
233
234 ;;
235
njnf76d27a2009-05-28 01:53:07 +0000236 *darwin*)
237 AC_MSG_RESULT([ok (${host_os})])
238 VGCONF_OS="darwin"
njnea2d6fd2010-07-01 00:20:20 +0000239 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
240 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
241 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
njnf76d27a2009-05-28 01:53:07 +0000242
243 AC_MSG_CHECKING([for the kernel version])
244 kernel=`uname -r`
245
246 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
247 # has only one relevant version, the OS version. The `uname` check
248 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
njnea2d6fd2010-07-01 00:20:20 +0000249 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard),
250 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000251 #
252 # XXX: `uname -r` won't do the right thing for cross-compiles, but
253 # that's not a problem yet.
254 case "${kernel}" in
255 9.*)
256 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000257 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000258 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000259 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000260 ;;
njnea2d6fd2010-07-01 00:20:20 +0000261 10.*)
262 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
263 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
264 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
265 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
266 ;;
njnf76d27a2009-05-28 01:53:07 +0000267 *)
268 AC_MSG_RESULT([unsupported (${kernel})])
njnea2d6fd2010-07-01 00:20:20 +0000269 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 +0000270 ;;
271 esac
272 ;;
273
sewardjde4a1d02002-03-22 01:27:54 +0000274 *)
275 AC_MSG_RESULT([no (${host_os})])
njncc58cea2010-07-05 07:21:22 +0000276 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
sewardjde4a1d02002-03-22 01:27:54 +0000277 ;;
278esac
279
njn7fd6d382009-01-22 21:56:32 +0000280#----------------------------------------------------------------------------
281
tomd6398392006-06-07 17:44:36 +0000282# If we are building on a 64 bit platform test to see if the system
283# supports building 32 bit programs and disable 32 bit support if it
284# does not support building 32 bit programs
285
njn7fd6d382009-01-22 21:56:32 +0000286case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000287 amd64-linux|ppc64-linux)
288 AC_MSG_CHECKING([for 32 bit build support])
289 safe_CFLAGS=$CFLAGS
290 CFLAGS="-m32"
291 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000292 return 0;
tomd6398392006-06-07 17:44:36 +0000293 ],
294 [
295 AC_MSG_RESULT([yes])
296 ], [
297 vg_cv_only64bit="yes"
298 AC_MSG_RESULT([no])
299 ])
300 CFLAGS=$safe_CFLAGS;;
301esac
302
303if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
304 AC_MSG_ERROR(
305 [--enable-only32bit was specified but system does not support 32 bit builds])
306fi
nethercote888ecb72004-08-23 14:54:40 +0000307
njn7fd6d382009-01-22 21:56:32 +0000308#----------------------------------------------------------------------------
309
njn311303f2009-02-06 03:46:50 +0000310# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
311# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
312# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
313# above) will be "amd64" since that reflects the most that this cpu can do,
314# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
315# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000316# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
317# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
318AC_SUBST(VGCONF_ARCH_PRI)
319
njn3f8a6e92009-06-02 00:20:47 +0000320# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
321# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
322# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
323# It is empty if there is no secondary target.
324AC_SUBST(VGCONF_ARCH_SEC)
325
njn311303f2009-02-06 03:46:50 +0000326# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
327# The entire system, including regression and performance tests, will be
328# built for this target. The "_CAPS" indicates that the name is in capital
329# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000330# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000331# convention and cannot contain '-' characters. This is in contrast to
332# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000333AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
334
335# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
336# Valgrind and tools will also be built for this target, but not the
337# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000338#
njn7fd6d382009-01-22 21:56:32 +0000339# By default, the primary arch is the same as the "max" arch, as commented
340# above (at the definition of ARCH_MAX). We may choose to downgrade it in
341# the big case statement just below here, in the case where we're building
342# on a 64 bit machine but have been requested only to do a 32 bit build.
343AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
344
sewardj01262142006-01-04 01:20:28 +0000345AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000346
njnea2d6fd2010-07-01 00:20:20 +0000347# NB. The load address for a given platform may be specified in more
348# than one place, in some cases, depending on whether we're doing a biarch,
349# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
350# Be careful to give consistent values in all subcases. Also, all four
351# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
352# even if it is to "0xUNSET".
353#
njn7fd6d382009-01-22 21:56:32 +0000354case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000355 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000356 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000357 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000358 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
359 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000360 valt_load_address_pri_norml="0x38000000"
361 valt_load_address_pri_inner="0x28000000"
362 valt_load_address_sec_norml="0xUNSET"
363 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000364 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000365 ;;
366 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000367 valt_load_address_sec_norml="0xUNSET"
368 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000369 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000370 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000371 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000372 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
373 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000374 valt_load_address_pri_norml="0x38000000"
375 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000376 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000377 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000378 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000379 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
380 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000381 valt_load_address_pri_norml="0x38000000"
382 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000383 else
njn7fd6d382009-01-22 21:56:32 +0000384 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000385 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000386 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
387 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000388 valt_load_address_pri_norml="0x38000000"
389 valt_load_address_pri_inner="0x28000000"
390 valt_load_address_sec_norml="0x38000000"
391 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000392 fi
njn377c43f2009-05-19 07:39:22 +0000393 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000394 ;;
395 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000396 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000397 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000398 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
399 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000400 valt_load_address_pri_norml="0x38000000"
401 valt_load_address_pri_inner="0x28000000"
402 valt_load_address_sec_norml="0xUNSET"
403 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000404 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000405 ;;
406 ppc64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000407 valt_load_address_sec_norml="0xUNSET"
408 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000409 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000410 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000411 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000412 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
413 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000414 valt_load_address_pri_norml="0x38000000"
415 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000416 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000417 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000418 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000419 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
420 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000421 valt_load_address_pri_norml="0x38000000"
422 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000423 else
njn7fd6d382009-01-22 21:56:32 +0000424 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000425 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000426 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
427 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000428 valt_load_address_pri_norml="0x38000000"
429 valt_load_address_pri_inner="0x28000000"
430 valt_load_address_sec_norml="0x38000000"
431 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000432 fi
njn377c43f2009-05-19 07:39:22 +0000433 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000434 ;;
njncc58cea2010-07-05 07:21:22 +0000435 # Darwin gets identified as 32-bit even when it supports 64-bit.
436 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
437 # all Macs support both 32-bit and 64-bit, so we just build both. If
438 # someone has a really old 32-bit only machine they can (hopefully?)
439 # build with --enable-only32bit. See bug 243362.
440 x86-darwin|amd64-darwin)
441 ARCH_MAX="amd64"
njnea2d6fd2010-07-01 00:20:20 +0000442 valt_load_address_sec_norml="0xUNSET"
443 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000444 if test x$vg_cv_only64bit = xyes; then
445 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000446 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000447 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
448 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000449 valt_load_address_pri_norml="0x138000000"
450 valt_load_address_pri_inner="0x128000000"
njnf76d27a2009-05-28 01:53:07 +0000451 elif test x$vg_cv_only32bit = xyes; then
452 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000453 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000454 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
455 VGCONF_PLATFORM_SEC_CAPS=""
456 VGCONF_ARCH_PRI_CAPS="x86"
njnea2d6fd2010-07-01 00:20:20 +0000457 valt_load_address_pri_norml="0x38000000"
458 valt_load_address_pri_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000459 else
460 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000461 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000462 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
463 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
njnea2d6fd2010-07-01 00:20:20 +0000464 valt_load_address_pri_norml="0x138000000"
465 valt_load_address_pri_inner="0x128000000"
466 valt_load_address_sec_norml="0x38000000"
467 valt_load_address_sec_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000468 fi
njnf76d27a2009-05-28 01:53:07 +0000469 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
470 ;;
sewardj59570ff2010-01-01 11:59:33 +0000471 arm-linux)
472 VGCONF_ARCH_PRI="arm"
473 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
474 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000475 valt_load_address_pri_norml="0x38000000"
476 valt_load_address_pri_inner="0x28000000"
477 valt_load_address_sec_norml="0xUNSET"
478 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000479 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
480 ;;
sewardjb5b87402011-03-07 16:05:35 +0000481 s390x-linux)
482 VGCONF_ARCH_PRI="s390x"
483 VGCONF_ARCH_SEC=""
484 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
485 VGCONF_PLATFORM_SEC_CAPS=""
486 # we want to have the generated code close to the dispatcher
487 valt_load_address_pri_norml="0x401000000"
488 valt_load_address_pri_inner="0x410000000"
489 valt_load_address_sec_norml="0xUNSET"
490 valt_load_address_sec_inner="0xUNSET"
491 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
492 ;;
nethercote888ecb72004-08-23 14:54:40 +0000493 *)
njn7fd6d382009-01-22 21:56:32 +0000494 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000495 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000496 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
497 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000498 valt_load_address_pri_norml="0xUNSET"
499 valt_load_address_pri_inner="0xUNSET"
500 valt_load_address_sec_norml="0xUNSET"
501 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000502 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000503 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000504 ;;
505esac
sewardjde4a1d02002-03-22 01:27:54 +0000506
njn7fd6d382009-01-22 21:56:32 +0000507#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000508
njn7fd6d382009-01-22 21:56:32 +0000509# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
510# defined.
511AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
512 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000513 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
514 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
515 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000516AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000517 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
518 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000519AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
520 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj6e9de462011-06-28 07:25:29 +0000521 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000522AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
sewardj6e9de462011-06-28 07:25:29 +0000523 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX )
sewardj59570ff2010-01-01 11:59:33 +0000524AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
525 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardjb5b87402011-03-07 16:05:35 +0000526AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
527 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000528
njn7fd6d382009-01-22 21:56:32 +0000529# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
530# become defined.
531AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
532 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
533 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
534AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
535 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
536AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
537 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
538 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
539AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
540 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000541AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
542 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
sewardjb5b87402011-03-07 16:05:35 +0000543AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
544 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
545 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000546
njnf76d27a2009-05-28 01:53:07 +0000547AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
548 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
549 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
550AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
551 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
552
553
sewardj72a2d802010-07-29 05:24:20 +0000554# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000555# Relies on the assumption that the primary and secondary targets are
556# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000557AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
558 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
559 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
560 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000561 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +0000562 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
563 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000564AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
565 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
566 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000567
568
njn7fd6d382009-01-22 21:56:32 +0000569# Sometimes, in the Makefile.am files, it's useful to know whether or not
570# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000571AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000572 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000573
tomb637bad2005-11-08 12:28:35 +0000574
njn7fd6d382009-01-22 21:56:32 +0000575#----------------------------------------------------------------------------
576# Inner Valgrind?
577#----------------------------------------------------------------------------
578
njnd74b0ef2009-01-20 06:06:52 +0000579# Check if this should be built as an inner Valgrind, to be run within
580# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000581AC_SUBST(VALT_LOAD_ADDRESS_PRI)
582AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000583AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
584 [AC_ARG_ENABLE(inner,
585 [ --enable-inner enables self-hosting],
586 [vg_cv_inner=$enableval],
587 [vg_cv_inner=no])])
588if test "$vg_cv_inner" = yes; then
589 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000590 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
591 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000592else
njnea2d6fd2010-07-01 00:20:20 +0000593 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
594 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000595fi
596
597
njn7fd6d382009-01-22 21:56:32 +0000598#----------------------------------------------------------------------------
599# Libc and suppressions
600#----------------------------------------------------------------------------
601# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000602AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000603
bart12e91122010-05-15 08:37:24 +0000604AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000605
bart12e91122010-05-15 08:37:24 +0000606if test x$ac_cv_header_features_h = xyes; then
607 rm -f conftest.$ac_ext
608 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000609#include <features.h>
bart12e91122010-05-15 08:37:24 +0000610#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
611glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000612#endif
bart12e91122010-05-15 08:37:24 +0000613_ACEOF
614 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
615fi
bartb7c3f082010-05-13 06:32:36 +0000616
njnf76d27a2009-05-28 01:53:07 +0000617# not really a version check
618AC_EGREP_CPP([DARWIN_LIBC], [
619#include <sys/cdefs.h>
620#if defined(__DARWIN_VERS_1050)
621 DARWIN_LIBC
622#endif
623],
624GLIBC_VERSION="darwin")
625
dirk07596a22008-04-25 11:33:30 +0000626AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000627
dirk07596a22008-04-25 11:33:30 +0000628case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000629 2.2)
630 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000631 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000632 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
633 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000634 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000635 ;;
636
sewardj08c7f012002-10-07 23:56:55 +0000637 2.3)
638 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000639 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000640 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000641 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000642 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000643 ;;
644
njn781dba52005-06-30 04:06:38 +0000645 2.4)
646 AC_MSG_RESULT(2.4 family)
647 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000648 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000649 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000650 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000651 ;;
652
dirkaece45c2006-10-12 08:17:49 +0000653 2.5)
654 AC_MSG_RESULT(2.5 family)
655 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000656 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000657 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000658 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000659 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000660 2.6)
661 AC_MSG_RESULT(2.6 family)
662 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000663 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000664 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000665 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000666 ;;
667 2.7)
668 AC_MSG_RESULT(2.7 family)
669 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000670 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000671 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000672 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000673 ;;
dirk07596a22008-04-25 11:33:30 +0000674 2.8)
675 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000676 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000677 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
678 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
679 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
680 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000681 2.9)
682 AC_MSG_RESULT(2.9 family)
683 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
684 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
685 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
686 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
687 ;;
sewardj5d425e82009-02-01 19:01:11 +0000688 2.10)
689 AC_MSG_RESULT(2.10 family)
690 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
691 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
692 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
693 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
694 ;;
bart0fac7ff2009-11-15 19:11:19 +0000695 2.11)
696 AC_MSG_RESULT(2.11 family)
697 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
698 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
699 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
700 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000701 ;;
702 2.12)
703 AC_MSG_RESULT(2.12 family)
704 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
705 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
706 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
707 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000708 ;;
tomebd619b2011-02-10 09:09:09 +0000709 2.13)
710 AC_MSG_RESULT(2.13 family)
711 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
712 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
713 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
714 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
715 ;;
tomcc077412011-06-07 21:52:26 +0000716 2.14)
717 AC_MSG_RESULT(2.14 family)
718 AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x])
719 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
720 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
721 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
722 ;;
njnf76d27a2009-05-28 01:53:07 +0000723 darwin)
724 AC_MSG_RESULT(Darwin)
725 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
726 # DEFAULT_SUPP set by kernel version check above.
727 ;;
dirkaece45c2006-10-12 08:17:49 +0000728
sewardjde4a1d02002-03-22 01:27:54 +0000729 *)
bart12e91122010-05-15 08:37:24 +0000730 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
tomcc077412011-06-07 21:52:26 +0000731 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.14])
njnf76d27a2009-05-28 01:53:07 +0000732 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000733 ;;
734esac
735
dirk07596a22008-04-25 11:33:30 +0000736AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000737
sewardj414f3582008-07-18 20:46:00 +0000738
739# Add default suppressions for the X client libraries. Make no
740# attempt to detect whether such libraries are installed on the
741# build machine (or even if any X facilities are present); just
742# add the suppressions antidisirregardless.
743DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
744DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000745
sewardjd2f95a02011-05-11 16:04:28 +0000746# Add glibc and X11 suppressions for exp-sgcheck
747DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
sewardj5744c022008-10-19 18:58:13 +0000748
sewardj2e10a682003-04-07 19:36:41 +0000749
njn7fd6d382009-01-22 21:56:32 +0000750#----------------------------------------------------------------------------
751# Checking for various library functions and other definitions
752#----------------------------------------------------------------------------
753
bart59e2f182008-04-28 16:22:53 +0000754# Check for CLOCK_MONOTONIC
755
756AC_MSG_CHECKING([for CLOCK_MONOTONIC])
757
758AC_TRY_COMPILE(
759[
760#include <time.h>
761], [
762 struct timespec t;
763 clock_gettime(CLOCK_MONOTONIC, &t);
764 return 0;
765],
766[
767AC_MSG_RESULT([yes])
768AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
769 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
770], [
771AC_MSG_RESULT([no])
772])
773
bartfea06922008-05-03 09:12:15 +0000774
775# Check for PTHREAD_MUTEX_ADAPTIVE_NP
776
777AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
778
779AC_TRY_COMPILE(
780[
781#define _GNU_SOURCE
782#include <pthread.h>
783], [
784 return (PTHREAD_MUTEX_ADAPTIVE_NP);
785],
786[
787AC_MSG_RESULT([yes])
788AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
789 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
790], [
791AC_MSG_RESULT([no])
792])
793
794
795# Check for PTHREAD_MUTEX_ERRORCHECK_NP
796
797AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
798
799AC_TRY_COMPILE(
800[
801#define _GNU_SOURCE
802#include <pthread.h>
803], [
804 return (PTHREAD_MUTEX_ERRORCHECK_NP);
805],
806[
807AC_MSG_RESULT([yes])
808AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
809 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
810], [
811AC_MSG_RESULT([no])
812])
813
814
815# Check for PTHREAD_MUTEX_RECURSIVE_NP
816
817AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
818
819AC_TRY_COMPILE(
820[
821#define _GNU_SOURCE
822#include <pthread.h>
823], [
824 return (PTHREAD_MUTEX_RECURSIVE_NP);
825],
826[
827AC_MSG_RESULT([yes])
828AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
829 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
830], [
831AC_MSG_RESULT([no])
832])
833
834
835# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
836
837AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
838
839AC_TRY_COMPILE(
840[
841#define _GNU_SOURCE
842#include <pthread.h>
843], [
844 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
845 return 0;
846],
847[
848AC_MSG_RESULT([yes])
849AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
850 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
851], [
852AC_MSG_RESULT([no])
853])
854
855
bart5e389f12008-04-05 12:53:15 +0000856# Check whether pthread_mutex_t has a member called __m_kind.
857
bartb11355c2010-04-29 16:37:26 +0000858AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
859 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
860 1,
861 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
862 ],
863 [],
864 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000865
866
867# Check whether pthread_mutex_t has a member called __data.__kind.
868
bartb11355c2010-04-29 16:37:26 +0000869AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
870 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
871 1,
872 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
873 ],
874 [],
875 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000876
877
bart62c370e2008-05-12 18:50:51 +0000878# does this compiler support -maltivec and does it have the include file
879# <altivec.h> ?
880
881AC_MSG_CHECKING([for Altivec])
882
883safe_CFLAGS=$CFLAGS
884CFLAGS="-maltivec"
885
886AC_TRY_COMPILE(
887[
888#include <altivec.h>
889], [
890 vector unsigned int v;
891],
892[
893ac_have_altivec=yes
894AC_MSG_RESULT([yes])
sewardjf9fe6022010-09-03 14:36:50 +0000895AC_DEFINE([HAS_ALTIVEC], 1,
sewardj6467a152010-09-03 14:02:22 +0000896 [Define to 1 if gcc/as can do Altivec.])
bart62c370e2008-05-12 18:50:51 +0000897], [
898ac_have_altivec=no
899AC_MSG_RESULT([no])
900])
901CFLAGS=$safe_CFLAGS
902
sewardj0e342a02010-09-03 23:49:33 +0000903AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
bart62c370e2008-05-12 18:50:51 +0000904
905
sewardjf34eb492011-04-15 11:57:05 +0000906# Check that both: the compiler supports -mvsx and that the assembler
907# understands VSX instructions. If either of those doesn't work,
908# conclude that we can't do VSX. NOTE: basically this is a kludge
909# in that it conflates two things that should be separate -- whether
910# the compiler understands the flag vs whether the assembler
911# understands the opcodes. This really ought to be cleaned up
912# and done properly, like it is for x86/x86_64.
913
914AC_MSG_CHECKING([for VSX])
915
916safe_CFLAGS=$CFLAGS
917CFLAGS="-mvsx"
918
919AC_TRY_COMPILE(
920[
921#include <altivec.h>
922], [
923 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +0000924 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
sewardjf34eb492011-04-15 11:57:05 +0000925],
926[
927ac_have_vsx=yes
928AC_MSG_RESULT([yes])
929], [
930ac_have_vsx=no
931AC_MSG_RESULT([no])
932])
933CFLAGS=$safe_CFLAGS
934
935AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
936
937
bart36dd85a2009-04-26 07:11:48 +0000938# Check for pthread_create@GLIBC2.0
939AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
940
bart16e1c5a2009-04-26 07:38:53 +0000941safe_CFLAGS=$CFLAGS
942CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000943AC_TRY_LINK(
944[
945extern int pthread_create_glibc_2_0(void*, const void*,
946 void *(*)(void*), void*);
947__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
948], [
bart276ed3a2009-05-10 15:41:45 +0000949#ifdef __powerpc__
950/*
951 * Apparently on PowerPC linking this program succeeds and generates an
952 * executable with the undefined symbol pthread_create@GLIBC_2.0.
953 */
954#error This test does not work properly on PowerPC.
955#else
bart16e1c5a2009-04-26 07:38:53 +0000956 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000957#endif
bart16e1c5a2009-04-26 07:38:53 +0000958 return 0;
bart36dd85a2009-04-26 07:11:48 +0000959],
960[
961ac_have_pthread_create_glibc_2_0=yes
962AC_MSG_RESULT([yes])
963AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
964 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
965], [
966ac_have_pthread_create_glibc_2_0=no
967AC_MSG_RESULT([no])
968])
bart16e1c5a2009-04-26 07:38:53 +0000969CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000970
971AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000972 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000973
974
barta50aa8a2008-04-27 06:06:57 +0000975# Check for eventfd_t, eventfd() and eventfd_read()
976AC_MSG_CHECKING([for eventfd()])
977
978AC_TRY_LINK(
979[
980#include <sys/eventfd.h>
981], [
982 eventfd_t ev;
983 int fd;
984
985 fd = eventfd(5, 0);
986 eventfd_read(fd, &ev);
987 return 0;
988],
989[
990AC_MSG_RESULT([yes])
991AC_DEFINE([HAVE_EVENTFD], 1,
992 [Define to 1 if you have the `eventfd' function.])
993AC_DEFINE([HAVE_EVENTFD_READ], 1,
994 [Define to 1 if you have the `eventfd_read' function.])
995], [
996AC_MSG_RESULT([no])
997])
998
999
njn7fd6d382009-01-22 21:56:32 +00001000#----------------------------------------------------------------------------
1001# Checking for supported compiler flags.
1002#----------------------------------------------------------------------------
1003
sewardj535c50f2005-06-04 23:14:53 +00001004# does this compiler support -m32 ?
1005AC_MSG_CHECKING([if gcc accepts -m32])
1006
1007safe_CFLAGS=$CFLAGS
1008CFLAGS="-m32"
1009
1010AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001011 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001012],
1013[
1014FLAG_M32="-m32"
1015AC_MSG_RESULT([yes])
1016], [
1017FLAG_M32=""
1018AC_MSG_RESULT([no])
1019])
1020CFLAGS=$safe_CFLAGS
1021
1022AC_SUBST(FLAG_M32)
1023
1024
sewardj01262142006-01-04 01:20:28 +00001025# does this compiler support -m64 ?
1026AC_MSG_CHECKING([if gcc accepts -m64])
1027
1028safe_CFLAGS=$CFLAGS
1029CFLAGS="-m64"
1030
1031AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001032 return 0;
sewardj01262142006-01-04 01:20:28 +00001033],
1034[
1035FLAG_M64="-m64"
1036AC_MSG_RESULT([yes])
1037], [
1038FLAG_M64=""
1039AC_MSG_RESULT([no])
1040])
1041CFLAGS=$safe_CFLAGS
1042
1043AC_SUBST(FLAG_M64)
1044
1045
sewardj67f1fcc2005-07-03 10:41:02 +00001046# does this compiler support -mmmx ?
1047AC_MSG_CHECKING([if gcc accepts -mmmx])
1048
1049safe_CFLAGS=$CFLAGS
1050CFLAGS="-mmmx"
1051
1052AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001053 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001054],
1055[
1056FLAG_MMMX="-mmmx"
1057AC_MSG_RESULT([yes])
1058], [
1059FLAG_MMMX=""
1060AC_MSG_RESULT([no])
1061])
1062CFLAGS=$safe_CFLAGS
1063
1064AC_SUBST(FLAG_MMMX)
1065
1066
1067# does this compiler support -msse ?
1068AC_MSG_CHECKING([if gcc accepts -msse])
1069
1070safe_CFLAGS=$CFLAGS
1071CFLAGS="-msse"
1072
1073AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001074 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001075],
1076[
1077FLAG_MSSE="-msse"
1078AC_MSG_RESULT([yes])
1079], [
1080FLAG_MSSE=""
1081AC_MSG_RESULT([no])
1082])
1083CFLAGS=$safe_CFLAGS
1084
1085AC_SUBST(FLAG_MSSE)
1086
1087
sewardj5b754b42002-06-03 22:53:35 +00001088# does this compiler support -mpreferred-stack-boundary=2 ?
1089AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1090
daywalker3664f562003-10-17 13:43:46 +00001091safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001092CFLAGS="-mpreferred-stack-boundary=2"
1093
1094AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001095 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001096],
1097[
1098PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001099AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001100], [
1101PREFERRED_STACK_BOUNDARY=""
1102AC_MSG_RESULT([no])
1103])
daywalker3664f562003-10-17 13:43:46 +00001104CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001105
1106AC_SUBST(PREFERRED_STACK_BOUNDARY)
1107
sewardj535c50f2005-06-04 23:14:53 +00001108
sewardjb5f6f512005-03-10 23:59:00 +00001109# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001110AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001111
1112safe_CFLAGS=$CFLAGS
1113CFLAGS="-Wno-pointer-sign"
1114
1115AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001116 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001117],
1118[
1119no_pointer_sign=yes
1120AC_MSG_RESULT([yes])
1121], [
1122no_pointer_sign=no
1123AC_MSG_RESULT([no])
1124])
1125CFLAGS=$safe_CFLAGS
1126
1127if test x$no_pointer_sign = xyes; then
1128 CFLAGS="$CFLAGS -Wno-pointer-sign"
1129fi
1130
sewardj535c50f2005-06-04 23:14:53 +00001131
barte026bd22009-07-04 12:17:07 +00001132# does this compiler support -Wno-empty-body ?
1133
1134AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1135
1136safe_CFLAGS=$CFLAGS
1137CFLAGS="-Wno-empty-body"
1138
1139AC_TRY_COMPILE(
1140[ ],
1141[
1142 return 0;
1143],
1144[
1145AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1146AC_MSG_RESULT([yes])
1147],
1148[
1149AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1150AC_MSG_RESULT([no])
1151])
1152CFLAGS=$safe_CFLAGS
1153
1154
bart9d865fa2008-06-23 12:11:49 +00001155# does this compiler support -Wno-format-zero-length ?
1156
1157AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1158
1159safe_CFLAGS=$CFLAGS
1160CFLAGS="-Wno-format-zero-length"
1161
1162AC_TRY_COMPILE(
1163[ ],
1164[
1165 return 0;
1166],
1167[
1168AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1169AC_MSG_RESULT([yes])
1170],
1171[
1172AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1173AC_MSG_RESULT([no])
1174])
1175CFLAGS=$safe_CFLAGS
1176
1177
bart8e216312011-05-15 17:05:36 +00001178# does this compiler support -Wno-nonnull ?
1179
1180AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
1181
1182safe_CFLAGS=$CFLAGS
1183CFLAGS="-Wno-nonnull"
1184
1185AC_TRY_COMPILE(
1186[ ],
1187[
1188 return 0;
1189],
1190[
1191AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
1192AC_MSG_RESULT([yes])
1193],
1194[
1195AC_SUBST([FLAG_W_NO_NONNULL], [])
1196AC_MSG_RESULT([no])
1197])
1198CFLAGS=$safe_CFLAGS
1199
1200
1201# does this compiler support -Wno-overflow ?
1202
1203AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
1204
1205safe_CFLAGS=$CFLAGS
1206CFLAGS="-Wno-overflow"
1207
1208AC_TRY_COMPILE(
1209[ ],
1210[
1211 return 0;
1212],
1213[
1214AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
1215AC_MSG_RESULT([yes])
1216],
1217[
1218AC_SUBST([FLAG_W_NO_OVERFLOW], [])
1219AC_MSG_RESULT([no])
1220])
1221CFLAGS=$safe_CFLAGS
1222
1223
bartbf9b85c2009-08-12 12:55:56 +00001224# does this compiler support -Wno-uninitialized ?
1225
1226AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1227
1228safe_CFLAGS=$CFLAGS
1229CFLAGS="-Wno-uninitialized"
1230
1231AC_TRY_COMPILE(
1232[ ],
1233[
1234 return 0;
1235],
1236[
1237AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1238AC_MSG_RESULT([yes])
1239],
1240[
1241AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1242AC_MSG_RESULT([no])
1243])
1244CFLAGS=$safe_CFLAGS
1245
1246
bart56730cd2008-05-11 06:41:46 +00001247# does this compiler support -Wextra or the older -W ?
1248
1249AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1250
1251safe_CFLAGS=$CFLAGS
1252CFLAGS="-Wextra"
1253
1254AC_TRY_COMPILE(
1255[ ],
1256[
1257 return 0;
1258],
1259[
1260AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1261AC_MSG_RESULT([-Wextra])
1262], [
1263 CFLAGS="-W"
1264 AC_TRY_COMPILE(
1265 [ ],
1266 [
1267 return 0;
1268 ],
1269 [
1270 AC_SUBST([FLAG_W_EXTRA], [-W])
1271 AC_MSG_RESULT([-W])
1272 ], [
1273 AC_SUBST([FLAG_W_EXTRA], [])
1274 AC_MSG_RESULT([not supported])
1275 ])
1276])
1277CFLAGS=$safe_CFLAGS
1278
1279
sewardja72c26d2007-05-01 13:44:08 +00001280# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001281AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001282
1283safe_CFLAGS=$CFLAGS
1284CFLAGS="-fno-stack-protector"
1285
1286AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001287 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001288],
1289[
1290no_stack_protector=yes
1291FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1292AC_MSG_RESULT([yes])
1293], [
1294no_stack_protector=no
1295FLAG_FNO_STACK_PROTECTOR=""
1296AC_MSG_RESULT([no])
1297])
1298CFLAGS=$safe_CFLAGS
1299
1300AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1301
1302if test x$no_stack_protector = xyes; then
1303 CFLAGS="$CFLAGS -fno-stack-protector"
1304fi
1305
1306
bart56730cd2008-05-11 06:41:46 +00001307# does this compiler support --param inline-unit-growth=... ?
1308
1309AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1310
1311safe_CFLAGS=$CFLAGS
1312CFLAGS="--param inline-unit-growth=900"
1313
1314AC_TRY_COMPILE(
1315[ ],
1316[
1317 return 0;
1318],
1319[
1320AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1321 ["--param inline-unit-growth=900"])
1322AC_MSG_RESULT([yes])
1323], [
1324AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1325AC_MSG_RESULT([no])
1326])
1327CFLAGS=$safe_CFLAGS
1328
1329
sewardjd3645802010-06-13 22:13:58 +00001330# does the linker support -Wl,--build-id=none ? Note, it's
1331# important that we test indirectly via whichever C compiler
1332# is selected, rather than testing /usr/bin/ld or whatever
1333# directly.
bart699fbac2010-06-08 18:23:59 +00001334
sewardjd3645802010-06-13 22:13:58 +00001335AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
bart699fbac2010-06-08 18:23:59 +00001336
1337safe_CFLAGS=$CFLAGS
1338CFLAGS="-Wl,--build-id=none"
1339
bart8508c752010-06-10 06:26:21 +00001340AC_LINK_IFELSE(
1341[AC_LANG_PROGRAM([ ], [return 0;])],
bart699fbac2010-06-08 18:23:59 +00001342[
1343 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1344 AC_MSG_RESULT([yes])
1345], [
1346 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1347 AC_MSG_RESULT([no])
1348])
1349CFLAGS=$safe_CFLAGS
1350
1351
sewardj00f1e622006-03-12 16:47:10 +00001352# does the ppc assembler support "mtocrf" et al?
1353AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1354
1355AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001356__asm__ __volatile__("mtocrf 4,0");
1357__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001358],
1359[
1360ac_have_as_ppc_mftocrf=yes
1361AC_MSG_RESULT([yes])
1362], [
1363ac_have_as_ppc_mftocrf=no
1364AC_MSG_RESULT([no])
1365])
1366if test x$ac_have_as_ppc_mftocrf = xyes ; then
1367 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1368fi
1369
1370
sewardjb5b87402011-03-07 16:05:35 +00001371CFLAGS=$safe_CFLAGS
1372
sewardjf0aabf82007-03-22 00:24:21 +00001373# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001374# Note, this doesn't generate a C-level symbol. It generates a
1375# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001376AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1377
1378AC_TRY_COMPILE(, [
1379 do { long long int x;
1380 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1381 while (0)
1382],
1383[
1384ac_have_as_sse3=yes
1385AC_MSG_RESULT([yes])
1386], [
1387ac_have_as_sse3=no
1388AC_MSG_RESULT([no])
1389])
sewardjfa18a262007-03-22 12:13:13 +00001390
1391AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001392
1393
sewardj6d6da5b2008-02-09 12:07:40 +00001394# Ditto for SSSE3 instructions (note extra S)
1395# Note, this doesn't generate a C-level symbol. It generates a
1396# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1397AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1398
1399AC_TRY_COMPILE(, [
1400 do { long long int x;
1401 __asm__ __volatile__(
1402 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1403 while (0)
1404],
1405[
1406ac_have_as_ssse3=yes
1407AC_MSG_RESULT([yes])
1408], [
1409ac_have_as_ssse3=no
1410AC_MSG_RESULT([no])
1411])
1412
1413AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1414
1415
sewardj27d176a2011-01-17 11:15:48 +00001416# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1417# Note, this doesn't generate a C-level symbol. It generates a
1418# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00001419AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
1420AC_TRY_COMPILE(, [
1421 do {
1422 __asm__ __volatile__(
1423 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1424 while (0)
1425],
1426[
1427ac_have_as_pclmulqdq=yes
1428AC_MSG_RESULT([yes])
1429], [
1430ac_have_as_pclmulqdq=no
1431AC_MSG_RESULT([no])
1432])
1433
1434AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1435
1436
sewardj27d176a2011-01-17 11:15:48 +00001437# does the x86/amd64 assembler understand the LZCNT instruction?
1438# Note, this doesn't generate a C-level symbol. It generates a
1439# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00001440AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1441
1442AC_TRY_COMPILE([], [
1443 do {
1444 __asm__ __volatile__("lzcnt %rax,%rax");
1445 } while (0)
1446],
1447[
1448 ac_have_as_lzcnt=yes
1449 AC_MSG_RESULT([yes])
1450], [
1451 ac_have_as_lzcnt=no
1452 AC_MSG_RESULT([no])
1453])
1454
1455AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1456
sewardj27d176a2011-01-17 11:15:48 +00001457
1458# does the x86/amd64 assembler understand SSE 4.2 instructions?
1459# Note, this doesn't generate a C-level symbol. It generates a
1460# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
1461AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
1462
1463AC_TRY_COMPILE(, [
1464 do { long long int x;
1465 __asm__ __volatile__(
1466 "crc32q %%r15,%%r15" : : : "r15" ); }
1467 while (0)
1468],
1469[
1470ac_have_as_sse42=yes
1471AC_MSG_RESULT([yes])
1472], [
1473ac_have_as_sse42=no
1474AC_MSG_RESULT([no])
1475])
1476
1477AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
1478
1479
sewardje089f012010-10-13 21:47:29 +00001480# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
1481# when building the tool executables. I think we should get rid of it.
1482#
sewardjb5f6f512005-03-10 23:59:00 +00001483# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001484if test "x${cross_compiling}" = "xno"; then
1485# Native compilation: check whether running a program using TLS succeeds.
1486# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1487# succeeds but running programs using TLS fails.
1488AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1489 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1490 [vg_cv_tls=$enableval],
1491 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1492 [[return foo;]])],
1493 [vg_cv_tls=yes],
1494 [vg_cv_tls=no])])])
1495else
1496# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001497AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1498 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1499 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001500 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001501 [[return foo;]])],
1502 [vg_cv_tls=yes],
1503 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001504fi
sewardjb5f6f512005-03-10 23:59:00 +00001505
1506if test "$vg_cv_tls" = yes; then
1507AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1508fi
sewardj5b754b42002-06-03 22:53:35 +00001509
sewardj535c50f2005-06-04 23:14:53 +00001510
njn7fd6d382009-01-22 21:56:32 +00001511#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001512# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001513#----------------------------------------------------------------------------
1514
sewardjde4a1d02002-03-22 01:27:54 +00001515AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001516AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001517 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001518 endian.h \
1519 mqueue.h \
1520 sys/endian.h \
1521 sys/epoll.h \
1522 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001523 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001524 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001525 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001526 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001527 sys/syscall.h \
1528 sys/time.h \
1529 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001530 ])
sewardjde4a1d02002-03-22 01:27:54 +00001531
njn7fd6d382009-01-22 21:56:32 +00001532#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001533# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001534#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001535AC_TYPE_UID_T
1536AC_TYPE_OFF_T
1537AC_TYPE_SIZE_T
1538AC_HEADER_TIME
1539
sewardj535c50f2005-06-04 23:14:53 +00001540
njn7fd6d382009-01-22 21:56:32 +00001541#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001542# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001543#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001544AC_FUNC_MEMCMP
1545AC_FUNC_MMAP
1546AC_TYPE_SIGNAL
1547
bart26288e42011-04-03 16:46:01 +00001548AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00001549AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001550
bartf5ceec82008-04-26 07:45:10 +00001551AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001552 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001553 epoll_create \
1554 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00001555 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001556 mallinfo \
1557 memchr \
1558 memset \
1559 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001560 mremap \
bartf5ceec82008-04-26 07:45:10 +00001561 ppoll \
bart6d45e922009-01-20 13:45:38 +00001562 pthread_barrier_init \
1563 pthread_condattr_setclock \
1564 pthread_mutex_timedlock \
1565 pthread_rwlock_timedrdlock \
1566 pthread_rwlock_timedwrlock \
1567 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001568 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001569 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001570 semtimedop \
1571 signalfd \
njn6cc22472009-03-16 03:46:48 +00001572 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001573 strchr \
1574 strdup \
1575 strpbrk \
1576 strrchr \
1577 strstr \
barta72a27b2010-04-29 06:22:17 +00001578 syscall \
bartf5ceec82008-04-26 07:45:10 +00001579 utimensat \
1580 ])
sewardjde4a1d02002-03-22 01:27:54 +00001581
bart623eec32008-07-29 17:54:49 +00001582# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1583# libraries with any shared object and/or executable. This is NOT what we
1584# want for e.g. vgpreload_core-x86-linux.so
1585LIBS=""
sewardj80637752006-03-02 13:48:21 +00001586
bart6d45e922009-01-20 13:45:38 +00001587AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1588 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001589AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1590 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001591AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1592 [test x$ac_cv_func_pthread_spin_lock = xyes])
1593
njn7fd6d382009-01-22 21:56:32 +00001594
1595#----------------------------------------------------------------------------
1596# MPI checks
1597#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001598# Do we have a useable MPI setup on the primary and/or secondary targets?
1599# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00001600# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00001601# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00001602# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001603MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00001604
sewardje9fa5062006-03-12 18:29:18 +00001605mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001606if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00001607 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1608 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001609 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001610elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00001611 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
1612 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001613 mflag_primary=$FLAG_M64
1614fi
1615
sewardj03d86f22006-10-17 00:57:24 +00001616mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001617if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1618 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001619 mflag_secondary=$FLAG_M32
sewardj03d86f22006-10-17 00:57:24 +00001620fi
1621
1622
sewardj0ad46092006-03-02 17:09:16 +00001623AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001624 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001625 MPI_CC=$withval
1626)
sewardj03d86f22006-10-17 00:57:24 +00001627AC_SUBST(MPI_CC)
1628
1629## See if MPI_CC works for the primary target
1630##
1631AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001632saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001633saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001634CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001635CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001636AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001637#include <mpi.h>
1638#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001639],[
1640 int r = MPI_Init(NULL,NULL);
1641 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1642 return r;
1643], [
sewardj03d86f22006-10-17 00:57:24 +00001644ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001645AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001646], [
sewardj03d86f22006-10-17 00:57:24 +00001647ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001648AC_MSG_RESULT([no])
1649])
sewardj0ad46092006-03-02 17:09:16 +00001650CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001651CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001652AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001653
sewardj03d86f22006-10-17 00:57:24 +00001654## See if MPI_CC works for the secondary target. Complication: what if
1655## there is no secondary target? We need this to then fail.
1656## Kludge this by making MPI_CC something which will surely fail in
1657## such a case.
1658##
1659AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1660saved_CC=$CC
1661saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001662if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001663 CC="$MPI_CC this will surely fail"
1664else
1665 CC=$MPI_CC
1666fi
1667CFLAGS=$mflag_secondary
1668AC_TRY_LINK([
1669#include <mpi.h>
1670#include <stdio.h>
1671],[
1672 int r = MPI_Init(NULL,NULL);
1673 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1674 return r;
1675], [
1676ac_have_mpi2_sec=yes
1677AC_MSG_RESULT([yes, $MPI_CC])
1678], [
1679ac_have_mpi2_sec=no
1680AC_MSG_RESULT([no])
1681])
1682CC=$saved_CC
1683CFLAGS=$saved_CFLAGS
1684AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001685
1686
njn7fd6d382009-01-22 21:56:32 +00001687#----------------------------------------------------------------------------
1688# Other library checks
1689#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00001690# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00001691# tests are present because Drd has some regression tests that use
1692# these packages. All regression test programs all compiled only
1693# for the primary target. And so it is important that the configure
1694# checks that follow, use the correct -m32 or -m64 flag for the
1695# primary target (called $mflag_primary). Otherwise, we can end up
1696# in a situation (eg) where, on amd64-linux, the test for Boost checks
1697# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1698# only build (meaning, the primary target is x86-linux), the build
1699# of the regtest programs that use Boost fails, because they are
1700# build as 32-bit (IN THIS EXAMPLE).
1701#
1702# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1703# NEEDED BY THE REGRESSION TEST PROGRAMS.
1704
1705
sewardj493c4ef2008-12-13 16:45:19 +00001706# Check whether the boost library 1.35 or later has been installed.
1707# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1708
1709AC_MSG_CHECKING([for boost])
1710
1711AC_LANG(C++)
1712safe_CXXFLAGS=$CXXFLAGS
1713CXXFLAGS="-lboost_thread-mt $mflag_primary"
1714
bart128fc522011-03-12 10:36:35 +00001715AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001716#include <boost/thread.hpp>
1717static void thread_func(void)
1718{ }
1719int main(int argc, char** argv)
1720{
1721 boost::thread t(thread_func);
1722 return 0;
1723}
bart128fc522011-03-12 10:36:35 +00001724])],
sewardj493c4ef2008-12-13 16:45:19 +00001725[
1726ac_have_boost_1_35=yes
1727AC_SUBST([BOOST_CFLAGS], [])
1728AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1729AC_MSG_RESULT([yes])
1730], [
1731ac_have_boost_1_35=no
1732AC_MSG_RESULT([no])
1733])
1734
1735CXXFLAGS=$safe_CXXFLAGS
1736AC_LANG(C)
1737
1738AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1739
1740
1741# does this compiler support -fopenmp, does it have the include file
1742# <omp.h> and does it have libgomp ?
1743
1744AC_MSG_CHECKING([for OpenMP])
1745
1746safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001747CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001748
bart128fc522011-03-12 10:36:35 +00001749AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001750#include <omp.h>
1751int main(int argc, char** argv)
1752{
1753 omp_set_dynamic(0);
1754 return 0;
1755}
bart128fc522011-03-12 10:36:35 +00001756])],
sewardj493c4ef2008-12-13 16:45:19 +00001757[
1758ac_have_openmp=yes
1759AC_MSG_RESULT([yes])
1760], [
1761ac_have_openmp=no
1762AC_MSG_RESULT([no])
1763])
1764CFLAGS=$safe_CFLAGS
1765
1766AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1767
1768
sewardjc876a2f2009-01-22 22:44:30 +00001769# does this compiler have built-in functions for atomic memory access ?
1770AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1771
1772safe_CFLAGS=$CFLAGS
1773CFLAGS="$mflag_primary"
1774
1775AC_TRY_LINK(,
1776[
1777 int variable = 1;
1778 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1779 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1780],
1781[
bartc82d1372009-05-31 16:21:23 +00001782 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001783 AC_MSG_RESULT([yes])
barte8740422011-03-24 20:27:54 +00001784 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 +00001785],
1786[
bartc82d1372009-05-31 16:21:23 +00001787 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001788 AC_MSG_RESULT([no])
1789])
1790
1791CFLAGS=$safe_CFLAGS
1792
bartc82d1372009-05-31 16:21:23 +00001793AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1794
barte8740422011-03-24 20:27:54 +00001795# does g++ have built-in functions for atomic memory access ?
1796AC_MSG_CHECKING([if g++ supports __sync_bool_compare_and_swap])
1797
1798safe_CXXFLAGS=$CXXFLAGS
1799CXXFLAGS="$mflag_primary"
1800
1801AC_LANG_PUSH(C++)
1802AC_TRY_LINK(,
1803[
1804 int variable = 1;
1805 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1806 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1807],
1808[
1809 ac_have_builtin_atomic_cxx=yes
1810 AC_MSG_RESULT([yes])
1811 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
1812],
1813[
1814 ac_have_builtin_atomic_cxx=no
1815 AC_MSG_RESULT([no])
1816])
1817AC_LANG_POP(C++)
1818
1819CXXFLAGS=$safe_CXXFLAGS
1820
1821AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00001822
njn7fd6d382009-01-22 21:56:32 +00001823#----------------------------------------------------------------------------
1824# Ok. We're done checking.
1825#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001826
njn8b68b642009-06-24 00:37:09 +00001827# Nb: VEX/Makefile is generated from Makefile.vex.in.
1828AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001829 Makefile
njn8b68b642009-06-24 00:37:09 +00001830 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001831 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001832 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001833 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001834 docs/Makefile
1835 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001836 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001837 perf/Makefile
1838 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00001839 gdbserver_tests/Makefile
njn254d542432002-09-23 16:09:39 +00001840 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001841 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001842 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001843 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001844 memcheck/Makefile
1845 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001846 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001847 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001848 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001849 memcheck/tests/darwin/Makefile
njnea2d6fd2010-07-01 00:20:20 +00001850 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00001851 memcheck/tests/x86-linux/Makefile
sewardj0e342a02010-09-03 23:49:33 +00001852 memcheck/tests/ppc32/Makefile
1853 memcheck/tests/ppc64/Makefile
njn29a5c012009-05-06 06:15:55 +00001854 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001855 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001856 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001857 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00001858 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00001859 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00001860 callgrind/Makefile
1861 callgrind/callgrind_annotate
1862 callgrind/callgrind_control
1863 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001864 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001865 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001866 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001867 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001868 massif/perf/Makefile
njnd5a8d242007-11-02 20:44:57 +00001869 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001870 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001871 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001872 none/Makefile
1873 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001874 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001875 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001876 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001877 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00001878 none/tests/arm/Makefile
sewardjb5b87402011-03-07 16:05:35 +00001879 none/tests/s390x/Makefile
njn0458a122009-02-13 06:23:46 +00001880 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001881 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001882 none/tests/x86-linux/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00001883 exp-sgcheck/Makefile
1884 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00001885 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00001886 drd/scripts/download-and-build-splash2
1887 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001888 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00001889 exp-bbv/tests/Makefile
1890 exp-bbv/tests/x86/Makefile
1891 exp-bbv/tests/x86-linux/Makefile
1892 exp-bbv/tests/amd64-linux/Makefile
1893 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00001894 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00001895 exp-dhat/Makefile
1896 exp-dhat/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00001897])
sewardjd3645802010-06-13 22:13:58 +00001898AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
1899 [chmod +x coregrind/link_tool_exe_linux])
1900AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
1901 [chmod +x coregrind/link_tool_exe_darwin])
njn8b68b642009-06-24 00:37:09 +00001902AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001903
1904cat<<EOF
1905
njn311303f2009-02-06 03:46:50 +00001906 Maximum build arch: ${ARCH_MAX}
1907 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001908 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001909 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001910 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1911 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001912 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001913
gobry3b777892002-04-04 09:18:39 +00001914EOF