blob: c4f33062db2763ecfa459ea15340528020392cd4 [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}"
267 ;;
268 *)
269 AC_MSG_RESULT([unsupported (${kernel})])
270 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
271 ;;
272 esac
273 ;;
274
sewardjde4a1d02002-03-22 01:27:54 +0000275 *)
276 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000277 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000278 ;;
279esac
280
njn7fd6d382009-01-22 21:56:32 +0000281#----------------------------------------------------------------------------
282
tomd6398392006-06-07 17:44:36 +0000283# If we are building on a 64 bit platform test to see if the system
284# supports building 32 bit programs and disable 32 bit support if it
285# does not support building 32 bit programs
286
njn7fd6d382009-01-22 21:56:32 +0000287case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000288 amd64-linux|ppc64-linux)
289 AC_MSG_CHECKING([for 32 bit build support])
290 safe_CFLAGS=$CFLAGS
291 CFLAGS="-m32"
292 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000293 return 0;
tomd6398392006-06-07 17:44:36 +0000294 ],
295 [
296 AC_MSG_RESULT([yes])
297 ], [
298 vg_cv_only64bit="yes"
299 AC_MSG_RESULT([no])
300 ])
301 CFLAGS=$safe_CFLAGS;;
302esac
303
304if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
305 AC_MSG_ERROR(
306 [--enable-only32bit was specified but system does not support 32 bit builds])
307fi
nethercote888ecb72004-08-23 14:54:40 +0000308
njn7fd6d382009-01-22 21:56:32 +0000309#----------------------------------------------------------------------------
310
njn311303f2009-02-06 03:46:50 +0000311# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
312# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
313# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
314# above) will be "amd64" since that reflects the most that this cpu can do,
315# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
316# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000317# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
318# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
319AC_SUBST(VGCONF_ARCH_PRI)
320
njn3f8a6e92009-06-02 00:20:47 +0000321# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
322# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
323# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
324# It is empty if there is no secondary target.
325AC_SUBST(VGCONF_ARCH_SEC)
326
njn311303f2009-02-06 03:46:50 +0000327# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
328# The entire system, including regression and performance tests, will be
329# built for this target. The "_CAPS" indicates that the name is in capital
330# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000331# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000332# convention and cannot contain '-' characters. This is in contrast to
333# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000334AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
335
336# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
337# Valgrind and tools will also be built for this target, but not the
338# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000339#
njn7fd6d382009-01-22 21:56:32 +0000340# By default, the primary arch is the same as the "max" arch, as commented
341# above (at the definition of ARCH_MAX). We may choose to downgrade it in
342# the big case statement just below here, in the case where we're building
343# on a 64 bit machine but have been requested only to do a 32 bit build.
344AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
345
sewardj01262142006-01-04 01:20:28 +0000346AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000347
njn7fd6d382009-01-22 21:56:32 +0000348case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000349 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000350 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000351 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000352 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
353 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000354 valt_load_address_normal="0x38000000"
355 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000356 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000357 ;;
358 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000359 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000360 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000361 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000362 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
363 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000364 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000365 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000366 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000367 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
368 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000369 else
njn7fd6d382009-01-22 21:56:32 +0000370 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000371 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000372 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
373 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000374 fi
njnd74b0ef2009-01-20 06:06:52 +0000375 valt_load_address_normal="0x38000000"
376 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000377 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000378 ;;
379 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000380 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000381 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000382 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
383 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000384 valt_load_address_normal="0x38000000"
385 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000386 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000387 ;;
sewardj03d86f22006-10-17 00:57:24 +0000388 ppc64-aix5)
389 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000390 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000391 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000392 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
393 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000394 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000395 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000396 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000397 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
398 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000399 else
njn7fd6d382009-01-22 21:56:32 +0000400 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000401 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000402 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
403 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000404 fi
njnd74b0ef2009-01-20 06:06:52 +0000405 valt_load_address_normal="0x38000000"
406 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000407 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000408 ;;
sewardj01262142006-01-04 01:20:28 +0000409 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000410 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000411 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000412 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000413 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
414 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000415 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000416 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000417 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000418 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
419 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000420 else
njn7fd6d382009-01-22 21:56:32 +0000421 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000422 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000423 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
424 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000425 fi
njnd74b0ef2009-01-20 06:06:52 +0000426 valt_load_address_normal="0x38000000"
427 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000428 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000429 ;;
njnf76d27a2009-05-28 01:53:07 +0000430 x86-darwin)
431 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000432 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000433 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
434 VGCONF_PLATFORM_SEC_CAPS=""
435 valt_load_address_normal="0x0"
436 valt_load_address_inner="0x0"
437 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
438 ;;
439 amd64-darwin)
440 if test x$vg_cv_only64bit = xyes; then
441 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000442 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000443 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
444 VGCONF_PLATFORM_SEC_CAPS=""
445 elif test x$vg_cv_only32bit = xyes; then
446 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000447 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000448 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
449 VGCONF_PLATFORM_SEC_CAPS=""
450 VGCONF_ARCH_PRI_CAPS="x86"
451 else
452 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000453 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000454 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
455 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
456 fi
457 valt_load_address_normal="0x0"
458 valt_load_address_inner="0x0"
459 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
460 ;;
nethercote888ecb72004-08-23 14:54:40 +0000461 *)
njn7fd6d382009-01-22 21:56:32 +0000462 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000463 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000464 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
465 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njn377c43f2009-05-19 07:39:22 +0000466 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000467 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000468 ;;
469esac
sewardjde4a1d02002-03-22 01:27:54 +0000470
njn7fd6d382009-01-22 21:56:32 +0000471#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000472
njn7fd6d382009-01-22 21:56:32 +0000473# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
474# defined.
475AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
476 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000477 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
478 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
479 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000480AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000481 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
482 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000483AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
484 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
485 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
486 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
487 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
488AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
489 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
490 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj03d86f22006-10-17 00:57:24 +0000491
njn7fd6d382009-01-22 21:56:32 +0000492# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
493# become defined.
494AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
495 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
496 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
497AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
498 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
499AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
500 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
501 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
502AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
503 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000504
njn7fd6d382009-01-22 21:56:32 +0000505AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
506 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
507 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
508AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
509 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
510
njnf76d27a2009-05-28 01:53:07 +0000511AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
512 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
513 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
514AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
515 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
516
517
njn7fd6d382009-01-22 21:56:32 +0000518# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000519# Relies on the assumption that the primary and secondary targets are
520# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000521AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
522 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
523 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
524 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
525 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
526AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
527 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
528 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000529AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
530 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
531 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000532
533
njn7fd6d382009-01-22 21:56:32 +0000534# Sometimes, in the Makefile.am files, it's useful to know whether or not
535# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000536AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000537 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000538
tomb637bad2005-11-08 12:28:35 +0000539
njn7fd6d382009-01-22 21:56:32 +0000540#----------------------------------------------------------------------------
541# Inner Valgrind?
542#----------------------------------------------------------------------------
543
njnd74b0ef2009-01-20 06:06:52 +0000544# Check if this should be built as an inner Valgrind, to be run within
545# another Valgrind. Choose the load address accordingly.
546AC_SUBST(VALT_LOAD_ADDRESS)
547AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
548 [AC_ARG_ENABLE(inner,
549 [ --enable-inner enables self-hosting],
550 [vg_cv_inner=$enableval],
551 [vg_cv_inner=no])])
552if test "$vg_cv_inner" = yes; then
553 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
554 VALT_LOAD_ADDRESS=$valt_load_address_inner
555else
556 VALT_LOAD_ADDRESS=$valt_load_address_normal
557fi
558
559
njn7fd6d382009-01-22 21:56:32 +0000560#----------------------------------------------------------------------------
561# Libc and suppressions
562#----------------------------------------------------------------------------
563# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000564AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000565
dirk07596a22008-04-25 11:33:30 +0000566GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000567
sewardjde4a1d02002-03-22 01:27:54 +0000568AC_EGREP_CPP([GLIBC_22], [
569#include <features.h>
570#ifdef __GNU_LIBRARY__
571 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
572 GLIBC_22
573 #endif
574#endif
575],
dirk07596a22008-04-25 11:33:30 +0000576GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000577
sewardj08c7f012002-10-07 23:56:55 +0000578AC_EGREP_CPP([GLIBC_23], [
579#include <features.h>
580#ifdef __GNU_LIBRARY__
581 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
582 GLIBC_23
583 #endif
584#endif
585],
dirk07596a22008-04-25 11:33:30 +0000586GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000587
njn781dba52005-06-30 04:06:38 +0000588AC_EGREP_CPP([GLIBC_24], [
589#include <features.h>
590#ifdef __GNU_LIBRARY__
591 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
592 GLIBC_24
593 #endif
594#endif
595],
dirk07596a22008-04-25 11:33:30 +0000596GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000597
dirkaece45c2006-10-12 08:17:49 +0000598AC_EGREP_CPP([GLIBC_25], [
599#include <features.h>
600#ifdef __GNU_LIBRARY__
601 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
602 GLIBC_25
603 #endif
604#endif
605],
dirk07596a22008-04-25 11:33:30 +0000606GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000607
dirkc8bd0c52007-05-23 17:39:08 +0000608AC_EGREP_CPP([GLIBC_26], [
609#include <features.h>
610#ifdef __GNU_LIBRARY__
611 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
612 GLIBC_26
613 #endif
614#endif
615],
dirk07596a22008-04-25 11:33:30 +0000616GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000617
sewardj68c80c12007-11-18 14:40:02 +0000618AC_EGREP_CPP([GLIBC_27], [
619#include <features.h>
620#ifdef __GNU_LIBRARY__
621 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
622 GLIBC_27
623 #endif
624#endif
625],
dirk07596a22008-04-25 11:33:30 +0000626GLIBC_VERSION="2.7")
627
628AC_EGREP_CPP([GLIBC_28], [
629#include <features.h>
630#ifdef __GNU_LIBRARY__
631 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
632 GLIBC_28
633 #endif
634#endif
635],
636GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000637
dirkd2e31eb2008-11-19 23:58:36 +0000638AC_EGREP_CPP([GLIBC_29], [
639#include <features.h>
640#ifdef __GNU_LIBRARY__
641 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
642 GLIBC_29
643 #endif
644#endif
645],
646GLIBC_VERSION="2.9")
647
sewardj5d425e82009-02-01 19:01:11 +0000648AC_EGREP_CPP([GLIBC_210], [
649#include <features.h>
650#ifdef __GNU_LIBRARY__
651 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
652 GLIBC_210
653 #endif
654#endif
655],
656GLIBC_VERSION="2.10")
657
sewardj03d86f22006-10-17 00:57:24 +0000658AC_EGREP_CPP([AIX5_LIBC], [
659#include <standards.h>
660#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
661 AIX5_LIBC
662#endif
663],
dirk07596a22008-04-25 11:33:30 +0000664GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000665
njnf76d27a2009-05-28 01:53:07 +0000666# not really a version check
667AC_EGREP_CPP([DARWIN_LIBC], [
668#include <sys/cdefs.h>
669#if defined(__DARWIN_VERS_1050)
670 DARWIN_LIBC
671#endif
672],
673GLIBC_VERSION="darwin")
674
dirk07596a22008-04-25 11:33:30 +0000675AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000676
dirk07596a22008-04-25 11:33:30 +0000677case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000678 2.2)
679 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000680 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000681 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
682 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000683 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000684 ;;
685
sewardj08c7f012002-10-07 23:56:55 +0000686 2.3)
687 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000688 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000689 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000690 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000691 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000692 ;;
693
njn781dba52005-06-30 04:06:38 +0000694 2.4)
695 AC_MSG_RESULT(2.4 family)
696 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000697 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000698 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000699 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000700 ;;
701
dirkaece45c2006-10-12 08:17:49 +0000702 2.5)
703 AC_MSG_RESULT(2.5 family)
704 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000705 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000706 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000707 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000708 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000709 2.6)
710 AC_MSG_RESULT(2.6 family)
711 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000712 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000713 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000714 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000715 ;;
716 2.7)
717 AC_MSG_RESULT(2.7 family)
718 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000719 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000720 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000721 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000722 ;;
dirk07596a22008-04-25 11:33:30 +0000723 2.8)
724 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000725 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000726 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
727 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
728 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
729 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000730 2.9)
731 AC_MSG_RESULT(2.9 family)
732 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
733 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
734 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
735 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
736 ;;
sewardj5d425e82009-02-01 19:01:11 +0000737 2.10)
738 AC_MSG_RESULT(2.10 family)
739 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
740 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
741 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
742 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
743 ;;
sewardj03d86f22006-10-17 00:57:24 +0000744 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000745 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
746 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 +0000747 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
748 ;;
njnf76d27a2009-05-28 01:53:07 +0000749 darwin)
750 AC_MSG_RESULT(Darwin)
751 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
752 # DEFAULT_SUPP set by kernel version check above.
753 ;;
dirkaece45c2006-10-12 08:17:49 +0000754
sewardjde4a1d02002-03-22 01:27:54 +0000755 *)
756 AC_MSG_RESULT(unsupported version)
sewardj5d425e82009-02-01 19:01:11 +0000757 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.10])
dirk07596a22008-04-25 11:33:30 +0000758 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000759 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000760 ;;
761esac
762
dirk07596a22008-04-25 11:33:30 +0000763AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000764
sewardj414f3582008-07-18 20:46:00 +0000765
766# Add default suppressions for the X client libraries. Make no
767# attempt to detect whether such libraries are installed on the
768# build machine (or even if any X facilities are present); just
769# add the suppressions antidisirregardless.
770DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
771DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000772
sewardj5744c022008-10-19 18:58:13 +0000773# Add glibc and X11 suppressions for exp-ptrcheck
774DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
775
sewardj2e10a682003-04-07 19:36:41 +0000776
njn7fd6d382009-01-22 21:56:32 +0000777#----------------------------------------------------------------------------
778# Checking for various library functions and other definitions
779#----------------------------------------------------------------------------
780
bart59e2f182008-04-28 16:22:53 +0000781# Check for CLOCK_MONOTONIC
782
783AC_MSG_CHECKING([for CLOCK_MONOTONIC])
784
785AC_TRY_COMPILE(
786[
787#include <time.h>
788], [
789 struct timespec t;
790 clock_gettime(CLOCK_MONOTONIC, &t);
791 return 0;
792],
793[
794AC_MSG_RESULT([yes])
795AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
796 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
797], [
798AC_MSG_RESULT([no])
799])
800
bartfea06922008-05-03 09:12:15 +0000801
802# Check for PTHREAD_MUTEX_ADAPTIVE_NP
803
804AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
805
806AC_TRY_COMPILE(
807[
808#define _GNU_SOURCE
809#include <pthread.h>
810], [
811 return (PTHREAD_MUTEX_ADAPTIVE_NP);
812],
813[
814AC_MSG_RESULT([yes])
815AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
816 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
817], [
818AC_MSG_RESULT([no])
819])
820
821
822# Check for PTHREAD_MUTEX_ERRORCHECK_NP
823
824AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
825
826AC_TRY_COMPILE(
827[
828#define _GNU_SOURCE
829#include <pthread.h>
830], [
831 return (PTHREAD_MUTEX_ERRORCHECK_NP);
832],
833[
834AC_MSG_RESULT([yes])
835AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
836 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
837], [
838AC_MSG_RESULT([no])
839])
840
841
842# Check for PTHREAD_MUTEX_RECURSIVE_NP
843
844AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
845
846AC_TRY_COMPILE(
847[
848#define _GNU_SOURCE
849#include <pthread.h>
850], [
851 return (PTHREAD_MUTEX_RECURSIVE_NP);
852],
853[
854AC_MSG_RESULT([yes])
855AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
856 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
857], [
858AC_MSG_RESULT([no])
859])
860
861
862# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
863
864AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
865
866AC_TRY_COMPILE(
867[
868#define _GNU_SOURCE
869#include <pthread.h>
870], [
871 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
872 return 0;
873],
874[
875AC_MSG_RESULT([yes])
876AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
877 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
878], [
879AC_MSG_RESULT([no])
880])
881
882
bart5e389f12008-04-05 12:53:15 +0000883# Check whether pthread_mutex_t has a member called __m_kind.
884
885AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
886
bart56730cd2008-05-11 06:41:46 +0000887AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000888[
bart56730cd2008-05-11 06:41:46 +0000889 #include <pthread.h>
890], [
bart5e389f12008-04-05 12:53:15 +0000891 pthread_mutex_t m;
892 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000893], [
bart5e389f12008-04-05 12:53:15 +0000894AC_MSG_RESULT([yes])
895AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
896 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
897], [
898AC_MSG_RESULT([no])
899])
900
901
902# Check whether pthread_mutex_t has a member called __data.__kind.
903
904AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
905
bart56730cd2008-05-11 06:41:46 +0000906AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000907[
bart56730cd2008-05-11 06:41:46 +0000908#include <pthread.h>
909], [
bart5e389f12008-04-05 12:53:15 +0000910 pthread_mutex_t m;
911 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000912], [
bart5e389f12008-04-05 12:53:15 +0000913AC_MSG_RESULT([yes])
914AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
915 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
916], [
917AC_MSG_RESULT([no])
918])
919
920
bart62c370e2008-05-12 18:50:51 +0000921# does this compiler support -maltivec and does it have the include file
922# <altivec.h> ?
923
924AC_MSG_CHECKING([for Altivec])
925
926safe_CFLAGS=$CFLAGS
927CFLAGS="-maltivec"
928
929AC_TRY_COMPILE(
930[
931#include <altivec.h>
932], [
933 vector unsigned int v;
934],
935[
936ac_have_altivec=yes
937AC_MSG_RESULT([yes])
938], [
939ac_have_altivec=no
940AC_MSG_RESULT([no])
941])
942CFLAGS=$safe_CFLAGS
943
944AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
945AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
946
947
bart36dd85a2009-04-26 07:11:48 +0000948# Check for pthread_create@GLIBC2.0
949AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
950
bart16e1c5a2009-04-26 07:38:53 +0000951safe_CFLAGS=$CFLAGS
952CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000953AC_TRY_LINK(
954[
955extern int pthread_create_glibc_2_0(void*, const void*,
956 void *(*)(void*), void*);
957__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
958], [
bart276ed3a2009-05-10 15:41:45 +0000959#ifdef __powerpc__
960/*
961 * Apparently on PowerPC linking this program succeeds and generates an
962 * executable with the undefined symbol pthread_create@GLIBC_2.0.
963 */
964#error This test does not work properly on PowerPC.
965#else
bart16e1c5a2009-04-26 07:38:53 +0000966 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000967#endif
bart16e1c5a2009-04-26 07:38:53 +0000968 return 0;
bart36dd85a2009-04-26 07:11:48 +0000969],
970[
971ac_have_pthread_create_glibc_2_0=yes
972AC_MSG_RESULT([yes])
973AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
974 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
975], [
976ac_have_pthread_create_glibc_2_0=no
977AC_MSG_RESULT([no])
978])
bart16e1c5a2009-04-26 07:38:53 +0000979CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000980
981AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000982 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000983
984
barta50aa8a2008-04-27 06:06:57 +0000985# Check for eventfd_t, eventfd() and eventfd_read()
986AC_MSG_CHECKING([for eventfd()])
987
988AC_TRY_LINK(
989[
990#include <sys/eventfd.h>
991], [
992 eventfd_t ev;
993 int fd;
994
995 fd = eventfd(5, 0);
996 eventfd_read(fd, &ev);
997 return 0;
998],
999[
1000AC_MSG_RESULT([yes])
1001AC_DEFINE([HAVE_EVENTFD], 1,
1002 [Define to 1 if you have the `eventfd' function.])
1003AC_DEFINE([HAVE_EVENTFD_READ], 1,
1004 [Define to 1 if you have the `eventfd_read' function.])
1005], [
1006AC_MSG_RESULT([no])
1007])
1008
1009
njn7fd6d382009-01-22 21:56:32 +00001010#----------------------------------------------------------------------------
1011# Checking for supported compiler flags.
1012#----------------------------------------------------------------------------
1013
sewardj535c50f2005-06-04 23:14:53 +00001014# does this compiler support -m32 ?
1015AC_MSG_CHECKING([if gcc accepts -m32])
1016
1017safe_CFLAGS=$CFLAGS
1018CFLAGS="-m32"
1019
1020AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001021 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001022],
1023[
1024FLAG_M32="-m32"
1025AC_MSG_RESULT([yes])
1026], [
1027FLAG_M32=""
1028AC_MSG_RESULT([no])
1029])
1030CFLAGS=$safe_CFLAGS
1031
1032AC_SUBST(FLAG_M32)
1033
1034
sewardj03d86f22006-10-17 00:57:24 +00001035# does this compiler support -maix32 ?
1036AC_MSG_CHECKING([if gcc accepts -maix32])
1037
1038safe_CFLAGS=$CFLAGS
1039CFLAGS="-maix32"
1040
1041AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001042 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001043],
1044[
1045FLAG_MAIX32="-maix32"
1046AC_MSG_RESULT([yes])
1047], [
1048FLAG_MAIX32=""
1049AC_MSG_RESULT([no])
1050])
1051CFLAGS=$safe_CFLAGS
1052
1053AC_SUBST(FLAG_MAIX32)
1054
1055
sewardj01262142006-01-04 01:20:28 +00001056# does this compiler support -m64 ?
1057AC_MSG_CHECKING([if gcc accepts -m64])
1058
1059safe_CFLAGS=$CFLAGS
1060CFLAGS="-m64"
1061
1062AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001063 return 0;
sewardj01262142006-01-04 01:20:28 +00001064],
1065[
1066FLAG_M64="-m64"
1067AC_MSG_RESULT([yes])
1068], [
1069FLAG_M64=""
1070AC_MSG_RESULT([no])
1071])
1072CFLAGS=$safe_CFLAGS
1073
1074AC_SUBST(FLAG_M64)
1075
1076
sewardj03d86f22006-10-17 00:57:24 +00001077# does this compiler support -maix64 ?
1078AC_MSG_CHECKING([if gcc accepts -maix64])
1079
1080safe_CFLAGS=$CFLAGS
1081CFLAGS="-maix64"
1082
1083AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001084 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001085],
1086[
1087FLAG_MAIX64="-maix64"
1088AC_MSG_RESULT([yes])
1089], [
1090FLAG_MAIX64=""
1091AC_MSG_RESULT([no])
1092])
1093CFLAGS=$safe_CFLAGS
1094
1095AC_SUBST(FLAG_MAIX64)
1096
1097
sewardj67f1fcc2005-07-03 10:41:02 +00001098# does this compiler support -mmmx ?
1099AC_MSG_CHECKING([if gcc accepts -mmmx])
1100
1101safe_CFLAGS=$CFLAGS
1102CFLAGS="-mmmx"
1103
1104AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001105 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001106],
1107[
1108FLAG_MMMX="-mmmx"
1109AC_MSG_RESULT([yes])
1110], [
1111FLAG_MMMX=""
1112AC_MSG_RESULT([no])
1113])
1114CFLAGS=$safe_CFLAGS
1115
1116AC_SUBST(FLAG_MMMX)
1117
1118
1119# does this compiler support -msse ?
1120AC_MSG_CHECKING([if gcc accepts -msse])
1121
1122safe_CFLAGS=$CFLAGS
1123CFLAGS="-msse"
1124
1125AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001126 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001127],
1128[
1129FLAG_MSSE="-msse"
1130AC_MSG_RESULT([yes])
1131], [
1132FLAG_MSSE=""
1133AC_MSG_RESULT([no])
1134])
1135CFLAGS=$safe_CFLAGS
1136
1137AC_SUBST(FLAG_MSSE)
1138
1139
sewardj5b754b42002-06-03 22:53:35 +00001140# does this compiler support -mpreferred-stack-boundary=2 ?
1141AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1142
daywalker3664f562003-10-17 13:43:46 +00001143safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001144CFLAGS="-mpreferred-stack-boundary=2"
1145
1146AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001147 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001148],
1149[
1150PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001151AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001152], [
1153PREFERRED_STACK_BOUNDARY=""
1154AC_MSG_RESULT([no])
1155])
daywalker3664f562003-10-17 13:43:46 +00001156CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001157
1158AC_SUBST(PREFERRED_STACK_BOUNDARY)
1159
sewardj535c50f2005-06-04 23:14:53 +00001160
sewardjb5f6f512005-03-10 23:59:00 +00001161# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001162AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001163
1164safe_CFLAGS=$CFLAGS
1165CFLAGS="-Wno-pointer-sign"
1166
1167AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001168 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001169],
1170[
1171no_pointer_sign=yes
1172AC_MSG_RESULT([yes])
1173], [
1174no_pointer_sign=no
1175AC_MSG_RESULT([no])
1176])
1177CFLAGS=$safe_CFLAGS
1178
1179if test x$no_pointer_sign = xyes; then
1180 CFLAGS="$CFLAGS -Wno-pointer-sign"
1181fi
1182
sewardj535c50f2005-06-04 23:14:53 +00001183
tom1e946682005-10-12 11:27:33 +00001184# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001185AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001186
1187safe_CFLAGS=$CFLAGS
1188CFLAGS="-Wdeclaration-after-statement"
1189
1190AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001191 return 0;
tom1e946682005-10-12 11:27:33 +00001192],
1193[
tome9814c32005-10-12 11:30:43 +00001194declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001195FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001196AC_MSG_RESULT([yes])
1197], [
tome9814c32005-10-12 11:30:43 +00001198declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001199FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001200AC_MSG_RESULT([no])
1201])
1202CFLAGS=$safe_CFLAGS
1203
sewardj72a547e2006-01-25 02:58:28 +00001204AC_SUBST(FLAG_WDECL_AFTER_STMT)
1205
tome9814c32005-10-12 11:30:43 +00001206if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001207 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1208fi
1209
sewardj00f1e622006-03-12 16:47:10 +00001210
barte026bd22009-07-04 12:17:07 +00001211# does this compiler support -Wno-empty-body ?
1212
1213AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1214
1215safe_CFLAGS=$CFLAGS
1216CFLAGS="-Wno-empty-body"
1217
1218AC_TRY_COMPILE(
1219[ ],
1220[
1221 return 0;
1222],
1223[
1224AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1225AC_MSG_RESULT([yes])
1226],
1227[
1228AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1229AC_MSG_RESULT([no])
1230])
1231CFLAGS=$safe_CFLAGS
1232
1233
bart9d865fa2008-06-23 12:11:49 +00001234# does this compiler support -Wno-format-zero-length ?
1235
1236AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1237
1238safe_CFLAGS=$CFLAGS
1239CFLAGS="-Wno-format-zero-length"
1240
1241AC_TRY_COMPILE(
1242[ ],
1243[
1244 return 0;
1245],
1246[
1247AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1248AC_MSG_RESULT([yes])
1249],
1250[
1251AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1252AC_MSG_RESULT([no])
1253])
1254CFLAGS=$safe_CFLAGS
1255
1256
bart56730cd2008-05-11 06:41:46 +00001257# does this compiler support -Wextra or the older -W ?
1258
1259AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1260
1261safe_CFLAGS=$CFLAGS
1262CFLAGS="-Wextra"
1263
1264AC_TRY_COMPILE(
1265[ ],
1266[
1267 return 0;
1268],
1269[
1270AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1271AC_MSG_RESULT([-Wextra])
1272], [
1273 CFLAGS="-W"
1274 AC_TRY_COMPILE(
1275 [ ],
1276 [
1277 return 0;
1278 ],
1279 [
1280 AC_SUBST([FLAG_W_EXTRA], [-W])
1281 AC_MSG_RESULT([-W])
1282 ], [
1283 AC_SUBST([FLAG_W_EXTRA], [])
1284 AC_MSG_RESULT([not supported])
1285 ])
1286])
1287CFLAGS=$safe_CFLAGS
1288
1289
sewardja72c26d2007-05-01 13:44:08 +00001290# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001291AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001292
1293safe_CFLAGS=$CFLAGS
1294CFLAGS="-fno-stack-protector"
1295
1296AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001297 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001298],
1299[
1300no_stack_protector=yes
1301FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1302AC_MSG_RESULT([yes])
1303], [
1304no_stack_protector=no
1305FLAG_FNO_STACK_PROTECTOR=""
1306AC_MSG_RESULT([no])
1307])
1308CFLAGS=$safe_CFLAGS
1309
1310AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1311
1312if test x$no_stack_protector = xyes; then
1313 CFLAGS="$CFLAGS -fno-stack-protector"
1314fi
1315
1316
bart56730cd2008-05-11 06:41:46 +00001317# does this compiler support --param inline-unit-growth=... ?
1318
1319AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1320
1321safe_CFLAGS=$CFLAGS
1322CFLAGS="--param inline-unit-growth=900"
1323
1324AC_TRY_COMPILE(
1325[ ],
1326[
1327 return 0;
1328],
1329[
1330AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1331 ["--param inline-unit-growth=900"])
1332AC_MSG_RESULT([yes])
1333], [
1334AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1335AC_MSG_RESULT([no])
1336])
1337CFLAGS=$safe_CFLAGS
1338
1339
tomd55121e2005-12-19 12:40:13 +00001340# does this compiler support __builtin_expect?
1341AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001342
tomd55121e2005-12-19 12:40:13 +00001343AC_TRY_LINK(, [
1344return __builtin_expect(1, 1) ? 1 : 0
1345],
1346[
1347ac_have_builtin_expect=yes
1348AC_MSG_RESULT([yes])
1349], [
1350ac_have_builtin_expect=no
1351AC_MSG_RESULT([no])
1352])
1353if test x$ac_have_builtin_expect = xyes ; then
1354 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1355fi
1356
tom1e946682005-10-12 11:27:33 +00001357
sewardj00f1e622006-03-12 16:47:10 +00001358# does the ppc assembler support "mtocrf" et al?
1359AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1360
1361AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001362__asm__ __volatile__("mtocrf 4,0");
1363__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001364],
1365[
1366ac_have_as_ppc_mftocrf=yes
1367AC_MSG_RESULT([yes])
1368], [
1369ac_have_as_ppc_mftocrf=no
1370AC_MSG_RESULT([no])
1371])
1372if test x$ac_have_as_ppc_mftocrf = xyes ; then
1373 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1374fi
1375
1376
sewardjf0aabf82007-03-22 00:24:21 +00001377# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001378# Note, this doesn't generate a C-level symbol. It generates a
1379# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001380AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1381
1382AC_TRY_COMPILE(, [
1383 do { long long int x;
1384 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1385 while (0)
1386],
1387[
1388ac_have_as_sse3=yes
1389AC_MSG_RESULT([yes])
1390], [
1391ac_have_as_sse3=no
1392AC_MSG_RESULT([no])
1393])
sewardjfa18a262007-03-22 12:13:13 +00001394
1395AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001396
1397
sewardj6d6da5b2008-02-09 12:07:40 +00001398# Ditto for SSSE3 instructions (note extra S)
1399# Note, this doesn't generate a C-level symbol. It generates a
1400# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1401AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1402
1403AC_TRY_COMPILE(, [
1404 do { long long int x;
1405 __asm__ __volatile__(
1406 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1407 while (0)
1408],
1409[
1410ac_have_as_ssse3=yes
1411AC_MSG_RESULT([yes])
1412], [
1413ac_have_as_ssse3=no
1414AC_MSG_RESULT([no])
1415])
1416
1417AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1418
1419
sewardjb5f6f512005-03-10 23:59:00 +00001420# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001421if test "x${cross_compiling}" = "xno"; then
1422# Native compilation: check whether running a program using TLS succeeds.
1423# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1424# succeeds but running programs using TLS fails.
1425AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1426 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1427 [vg_cv_tls=$enableval],
1428 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1429 [[return foo;]])],
1430 [vg_cv_tls=yes],
1431 [vg_cv_tls=no])])])
1432else
1433# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001434AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1435 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1436 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001437 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001438 [[return foo;]])],
1439 [vg_cv_tls=yes],
1440 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001441fi
sewardjb5f6f512005-03-10 23:59:00 +00001442
1443if test "$vg_cv_tls" = yes; then
1444AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1445fi
sewardj5b754b42002-06-03 22:53:35 +00001446
sewardj535c50f2005-06-04 23:14:53 +00001447
njn7fd6d382009-01-22 21:56:32 +00001448#----------------------------------------------------------------------------
njnf76d27a2009-05-28 01:53:07 +00001449# Check for /proc filesystem
1450#----------------------------------------------------------------------------
1451AC_CHECK_FILES(/proc/self/fd /proc/self/exe /proc/self/maps,
1452 [ AC_DEFINE([HAVE_PROC], 1, [can use /proc filesystem]) ],
1453 [])
1454
1455
1456#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001457# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001458#----------------------------------------------------------------------------
1459
sewardjde4a1d02002-03-22 01:27:54 +00001460AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001461AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001462 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001463 endian.h \
1464 mqueue.h \
1465 sys/endian.h \
1466 sys/epoll.h \
1467 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001468 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001469 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001470 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001471 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001472 sys/syscall.h \
1473 sys/time.h \
1474 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001475 ])
sewardjde4a1d02002-03-22 01:27:54 +00001476
njn7fd6d382009-01-22 21:56:32 +00001477#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001478# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001479#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001480AC_TYPE_UID_T
1481AC_TYPE_OFF_T
1482AC_TYPE_SIZE_T
1483AC_HEADER_TIME
1484
sewardj535c50f2005-06-04 23:14:53 +00001485
njn7fd6d382009-01-22 21:56:32 +00001486#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001487# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001488#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001489AC_FUNC_MEMCMP
1490AC_FUNC_MMAP
1491AC_TYPE_SIGNAL
1492
bart71bad292008-04-27 11:43:23 +00001493AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001494
bartf5ceec82008-04-26 07:45:10 +00001495AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001496 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001497 epoll_create \
1498 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001499 floor \
bartce48fa92008-04-26 10:59:46 +00001500 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001501 mallinfo \
1502 memchr \
1503 memset \
1504 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001505 mremap \
bartf5ceec82008-04-26 07:45:10 +00001506 ppoll \
bart6d45e922009-01-20 13:45:38 +00001507 pthread_barrier_init \
1508 pthread_condattr_setclock \
1509 pthread_mutex_timedlock \
1510 pthread_rwlock_timedrdlock \
1511 pthread_rwlock_timedwrlock \
1512 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001513 semtimedop \
1514 signalfd \
njn6cc22472009-03-16 03:46:48 +00001515 sigwaitinfo \
bart71bad292008-04-27 11:43:23 +00001516 syscall \
bartf5ceec82008-04-26 07:45:10 +00001517 strchr \
1518 strdup \
1519 strpbrk \
1520 strrchr \
1521 strstr \
1522 timerfd \
1523 utimensat \
1524 ])
sewardjde4a1d02002-03-22 01:27:54 +00001525
bart623eec32008-07-29 17:54:49 +00001526# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1527# libraries with any shared object and/or executable. This is NOT what we
1528# want for e.g. vgpreload_core-x86-linux.so
1529LIBS=""
sewardj80637752006-03-02 13:48:21 +00001530
bart6d45e922009-01-20 13:45:38 +00001531AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1532 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001533AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1534 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001535AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1536 [test x$ac_cv_func_pthread_spin_lock = xyes])
1537
njn7fd6d382009-01-22 21:56:32 +00001538
1539#----------------------------------------------------------------------------
1540# MPI checks
1541#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001542# Do we have a useable MPI setup on the primary and/or secondary targets?
1543# On Linux, by default, assumes mpicc and -m32/-m64
1544# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001545# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001546# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1547# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001548MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001549if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1550 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001551 MPI_CC="mpxlc"
1552fi
1553
sewardje9fa5062006-03-12 18:29:18 +00001554mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001555if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1556 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001557 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001558elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1559 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001560 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001561elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001562 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001563elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001564 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001565fi
1566
sewardj03d86f22006-10-17 00:57:24 +00001567mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001568if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1569 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001570 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001571elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001572 mflag_secondary=-q32
1573fi
1574
1575
sewardj0ad46092006-03-02 17:09:16 +00001576AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001577 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001578 MPI_CC=$withval
1579)
sewardj03d86f22006-10-17 00:57:24 +00001580AC_SUBST(MPI_CC)
1581
1582## See if MPI_CC works for the primary target
1583##
1584AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001585saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001586saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001587CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001588CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001589AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001590#include <mpi.h>
1591#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001592],[
1593 int r = MPI_Init(NULL,NULL);
1594 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1595 return r;
1596], [
sewardj03d86f22006-10-17 00:57:24 +00001597ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001598AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001599], [
sewardj03d86f22006-10-17 00:57:24 +00001600ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001601AC_MSG_RESULT([no])
1602])
sewardj0ad46092006-03-02 17:09:16 +00001603CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001604CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001605AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001606
sewardj03d86f22006-10-17 00:57:24 +00001607## See if MPI_CC works for the secondary target. Complication: what if
1608## there is no secondary target? We need this to then fail.
1609## Kludge this by making MPI_CC something which will surely fail in
1610## such a case.
1611##
1612AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1613saved_CC=$CC
1614saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001615if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001616 CC="$MPI_CC this will surely fail"
1617else
1618 CC=$MPI_CC
1619fi
1620CFLAGS=$mflag_secondary
1621AC_TRY_LINK([
1622#include <mpi.h>
1623#include <stdio.h>
1624],[
1625 int r = MPI_Init(NULL,NULL);
1626 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1627 return r;
1628], [
1629ac_have_mpi2_sec=yes
1630AC_MSG_RESULT([yes, $MPI_CC])
1631], [
1632ac_have_mpi2_sec=no
1633AC_MSG_RESULT([no])
1634])
1635CC=$saved_CC
1636CFLAGS=$saved_CFLAGS
1637AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001638
1639
njn7fd6d382009-01-22 21:56:32 +00001640#----------------------------------------------------------------------------
1641# Other library checks
1642#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001643# There now follow some tests for QtCore, Boost, and OpenMP. These
1644# tests are present because Drd has some regression tests that use
1645# these packages. All regression test programs all compiled only
1646# for the primary target. And so it is important that the configure
1647# checks that follow, use the correct -m32 or -m64 flag for the
1648# primary target (called $mflag_primary). Otherwise, we can end up
1649# in a situation (eg) where, on amd64-linux, the test for Boost checks
1650# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1651# only build (meaning, the primary target is x86-linux), the build
1652# of the regtest programs that use Boost fails, because they are
1653# build as 32-bit (IN THIS EXAMPLE).
1654#
1655# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1656# NEEDED BY THE REGRESSION TEST PROGRAMS.
1657
1658
bart21d3cfc2008-08-02 09:08:17 +00001659# The test below verifies whether the QtCore package been installed.
1660# This test works as follows:
1661# - If pkg-config was not installed at the time autogen.sh was run,
1662# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1663# autogen.sh. Augogen.sh will generate a configure script that prints
1664# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1665# - If pkg-config was installed at the time autogen.sh was run,
1666# the generated configure script will try to detect the presence of the
1667# Qt4 QtCore library by looking up compile and linker flags in the file
1668# called QtCore.pc.
1669# - pkg-config settings can be overridden via the configure variables
1670# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1671# configure script -- see also ./configure --help).
1672# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1673# the pkg-config executable is not present on the system on which the
1674# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001675
bart21d3cfc2008-08-02 09:08:17 +00001676ifdef(
1677 [PKG_CHECK_EXISTS],
1678 [PKG_CHECK_EXISTS(
1679 [QtCore],
1680 [
1681 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001682 # Paranoia: don't trust the result reported by pkg-config, but when
1683 # pkg-config reports that QtCore has been found, verify whether linking
1684 # programs with QtCore succeeds.
1685 AC_LANG(C++)
1686 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001687 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001688 AC_TRY_LINK(
1689 [#include <QMutex>],
1690 [QMutex Mutex;],
1691 [ac_have_qtcore=yes],
1692 [
1693 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1694 ac_have_qtcore=no
1695 ]
1696 )
1697 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001698 ],
1699 [
1700 ac_have_qtcore=no
1701 ]
1702 )
1703 ],
1704 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1705 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1706 [ac_have_qtcore=no]
1707)
bart41ac62a2008-07-07 16:58:03 +00001708
1709AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1710
1711
bart62f54e42008-07-28 11:35:10 +00001712# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1713# See also http://doc.trolltech.com/4.3/qmutex.html.
1714if test x$ac_have_qtcore = xyes; then
1715 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1716 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001717 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001718 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001719 AC_TRY_COMPILE([
1720 #include <QtCore/QMutex>
1721 ],
1722 [
1723 QMutex M;
1724 M.tryLock(1);
1725 M.unlock();
1726 return 0;
1727 ],
1728 [
1729 AC_MSG_RESULT([yes])
1730 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1731 ],
1732 [
1733 AC_MSG_RESULT([no])
1734 ])
bart21d3cfc2008-08-02 09:08:17 +00001735 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001736 AC_LANG(C)
1737fi
1738
1739
sewardj493c4ef2008-12-13 16:45:19 +00001740# Check whether the boost library 1.35 or later has been installed.
1741# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1742
1743AC_MSG_CHECKING([for boost])
1744
1745AC_LANG(C++)
1746safe_CXXFLAGS=$CXXFLAGS
1747CXXFLAGS="-lboost_thread-mt $mflag_primary"
1748
1749AC_LINK_IFELSE(
1750[
1751#include <boost/thread.hpp>
1752static void thread_func(void)
1753{ }
1754int main(int argc, char** argv)
1755{
1756 boost::thread t(thread_func);
1757 return 0;
1758}
1759],
1760[
1761ac_have_boost_1_35=yes
1762AC_SUBST([BOOST_CFLAGS], [])
1763AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1764AC_MSG_RESULT([yes])
1765], [
1766ac_have_boost_1_35=no
1767AC_MSG_RESULT([no])
1768])
1769
1770CXXFLAGS=$safe_CXXFLAGS
1771AC_LANG(C)
1772
1773AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1774
1775
1776# does this compiler support -fopenmp, does it have the include file
1777# <omp.h> and does it have libgomp ?
1778
1779AC_MSG_CHECKING([for OpenMP])
1780
1781safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001782CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001783
1784AC_LINK_IFELSE(
1785[
1786#include <omp.h>
1787int main(int argc, char** argv)
1788{
1789 omp_set_dynamic(0);
1790 return 0;
1791}
1792],
1793[
1794ac_have_openmp=yes
1795AC_MSG_RESULT([yes])
1796], [
1797ac_have_openmp=no
1798AC_MSG_RESULT([no])
1799])
1800CFLAGS=$safe_CFLAGS
1801
1802AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1803
1804
sewardjc876a2f2009-01-22 22:44:30 +00001805# does this compiler have built-in functions for atomic memory access ?
1806AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1807
1808safe_CFLAGS=$CFLAGS
1809CFLAGS="$mflag_primary"
1810
1811AC_TRY_LINK(,
1812[
1813 int variable = 1;
1814 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1815 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1816],
1817[
bartc82d1372009-05-31 16:21:23 +00001818 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001819 AC_MSG_RESULT([yes])
1820 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1821],
1822[
bartc82d1372009-05-31 16:21:23 +00001823 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001824 AC_MSG_RESULT([no])
1825])
1826
1827CFLAGS=$safe_CFLAGS
1828
bartc82d1372009-05-31 16:21:23 +00001829AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1830
sewardjc876a2f2009-01-22 22:44:30 +00001831
njn7fd6d382009-01-22 21:56:32 +00001832#----------------------------------------------------------------------------
1833# Ok. We're done checking.
1834#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001835
njn8b68b642009-06-24 00:37:09 +00001836# Nb: VEX/Makefile is generated from Makefile.vex.in.
1837AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001838 Makefile
njn8b68b642009-06-24 00:37:09 +00001839 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001840 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001841 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001842 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001843 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001844 docs/lib/Makefile
1845 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001846 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001847 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001848 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001849 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001850 perf/Makefile
1851 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001852 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001853 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001854 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001855 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001856 memcheck/Makefile
1857 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001858 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001859 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001860 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001861 memcheck/tests/darwin/Makefile
njna454ec02009-01-19 03:16:59 +00001862 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001863 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001864 memcheck/docs/Makefile
1865 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001866 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001867 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001868 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001869 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001870 callgrind/Makefile
1871 callgrind/callgrind_annotate
1872 callgrind/callgrind_control
1873 callgrind/tests/Makefile
1874 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001875 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001876 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001877 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001878 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001879 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001880 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001881 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001882 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001883 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001884 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001885 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001886 none/Makefile
1887 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001888 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001889 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001890 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001891 none/tests/x86/Makefile
njn0458a122009-02-13 06:23:46 +00001892 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001893 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001894 none/tests/x86-linux/Makefile
njn9bc8c002002-10-02 13:49:13 +00001895 none/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001896 exp-ptrcheck/Makefile
1897 exp-ptrcheck/tests/Makefile
1898 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001899 drd/Makefile
1900 drd/docs/Makefile
1901 drd/scripts/download-and-build-splash2
1902 drd/tests/Makefile
njndbebecc2009-07-14 01:39:54 +00001903 exp-bbv/Makefile
1904 exp-bbv/docs/Makefile
1905 exp-bbv/tests/Makefile
1906 exp-bbv/tests/x86/Makefile
1907 exp-bbv/tests/x86-linux/Makefile
1908 exp-bbv/tests/amd64-linux/Makefile
1909 exp-bbv/tests/ppc32-linux/Makefile
njn8b68b642009-06-24 00:37:09 +00001910])
1911AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001912
1913cat<<EOF
1914
njn311303f2009-02-06 03:46:50 +00001915 Maximum build arch: ${ARCH_MAX}
1916 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001917 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001918 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001919 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1920 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001921 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001922
gobry3b777892002-04-04 09:18:39 +00001923EOF