blob: 087f33aa383e05494cc8e41569e842fa1dba364d [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
njn0cd26892009-07-12 23:07:13 +000028# AC_PROG_OBJC apparently causes problems on older Linux distros. If we
29# ever have any Objective-C code in the Valgrind code base (eg. most likely
30# as Darwin-specific tests) we'll need one of the following:
31# - put AC_PROG_OBJC in a Darwin-specific part of this file
32# - Use AC_PROG_OBJC here and up the minimum autoconf version
33# - Use the following, which is apparently equivalent:
34# m4_ifdef([AC_PROG_OBJC],
35# [AC_PROG_OBJC],
36# [AC_CHECK_TOOL([OBJC], [gcc])
37# AC_SUBST([OBJC])
38# AC_SUBST([OBJCFLAGS])
39# ])
sewardjde4a1d02002-03-22 01:27:54 +000040AC_PROG_RANLIB
41
bartcddeaf52008-05-25 15:58:11 +000042# If no AR variable was specified, look up the name of the archiver. Otherwise
43# do not touch the AR variable.
44if test "x$AR" = "x"; then
bart325cd972009-04-04 14:36:51 +000045 AC_PATH_PROGS([AR], [`echo $LD | sed 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000046fi
47AC_ARG_VAR([AR],[Archiver command])
48
gobrye721a522002-03-22 13:38:30 +000049# Check for the compiler support
50if test "${GCC}" != "yes" ; then
51 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
52fi
53
sewardj2f685952002-12-22 19:32:23 +000054# figure out where perl lives
55AC_PATH_PROG(PERL, perl)
56
njn9315df32003-04-16 20:50:50 +000057# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000058AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000059AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000060
daywalker48ccca52002-04-15 00:31:58 +000061# some older automake's don't have it so try something on our own
62ifdef([AM_PROG_AS],[AM_PROG_AS],
63[
gobry1be19852002-03-26 20:44:55 +000064AS="${CC}"
65AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000066
gobry1be19852002-03-26 20:44:55 +000067ASFLAGS=""
68AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000069])
gobry3b777892002-04-04 09:18:39 +000070
gobry3b777892002-04-04 09:18:39 +000071
njn0d2e58f2009-02-25 04:57:56 +000072# Check if 'diff' supports -u (universal diffs) and use it if possible.
73
74AC_MSG_CHECKING([for diff -u])
75AC_SUBST(DIFF)
76
77# Comparing two identical files results in 0, unless -u isn't supported (as
78# it's not on AIX).
njn31f665e2009-02-26 21:25:50 +000079tmpfile="tmp-xxx-yyy-zzz"
80touch $tmpfile;
81if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000082 AC_MSG_RESULT([yes])
83 DIFF="diff -u"
84else
85 AC_MSG_RESULT([no])
86 DIFF="diff"
87fi
njn31f665e2009-02-26 21:25:50 +000088rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000089
90
sewardj535c50f2005-06-04 23:14:53 +000091# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +000092AC_MSG_CHECKING([for a supported version of gcc])
93
sewardjf33b4332008-07-18 18:20:42 +000094[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +000095
96case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +000097 2.*)
gobrye721a522002-03-22 13:38:30 +000098 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +000099 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
100 ;;
gobrye721a522002-03-22 13:38:30 +0000101 *)
102 AC_MSG_RESULT([ok (${gcc_version})])
103 ;;
104esac
105
njn7fd6d382009-01-22 21:56:32 +0000106#----------------------------------------------------------------------------
107# Arch/OS/platform tests.
108#----------------------------------------------------------------------------
109# We create a number of arch/OS/platform-related variables. We prefix them
110# all with "VGCONF_" which indicates that they are defined at
111# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
112# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000113
sewardjde4a1d02002-03-22 01:27:54 +0000114AC_CANONICAL_HOST
115
116AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000117
njn7fd6d382009-01-22 21:56:32 +0000118# ARCH_MAX reflects the most that this CPU can do: for example if it
119# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
120# Ditto for amd64. It is used for more configuration below, but is not used
121# outside this file.
gobrye721a522002-03-22 13:38:30 +0000122case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000123 i?86)
124 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000125 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000126 ;;
127
njnfe408942004-11-23 17:52:24 +0000128 x86_64)
129 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000130 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000131 ;;
132
sewardj2c48c7b2005-11-29 13:05:56 +0000133 powerpc64)
njn7fd6d382009-01-22 21:56:32 +0000134 # This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000135 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000136 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000137 ;;
138
139 powerpc)
njn7fd6d382009-01-22 21:56:32 +0000140 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
141 # Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000142 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000143 case "${host_os}" in
144 aix5.*)
njn7fd6d382009-01-22 21:56:32 +0000145 ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000146 ;;
147 *)
njn7fd6d382009-01-22 21:56:32 +0000148 ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000149 ;;
150 esac
nethercote9bcc9062004-10-13 13:50:01 +0000151 ;;
152
sewardjde4a1d02002-03-22 01:27:54 +0000153 *)
154 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000155 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000156 ;;
157esac
158
njn7fd6d382009-01-22 21:56:32 +0000159#----------------------------------------------------------------------------
160
sewardj86e992f2006-01-28 18:39:09 +0000161# Sometimes it's convenient to subvert the bi-arch build system and
162# just have a single build even though the underlying platform is
163# capable of both. Hence handle --enable-only64bit and
164# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000165# [Actually, if either of these options are used, I think both get built,
166# but only one gets installed. So if you use an in-place build, both can be
167# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000168
169# Check if a 64-bit only build has been requested
170AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
171 [AC_ARG_ENABLE(only64bit,
172 [ --enable-only64bit do a 64-bit only build],
173 [vg_cv_only64bit=$enableval],
174 [vg_cv_only64bit=no])])
175
176# Check if a 32-bit only build has been requested
177AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
178 [AC_ARG_ENABLE(only32bit,
179 [ --enable-only32bit do a 32-bit only build],
180 [vg_cv_only32bit=$enableval],
181 [vg_cv_only32bit=no])])
182
183# Stay sane
184if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
185 AC_MSG_ERROR(
186 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
187fi
188
njn7fd6d382009-01-22 21:56:32 +0000189#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000190
njn311303f2009-02-06 03:46:50 +0000191# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
192# compilation of many C files via -VGO_$(VGCONF_OS) and
193# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000194AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000195AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000196
njnf76d27a2009-05-28 01:53:07 +0000197DEFAULT_SUPP=""
198
gobrye721a522002-03-22 13:38:30 +0000199case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000200 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000201 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000202 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000203
204 # Ok, this is linux. Check the kernel version
205 AC_MSG_CHECKING([for the kernel version])
206
207 kernel=`uname -r`
208
209 case "${kernel}" in
210 2.6.*)
211 AC_MSG_RESULT([2.6 family (${kernel})])
212 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
213 ;;
214
215 2.4.*)
216 AC_MSG_RESULT([2.4 family (${kernel})])
217 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
218 ;;
219
mueller8c68e042004-01-03 15:21:14 +0000220 *)
221 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000222 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000223 ;;
224 esac
225
226 ;;
227
sewardj03d86f22006-10-17 00:57:24 +0000228 aix5.1.*)
229 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000230 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000231 ;;
232 aix5.2.*)
233 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000234 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000235 ;;
236 aix5.3.*)
237 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000238 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000239 ;;
240
mueller8c68e042004-01-03 15:21:14 +0000241 *freebsd*)
242 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000243 VGCONF_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000244 ;;
245
njnf76d27a2009-05-28 01:53:07 +0000246 *darwin*)
247 AC_MSG_RESULT([ok (${host_os})])
248 VGCONF_OS="darwin"
249
250 AC_MSG_CHECKING([for the kernel version])
251 kernel=`uname -r`
252
253 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
254 # has only one relevant version, the OS version. The `uname` check
255 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
256 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
257 # Snow Leopard and darwin10.supp), and we don't know of an macros
258 # similar to __GLIBC__ to get that info.
259 #
260 # XXX: `uname -r` won't do the right thing for cross-compiles, but
261 # that's not a problem yet.
262 case "${kernel}" in
263 9.*)
264 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
265 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
266 ;;
267 *)
268 AC_MSG_RESULT([unsupported (${kernel})])
269 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
270 ;;
271 esac
272 ;;
273
sewardjde4a1d02002-03-22 01:27:54 +0000274 *)
275 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000276 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000277 ;;
278esac
279
njn7fd6d382009-01-22 21:56:32 +0000280#----------------------------------------------------------------------------
281
tomd6398392006-06-07 17:44:36 +0000282# If we are building on a 64 bit platform test to see if the system
283# supports building 32 bit programs and disable 32 bit support if it
284# does not support building 32 bit programs
285
njn7fd6d382009-01-22 21:56:32 +0000286case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000287 amd64-linux|ppc64-linux)
288 AC_MSG_CHECKING([for 32 bit build support])
289 safe_CFLAGS=$CFLAGS
290 CFLAGS="-m32"
291 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000292 return 0;
tomd6398392006-06-07 17:44:36 +0000293 ],
294 [
295 AC_MSG_RESULT([yes])
296 ], [
297 vg_cv_only64bit="yes"
298 AC_MSG_RESULT([no])
299 ])
300 CFLAGS=$safe_CFLAGS;;
301esac
302
303if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
304 AC_MSG_ERROR(
305 [--enable-only32bit was specified but system does not support 32 bit builds])
306fi
nethercote888ecb72004-08-23 14:54:40 +0000307
njn7fd6d382009-01-22 21:56:32 +0000308#----------------------------------------------------------------------------
309
njn311303f2009-02-06 03:46:50 +0000310# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
311# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
312# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
313# above) will be "amd64" since that reflects the most that this cpu can do,
314# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
315# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000316# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
317# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
318AC_SUBST(VGCONF_ARCH_PRI)
319
njn3f8a6e92009-06-02 00:20:47 +0000320# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
321# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
322# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
323# It is empty if there is no secondary target.
324AC_SUBST(VGCONF_ARCH_SEC)
325
njn311303f2009-02-06 03:46:50 +0000326# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
327# The entire system, including regression and performance tests, will be
328# built for this target. The "_CAPS" indicates that the name is in capital
329# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000330# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000331# convention and cannot contain '-' characters. This is in contrast to
332# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000333AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
334
335# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
336# Valgrind and tools will also be built for this target, but not the
337# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000338#
njn7fd6d382009-01-22 21:56:32 +0000339# By default, the primary arch is the same as the "max" arch, as commented
340# above (at the definition of ARCH_MAX). We may choose to downgrade it in
341# the big case statement just below here, in the case where we're building
342# on a 64 bit machine but have been requested only to do a 32 bit build.
343AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
344
sewardj01262142006-01-04 01:20:28 +0000345AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000346
njn7fd6d382009-01-22 21:56:32 +0000347case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000348 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000349 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000350 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000351 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
352 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000353 valt_load_address_normal="0x38000000"
354 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000355 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000356 ;;
357 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000358 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000359 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000360 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000361 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
362 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000363 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000364 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000365 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000366 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
367 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000368 else
njn7fd6d382009-01-22 21:56:32 +0000369 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000370 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000371 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
372 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000373 fi
njnd74b0ef2009-01-20 06:06:52 +0000374 valt_load_address_normal="0x38000000"
375 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000376 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000377 ;;
378 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000379 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000380 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000381 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
382 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000383 valt_load_address_normal="0x38000000"
384 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000385 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000386 ;;
sewardj03d86f22006-10-17 00:57:24 +0000387 ppc64-aix5)
388 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000389 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000390 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000391 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
392 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000393 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000394 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000395 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000396 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
397 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000398 else
njn7fd6d382009-01-22 21:56:32 +0000399 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000400 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000401 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
402 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000403 fi
njnd74b0ef2009-01-20 06:06:52 +0000404 valt_load_address_normal="0x38000000"
405 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000406 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000407 ;;
sewardj01262142006-01-04 01:20:28 +0000408 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000409 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000410 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000411 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000412 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
413 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000414 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000415 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000416 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000417 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
418 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000419 else
njn7fd6d382009-01-22 21:56:32 +0000420 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000421 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000422 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
423 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000424 fi
njnd74b0ef2009-01-20 06:06:52 +0000425 valt_load_address_normal="0x38000000"
426 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000427 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000428 ;;
njnf76d27a2009-05-28 01:53:07 +0000429 x86-darwin)
430 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000431 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000432 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
433 VGCONF_PLATFORM_SEC_CAPS=""
434 valt_load_address_normal="0x0"
435 valt_load_address_inner="0x0"
436 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
437 ;;
438 amd64-darwin)
439 if test x$vg_cv_only64bit = xyes; then
440 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000441 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000442 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
443 VGCONF_PLATFORM_SEC_CAPS=""
444 elif test x$vg_cv_only32bit = xyes; then
445 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000446 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000447 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
448 VGCONF_PLATFORM_SEC_CAPS=""
449 VGCONF_ARCH_PRI_CAPS="x86"
450 else
451 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000452 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000453 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
454 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
455 fi
456 valt_load_address_normal="0x0"
457 valt_load_address_inner="0x0"
458 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
459 ;;
nethercote888ecb72004-08-23 14:54:40 +0000460 *)
njn7fd6d382009-01-22 21:56:32 +0000461 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000462 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000463 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
464 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njn377c43f2009-05-19 07:39:22 +0000465 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000466 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000467 ;;
468esac
sewardjde4a1d02002-03-22 01:27:54 +0000469
njn7fd6d382009-01-22 21:56:32 +0000470#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000471
njn7fd6d382009-01-22 21:56:32 +0000472# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
473# defined.
474AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
475 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000476 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
477 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
478 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000479AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000480 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
481 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000482AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
483 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
484 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
485 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
486 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
487AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
488 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
489 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj03d86f22006-10-17 00:57:24 +0000490
njn7fd6d382009-01-22 21:56:32 +0000491# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
492# become defined.
493AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
494 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
495 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
496AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
497 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
498AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
499 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
500 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
501AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
502 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000503
njn7fd6d382009-01-22 21:56:32 +0000504AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
505 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
506 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
507AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
508 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
509
njnf76d27a2009-05-28 01:53:07 +0000510AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
511 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
512 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
513AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
514 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
515
516
njn7fd6d382009-01-22 21:56:32 +0000517# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000518# Relies on the assumption that the primary and secondary targets are
519# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000520AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
521 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
522 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
523 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
524 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
525AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
526 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
527 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000528AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
529 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
530 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000531
532
njn7fd6d382009-01-22 21:56:32 +0000533# Sometimes, in the Makefile.am files, it's useful to know whether or not
534# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000535AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000536 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000537
tomb637bad2005-11-08 12:28:35 +0000538
njn7fd6d382009-01-22 21:56:32 +0000539#----------------------------------------------------------------------------
540# Inner Valgrind?
541#----------------------------------------------------------------------------
542
njnd74b0ef2009-01-20 06:06:52 +0000543# Check if this should be built as an inner Valgrind, to be run within
544# another Valgrind. Choose the load address accordingly.
545AC_SUBST(VALT_LOAD_ADDRESS)
546AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
547 [AC_ARG_ENABLE(inner,
548 [ --enable-inner enables self-hosting],
549 [vg_cv_inner=$enableval],
550 [vg_cv_inner=no])])
551if test "$vg_cv_inner" = yes; then
552 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
553 VALT_LOAD_ADDRESS=$valt_load_address_inner
554else
555 VALT_LOAD_ADDRESS=$valt_load_address_normal
556fi
557
558
njn7fd6d382009-01-22 21:56:32 +0000559#----------------------------------------------------------------------------
560# Libc and suppressions
561#----------------------------------------------------------------------------
562# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000563AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000564
dirk07596a22008-04-25 11:33:30 +0000565GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000566
sewardjde4a1d02002-03-22 01:27:54 +0000567AC_EGREP_CPP([GLIBC_22], [
568#include <features.h>
569#ifdef __GNU_LIBRARY__
570 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
571 GLIBC_22
572 #endif
573#endif
574],
dirk07596a22008-04-25 11:33:30 +0000575GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000576
sewardj08c7f012002-10-07 23:56:55 +0000577AC_EGREP_CPP([GLIBC_23], [
578#include <features.h>
579#ifdef __GNU_LIBRARY__
580 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
581 GLIBC_23
582 #endif
583#endif
584],
dirk07596a22008-04-25 11:33:30 +0000585GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000586
njn781dba52005-06-30 04:06:38 +0000587AC_EGREP_CPP([GLIBC_24], [
588#include <features.h>
589#ifdef __GNU_LIBRARY__
590 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
591 GLIBC_24
592 #endif
593#endif
594],
dirk07596a22008-04-25 11:33:30 +0000595GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000596
dirkaece45c2006-10-12 08:17:49 +0000597AC_EGREP_CPP([GLIBC_25], [
598#include <features.h>
599#ifdef __GNU_LIBRARY__
600 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
601 GLIBC_25
602 #endif
603#endif
604],
dirk07596a22008-04-25 11:33:30 +0000605GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000606
dirkc8bd0c52007-05-23 17:39:08 +0000607AC_EGREP_CPP([GLIBC_26], [
608#include <features.h>
609#ifdef __GNU_LIBRARY__
610 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
611 GLIBC_26
612 #endif
613#endif
614],
dirk07596a22008-04-25 11:33:30 +0000615GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000616
sewardj68c80c12007-11-18 14:40:02 +0000617AC_EGREP_CPP([GLIBC_27], [
618#include <features.h>
619#ifdef __GNU_LIBRARY__
620 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
621 GLIBC_27
622 #endif
623#endif
624],
dirk07596a22008-04-25 11:33:30 +0000625GLIBC_VERSION="2.7")
626
627AC_EGREP_CPP([GLIBC_28], [
628#include <features.h>
629#ifdef __GNU_LIBRARY__
630 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
631 GLIBC_28
632 #endif
633#endif
634],
635GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000636
dirkd2e31eb2008-11-19 23:58:36 +0000637AC_EGREP_CPP([GLIBC_29], [
638#include <features.h>
639#ifdef __GNU_LIBRARY__
640 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
641 GLIBC_29
642 #endif
643#endif
644],
645GLIBC_VERSION="2.9")
646
sewardj5d425e82009-02-01 19:01:11 +0000647AC_EGREP_CPP([GLIBC_210], [
648#include <features.h>
649#ifdef __GNU_LIBRARY__
650 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
651 GLIBC_210
652 #endif
653#endif
654],
655GLIBC_VERSION="2.10")
656
sewardj03d86f22006-10-17 00:57:24 +0000657AC_EGREP_CPP([AIX5_LIBC], [
658#include <standards.h>
659#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
660 AIX5_LIBC
661#endif
662],
dirk07596a22008-04-25 11:33:30 +0000663GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000664
njnf76d27a2009-05-28 01:53:07 +0000665# not really a version check
666AC_EGREP_CPP([DARWIN_LIBC], [
667#include <sys/cdefs.h>
668#if defined(__DARWIN_VERS_1050)
669 DARWIN_LIBC
670#endif
671],
672GLIBC_VERSION="darwin")
673
dirk07596a22008-04-25 11:33:30 +0000674AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000675
dirk07596a22008-04-25 11:33:30 +0000676case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000677 2.2)
678 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000679 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000680 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
681 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000682 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000683 ;;
684
sewardj08c7f012002-10-07 23:56:55 +0000685 2.3)
686 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000687 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000688 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000689 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000690 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000691 ;;
692
njn781dba52005-06-30 04:06:38 +0000693 2.4)
694 AC_MSG_RESULT(2.4 family)
695 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000696 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000697 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000698 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000699 ;;
700
dirkaece45c2006-10-12 08:17:49 +0000701 2.5)
702 AC_MSG_RESULT(2.5 family)
703 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000704 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000705 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000706 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000707 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000708 2.6)
709 AC_MSG_RESULT(2.6 family)
710 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000711 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000712 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000713 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000714 ;;
715 2.7)
716 AC_MSG_RESULT(2.7 family)
717 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000718 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000719 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000720 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000721 ;;
dirk07596a22008-04-25 11:33:30 +0000722 2.8)
723 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000724 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000725 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
726 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
727 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
728 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000729 2.9)
730 AC_MSG_RESULT(2.9 family)
731 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
732 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
733 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
734 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
735 ;;
sewardj5d425e82009-02-01 19:01:11 +0000736 2.10)
737 AC_MSG_RESULT(2.10 family)
738 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
739 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
740 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
741 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
742 ;;
sewardj03d86f22006-10-17 00:57:24 +0000743 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000744 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
745 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 +0000746 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
747 ;;
njnf76d27a2009-05-28 01:53:07 +0000748 darwin)
749 AC_MSG_RESULT(Darwin)
750 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
751 # DEFAULT_SUPP set by kernel version check above.
752 ;;
dirkaece45c2006-10-12 08:17:49 +0000753
sewardjde4a1d02002-03-22 01:27:54 +0000754 *)
755 AC_MSG_RESULT(unsupported version)
sewardj5d425e82009-02-01 19:01:11 +0000756 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.10])
dirk07596a22008-04-25 11:33:30 +0000757 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000758 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000759 ;;
760esac
761
dirk07596a22008-04-25 11:33:30 +0000762AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000763
sewardj414f3582008-07-18 20:46:00 +0000764
765# Add default suppressions for the X client libraries. Make no
766# attempt to detect whether such libraries are installed on the
767# build machine (or even if any X facilities are present); just
768# add the suppressions antidisirregardless.
769DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
770DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000771
sewardj5744c022008-10-19 18:58:13 +0000772# Add glibc and X11 suppressions for exp-ptrcheck
773DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
774
sewardj2e10a682003-04-07 19:36:41 +0000775
njn7fd6d382009-01-22 21:56:32 +0000776#----------------------------------------------------------------------------
777# Checking for various library functions and other definitions
778#----------------------------------------------------------------------------
779
bart59e2f182008-04-28 16:22:53 +0000780# Check for CLOCK_MONOTONIC
781
782AC_MSG_CHECKING([for CLOCK_MONOTONIC])
783
784AC_TRY_COMPILE(
785[
786#include <time.h>
787], [
788 struct timespec t;
789 clock_gettime(CLOCK_MONOTONIC, &t);
790 return 0;
791],
792[
793AC_MSG_RESULT([yes])
794AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
795 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
796], [
797AC_MSG_RESULT([no])
798])
799
bartfea06922008-05-03 09:12:15 +0000800
801# Check for PTHREAD_MUTEX_ADAPTIVE_NP
802
803AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
804
805AC_TRY_COMPILE(
806[
807#define _GNU_SOURCE
808#include <pthread.h>
809], [
810 return (PTHREAD_MUTEX_ADAPTIVE_NP);
811],
812[
813AC_MSG_RESULT([yes])
814AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
815 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
816], [
817AC_MSG_RESULT([no])
818])
819
820
821# Check for PTHREAD_MUTEX_ERRORCHECK_NP
822
823AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
824
825AC_TRY_COMPILE(
826[
827#define _GNU_SOURCE
828#include <pthread.h>
829], [
830 return (PTHREAD_MUTEX_ERRORCHECK_NP);
831],
832[
833AC_MSG_RESULT([yes])
834AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
835 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
836], [
837AC_MSG_RESULT([no])
838])
839
840
841# Check for PTHREAD_MUTEX_RECURSIVE_NP
842
843AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
844
845AC_TRY_COMPILE(
846[
847#define _GNU_SOURCE
848#include <pthread.h>
849], [
850 return (PTHREAD_MUTEX_RECURSIVE_NP);
851],
852[
853AC_MSG_RESULT([yes])
854AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
855 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
856], [
857AC_MSG_RESULT([no])
858])
859
860
861# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
862
863AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
864
865AC_TRY_COMPILE(
866[
867#define _GNU_SOURCE
868#include <pthread.h>
869], [
870 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
871 return 0;
872],
873[
874AC_MSG_RESULT([yes])
875AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
876 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
877], [
878AC_MSG_RESULT([no])
879])
880
881
bart5e389f12008-04-05 12:53:15 +0000882# Check whether pthread_mutex_t has a member called __m_kind.
883
884AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
885
bart56730cd2008-05-11 06:41:46 +0000886AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000887[
bart56730cd2008-05-11 06:41:46 +0000888 #include <pthread.h>
889], [
bart5e389f12008-04-05 12:53:15 +0000890 pthread_mutex_t m;
891 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000892], [
bart5e389f12008-04-05 12:53:15 +0000893AC_MSG_RESULT([yes])
894AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
895 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
896], [
897AC_MSG_RESULT([no])
898])
899
900
901# Check whether pthread_mutex_t has a member called __data.__kind.
902
903AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
904
bart56730cd2008-05-11 06:41:46 +0000905AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000906[
bart56730cd2008-05-11 06:41:46 +0000907#include <pthread.h>
908], [
bart5e389f12008-04-05 12:53:15 +0000909 pthread_mutex_t m;
910 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000911], [
bart5e389f12008-04-05 12:53:15 +0000912AC_MSG_RESULT([yes])
913AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
914 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
915], [
916AC_MSG_RESULT([no])
917])
918
919
bart62c370e2008-05-12 18:50:51 +0000920# does this compiler support -maltivec and does it have the include file
921# <altivec.h> ?
922
923AC_MSG_CHECKING([for Altivec])
924
925safe_CFLAGS=$CFLAGS
926CFLAGS="-maltivec"
927
928AC_TRY_COMPILE(
929[
930#include <altivec.h>
931], [
932 vector unsigned int v;
933],
934[
935ac_have_altivec=yes
936AC_MSG_RESULT([yes])
937], [
938ac_have_altivec=no
939AC_MSG_RESULT([no])
940])
941CFLAGS=$safe_CFLAGS
942
943AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
944AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
945
946
bart36dd85a2009-04-26 07:11:48 +0000947# Check for pthread_create@GLIBC2.0
948AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
949
bart16e1c5a2009-04-26 07:38:53 +0000950safe_CFLAGS=$CFLAGS
951CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000952AC_TRY_LINK(
953[
954extern int pthread_create_glibc_2_0(void*, const void*,
955 void *(*)(void*), void*);
956__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
957], [
bart276ed3a2009-05-10 15:41:45 +0000958#ifdef __powerpc__
959/*
960 * Apparently on PowerPC linking this program succeeds and generates an
961 * executable with the undefined symbol pthread_create@GLIBC_2.0.
962 */
963#error This test does not work properly on PowerPC.
964#else
bart16e1c5a2009-04-26 07:38:53 +0000965 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000966#endif
bart16e1c5a2009-04-26 07:38:53 +0000967 return 0;
bart36dd85a2009-04-26 07:11:48 +0000968],
969[
970ac_have_pthread_create_glibc_2_0=yes
971AC_MSG_RESULT([yes])
972AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
973 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
974], [
975ac_have_pthread_create_glibc_2_0=no
976AC_MSG_RESULT([no])
977])
bart16e1c5a2009-04-26 07:38:53 +0000978CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000979
980AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000981 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000982
983
barta50aa8a2008-04-27 06:06:57 +0000984# Check for eventfd_t, eventfd() and eventfd_read()
985AC_MSG_CHECKING([for eventfd()])
986
987AC_TRY_LINK(
988[
989#include <sys/eventfd.h>
990], [
991 eventfd_t ev;
992 int fd;
993
994 fd = eventfd(5, 0);
995 eventfd_read(fd, &ev);
996 return 0;
997],
998[
999AC_MSG_RESULT([yes])
1000AC_DEFINE([HAVE_EVENTFD], 1,
1001 [Define to 1 if you have the `eventfd' function.])
1002AC_DEFINE([HAVE_EVENTFD_READ], 1,
1003 [Define to 1 if you have the `eventfd_read' function.])
1004], [
1005AC_MSG_RESULT([no])
1006])
1007
1008
njn7fd6d382009-01-22 21:56:32 +00001009#----------------------------------------------------------------------------
1010# Checking for supported compiler flags.
1011#----------------------------------------------------------------------------
1012
sewardj535c50f2005-06-04 23:14:53 +00001013# does this compiler support -m32 ?
1014AC_MSG_CHECKING([if gcc accepts -m32])
1015
1016safe_CFLAGS=$CFLAGS
1017CFLAGS="-m32"
1018
1019AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001020 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001021],
1022[
1023FLAG_M32="-m32"
1024AC_MSG_RESULT([yes])
1025], [
1026FLAG_M32=""
1027AC_MSG_RESULT([no])
1028])
1029CFLAGS=$safe_CFLAGS
1030
1031AC_SUBST(FLAG_M32)
1032
1033
sewardj03d86f22006-10-17 00:57:24 +00001034# does this compiler support -maix32 ?
1035AC_MSG_CHECKING([if gcc accepts -maix32])
1036
1037safe_CFLAGS=$CFLAGS
1038CFLAGS="-maix32"
1039
1040AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001041 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001042],
1043[
1044FLAG_MAIX32="-maix32"
1045AC_MSG_RESULT([yes])
1046], [
1047FLAG_MAIX32=""
1048AC_MSG_RESULT([no])
1049])
1050CFLAGS=$safe_CFLAGS
1051
1052AC_SUBST(FLAG_MAIX32)
1053
1054
sewardj01262142006-01-04 01:20:28 +00001055# does this compiler support -m64 ?
1056AC_MSG_CHECKING([if gcc accepts -m64])
1057
1058safe_CFLAGS=$CFLAGS
1059CFLAGS="-m64"
1060
1061AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001062 return 0;
sewardj01262142006-01-04 01:20:28 +00001063],
1064[
1065FLAG_M64="-m64"
1066AC_MSG_RESULT([yes])
1067], [
1068FLAG_M64=""
1069AC_MSG_RESULT([no])
1070])
1071CFLAGS=$safe_CFLAGS
1072
1073AC_SUBST(FLAG_M64)
1074
1075
sewardj03d86f22006-10-17 00:57:24 +00001076# does this compiler support -maix64 ?
1077AC_MSG_CHECKING([if gcc accepts -maix64])
1078
1079safe_CFLAGS=$CFLAGS
1080CFLAGS="-maix64"
1081
1082AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001083 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001084],
1085[
1086FLAG_MAIX64="-maix64"
1087AC_MSG_RESULT([yes])
1088], [
1089FLAG_MAIX64=""
1090AC_MSG_RESULT([no])
1091])
1092CFLAGS=$safe_CFLAGS
1093
1094AC_SUBST(FLAG_MAIX64)
1095
1096
sewardj67f1fcc2005-07-03 10:41:02 +00001097# does this compiler support -mmmx ?
1098AC_MSG_CHECKING([if gcc accepts -mmmx])
1099
1100safe_CFLAGS=$CFLAGS
1101CFLAGS="-mmmx"
1102
1103AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001104 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001105],
1106[
1107FLAG_MMMX="-mmmx"
1108AC_MSG_RESULT([yes])
1109], [
1110FLAG_MMMX=""
1111AC_MSG_RESULT([no])
1112])
1113CFLAGS=$safe_CFLAGS
1114
1115AC_SUBST(FLAG_MMMX)
1116
1117
1118# does this compiler support -msse ?
1119AC_MSG_CHECKING([if gcc accepts -msse])
1120
1121safe_CFLAGS=$CFLAGS
1122CFLAGS="-msse"
1123
1124AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001125 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001126],
1127[
1128FLAG_MSSE="-msse"
1129AC_MSG_RESULT([yes])
1130], [
1131FLAG_MSSE=""
1132AC_MSG_RESULT([no])
1133])
1134CFLAGS=$safe_CFLAGS
1135
1136AC_SUBST(FLAG_MSSE)
1137
1138
sewardj5b754b42002-06-03 22:53:35 +00001139# does this compiler support -mpreferred-stack-boundary=2 ?
1140AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1141
daywalker3664f562003-10-17 13:43:46 +00001142safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001143CFLAGS="-mpreferred-stack-boundary=2"
1144
1145AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001146 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001147],
1148[
1149PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001150AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001151], [
1152PREFERRED_STACK_BOUNDARY=""
1153AC_MSG_RESULT([no])
1154])
daywalker3664f562003-10-17 13:43:46 +00001155CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001156
1157AC_SUBST(PREFERRED_STACK_BOUNDARY)
1158
sewardj535c50f2005-06-04 23:14:53 +00001159
sewardjb5f6f512005-03-10 23:59:00 +00001160# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001161AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001162
1163safe_CFLAGS=$CFLAGS
1164CFLAGS="-Wno-pointer-sign"
1165
1166AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001167 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001168],
1169[
1170no_pointer_sign=yes
1171AC_MSG_RESULT([yes])
1172], [
1173no_pointer_sign=no
1174AC_MSG_RESULT([no])
1175])
1176CFLAGS=$safe_CFLAGS
1177
1178if test x$no_pointer_sign = xyes; then
1179 CFLAGS="$CFLAGS -Wno-pointer-sign"
1180fi
1181
sewardj535c50f2005-06-04 23:14:53 +00001182
tom1e946682005-10-12 11:27:33 +00001183# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001184AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001185
1186safe_CFLAGS=$CFLAGS
1187CFLAGS="-Wdeclaration-after-statement"
1188
1189AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001190 return 0;
tom1e946682005-10-12 11:27:33 +00001191],
1192[
tome9814c32005-10-12 11:30:43 +00001193declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001194FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001195AC_MSG_RESULT([yes])
1196], [
tome9814c32005-10-12 11:30:43 +00001197declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001198FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001199AC_MSG_RESULT([no])
1200])
1201CFLAGS=$safe_CFLAGS
1202
sewardj72a547e2006-01-25 02:58:28 +00001203AC_SUBST(FLAG_WDECL_AFTER_STMT)
1204
tome9814c32005-10-12 11:30:43 +00001205if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001206 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1207fi
1208
sewardj00f1e622006-03-12 16:47:10 +00001209
barte026bd22009-07-04 12:17:07 +00001210# does this compiler support -Wno-empty-body ?
1211
1212AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1213
1214safe_CFLAGS=$CFLAGS
1215CFLAGS="-Wno-empty-body"
1216
1217AC_TRY_COMPILE(
1218[ ],
1219[
1220 return 0;
1221],
1222[
1223AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1224AC_MSG_RESULT([yes])
1225],
1226[
1227AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1228AC_MSG_RESULT([no])
1229])
1230CFLAGS=$safe_CFLAGS
1231
1232
bart9d865fa2008-06-23 12:11:49 +00001233# does this compiler support -Wno-format-zero-length ?
1234
1235AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1236
1237safe_CFLAGS=$CFLAGS
1238CFLAGS="-Wno-format-zero-length"
1239
1240AC_TRY_COMPILE(
1241[ ],
1242[
1243 return 0;
1244],
1245[
1246AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1247AC_MSG_RESULT([yes])
1248],
1249[
1250AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1251AC_MSG_RESULT([no])
1252])
1253CFLAGS=$safe_CFLAGS
1254
1255
bart56730cd2008-05-11 06:41:46 +00001256# does this compiler support -Wextra or the older -W ?
1257
1258AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1259
1260safe_CFLAGS=$CFLAGS
1261CFLAGS="-Wextra"
1262
1263AC_TRY_COMPILE(
1264[ ],
1265[
1266 return 0;
1267],
1268[
1269AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1270AC_MSG_RESULT([-Wextra])
1271], [
1272 CFLAGS="-W"
1273 AC_TRY_COMPILE(
1274 [ ],
1275 [
1276 return 0;
1277 ],
1278 [
1279 AC_SUBST([FLAG_W_EXTRA], [-W])
1280 AC_MSG_RESULT([-W])
1281 ], [
1282 AC_SUBST([FLAG_W_EXTRA], [])
1283 AC_MSG_RESULT([not supported])
1284 ])
1285])
1286CFLAGS=$safe_CFLAGS
1287
1288
sewardja72c26d2007-05-01 13:44:08 +00001289# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001290AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001291
1292safe_CFLAGS=$CFLAGS
1293CFLAGS="-fno-stack-protector"
1294
1295AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001296 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001297],
1298[
1299no_stack_protector=yes
1300FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1301AC_MSG_RESULT([yes])
1302], [
1303no_stack_protector=no
1304FLAG_FNO_STACK_PROTECTOR=""
1305AC_MSG_RESULT([no])
1306])
1307CFLAGS=$safe_CFLAGS
1308
1309AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1310
1311if test x$no_stack_protector = xyes; then
1312 CFLAGS="$CFLAGS -fno-stack-protector"
1313fi
1314
1315
bart56730cd2008-05-11 06:41:46 +00001316# does this compiler support --param inline-unit-growth=... ?
1317
1318AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1319
1320safe_CFLAGS=$CFLAGS
1321CFLAGS="--param inline-unit-growth=900"
1322
1323AC_TRY_COMPILE(
1324[ ],
1325[
1326 return 0;
1327],
1328[
1329AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1330 ["--param inline-unit-growth=900"])
1331AC_MSG_RESULT([yes])
1332], [
1333AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1334AC_MSG_RESULT([no])
1335])
1336CFLAGS=$safe_CFLAGS
1337
1338
tomd55121e2005-12-19 12:40:13 +00001339# does this compiler support __builtin_expect?
1340AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001341
tomd55121e2005-12-19 12:40:13 +00001342AC_TRY_LINK(, [
1343return __builtin_expect(1, 1) ? 1 : 0
1344],
1345[
1346ac_have_builtin_expect=yes
1347AC_MSG_RESULT([yes])
1348], [
1349ac_have_builtin_expect=no
1350AC_MSG_RESULT([no])
1351])
1352if test x$ac_have_builtin_expect = xyes ; then
1353 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1354fi
1355
tom1e946682005-10-12 11:27:33 +00001356
sewardj00f1e622006-03-12 16:47:10 +00001357# does the ppc assembler support "mtocrf" et al?
1358AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1359
1360AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001361__asm__ __volatile__("mtocrf 4,0");
1362__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001363],
1364[
1365ac_have_as_ppc_mftocrf=yes
1366AC_MSG_RESULT([yes])
1367], [
1368ac_have_as_ppc_mftocrf=no
1369AC_MSG_RESULT([no])
1370])
1371if test x$ac_have_as_ppc_mftocrf = xyes ; then
1372 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1373fi
1374
1375
sewardjf0aabf82007-03-22 00:24:21 +00001376# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001377# Note, this doesn't generate a C-level symbol. It generates a
1378# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001379AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1380
1381AC_TRY_COMPILE(, [
1382 do { long long int x;
1383 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1384 while (0)
1385],
1386[
1387ac_have_as_sse3=yes
1388AC_MSG_RESULT([yes])
1389], [
1390ac_have_as_sse3=no
1391AC_MSG_RESULT([no])
1392])
sewardjfa18a262007-03-22 12:13:13 +00001393
1394AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001395
1396
sewardj6d6da5b2008-02-09 12:07:40 +00001397# Ditto for SSSE3 instructions (note extra S)
1398# Note, this doesn't generate a C-level symbol. It generates a
1399# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1400AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1401
1402AC_TRY_COMPILE(, [
1403 do { long long int x;
1404 __asm__ __volatile__(
1405 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1406 while (0)
1407],
1408[
1409ac_have_as_ssse3=yes
1410AC_MSG_RESULT([yes])
1411], [
1412ac_have_as_ssse3=no
1413AC_MSG_RESULT([no])
1414])
1415
1416AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1417
1418
sewardjb5f6f512005-03-10 23:59:00 +00001419# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001420if test "x${cross_compiling}" = "xno"; then
1421# Native compilation: check whether running a program using TLS succeeds.
1422# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1423# succeeds but running programs using TLS fails.
1424AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1425 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1426 [vg_cv_tls=$enableval],
1427 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1428 [[return foo;]])],
1429 [vg_cv_tls=yes],
1430 [vg_cv_tls=no])])])
1431else
1432# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001433AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1434 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1435 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001436 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001437 [[return foo;]])],
1438 [vg_cv_tls=yes],
1439 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001440fi
sewardjb5f6f512005-03-10 23:59:00 +00001441
1442if test "$vg_cv_tls" = yes; then
1443AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1444fi
sewardj5b754b42002-06-03 22:53:35 +00001445
sewardj535c50f2005-06-04 23:14:53 +00001446
njn7fd6d382009-01-22 21:56:32 +00001447#----------------------------------------------------------------------------
njnf76d27a2009-05-28 01:53:07 +00001448# Check for /proc filesystem
1449#----------------------------------------------------------------------------
1450AC_CHECK_FILES(/proc/self/fd /proc/self/exe /proc/self/maps,
1451 [ AC_DEFINE([HAVE_PROC], 1, [can use /proc filesystem]) ],
1452 [])
1453
1454
1455#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001456# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001457#----------------------------------------------------------------------------
1458
sewardjde4a1d02002-03-22 01:27:54 +00001459AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001460AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001461 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001462 endian.h \
1463 mqueue.h \
1464 sys/endian.h \
1465 sys/epoll.h \
1466 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001467 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001468 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001469 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001470 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001471 sys/syscall.h \
1472 sys/time.h \
1473 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001474 ])
sewardjde4a1d02002-03-22 01:27:54 +00001475
njn7fd6d382009-01-22 21:56:32 +00001476#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001477# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001478#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001479AC_TYPE_UID_T
1480AC_TYPE_OFF_T
1481AC_TYPE_SIZE_T
1482AC_HEADER_TIME
1483
sewardj535c50f2005-06-04 23:14:53 +00001484
njn7fd6d382009-01-22 21:56:32 +00001485#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001486# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001487#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001488AC_FUNC_MEMCMP
1489AC_FUNC_MMAP
1490AC_TYPE_SIGNAL
1491
bart71bad292008-04-27 11:43:23 +00001492AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001493
bartf5ceec82008-04-26 07:45:10 +00001494AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001495 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001496 epoll_create \
1497 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001498 floor \
bartce48fa92008-04-26 10:59:46 +00001499 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001500 mallinfo \
1501 memchr \
1502 memset \
1503 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001504 mremap \
bartf5ceec82008-04-26 07:45:10 +00001505 ppoll \
bart6d45e922009-01-20 13:45:38 +00001506 pthread_barrier_init \
1507 pthread_condattr_setclock \
1508 pthread_mutex_timedlock \
1509 pthread_rwlock_timedrdlock \
1510 pthread_rwlock_timedwrlock \
1511 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001512 semtimedop \
1513 signalfd \
njn6cc22472009-03-16 03:46:48 +00001514 sigwaitinfo \
bart71bad292008-04-27 11:43:23 +00001515 syscall \
bartf5ceec82008-04-26 07:45:10 +00001516 strchr \
1517 strdup \
1518 strpbrk \
1519 strrchr \
1520 strstr \
1521 timerfd \
1522 utimensat \
1523 ])
sewardjde4a1d02002-03-22 01:27:54 +00001524
bart623eec32008-07-29 17:54:49 +00001525# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1526# libraries with any shared object and/or executable. This is NOT what we
1527# want for e.g. vgpreload_core-x86-linux.so
1528LIBS=""
sewardj80637752006-03-02 13:48:21 +00001529
bart6d45e922009-01-20 13:45:38 +00001530AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1531 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001532AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1533 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001534AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1535 [test x$ac_cv_func_pthread_spin_lock = xyes])
1536
njn7fd6d382009-01-22 21:56:32 +00001537
1538#----------------------------------------------------------------------------
1539# MPI checks
1540#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001541# Do we have a useable MPI setup on the primary and/or secondary targets?
1542# On Linux, by default, assumes mpicc and -m32/-m64
1543# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001544# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001545# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1546# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001547MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001548if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1549 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001550 MPI_CC="mpxlc"
1551fi
1552
sewardje9fa5062006-03-12 18:29:18 +00001553mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001554if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1555 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001556 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001557elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1558 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001559 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001560elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001561 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001562elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001563 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001564fi
1565
sewardj03d86f22006-10-17 00:57:24 +00001566mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001567if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1568 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001569 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001570elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001571 mflag_secondary=-q32
1572fi
1573
1574
sewardj0ad46092006-03-02 17:09:16 +00001575AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001576 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001577 MPI_CC=$withval
1578)
sewardj03d86f22006-10-17 00:57:24 +00001579AC_SUBST(MPI_CC)
1580
1581## See if MPI_CC works for the primary target
1582##
1583AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001584saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001585saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001586CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001587CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001588AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001589#include <mpi.h>
1590#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001591],[
1592 int r = MPI_Init(NULL,NULL);
1593 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1594 return r;
1595], [
sewardj03d86f22006-10-17 00:57:24 +00001596ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001597AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001598], [
sewardj03d86f22006-10-17 00:57:24 +00001599ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001600AC_MSG_RESULT([no])
1601])
sewardj0ad46092006-03-02 17:09:16 +00001602CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001603CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001604AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001605
sewardj03d86f22006-10-17 00:57:24 +00001606## See if MPI_CC works for the secondary target. Complication: what if
1607## there is no secondary target? We need this to then fail.
1608## Kludge this by making MPI_CC something which will surely fail in
1609## such a case.
1610##
1611AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1612saved_CC=$CC
1613saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001614if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001615 CC="$MPI_CC this will surely fail"
1616else
1617 CC=$MPI_CC
1618fi
1619CFLAGS=$mflag_secondary
1620AC_TRY_LINK([
1621#include <mpi.h>
1622#include <stdio.h>
1623],[
1624 int r = MPI_Init(NULL,NULL);
1625 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1626 return r;
1627], [
1628ac_have_mpi2_sec=yes
1629AC_MSG_RESULT([yes, $MPI_CC])
1630], [
1631ac_have_mpi2_sec=no
1632AC_MSG_RESULT([no])
1633])
1634CC=$saved_CC
1635CFLAGS=$saved_CFLAGS
1636AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001637
1638
njn7fd6d382009-01-22 21:56:32 +00001639#----------------------------------------------------------------------------
1640# Other library checks
1641#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001642# There now follow some tests for QtCore, Boost, and OpenMP. These
1643# tests are present because Drd has some regression tests that use
1644# these packages. All regression test programs all compiled only
1645# for the primary target. And so it is important that the configure
1646# checks that follow, use the correct -m32 or -m64 flag for the
1647# primary target (called $mflag_primary). Otherwise, we can end up
1648# in a situation (eg) where, on amd64-linux, the test for Boost checks
1649# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1650# only build (meaning, the primary target is x86-linux), the build
1651# of the regtest programs that use Boost fails, because they are
1652# build as 32-bit (IN THIS EXAMPLE).
1653#
1654# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1655# NEEDED BY THE REGRESSION TEST PROGRAMS.
1656
1657
bart21d3cfc2008-08-02 09:08:17 +00001658# The test below verifies whether the QtCore package been installed.
1659# This test works as follows:
1660# - If pkg-config was not installed at the time autogen.sh was run,
1661# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1662# autogen.sh. Augogen.sh will generate a configure script that prints
1663# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1664# - If pkg-config was installed at the time autogen.sh was run,
1665# the generated configure script will try to detect the presence of the
1666# Qt4 QtCore library by looking up compile and linker flags in the file
1667# called QtCore.pc.
1668# - pkg-config settings can be overridden via the configure variables
1669# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1670# configure script -- see also ./configure --help).
1671# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1672# the pkg-config executable is not present on the system on which the
1673# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001674
bart21d3cfc2008-08-02 09:08:17 +00001675ifdef(
1676 [PKG_CHECK_EXISTS],
1677 [PKG_CHECK_EXISTS(
1678 [QtCore],
1679 [
1680 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001681 # Paranoia: don't trust the result reported by pkg-config, but when
1682 # pkg-config reports that QtCore has been found, verify whether linking
1683 # programs with QtCore succeeds.
1684 AC_LANG(C++)
1685 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001686 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001687 AC_TRY_LINK(
1688 [#include <QMutex>],
1689 [QMutex Mutex;],
1690 [ac_have_qtcore=yes],
1691 [
1692 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1693 ac_have_qtcore=no
1694 ]
1695 )
1696 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001697 ],
1698 [
1699 ac_have_qtcore=no
1700 ]
1701 )
1702 ],
1703 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1704 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1705 [ac_have_qtcore=no]
1706)
bart41ac62a2008-07-07 16:58:03 +00001707
1708AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1709
1710
bart62f54e42008-07-28 11:35:10 +00001711# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1712# See also http://doc.trolltech.com/4.3/qmutex.html.
1713if test x$ac_have_qtcore = xyes; then
1714 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1715 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001716 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001717 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001718 AC_TRY_COMPILE([
1719 #include <QtCore/QMutex>
1720 ],
1721 [
1722 QMutex M;
1723 M.tryLock(1);
1724 M.unlock();
1725 return 0;
1726 ],
1727 [
1728 AC_MSG_RESULT([yes])
1729 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1730 ],
1731 [
1732 AC_MSG_RESULT([no])
1733 ])
bart21d3cfc2008-08-02 09:08:17 +00001734 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001735 AC_LANG(C)
1736fi
1737
1738
sewardj493c4ef2008-12-13 16:45:19 +00001739# Check whether the boost library 1.35 or later has been installed.
1740# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1741
1742AC_MSG_CHECKING([for boost])
1743
1744AC_LANG(C++)
1745safe_CXXFLAGS=$CXXFLAGS
1746CXXFLAGS="-lboost_thread-mt $mflag_primary"
1747
1748AC_LINK_IFELSE(
1749[
1750#include <boost/thread.hpp>
1751static void thread_func(void)
1752{ }
1753int main(int argc, char** argv)
1754{
1755 boost::thread t(thread_func);
1756 return 0;
1757}
1758],
1759[
1760ac_have_boost_1_35=yes
1761AC_SUBST([BOOST_CFLAGS], [])
1762AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1763AC_MSG_RESULT([yes])
1764], [
1765ac_have_boost_1_35=no
1766AC_MSG_RESULT([no])
1767])
1768
1769CXXFLAGS=$safe_CXXFLAGS
1770AC_LANG(C)
1771
1772AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1773
1774
1775# does this compiler support -fopenmp, does it have the include file
1776# <omp.h> and does it have libgomp ?
1777
1778AC_MSG_CHECKING([for OpenMP])
1779
1780safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001781CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001782
1783AC_LINK_IFELSE(
1784[
1785#include <omp.h>
1786int main(int argc, char** argv)
1787{
1788 omp_set_dynamic(0);
1789 return 0;
1790}
1791],
1792[
1793ac_have_openmp=yes
1794AC_MSG_RESULT([yes])
1795], [
1796ac_have_openmp=no
1797AC_MSG_RESULT([no])
1798])
1799CFLAGS=$safe_CFLAGS
1800
1801AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1802
1803
sewardjc876a2f2009-01-22 22:44:30 +00001804# does this compiler have built-in functions for atomic memory access ?
1805AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1806
1807safe_CFLAGS=$CFLAGS
1808CFLAGS="$mflag_primary"
1809
1810AC_TRY_LINK(,
1811[
1812 int variable = 1;
1813 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1814 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1815],
1816[
bartc82d1372009-05-31 16:21:23 +00001817 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001818 AC_MSG_RESULT([yes])
1819 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1820],
1821[
bartc82d1372009-05-31 16:21:23 +00001822 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001823 AC_MSG_RESULT([no])
1824])
1825
1826CFLAGS=$safe_CFLAGS
1827
bartc82d1372009-05-31 16:21:23 +00001828AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1829
sewardjc876a2f2009-01-22 22:44:30 +00001830
njn7fd6d382009-01-22 21:56:32 +00001831#----------------------------------------------------------------------------
1832# Ok. We're done checking.
1833#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001834
njn8b68b642009-06-24 00:37:09 +00001835# Nb: VEX/Makefile is generated from Makefile.vex.in.
1836AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001837 Makefile
njn8b68b642009-06-24 00:37:09 +00001838 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001839 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001840 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001841 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001842 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001843 docs/lib/Makefile
1844 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001845 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001846 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001847 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001848 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001849 perf/Makefile
1850 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001851 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001852 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001853 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001854 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001855 memcheck/Makefile
1856 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001857 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001858 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001859 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001860 memcheck/tests/darwin/Makefile
njna454ec02009-01-19 03:16:59 +00001861 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001862 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001863 memcheck/docs/Makefile
1864 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001865 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001866 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001867 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001868 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001869 callgrind/Makefile
1870 callgrind/callgrind_annotate
1871 callgrind/callgrind_control
1872 callgrind/tests/Makefile
1873 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001874 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001875 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001876 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001877 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001878 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001879 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001880 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001881 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001882 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001883 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001884 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001885 none/Makefile
1886 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001887 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001888 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001889 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001890 none/tests/x86/Makefile
njn0458a122009-02-13 06:23:46 +00001891 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001892 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001893 none/tests/x86-linux/Makefile
njn9bc8c002002-10-02 13:49:13 +00001894 none/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001895 exp-ptrcheck/Makefile
1896 exp-ptrcheck/tests/Makefile
1897 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001898 drd/Makefile
1899 drd/docs/Makefile
1900 drd/scripts/download-and-build-splash2
1901 drd/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00001902])
1903AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001904
1905cat<<EOF
1906
njn311303f2009-02-06 03:46:50 +00001907 Maximum build arch: ${ARCH_MAX}
1908 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001909 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001910 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001911 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1912 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001913 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001914
gobry3b777892002-04-04 09:18:39 +00001915EOF