blob: 8f2242319dcbf7a97b07a358b151c545fcaadbf0 [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#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000599# Extra fine-tuning of installation directories
600#----------------------------------------------------------------------------
601AC_ARG_WITH(tmpdir,
602 [ --with-tmpdir=PATH Specify path for temporary files],
603 tmpdir="$withval",
604 tmpdir="/tmp")
605AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
606
607#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000608# Libc and suppressions
609#----------------------------------------------------------------------------
610# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000611AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000612
bart12e91122010-05-15 08:37:24 +0000613AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000614
bart12e91122010-05-15 08:37:24 +0000615if test x$ac_cv_header_features_h = xyes; then
616 rm -f conftest.$ac_ext
617 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000618#include <features.h>
bart12e91122010-05-15 08:37:24 +0000619#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
620glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000621#endif
bart12e91122010-05-15 08:37:24 +0000622_ACEOF
623 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
624fi
bartb7c3f082010-05-13 06:32:36 +0000625
njnf76d27a2009-05-28 01:53:07 +0000626# not really a version check
627AC_EGREP_CPP([DARWIN_LIBC], [
628#include <sys/cdefs.h>
629#if defined(__DARWIN_VERS_1050)
630 DARWIN_LIBC
631#endif
632],
633GLIBC_VERSION="darwin")
634
sewardjcb495c82011-07-11 20:42:34 +0000635# not really a version check
636AC_EGREP_CPP([BIONIC_LIBC], [
637#if defined(__ANDROID__)
638 BIONIC_LIBC
639#endif
640],
641GLIBC_VERSION="bionic")
642
643
dirk07596a22008-04-25 11:33:30 +0000644AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000645
dirk07596a22008-04-25 11:33:30 +0000646case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000647 2.2)
648 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000649 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000650 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
651 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000652 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000653 ;;
654
sewardj08c7f012002-10-07 23:56:55 +0000655 2.3)
656 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000657 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000658 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000659 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000660 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000661 ;;
662
njn781dba52005-06-30 04:06:38 +0000663 2.4)
664 AC_MSG_RESULT(2.4 family)
665 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000666 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000667 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000668 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000669 ;;
670
dirkaece45c2006-10-12 08:17:49 +0000671 2.5)
672 AC_MSG_RESULT(2.5 family)
673 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000674 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000675 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000676 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000677 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000678 2.6)
679 AC_MSG_RESULT(2.6 family)
680 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000681 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000682 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000683 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000684 ;;
685 2.7)
686 AC_MSG_RESULT(2.7 family)
687 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000688 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000689 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000690 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000691 ;;
dirk07596a22008-04-25 11:33:30 +0000692 2.8)
693 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000694 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000695 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
696 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
697 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
698 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000699 2.9)
700 AC_MSG_RESULT(2.9 family)
701 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
702 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
703 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
704 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
705 ;;
sewardj5d425e82009-02-01 19:01:11 +0000706 2.10)
707 AC_MSG_RESULT(2.10 family)
708 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
709 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
710 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
711 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
712 ;;
bart0fac7ff2009-11-15 19:11:19 +0000713 2.11)
714 AC_MSG_RESULT(2.11 family)
715 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
716 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
717 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
718 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000719 ;;
720 2.12)
721 AC_MSG_RESULT(2.12 family)
722 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
723 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
724 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
725 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000726 ;;
tomebd619b2011-02-10 09:09:09 +0000727 2.13)
728 AC_MSG_RESULT(2.13 family)
729 AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
730 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
731 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
732 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
733 ;;
tomcc077412011-06-07 21:52:26 +0000734 2.14)
735 AC_MSG_RESULT(2.14 family)
736 AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x])
737 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
738 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
739 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
740 ;;
njnf76d27a2009-05-28 01:53:07 +0000741 darwin)
742 AC_MSG_RESULT(Darwin)
743 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
744 # DEFAULT_SUPP set by kernel version check above.
745 ;;
sewardjcb495c82011-07-11 20:42:34 +0000746 bionic)
747 AC_MSG_RESULT(Bionic)
748 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
749 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
750 ;;
dirkaece45c2006-10-12 08:17:49 +0000751
sewardjde4a1d02002-03-22 01:27:54 +0000752 *)
bart12e91122010-05-15 08:37:24 +0000753 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
tomcc077412011-06-07 21:52:26 +0000754 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.14])
njnf76d27a2009-05-28 01:53:07 +0000755 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000756 ;;
757esac
758
dirk07596a22008-04-25 11:33:30 +0000759AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000760
sewardj414f3582008-07-18 20:46:00 +0000761
762# Add default suppressions for the X client libraries. Make no
763# attempt to detect whether such libraries are installed on the
764# build machine (or even if any X facilities are present); just
765# add the suppressions antidisirregardless.
766DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
767DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000768
sewardjd2f95a02011-05-11 16:04:28 +0000769# Add glibc and X11 suppressions for exp-sgcheck
770DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
sewardj5744c022008-10-19 18:58:13 +0000771
sewardj2e10a682003-04-07 19:36:41 +0000772
njn7fd6d382009-01-22 21:56:32 +0000773#----------------------------------------------------------------------------
sewardjcb495c82011-07-11 20:42:34 +0000774# Platform variants?
775#----------------------------------------------------------------------------
776
777# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
778# But there are times where we need a bit more control. The motivating
779# and currently only case is Android: this is almost identical to arm-linux,
780# but not quite. So this introduces the concept of platform variant tags,
781# which get passed in the compile as -DVGPV_<arch>_<os>_<variant> along
782# with the main -DVGP_<arch>_<os> definition.
783#
784# In almost all cases, the <variant> bit is "vanilla". But for Android
785# it is "android" instead.
786#
787# Consequently (eg), plain arm-linux would build with
788#
789# -DVGP_arm_linux -DVGPV_arm_linux_vanilla
790#
791# whilst an Android build would have
792#
793# -DVGP_arm_linux -DVGPV_arm_linux_android
794#
795# The setup of the platform variant is pushed relatively far down this
796# file in order that we can inspect any of the variables set above.
797
798# In the normal case ..
799VGCONF_PLATVARIANT="vanilla"
800
801# Android on ARM ?
802if test "$VGCONF_ARCH_PRI-$VGCONF_OS" = "arm-linux" \
803 -a "$GLIBC_VERSION" = "bionic";
804then
805 VGCONF_PLATVARIANT="android"
806fi
807
808AC_SUBST(VGCONF_PLATVARIANT)
809
810
811# FIXME: do we also want to define automake variables
812# VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
813# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
814# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
815# do that. Problem is that we can't do and-ing in Makefile.am's, but
816# that's what we'd need to do to use this, since what we'd want to write
817# is something like
818#
819# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
820#
821# Oh well, something to figure out properly later on.
822
823
824#----------------------------------------------------------------------------
njn7fd6d382009-01-22 21:56:32 +0000825# Checking for various library functions and other definitions
826#----------------------------------------------------------------------------
827
bart59e2f182008-04-28 16:22:53 +0000828# Check for CLOCK_MONOTONIC
829
830AC_MSG_CHECKING([for CLOCK_MONOTONIC])
831
832AC_TRY_COMPILE(
833[
834#include <time.h>
835], [
836 struct timespec t;
837 clock_gettime(CLOCK_MONOTONIC, &t);
838 return 0;
839],
840[
841AC_MSG_RESULT([yes])
842AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
843 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
844], [
845AC_MSG_RESULT([no])
846])
847
bartfea06922008-05-03 09:12:15 +0000848
849# Check for PTHREAD_MUTEX_ADAPTIVE_NP
850
851AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
852
853AC_TRY_COMPILE(
854[
855#define _GNU_SOURCE
856#include <pthread.h>
857], [
858 return (PTHREAD_MUTEX_ADAPTIVE_NP);
859],
860[
861AC_MSG_RESULT([yes])
862AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
863 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
864], [
865AC_MSG_RESULT([no])
866])
867
868
869# Check for PTHREAD_MUTEX_ERRORCHECK_NP
870
871AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
872
873AC_TRY_COMPILE(
874[
875#define _GNU_SOURCE
876#include <pthread.h>
877], [
878 return (PTHREAD_MUTEX_ERRORCHECK_NP);
879],
880[
881AC_MSG_RESULT([yes])
882AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
883 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
884], [
885AC_MSG_RESULT([no])
886])
887
888
889# Check for PTHREAD_MUTEX_RECURSIVE_NP
890
891AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
892
893AC_TRY_COMPILE(
894[
895#define _GNU_SOURCE
896#include <pthread.h>
897], [
898 return (PTHREAD_MUTEX_RECURSIVE_NP);
899],
900[
901AC_MSG_RESULT([yes])
902AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
903 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
904], [
905AC_MSG_RESULT([no])
906])
907
908
909# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
910
911AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
912
913AC_TRY_COMPILE(
914[
915#define _GNU_SOURCE
916#include <pthread.h>
917], [
918 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
919 return 0;
920],
921[
922AC_MSG_RESULT([yes])
923AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
924 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
925], [
926AC_MSG_RESULT([no])
927])
928
929
bart5e389f12008-04-05 12:53:15 +0000930# Check whether pthread_mutex_t has a member called __m_kind.
931
bartb11355c2010-04-29 16:37:26 +0000932AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
933 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
934 1,
935 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
936 ],
937 [],
938 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000939
940
941# Check whether pthread_mutex_t has a member called __data.__kind.
942
bartb11355c2010-04-29 16:37:26 +0000943AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
944 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
945 1,
946 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
947 ],
948 [],
949 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000950
951
bart62c370e2008-05-12 18:50:51 +0000952# does this compiler support -maltivec and does it have the include file
953# <altivec.h> ?
954
955AC_MSG_CHECKING([for Altivec])
956
957safe_CFLAGS=$CFLAGS
958CFLAGS="-maltivec"
959
960AC_TRY_COMPILE(
961[
962#include <altivec.h>
963], [
964 vector unsigned int v;
965],
966[
967ac_have_altivec=yes
968AC_MSG_RESULT([yes])
sewardjf9fe6022010-09-03 14:36:50 +0000969AC_DEFINE([HAS_ALTIVEC], 1,
sewardj6467a152010-09-03 14:02:22 +0000970 [Define to 1 if gcc/as can do Altivec.])
bart62c370e2008-05-12 18:50:51 +0000971], [
972ac_have_altivec=no
973AC_MSG_RESULT([no])
974])
975CFLAGS=$safe_CFLAGS
976
sewardj0e342a02010-09-03 23:49:33 +0000977AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
bart62c370e2008-05-12 18:50:51 +0000978
979
sewardjf34eb492011-04-15 11:57:05 +0000980# Check that both: the compiler supports -mvsx and that the assembler
981# understands VSX instructions. If either of those doesn't work,
982# conclude that we can't do VSX. NOTE: basically this is a kludge
983# in that it conflates two things that should be separate -- whether
984# the compiler understands the flag vs whether the assembler
985# understands the opcodes. This really ought to be cleaned up
986# and done properly, like it is for x86/x86_64.
987
988AC_MSG_CHECKING([for VSX])
989
990safe_CFLAGS=$CFLAGS
991CFLAGS="-mvsx"
992
993AC_TRY_COMPILE(
994[
995#include <altivec.h>
996], [
997 vector unsigned int v;
sewardj9b80ebb2011-04-15 21:16:00 +0000998 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
sewardjf34eb492011-04-15 11:57:05 +0000999],
1000[
1001ac_have_vsx=yes
1002AC_MSG_RESULT([yes])
1003], [
1004ac_have_vsx=no
1005AC_MSG_RESULT([no])
1006])
1007CFLAGS=$safe_CFLAGS
1008
1009AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1010
1011
bart36dd85a2009-04-26 07:11:48 +00001012# Check for pthread_create@GLIBC2.0
1013AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1014
bart16e1c5a2009-04-26 07:38:53 +00001015safe_CFLAGS=$CFLAGS
1016CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +00001017AC_TRY_LINK(
1018[
1019extern int pthread_create_glibc_2_0(void*, const void*,
1020 void *(*)(void*), void*);
1021__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1022], [
bart276ed3a2009-05-10 15:41:45 +00001023#ifdef __powerpc__
1024/*
1025 * Apparently on PowerPC linking this program succeeds and generates an
1026 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1027 */
1028#error This test does not work properly on PowerPC.
1029#else
bart16e1c5a2009-04-26 07:38:53 +00001030 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +00001031#endif
bart16e1c5a2009-04-26 07:38:53 +00001032 return 0;
bart36dd85a2009-04-26 07:11:48 +00001033],
1034[
1035ac_have_pthread_create_glibc_2_0=yes
1036AC_MSG_RESULT([yes])
1037AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1038 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1039], [
1040ac_have_pthread_create_glibc_2_0=no
1041AC_MSG_RESULT([no])
1042])
bart16e1c5a2009-04-26 07:38:53 +00001043CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +00001044
1045AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +00001046 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +00001047
1048
barta50aa8a2008-04-27 06:06:57 +00001049# Check for eventfd_t, eventfd() and eventfd_read()
1050AC_MSG_CHECKING([for eventfd()])
1051
1052AC_TRY_LINK(
1053[
1054#include <sys/eventfd.h>
1055], [
1056 eventfd_t ev;
1057 int fd;
1058
1059 fd = eventfd(5, 0);
1060 eventfd_read(fd, &ev);
1061 return 0;
1062],
1063[
1064AC_MSG_RESULT([yes])
1065AC_DEFINE([HAVE_EVENTFD], 1,
1066 [Define to 1 if you have the `eventfd' function.])
1067AC_DEFINE([HAVE_EVENTFD_READ], 1,
1068 [Define to 1 if you have the `eventfd_read' function.])
1069], [
1070AC_MSG_RESULT([no])
1071])
1072
1073
njn7fd6d382009-01-22 21:56:32 +00001074#----------------------------------------------------------------------------
1075# Checking for supported compiler flags.
1076#----------------------------------------------------------------------------
1077
sewardj535c50f2005-06-04 23:14:53 +00001078# does this compiler support -m32 ?
1079AC_MSG_CHECKING([if gcc accepts -m32])
1080
1081safe_CFLAGS=$CFLAGS
1082CFLAGS="-m32"
1083
1084AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001085 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001086],
1087[
1088FLAG_M32="-m32"
1089AC_MSG_RESULT([yes])
1090], [
1091FLAG_M32=""
1092AC_MSG_RESULT([no])
1093])
1094CFLAGS=$safe_CFLAGS
1095
1096AC_SUBST(FLAG_M32)
1097
1098
sewardj01262142006-01-04 01:20:28 +00001099# does this compiler support -m64 ?
1100AC_MSG_CHECKING([if gcc accepts -m64])
1101
1102safe_CFLAGS=$CFLAGS
1103CFLAGS="-m64"
1104
1105AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001106 return 0;
sewardj01262142006-01-04 01:20:28 +00001107],
1108[
1109FLAG_M64="-m64"
1110AC_MSG_RESULT([yes])
1111], [
1112FLAG_M64=""
1113AC_MSG_RESULT([no])
1114])
1115CFLAGS=$safe_CFLAGS
1116
1117AC_SUBST(FLAG_M64)
1118
1119
sewardj67f1fcc2005-07-03 10:41:02 +00001120# does this compiler support -mmmx ?
1121AC_MSG_CHECKING([if gcc accepts -mmmx])
1122
1123safe_CFLAGS=$CFLAGS
1124CFLAGS="-mmmx"
1125
1126AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001127 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001128],
1129[
1130FLAG_MMMX="-mmmx"
1131AC_MSG_RESULT([yes])
1132], [
1133FLAG_MMMX=""
1134AC_MSG_RESULT([no])
1135])
1136CFLAGS=$safe_CFLAGS
1137
1138AC_SUBST(FLAG_MMMX)
1139
1140
1141# does this compiler support -msse ?
1142AC_MSG_CHECKING([if gcc accepts -msse])
1143
1144safe_CFLAGS=$CFLAGS
1145CFLAGS="-msse"
1146
1147AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001148 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001149],
1150[
1151FLAG_MSSE="-msse"
1152AC_MSG_RESULT([yes])
1153], [
1154FLAG_MSSE=""
1155AC_MSG_RESULT([no])
1156])
1157CFLAGS=$safe_CFLAGS
1158
1159AC_SUBST(FLAG_MSSE)
1160
1161
sewardj5b754b42002-06-03 22:53:35 +00001162# does this compiler support -mpreferred-stack-boundary=2 ?
1163AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1164
daywalker3664f562003-10-17 13:43:46 +00001165safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001166CFLAGS="-mpreferred-stack-boundary=2"
1167
1168AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001169 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001170],
1171[
1172PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001173AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001174], [
1175PREFERRED_STACK_BOUNDARY=""
1176AC_MSG_RESULT([no])
1177])
daywalker3664f562003-10-17 13:43:46 +00001178CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001179
1180AC_SUBST(PREFERRED_STACK_BOUNDARY)
1181
sewardj535c50f2005-06-04 23:14:53 +00001182
sewardjb5f6f512005-03-10 23:59:00 +00001183# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001184AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001185
1186safe_CFLAGS=$CFLAGS
1187CFLAGS="-Wno-pointer-sign"
1188
1189AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001190 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001191],
1192[
1193no_pointer_sign=yes
1194AC_MSG_RESULT([yes])
1195], [
1196no_pointer_sign=no
1197AC_MSG_RESULT([no])
1198])
1199CFLAGS=$safe_CFLAGS
1200
1201if test x$no_pointer_sign = xyes; then
1202 CFLAGS="$CFLAGS -Wno-pointer-sign"
1203fi
1204
sewardj535c50f2005-06-04 23:14:53 +00001205
barte026bd22009-07-04 12:17:07 +00001206# does this compiler support -Wno-empty-body ?
1207
1208AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1209
1210safe_CFLAGS=$CFLAGS
1211CFLAGS="-Wno-empty-body"
1212
1213AC_TRY_COMPILE(
1214[ ],
1215[
1216 return 0;
1217],
1218[
1219AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1220AC_MSG_RESULT([yes])
1221],
1222[
1223AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1224AC_MSG_RESULT([no])
1225])
1226CFLAGS=$safe_CFLAGS
1227
1228
bart9d865fa2008-06-23 12:11:49 +00001229# does this compiler support -Wno-format-zero-length ?
1230
1231AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1232
1233safe_CFLAGS=$CFLAGS
1234CFLAGS="-Wno-format-zero-length"
1235
1236AC_TRY_COMPILE(
1237[ ],
1238[
1239 return 0;
1240],
1241[
1242AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1243AC_MSG_RESULT([yes])
1244],
1245[
1246AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1247AC_MSG_RESULT([no])
1248])
1249CFLAGS=$safe_CFLAGS
1250
1251
bart8e216312011-05-15 17:05:36 +00001252# does this compiler support -Wno-nonnull ?
1253
1254AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
1255
1256safe_CFLAGS=$CFLAGS
1257CFLAGS="-Wno-nonnull"
1258
1259AC_TRY_COMPILE(
1260[ ],
1261[
1262 return 0;
1263],
1264[
1265AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
1266AC_MSG_RESULT([yes])
1267],
1268[
1269AC_SUBST([FLAG_W_NO_NONNULL], [])
1270AC_MSG_RESULT([no])
1271])
1272CFLAGS=$safe_CFLAGS
1273
1274
1275# does this compiler support -Wno-overflow ?
1276
1277AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
1278
1279safe_CFLAGS=$CFLAGS
1280CFLAGS="-Wno-overflow"
1281
1282AC_TRY_COMPILE(
1283[ ],
1284[
1285 return 0;
1286],
1287[
1288AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
1289AC_MSG_RESULT([yes])
1290],
1291[
1292AC_SUBST([FLAG_W_NO_OVERFLOW], [])
1293AC_MSG_RESULT([no])
1294])
1295CFLAGS=$safe_CFLAGS
1296
1297
bartbf9b85c2009-08-12 12:55:56 +00001298# does this compiler support -Wno-uninitialized ?
1299
1300AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1301
1302safe_CFLAGS=$CFLAGS
1303CFLAGS="-Wno-uninitialized"
1304
1305AC_TRY_COMPILE(
1306[ ],
1307[
1308 return 0;
1309],
1310[
1311AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1312AC_MSG_RESULT([yes])
1313],
1314[
1315AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1316AC_MSG_RESULT([no])
1317])
1318CFLAGS=$safe_CFLAGS
1319
1320
bart56730cd2008-05-11 06:41:46 +00001321# does this compiler support -Wextra or the older -W ?
1322
1323AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1324
1325safe_CFLAGS=$CFLAGS
1326CFLAGS="-Wextra"
1327
1328AC_TRY_COMPILE(
1329[ ],
1330[
1331 return 0;
1332],
1333[
1334AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1335AC_MSG_RESULT([-Wextra])
1336], [
1337 CFLAGS="-W"
1338 AC_TRY_COMPILE(
1339 [ ],
1340 [
1341 return 0;
1342 ],
1343 [
1344 AC_SUBST([FLAG_W_EXTRA], [-W])
1345 AC_MSG_RESULT([-W])
1346 ], [
1347 AC_SUBST([FLAG_W_EXTRA], [])
1348 AC_MSG_RESULT([not supported])
1349 ])
1350])
1351CFLAGS=$safe_CFLAGS
1352
1353
sewardja72c26d2007-05-01 13:44:08 +00001354# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001355AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001356
1357safe_CFLAGS=$CFLAGS
1358CFLAGS="-fno-stack-protector"
1359
1360AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001361 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001362],
1363[
1364no_stack_protector=yes
1365FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1366AC_MSG_RESULT([yes])
1367], [
1368no_stack_protector=no
1369FLAG_FNO_STACK_PROTECTOR=""
1370AC_MSG_RESULT([no])
1371])
1372CFLAGS=$safe_CFLAGS
1373
1374AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1375
1376if test x$no_stack_protector = xyes; then
1377 CFLAGS="$CFLAGS -fno-stack-protector"
1378fi
1379
1380
bart56730cd2008-05-11 06:41:46 +00001381# does this compiler support --param inline-unit-growth=... ?
1382
1383AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1384
1385safe_CFLAGS=$CFLAGS
1386CFLAGS="--param inline-unit-growth=900"
1387
1388AC_TRY_COMPILE(
1389[ ],
1390[
1391 return 0;
1392],
1393[
1394AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1395 ["--param inline-unit-growth=900"])
1396AC_MSG_RESULT([yes])
1397], [
1398AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1399AC_MSG_RESULT([no])
1400])
1401CFLAGS=$safe_CFLAGS
1402
1403
sewardjd3645802010-06-13 22:13:58 +00001404# does the linker support -Wl,--build-id=none ? Note, it's
1405# important that we test indirectly via whichever C compiler
1406# is selected, rather than testing /usr/bin/ld or whatever
1407# directly.
bart699fbac2010-06-08 18:23:59 +00001408
sewardjd3645802010-06-13 22:13:58 +00001409AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
bart699fbac2010-06-08 18:23:59 +00001410
1411safe_CFLAGS=$CFLAGS
1412CFLAGS="-Wl,--build-id=none"
1413
bart8508c752010-06-10 06:26:21 +00001414AC_LINK_IFELSE(
1415[AC_LANG_PROGRAM([ ], [return 0;])],
bart699fbac2010-06-08 18:23:59 +00001416[
1417 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1418 AC_MSG_RESULT([yes])
1419], [
1420 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1421 AC_MSG_RESULT([no])
1422])
1423CFLAGS=$safe_CFLAGS
1424
1425
sewardj00f1e622006-03-12 16:47:10 +00001426# does the ppc assembler support "mtocrf" et al?
1427AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1428
1429AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001430__asm__ __volatile__("mtocrf 4,0");
1431__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001432],
1433[
1434ac_have_as_ppc_mftocrf=yes
1435AC_MSG_RESULT([yes])
1436], [
1437ac_have_as_ppc_mftocrf=no
1438AC_MSG_RESULT([no])
1439])
1440if test x$ac_have_as_ppc_mftocrf = xyes ; then
1441 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1442fi
1443
1444
sewardjb5b87402011-03-07 16:05:35 +00001445CFLAGS=$safe_CFLAGS
1446
sewardjf0aabf82007-03-22 00:24:21 +00001447# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001448# Note, this doesn't generate a C-level symbol. It generates a
1449# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001450AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1451
1452AC_TRY_COMPILE(, [
1453 do { long long int x;
1454 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1455 while (0)
1456],
1457[
1458ac_have_as_sse3=yes
1459AC_MSG_RESULT([yes])
1460], [
1461ac_have_as_sse3=no
1462AC_MSG_RESULT([no])
1463])
sewardjfa18a262007-03-22 12:13:13 +00001464
1465AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001466
1467
sewardj6d6da5b2008-02-09 12:07:40 +00001468# Ditto for SSSE3 instructions (note extra S)
1469# Note, this doesn't generate a C-level symbol. It generates a
1470# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1471AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1472
1473AC_TRY_COMPILE(, [
1474 do { long long int x;
1475 __asm__ __volatile__(
1476 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1477 while (0)
1478],
1479[
1480ac_have_as_ssse3=yes
1481AC_MSG_RESULT([yes])
1482], [
1483ac_have_as_ssse3=no
1484AC_MSG_RESULT([no])
1485])
1486
1487AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1488
1489
sewardj27d176a2011-01-17 11:15:48 +00001490# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1491# Note, this doesn't generate a C-level symbol. It generates a
1492# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
sewardje3ae8a32010-09-28 19:59:47 +00001493AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
1494AC_TRY_COMPILE(, [
1495 do {
1496 __asm__ __volatile__(
1497 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1498 while (0)
1499],
1500[
1501ac_have_as_pclmulqdq=yes
1502AC_MSG_RESULT([yes])
1503], [
1504ac_have_as_pclmulqdq=no
1505AC_MSG_RESULT([no])
1506])
1507
1508AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1509
1510
sewardj27d176a2011-01-17 11:15:48 +00001511# does the x86/amd64 assembler understand the LZCNT instruction?
1512# Note, this doesn't generate a C-level symbol. It generates a
1513# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
bart55e438b2010-09-14 10:53:57 +00001514AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1515
1516AC_TRY_COMPILE([], [
1517 do {
1518 __asm__ __volatile__("lzcnt %rax,%rax");
1519 } while (0)
1520],
1521[
1522 ac_have_as_lzcnt=yes
1523 AC_MSG_RESULT([yes])
1524], [
1525 ac_have_as_lzcnt=no
1526 AC_MSG_RESULT([no])
1527])
1528
1529AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1530
sewardj27d176a2011-01-17 11:15:48 +00001531
1532# does the x86/amd64 assembler understand SSE 4.2 instructions?
1533# Note, this doesn't generate a C-level symbol. It generates a
1534# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
1535AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
1536
1537AC_TRY_COMPILE(, [
1538 do { long long int x;
1539 __asm__ __volatile__(
1540 "crc32q %%r15,%%r15" : : : "r15" ); }
1541 while (0)
1542],
1543[
1544ac_have_as_sse42=yes
1545AC_MSG_RESULT([yes])
1546], [
1547ac_have_as_sse42=no
1548AC_MSG_RESULT([no])
1549])
1550
1551AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
1552
1553
sewardje089f012010-10-13 21:47:29 +00001554# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
1555# when building the tool executables. I think we should get rid of it.
1556#
sewardjb5f6f512005-03-10 23:59:00 +00001557# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001558if test "x${cross_compiling}" = "xno"; then
1559# Native compilation: check whether running a program using TLS succeeds.
1560# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1561# succeeds but running programs using TLS fails.
1562AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1563 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1564 [vg_cv_tls=$enableval],
1565 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1566 [[return foo;]])],
1567 [vg_cv_tls=yes],
1568 [vg_cv_tls=no])])])
1569else
1570# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001571AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1572 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1573 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001574 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001575 [[return foo;]])],
1576 [vg_cv_tls=yes],
1577 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001578fi
sewardjb5f6f512005-03-10 23:59:00 +00001579
1580if test "$vg_cv_tls" = yes; then
1581AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1582fi
sewardj5b754b42002-06-03 22:53:35 +00001583
sewardj535c50f2005-06-04 23:14:53 +00001584
njn7fd6d382009-01-22 21:56:32 +00001585#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001586# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001587#----------------------------------------------------------------------------
1588
sewardjde4a1d02002-03-22 01:27:54 +00001589AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001590AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001591 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001592 endian.h \
1593 mqueue.h \
1594 sys/endian.h \
1595 sys/epoll.h \
1596 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001597 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001598 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001599 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001600 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001601 sys/syscall.h \
1602 sys/time.h \
1603 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001604 ])
sewardjde4a1d02002-03-22 01:27:54 +00001605
njn7fd6d382009-01-22 21:56:32 +00001606#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001607# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001608#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001609AC_TYPE_UID_T
1610AC_TYPE_OFF_T
1611AC_TYPE_SIZE_T
1612AC_HEADER_TIME
1613
sewardj535c50f2005-06-04 23:14:53 +00001614
njn7fd6d382009-01-22 21:56:32 +00001615#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001616# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001617#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001618AC_FUNC_MEMCMP
1619AC_FUNC_MMAP
1620AC_TYPE_SIGNAL
1621
bart26288e42011-04-03 16:46:01 +00001622AC_CHECK_LIB([pthread], [pthread_create])
bart71bad292008-04-27 11:43:23 +00001623AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001624
bartf5ceec82008-04-26 07:45:10 +00001625AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001626 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001627 epoll_create \
1628 epoll_pwait \
bartce48fa92008-04-26 10:59:46 +00001629 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001630 mallinfo \
1631 memchr \
1632 memset \
1633 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001634 mremap \
bartf5ceec82008-04-26 07:45:10 +00001635 ppoll \
bart6d45e922009-01-20 13:45:38 +00001636 pthread_barrier_init \
1637 pthread_condattr_setclock \
1638 pthread_mutex_timedlock \
1639 pthread_rwlock_timedrdlock \
1640 pthread_rwlock_timedwrlock \
1641 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001642 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001643 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001644 semtimedop \
1645 signalfd \
njn6cc22472009-03-16 03:46:48 +00001646 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001647 strchr \
1648 strdup \
1649 strpbrk \
1650 strrchr \
1651 strstr \
barta72a27b2010-04-29 06:22:17 +00001652 syscall \
bartf5ceec82008-04-26 07:45:10 +00001653 utimensat \
1654 ])
sewardjde4a1d02002-03-22 01:27:54 +00001655
bart623eec32008-07-29 17:54:49 +00001656# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1657# libraries with any shared object and/or executable. This is NOT what we
1658# want for e.g. vgpreload_core-x86-linux.so
1659LIBS=""
sewardj80637752006-03-02 13:48:21 +00001660
bart6d45e922009-01-20 13:45:38 +00001661AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1662 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001663AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1664 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001665AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1666 [test x$ac_cv_func_pthread_spin_lock = xyes])
1667
njn7fd6d382009-01-22 21:56:32 +00001668
1669#----------------------------------------------------------------------------
1670# MPI checks
1671#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001672# Do we have a useable MPI setup on the primary and/or secondary targets?
1673# On Linux, by default, assumes mpicc and -m32/-m64
sewardje9fa5062006-03-12 18:29:18 +00001674# Note: this is a kludge in that it assumes the specified mpicc
sewardj6e9de462011-06-28 07:25:29 +00001675# understands -m32/-m64 regardless of what is specified using
sewardj03d86f22006-10-17 00:57:24 +00001676# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001677MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00001678
sewardje9fa5062006-03-12 18:29:18 +00001679mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001680if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
sewardj6e9de462011-06-28 07:25:29 +00001681 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
1682 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001683 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001684elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
sewardjb5b87402011-03-07 16:05:35 +00001685 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
1686 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001687 mflag_primary=$FLAG_M64
1688fi
1689
sewardj03d86f22006-10-17 00:57:24 +00001690mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001691if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1692 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001693 mflag_secondary=$FLAG_M32
sewardj03d86f22006-10-17 00:57:24 +00001694fi
1695
1696
sewardj0ad46092006-03-02 17:09:16 +00001697AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001698 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001699 MPI_CC=$withval
1700)
sewardj03d86f22006-10-17 00:57:24 +00001701AC_SUBST(MPI_CC)
1702
1703## See if MPI_CC works for the primary target
1704##
1705AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001706saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001707saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001708CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001709CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001710AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001711#include <mpi.h>
1712#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001713],[
1714 int r = MPI_Init(NULL,NULL);
1715 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1716 return r;
1717], [
sewardj03d86f22006-10-17 00:57:24 +00001718ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001719AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001720], [
sewardj03d86f22006-10-17 00:57:24 +00001721ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001722AC_MSG_RESULT([no])
1723])
sewardj0ad46092006-03-02 17:09:16 +00001724CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001725CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001726AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001727
sewardj03d86f22006-10-17 00:57:24 +00001728## See if MPI_CC works for the secondary target. Complication: what if
1729## there is no secondary target? We need this to then fail.
1730## Kludge this by making MPI_CC something which will surely fail in
1731## such a case.
1732##
1733AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1734saved_CC=$CC
1735saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001736if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001737 CC="$MPI_CC this will surely fail"
1738else
1739 CC=$MPI_CC
1740fi
1741CFLAGS=$mflag_secondary
1742AC_TRY_LINK([
1743#include <mpi.h>
1744#include <stdio.h>
1745],[
1746 int r = MPI_Init(NULL,NULL);
1747 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1748 return r;
1749], [
1750ac_have_mpi2_sec=yes
1751AC_MSG_RESULT([yes, $MPI_CC])
1752], [
1753ac_have_mpi2_sec=no
1754AC_MSG_RESULT([no])
1755])
1756CC=$saved_CC
1757CFLAGS=$saved_CFLAGS
1758AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001759
1760
njn7fd6d382009-01-22 21:56:32 +00001761#----------------------------------------------------------------------------
1762# Other library checks
1763#----------------------------------------------------------------------------
bart2ef12d42010-10-18 16:32:11 +00001764# There now follow some tests for Boost, and OpenMP. These
sewardj493c4ef2008-12-13 16:45:19 +00001765# tests are present because Drd has some regression tests that use
1766# these packages. All regression test programs all compiled only
1767# for the primary target. And so it is important that the configure
1768# checks that follow, use the correct -m32 or -m64 flag for the
1769# primary target (called $mflag_primary). Otherwise, we can end up
1770# in a situation (eg) where, on amd64-linux, the test for Boost checks
1771# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1772# only build (meaning, the primary target is x86-linux), the build
1773# of the regtest programs that use Boost fails, because they are
1774# build as 32-bit (IN THIS EXAMPLE).
1775#
1776# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1777# NEEDED BY THE REGRESSION TEST PROGRAMS.
1778
1779
sewardj493c4ef2008-12-13 16:45:19 +00001780# Check whether the boost library 1.35 or later has been installed.
1781# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1782
1783AC_MSG_CHECKING([for boost])
1784
1785AC_LANG(C++)
1786safe_CXXFLAGS=$CXXFLAGS
1787CXXFLAGS="-lboost_thread-mt $mflag_primary"
1788
bart128fc522011-03-12 10:36:35 +00001789AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001790#include <boost/thread.hpp>
1791static void thread_func(void)
1792{ }
1793int main(int argc, char** argv)
1794{
1795 boost::thread t(thread_func);
1796 return 0;
1797}
bart128fc522011-03-12 10:36:35 +00001798])],
sewardj493c4ef2008-12-13 16:45:19 +00001799[
1800ac_have_boost_1_35=yes
1801AC_SUBST([BOOST_CFLAGS], [])
1802AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1803AC_MSG_RESULT([yes])
1804], [
1805ac_have_boost_1_35=no
1806AC_MSG_RESULT([no])
1807])
1808
1809CXXFLAGS=$safe_CXXFLAGS
1810AC_LANG(C)
1811
1812AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1813
1814
1815# does this compiler support -fopenmp, does it have the include file
1816# <omp.h> and does it have libgomp ?
1817
1818AC_MSG_CHECKING([for OpenMP])
1819
1820safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001821CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001822
bart128fc522011-03-12 10:36:35 +00001823AC_LINK_IFELSE([AC_LANG_SOURCE([
sewardj493c4ef2008-12-13 16:45:19 +00001824#include <omp.h>
1825int main(int argc, char** argv)
1826{
1827 omp_set_dynamic(0);
1828 return 0;
1829}
bart128fc522011-03-12 10:36:35 +00001830])],
sewardj493c4ef2008-12-13 16:45:19 +00001831[
1832ac_have_openmp=yes
1833AC_MSG_RESULT([yes])
1834], [
1835ac_have_openmp=no
1836AC_MSG_RESULT([no])
1837])
1838CFLAGS=$safe_CFLAGS
1839
1840AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1841
1842
sewardjc876a2f2009-01-22 22:44:30 +00001843# does this compiler have built-in functions for atomic memory access ?
1844AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1845
1846safe_CFLAGS=$CFLAGS
1847CFLAGS="$mflag_primary"
1848
1849AC_TRY_LINK(,
1850[
1851 int variable = 1;
1852 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1853 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1854],
1855[
bartc82d1372009-05-31 16:21:23 +00001856 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001857 AC_MSG_RESULT([yes])
barte8740422011-03-24 20:27:54 +00001858 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 +00001859],
1860[
bartc82d1372009-05-31 16:21:23 +00001861 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001862 AC_MSG_RESULT([no])
1863])
1864
1865CFLAGS=$safe_CFLAGS
1866
bartc82d1372009-05-31 16:21:23 +00001867AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1868
barte8740422011-03-24 20:27:54 +00001869# does g++ have built-in functions for atomic memory access ?
1870AC_MSG_CHECKING([if g++ supports __sync_bool_compare_and_swap])
1871
1872safe_CXXFLAGS=$CXXFLAGS
1873CXXFLAGS="$mflag_primary"
1874
1875AC_LANG_PUSH(C++)
1876AC_TRY_LINK(,
1877[
1878 int variable = 1;
1879 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1880 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1881],
1882[
1883 ac_have_builtin_atomic_cxx=yes
1884 AC_MSG_RESULT([yes])
1885 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
1886],
1887[
1888 ac_have_builtin_atomic_cxx=no
1889 AC_MSG_RESULT([no])
1890])
1891AC_LANG_POP(C++)
1892
1893CXXFLAGS=$safe_CXXFLAGS
1894
1895AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
sewardjc876a2f2009-01-22 22:44:30 +00001896
njn7fd6d382009-01-22 21:56:32 +00001897#----------------------------------------------------------------------------
1898# Ok. We're done checking.
1899#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001900
njn8b68b642009-06-24 00:37:09 +00001901# Nb: VEX/Makefile is generated from Makefile.vex.in.
1902AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001903 Makefile
njn8b68b642009-06-24 00:37:09 +00001904 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001905 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001906 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001907 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001908 docs/Makefile
1909 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001910 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001911 perf/Makefile
1912 perf/vg_perf
sewardj3b290482011-05-06 21:02:55 +00001913 gdbserver_tests/Makefile
njn254d542432002-09-23 16:09:39 +00001914 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001915 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001916 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001917 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001918 memcheck/Makefile
1919 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001920 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001921 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001922 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001923 memcheck/tests/darwin/Makefile
njnea2d6fd2010-07-01 00:20:20 +00001924 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00001925 memcheck/tests/x86-linux/Makefile
sewardj0e342a02010-09-03 23:49:33 +00001926 memcheck/tests/ppc32/Makefile
1927 memcheck/tests/ppc64/Makefile
njn29a5c012009-05-06 06:15:55 +00001928 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001929 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001930 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001931 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00001932 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00001933 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00001934 callgrind/Makefile
1935 callgrind/callgrind_annotate
1936 callgrind/callgrind_control
1937 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001938 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001939 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001940 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001941 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001942 massif/perf/Makefile
njnd5a8d242007-11-02 20:44:57 +00001943 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001944 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001945 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001946 none/Makefile
1947 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001948 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001949 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001950 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001951 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00001952 none/tests/arm/Makefile
sewardjb5b87402011-03-07 16:05:35 +00001953 none/tests/s390x/Makefile
njn0458a122009-02-13 06:23:46 +00001954 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001955 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001956 none/tests/x86-linux/Makefile
sewardjd2f95a02011-05-11 16:04:28 +00001957 exp-sgcheck/Makefile
1958 exp-sgcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00001959 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00001960 drd/scripts/download-and-build-splash2
1961 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001962 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00001963 exp-bbv/tests/Makefile
1964 exp-bbv/tests/x86/Makefile
1965 exp-bbv/tests/x86-linux/Makefile
1966 exp-bbv/tests/amd64-linux/Makefile
1967 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00001968 exp-bbv/tests/arm-linux/Makefile
sewardj4d7d8f52010-10-12 10:09:15 +00001969 exp-dhat/Makefile
1970 exp-dhat/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00001971])
sewardjd3645802010-06-13 22:13:58 +00001972AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
1973 [chmod +x coregrind/link_tool_exe_linux])
1974AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
1975 [chmod +x coregrind/link_tool_exe_darwin])
njn8b68b642009-06-24 00:37:09 +00001976AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001977
1978cat<<EOF
1979
njn311303f2009-02-06 03:46:50 +00001980 Maximum build arch: ${ARCH_MAX}
1981 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001982 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001983 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001984 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1985 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardjcb495c82011-07-11 20:42:34 +00001986 Platform variant: ${VGCONF_PLATVARIANT}
1987 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
sewardje95d94f2008-09-19 09:02:19 +00001988 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001989
gobry3b777892002-04-04 09:18:39 +00001990EOF