blob: 65597205efc65a1bc74815762c4ca93ba4ce61fc [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"
257
258 AC_MSG_CHECKING([for the kernel version])
259 kernel=`uname -r`
260
261 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
262 # has only one relevant version, the OS version. The `uname` check
263 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
264 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
265 # Snow Leopard and darwin10.supp), and we don't know of an macros
266 # similar to __GLIBC__ to get that info.
267 #
268 # XXX: `uname -r` won't do the right thing for cross-compiles, but
269 # that's not a problem yet.
270 case "${kernel}" in
271 9.*)
272 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
273 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000274 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000275 ;;
276 *)
277 AC_MSG_RESULT([unsupported (${kernel})])
278 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
279 ;;
280 esac
281 ;;
282
sewardjde4a1d02002-03-22 01:27:54 +0000283 *)
284 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000285 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000286 ;;
287esac
288
njn7fd6d382009-01-22 21:56:32 +0000289#----------------------------------------------------------------------------
290
tomd6398392006-06-07 17:44:36 +0000291# If we are building on a 64 bit platform test to see if the system
292# supports building 32 bit programs and disable 32 bit support if it
293# does not support building 32 bit programs
294
njn7fd6d382009-01-22 21:56:32 +0000295case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000296 amd64-linux|ppc64-linux)
297 AC_MSG_CHECKING([for 32 bit build support])
298 safe_CFLAGS=$CFLAGS
299 CFLAGS="-m32"
300 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000301 return 0;
tomd6398392006-06-07 17:44:36 +0000302 ],
303 [
304 AC_MSG_RESULT([yes])
305 ], [
306 vg_cv_only64bit="yes"
307 AC_MSG_RESULT([no])
308 ])
309 CFLAGS=$safe_CFLAGS;;
310esac
311
312if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
313 AC_MSG_ERROR(
314 [--enable-only32bit was specified but system does not support 32 bit builds])
315fi
nethercote888ecb72004-08-23 14:54:40 +0000316
njn7fd6d382009-01-22 21:56:32 +0000317#----------------------------------------------------------------------------
318
njn311303f2009-02-06 03:46:50 +0000319# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
320# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
321# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
322# above) will be "amd64" since that reflects the most that this cpu can do,
323# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
324# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000325# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
326# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
327AC_SUBST(VGCONF_ARCH_PRI)
328
njn3f8a6e92009-06-02 00:20:47 +0000329# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
330# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
331# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
332# It is empty if there is no secondary target.
333AC_SUBST(VGCONF_ARCH_SEC)
334
njn311303f2009-02-06 03:46:50 +0000335# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
336# The entire system, including regression and performance tests, will be
337# built for this target. The "_CAPS" indicates that the name is in capital
338# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000339# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000340# convention and cannot contain '-' characters. This is in contrast to
341# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000342AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
343
344# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
345# Valgrind and tools will also be built for this target, but not the
346# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000347#
njn7fd6d382009-01-22 21:56:32 +0000348# By default, the primary arch is the same as the "max" arch, as commented
349# above (at the definition of ARCH_MAX). We may choose to downgrade it in
350# the big case statement just below here, in the case where we're building
351# on a 64 bit machine but have been requested only to do a 32 bit build.
352AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
353
sewardj01262142006-01-04 01:20:28 +0000354AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000355
njn7fd6d382009-01-22 21:56:32 +0000356case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000357 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000358 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000359 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000360 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
361 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000362 valt_load_address_normal="0x38000000"
363 valt_load_address_inner="0x28000000"
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)
sewardj86e992f2006-01-28 18:39:09 +0000367 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000368 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000369 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000370 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
371 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000372 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000373 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000374 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000375 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
376 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000377 else
njn7fd6d382009-01-22 21:56:32 +0000378 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000379 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000380 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
381 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000382 fi
njnd74b0ef2009-01-20 06:06:52 +0000383 valt_load_address_normal="0x38000000"
384 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000385 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000386 ;;
387 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000388 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000389 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000390 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
391 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000392 valt_load_address_normal="0x38000000"
393 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000394 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000395 ;;
sewardj03d86f22006-10-17 00:57:24 +0000396 ppc64-aix5)
397 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000398 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000399 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000400 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
401 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000402 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000403 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000404 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000405 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
406 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000407 else
njn7fd6d382009-01-22 21:56:32 +0000408 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000409 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000410 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
411 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000412 fi
njnd74b0ef2009-01-20 06:06:52 +0000413 valt_load_address_normal="0x38000000"
414 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000415 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000416 ;;
sewardj01262142006-01-04 01:20:28 +0000417 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000418 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000419 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000420 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000421 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
422 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000423 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000424 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000425 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000426 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
427 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000428 else
njn7fd6d382009-01-22 21:56:32 +0000429 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000430 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000431 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
432 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000433 fi
njnd74b0ef2009-01-20 06:06:52 +0000434 valt_load_address_normal="0x38000000"
435 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000436 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000437 ;;
njnf76d27a2009-05-28 01:53:07 +0000438 x86-darwin)
439 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000440 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000441 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
442 VGCONF_PLATFORM_SEC_CAPS=""
443 valt_load_address_normal="0x0"
444 valt_load_address_inner="0x0"
445 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
446 ;;
447 amd64-darwin)
448 if test x$vg_cv_only64bit = xyes; then
449 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000450 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000451 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
452 VGCONF_PLATFORM_SEC_CAPS=""
453 elif test x$vg_cv_only32bit = xyes; then
454 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000455 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000456 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
457 VGCONF_PLATFORM_SEC_CAPS=""
458 VGCONF_ARCH_PRI_CAPS="x86"
459 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"
464 fi
465 valt_load_address_normal="0x0"
466 valt_load_address_inner="0x0"
467 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
468 ;;
sewardj59570ff2010-01-01 11:59:33 +0000469 arm-linux)
470 VGCONF_ARCH_PRI="arm"
471 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
472 VGCONF_PLATFORM_SEC_CAPS=""
473 valt_load_address_normal="0x38000000"
474 valt_load_address_inner="0x28000000"
475 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
476 ;;
nethercote888ecb72004-08-23 14:54:40 +0000477 *)
njn7fd6d382009-01-22 21:56:32 +0000478 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000479 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000480 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
481 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njn377c43f2009-05-19 07:39:22 +0000482 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000483 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000484 ;;
485esac
sewardjde4a1d02002-03-22 01:27:54 +0000486
njn7fd6d382009-01-22 21:56:32 +0000487#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000488
njn7fd6d382009-01-22 21:56:32 +0000489# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
490# defined.
491AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
492 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000493 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
494 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
495 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000496AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000497 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
498 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000499AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
500 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
501 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
502 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
503 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
504AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
505 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
506 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj59570ff2010-01-01 11:59:33 +0000507AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
508 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
sewardj03d86f22006-10-17 00:57:24 +0000509
njn7fd6d382009-01-22 21:56:32 +0000510# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
511# become defined.
512AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
513 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
514 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
515AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
516 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
517AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
518 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
519 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
520AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
521 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
sewardj59570ff2010-01-01 11:59:33 +0000522AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
523 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000524
njn7fd6d382009-01-22 21:56:32 +0000525AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
526 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
527 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
528AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
529 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
530
njnf76d27a2009-05-28 01:53:07 +0000531AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
532 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
533 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
534AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
535 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
536
537
njn7fd6d382009-01-22 21:56:32 +0000538# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000539# Relies on the assumption that the primary and secondary targets are
540# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000541AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
542 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
543 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
544 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
sewardj59570ff2010-01-01 11:59:33 +0000545 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
546 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
njn7fd6d382009-01-22 21:56:32 +0000547AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
548 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
549 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000550AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
551 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
552 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000553
554
njn7fd6d382009-01-22 21:56:32 +0000555# Sometimes, in the Makefile.am files, it's useful to know whether or not
556# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000557AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000558 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000559
tomb637bad2005-11-08 12:28:35 +0000560
njn7fd6d382009-01-22 21:56:32 +0000561#----------------------------------------------------------------------------
562# Inner Valgrind?
563#----------------------------------------------------------------------------
564
njnd74b0ef2009-01-20 06:06:52 +0000565# Check if this should be built as an inner Valgrind, to be run within
566# another Valgrind. Choose the load address accordingly.
567AC_SUBST(VALT_LOAD_ADDRESS)
568AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
569 [AC_ARG_ENABLE(inner,
570 [ --enable-inner enables self-hosting],
571 [vg_cv_inner=$enableval],
572 [vg_cv_inner=no])])
573if test "$vg_cv_inner" = yes; then
574 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
575 VALT_LOAD_ADDRESS=$valt_load_address_inner
576else
577 VALT_LOAD_ADDRESS=$valt_load_address_normal
578fi
579
580
njn7fd6d382009-01-22 21:56:32 +0000581#----------------------------------------------------------------------------
582# Libc and suppressions
583#----------------------------------------------------------------------------
584# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000585AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000586
bart12e91122010-05-15 08:37:24 +0000587AC_CHECK_HEADER([features.h])
sewardjde4a1d02002-03-22 01:27:54 +0000588
bart12e91122010-05-15 08:37:24 +0000589if test x$ac_cv_header_features_h = xyes; then
590 rm -f conftest.$ac_ext
591 cat <<_ACEOF >conftest.$ac_ext
sewardjde4a1d02002-03-22 01:27:54 +0000592#include <features.h>
bart12e91122010-05-15 08:37:24 +0000593#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
594glibc version is: __GLIBC__ __GLIBC_MINOR__
sewardjde4a1d02002-03-22 01:27:54 +0000595#endif
bart12e91122010-05-15 08:37:24 +0000596_ACEOF
597 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
598fi
bartb7c3f082010-05-13 06:32:36 +0000599
sewardj03d86f22006-10-17 00:57:24 +0000600AC_EGREP_CPP([AIX5_LIBC], [
601#include <standards.h>
602#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
603 AIX5_LIBC
604#endif
605],
dirk07596a22008-04-25 11:33:30 +0000606GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000607
njnf76d27a2009-05-28 01:53:07 +0000608# not really a version check
609AC_EGREP_CPP([DARWIN_LIBC], [
610#include <sys/cdefs.h>
611#if defined(__DARWIN_VERS_1050)
612 DARWIN_LIBC
613#endif
614],
615GLIBC_VERSION="darwin")
616
dirk07596a22008-04-25 11:33:30 +0000617AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000618
dirk07596a22008-04-25 11:33:30 +0000619case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000620 2.2)
621 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000622 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000623 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
624 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000625 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000626 ;;
627
sewardj08c7f012002-10-07 23:56:55 +0000628 2.3)
629 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000630 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000631 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000632 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000633 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000634 ;;
635
njn781dba52005-06-30 04:06:38 +0000636 2.4)
637 AC_MSG_RESULT(2.4 family)
638 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000639 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000640 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000641 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000642 ;;
643
dirkaece45c2006-10-12 08:17:49 +0000644 2.5)
645 AC_MSG_RESULT(2.5 family)
646 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000647 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000648 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000649 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000650 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000651 2.6)
652 AC_MSG_RESULT(2.6 family)
653 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000654 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000655 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000656 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000657 ;;
658 2.7)
659 AC_MSG_RESULT(2.7 family)
660 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000661 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000662 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000663 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000664 ;;
dirk07596a22008-04-25 11:33:30 +0000665 2.8)
666 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000667 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000668 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
669 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
670 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
671 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000672 2.9)
673 AC_MSG_RESULT(2.9 family)
674 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
675 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
676 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
677 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
678 ;;
sewardj5d425e82009-02-01 19:01:11 +0000679 2.10)
680 AC_MSG_RESULT(2.10 family)
681 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
682 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
683 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
684 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
685 ;;
bart0fac7ff2009-11-15 19:11:19 +0000686 2.11)
687 AC_MSG_RESULT(2.11 family)
688 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
689 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
690 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
691 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bartb7c3f082010-05-13 06:32:36 +0000692 ;;
693 2.12)
694 AC_MSG_RESULT(2.12 family)
695 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
696 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
697 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
698 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
bart0fac7ff2009-11-15 19:11:19 +0000699 ;;
sewardj03d86f22006-10-17 00:57:24 +0000700 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000701 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
702 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 +0000703 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
704 ;;
njnf76d27a2009-05-28 01:53:07 +0000705 darwin)
706 AC_MSG_RESULT(Darwin)
707 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
708 # DEFAULT_SUPP set by kernel version check above.
709 ;;
dirkaece45c2006-10-12 08:17:49 +0000710
sewardjde4a1d02002-03-22 01:27:54 +0000711 *)
bart12e91122010-05-15 08:37:24 +0000712 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
bartb7c3f082010-05-13 06:32:36 +0000713 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.12])
dirk07596a22008-04-25 11:33:30 +0000714 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000715 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000716 ;;
717esac
718
dirk07596a22008-04-25 11:33:30 +0000719AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000720
sewardj414f3582008-07-18 20:46:00 +0000721
722# Add default suppressions for the X client libraries. Make no
723# attempt to detect whether such libraries are installed on the
724# build machine (or even if any X facilities are present); just
725# add the suppressions antidisirregardless.
726DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
727DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000728
sewardj5744c022008-10-19 18:58:13 +0000729# Add glibc and X11 suppressions for exp-ptrcheck
730DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
731
sewardj2e10a682003-04-07 19:36:41 +0000732
njn7fd6d382009-01-22 21:56:32 +0000733#----------------------------------------------------------------------------
734# Checking for various library functions and other definitions
735#----------------------------------------------------------------------------
736
bart59e2f182008-04-28 16:22:53 +0000737# Check for CLOCK_MONOTONIC
738
739AC_MSG_CHECKING([for CLOCK_MONOTONIC])
740
741AC_TRY_COMPILE(
742[
743#include <time.h>
744], [
745 struct timespec t;
746 clock_gettime(CLOCK_MONOTONIC, &t);
747 return 0;
748],
749[
750AC_MSG_RESULT([yes])
751AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
752 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
753], [
754AC_MSG_RESULT([no])
755])
756
bartfea06922008-05-03 09:12:15 +0000757
758# Check for PTHREAD_MUTEX_ADAPTIVE_NP
759
760AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
761
762AC_TRY_COMPILE(
763[
764#define _GNU_SOURCE
765#include <pthread.h>
766], [
767 return (PTHREAD_MUTEX_ADAPTIVE_NP);
768],
769[
770AC_MSG_RESULT([yes])
771AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
772 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
773], [
774AC_MSG_RESULT([no])
775])
776
777
778# Check for PTHREAD_MUTEX_ERRORCHECK_NP
779
780AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
781
782AC_TRY_COMPILE(
783[
784#define _GNU_SOURCE
785#include <pthread.h>
786], [
787 return (PTHREAD_MUTEX_ERRORCHECK_NP);
788],
789[
790AC_MSG_RESULT([yes])
791AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
792 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
793], [
794AC_MSG_RESULT([no])
795])
796
797
798# Check for PTHREAD_MUTEX_RECURSIVE_NP
799
800AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
801
802AC_TRY_COMPILE(
803[
804#define _GNU_SOURCE
805#include <pthread.h>
806], [
807 return (PTHREAD_MUTEX_RECURSIVE_NP);
808],
809[
810AC_MSG_RESULT([yes])
811AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
812 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
813], [
814AC_MSG_RESULT([no])
815])
816
817
818# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
819
820AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
821
822AC_TRY_COMPILE(
823[
824#define _GNU_SOURCE
825#include <pthread.h>
826], [
827 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
828 return 0;
829],
830[
831AC_MSG_RESULT([yes])
832AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
833 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
834], [
835AC_MSG_RESULT([no])
836])
837
838
bart5e389f12008-04-05 12:53:15 +0000839# Check whether pthread_mutex_t has a member called __m_kind.
840
bartb11355c2010-04-29 16:37:26 +0000841AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
842 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
843 1,
844 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
845 ],
846 [],
847 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000848
849
850# Check whether pthread_mutex_t has a member called __data.__kind.
851
bartb11355c2010-04-29 16:37:26 +0000852AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
853 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
854 1,
855 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
856 ],
857 [],
858 [#include <pthread.h>])
bart5e389f12008-04-05 12:53:15 +0000859
860
bart62c370e2008-05-12 18:50:51 +0000861# does this compiler support -maltivec and does it have the include file
862# <altivec.h> ?
863
864AC_MSG_CHECKING([for Altivec])
865
866safe_CFLAGS=$CFLAGS
867CFLAGS="-maltivec"
868
869AC_TRY_COMPILE(
870[
871#include <altivec.h>
872], [
873 vector unsigned int v;
874],
875[
876ac_have_altivec=yes
877AC_MSG_RESULT([yes])
878], [
879ac_have_altivec=no
880AC_MSG_RESULT([no])
881])
882CFLAGS=$safe_CFLAGS
883
884AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
885AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
886
887
bart36dd85a2009-04-26 07:11:48 +0000888# Check for pthread_create@GLIBC2.0
889AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
890
bart16e1c5a2009-04-26 07:38:53 +0000891safe_CFLAGS=$CFLAGS
892CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000893AC_TRY_LINK(
894[
895extern int pthread_create_glibc_2_0(void*, const void*,
896 void *(*)(void*), void*);
897__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
898], [
bart276ed3a2009-05-10 15:41:45 +0000899#ifdef __powerpc__
900/*
901 * Apparently on PowerPC linking this program succeeds and generates an
902 * executable with the undefined symbol pthread_create@GLIBC_2.0.
903 */
904#error This test does not work properly on PowerPC.
905#else
bart16e1c5a2009-04-26 07:38:53 +0000906 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000907#endif
bart16e1c5a2009-04-26 07:38:53 +0000908 return 0;
bart36dd85a2009-04-26 07:11:48 +0000909],
910[
911ac_have_pthread_create_glibc_2_0=yes
912AC_MSG_RESULT([yes])
913AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
914 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
915], [
916ac_have_pthread_create_glibc_2_0=no
917AC_MSG_RESULT([no])
918])
bart16e1c5a2009-04-26 07:38:53 +0000919CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000920
921AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000922 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000923
924
barta50aa8a2008-04-27 06:06:57 +0000925# Check for eventfd_t, eventfd() and eventfd_read()
926AC_MSG_CHECKING([for eventfd()])
927
928AC_TRY_LINK(
929[
930#include <sys/eventfd.h>
931], [
932 eventfd_t ev;
933 int fd;
934
935 fd = eventfd(5, 0);
936 eventfd_read(fd, &ev);
937 return 0;
938],
939[
940AC_MSG_RESULT([yes])
941AC_DEFINE([HAVE_EVENTFD], 1,
942 [Define to 1 if you have the `eventfd' function.])
943AC_DEFINE([HAVE_EVENTFD_READ], 1,
944 [Define to 1 if you have the `eventfd_read' function.])
945], [
946AC_MSG_RESULT([no])
947])
948
949
njn7fd6d382009-01-22 21:56:32 +0000950#----------------------------------------------------------------------------
951# Checking for supported compiler flags.
952#----------------------------------------------------------------------------
953
sewardj535c50f2005-06-04 23:14:53 +0000954# does this compiler support -m32 ?
955AC_MSG_CHECKING([if gcc accepts -m32])
956
957safe_CFLAGS=$CFLAGS
958CFLAGS="-m32"
959
960AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000961 return 0;
sewardj535c50f2005-06-04 23:14:53 +0000962],
963[
964FLAG_M32="-m32"
965AC_MSG_RESULT([yes])
966], [
967FLAG_M32=""
968AC_MSG_RESULT([no])
969])
970CFLAGS=$safe_CFLAGS
971
972AC_SUBST(FLAG_M32)
973
974
sewardj03d86f22006-10-17 00:57:24 +0000975# does this compiler support -maix32 ?
976AC_MSG_CHECKING([if gcc accepts -maix32])
977
978safe_CFLAGS=$CFLAGS
979CFLAGS="-maix32"
980
981AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000982 return 0;
sewardj03d86f22006-10-17 00:57:24 +0000983],
984[
985FLAG_MAIX32="-maix32"
986AC_MSG_RESULT([yes])
987], [
988FLAG_MAIX32=""
989AC_MSG_RESULT([no])
990])
991CFLAGS=$safe_CFLAGS
992
993AC_SUBST(FLAG_MAIX32)
994
995
sewardj01262142006-01-04 01:20:28 +0000996# does this compiler support -m64 ?
997AC_MSG_CHECKING([if gcc accepts -m64])
998
999safe_CFLAGS=$CFLAGS
1000CFLAGS="-m64"
1001
1002AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001003 return 0;
sewardj01262142006-01-04 01:20:28 +00001004],
1005[
1006FLAG_M64="-m64"
1007AC_MSG_RESULT([yes])
1008], [
1009FLAG_M64=""
1010AC_MSG_RESULT([no])
1011])
1012CFLAGS=$safe_CFLAGS
1013
1014AC_SUBST(FLAG_M64)
1015
1016
sewardj03d86f22006-10-17 00:57:24 +00001017# does this compiler support -maix64 ?
1018AC_MSG_CHECKING([if gcc accepts -maix64])
1019
1020safe_CFLAGS=$CFLAGS
1021CFLAGS="-maix64"
1022
1023AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001024 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001025],
1026[
1027FLAG_MAIX64="-maix64"
1028AC_MSG_RESULT([yes])
1029], [
1030FLAG_MAIX64=""
1031AC_MSG_RESULT([no])
1032])
1033CFLAGS=$safe_CFLAGS
1034
1035AC_SUBST(FLAG_MAIX64)
1036
1037
sewardj67f1fcc2005-07-03 10:41:02 +00001038# does this compiler support -mmmx ?
1039AC_MSG_CHECKING([if gcc accepts -mmmx])
1040
1041safe_CFLAGS=$CFLAGS
1042CFLAGS="-mmmx"
1043
1044AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001045 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001046],
1047[
1048FLAG_MMMX="-mmmx"
1049AC_MSG_RESULT([yes])
1050], [
1051FLAG_MMMX=""
1052AC_MSG_RESULT([no])
1053])
1054CFLAGS=$safe_CFLAGS
1055
1056AC_SUBST(FLAG_MMMX)
1057
1058
1059# does this compiler support -msse ?
1060AC_MSG_CHECKING([if gcc accepts -msse])
1061
1062safe_CFLAGS=$CFLAGS
1063CFLAGS="-msse"
1064
1065AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001066 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001067],
1068[
1069FLAG_MSSE="-msse"
1070AC_MSG_RESULT([yes])
1071], [
1072FLAG_MSSE=""
1073AC_MSG_RESULT([no])
1074])
1075CFLAGS=$safe_CFLAGS
1076
1077AC_SUBST(FLAG_MSSE)
1078
1079
sewardj5b754b42002-06-03 22:53:35 +00001080# does this compiler support -mpreferred-stack-boundary=2 ?
1081AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1082
daywalker3664f562003-10-17 13:43:46 +00001083safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001084CFLAGS="-mpreferred-stack-boundary=2"
1085
1086AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001087 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001088],
1089[
1090PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001091AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001092], [
1093PREFERRED_STACK_BOUNDARY=""
1094AC_MSG_RESULT([no])
1095])
daywalker3664f562003-10-17 13:43:46 +00001096CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001097
1098AC_SUBST(PREFERRED_STACK_BOUNDARY)
1099
sewardj535c50f2005-06-04 23:14:53 +00001100
sewardjb5f6f512005-03-10 23:59:00 +00001101# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001102AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001103
1104safe_CFLAGS=$CFLAGS
1105CFLAGS="-Wno-pointer-sign"
1106
1107AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001108 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001109],
1110[
1111no_pointer_sign=yes
1112AC_MSG_RESULT([yes])
1113], [
1114no_pointer_sign=no
1115AC_MSG_RESULT([no])
1116])
1117CFLAGS=$safe_CFLAGS
1118
1119if test x$no_pointer_sign = xyes; then
1120 CFLAGS="$CFLAGS -Wno-pointer-sign"
1121fi
1122
sewardj535c50f2005-06-04 23:14:53 +00001123
barte026bd22009-07-04 12:17:07 +00001124# does this compiler support -Wno-empty-body ?
1125
1126AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1127
1128safe_CFLAGS=$CFLAGS
1129CFLAGS="-Wno-empty-body"
1130
1131AC_TRY_COMPILE(
1132[ ],
1133[
1134 return 0;
1135],
1136[
1137AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1138AC_MSG_RESULT([yes])
1139],
1140[
1141AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1142AC_MSG_RESULT([no])
1143])
1144CFLAGS=$safe_CFLAGS
1145
1146
bart9d865fa2008-06-23 12:11:49 +00001147# does this compiler support -Wno-format-zero-length ?
1148
1149AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1150
1151safe_CFLAGS=$CFLAGS
1152CFLAGS="-Wno-format-zero-length"
1153
1154AC_TRY_COMPILE(
1155[ ],
1156[
1157 return 0;
1158],
1159[
1160AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1161AC_MSG_RESULT([yes])
1162],
1163[
1164AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1165AC_MSG_RESULT([no])
1166])
1167CFLAGS=$safe_CFLAGS
1168
1169
bartbf9b85c2009-08-12 12:55:56 +00001170# does this compiler support -Wno-uninitialized ?
1171
1172AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1173
1174safe_CFLAGS=$CFLAGS
1175CFLAGS="-Wno-uninitialized"
1176
1177AC_TRY_COMPILE(
1178[ ],
1179[
1180 return 0;
1181],
1182[
1183AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1184AC_MSG_RESULT([yes])
1185],
1186[
1187AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1188AC_MSG_RESULT([no])
1189])
1190CFLAGS=$safe_CFLAGS
1191
1192
bart56730cd2008-05-11 06:41:46 +00001193# does this compiler support -Wextra or the older -W ?
1194
1195AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1196
1197safe_CFLAGS=$CFLAGS
1198CFLAGS="-Wextra"
1199
1200AC_TRY_COMPILE(
1201[ ],
1202[
1203 return 0;
1204],
1205[
1206AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1207AC_MSG_RESULT([-Wextra])
1208], [
1209 CFLAGS="-W"
1210 AC_TRY_COMPILE(
1211 [ ],
1212 [
1213 return 0;
1214 ],
1215 [
1216 AC_SUBST([FLAG_W_EXTRA], [-W])
1217 AC_MSG_RESULT([-W])
1218 ], [
1219 AC_SUBST([FLAG_W_EXTRA], [])
1220 AC_MSG_RESULT([not supported])
1221 ])
1222])
1223CFLAGS=$safe_CFLAGS
1224
1225
sewardja72c26d2007-05-01 13:44:08 +00001226# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001227AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001228
1229safe_CFLAGS=$CFLAGS
1230CFLAGS="-fno-stack-protector"
1231
1232AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001233 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001234],
1235[
1236no_stack_protector=yes
1237FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1238AC_MSG_RESULT([yes])
1239], [
1240no_stack_protector=no
1241FLAG_FNO_STACK_PROTECTOR=""
1242AC_MSG_RESULT([no])
1243])
1244CFLAGS=$safe_CFLAGS
1245
1246AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1247
1248if test x$no_stack_protector = xyes; then
1249 CFLAGS="$CFLAGS -fno-stack-protector"
1250fi
1251
1252
bart56730cd2008-05-11 06:41:46 +00001253# does this compiler support --param inline-unit-growth=... ?
1254
1255AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1256
1257safe_CFLAGS=$CFLAGS
1258CFLAGS="--param inline-unit-growth=900"
1259
1260AC_TRY_COMPILE(
1261[ ],
1262[
1263 return 0;
1264],
1265[
1266AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1267 ["--param inline-unit-growth=900"])
1268AC_MSG_RESULT([yes])
1269], [
1270AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1271AC_MSG_RESULT([no])
1272])
1273CFLAGS=$safe_CFLAGS
1274
1275
sewardjd3645802010-06-13 22:13:58 +00001276# does the linker support -Wl,--build-id=none ? Note, it's
1277# important that we test indirectly via whichever C compiler
1278# is selected, rather than testing /usr/bin/ld or whatever
1279# directly.
bart699fbac2010-06-08 18:23:59 +00001280
sewardjd3645802010-06-13 22:13:58 +00001281AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
bart699fbac2010-06-08 18:23:59 +00001282
1283safe_CFLAGS=$CFLAGS
1284CFLAGS="-Wl,--build-id=none"
1285
bart8508c752010-06-10 06:26:21 +00001286AC_LINK_IFELSE(
1287[AC_LANG_PROGRAM([ ], [return 0;])],
bart699fbac2010-06-08 18:23:59 +00001288[
1289 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1290 AC_MSG_RESULT([yes])
1291], [
1292 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1293 AC_MSG_RESULT([no])
1294])
1295CFLAGS=$safe_CFLAGS
1296
1297
sewardj00f1e622006-03-12 16:47:10 +00001298# does the ppc assembler support "mtocrf" et al?
1299AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1300
1301AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001302__asm__ __volatile__("mtocrf 4,0");
1303__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001304],
1305[
1306ac_have_as_ppc_mftocrf=yes
1307AC_MSG_RESULT([yes])
1308], [
1309ac_have_as_ppc_mftocrf=no
1310AC_MSG_RESULT([no])
1311])
1312if test x$ac_have_as_ppc_mftocrf = xyes ; then
1313 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1314fi
1315
1316
sewardjf0aabf82007-03-22 00:24:21 +00001317# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001318# Note, this doesn't generate a C-level symbol. It generates a
1319# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001320AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1321
1322AC_TRY_COMPILE(, [
1323 do { long long int x;
1324 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1325 while (0)
1326],
1327[
1328ac_have_as_sse3=yes
1329AC_MSG_RESULT([yes])
1330], [
1331ac_have_as_sse3=no
1332AC_MSG_RESULT([no])
1333])
sewardjfa18a262007-03-22 12:13:13 +00001334
1335AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001336
1337
sewardj6d6da5b2008-02-09 12:07:40 +00001338# Ditto for SSSE3 instructions (note extra S)
1339# Note, this doesn't generate a C-level symbol. It generates a
1340# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1341AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1342
1343AC_TRY_COMPILE(, [
1344 do { long long int x;
1345 __asm__ __volatile__(
1346 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1347 while (0)
1348],
1349[
1350ac_have_as_ssse3=yes
1351AC_MSG_RESULT([yes])
1352], [
1353ac_have_as_ssse3=no
1354AC_MSG_RESULT([no])
1355])
1356
1357AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1358
1359
sewardjb5f6f512005-03-10 23:59:00 +00001360# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001361if test "x${cross_compiling}" = "xno"; then
1362# Native compilation: check whether running a program using TLS succeeds.
1363# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1364# succeeds but running programs using TLS fails.
1365AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1366 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1367 [vg_cv_tls=$enableval],
1368 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1369 [[return foo;]])],
1370 [vg_cv_tls=yes],
1371 [vg_cv_tls=no])])])
1372else
1373# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001374AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1375 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1376 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001377 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001378 [[return foo;]])],
1379 [vg_cv_tls=yes],
1380 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001381fi
sewardjb5f6f512005-03-10 23:59:00 +00001382
1383if test "$vg_cv_tls" = yes; then
1384AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1385fi
sewardj5b754b42002-06-03 22:53:35 +00001386
sewardj535c50f2005-06-04 23:14:53 +00001387
njn7fd6d382009-01-22 21:56:32 +00001388#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001389# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001390#----------------------------------------------------------------------------
1391
sewardjde4a1d02002-03-22 01:27:54 +00001392AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001393AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001394 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001395 endian.h \
1396 mqueue.h \
1397 sys/endian.h \
1398 sys/epoll.h \
1399 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001400 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001401 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001402 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001403 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001404 sys/syscall.h \
1405 sys/time.h \
1406 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001407 ])
sewardjde4a1d02002-03-22 01:27:54 +00001408
njn7fd6d382009-01-22 21:56:32 +00001409#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001410# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001411#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001412AC_TYPE_UID_T
1413AC_TYPE_OFF_T
1414AC_TYPE_SIZE_T
1415AC_HEADER_TIME
1416
sewardj535c50f2005-06-04 23:14:53 +00001417
njn7fd6d382009-01-22 21:56:32 +00001418#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001419# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001420#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001421AC_FUNC_MEMCMP
1422AC_FUNC_MMAP
1423AC_TYPE_SIGNAL
1424
bart71bad292008-04-27 11:43:23 +00001425AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001426
bartf5ceec82008-04-26 07:45:10 +00001427AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001428 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001429 epoll_create \
1430 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001431 floor \
bartce48fa92008-04-26 10:59:46 +00001432 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001433 mallinfo \
1434 memchr \
1435 memset \
1436 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001437 mremap \
bartf5ceec82008-04-26 07:45:10 +00001438 ppoll \
bart6d45e922009-01-20 13:45:38 +00001439 pthread_barrier_init \
1440 pthread_condattr_setclock \
1441 pthread_mutex_timedlock \
1442 pthread_rwlock_timedrdlock \
1443 pthread_rwlock_timedwrlock \
1444 pthread_spin_lock \
barta72a27b2010-04-29 06:22:17 +00001445 pthread_yield \
bartd1f724c2009-08-26 18:11:18 +00001446 readlinkat \
bartf5ceec82008-04-26 07:45:10 +00001447 semtimedop \
1448 signalfd \
njn6cc22472009-03-16 03:46:48 +00001449 sigwaitinfo \
bartf5ceec82008-04-26 07:45:10 +00001450 strchr \
1451 strdup \
1452 strpbrk \
1453 strrchr \
1454 strstr \
barta72a27b2010-04-29 06:22:17 +00001455 syscall \
bartf5ceec82008-04-26 07:45:10 +00001456 timerfd \
1457 utimensat \
1458 ])
sewardjde4a1d02002-03-22 01:27:54 +00001459
bart623eec32008-07-29 17:54:49 +00001460# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1461# libraries with any shared object and/or executable. This is NOT what we
1462# want for e.g. vgpreload_core-x86-linux.so
1463LIBS=""
sewardj80637752006-03-02 13:48:21 +00001464
bart6d45e922009-01-20 13:45:38 +00001465AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1466 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001467AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1468 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001469AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1470 [test x$ac_cv_func_pthread_spin_lock = xyes])
1471
njn7fd6d382009-01-22 21:56:32 +00001472
1473#----------------------------------------------------------------------------
1474# MPI checks
1475#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001476# Do we have a useable MPI setup on the primary and/or secondary targets?
1477# On Linux, by default, assumes mpicc and -m32/-m64
1478# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001479# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001480# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1481# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001482MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001483if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1484 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001485 MPI_CC="mpxlc"
1486fi
1487
sewardje9fa5062006-03-12 18:29:18 +00001488mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001489if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1490 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001491 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001492elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1493 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001494 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001495elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001496 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001497elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001498 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001499fi
1500
sewardj03d86f22006-10-17 00:57:24 +00001501mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001502if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1503 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001504 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001505elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001506 mflag_secondary=-q32
1507fi
1508
1509
sewardj0ad46092006-03-02 17:09:16 +00001510AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001511 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001512 MPI_CC=$withval
1513)
sewardj03d86f22006-10-17 00:57:24 +00001514AC_SUBST(MPI_CC)
1515
1516## See if MPI_CC works for the primary target
1517##
1518AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001519saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001520saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001521CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001522CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001523AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001524#include <mpi.h>
1525#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001526],[
1527 int r = MPI_Init(NULL,NULL);
1528 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1529 return r;
1530], [
sewardj03d86f22006-10-17 00:57:24 +00001531ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001532AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001533], [
sewardj03d86f22006-10-17 00:57:24 +00001534ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001535AC_MSG_RESULT([no])
1536])
sewardj0ad46092006-03-02 17:09:16 +00001537CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001538CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001539AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001540
sewardj03d86f22006-10-17 00:57:24 +00001541## See if MPI_CC works for the secondary target. Complication: what if
1542## there is no secondary target? We need this to then fail.
1543## Kludge this by making MPI_CC something which will surely fail in
1544## such a case.
1545##
1546AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1547saved_CC=$CC
1548saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001549if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001550 CC="$MPI_CC this will surely fail"
1551else
1552 CC=$MPI_CC
1553fi
1554CFLAGS=$mflag_secondary
1555AC_TRY_LINK([
1556#include <mpi.h>
1557#include <stdio.h>
1558],[
1559 int r = MPI_Init(NULL,NULL);
1560 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1561 return r;
1562], [
1563ac_have_mpi2_sec=yes
1564AC_MSG_RESULT([yes, $MPI_CC])
1565], [
1566ac_have_mpi2_sec=no
1567AC_MSG_RESULT([no])
1568])
1569CC=$saved_CC
1570CFLAGS=$saved_CFLAGS
1571AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001572
1573
njn7fd6d382009-01-22 21:56:32 +00001574#----------------------------------------------------------------------------
1575# Other library checks
1576#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001577# There now follow some tests for QtCore, Boost, and OpenMP. These
1578# tests are present because Drd has some regression tests that use
1579# these packages. All regression test programs all compiled only
1580# for the primary target. And so it is important that the configure
1581# checks that follow, use the correct -m32 or -m64 flag for the
1582# primary target (called $mflag_primary). Otherwise, we can end up
1583# in a situation (eg) where, on amd64-linux, the test for Boost checks
1584# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1585# only build (meaning, the primary target is x86-linux), the build
1586# of the regtest programs that use Boost fails, because they are
1587# build as 32-bit (IN THIS EXAMPLE).
1588#
1589# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1590# NEEDED BY THE REGRESSION TEST PROGRAMS.
1591
1592
bart21d3cfc2008-08-02 09:08:17 +00001593# The test below verifies whether the QtCore package been installed.
1594# This test works as follows:
1595# - If pkg-config was not installed at the time autogen.sh was run,
1596# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1597# autogen.sh. Augogen.sh will generate a configure script that prints
1598# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1599# - If pkg-config was installed at the time autogen.sh was run,
1600# the generated configure script will try to detect the presence of the
1601# Qt4 QtCore library by looking up compile and linker flags in the file
1602# called QtCore.pc.
1603# - pkg-config settings can be overridden via the configure variables
1604# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1605# configure script -- see also ./configure --help).
1606# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1607# the pkg-config executable is not present on the system on which the
1608# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001609
bart21d3cfc2008-08-02 09:08:17 +00001610ifdef(
1611 [PKG_CHECK_EXISTS],
1612 [PKG_CHECK_EXISTS(
1613 [QtCore],
1614 [
1615 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001616 # Paranoia: don't trust the result reported by pkg-config, but when
1617 # pkg-config reports that QtCore has been found, verify whether linking
1618 # programs with QtCore succeeds.
1619 AC_LANG(C++)
1620 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001621 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001622 AC_TRY_LINK(
1623 [#include <QMutex>],
1624 [QMutex Mutex;],
1625 [ac_have_qtcore=yes],
1626 [
1627 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1628 ac_have_qtcore=no
1629 ]
1630 )
1631 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001632 ],
1633 [
1634 ac_have_qtcore=no
1635 ]
1636 )
1637 ],
1638 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1639 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1640 [ac_have_qtcore=no]
1641)
bart41ac62a2008-07-07 16:58:03 +00001642
1643AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1644
1645
bart62f54e42008-07-28 11:35:10 +00001646# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1647# See also http://doc.trolltech.com/4.3/qmutex.html.
1648if test x$ac_have_qtcore = xyes; then
1649 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1650 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001651 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001652 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001653 AC_TRY_COMPILE([
1654 #include <QtCore/QMutex>
1655 ],
1656 [
1657 QMutex M;
1658 M.tryLock(1);
1659 M.unlock();
1660 return 0;
1661 ],
1662 [
1663 AC_MSG_RESULT([yes])
1664 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1665 ],
1666 [
1667 AC_MSG_RESULT([no])
1668 ])
bart21d3cfc2008-08-02 09:08:17 +00001669 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001670 AC_LANG(C)
1671fi
1672
1673
bart4f43e002009-11-09 16:07:43 +00001674# Test for QAtomicInt, which has been introduced in Qt 4.4.
1675# See also http://doc.trolltech.com/4.4/qatomicint.html.
1676if test x$ac_have_qtcore = xyes; then
bart9da08ba2009-11-11 19:22:05 +00001677 AC_MSG_CHECKING([for Qt4 QAtomicInt])
bart4f43e002009-11-09 16:07:43 +00001678 AC_LANG(C++)
1679 safe_CXXFLAGS="${CXXFLAGS}"
1680 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1681 AC_TRY_COMPILE([
1682 #include <QtCore/QAtomicInt>
1683 ],
1684 [
1685 QAtomicInt I;
1686 I.testAndSetOrdered(0, 1);
1687 return 0;
1688 ],
1689 [
1690 ac_have_qtcore_qatomicint=yes
1691 AC_MSG_RESULT([yes])
1692 AC_DEFINE([HAVE_QTCORE_QATOMICINT], [1], [Define to 1 if the installed version of Qt4 provides QAtomicInt.])
1693 ],
1694 [
1695 ac_have_qtcore_qatomicint=no
1696 AC_MSG_RESULT([no])
1697 ])
1698 CXXFLAGS="${safe_CXXFLAGS}"
1699 AC_LANG(C)
1700fi
1701
1702AM_CONDITIONAL([HAVE_QTCORE_QATOMICINT], [test x$ac_have_qtcore_qatomicint = xyes])
1703
1704
1705
sewardj493c4ef2008-12-13 16:45:19 +00001706# Check whether the boost library 1.35 or later has been installed.
1707# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1708
1709AC_MSG_CHECKING([for boost])
1710
1711AC_LANG(C++)
1712safe_CXXFLAGS=$CXXFLAGS
1713CXXFLAGS="-lboost_thread-mt $mflag_primary"
1714
1715AC_LINK_IFELSE(
1716[
1717#include <boost/thread.hpp>
1718static void thread_func(void)
1719{ }
1720int main(int argc, char** argv)
1721{
1722 boost::thread t(thread_func);
1723 return 0;
1724}
1725],
1726[
1727ac_have_boost_1_35=yes
1728AC_SUBST([BOOST_CFLAGS], [])
1729AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1730AC_MSG_RESULT([yes])
1731], [
1732ac_have_boost_1_35=no
1733AC_MSG_RESULT([no])
1734])
1735
1736CXXFLAGS=$safe_CXXFLAGS
1737AC_LANG(C)
1738
1739AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1740
1741
1742# does this compiler support -fopenmp, does it have the include file
1743# <omp.h> and does it have libgomp ?
1744
1745AC_MSG_CHECKING([for OpenMP])
1746
1747safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001748CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001749
1750AC_LINK_IFELSE(
1751[
1752#include <omp.h>
1753int main(int argc, char** argv)
1754{
1755 omp_set_dynamic(0);
1756 return 0;
1757}
1758],
1759[
1760ac_have_openmp=yes
1761AC_MSG_RESULT([yes])
1762], [
1763ac_have_openmp=no
1764AC_MSG_RESULT([no])
1765])
1766CFLAGS=$safe_CFLAGS
1767
1768AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1769
1770
sewardjc876a2f2009-01-22 22:44:30 +00001771# does this compiler have built-in functions for atomic memory access ?
1772AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1773
1774safe_CFLAGS=$CFLAGS
1775CFLAGS="$mflag_primary"
1776
1777AC_TRY_LINK(,
1778[
1779 int variable = 1;
1780 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1781 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1782],
1783[
bartc82d1372009-05-31 16:21:23 +00001784 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001785 AC_MSG_RESULT([yes])
1786 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1787],
1788[
bartc82d1372009-05-31 16:21:23 +00001789 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001790 AC_MSG_RESULT([no])
1791])
1792
1793CFLAGS=$safe_CFLAGS
1794
bartc82d1372009-05-31 16:21:23 +00001795AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1796
sewardjc876a2f2009-01-22 22:44:30 +00001797
njn7fd6d382009-01-22 21:56:32 +00001798#----------------------------------------------------------------------------
1799# Ok. We're done checking.
1800#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001801
njn8b68b642009-06-24 00:37:09 +00001802# Nb: VEX/Makefile is generated from Makefile.vex.in.
1803AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001804 Makefile
njn8b68b642009-06-24 00:37:09 +00001805 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001806 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001807 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001808 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001809 docs/Makefile
1810 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001811 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001812 perf/Makefile
1813 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001814 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001815 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001816 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001817 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001818 memcheck/Makefile
1819 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001820 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001821 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001822 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001823 memcheck/tests/darwin/Makefile
njna454ec02009-01-19 03:16:59 +00001824 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001825 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001826 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001827 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001828 cachegrind/tests/x86/Makefile
njnf2df9b52002-10-04 11:35:47 +00001829 cachegrind/cg_annotate
njn69d495d2010-06-30 05:23:34 +00001830 cachegrind/cg_diff
weidendoa17f2a32006-03-20 10:27:30 +00001831 callgrind/Makefile
1832 callgrind/callgrind_annotate
1833 callgrind/callgrind_control
1834 callgrind/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001835 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001836 helgrind/tests/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001837 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001838 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001839 massif/perf/Makefile
njnd5a8d242007-11-02 20:44:57 +00001840 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001841 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001842 lackey/tests/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001843 none/Makefile
1844 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001845 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001846 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001847 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001848 none/tests/x86/Makefile
sewardj59570ff2010-01-01 11:59:33 +00001849 none/tests/arm/Makefile
njn0458a122009-02-13 06:23:46 +00001850 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001851 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001852 none/tests/x86-linux/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001853 exp-ptrcheck/Makefile
1854 exp-ptrcheck/tests/Makefile
bartccf17de2008-07-04 15:14:35 +00001855 drd/Makefile
bartccf17de2008-07-04 15:14:35 +00001856 drd/scripts/download-and-build-splash2
1857 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001858 exp-bbv/Makefile
njndbebecc2009-07-14 01:39:54 +00001859 exp-bbv/tests/Makefile
1860 exp-bbv/tests/x86/Makefile
1861 exp-bbv/tests/x86-linux/Makefile
1862 exp-bbv/tests/amd64-linux/Makefile
1863 exp-bbv/tests/ppc32-linux/Makefile
vince226e0782010-01-06 15:22:11 +00001864 exp-bbv/tests/arm-linux/Makefile
njn8b68b642009-06-24 00:37:09 +00001865])
sewardjd3645802010-06-13 22:13:58 +00001866AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
1867 [chmod +x coregrind/link_tool_exe_linux])
1868AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
1869 [chmod +x coregrind/link_tool_exe_darwin])
1870AC_CONFIG_FILES([coregrind/link_tool_exe_aix5],
1871 [chmod +x coregrind/link_tool_exe_aix5])
njn8b68b642009-06-24 00:37:09 +00001872AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001873
1874cat<<EOF
1875
njn311303f2009-02-06 03:46:50 +00001876 Maximum build arch: ${ARCH_MAX}
1877 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001878 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001879 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001880 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1881 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001882 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001883
gobry3b777892002-04-04 09:18:39 +00001884EOF