blob: 073910afedbf2ae557323bd3d512a3159f81acc5 [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.
sewardj9ccee392009-08-20 20:20:05 +000011AC_INIT(Valgrind, 3.6.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#----------------------------------------------------------------------------
sewardjb5f6f512005-03-10 23:59:00 +000021CFLAGS="-Wno-long-long"
gobrye721a522002-03-22 13:38:30 +000022
sewardjde4a1d02002-03-22 01:27:54 +000023AC_PROG_LN_S
24AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000025AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000026AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000027AC_PROG_CXX
njn629a5ec2009-07-14 01:29:39 +000028# AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
29# autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
30# base (eg. most likely as Darwin-specific tests) we'll need one of the
31# following:
njn0cd26892009-07-12 23:07:13 +000032# - put AC_PROG_OBJC in a Darwin-specific part of this file
33# - Use AC_PROG_OBJC here and up the minimum autoconf version
34# - Use the following, which is apparently equivalent:
35# m4_ifdef([AC_PROG_OBJC],
36# [AC_PROG_OBJC],
37# [AC_CHECK_TOOL([OBJC], [gcc])
38# AC_SUBST([OBJC])
39# AC_SUBST([OBJCFLAGS])
40# ])
sewardjde4a1d02002-03-22 01:27:54 +000041AC_PROG_RANLIB
bart07de2c92010-05-29 06:44:28 +000042# provide a very basic definition for AC_PROG_SED if it's not provided by
43# autoconf (as e.g. in autoconf 2.59).
44m4_ifndef([AC_PROG_SED],
45 [AC_DEFUN([AC_PROG_SED],
46 [AC_ARG_VAR([SED])
47 AC_CHECK_PROGS([SED],[gsed sed])])])
bart12e91122010-05-15 08:37:24 +000048AC_PROG_SED
sewardjde4a1d02002-03-22 01:27:54 +000049
bartcddeaf52008-05-25 15:58:11 +000050# If no AR variable was specified, look up the name of the archiver. Otherwise
51# do not touch the AR variable.
52if test "x$AR" = "x"; then
bart07de2c92010-05-29 06:44:28 +000053 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000054fi
55AC_ARG_VAR([AR],[Archiver command])
56
gobrye721a522002-03-22 13:38:30 +000057# Check for the compiler support
58if test "${GCC}" != "yes" ; then
59 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
60fi
61
sewardj2f685952002-12-22 19:32:23 +000062# figure out where perl lives
63AC_PATH_PROG(PERL, perl)
64
njn9315df32003-04-16 20:50:50 +000065# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000066AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000067AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000068
daywalker48ccca52002-04-15 00:31:58 +000069# some older automake's don't have it so try something on our own
70ifdef([AM_PROG_AS],[AM_PROG_AS],
71[
gobry1be19852002-03-26 20:44:55 +000072AS="${CC}"
73AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000074
gobry1be19852002-03-26 20:44:55 +000075ASFLAGS=""
76AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000077])
gobry3b777892002-04-04 09:18:39 +000078
gobry3b777892002-04-04 09:18:39 +000079
njn0d2e58f2009-02-25 04:57:56 +000080# Check if 'diff' supports -u (universal diffs) and use it if possible.
81
82AC_MSG_CHECKING([for diff -u])
83AC_SUBST(DIFF)
84
85# Comparing two identical files results in 0, unless -u isn't supported (as
86# it's not on AIX).
njn31f665e2009-02-26 21:25:50 +000087tmpfile="tmp-xxx-yyy-zzz"
88touch $tmpfile;
89if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000090 AC_MSG_RESULT([yes])
91 DIFF="diff -u"
92else
93 AC_MSG_RESULT([no])
94 DIFF="diff"
95fi
njn31f665e2009-02-26 21:25:50 +000096rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000097
98
sewardj535c50f2005-06-04 23:14:53 +000099# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +0000100AC_MSG_CHECKING([for a supported version of gcc])
101
bart07de2c92010-05-29 06:44:28 +0000102[gcc_version=`${CC} --version | head -n 1 | $SED 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +0000103
104case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +0000105 2.*)
gobrye721a522002-03-22 13:38:30 +0000106 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000107 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
108 ;;
gobrye721a522002-03-22 13:38:30 +0000109 *)
110 AC_MSG_RESULT([ok (${gcc_version})])
111 ;;
112esac
113
njn7fd6d382009-01-22 21:56:32 +0000114#----------------------------------------------------------------------------
115# Arch/OS/platform tests.
116#----------------------------------------------------------------------------
117# We create a number of arch/OS/platform-related variables. We prefix them
118# all with "VGCONF_" which indicates that they are defined at
119# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
120# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000121
sewardjde4a1d02002-03-22 01:27:54 +0000122AC_CANONICAL_HOST
123
124AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000125
njn7fd6d382009-01-22 21:56:32 +0000126# ARCH_MAX reflects the most that this CPU can do: for example if it
127# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
128# Ditto for amd64. It is used for more configuration below, but is not used
129# outside this file.
gobrye721a522002-03-22 13:38:30 +0000130case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000131 i?86)
132 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000133 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000134 ;;
135
njnfe408942004-11-23 17:52:24 +0000136 x86_64)
137 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000138 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000139 ;;
140
sewardj2c48c7b2005-11-29 13:05:56 +0000141 powerpc64)
njn7fd6d382009-01-22 21:56:32 +0000142 # This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000143 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000144 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000145 ;;
146
147 powerpc)
njn7fd6d382009-01-22 21:56:32 +0000148 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
149 # Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000150 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000151 case "${host_os}" in
152 aix5.*)
njn7fd6d382009-01-22 21:56:32 +0000153 ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000154 ;;
155 *)
njn7fd6d382009-01-22 21:56:32 +0000156 ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000157 ;;
158 esac
nethercote9bcc9062004-10-13 13:50:01 +0000159 ;;
160
sewardj59570ff2010-01-01 11:59:33 +0000161 armv7*)
162 AC_MSG_RESULT([ok (${host_cpu})])
163 ARCH_MAX="arm"
164 ;;
165
sewardjde4a1d02002-03-22 01:27:54 +0000166 *)
167 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000168 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000169 ;;
170esac
171
njn7fd6d382009-01-22 21:56:32 +0000172#----------------------------------------------------------------------------
173
sewardj86e992f2006-01-28 18:39:09 +0000174# Sometimes it's convenient to subvert the bi-arch build system and
175# just have a single build even though the underlying platform is
176# capable of both. Hence handle --enable-only64bit and
177# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000178# [Actually, if either of these options are used, I think both get built,
179# but only one gets installed. So if you use an in-place build, both can be
180# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000181
182# Check if a 64-bit only build has been requested
183AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
184 [AC_ARG_ENABLE(only64bit,
185 [ --enable-only64bit do a 64-bit only build],
186 [vg_cv_only64bit=$enableval],
187 [vg_cv_only64bit=no])])
188
189# Check if a 32-bit only build has been requested
190AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
191 [AC_ARG_ENABLE(only32bit,
192 [ --enable-only32bit do a 32-bit only build],
193 [vg_cv_only32bit=$enableval],
194 [vg_cv_only32bit=no])])
195
196# Stay sane
197if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
198 AC_MSG_ERROR(
199 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
200fi
201
njn7fd6d382009-01-22 21:56:32 +0000202#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000203
njn311303f2009-02-06 03:46:50 +0000204# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
205# compilation of many C files via -VGO_$(VGCONF_OS) and
206# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000207AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000208AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000209
njnf76d27a2009-05-28 01:53:07 +0000210DEFAULT_SUPP=""
211
gobrye721a522002-03-22 13:38:30 +0000212case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000213 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000214 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000215 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000216
217 # Ok, this is linux. Check the kernel version
218 AC_MSG_CHECKING([for the kernel version])
219
220 kernel=`uname -r`
221
222 case "${kernel}" in
223 2.6.*)
224 AC_MSG_RESULT([2.6 family (${kernel})])
225 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
226 ;;
227
228 2.4.*)
229 AC_MSG_RESULT([2.4 family (${kernel})])
230 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
231 ;;
232
mueller8c68e042004-01-03 15:21:14 +0000233 *)
234 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000235 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000236 ;;
237 esac
238
239 ;;
240
sewardj03d86f22006-10-17 00:57:24 +0000241 aix5.1.*)
242 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000243 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000244 ;;
245 aix5.2.*)
246 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000247 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000248 ;;
249 aix5.3.*)
250 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000251 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000252 ;;
253
njnf76d27a2009-05-28 01:53:07 +0000254 *darwin*)
255 AC_MSG_RESULT([ok (${host_os})])
256 VGCONF_OS="darwin"
njnea2d6fd2010-07-01 00:20:20 +0000257 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
258 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
259 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
njnf76d27a2009-05-28 01:53:07 +0000260
261 AC_MSG_CHECKING([for the kernel version])
262 kernel=`uname -r`
263
264 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
265 # has only one relevant version, the OS version. The `uname` check
266 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
njnea2d6fd2010-07-01 00:20:20 +0000267 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard),
268 # and we don't know of an macros similar to __GLIBC__ to get that info.
njnf76d27a2009-05-28 01:53:07 +0000269 #
270 # XXX: `uname -r` won't do the right thing for cross-compiles, but
271 # that's not a problem yet.
272 case "${kernel}" in
273 9.*)
274 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
njnea2d6fd2010-07-01 00:20:20 +0000275 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
njnf76d27a2009-05-28 01:53:07 +0000276 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000277 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000278 ;;
njnea2d6fd2010-07-01 00:20:20 +0000279 10.*)
280 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
281 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
282 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
283 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
284 ;;
njnf76d27a2009-05-28 01:53:07 +0000285 *)
286 AC_MSG_RESULT([unsupported (${kernel})])
njnea2d6fd2010-07-01 00:20:20 +0000287 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 +0000288 ;;
289 esac
290 ;;
291
sewardjde4a1d02002-03-22 01:27:54 +0000292 *)
293 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000294 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000295 ;;
296esac
297
njn7fd6d382009-01-22 21:56:32 +0000298#----------------------------------------------------------------------------
299
tomd6398392006-06-07 17:44:36 +0000300# If we are building on a 64 bit platform test to see if the system
301# supports building 32 bit programs and disable 32 bit support if it
302# does not support building 32 bit programs
303
njn7fd6d382009-01-22 21:56:32 +0000304case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000305 amd64-linux|ppc64-linux)
306 AC_MSG_CHECKING([for 32 bit build support])
307 safe_CFLAGS=$CFLAGS
308 CFLAGS="-m32"
309 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000310 return 0;
tomd6398392006-06-07 17:44:36 +0000311 ],
312 [
313 AC_MSG_RESULT([yes])
314 ], [
315 vg_cv_only64bit="yes"
316 AC_MSG_RESULT([no])
317 ])
318 CFLAGS=$safe_CFLAGS;;
319esac
320
321if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
322 AC_MSG_ERROR(
323 [--enable-only32bit was specified but system does not support 32 bit builds])
324fi
nethercote888ecb72004-08-23 14:54:40 +0000325
njn7fd6d382009-01-22 21:56:32 +0000326#----------------------------------------------------------------------------
327
njn311303f2009-02-06 03:46:50 +0000328# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
329# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
330# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
331# above) will be "amd64" since that reflects the most that this cpu can do,
332# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
333# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000334# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
335# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
336AC_SUBST(VGCONF_ARCH_PRI)
337
njn3f8a6e92009-06-02 00:20:47 +0000338# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
339# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
340# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
341# It is empty if there is no secondary target.
342AC_SUBST(VGCONF_ARCH_SEC)
343
njn311303f2009-02-06 03:46:50 +0000344# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
345# The entire system, including regression and performance tests, will be
346# built for this target. The "_CAPS" indicates that the name is in capital
347# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000348# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000349# convention and cannot contain '-' characters. This is in contrast to
350# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000351AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
352
353# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
354# Valgrind and tools will also be built for this target, but not the
355# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000356#
njn7fd6d382009-01-22 21:56:32 +0000357# By default, the primary arch is the same as the "max" arch, as commented
358# above (at the definition of ARCH_MAX). We may choose to downgrade it in
359# the big case statement just below here, in the case where we're building
360# on a 64 bit machine but have been requested only to do a 32 bit build.
361AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
362
sewardj01262142006-01-04 01:20:28 +0000363AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000364
njnea2d6fd2010-07-01 00:20:20 +0000365# NB. The load address for a given platform may be specified in more
366# than one place, in some cases, depending on whether we're doing a biarch,
367# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
368# Be careful to give consistent values in all subcases. Also, all four
369# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
370# even if it is to "0xUNSET".
371#
njn7fd6d382009-01-22 21:56:32 +0000372case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000373 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000374 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000375 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000376 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
377 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000378 valt_load_address_pri_norml="0x38000000"
379 valt_load_address_pri_inner="0x28000000"
380 valt_load_address_sec_norml="0xUNSET"
381 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000382 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000383 ;;
384 amd64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000385 valt_load_address_sec_norml="0xUNSET"
386 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000387 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000388 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000389 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000390 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
391 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000392 valt_load_address_pri_norml="0x38000000"
393 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000394 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000395 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000396 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000397 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
398 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000399 valt_load_address_pri_norml="0x38000000"
400 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000401 else
njn7fd6d382009-01-22 21:56:32 +0000402 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000403 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000404 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
405 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000406 valt_load_address_pri_norml="0x38000000"
407 valt_load_address_pri_inner="0x28000000"
408 valt_load_address_sec_norml="0x38000000"
409 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000410 fi
njn377c43f2009-05-19 07:39:22 +0000411 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000412 ;;
413 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000414 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000415 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000416 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
417 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000418 valt_load_address_pri_norml="0x38000000"
419 valt_load_address_pri_inner="0x28000000"
420 valt_load_address_sec_norml="0xUNSET"
421 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000422 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000423 ;;
sewardj03d86f22006-10-17 00:57:24 +0000424 ppc64-aix5)
njnea2d6fd2010-07-01 00:20:20 +0000425 valt_load_address_pri_norml="0xUNSET"
426 valt_load_address_pri_inner="0xUNSET"
427 valt_load_address_sec_norml="0xUNSET"
428 valt_load_address_sec_inner="0xUNSET"
sewardj03d86f22006-10-17 00:57:24 +0000429 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000430 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000431 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000432 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
433 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000434 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000435 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000436 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000437 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
438 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000439 else
njn7fd6d382009-01-22 21:56:32 +0000440 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000441 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000442 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
443 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000444 fi
njn377c43f2009-05-19 07:39:22 +0000445 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000446 ;;
sewardj01262142006-01-04 01:20:28 +0000447 ppc64-linux)
njnea2d6fd2010-07-01 00:20:20 +0000448 valt_load_address_sec_norml="0xUNSET"
449 valt_load_address_sec_inner="0xUNSET"
sewardj86e992f2006-01-28 18:39:09 +0000450 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000451 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000452 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000453 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
454 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000455 valt_load_address_pri_norml="0x38000000"
456 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000457 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000458 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000459 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000460 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
461 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000462 valt_load_address_pri_norml="0x38000000"
463 valt_load_address_pri_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000464 else
njn7fd6d382009-01-22 21:56:32 +0000465 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000466 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000467 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
468 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
njnea2d6fd2010-07-01 00:20:20 +0000469 valt_load_address_pri_norml="0x38000000"
470 valt_load_address_pri_inner="0x28000000"
471 valt_load_address_sec_norml="0x38000000"
472 valt_load_address_sec_inner="0x28000000"
sewardj86e992f2006-01-28 18:39:09 +0000473 fi
njn377c43f2009-05-19 07:39:22 +0000474 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000475 ;;
njnf76d27a2009-05-28 01:53:07 +0000476 x86-darwin)
477 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000478 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000479 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
480 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000481 valt_load_address_pri_norml="0x38000000"
482 valt_load_address_pri_inner="0x28000000"
483 valt_load_address_sec_norml="0xUNSET"
484 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000485 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
486 ;;
487 amd64-darwin)
njnea2d6fd2010-07-01 00:20:20 +0000488 valt_load_address_sec_norml="0xUNSET"
489 valt_load_address_sec_inner="0xUNSET"
njnf76d27a2009-05-28 01:53:07 +0000490 if test x$vg_cv_only64bit = xyes; then
491 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000492 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000493 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
494 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000495 valt_load_address_pri_norml="0x138000000"
496 valt_load_address_pri_inner="0x128000000"
njnf76d27a2009-05-28 01:53:07 +0000497 elif test x$vg_cv_only32bit = xyes; then
498 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000499 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000500 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
501 VGCONF_PLATFORM_SEC_CAPS=""
502 VGCONF_ARCH_PRI_CAPS="x86"
njnea2d6fd2010-07-01 00:20:20 +0000503 valt_load_address_pri_norml="0x38000000"
504 valt_load_address_pri_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000505 else
506 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000507 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000508 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
509 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
njnea2d6fd2010-07-01 00:20:20 +0000510 valt_load_address_pri_norml="0x138000000"
511 valt_load_address_pri_inner="0x128000000"
512 valt_load_address_sec_norml="0x38000000"
513 valt_load_address_sec_inner="0x28000000"
njnf76d27a2009-05-28 01:53:07 +0000514 fi
njnf76d27a2009-05-28 01:53:07 +0000515 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
516 ;;
sewardj59570ff2010-01-01 11:59:33 +0000517 arm-linux)
518 VGCONF_ARCH_PRI="arm"
519 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
520 VGCONF_PLATFORM_SEC_CAPS=""
njnea2d6fd2010-07-01 00:20:20 +0000521 valt_load_address_pri_norml="0x38000000"
522 valt_load_address_pri_inner="0x28000000"
523 valt_load_address_sec_norml="0xUNSET"
524 valt_load_address_sec_inner="0xUNSET"
sewardj59570ff2010-01-01 11:59:33 +0000525 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
526 ;;
nethercote888ecb72004-08-23 14:54:40 +0000527 *)
njn7fd6d382009-01-22 21:56:32 +0000528 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000529 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000530 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
531 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njnea2d6fd2010-07-01 00:20:20 +0000532 valt_load_address_pri_norml="0xUNSET"
533 valt_load_address_pri_inner="0xUNSET"
534 valt_load_address_sec_norml="0xUNSET"
535 valt_load_address_sec_inner="0xUNSET"
njn377c43f2009-05-19 07:39:22 +0000536 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000537 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000538 ;;
539esac
sewardjde4a1d02002-03-22 01:27:54 +0000540
njn7fd6d382009-01-22 21:56:32 +0000541#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000542
njn7fd6d382009-01-22 21:56:32 +0000543# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
544# defined.
545AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
546 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000547 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
548 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
549 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000550AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000551 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
552 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000553AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
554 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
555 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
556 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
557 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
558AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
559 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
560 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj59570ff2010-01-01 11:59:33 +0000561AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
562 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000563
njn7fd6d382009-01-22 21:56:32 +0000564# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
565# become defined.
566AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
567 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
568 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
569AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
570 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
571AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
572 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
573 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
574AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
575 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000576AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
577 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000578
njn7fd6d382009-01-22 21:56:32 +0000579AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
580 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
581 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
582AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
583 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
584
njnf76d27a2009-05-28 01:53:07 +0000585AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
586 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
587 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
588AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
589 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
590
591
njn7fd6d382009-01-22 21:56:32 +0000592# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000593# Relies on the assumption that the primary and secondary targets are
594# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000595AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
596 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
597 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
598 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000599 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
600 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000601AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
602 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
603 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000604AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
605 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
606 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000607
608
njn7fd6d382009-01-22 21:56:32 +0000609# Sometimes, in the Makefile.am files, it's useful to know whether or not
610# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000611AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000612 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000613
tomb637bad2005-11-08 12:28:35 +0000614
njn7fd6d382009-01-22 21:56:32 +0000615#----------------------------------------------------------------------------
616# Inner Valgrind?
617#----------------------------------------------------------------------------
618
njnd74b0ef2009-01-20 06:06:52 +0000619# Check if this should be built as an inner Valgrind, to be run within
620# another Valgrind. Choose the load address accordingly.
njnea2d6fd2010-07-01 00:20:20 +0000621AC_SUBST(VALT_LOAD_ADDRESS_PRI)
622AC_SUBST(VALT_LOAD_ADDRESS_SEC)
njnd74b0ef2009-01-20 06:06:52 +0000623AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
624 [AC_ARG_ENABLE(inner,
625 [ --enable-inner enables self-hosting],
626 [vg_cv_inner=$enableval],
627 [vg_cv_inner=no])])
628if test "$vg_cv_inner" = yes; then
629 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
njnea2d6fd2010-07-01 00:20:20 +0000630 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
631 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
njnd74b0ef2009-01-20 06:06:52 +0000632else
njnea2d6fd2010-07-01 00:20:20 +0000633 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
634 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
njnd74b0ef2009-01-20 06:06:52 +0000635fi
636
637
njn7fd6d382009-01-22 21:56:32 +0000638#----------------------------------------------------------------------------
639# Libc and suppressions
640#----------------------------------------------------------------------------
641# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000642AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000643
bart12e91122010-05-15 08:37:24 +0000644AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000645
bart12e91122010-05-15 08:37:24 +0000646if test x$ac_cv_header_features_h = xyes; then
647 rm -f conftest.$ac_ext
648 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000649#include <features.h>
bart12e91122010-05-15 08:37:24 +0000650#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
651glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000652#endif
bart12e91122010-05-15 08:37:24 +0000653_ACEOF
654 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
655fi
bartb7c3f082010-05-13 06:32:36 +0000656
sewardj03d86f22006-10-17 00:57:24 +0000657AC_EGREP_CPP([AIX5_LIBC], [
658#include <standards.h>
659#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
660 AIX5_LIBC
661#endif
662],
dirk07596a22008-04-25 11:33:30 +0000663GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000664
njnf76d27a2009-05-28 01:53:07 +0000665# not really a version check
666AC_EGREP_CPP([DARWIN_LIBC], [
667#include <sys/cdefs.h>
668#if defined(__DARWIN_VERS_1050)
669 DARWIN_LIBC
670#endif
671],
672GLIBC_VERSION="darwin")
673
dirk07596a22008-04-25 11:33:30 +0000674AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000675
dirk07596a22008-04-25 11:33:30 +0000676case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000677 2.2)
678 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000679 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000680 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
681 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000682 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000683 ;;
684
sewardj08c7f012002-10-07 23:56:55 +0000685 2.3)
686 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000687 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000688 DEFAULT_SUPP="glibc-2.3.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}"
sewardj08c7f012002-10-07 23:56:55 +0000691 ;;
692
njn781dba52005-06-30 04:06:38 +0000693 2.4)
694 AC_MSG_RESULT(2.4 family)
695 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000696 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000697 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000698 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000699 ;;
700
dirkaece45c2006-10-12 08:17:49 +0000701 2.5)
702 AC_MSG_RESULT(2.5 family)
703 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000704 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000705 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000706 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000707 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000708 2.6)
709 AC_MSG_RESULT(2.6 family)
710 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000711 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000712 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000713 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000714 ;;
715 2.7)
716 AC_MSG_RESULT(2.7 family)
717 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000718 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000719 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000720 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000721 ;;
dirk07596a22008-04-25 11:33:30 +0000722 2.8)
723 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000724 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000725 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
726 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
727 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
728 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000729 2.9)
730 AC_MSG_RESULT(2.9 family)
731 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
732 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
733 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
734 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
735 ;;
sewardj5d425e82009-02-01 19:01:11 +0000736 2.10)
737 AC_MSG_RESULT(2.10 family)
738 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
739 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
740 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
741 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
742 ;;
bart0fac7ff2009-11-15 19:11:19 +0000743 2.11)
744 AC_MSG_RESULT(2.11 family)
745 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
746 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
747 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
748 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000749 ;;
750 2.12)
751 AC_MSG_RESULT(2.12 family)
752 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
753 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
754 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
755 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000756 ;;
sewardj03d86f22006-10-17 00:57:24 +0000757 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000758 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
759 AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
sewardj03d86f22006-10-17 00:57:24 +0000760 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
761 ;;
njnf76d27a2009-05-28 01:53:07 +0000762 darwin)
763 AC_MSG_RESULT(Darwin)
764 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
765 # DEFAULT_SUPP set by kernel version check above.
766 ;;
dirkaece45c2006-10-12 08:17:49 +0000767
sewardjde4a1d02002-03-22 01:27:54 +0000768 *)
bart12e91122010-05-15 08:37:24 +0000769 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
bartb7c3f082010-05-13 06:32:36 +0000770 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.12])
dirk07596a22008-04-25 11:33:30 +0000771 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000772 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000773 ;;
774esac
775
dirk07596a22008-04-25 11:33:30 +0000776AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000777
sewardj414f3582008-07-18 20:46:00 +0000778
779# Add default suppressions for the X client libraries. Make no
780# attempt to detect whether such libraries are installed on the
781# build machine (or even if any X facilities are present); just
782# add the suppressions antidisirregardless.
783DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
784DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000785
sewardj5744c022008-10-19 18:58:13 +0000786# Add glibc and X11 suppressions for exp-ptrcheck
787DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
788
sewardj2e10a682003-04-07 19:36:41 +0000789
njn7fd6d382009-01-22 21:56:32 +0000790#----------------------------------------------------------------------------
791# Checking for various library functions and other definitions
792#----------------------------------------------------------------------------
793
bart59e2f182008-04-28 16:22:53 +0000794# Check for CLOCK_MONOTONIC
795
796AC_MSG_CHECKING([for CLOCK_MONOTONIC])
797
798AC_TRY_COMPILE(
799[
800#include <time.h>
801], [
802 struct timespec t;
803 clock_gettime(CLOCK_MONOTONIC, &t);
804 return 0;
805],
806[
807AC_MSG_RESULT([yes])
808AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
809 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
810], [
811AC_MSG_RESULT([no])
812])
813
bartfea06922008-05-03 09:12:15 +0000814
815# Check for PTHREAD_MUTEX_ADAPTIVE_NP
816
817AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
818
819AC_TRY_COMPILE(
820[
821#define _GNU_SOURCE
822#include <pthread.h>
823], [
824 return (PTHREAD_MUTEX_ADAPTIVE_NP);
825],
826[
827AC_MSG_RESULT([yes])
828AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
829 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
830], [
831AC_MSG_RESULT([no])
832])
833
834
835# Check for PTHREAD_MUTEX_ERRORCHECK_NP
836
837AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
838
839AC_TRY_COMPILE(
840[
841#define _GNU_SOURCE
842#include <pthread.h>
843], [
844 return (PTHREAD_MUTEX_ERRORCHECK_NP);
845],
846[
847AC_MSG_RESULT([yes])
848AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
849 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
850], [
851AC_MSG_RESULT([no])
852])
853
854
855# Check for PTHREAD_MUTEX_RECURSIVE_NP
856
857AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
858
859AC_TRY_COMPILE(
860[
861#define _GNU_SOURCE
862#include <pthread.h>
863], [
864 return (PTHREAD_MUTEX_RECURSIVE_NP);
865],
866[
867AC_MSG_RESULT([yes])
868AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
869 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
870], [
871AC_MSG_RESULT([no])
872])
873
874
875# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
876
877AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
878
879AC_TRY_COMPILE(
880[
881#define _GNU_SOURCE
882#include <pthread.h>
883], [
884 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
885 return 0;
886],
887[
888AC_MSG_RESULT([yes])
889AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
890 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
891], [
892AC_MSG_RESULT([no])
893])
894
895
bart5e389f12008-04-05 12:53:15 +0000896# Check whether pthread_mutex_t has a member called __m_kind.
897
bartb11355c2010-04-29 16:37:26 +0000898AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
899 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
900 1,
901 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
902 ],
903 [],
904 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000905
906
907# Check whether pthread_mutex_t has a member called __data.__kind.
908
bartb11355c2010-04-29 16:37:26 +0000909AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
910 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
911 1,
912 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
913 ],
914 [],
915 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000916
917
bart62c370e2008-05-12 18:50:51 +0000918# does this compiler support -maltivec and does it have the include file
919# <altivec.h> ?
920
921AC_MSG_CHECKING([for Altivec])
922
923safe_CFLAGS=$CFLAGS
924CFLAGS="-maltivec"
925
926AC_TRY_COMPILE(
927[
928#include <altivec.h>
929], [
930 vector unsigned int v;
931],
932[
933ac_have_altivec=yes
934AC_MSG_RESULT([yes])
935], [
936ac_have_altivec=no
937AC_MSG_RESULT([no])
938])
939CFLAGS=$safe_CFLAGS
940
941AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
942AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
943
944
bart36dd85a2009-04-26 07:11:48 +0000945# Check for pthread_create@GLIBC2.0
946AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
947
bart16e1c5a2009-04-26 07:38:53 +0000948safe_CFLAGS=$CFLAGS
949CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000950AC_TRY_LINK(
951[
952extern int pthread_create_glibc_2_0(void*, const void*,
953 void *(*)(void*), void*);
954__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
955], [
bart276ed3a2009-05-10 15:41:45 +0000956#ifdef __powerpc__
957/*
958 * Apparently on PowerPC linking this program succeeds and generates an
959 * executable with the undefined symbol pthread_create@GLIBC_2.0.
960 */
961#error This test does not work properly on PowerPC.
962#else
bart16e1c5a2009-04-26 07:38:53 +0000963 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000964#endif
bart16e1c5a2009-04-26 07:38:53 +0000965 return 0;
bart36dd85a2009-04-26 07:11:48 +0000966],
967[
968ac_have_pthread_create_glibc_2_0=yes
969AC_MSG_RESULT([yes])
970AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
971 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
972], [
973ac_have_pthread_create_glibc_2_0=no
974AC_MSG_RESULT([no])
975])
bart16e1c5a2009-04-26 07:38:53 +0000976CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000977
978AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000979 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000980
981
barta50aa8a2008-04-27 06:06:57 +0000982# Check for eventfd_t, eventfd() and eventfd_read()
983AC_MSG_CHECKING([for eventfd()])
984
985AC_TRY_LINK(
986[
987#include <sys/eventfd.h>
988], [
989 eventfd_t ev;
990 int fd;
991
992 fd = eventfd(5, 0);
993 eventfd_read(fd, &ev);
994 return 0;
995],
996[
997AC_MSG_RESULT([yes])
998AC_DEFINE([HAVE_EVENTFD], 1,
999 [Define to 1 if you have the `eventfd' function.])
1000AC_DEFINE([HAVE_EVENTFD_READ], 1,
1001 [Define to 1 if you have the `eventfd_read' function.])
1002], [
1003AC_MSG_RESULT([no])
1004])
1005
1006
njn7fd6d382009-01-22 21:56:32 +00001007#----------------------------------------------------------------------------
1008# Checking for supported compiler flags.
1009#----------------------------------------------------------------------------
1010
sewardj535c50f2005-06-04 23:14:53 +00001011# does this compiler support -m32 ?
1012AC_MSG_CHECKING([if gcc accepts -m32])
1013
1014safe_CFLAGS=$CFLAGS
1015CFLAGS="-m32"
1016
1017AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001018 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001019],
1020[
1021FLAG_M32="-m32"
1022AC_MSG_RESULT([yes])
1023], [
1024FLAG_M32=""
1025AC_MSG_RESULT([no])
1026])
1027CFLAGS=$safe_CFLAGS
1028
1029AC_SUBST(FLAG_M32)
1030
1031
sewardj03d86f22006-10-17 00:57:24 +00001032# does this compiler support -maix32 ?
1033AC_MSG_CHECKING([if gcc accepts -maix32])
1034
1035safe_CFLAGS=$CFLAGS
1036CFLAGS="-maix32"
1037
1038AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001039 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001040],
1041[
1042FLAG_MAIX32="-maix32"
1043AC_MSG_RESULT([yes])
1044], [
1045FLAG_MAIX32=""
1046AC_MSG_RESULT([no])
1047])
1048CFLAGS=$safe_CFLAGS
1049
1050AC_SUBST(FLAG_MAIX32)
1051
1052
sewardj01262142006-01-04 01:20:28 +00001053# does this compiler support -m64 ?
1054AC_MSG_CHECKING([if gcc accepts -m64])
1055
1056safe_CFLAGS=$CFLAGS
1057CFLAGS="-m64"
1058
1059AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001060 return 0;
sewardj01262142006-01-04 01:20:28 +00001061],
1062[
1063FLAG_M64="-m64"
1064AC_MSG_RESULT([yes])
1065], [
1066FLAG_M64=""
1067AC_MSG_RESULT([no])
1068])
1069CFLAGS=$safe_CFLAGS
1070
1071AC_SUBST(FLAG_M64)
1072
1073
sewardj03d86f22006-10-17 00:57:24 +00001074# does this compiler support -maix64 ?
1075AC_MSG_CHECKING([if gcc accepts -maix64])
1076
1077safe_CFLAGS=$CFLAGS
1078CFLAGS="-maix64"
1079
1080AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001081 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001082],
1083[
1084FLAG_MAIX64="-maix64"
1085AC_MSG_RESULT([yes])
1086], [
1087FLAG_MAIX64=""
1088AC_MSG_RESULT([no])
1089])
1090CFLAGS=$safe_CFLAGS
1091
1092AC_SUBST(FLAG_MAIX64)
1093
1094
sewardj67f1fcc2005-07-03 10:41:02 +00001095# does this compiler support -mmmx ?
1096AC_MSG_CHECKING([if gcc accepts -mmmx])
1097
1098safe_CFLAGS=$CFLAGS
1099CFLAGS="-mmmx"
1100
1101AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001102 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001103],
1104[
1105FLAG_MMMX="-mmmx"
1106AC_MSG_RESULT([yes])
1107], [
1108FLAG_MMMX=""
1109AC_MSG_RESULT([no])
1110])
1111CFLAGS=$safe_CFLAGS
1112
1113AC_SUBST(FLAG_MMMX)
1114
1115
1116# does this compiler support -msse ?
1117AC_MSG_CHECKING([if gcc accepts -msse])
1118
1119safe_CFLAGS=$CFLAGS
1120CFLAGS="-msse"
1121
1122AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001123 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001124],
1125[
1126FLAG_MSSE="-msse"
1127AC_MSG_RESULT([yes])
1128], [
1129FLAG_MSSE=""
1130AC_MSG_RESULT([no])
1131])
1132CFLAGS=$safe_CFLAGS
1133
1134AC_SUBST(FLAG_MSSE)
1135
1136
sewardj5b754b42002-06-03 22:53:35 +00001137# does this compiler support -mpreferred-stack-boundary=2 ?
1138AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1139
daywalker3664f562003-10-17 13:43:46 +00001140safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001141CFLAGS="-mpreferred-stack-boundary=2"
1142
1143AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001144 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001145],
1146[
1147PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001148AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001149], [
1150PREFERRED_STACK_BOUNDARY=""
1151AC_MSG_RESULT([no])
1152])
daywalker3664f562003-10-17 13:43:46 +00001153CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001154
1155AC_SUBST(PREFERRED_STACK_BOUNDARY)
1156
sewardj535c50f2005-06-04 23:14:53 +00001157
sewardjb5f6f512005-03-10 23:59:00 +00001158# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001159AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001160
1161safe_CFLAGS=$CFLAGS
1162CFLAGS="-Wno-pointer-sign"
1163
1164AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001165 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001166],
1167[
1168no_pointer_sign=yes
1169AC_MSG_RESULT([yes])
1170], [
1171no_pointer_sign=no
1172AC_MSG_RESULT([no])
1173])
1174CFLAGS=$safe_CFLAGS
1175
1176if test x$no_pointer_sign = xyes; then
1177 CFLAGS="$CFLAGS -Wno-pointer-sign"
1178fi
1179
sewardj535c50f2005-06-04 23:14:53 +00001180
barte026bd22009-07-04 12:17:07 +00001181# does this compiler support -Wno-empty-body ?
1182
1183AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1184
1185safe_CFLAGS=$CFLAGS
1186CFLAGS="-Wno-empty-body"
1187
1188AC_TRY_COMPILE(
1189[ ],
1190[
1191 return 0;
1192],
1193[
1194AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1195AC_MSG_RESULT([yes])
1196],
1197[
1198AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1199AC_MSG_RESULT([no])
1200])
1201CFLAGS=$safe_CFLAGS
1202
1203
bart9d865fa2008-06-23 12:11:49 +00001204# does this compiler support -Wno-format-zero-length ?
1205
1206AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1207
1208safe_CFLAGS=$CFLAGS
1209CFLAGS="-Wno-format-zero-length"
1210
1211AC_TRY_COMPILE(
1212[ ],
1213[
1214 return 0;
1215],
1216[
1217AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1218AC_MSG_RESULT([yes])
1219],
1220[
1221AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1222AC_MSG_RESULT([no])
1223])
1224CFLAGS=$safe_CFLAGS
1225
1226
bartbf9b85c2009-08-12 12:55:56 +00001227# does this compiler support -Wno-uninitialized ?
1228
1229AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1230
1231safe_CFLAGS=$CFLAGS
1232CFLAGS="-Wno-uninitialized"
1233
1234AC_TRY_COMPILE(
1235[ ],
1236[
1237 return 0;
1238],
1239[
1240AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1241AC_MSG_RESULT([yes])
1242],
1243[
1244AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1245AC_MSG_RESULT([no])
1246])
1247CFLAGS=$safe_CFLAGS
1248
1249
bart56730cd2008-05-11 06:41:46 +00001250# does this compiler support -Wextra or the older -W ?
1251
1252AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1253
1254safe_CFLAGS=$CFLAGS
1255CFLAGS="-Wextra"
1256
1257AC_TRY_COMPILE(
1258[ ],
1259[
1260 return 0;
1261],
1262[
1263AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1264AC_MSG_RESULT([-Wextra])
1265], [
1266 CFLAGS="-W"
1267 AC_TRY_COMPILE(
1268 [ ],
1269 [
1270 return 0;
1271 ],
1272 [
1273 AC_SUBST([FLAG_W_EXTRA], [-W])
1274 AC_MSG_RESULT([-W])
1275 ], [
1276 AC_SUBST([FLAG_W_EXTRA], [])
1277 AC_MSG_RESULT([not supported])
1278 ])
1279])
1280CFLAGS=$safe_CFLAGS
1281
1282
sewardja72c26d2007-05-01 13:44:08 +00001283# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001284AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001285
1286safe_CFLAGS=$CFLAGS
1287CFLAGS="-fno-stack-protector"
1288
1289AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001290 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001291],
1292[
1293no_stack_protector=yes
1294FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1295AC_MSG_RESULT([yes])
1296], [
1297no_stack_protector=no
1298FLAG_FNO_STACK_PROTECTOR=""
1299AC_MSG_RESULT([no])
1300])
1301CFLAGS=$safe_CFLAGS
1302
1303AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1304
1305if test x$no_stack_protector = xyes; then
1306 CFLAGS="$CFLAGS -fno-stack-protector"
1307fi
1308
1309
bart56730cd2008-05-11 06:41:46 +00001310# does this compiler support --param inline-unit-growth=... ?
1311
1312AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1313
1314safe_CFLAGS=$CFLAGS
1315CFLAGS="--param inline-unit-growth=900"
1316
1317AC_TRY_COMPILE(
1318[ ],
1319[
1320 return 0;
1321],
1322[
1323AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1324 ["--param inline-unit-growth=900"])
1325AC_MSG_RESULT([yes])
1326], [
1327AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1328AC_MSG_RESULT([no])
1329])
1330CFLAGS=$safe_CFLAGS
1331
1332
sewardjd3645802010-06-13 22:13:58 +00001333# does the linker support -Wl,--build-id=none ? Note, it's
1334# important that we test indirectly via whichever C compiler
1335# is selected, rather than testing /usr/bin/ld or whatever
1336# directly.
bart699fbac2010-06-08 18:23:59 +00001337
sewardjd3645802010-06-13 22:13:58 +00001338AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
bart699fbac2010-06-08 18:23:59 +00001339
1340safe_CFLAGS=$CFLAGS
1341CFLAGS="-Wl,--build-id=none"
1342
bart8508c752010-06-10 06:26:21 +00001343AC_LINK_IFELSE(
1344[AC_LANG_PROGRAM([ ], [return 0;])],
bart699fbac2010-06-08 18:23:59 +00001345[
1346 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1347 AC_MSG_RESULT([yes])
1348], [
1349 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1350 AC_MSG_RESULT([no])
1351])
1352CFLAGS=$safe_CFLAGS
1353
1354
sewardj00f1e622006-03-12 16:47:10 +00001355# does the ppc assembler support "mtocrf" et al?
1356AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1357
1358AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001359__asm__ __volatile__("mtocrf 4,0");
1360__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001361],
1362[
1363ac_have_as_ppc_mftocrf=yes
1364AC_MSG_RESULT([yes])
1365], [
1366ac_have_as_ppc_mftocrf=no
1367AC_MSG_RESULT([no])
1368])
1369if test x$ac_have_as_ppc_mftocrf = xyes ; then
1370 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1371fi
1372
1373
sewardjf0aabf82007-03-22 00:24:21 +00001374# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001375# Note, this doesn't generate a C-level symbol. It generates a
1376# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001377AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1378
1379AC_TRY_COMPILE(, [
1380 do { long long int x;
1381 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1382 while (0)
1383],
1384[
1385ac_have_as_sse3=yes
1386AC_MSG_RESULT([yes])
1387], [
1388ac_have_as_sse3=no
1389AC_MSG_RESULT([no])
1390])
sewardjfa18a262007-03-22 12:13:13 +00001391
1392AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001393
1394
sewardj6d6da5b2008-02-09 12:07:40 +00001395# Ditto for SSSE3 instructions (note extra S)
1396# Note, this doesn't generate a C-level symbol. It generates a
1397# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1398AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1399
1400AC_TRY_COMPILE(, [
1401 do { long long int x;
1402 __asm__ __volatile__(
1403 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1404 while (0)
1405],
1406[
1407ac_have_as_ssse3=yes
1408AC_MSG_RESULT([yes])
1409], [
1410ac_have_as_ssse3=no
1411AC_MSG_RESULT([no])
1412])
1413
1414AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1415
1416
sewardjb5f6f512005-03-10 23:59:00 +00001417# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001418if test "x${cross_compiling}" = "xno"; then
1419# Native compilation: check whether running a program using TLS succeeds.
1420# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1421# succeeds but running programs using TLS fails.
1422AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1423 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1424 [vg_cv_tls=$enableval],
1425 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1426 [[return foo;]])],
1427 [vg_cv_tls=yes],
1428 [vg_cv_tls=no])])])
1429else
1430# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001431AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1432 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1433 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001434 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001435 [[return foo;]])],
1436 [vg_cv_tls=yes],
1437 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001438fi
sewardjb5f6f512005-03-10 23:59:00 +00001439
1440if test "$vg_cv_tls" = yes; then
1441AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1442fi
sewardj5b754b42002-06-03 22:53:35 +00001443
sewardj535c50f2005-06-04 23:14:53 +00001444
njn7fd6d382009-01-22 21:56:32 +00001445#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001446# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001447#----------------------------------------------------------------------------
1448
sewardjde4a1d02002-03-22 01:27:54 +00001449AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001450AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001451 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001452 endian.h \
1453 mqueue.h \
1454 sys/endian.h \
1455 sys/epoll.h \
1456 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001457 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001458 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001459 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001460 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001461 sys/syscall.h \
1462 sys/time.h \
1463 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001464 ])
sewardjde4a1d02002-03-22 01:27:54 +00001465
njn7fd6d382009-01-22 21:56:32 +00001466#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001467# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001468#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001469AC_TYPE_UID_T
1470AC_TYPE_OFF_T
1471AC_TYPE_SIZE_T
1472AC_HEADER_TIME
1473
sewardj535c50f2005-06-04 23:14:53 +00001474
njn7fd6d382009-01-22 21:56:32 +00001475#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001476# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001477#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001478AC_FUNC_MEMCMP
1479AC_FUNC_MMAP
1480AC_TYPE_SIGNAL
1481
bart71bad292008-04-27 11:43:23 +00001482AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001483
bartf5ceec82008-04-26 07:45:10 +00001484AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001485 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001486 epoll_create \
1487 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001488 floor \
bartce48fa92008-04-26 10:59:46 +00001489 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001490 mallinfo \
1491 memchr \
1492 memset \
1493 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001494 mremap \
bartf5ceec82008-04-26 07:45:10 +00001495 ppoll \
bart6d45e922009-01-20 13:45:38 +00001496 pthread_barrier_init \
1497 pthread_condattr_setclock \
1498 pthread_mutex_timedlock \
1499 pthread_rwlock_timedrdlock \
1500 pthread_rwlock_timedwrlock \
1501 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001502 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001503 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001504 semtimedop \
1505 signalfd \
njn6cc22472009-03-16 03:46:48 +00001506 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001507 strchr \
1508 strdup \
1509 strpbrk \
1510 strrchr \
1511 strstr \
barta72a27b2010-04-29 06:22:17 +00001512 syscall \
bartf5ceec82008-04-26 07:45:10 +00001513 timerfd \
1514 utimensat \
1515 ])
sewardjde4a1d02002-03-22 01:27:54 +00001516
bart623eec32008-07-29 17:54:49 +00001517# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1518# libraries with any shared object and/or executable. This is NOT what we
1519# want for e.g. vgpreload_core-x86-linux.so
1520LIBS=""
sewardj80637752006-03-02 13:48:21 +00001521
bart6d45e922009-01-20 13:45:38 +00001522AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1523 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001524AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1525 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001526AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1527 [test x$ac_cv_func_pthread_spin_lock = xyes])
1528
njn7fd6d382009-01-22 21:56:32 +00001529
1530#----------------------------------------------------------------------------
1531# MPI checks
1532#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001533# Do we have a useable MPI setup on the primary and/or secondary targets?
1534# On Linux, by default, assumes mpicc and -m32/-m64
1535# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001536# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001537# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1538# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001539MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001540if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1541 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001542 MPI_CC="mpxlc"
1543fi
1544
sewardje9fa5062006-03-12 18:29:18 +00001545mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001546if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1547 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001548 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001549elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1550 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001551 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001552elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001553 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001554elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001555 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001556fi
1557
sewardj03d86f22006-10-17 00:57:24 +00001558mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001559if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1560 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001561 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001562elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001563 mflag_secondary=-q32
1564fi
1565
1566
sewardj0ad46092006-03-02 17:09:16 +00001567AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001568 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001569 MPI_CC=$withval
1570)
sewardj03d86f22006-10-17 00:57:24 +00001571AC_SUBST(MPI_CC)
1572
1573## See if MPI_CC works for the primary target
1574##
1575AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001576saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001577saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001578CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001579CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001580AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001581#include <mpi.h>
1582#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001583],[
1584 int r = MPI_Init(NULL,NULL);
1585 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1586 return r;
1587], [
sewardj03d86f22006-10-17 00:57:24 +00001588ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001589AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001590], [
sewardj03d86f22006-10-17 00:57:24 +00001591ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001592AC_MSG_RESULT([no])
1593])
sewardj0ad46092006-03-02 17:09:16 +00001594CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001595CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001596AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001597
sewardj03d86f22006-10-17 00:57:24 +00001598## See if MPI_CC works for the secondary target. Complication: what if
1599## there is no secondary target? We need this to then fail.
1600## Kludge this by making MPI_CC something which will surely fail in
1601## such a case.
1602##
1603AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1604saved_CC=$CC
1605saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001606if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001607 CC="$MPI_CC this will surely fail"
1608else
1609 CC=$MPI_CC
1610fi
1611CFLAGS=$mflag_secondary
1612AC_TRY_LINK([
1613#include <mpi.h>
1614#include <stdio.h>
1615],[
1616 int r = MPI_Init(NULL,NULL);
1617 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1618 return r;
1619], [
1620ac_have_mpi2_sec=yes
1621AC_MSG_RESULT([yes, $MPI_CC])
1622], [
1623ac_have_mpi2_sec=no
1624AC_MSG_RESULT([no])
1625])
1626CC=$saved_CC
1627CFLAGS=$saved_CFLAGS
1628AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001629
1630
njn7fd6d382009-01-22 21:56:32 +00001631#----------------------------------------------------------------------------
1632# Other library checks
1633#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001634# There now follow some tests for QtCore, Boost, and OpenMP. These
1635# tests are present because Drd has some regression tests that use
1636# these packages. All regression test programs all compiled only
1637# for the primary target. And so it is important that the configure
1638# checks that follow, use the correct -m32 or -m64 flag for the
1639# primary target (called $mflag_primary). Otherwise, we can end up
1640# in a situation (eg) where, on amd64-linux, the test for Boost checks
1641# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1642# only build (meaning, the primary target is x86-linux), the build
1643# of the regtest programs that use Boost fails, because they are
1644# build as 32-bit (IN THIS EXAMPLE).
1645#
1646# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1647# NEEDED BY THE REGRESSION TEST PROGRAMS.
1648
1649
bart21d3cfc2008-08-02 09:08:17 +00001650# The test below verifies whether the QtCore package been installed.
1651# This test works as follows:
1652# - If pkg-config was not installed at the time autogen.sh was run,
1653# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1654# autogen.sh. Augogen.sh will generate a configure script that prints
1655# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1656# - If pkg-config was installed at the time autogen.sh was run,
1657# the generated configure script will try to detect the presence of the
1658# Qt4 QtCore library by looking up compile and linker flags in the file
1659# called QtCore.pc.
1660# - pkg-config settings can be overridden via the configure variables
1661# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1662# configure script -- see also ./configure --help).
1663# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1664# the pkg-config executable is not present on the system on which the
1665# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001666
bart21d3cfc2008-08-02 09:08:17 +00001667ifdef(
1668 [PKG_CHECK_EXISTS],
1669 [PKG_CHECK_EXISTS(
1670 [QtCore],
1671 [
1672 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001673 # Paranoia: don't trust the result reported by pkg-config, but when
1674 # pkg-config reports that QtCore has been found, verify whether linking
1675 # programs with QtCore succeeds.
1676 AC_LANG(C++)
1677 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001678 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001679 AC_TRY_LINK(
1680 [#include <QMutex>],
1681 [QMutex Mutex;],
1682 [ac_have_qtcore=yes],
1683 [
1684 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1685 ac_have_qtcore=no
1686 ]
1687 )
1688 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001689 ],
1690 [
1691 ac_have_qtcore=no
1692 ]
1693 )
1694 ],
1695 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1696 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1697 [ac_have_qtcore=no]
1698)
bart41ac62a2008-07-07 16:58:03 +00001699
1700AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1701
1702
bart62f54e42008-07-28 11:35:10 +00001703# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1704# See also http://doc.trolltech.com/4.3/qmutex.html.
1705if test x$ac_have_qtcore = xyes; then
1706 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1707 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001708 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001709 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001710 AC_TRY_COMPILE([
1711 #include <QtCore/QMutex>
1712 ],
1713 [
1714 QMutex M;
1715 M.tryLock(1);
1716 M.unlock();
1717 return 0;
1718 ],
1719 [
1720 AC_MSG_RESULT([yes])
1721 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1722 ],
1723 [
1724 AC_MSG_RESULT([no])
1725 ])
bart21d3cfc2008-08-02 09:08:17 +00001726 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001727 AC_LANG(C)
1728fi
1729
1730
bart4f43e002009-11-09 16:07:43 +00001731# Test for QAtomicInt, which has been introduced in Qt 4.4.
1732# See also http://doc.trolltech.com/4.4/qatomicint.html.
1733if test x$ac_have_qtcore = xyes; then
bart9da08ba2009-11-11 19:22:05 +00001734 AC_MSG_CHECKING([for Qt4 QAtomicInt])
bart4f43e002009-11-09 16:07:43 +00001735 AC_LANG(C++)
1736 safe_CXXFLAGS="${CXXFLAGS}"
1737 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1738 AC_TRY_COMPILE([
1739 #include <QtCore/QAtomicInt>
1740 ],
1741 [
1742 QAtomicInt I;
1743 I.testAndSetOrdered(0, 1);
1744 return 0;
1745 ],
1746 [
1747 ac_have_qtcore_qatomicint=yes
1748 AC_MSG_RESULT([yes])
1749 AC_DEFINE([HAVE_QTCORE_QATOMICINT], [1], [Define to 1 if the installed version of Qt4 provides QAtomicInt.])
1750 ],
1751 [
1752 ac_have_qtcore_qatomicint=no
1753 AC_MSG_RESULT([no])
1754 ])
1755 CXXFLAGS="${safe_CXXFLAGS}"
1756 AC_LANG(C)
1757fi
1758
1759AM_CONDITIONAL([HAVE_QTCORE_QATOMICINT], [test x$ac_have_qtcore_qatomicint = xyes])
1760
1761
1762
sewardj493c4ef2008-12-13 16:45:19 +00001763# Check whether the boost library 1.35 or later has been installed.
1764# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1765
1766AC_MSG_CHECKING([for boost])
1767
1768AC_LANG(C++)
1769safe_CXXFLAGS=$CXXFLAGS
1770CXXFLAGS="-lboost_thread-mt $mflag_primary"
1771
1772AC_LINK_IFELSE(
1773[
1774#include <boost/thread.hpp>
1775static void thread_func(void)
1776{ }
1777int main(int argc, char** argv)
1778{
1779 boost::thread t(thread_func);
1780 return 0;
1781}
1782],
1783[
1784ac_have_boost_1_35=yes
1785AC_SUBST([BOOST_CFLAGS], [])
1786AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1787AC_MSG_RESULT([yes])
1788], [
1789ac_have_boost_1_35=no
1790AC_MSG_RESULT([no])
1791])
1792
1793CXXFLAGS=$safe_CXXFLAGS
1794AC_LANG(C)
1795
1796AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1797
1798
1799# does this compiler support -fopenmp, does it have the include file
1800# <omp.h> and does it have libgomp ?
1801
1802AC_MSG_CHECKING([for OpenMP])
1803
1804safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001805CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001806
1807AC_LINK_IFELSE(
1808[
1809#include <omp.h>
1810int main(int argc, char** argv)
1811{
1812 omp_set_dynamic(0);
1813 return 0;
1814}
1815],
1816[
1817ac_have_openmp=yes
1818AC_MSG_RESULT([yes])
1819], [
1820ac_have_openmp=no
1821AC_MSG_RESULT([no])
1822])
1823CFLAGS=$safe_CFLAGS
1824
1825AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1826
1827
sewardjc876a2f2009-01-22 22:44:30 +00001828# does this compiler have built-in functions for atomic memory access ?
1829AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1830
1831safe_CFLAGS=$CFLAGS
1832CFLAGS="$mflag_primary"
1833
1834AC_TRY_LINK(,
1835[
1836 int variable = 1;
1837 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1838 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1839],
1840[
bartc82d1372009-05-31 16:21:23 +00001841 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001842 AC_MSG_RESULT([yes])
1843 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1844],
1845[
bartc82d1372009-05-31 16:21:23 +00001846 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001847 AC_MSG_RESULT([no])
1848])
1849
1850CFLAGS=$safe_CFLAGS
1851
bartc82d1372009-05-31 16:21:23 +00001852AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1853
sewardjc876a2f2009-01-22 22:44:30 +00001854
njn7fd6d382009-01-22 21:56:32 +00001855#----------------------------------------------------------------------------
1856# Ok. We're done checking.
1857#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001858
njn8b68b642009-06-24 00:37:09 +00001859# Nb: VEX/Makefile is generated from Makefile.vex.in.
1860AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001861 Makefile
njn8b68b642009-06-24 00:37:09 +00001862 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001863 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001864 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001865 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001866 docs/Makefile
1867 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001868 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001869 perf/Makefile
1870 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001871 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001872 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001873 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001874 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001875 memcheck/Makefile
1876 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001877 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001878 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001879 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001880 memcheck/tests/darwin/Makefile
njnea2d6fd2010-07-01 00:20:20 +00001881 memcheck/tests/amd64-linux/Makefile
njna454ec02009-01-19 03:16:59 +00001882 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001883 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001884 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001885 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001886 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00001887 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00001888 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00001889 callgrind/Makefile
1890 callgrind/callgrind_annotate
1891 callgrind/callgrind_control
1892 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001893 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001894 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001895 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001896 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001897 massif/perf/Makefile
njnd5a8d242007-11-02 20:44:57 +00001898 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001899 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001900 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001901 none/Makefile
1902 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001903 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001904 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001905 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001906 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00001907 none/tests/arm/Makefile
njn0458a122009-02-13 06:23:46 +00001908 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001909 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001910 none/tests/x86-linux/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001911 exp-ptrcheck/Makefile
1912 exp-ptrcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00001913 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00001914 drd/scripts/download-and-build-splash2
1915 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001916 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00001917 exp-bbv/tests/Makefile
1918 exp-bbv/tests/x86/Makefile
1919 exp-bbv/tests/x86-linux/Makefile
1920 exp-bbv/tests/amd64-linux/Makefile
1921 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00001922 exp-bbv/tests/arm-linux/Makefile
njn8b68b642009-06-24 00:37:09 +00001923])
sewardjd3645802010-06-13 22:13:58 +00001924AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
1925 [chmod +x coregrind/link_tool_exe_linux])
1926AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
1927 [chmod +x coregrind/link_tool_exe_darwin])
1928AC_CONFIG_FILES([coregrind/link_tool_exe_aix5],
1929 [chmod +x coregrind/link_tool_exe_aix5])
njn8b68b642009-06-24 00:37:09 +00001930AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001931
1932cat<<EOF
1933
njn311303f2009-02-06 03:46:50 +00001934 Maximum build arch: ${ARCH_MAX}
1935 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001936 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001937 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001938 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1939 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001940 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001941
gobry3b777892002-04-04 09:18:39 +00001942EOF