blob: 4407a37e9eee6cefccae28fe36dfc9f9538352ed [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.
sewardj8d37f362009-01-05 17:14:12 +000011AC_INIT(Valgrind, 3.5.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
42
bartcddeaf52008-05-25 15:58:11 +000043# If no AR variable was specified, look up the name of the archiver. Otherwise
44# do not touch the AR variable.
45if test "x$AR" = "x"; then
bart325cd972009-04-04 14:36:51 +000046 AC_PATH_PROGS([AR], [`echo $LD | sed 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000047fi
48AC_ARG_VAR([AR],[Archiver command])
49
gobrye721a522002-03-22 13:38:30 +000050# Check for the compiler support
51if test "${GCC}" != "yes" ; then
52 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
53fi
54
sewardj2f685952002-12-22 19:32:23 +000055# figure out where perl lives
56AC_PATH_PROG(PERL, perl)
57
njn9315df32003-04-16 20:50:50 +000058# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000059AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000060AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000061
daywalker48ccca52002-04-15 00:31:58 +000062# some older automake's don't have it so try something on our own
63ifdef([AM_PROG_AS],[AM_PROG_AS],
64[
gobry1be19852002-03-26 20:44:55 +000065AS="${CC}"
66AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000067
gobry1be19852002-03-26 20:44:55 +000068ASFLAGS=""
69AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000070])
gobry3b777892002-04-04 09:18:39 +000071
gobry3b777892002-04-04 09:18:39 +000072
njn0d2e58f2009-02-25 04:57:56 +000073# Check if 'diff' supports -u (universal diffs) and use it if possible.
74
75AC_MSG_CHECKING([for diff -u])
76AC_SUBST(DIFF)
77
78# Comparing two identical files results in 0, unless -u isn't supported (as
79# it's not on AIX).
njn31f665e2009-02-26 21:25:50 +000080tmpfile="tmp-xxx-yyy-zzz"
81touch $tmpfile;
82if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000083 AC_MSG_RESULT([yes])
84 DIFF="diff -u"
85else
86 AC_MSG_RESULT([no])
87 DIFF="diff"
88fi
njn31f665e2009-02-26 21:25:50 +000089rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000090
91
sewardj535c50f2005-06-04 23:14:53 +000092# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +000093AC_MSG_CHECKING([for a supported version of gcc])
94
sewardjf33b4332008-07-18 18:20:42 +000095[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +000096
97case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +000098 2.*)
gobrye721a522002-03-22 13:38:30 +000099 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000100 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
101 ;;
gobrye721a522002-03-22 13:38:30 +0000102 *)
103 AC_MSG_RESULT([ok (${gcc_version})])
104 ;;
105esac
106
njn7fd6d382009-01-22 21:56:32 +0000107#----------------------------------------------------------------------------
108# Arch/OS/platform tests.
109#----------------------------------------------------------------------------
110# We create a number of arch/OS/platform-related variables. We prefix them
111# all with "VGCONF_" which indicates that they are defined at
112# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
113# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000114
sewardjde4a1d02002-03-22 01:27:54 +0000115AC_CANONICAL_HOST
116
117AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000118
njn7fd6d382009-01-22 21:56:32 +0000119# ARCH_MAX reflects the most that this CPU can do: for example if it
120# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
121# Ditto for amd64. It is used for more configuration below, but is not used
122# outside this file.
gobrye721a522002-03-22 13:38:30 +0000123case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000124 i?86)
125 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000126 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000127 ;;
128
njnfe408942004-11-23 17:52:24 +0000129 x86_64)
130 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000131 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000132 ;;
133
sewardj2c48c7b2005-11-29 13:05:56 +0000134 powerpc64)
njn7fd6d382009-01-22 21:56:32 +0000135 # This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000136 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000137 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000138 ;;
139
140 powerpc)
njn7fd6d382009-01-22 21:56:32 +0000141 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
142 # Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000143 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000144 case "${host_os}" in
145 aix5.*)
njn7fd6d382009-01-22 21:56:32 +0000146 ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000147 ;;
148 *)
njn7fd6d382009-01-22 21:56:32 +0000149 ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000150 ;;
151 esac
nethercote9bcc9062004-10-13 13:50:01 +0000152 ;;
153
sewardjde4a1d02002-03-22 01:27:54 +0000154 *)
155 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000156 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000157 ;;
158esac
159
njn7fd6d382009-01-22 21:56:32 +0000160#----------------------------------------------------------------------------
161
sewardj86e992f2006-01-28 18:39:09 +0000162# Sometimes it's convenient to subvert the bi-arch build system and
163# just have a single build even though the underlying platform is
164# capable of both. Hence handle --enable-only64bit and
165# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000166# [Actually, if either of these options are used, I think both get built,
167# but only one gets installed. So if you use an in-place build, both can be
168# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000169
170# Check if a 64-bit only build has been requested
171AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
172 [AC_ARG_ENABLE(only64bit,
173 [ --enable-only64bit do a 64-bit only build],
174 [vg_cv_only64bit=$enableval],
175 [vg_cv_only64bit=no])])
176
177# Check if a 32-bit only build has been requested
178AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
179 [AC_ARG_ENABLE(only32bit,
180 [ --enable-only32bit do a 32-bit only build],
181 [vg_cv_only32bit=$enableval],
182 [vg_cv_only32bit=no])])
183
184# Stay sane
185if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
186 AC_MSG_ERROR(
187 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
188fi
189
njn7fd6d382009-01-22 21:56:32 +0000190#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000191
njn311303f2009-02-06 03:46:50 +0000192# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
193# compilation of many C files via -VGO_$(VGCONF_OS) and
194# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000195AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000196AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000197
njnf76d27a2009-05-28 01:53:07 +0000198DEFAULT_SUPP=""
199
gobrye721a522002-03-22 13:38:30 +0000200case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000201 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000202 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000203 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000204
205 # Ok, this is linux. Check the kernel version
206 AC_MSG_CHECKING([for the kernel version])
207
208 kernel=`uname -r`
209
210 case "${kernel}" in
211 2.6.*)
212 AC_MSG_RESULT([2.6 family (${kernel})])
213 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
214 ;;
215
216 2.4.*)
217 AC_MSG_RESULT([2.4 family (${kernel})])
218 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
219 ;;
220
mueller8c68e042004-01-03 15:21:14 +0000221 *)
222 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000223 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000224 ;;
225 esac
226
227 ;;
228
sewardj03d86f22006-10-17 00:57:24 +0000229 aix5.1.*)
230 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000231 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000232 ;;
233 aix5.2.*)
234 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000235 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000236 ;;
237 aix5.3.*)
238 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000239 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000240 ;;
241
mueller8c68e042004-01-03 15:21:14 +0000242 *freebsd*)
243 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000244 VGCONF_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000245 ;;
246
njnf76d27a2009-05-28 01:53:07 +0000247 *darwin*)
248 AC_MSG_RESULT([ok (${host_os})])
249 VGCONF_OS="darwin"
250
251 AC_MSG_CHECKING([for the kernel version])
252 kernel=`uname -r`
253
254 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
255 # has only one relevant version, the OS version. The `uname` check
256 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
257 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
258 # Snow Leopard and darwin10.supp), and we don't know of an macros
259 # similar to __GLIBC__ to get that info.
260 #
261 # XXX: `uname -r` won't do the right thing for cross-compiles, but
262 # that's not a problem yet.
263 case "${kernel}" in
264 9.*)
265 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
266 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
bart6ccda142009-07-23 07:37:32 +0000267 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
njnf76d27a2009-05-28 01:53:07 +0000268 ;;
269 *)
270 AC_MSG_RESULT([unsupported (${kernel})])
271 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
272 ;;
273 esac
274 ;;
275
sewardjde4a1d02002-03-22 01:27:54 +0000276 *)
277 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000278 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000279 ;;
280esac
281
njn7fd6d382009-01-22 21:56:32 +0000282#----------------------------------------------------------------------------
283
tomd6398392006-06-07 17:44:36 +0000284# If we are building on a 64 bit platform test to see if the system
285# supports building 32 bit programs and disable 32 bit support if it
286# does not support building 32 bit programs
287
njn7fd6d382009-01-22 21:56:32 +0000288case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000289 amd64-linux|ppc64-linux)
290 AC_MSG_CHECKING([for 32 bit build support])
291 safe_CFLAGS=$CFLAGS
292 CFLAGS="-m32"
293 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000294 return 0;
tomd6398392006-06-07 17:44:36 +0000295 ],
296 [
297 AC_MSG_RESULT([yes])
298 ], [
299 vg_cv_only64bit="yes"
300 AC_MSG_RESULT([no])
301 ])
302 CFLAGS=$safe_CFLAGS;;
303esac
304
305if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
306 AC_MSG_ERROR(
307 [--enable-only32bit was specified but system does not support 32 bit builds])
308fi
nethercote888ecb72004-08-23 14:54:40 +0000309
njn7fd6d382009-01-22 21:56:32 +0000310#----------------------------------------------------------------------------
311
njn311303f2009-02-06 03:46:50 +0000312# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
313# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
314# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
315# above) will be "amd64" since that reflects the most that this cpu can do,
316# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
317# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000318# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
319# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
320AC_SUBST(VGCONF_ARCH_PRI)
321
njn3f8a6e92009-06-02 00:20:47 +0000322# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
323# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
324# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
325# It is empty if there is no secondary target.
326AC_SUBST(VGCONF_ARCH_SEC)
327
njn311303f2009-02-06 03:46:50 +0000328# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
329# The entire system, including regression and performance tests, will be
330# built for this target. The "_CAPS" indicates that the name is in capital
331# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000332# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000333# convention and cannot contain '-' characters. This is in contrast to
334# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000335AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
336
337# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
338# Valgrind and tools will also be built for this target, but not the
339# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000340#
njn7fd6d382009-01-22 21:56:32 +0000341# By default, the primary arch is the same as the "max" arch, as commented
342# above (at the definition of ARCH_MAX). We may choose to downgrade it in
343# the big case statement just below here, in the case where we're building
344# on a 64 bit machine but have been requested only to do a 32 bit build.
345AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
346
sewardj01262142006-01-04 01:20:28 +0000347AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000348
njn7fd6d382009-01-22 21:56:32 +0000349case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000350 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000351 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000352 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000353 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
354 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000355 valt_load_address_normal="0x38000000"
356 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000357 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000358 ;;
359 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000360 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000361 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000362 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000363 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
364 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000365 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000366 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000367 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000368 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
369 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000370 else
njn7fd6d382009-01-22 21:56:32 +0000371 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000372 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000373 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
374 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000375 fi
njnd74b0ef2009-01-20 06:06:52 +0000376 valt_load_address_normal="0x38000000"
377 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000378 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000379 ;;
380 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000381 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000382 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000383 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
384 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000385 valt_load_address_normal="0x38000000"
386 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000387 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000388 ;;
sewardj03d86f22006-10-17 00:57:24 +0000389 ppc64-aix5)
390 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000391 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000392 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000393 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
394 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000395 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000396 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000397 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000398 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
399 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000400 else
njn7fd6d382009-01-22 21:56:32 +0000401 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000402 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000403 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
404 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000405 fi
njnd74b0ef2009-01-20 06:06:52 +0000406 valt_load_address_normal="0x38000000"
407 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000408 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000409 ;;
sewardj01262142006-01-04 01:20:28 +0000410 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000411 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000412 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000413 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000414 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
415 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000416 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000417 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000418 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000419 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
420 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000421 else
njn7fd6d382009-01-22 21:56:32 +0000422 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000423 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000424 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
425 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000426 fi
njnd74b0ef2009-01-20 06:06:52 +0000427 valt_load_address_normal="0x38000000"
428 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000429 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000430 ;;
njnf76d27a2009-05-28 01:53:07 +0000431 x86-darwin)
432 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000433 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000434 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
435 VGCONF_PLATFORM_SEC_CAPS=""
436 valt_load_address_normal="0x0"
437 valt_load_address_inner="0x0"
438 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
439 ;;
440 amd64-darwin)
441 if test x$vg_cv_only64bit = xyes; then
442 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000443 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000444 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
445 VGCONF_PLATFORM_SEC_CAPS=""
446 elif test x$vg_cv_only32bit = xyes; then
447 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000448 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000449 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
450 VGCONF_PLATFORM_SEC_CAPS=""
451 VGCONF_ARCH_PRI_CAPS="x86"
452 else
453 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000454 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000455 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
456 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
457 fi
458 valt_load_address_normal="0x0"
459 valt_load_address_inner="0x0"
460 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
461 ;;
nethercote888ecb72004-08-23 14:54:40 +0000462 *)
njn7fd6d382009-01-22 21:56:32 +0000463 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000464 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000465 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
466 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njn377c43f2009-05-19 07:39:22 +0000467 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000468 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000469 ;;
470esac
sewardjde4a1d02002-03-22 01:27:54 +0000471
njn7fd6d382009-01-22 21:56:32 +0000472#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000473
njn7fd6d382009-01-22 21:56:32 +0000474# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
475# defined.
476AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
477 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000478 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
479 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
480 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000481AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000482 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
483 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000484AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
485 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
486 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
487 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
488 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
489AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
490 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
491 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj03d86f22006-10-17 00:57:24 +0000492
njn7fd6d382009-01-22 21:56:32 +0000493# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
494# become defined.
495AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
496 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
497 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
498AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
499 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
500AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
501 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
502 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
503AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
504 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000505
njn7fd6d382009-01-22 21:56:32 +0000506AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
507 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
508 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
509AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
510 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
511
njnf76d27a2009-05-28 01:53:07 +0000512AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
513 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
514 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
515AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
516 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
517
518
njn7fd6d382009-01-22 21:56:32 +0000519# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000520# Relies on the assumption that the primary and secondary targets are
521# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000522AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
523 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
524 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
525 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
526 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
527AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
528 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
529 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000530AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
531 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
532 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000533
534
njn7fd6d382009-01-22 21:56:32 +0000535# Sometimes, in the Makefile.am files, it's useful to know whether or not
536# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000537AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000538 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000539
tomb637bad2005-11-08 12:28:35 +0000540
njn7fd6d382009-01-22 21:56:32 +0000541#----------------------------------------------------------------------------
542# Inner Valgrind?
543#----------------------------------------------------------------------------
544
njnd74b0ef2009-01-20 06:06:52 +0000545# Check if this should be built as an inner Valgrind, to be run within
546# another Valgrind. Choose the load address accordingly.
547AC_SUBST(VALT_LOAD_ADDRESS)
548AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
549 [AC_ARG_ENABLE(inner,
550 [ --enable-inner enables self-hosting],
551 [vg_cv_inner=$enableval],
552 [vg_cv_inner=no])])
553if test "$vg_cv_inner" = yes; then
554 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
555 VALT_LOAD_ADDRESS=$valt_load_address_inner
556else
557 VALT_LOAD_ADDRESS=$valt_load_address_normal
558fi
559
560
njn7fd6d382009-01-22 21:56:32 +0000561#----------------------------------------------------------------------------
562# Libc and suppressions
563#----------------------------------------------------------------------------
564# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000565AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000566
dirk07596a22008-04-25 11:33:30 +0000567GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000568
sewardjde4a1d02002-03-22 01:27:54 +0000569AC_EGREP_CPP([GLIBC_22], [
570#include <features.h>
571#ifdef __GNU_LIBRARY__
572 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
573 GLIBC_22
574 #endif
575#endif
576],
dirk07596a22008-04-25 11:33:30 +0000577GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000578
sewardj08c7f012002-10-07 23:56:55 +0000579AC_EGREP_CPP([GLIBC_23], [
580#include <features.h>
581#ifdef __GNU_LIBRARY__
582 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
583 GLIBC_23
584 #endif
585#endif
586],
dirk07596a22008-04-25 11:33:30 +0000587GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000588
njn781dba52005-06-30 04:06:38 +0000589AC_EGREP_CPP([GLIBC_24], [
590#include <features.h>
591#ifdef __GNU_LIBRARY__
592 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
593 GLIBC_24
594 #endif
595#endif
596],
dirk07596a22008-04-25 11:33:30 +0000597GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000598
dirkaece45c2006-10-12 08:17:49 +0000599AC_EGREP_CPP([GLIBC_25], [
600#include <features.h>
601#ifdef __GNU_LIBRARY__
602 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
603 GLIBC_25
604 #endif
605#endif
606],
dirk07596a22008-04-25 11:33:30 +0000607GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000608
dirkc8bd0c52007-05-23 17:39:08 +0000609AC_EGREP_CPP([GLIBC_26], [
610#include <features.h>
611#ifdef __GNU_LIBRARY__
612 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
613 GLIBC_26
614 #endif
615#endif
616],
dirk07596a22008-04-25 11:33:30 +0000617GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000618
sewardj68c80c12007-11-18 14:40:02 +0000619AC_EGREP_CPP([GLIBC_27], [
620#include <features.h>
621#ifdef __GNU_LIBRARY__
622 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
623 GLIBC_27
624 #endif
625#endif
626],
dirk07596a22008-04-25 11:33:30 +0000627GLIBC_VERSION="2.7")
628
629AC_EGREP_CPP([GLIBC_28], [
630#include <features.h>
631#ifdef __GNU_LIBRARY__
632 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
633 GLIBC_28
634 #endif
635#endif
636],
637GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000638
dirkd2e31eb2008-11-19 23:58:36 +0000639AC_EGREP_CPP([GLIBC_29], [
640#include <features.h>
641#ifdef __GNU_LIBRARY__
642 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
643 GLIBC_29
644 #endif
645#endif
646],
647GLIBC_VERSION="2.9")
648
sewardj5d425e82009-02-01 19:01:11 +0000649AC_EGREP_CPP([GLIBC_210], [
650#include <features.h>
651#ifdef __GNU_LIBRARY__
652 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
653 GLIBC_210
654 #endif
655#endif
656],
657GLIBC_VERSION="2.10")
658
sewardj03d86f22006-10-17 00:57:24 +0000659AC_EGREP_CPP([AIX5_LIBC], [
660#include <standards.h>
661#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
662 AIX5_LIBC
663#endif
664],
dirk07596a22008-04-25 11:33:30 +0000665GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000666
njnf76d27a2009-05-28 01:53:07 +0000667# not really a version check
668AC_EGREP_CPP([DARWIN_LIBC], [
669#include <sys/cdefs.h>
670#if defined(__DARWIN_VERS_1050)
671 DARWIN_LIBC
672#endif
673],
674GLIBC_VERSION="darwin")
675
dirk07596a22008-04-25 11:33:30 +0000676AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000677
dirk07596a22008-04-25 11:33:30 +0000678case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000679 2.2)
680 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000681 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000682 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
683 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000684 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000685 ;;
686
sewardj08c7f012002-10-07 23:56:55 +0000687 2.3)
688 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000689 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000690 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000691 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000692 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000693 ;;
694
njn781dba52005-06-30 04:06:38 +0000695 2.4)
696 AC_MSG_RESULT(2.4 family)
697 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000698 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000699 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000700 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000701 ;;
702
dirkaece45c2006-10-12 08:17:49 +0000703 2.5)
704 AC_MSG_RESULT(2.5 family)
705 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000706 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000707 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000708 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000709 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000710 2.6)
711 AC_MSG_RESULT(2.6 family)
712 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000713 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000714 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000715 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000716 ;;
717 2.7)
718 AC_MSG_RESULT(2.7 family)
719 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000720 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000721 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000722 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000723 ;;
dirk07596a22008-04-25 11:33:30 +0000724 2.8)
725 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000726 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000727 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
728 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
729 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
730 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000731 2.9)
732 AC_MSG_RESULT(2.9 family)
733 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
734 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
735 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
736 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
737 ;;
sewardj5d425e82009-02-01 19:01:11 +0000738 2.10)
739 AC_MSG_RESULT(2.10 family)
740 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
741 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
742 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
743 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
744 ;;
sewardj03d86f22006-10-17 00:57:24 +0000745 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000746 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
747 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 +0000748 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
749 ;;
njnf76d27a2009-05-28 01:53:07 +0000750 darwin)
751 AC_MSG_RESULT(Darwin)
752 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
753 # DEFAULT_SUPP set by kernel version check above.
754 ;;
dirkaece45c2006-10-12 08:17:49 +0000755
sewardjde4a1d02002-03-22 01:27:54 +0000756 *)
757 AC_MSG_RESULT(unsupported version)
sewardj5d425e82009-02-01 19:01:11 +0000758 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.10])
dirk07596a22008-04-25 11:33:30 +0000759 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000760 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000761 ;;
762esac
763
dirk07596a22008-04-25 11:33:30 +0000764AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000765
sewardj414f3582008-07-18 20:46:00 +0000766
767# Add default suppressions for the X client libraries. Make no
768# attempt to detect whether such libraries are installed on the
769# build machine (or even if any X facilities are present); just
770# add the suppressions antidisirregardless.
771DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
772DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000773
sewardj5744c022008-10-19 18:58:13 +0000774# Add glibc and X11 suppressions for exp-ptrcheck
775DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
776
sewardj2e10a682003-04-07 19:36:41 +0000777
njn7fd6d382009-01-22 21:56:32 +0000778#----------------------------------------------------------------------------
779# Checking for various library functions and other definitions
780#----------------------------------------------------------------------------
781
bart59e2f182008-04-28 16:22:53 +0000782# Check for CLOCK_MONOTONIC
783
784AC_MSG_CHECKING([for CLOCK_MONOTONIC])
785
786AC_TRY_COMPILE(
787[
788#include <time.h>
789], [
790 struct timespec t;
791 clock_gettime(CLOCK_MONOTONIC, &t);
792 return 0;
793],
794[
795AC_MSG_RESULT([yes])
796AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
797 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
798], [
799AC_MSG_RESULT([no])
800])
801
bartfea06922008-05-03 09:12:15 +0000802
803# Check for PTHREAD_MUTEX_ADAPTIVE_NP
804
805AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
806
807AC_TRY_COMPILE(
808[
809#define _GNU_SOURCE
810#include <pthread.h>
811], [
812 return (PTHREAD_MUTEX_ADAPTIVE_NP);
813],
814[
815AC_MSG_RESULT([yes])
816AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
817 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
818], [
819AC_MSG_RESULT([no])
820])
821
822
823# Check for PTHREAD_MUTEX_ERRORCHECK_NP
824
825AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
826
827AC_TRY_COMPILE(
828[
829#define _GNU_SOURCE
830#include <pthread.h>
831], [
832 return (PTHREAD_MUTEX_ERRORCHECK_NP);
833],
834[
835AC_MSG_RESULT([yes])
836AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
837 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
838], [
839AC_MSG_RESULT([no])
840])
841
842
843# Check for PTHREAD_MUTEX_RECURSIVE_NP
844
845AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
846
847AC_TRY_COMPILE(
848[
849#define _GNU_SOURCE
850#include <pthread.h>
851], [
852 return (PTHREAD_MUTEX_RECURSIVE_NP);
853],
854[
855AC_MSG_RESULT([yes])
856AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
857 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
858], [
859AC_MSG_RESULT([no])
860])
861
862
863# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
864
865AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
866
867AC_TRY_COMPILE(
868[
869#define _GNU_SOURCE
870#include <pthread.h>
871], [
872 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
873 return 0;
874],
875[
876AC_MSG_RESULT([yes])
877AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
878 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
879], [
880AC_MSG_RESULT([no])
881])
882
883
bart5e389f12008-04-05 12:53:15 +0000884# Check whether pthread_mutex_t has a member called __m_kind.
885
886AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
887
bart56730cd2008-05-11 06:41:46 +0000888AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000889[
bart56730cd2008-05-11 06:41:46 +0000890 #include <pthread.h>
891], [
bart5e389f12008-04-05 12:53:15 +0000892 pthread_mutex_t m;
893 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000894], [
bart5e389f12008-04-05 12:53:15 +0000895AC_MSG_RESULT([yes])
896AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
897 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
898], [
899AC_MSG_RESULT([no])
900])
901
902
903# Check whether pthread_mutex_t has a member called __data.__kind.
904
905AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
906
bart56730cd2008-05-11 06:41:46 +0000907AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000908[
bart56730cd2008-05-11 06:41:46 +0000909#include <pthread.h>
910], [
bart5e389f12008-04-05 12:53:15 +0000911 pthread_mutex_t m;
912 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000913], [
bart5e389f12008-04-05 12:53:15 +0000914AC_MSG_RESULT([yes])
915AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
916 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
917], [
918AC_MSG_RESULT([no])
919])
920
921
bart62c370e2008-05-12 18:50:51 +0000922# does this compiler support -maltivec and does it have the include file
923# <altivec.h> ?
924
925AC_MSG_CHECKING([for Altivec])
926
927safe_CFLAGS=$CFLAGS
928CFLAGS="-maltivec"
929
930AC_TRY_COMPILE(
931[
932#include <altivec.h>
933], [
934 vector unsigned int v;
935],
936[
937ac_have_altivec=yes
938AC_MSG_RESULT([yes])
939], [
940ac_have_altivec=no
941AC_MSG_RESULT([no])
942])
943CFLAGS=$safe_CFLAGS
944
945AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
946AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
947
948
bart36dd85a2009-04-26 07:11:48 +0000949# Check for pthread_create@GLIBC2.0
950AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
951
bart16e1c5a2009-04-26 07:38:53 +0000952safe_CFLAGS=$CFLAGS
953CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000954AC_TRY_LINK(
955[
956extern int pthread_create_glibc_2_0(void*, const void*,
957 void *(*)(void*), void*);
958__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
959], [
bart276ed3a2009-05-10 15:41:45 +0000960#ifdef __powerpc__
961/*
962 * Apparently on PowerPC linking this program succeeds and generates an
963 * executable with the undefined symbol pthread_create@GLIBC_2.0.
964 */
965#error This test does not work properly on PowerPC.
966#else
bart16e1c5a2009-04-26 07:38:53 +0000967 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000968#endif
bart16e1c5a2009-04-26 07:38:53 +0000969 return 0;
bart36dd85a2009-04-26 07:11:48 +0000970],
971[
972ac_have_pthread_create_glibc_2_0=yes
973AC_MSG_RESULT([yes])
974AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
975 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
976], [
977ac_have_pthread_create_glibc_2_0=no
978AC_MSG_RESULT([no])
979])
bart16e1c5a2009-04-26 07:38:53 +0000980CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000981
982AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000983 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000984
985
barta50aa8a2008-04-27 06:06:57 +0000986# Check for eventfd_t, eventfd() and eventfd_read()
987AC_MSG_CHECKING([for eventfd()])
988
989AC_TRY_LINK(
990[
991#include <sys/eventfd.h>
992], [
993 eventfd_t ev;
994 int fd;
995
996 fd = eventfd(5, 0);
997 eventfd_read(fd, &ev);
998 return 0;
999],
1000[
1001AC_MSG_RESULT([yes])
1002AC_DEFINE([HAVE_EVENTFD], 1,
1003 [Define to 1 if you have the `eventfd' function.])
1004AC_DEFINE([HAVE_EVENTFD_READ], 1,
1005 [Define to 1 if you have the `eventfd_read' function.])
1006], [
1007AC_MSG_RESULT([no])
1008])
1009
1010
njn7fd6d382009-01-22 21:56:32 +00001011#----------------------------------------------------------------------------
1012# Checking for supported compiler flags.
1013#----------------------------------------------------------------------------
1014
sewardj535c50f2005-06-04 23:14:53 +00001015# does this compiler support -m32 ?
1016AC_MSG_CHECKING([if gcc accepts -m32])
1017
1018safe_CFLAGS=$CFLAGS
1019CFLAGS="-m32"
1020
1021AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001022 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001023],
1024[
1025FLAG_M32="-m32"
1026AC_MSG_RESULT([yes])
1027], [
1028FLAG_M32=""
1029AC_MSG_RESULT([no])
1030])
1031CFLAGS=$safe_CFLAGS
1032
1033AC_SUBST(FLAG_M32)
1034
1035
sewardj03d86f22006-10-17 00:57:24 +00001036# does this compiler support -maix32 ?
1037AC_MSG_CHECKING([if gcc accepts -maix32])
1038
1039safe_CFLAGS=$CFLAGS
1040CFLAGS="-maix32"
1041
1042AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001043 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001044],
1045[
1046FLAG_MAIX32="-maix32"
1047AC_MSG_RESULT([yes])
1048], [
1049FLAG_MAIX32=""
1050AC_MSG_RESULT([no])
1051])
1052CFLAGS=$safe_CFLAGS
1053
1054AC_SUBST(FLAG_MAIX32)
1055
1056
sewardj01262142006-01-04 01:20:28 +00001057# does this compiler support -m64 ?
1058AC_MSG_CHECKING([if gcc accepts -m64])
1059
1060safe_CFLAGS=$CFLAGS
1061CFLAGS="-m64"
1062
1063AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001064 return 0;
sewardj01262142006-01-04 01:20:28 +00001065],
1066[
1067FLAG_M64="-m64"
1068AC_MSG_RESULT([yes])
1069], [
1070FLAG_M64=""
1071AC_MSG_RESULT([no])
1072])
1073CFLAGS=$safe_CFLAGS
1074
1075AC_SUBST(FLAG_M64)
1076
1077
sewardj03d86f22006-10-17 00:57:24 +00001078# does this compiler support -maix64 ?
1079AC_MSG_CHECKING([if gcc accepts -maix64])
1080
1081safe_CFLAGS=$CFLAGS
1082CFLAGS="-maix64"
1083
1084AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001085 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001086],
1087[
1088FLAG_MAIX64="-maix64"
1089AC_MSG_RESULT([yes])
1090], [
1091FLAG_MAIX64=""
1092AC_MSG_RESULT([no])
1093])
1094CFLAGS=$safe_CFLAGS
1095
1096AC_SUBST(FLAG_MAIX64)
1097
1098
sewardj67f1fcc2005-07-03 10:41:02 +00001099# does this compiler support -mmmx ?
1100AC_MSG_CHECKING([if gcc accepts -mmmx])
1101
1102safe_CFLAGS=$CFLAGS
1103CFLAGS="-mmmx"
1104
1105AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001106 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001107],
1108[
1109FLAG_MMMX="-mmmx"
1110AC_MSG_RESULT([yes])
1111], [
1112FLAG_MMMX=""
1113AC_MSG_RESULT([no])
1114])
1115CFLAGS=$safe_CFLAGS
1116
1117AC_SUBST(FLAG_MMMX)
1118
1119
1120# does this compiler support -msse ?
1121AC_MSG_CHECKING([if gcc accepts -msse])
1122
1123safe_CFLAGS=$CFLAGS
1124CFLAGS="-msse"
1125
1126AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001127 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001128],
1129[
1130FLAG_MSSE="-msse"
1131AC_MSG_RESULT([yes])
1132], [
1133FLAG_MSSE=""
1134AC_MSG_RESULT([no])
1135])
1136CFLAGS=$safe_CFLAGS
1137
1138AC_SUBST(FLAG_MSSE)
1139
1140
sewardj5b754b42002-06-03 22:53:35 +00001141# does this compiler support -mpreferred-stack-boundary=2 ?
1142AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1143
daywalker3664f562003-10-17 13:43:46 +00001144safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001145CFLAGS="-mpreferred-stack-boundary=2"
1146
1147AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001148 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001149],
1150[
1151PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001152AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001153], [
1154PREFERRED_STACK_BOUNDARY=""
1155AC_MSG_RESULT([no])
1156])
daywalker3664f562003-10-17 13:43:46 +00001157CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001158
1159AC_SUBST(PREFERRED_STACK_BOUNDARY)
1160
sewardj535c50f2005-06-04 23:14:53 +00001161
sewardjb5f6f512005-03-10 23:59:00 +00001162# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001163AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001164
1165safe_CFLAGS=$CFLAGS
1166CFLAGS="-Wno-pointer-sign"
1167
1168AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001169 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001170],
1171[
1172no_pointer_sign=yes
1173AC_MSG_RESULT([yes])
1174], [
1175no_pointer_sign=no
1176AC_MSG_RESULT([no])
1177])
1178CFLAGS=$safe_CFLAGS
1179
1180if test x$no_pointer_sign = xyes; then
1181 CFLAGS="$CFLAGS -Wno-pointer-sign"
1182fi
1183
sewardj535c50f2005-06-04 23:14:53 +00001184
tom1e946682005-10-12 11:27:33 +00001185# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001186AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001187
1188safe_CFLAGS=$CFLAGS
1189CFLAGS="-Wdeclaration-after-statement"
1190
1191AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001192 return 0;
tom1e946682005-10-12 11:27:33 +00001193],
1194[
tome9814c32005-10-12 11:30:43 +00001195declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001196FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001197AC_MSG_RESULT([yes])
1198], [
tome9814c32005-10-12 11:30:43 +00001199declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001200FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001201AC_MSG_RESULT([no])
1202])
1203CFLAGS=$safe_CFLAGS
1204
sewardj72a547e2006-01-25 02:58:28 +00001205AC_SUBST(FLAG_WDECL_AFTER_STMT)
1206
tome9814c32005-10-12 11:30:43 +00001207if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001208 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1209fi
1210
sewardj00f1e622006-03-12 16:47:10 +00001211
barte026bd22009-07-04 12:17:07 +00001212# does this compiler support -Wno-empty-body ?
1213
1214AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1215
1216safe_CFLAGS=$CFLAGS
1217CFLAGS="-Wno-empty-body"
1218
1219AC_TRY_COMPILE(
1220[ ],
1221[
1222 return 0;
1223],
1224[
1225AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1226AC_MSG_RESULT([yes])
1227],
1228[
1229AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1230AC_MSG_RESULT([no])
1231])
1232CFLAGS=$safe_CFLAGS
1233
1234
bart9d865fa2008-06-23 12:11:49 +00001235# does this compiler support -Wno-format-zero-length ?
1236
1237AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1238
1239safe_CFLAGS=$CFLAGS
1240CFLAGS="-Wno-format-zero-length"
1241
1242AC_TRY_COMPILE(
1243[ ],
1244[
1245 return 0;
1246],
1247[
1248AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1249AC_MSG_RESULT([yes])
1250],
1251[
1252AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1253AC_MSG_RESULT([no])
1254])
1255CFLAGS=$safe_CFLAGS
1256
1257
bart56730cd2008-05-11 06:41:46 +00001258# does this compiler support -Wextra or the older -W ?
1259
1260AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1261
1262safe_CFLAGS=$CFLAGS
1263CFLAGS="-Wextra"
1264
1265AC_TRY_COMPILE(
1266[ ],
1267[
1268 return 0;
1269],
1270[
1271AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1272AC_MSG_RESULT([-Wextra])
1273], [
1274 CFLAGS="-W"
1275 AC_TRY_COMPILE(
1276 [ ],
1277 [
1278 return 0;
1279 ],
1280 [
1281 AC_SUBST([FLAG_W_EXTRA], [-W])
1282 AC_MSG_RESULT([-W])
1283 ], [
1284 AC_SUBST([FLAG_W_EXTRA], [])
1285 AC_MSG_RESULT([not supported])
1286 ])
1287])
1288CFLAGS=$safe_CFLAGS
1289
1290
sewardja72c26d2007-05-01 13:44:08 +00001291# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001292AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001293
1294safe_CFLAGS=$CFLAGS
1295CFLAGS="-fno-stack-protector"
1296
1297AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001298 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001299],
1300[
1301no_stack_protector=yes
1302FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1303AC_MSG_RESULT([yes])
1304], [
1305no_stack_protector=no
1306FLAG_FNO_STACK_PROTECTOR=""
1307AC_MSG_RESULT([no])
1308])
1309CFLAGS=$safe_CFLAGS
1310
1311AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1312
1313if test x$no_stack_protector = xyes; then
1314 CFLAGS="$CFLAGS -fno-stack-protector"
1315fi
1316
1317
bart56730cd2008-05-11 06:41:46 +00001318# does this compiler support --param inline-unit-growth=... ?
1319
1320AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1321
1322safe_CFLAGS=$CFLAGS
1323CFLAGS="--param inline-unit-growth=900"
1324
1325AC_TRY_COMPILE(
1326[ ],
1327[
1328 return 0;
1329],
1330[
1331AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1332 ["--param inline-unit-growth=900"])
1333AC_MSG_RESULT([yes])
1334], [
1335AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1336AC_MSG_RESULT([no])
1337])
1338CFLAGS=$safe_CFLAGS
1339
1340
tomd55121e2005-12-19 12:40:13 +00001341# does this compiler support __builtin_expect?
1342AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001343
tomd55121e2005-12-19 12:40:13 +00001344AC_TRY_LINK(, [
1345return __builtin_expect(1, 1) ? 1 : 0
1346],
1347[
1348ac_have_builtin_expect=yes
1349AC_MSG_RESULT([yes])
1350], [
1351ac_have_builtin_expect=no
1352AC_MSG_RESULT([no])
1353])
1354if test x$ac_have_builtin_expect = xyes ; then
1355 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1356fi
1357
tom1e946682005-10-12 11:27:33 +00001358
sewardj00f1e622006-03-12 16:47:10 +00001359# does the ppc assembler support "mtocrf" et al?
1360AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1361
1362AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001363__asm__ __volatile__("mtocrf 4,0");
1364__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001365],
1366[
1367ac_have_as_ppc_mftocrf=yes
1368AC_MSG_RESULT([yes])
1369], [
1370ac_have_as_ppc_mftocrf=no
1371AC_MSG_RESULT([no])
1372])
1373if test x$ac_have_as_ppc_mftocrf = xyes ; then
1374 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1375fi
1376
1377
sewardjf0aabf82007-03-22 00:24:21 +00001378# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001379# Note, this doesn't generate a C-level symbol. It generates a
1380# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001381AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1382
1383AC_TRY_COMPILE(, [
1384 do { long long int x;
1385 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1386 while (0)
1387],
1388[
1389ac_have_as_sse3=yes
1390AC_MSG_RESULT([yes])
1391], [
1392ac_have_as_sse3=no
1393AC_MSG_RESULT([no])
1394])
sewardjfa18a262007-03-22 12:13:13 +00001395
1396AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001397
1398
sewardj6d6da5b2008-02-09 12:07:40 +00001399# Ditto for SSSE3 instructions (note extra S)
1400# Note, this doesn't generate a C-level symbol. It generates a
1401# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1402AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1403
1404AC_TRY_COMPILE(, [
1405 do { long long int x;
1406 __asm__ __volatile__(
1407 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1408 while (0)
1409],
1410[
1411ac_have_as_ssse3=yes
1412AC_MSG_RESULT([yes])
1413], [
1414ac_have_as_ssse3=no
1415AC_MSG_RESULT([no])
1416])
1417
1418AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1419
1420
sewardjb5f6f512005-03-10 23:59:00 +00001421# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001422if test "x${cross_compiling}" = "xno"; then
1423# Native compilation: check whether running a program using TLS succeeds.
1424# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1425# succeeds but running programs using TLS fails.
1426AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1427 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1428 [vg_cv_tls=$enableval],
1429 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1430 [[return foo;]])],
1431 [vg_cv_tls=yes],
1432 [vg_cv_tls=no])])])
1433else
1434# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001435AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1436 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1437 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001438 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001439 [[return foo;]])],
1440 [vg_cv_tls=yes],
1441 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001442fi
sewardjb5f6f512005-03-10 23:59:00 +00001443
1444if test "$vg_cv_tls" = yes; then
1445AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1446fi
sewardj5b754b42002-06-03 22:53:35 +00001447
sewardj535c50f2005-06-04 23:14:53 +00001448
njn7fd6d382009-01-22 21:56:32 +00001449#----------------------------------------------------------------------------
njnf76d27a2009-05-28 01:53:07 +00001450# Check for /proc filesystem
1451#----------------------------------------------------------------------------
1452AC_CHECK_FILES(/proc/self/fd /proc/self/exe /proc/self/maps,
1453 [ AC_DEFINE([HAVE_PROC], 1, [can use /proc filesystem]) ],
1454 [])
1455
1456
1457#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001458# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001459#----------------------------------------------------------------------------
1460
sewardjde4a1d02002-03-22 01:27:54 +00001461AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001462AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001463 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001464 endian.h \
1465 mqueue.h \
1466 sys/endian.h \
1467 sys/epoll.h \
1468 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001469 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001470 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001471 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001472 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001473 sys/syscall.h \
1474 sys/time.h \
1475 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001476 ])
sewardjde4a1d02002-03-22 01:27:54 +00001477
njn7fd6d382009-01-22 21:56:32 +00001478#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001479# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001480#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001481AC_TYPE_UID_T
1482AC_TYPE_OFF_T
1483AC_TYPE_SIZE_T
1484AC_HEADER_TIME
1485
sewardj535c50f2005-06-04 23:14:53 +00001486
njn7fd6d382009-01-22 21:56:32 +00001487#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001488# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001489#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001490AC_FUNC_MEMCMP
1491AC_FUNC_MMAP
1492AC_TYPE_SIGNAL
1493
bart71bad292008-04-27 11:43:23 +00001494AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001495
bartf5ceec82008-04-26 07:45:10 +00001496AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001497 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001498 epoll_create \
1499 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001500 floor \
bartce48fa92008-04-26 10:59:46 +00001501 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001502 mallinfo \
1503 memchr \
1504 memset \
1505 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001506 mremap \
bartf5ceec82008-04-26 07:45:10 +00001507 ppoll \
bart6d45e922009-01-20 13:45:38 +00001508 pthread_barrier_init \
1509 pthread_condattr_setclock \
1510 pthread_mutex_timedlock \
1511 pthread_rwlock_timedrdlock \
1512 pthread_rwlock_timedwrlock \
1513 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001514 semtimedop \
1515 signalfd \
njn6cc22472009-03-16 03:46:48 +00001516 sigwaitinfo \
bart71bad292008-04-27 11:43:23 +00001517 syscall \
bartf5ceec82008-04-26 07:45:10 +00001518 strchr \
1519 strdup \
1520 strpbrk \
1521 strrchr \
1522 strstr \
1523 timerfd \
1524 utimensat \
1525 ])
sewardjde4a1d02002-03-22 01:27:54 +00001526
bart623eec32008-07-29 17:54:49 +00001527# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1528# libraries with any shared object and/or executable. This is NOT what we
1529# want for e.g. vgpreload_core-x86-linux.so
1530LIBS=""
sewardj80637752006-03-02 13:48:21 +00001531
bart6d45e922009-01-20 13:45:38 +00001532AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1533 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001534AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1535 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001536AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1537 [test x$ac_cv_func_pthread_spin_lock = xyes])
1538
njn7fd6d382009-01-22 21:56:32 +00001539
1540#----------------------------------------------------------------------------
1541# MPI checks
1542#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001543# Do we have a useable MPI setup on the primary and/or secondary targets?
1544# On Linux, by default, assumes mpicc and -m32/-m64
1545# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001546# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001547# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1548# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001549MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001550if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1551 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001552 MPI_CC="mpxlc"
1553fi
1554
sewardje9fa5062006-03-12 18:29:18 +00001555mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001556if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1557 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001558 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001559elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1560 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001561 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001562elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001563 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001564elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001565 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001566fi
1567
sewardj03d86f22006-10-17 00:57:24 +00001568mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001569if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1570 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001571 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001572elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001573 mflag_secondary=-q32
1574fi
1575
1576
sewardj0ad46092006-03-02 17:09:16 +00001577AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001578 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001579 MPI_CC=$withval
1580)
sewardj03d86f22006-10-17 00:57:24 +00001581AC_SUBST(MPI_CC)
1582
1583## See if MPI_CC works for the primary target
1584##
1585AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001586saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001587saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001588CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001589CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001590AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001591#include <mpi.h>
1592#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001593],[
1594 int r = MPI_Init(NULL,NULL);
1595 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1596 return r;
1597], [
sewardj03d86f22006-10-17 00:57:24 +00001598ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001599AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001600], [
sewardj03d86f22006-10-17 00:57:24 +00001601ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001602AC_MSG_RESULT([no])
1603])
sewardj0ad46092006-03-02 17:09:16 +00001604CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001605CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001606AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001607
sewardj03d86f22006-10-17 00:57:24 +00001608## See if MPI_CC works for the secondary target. Complication: what if
1609## there is no secondary target? We need this to then fail.
1610## Kludge this by making MPI_CC something which will surely fail in
1611## such a case.
1612##
1613AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1614saved_CC=$CC
1615saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001616if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001617 CC="$MPI_CC this will surely fail"
1618else
1619 CC=$MPI_CC
1620fi
1621CFLAGS=$mflag_secondary
1622AC_TRY_LINK([
1623#include <mpi.h>
1624#include <stdio.h>
1625],[
1626 int r = MPI_Init(NULL,NULL);
1627 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1628 return r;
1629], [
1630ac_have_mpi2_sec=yes
1631AC_MSG_RESULT([yes, $MPI_CC])
1632], [
1633ac_have_mpi2_sec=no
1634AC_MSG_RESULT([no])
1635])
1636CC=$saved_CC
1637CFLAGS=$saved_CFLAGS
1638AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001639
1640
njn7fd6d382009-01-22 21:56:32 +00001641#----------------------------------------------------------------------------
1642# Other library checks
1643#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001644# There now follow some tests for QtCore, Boost, and OpenMP. These
1645# tests are present because Drd has some regression tests that use
1646# these packages. All regression test programs all compiled only
1647# for the primary target. And so it is important that the configure
1648# checks that follow, use the correct -m32 or -m64 flag for the
1649# primary target (called $mflag_primary). Otherwise, we can end up
1650# in a situation (eg) where, on amd64-linux, the test for Boost checks
1651# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1652# only build (meaning, the primary target is x86-linux), the build
1653# of the regtest programs that use Boost fails, because they are
1654# build as 32-bit (IN THIS EXAMPLE).
1655#
1656# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1657# NEEDED BY THE REGRESSION TEST PROGRAMS.
1658
1659
bart21d3cfc2008-08-02 09:08:17 +00001660# The test below verifies whether the QtCore package been installed.
1661# This test works as follows:
1662# - If pkg-config was not installed at the time autogen.sh was run,
1663# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1664# autogen.sh. Augogen.sh will generate a configure script that prints
1665# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1666# - If pkg-config was installed at the time autogen.sh was run,
1667# the generated configure script will try to detect the presence of the
1668# Qt4 QtCore library by looking up compile and linker flags in the file
1669# called QtCore.pc.
1670# - pkg-config settings can be overridden via the configure variables
1671# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1672# configure script -- see also ./configure --help).
1673# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1674# the pkg-config executable is not present on the system on which the
1675# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001676
bart21d3cfc2008-08-02 09:08:17 +00001677ifdef(
1678 [PKG_CHECK_EXISTS],
1679 [PKG_CHECK_EXISTS(
1680 [QtCore],
1681 [
1682 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001683 # Paranoia: don't trust the result reported by pkg-config, but when
1684 # pkg-config reports that QtCore has been found, verify whether linking
1685 # programs with QtCore succeeds.
1686 AC_LANG(C++)
1687 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001688 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001689 AC_TRY_LINK(
1690 [#include <QMutex>],
1691 [QMutex Mutex;],
1692 [ac_have_qtcore=yes],
1693 [
1694 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1695 ac_have_qtcore=no
1696 ]
1697 )
1698 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001699 ],
1700 [
1701 ac_have_qtcore=no
1702 ]
1703 )
1704 ],
1705 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1706 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1707 [ac_have_qtcore=no]
1708)
bart41ac62a2008-07-07 16:58:03 +00001709
1710AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1711
1712
bart62f54e42008-07-28 11:35:10 +00001713# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1714# See also http://doc.trolltech.com/4.3/qmutex.html.
1715if test x$ac_have_qtcore = xyes; then
1716 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1717 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001718 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001719 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001720 AC_TRY_COMPILE([
1721 #include <QtCore/QMutex>
1722 ],
1723 [
1724 QMutex M;
1725 M.tryLock(1);
1726 M.unlock();
1727 return 0;
1728 ],
1729 [
1730 AC_MSG_RESULT([yes])
1731 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1732 ],
1733 [
1734 AC_MSG_RESULT([no])
1735 ])
bart21d3cfc2008-08-02 09:08:17 +00001736 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001737 AC_LANG(C)
1738fi
1739
1740
sewardj493c4ef2008-12-13 16:45:19 +00001741# Check whether the boost library 1.35 or later has been installed.
1742# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1743
1744AC_MSG_CHECKING([for boost])
1745
1746AC_LANG(C++)
1747safe_CXXFLAGS=$CXXFLAGS
1748CXXFLAGS="-lboost_thread-mt $mflag_primary"
1749
1750AC_LINK_IFELSE(
1751[
1752#include <boost/thread.hpp>
1753static void thread_func(void)
1754{ }
1755int main(int argc, char** argv)
1756{
1757 boost::thread t(thread_func);
1758 return 0;
1759}
1760],
1761[
1762ac_have_boost_1_35=yes
1763AC_SUBST([BOOST_CFLAGS], [])
1764AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1765AC_MSG_RESULT([yes])
1766], [
1767ac_have_boost_1_35=no
1768AC_MSG_RESULT([no])
1769])
1770
1771CXXFLAGS=$safe_CXXFLAGS
1772AC_LANG(C)
1773
1774AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1775
1776
1777# does this compiler support -fopenmp, does it have the include file
1778# <omp.h> and does it have libgomp ?
1779
1780AC_MSG_CHECKING([for OpenMP])
1781
1782safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001783CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001784
1785AC_LINK_IFELSE(
1786[
1787#include <omp.h>
1788int main(int argc, char** argv)
1789{
1790 omp_set_dynamic(0);
1791 return 0;
1792}
1793],
1794[
1795ac_have_openmp=yes
1796AC_MSG_RESULT([yes])
1797], [
1798ac_have_openmp=no
1799AC_MSG_RESULT([no])
1800])
1801CFLAGS=$safe_CFLAGS
1802
1803AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1804
1805
sewardjc876a2f2009-01-22 22:44:30 +00001806# does this compiler have built-in functions for atomic memory access ?
1807AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1808
1809safe_CFLAGS=$CFLAGS
1810CFLAGS="$mflag_primary"
1811
1812AC_TRY_LINK(,
1813[
1814 int variable = 1;
1815 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1816 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1817],
1818[
bartc82d1372009-05-31 16:21:23 +00001819 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001820 AC_MSG_RESULT([yes])
1821 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1822],
1823[
bartc82d1372009-05-31 16:21:23 +00001824 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001825 AC_MSG_RESULT([no])
1826])
1827
1828CFLAGS=$safe_CFLAGS
1829
bartc82d1372009-05-31 16:21:23 +00001830AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1831
sewardjc876a2f2009-01-22 22:44:30 +00001832
njn7fd6d382009-01-22 21:56:32 +00001833#----------------------------------------------------------------------------
1834# Ok. We're done checking.
1835#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001836
njn8b68b642009-06-24 00:37:09 +00001837# Nb: VEX/Makefile is generated from Makefile.vex.in.
1838AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001839 Makefile
njn8b68b642009-06-24 00:37:09 +00001840 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001841 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001842 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001843 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001844 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001845 docs/lib/Makefile
1846 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001847 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001848 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001849 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001850 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001851 perf/Makefile
1852 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001853 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001854 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001855 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001856 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001857 memcheck/Makefile
1858 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001859 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001860 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001861 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001862 memcheck/tests/darwin/Makefile
njna454ec02009-01-19 03:16:59 +00001863 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001864 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001865 memcheck/docs/Makefile
1866 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001867 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001868 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001869 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001870 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001871 callgrind/Makefile
1872 callgrind/callgrind_annotate
1873 callgrind/callgrind_control
1874 callgrind/tests/Makefile
1875 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001876 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001877 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001878 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001879 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001880 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001881 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001882 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001883 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001884 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001885 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001886 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001887 none/Makefile
1888 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001889 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001890 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001891 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001892 none/tests/x86/Makefile
njn0458a122009-02-13 06:23:46 +00001893 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001894 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001895 none/tests/x86-linux/Makefile
njn9bc8c002002-10-02 13:49:13 +00001896 none/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001897 exp-ptrcheck/Makefile
1898 exp-ptrcheck/tests/Makefile
1899 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001900 drd/Makefile
1901 drd/docs/Makefile
1902 drd/scripts/download-and-build-splash2
1903 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001904 exp-bbv/Makefile
1905 exp-bbv/docs/Makefile
1906 exp-bbv/tests/Makefile
1907 exp-bbv/tests/x86/Makefile
1908 exp-bbv/tests/x86-linux/Makefile
1909 exp-bbv/tests/amd64-linux/Makefile
1910 exp-bbv/tests/ppc32-linux/Makefile
njn8b68b642009-06-24 00:37:09 +00001911])
1912AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001913
1914cat<<EOF
1915
njn311303f2009-02-06 03:46:50 +00001916 Maximum build arch: ${ARCH_MAX}
1917 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001918 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001919 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001920 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1921 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001922 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001923
gobry3b777892002-04-04 09:18:39 +00001924EOF