blob: 3a8b18cc922676731ac61246d3acc4518ccac80d [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#----------------------------------------------------------------------------
njn8738c282004-11-23 16:31:56 +000019# Where is VEX ?
njn7fd6d382009-01-22 21:56:32 +000020#----------------------------------------------------------------------------
njnfe408942004-11-23 17:52:24 +000021# Nb: For the 2nd arg, the help string, AS_HELP_STRING is the proper way, but
22# older autoconfs don't support it... here's what it would say:
23#
sewardj85a9dca2005-07-26 10:42:57 +000024# AS_HELP_STRING([--with-vex], [Vex directory]),
njnfe408942004-11-23 17:52:24 +000025#
njn8738c282004-11-23 16:31:56 +000026AC_ARG_WITH(vex,
sewardj85a9dca2005-07-26 10:42:57 +000027 [ --with-vex=/path/to/vex/dir Vex directory],
njn8738c282004-11-23 16:31:56 +000028[
29 AC_CHECK_FILE($withval/pub/libvex.h,
30 [VEX_DIR=$withval],
31 [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain Vex])])
32],
33[
njn17adf1e2005-09-16 03:59:37 +000034 VEX_DIR='$(top_srcdir)/VEX'
njn8738c282004-11-23 16:31:56 +000035])
sewardj50629ec2004-11-22 13:44:11 +000036AC_SUBST(VEX_DIR)
37
njn657d9512005-06-24 15:20:52 +000038# "make distcheck" first builds a tarball, then extracts it.
39# Then it creates a build directory different from the extracted sources
40# (called _build), and issues
41#
42# ../configure $(DISTCHECK_CONFIGURE_FLAGS)
43#
44# and then builds, runs "make check", installs using DESTDIR, runs make
45# installcheck, uninstalls, checks whether the installed base is empty
46# again, then does yet another "make dist" and compares the resulting
47# tarball with the one it started off with for identical content. Then it
48# tests "make distclean" for no leftover files.
49#
50# So this line means: when doing "make dist", use the same --with-vex value
51# that you used when running configure to configure this tree in the first
52# place.
53AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], [--with-vex=$VEX_DIR])
54
njn7fd6d382009-01-22 21:56:32 +000055#----------------------------------------------------------------------------
56# Checks for various programs.
57#----------------------------------------------------------------------------
sewardjb5f6f512005-03-10 23:59:00 +000058CFLAGS="-Wno-long-long"
gobrye721a522002-03-22 13:38:30 +000059
sewardjde4a1d02002-03-22 01:27:54 +000060AC_PROG_LN_S
61AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000062AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000063AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000064AC_PROG_CXX
njnf76d27a2009-05-28 01:53:07 +000065AC_PROG_OBJC
sewardjde4a1d02002-03-22 01:27:54 +000066AC_PROG_RANLIB
67
bartcddeaf52008-05-25 15:58:11 +000068# If no AR variable was specified, look up the name of the archiver. Otherwise
69# do not touch the AR variable.
70if test "x$AR" = "x"; then
bart325cd972009-04-04 14:36:51 +000071 AC_PATH_PROGS([AR], [`echo $LD | sed 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000072fi
73AC_ARG_VAR([AR],[Archiver command])
74
gobrye721a522002-03-22 13:38:30 +000075# Check for the compiler support
76if test "${GCC}" != "yes" ; then
77 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
78fi
79
sewardj2f685952002-12-22 19:32:23 +000080# figure out where perl lives
81AC_PATH_PROG(PERL, perl)
82
njn9315df32003-04-16 20:50:50 +000083# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000084AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000085AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000086
daywalker48ccca52002-04-15 00:31:58 +000087# some older automake's don't have it so try something on our own
88ifdef([AM_PROG_AS],[AM_PROG_AS],
89[
gobry1be19852002-03-26 20:44:55 +000090AS="${CC}"
91AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000092
gobry1be19852002-03-26 20:44:55 +000093ASFLAGS=""
94AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000095])
gobry3b777892002-04-04 09:18:39 +000096
gobry3b777892002-04-04 09:18:39 +000097
njn0d2e58f2009-02-25 04:57:56 +000098# Check if 'diff' supports -u (universal diffs) and use it if possible.
99
100AC_MSG_CHECKING([for diff -u])
101AC_SUBST(DIFF)
102
103# Comparing two identical files results in 0, unless -u isn't supported (as
104# it's not on AIX).
njn31f665e2009-02-26 21:25:50 +0000105tmpfile="tmp-xxx-yyy-zzz"
106touch $tmpfile;
107if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +0000108 AC_MSG_RESULT([yes])
109 DIFF="diff -u"
110else
111 AC_MSG_RESULT([no])
112 DIFF="diff"
113fi
njn31f665e2009-02-26 21:25:50 +0000114rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +0000115
116
sewardj535c50f2005-06-04 23:14:53 +0000117# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +0000118AC_MSG_CHECKING([for a supported version of gcc])
119
sewardjf33b4332008-07-18 18:20:42 +0000120[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +0000121
122case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +0000123 2.*)
gobrye721a522002-03-22 13:38:30 +0000124 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000125 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
126 ;;
gobrye721a522002-03-22 13:38:30 +0000127 *)
128 AC_MSG_RESULT([ok (${gcc_version})])
129 ;;
130esac
131
njn7fd6d382009-01-22 21:56:32 +0000132#----------------------------------------------------------------------------
133# Arch/OS/platform tests.
134#----------------------------------------------------------------------------
135# We create a number of arch/OS/platform-related variables. We prefix them
136# all with "VGCONF_" which indicates that they are defined at
137# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
138# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000139
sewardjde4a1d02002-03-22 01:27:54 +0000140AC_CANONICAL_HOST
141
142AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000143
njn7fd6d382009-01-22 21:56:32 +0000144# ARCH_MAX reflects the most that this CPU can do: for example if it
145# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
146# Ditto for amd64. It is used for more configuration below, but is not used
147# outside this file.
gobrye721a522002-03-22 13:38:30 +0000148case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000149 i?86)
150 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000151 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000152 ;;
153
njnfe408942004-11-23 17:52:24 +0000154 x86_64)
155 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000156 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000157 ;;
158
sewardj2c48c7b2005-11-29 13:05:56 +0000159 powerpc64)
njn7fd6d382009-01-22 21:56:32 +0000160 # This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000161 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000162 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000163 ;;
164
165 powerpc)
njn7fd6d382009-01-22 21:56:32 +0000166 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
167 # Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000168 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000169 case "${host_os}" in
170 aix5.*)
njn7fd6d382009-01-22 21:56:32 +0000171 ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000172 ;;
173 *)
njn7fd6d382009-01-22 21:56:32 +0000174 ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000175 ;;
176 esac
nethercote9bcc9062004-10-13 13:50:01 +0000177 ;;
178
sewardjde4a1d02002-03-22 01:27:54 +0000179 *)
180 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000181 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000182 ;;
183esac
184
njn7fd6d382009-01-22 21:56:32 +0000185#----------------------------------------------------------------------------
186
sewardj86e992f2006-01-28 18:39:09 +0000187# Sometimes it's convenient to subvert the bi-arch build system and
188# just have a single build even though the underlying platform is
189# capable of both. Hence handle --enable-only64bit and
190# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000191# [Actually, if either of these options are used, I think both get built,
192# but only one gets installed. So if you use an in-place build, both can be
193# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000194
195# Check if a 64-bit only build has been requested
196AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
197 [AC_ARG_ENABLE(only64bit,
198 [ --enable-only64bit do a 64-bit only build],
199 [vg_cv_only64bit=$enableval],
200 [vg_cv_only64bit=no])])
201
202# Check if a 32-bit only build has been requested
203AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
204 [AC_ARG_ENABLE(only32bit,
205 [ --enable-only32bit do a 32-bit only build],
206 [vg_cv_only32bit=$enableval],
207 [vg_cv_only32bit=no])])
208
209# Stay sane
210if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
211 AC_MSG_ERROR(
212 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
213fi
214
njn7fd6d382009-01-22 21:56:32 +0000215#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000216
njn311303f2009-02-06 03:46:50 +0000217# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
218# compilation of many C files via -VGO_$(VGCONF_OS) and
219# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000220AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000221AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000222
njnf76d27a2009-05-28 01:53:07 +0000223DEFAULT_SUPP=""
224
gobrye721a522002-03-22 13:38:30 +0000225case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000226 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000227 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000228 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000229
230 # Ok, this is linux. Check the kernel version
231 AC_MSG_CHECKING([for the kernel version])
232
233 kernel=`uname -r`
234
235 case "${kernel}" in
236 2.6.*)
237 AC_MSG_RESULT([2.6 family (${kernel})])
238 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
239 ;;
240
241 2.4.*)
242 AC_MSG_RESULT([2.4 family (${kernel})])
243 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
244 ;;
245
mueller8c68e042004-01-03 15:21:14 +0000246 *)
247 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000248 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000249 ;;
250 esac
251
252 ;;
253
sewardj03d86f22006-10-17 00:57:24 +0000254 aix5.1.*)
255 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000256 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000257 ;;
258 aix5.2.*)
259 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000260 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000261 ;;
262 aix5.3.*)
263 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000264 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000265 ;;
266
mueller8c68e042004-01-03 15:21:14 +0000267 *freebsd*)
268 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000269 VGCONF_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000270 ;;
271
njnf76d27a2009-05-28 01:53:07 +0000272 *darwin*)
273 AC_MSG_RESULT([ok (${host_os})])
274 VGCONF_OS="darwin"
275
276 AC_MSG_CHECKING([for the kernel version])
277 kernel=`uname -r`
278
279 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
280 # has only one relevant version, the OS version. The `uname` check
281 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
282 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
283 # Snow Leopard and darwin10.supp), and we don't know of an macros
284 # similar to __GLIBC__ to get that info.
285 #
286 # XXX: `uname -r` won't do the right thing for cross-compiles, but
287 # that's not a problem yet.
288 case "${kernel}" in
289 9.*)
290 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
291 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
292 ;;
293 *)
294 AC_MSG_RESULT([unsupported (${kernel})])
295 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
296 ;;
297 esac
298 ;;
299
sewardjde4a1d02002-03-22 01:27:54 +0000300 *)
301 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000302 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000303 ;;
304esac
305
njn7fd6d382009-01-22 21:56:32 +0000306#----------------------------------------------------------------------------
307
tomd6398392006-06-07 17:44:36 +0000308# If we are building on a 64 bit platform test to see if the system
309# supports building 32 bit programs and disable 32 bit support if it
310# does not support building 32 bit programs
311
njn7fd6d382009-01-22 21:56:32 +0000312case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000313 amd64-linux|ppc64-linux)
314 AC_MSG_CHECKING([for 32 bit build support])
315 safe_CFLAGS=$CFLAGS
316 CFLAGS="-m32"
317 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000318 return 0;
tomd6398392006-06-07 17:44:36 +0000319 ],
320 [
321 AC_MSG_RESULT([yes])
322 ], [
323 vg_cv_only64bit="yes"
324 AC_MSG_RESULT([no])
325 ])
326 CFLAGS=$safe_CFLAGS;;
327esac
328
329if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
330 AC_MSG_ERROR(
331 [--enable-only32bit was specified but system does not support 32 bit builds])
332fi
nethercote888ecb72004-08-23 14:54:40 +0000333
njn7fd6d382009-01-22 21:56:32 +0000334#----------------------------------------------------------------------------
335
njn311303f2009-02-06 03:46:50 +0000336# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
337# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
338# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
339# above) will be "amd64" since that reflects the most that this cpu can do,
340# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
341# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000342# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
343# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
344AC_SUBST(VGCONF_ARCH_PRI)
345
njn311303f2009-02-06 03:46:50 +0000346# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
347# The entire system, including regression and performance tests, will be
348# built for this target. The "_CAPS" indicates that the name is in capital
349# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000350# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000351# convention and cannot contain '-' characters. This is in contrast to
352# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000353AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
354
355# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
356# Valgrind and tools will also be built for this target, but not the
357# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000358#
njn7fd6d382009-01-22 21:56:32 +0000359# By default, the primary arch is the same as the "max" arch, as commented
360# above (at the definition of ARCH_MAX). We may choose to downgrade it in
361# the big case statement just below here, in the case where we're building
362# on a 64 bit machine but have been requested only to do a 32 bit build.
363AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
364
sewardj01262142006-01-04 01:20:28 +0000365AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000366
njn7fd6d382009-01-22 21:56:32 +0000367case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000368 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000369 VGCONF_ARCH_PRI="x86"
370 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
371 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000372 valt_load_address_normal="0x38000000"
373 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000374 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000375 ;;
376 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000377 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000378 VGCONF_ARCH_PRI="amd64"
379 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
380 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000381 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000382 VGCONF_ARCH_PRI="x86"
383 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
384 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000385 else
njn7fd6d382009-01-22 21:56:32 +0000386 VGCONF_ARCH_PRI="amd64"
387 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
388 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000389 fi
njnd74b0ef2009-01-20 06:06:52 +0000390 valt_load_address_normal="0x38000000"
391 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000392 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000393 ;;
394 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000395 VGCONF_ARCH_PRI="ppc32"
396 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
397 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000398 valt_load_address_normal="0x38000000"
399 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000400 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000401 ;;
sewardj03d86f22006-10-17 00:57:24 +0000402 ppc64-aix5)
403 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000404 VGCONF_ARCH_PRI="ppc64"
405 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
406 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000407 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000408 VGCONF_ARCH_PRI="ppc32"
409 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
410 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000411 else
njn7fd6d382009-01-22 21:56:32 +0000412 VGCONF_ARCH_PRI="ppc64"
413 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
414 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000415 fi
njnd74b0ef2009-01-20 06:06:52 +0000416 valt_load_address_normal="0x38000000"
417 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000418 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000419 ;;
sewardj01262142006-01-04 01:20:28 +0000420 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000421 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000422 VGCONF_ARCH_PRI="ppc64"
423 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
424 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000425 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000426 VGCONF_ARCH_PRI="ppc32"
427 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
428 VGCONF_PLATFORM_SEC_CAPS=""
429 VGCONF_ARCH_PRI="ppc32"
sewardj86e992f2006-01-28 18:39:09 +0000430 else
njn7fd6d382009-01-22 21:56:32 +0000431 VGCONF_ARCH_PRI="ppc64"
432 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
433 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000434 fi
njnd74b0ef2009-01-20 06:06:52 +0000435 valt_load_address_normal="0x38000000"
436 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000437 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000438 ;;
njnf76d27a2009-05-28 01:53:07 +0000439 x86-darwin)
440 VGCONF_ARCH_PRI="x86"
441 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
442 VGCONF_PLATFORM_SEC_CAPS=""
443 valt_load_address_normal="0x0"
444 valt_load_address_inner="0x0"
445 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
446 ;;
447 amd64-darwin)
448 if test x$vg_cv_only64bit = xyes; then
449 VGCONF_ARCH_PRI="amd64"
450 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
451 VGCONF_PLATFORM_SEC_CAPS=""
452 elif test x$vg_cv_only32bit = xyes; then
453 VGCONF_ARCH_PRI="x86"
454 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
455 VGCONF_PLATFORM_SEC_CAPS=""
456 VGCONF_ARCH_PRI_CAPS="x86"
457 else
458 VGCONF_ARCH_PRI="amd64"
459 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
460 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
461 fi
462 valt_load_address_normal="0x0"
463 valt_load_address_inner="0x0"
464 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
465 ;;
nethercote888ecb72004-08-23 14:54:40 +0000466 *)
njn7fd6d382009-01-22 21:56:32 +0000467 VGCONF_ARCH_PRI="unknown"
468 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
469 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njn377c43f2009-05-19 07:39:22 +0000470 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000471 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000472 ;;
473esac
sewardjde4a1d02002-03-22 01:27:54 +0000474
njn7fd6d382009-01-22 21:56:32 +0000475#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000476
njn7fd6d382009-01-22 21:56:32 +0000477# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
478# defined.
479AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
480 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000481 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
482 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
483 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000484AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000485 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
486 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000487AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
488 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
489 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
490 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
491 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
492AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
493 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
494 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj03d86f22006-10-17 00:57:24 +0000495
njn7fd6d382009-01-22 21:56:32 +0000496# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
497# become defined.
498AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
499 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
500 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
501AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
502 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
503AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
504 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
505 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
506AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
507 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000508
njn7fd6d382009-01-22 21:56:32 +0000509AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
510 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
511 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
512AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
513 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
514
njnf76d27a2009-05-28 01:53:07 +0000515AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
516 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
517 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
518AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
519 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
520
521
njn7fd6d382009-01-22 21:56:32 +0000522# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000523# Relies on the assumption that the primary and secondary targets are
524# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000525AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
526 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
527 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
528 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
529 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
530AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
531 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
532 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000533AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
534 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
535 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000536
537
njn7fd6d382009-01-22 21:56:32 +0000538# Sometimes, in the Makefile.am files, it's useful to know whether or not
539# there is a secondary target.
540AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC_CAPS,
541 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000542
tomb637bad2005-11-08 12:28:35 +0000543
njn7fd6d382009-01-22 21:56:32 +0000544#----------------------------------------------------------------------------
545# Inner Valgrind?
546#----------------------------------------------------------------------------
547
njnd74b0ef2009-01-20 06:06:52 +0000548# Check if this should be built as an inner Valgrind, to be run within
549# another Valgrind. Choose the load address accordingly.
550AC_SUBST(VALT_LOAD_ADDRESS)
551AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
552 [AC_ARG_ENABLE(inner,
553 [ --enable-inner enables self-hosting],
554 [vg_cv_inner=$enableval],
555 [vg_cv_inner=no])])
556if test "$vg_cv_inner" = yes; then
557 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
558 VALT_LOAD_ADDRESS=$valt_load_address_inner
559else
560 VALT_LOAD_ADDRESS=$valt_load_address_normal
561fi
562
563
njn7fd6d382009-01-22 21:56:32 +0000564#----------------------------------------------------------------------------
565# Libc and suppressions
566#----------------------------------------------------------------------------
567# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000568AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000569
dirk07596a22008-04-25 11:33:30 +0000570GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000571
sewardjde4a1d02002-03-22 01:27:54 +0000572AC_EGREP_CPP([GLIBC_22], [
573#include <features.h>
574#ifdef __GNU_LIBRARY__
575 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
576 GLIBC_22
577 #endif
578#endif
579],
dirk07596a22008-04-25 11:33:30 +0000580GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000581
sewardj08c7f012002-10-07 23:56:55 +0000582AC_EGREP_CPP([GLIBC_23], [
583#include <features.h>
584#ifdef __GNU_LIBRARY__
585 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
586 GLIBC_23
587 #endif
588#endif
589],
dirk07596a22008-04-25 11:33:30 +0000590GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000591
njn781dba52005-06-30 04:06:38 +0000592AC_EGREP_CPP([GLIBC_24], [
593#include <features.h>
594#ifdef __GNU_LIBRARY__
595 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
596 GLIBC_24
597 #endif
598#endif
599],
dirk07596a22008-04-25 11:33:30 +0000600GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000601
dirkaece45c2006-10-12 08:17:49 +0000602AC_EGREP_CPP([GLIBC_25], [
603#include <features.h>
604#ifdef __GNU_LIBRARY__
605 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
606 GLIBC_25
607 #endif
608#endif
609],
dirk07596a22008-04-25 11:33:30 +0000610GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000611
dirkc8bd0c52007-05-23 17:39:08 +0000612AC_EGREP_CPP([GLIBC_26], [
613#include <features.h>
614#ifdef __GNU_LIBRARY__
615 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
616 GLIBC_26
617 #endif
618#endif
619],
dirk07596a22008-04-25 11:33:30 +0000620GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000621
sewardj68c80c12007-11-18 14:40:02 +0000622AC_EGREP_CPP([GLIBC_27], [
623#include <features.h>
624#ifdef __GNU_LIBRARY__
625 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
626 GLIBC_27
627 #endif
628#endif
629],
dirk07596a22008-04-25 11:33:30 +0000630GLIBC_VERSION="2.7")
631
632AC_EGREP_CPP([GLIBC_28], [
633#include <features.h>
634#ifdef __GNU_LIBRARY__
635 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
636 GLIBC_28
637 #endif
638#endif
639],
640GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000641
dirkd2e31eb2008-11-19 23:58:36 +0000642AC_EGREP_CPP([GLIBC_29], [
643#include <features.h>
644#ifdef __GNU_LIBRARY__
645 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
646 GLIBC_29
647 #endif
648#endif
649],
650GLIBC_VERSION="2.9")
651
sewardj5d425e82009-02-01 19:01:11 +0000652AC_EGREP_CPP([GLIBC_210], [
653#include <features.h>
654#ifdef __GNU_LIBRARY__
655 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
656 GLIBC_210
657 #endif
658#endif
659],
660GLIBC_VERSION="2.10")
661
sewardj03d86f22006-10-17 00:57:24 +0000662AC_EGREP_CPP([AIX5_LIBC], [
663#include <standards.h>
664#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
665 AIX5_LIBC
666#endif
667],
dirk07596a22008-04-25 11:33:30 +0000668GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000669
njnf76d27a2009-05-28 01:53:07 +0000670# not really a version check
671AC_EGREP_CPP([DARWIN_LIBC], [
672#include <sys/cdefs.h>
673#if defined(__DARWIN_VERS_1050)
674 DARWIN_LIBC
675#endif
676],
677GLIBC_VERSION="darwin")
678
dirk07596a22008-04-25 11:33:30 +0000679AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000680
dirk07596a22008-04-25 11:33:30 +0000681case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000682 2.2)
683 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000684 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000685 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
686 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000687 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000688 ;;
689
sewardj08c7f012002-10-07 23:56:55 +0000690 2.3)
691 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000692 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000693 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000694 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000695 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000696 ;;
697
njn781dba52005-06-30 04:06:38 +0000698 2.4)
699 AC_MSG_RESULT(2.4 family)
700 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000701 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000702 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000703 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000704 ;;
705
dirkaece45c2006-10-12 08:17:49 +0000706 2.5)
707 AC_MSG_RESULT(2.5 family)
708 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000709 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000710 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000711 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000712 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000713 2.6)
714 AC_MSG_RESULT(2.6 family)
715 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000716 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000717 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000718 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000719 ;;
720 2.7)
721 AC_MSG_RESULT(2.7 family)
722 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000723 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000724 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000725 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000726 ;;
dirk07596a22008-04-25 11:33:30 +0000727 2.8)
728 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000729 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000730 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
731 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
732 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
733 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000734 2.9)
735 AC_MSG_RESULT(2.9 family)
736 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
737 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
738 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
739 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
740 ;;
sewardj5d425e82009-02-01 19:01:11 +0000741 2.10)
742 AC_MSG_RESULT(2.10 family)
743 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
744 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
745 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
746 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
747 ;;
sewardj03d86f22006-10-17 00:57:24 +0000748 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000749 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
750 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 +0000751 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
752 ;;
njnf76d27a2009-05-28 01:53:07 +0000753 darwin)
754 AC_MSG_RESULT(Darwin)
755 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
756 # DEFAULT_SUPP set by kernel version check above.
757 ;;
dirkaece45c2006-10-12 08:17:49 +0000758
sewardjde4a1d02002-03-22 01:27:54 +0000759 *)
760 AC_MSG_RESULT(unsupported version)
sewardj5d425e82009-02-01 19:01:11 +0000761 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.10])
dirk07596a22008-04-25 11:33:30 +0000762 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000763 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000764 ;;
765esac
766
dirk07596a22008-04-25 11:33:30 +0000767AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000768
sewardj414f3582008-07-18 20:46:00 +0000769
770# Add default suppressions for the X client libraries. Make no
771# attempt to detect whether such libraries are installed on the
772# build machine (or even if any X facilities are present); just
773# add the suppressions antidisirregardless.
774DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
775DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000776
sewardj5744c022008-10-19 18:58:13 +0000777# Add glibc and X11 suppressions for exp-ptrcheck
778DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
779
sewardj2e10a682003-04-07 19:36:41 +0000780
njn7fd6d382009-01-22 21:56:32 +0000781#----------------------------------------------------------------------------
782# Checking for various library functions and other definitions
783#----------------------------------------------------------------------------
784
bart59e2f182008-04-28 16:22:53 +0000785# Check for CLOCK_MONOTONIC
786
787AC_MSG_CHECKING([for CLOCK_MONOTONIC])
788
789AC_TRY_COMPILE(
790[
791#include <time.h>
792], [
793 struct timespec t;
794 clock_gettime(CLOCK_MONOTONIC, &t);
795 return 0;
796],
797[
798AC_MSG_RESULT([yes])
799AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
800 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
801], [
802AC_MSG_RESULT([no])
803])
804
bartfea06922008-05-03 09:12:15 +0000805
806# Check for PTHREAD_MUTEX_ADAPTIVE_NP
807
808AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
809
810AC_TRY_COMPILE(
811[
812#define _GNU_SOURCE
813#include <pthread.h>
814], [
815 return (PTHREAD_MUTEX_ADAPTIVE_NP);
816],
817[
818AC_MSG_RESULT([yes])
819AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
820 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
821], [
822AC_MSG_RESULT([no])
823])
824
825
826# Check for PTHREAD_MUTEX_ERRORCHECK_NP
827
828AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
829
830AC_TRY_COMPILE(
831[
832#define _GNU_SOURCE
833#include <pthread.h>
834], [
835 return (PTHREAD_MUTEX_ERRORCHECK_NP);
836],
837[
838AC_MSG_RESULT([yes])
839AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
840 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
841], [
842AC_MSG_RESULT([no])
843])
844
845
846# Check for PTHREAD_MUTEX_RECURSIVE_NP
847
848AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
849
850AC_TRY_COMPILE(
851[
852#define _GNU_SOURCE
853#include <pthread.h>
854], [
855 return (PTHREAD_MUTEX_RECURSIVE_NP);
856],
857[
858AC_MSG_RESULT([yes])
859AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
860 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
861], [
862AC_MSG_RESULT([no])
863])
864
865
866# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
867
868AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
869
870AC_TRY_COMPILE(
871[
872#define _GNU_SOURCE
873#include <pthread.h>
874], [
875 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
876 return 0;
877],
878[
879AC_MSG_RESULT([yes])
880AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
881 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
882], [
883AC_MSG_RESULT([no])
884])
885
886
bart5e389f12008-04-05 12:53:15 +0000887# Check whether pthread_mutex_t has a member called __m_kind.
888
889AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
890
bart56730cd2008-05-11 06:41:46 +0000891AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000892[
bart56730cd2008-05-11 06:41:46 +0000893 #include <pthread.h>
894], [
bart5e389f12008-04-05 12:53:15 +0000895 pthread_mutex_t m;
896 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000897], [
bart5e389f12008-04-05 12:53:15 +0000898AC_MSG_RESULT([yes])
899AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
900 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
901], [
902AC_MSG_RESULT([no])
903])
904
905
906# Check whether pthread_mutex_t has a member called __data.__kind.
907
908AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
909
bart56730cd2008-05-11 06:41:46 +0000910AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000911[
bart56730cd2008-05-11 06:41:46 +0000912#include <pthread.h>
913], [
bart5e389f12008-04-05 12:53:15 +0000914 pthread_mutex_t m;
915 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000916], [
bart5e389f12008-04-05 12:53:15 +0000917AC_MSG_RESULT([yes])
918AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
919 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
920], [
921AC_MSG_RESULT([no])
922])
923
924
bart62c370e2008-05-12 18:50:51 +0000925# does this compiler support -maltivec and does it have the include file
926# <altivec.h> ?
927
928AC_MSG_CHECKING([for Altivec])
929
930safe_CFLAGS=$CFLAGS
931CFLAGS="-maltivec"
932
933AC_TRY_COMPILE(
934[
935#include <altivec.h>
936], [
937 vector unsigned int v;
938],
939[
940ac_have_altivec=yes
941AC_MSG_RESULT([yes])
942], [
943ac_have_altivec=no
944AC_MSG_RESULT([no])
945])
946CFLAGS=$safe_CFLAGS
947
948AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
949AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
950
951
bart36dd85a2009-04-26 07:11:48 +0000952# Check for pthread_create@GLIBC2.0
953AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
954
bart16e1c5a2009-04-26 07:38:53 +0000955safe_CFLAGS=$CFLAGS
956CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000957AC_TRY_LINK(
958[
959extern int pthread_create_glibc_2_0(void*, const void*,
960 void *(*)(void*), void*);
961__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
962], [
bart276ed3a2009-05-10 15:41:45 +0000963#ifdef __powerpc__
964/*
965 * Apparently on PowerPC linking this program succeeds and generates an
966 * executable with the undefined symbol pthread_create@GLIBC_2.0.
967 */
968#error This test does not work properly on PowerPC.
969#else
bart16e1c5a2009-04-26 07:38:53 +0000970 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000971#endif
bart16e1c5a2009-04-26 07:38:53 +0000972 return 0;
bart36dd85a2009-04-26 07:11:48 +0000973],
974[
975ac_have_pthread_create_glibc_2_0=yes
976AC_MSG_RESULT([yes])
977AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
978 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
979], [
980ac_have_pthread_create_glibc_2_0=no
981AC_MSG_RESULT([no])
982])
bart16e1c5a2009-04-26 07:38:53 +0000983CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000984
985AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000986 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000987
988
barta50aa8a2008-04-27 06:06:57 +0000989# Check for eventfd_t, eventfd() and eventfd_read()
990AC_MSG_CHECKING([for eventfd()])
991
992AC_TRY_LINK(
993[
994#include <sys/eventfd.h>
995], [
996 eventfd_t ev;
997 int fd;
998
999 fd = eventfd(5, 0);
1000 eventfd_read(fd, &ev);
1001 return 0;
1002],
1003[
1004AC_MSG_RESULT([yes])
1005AC_DEFINE([HAVE_EVENTFD], 1,
1006 [Define to 1 if you have the `eventfd' function.])
1007AC_DEFINE([HAVE_EVENTFD_READ], 1,
1008 [Define to 1 if you have the `eventfd_read' function.])
1009], [
1010AC_MSG_RESULT([no])
1011])
1012
1013
njn7fd6d382009-01-22 21:56:32 +00001014#----------------------------------------------------------------------------
1015# Checking for supported compiler flags.
1016#----------------------------------------------------------------------------
1017
sewardj535c50f2005-06-04 23:14:53 +00001018# does this compiler support -m32 ?
1019AC_MSG_CHECKING([if gcc accepts -m32])
1020
1021safe_CFLAGS=$CFLAGS
1022CFLAGS="-m32"
1023
1024AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001025 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001026],
1027[
1028FLAG_M32="-m32"
1029AC_MSG_RESULT([yes])
1030], [
1031FLAG_M32=""
1032AC_MSG_RESULT([no])
1033])
1034CFLAGS=$safe_CFLAGS
1035
1036AC_SUBST(FLAG_M32)
1037
1038
sewardj03d86f22006-10-17 00:57:24 +00001039# does this compiler support -maix32 ?
1040AC_MSG_CHECKING([if gcc accepts -maix32])
1041
1042safe_CFLAGS=$CFLAGS
1043CFLAGS="-maix32"
1044
1045AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001046 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001047],
1048[
1049FLAG_MAIX32="-maix32"
1050AC_MSG_RESULT([yes])
1051], [
1052FLAG_MAIX32=""
1053AC_MSG_RESULT([no])
1054])
1055CFLAGS=$safe_CFLAGS
1056
1057AC_SUBST(FLAG_MAIX32)
1058
1059
sewardj01262142006-01-04 01:20:28 +00001060# does this compiler support -m64 ?
1061AC_MSG_CHECKING([if gcc accepts -m64])
1062
1063safe_CFLAGS=$CFLAGS
1064CFLAGS="-m64"
1065
1066AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001067 return 0;
sewardj01262142006-01-04 01:20:28 +00001068],
1069[
1070FLAG_M64="-m64"
1071AC_MSG_RESULT([yes])
1072], [
1073FLAG_M64=""
1074AC_MSG_RESULT([no])
1075])
1076CFLAGS=$safe_CFLAGS
1077
1078AC_SUBST(FLAG_M64)
1079
1080
sewardj03d86f22006-10-17 00:57:24 +00001081# does this compiler support -maix64 ?
1082AC_MSG_CHECKING([if gcc accepts -maix64])
1083
1084safe_CFLAGS=$CFLAGS
1085CFLAGS="-maix64"
1086
1087AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001088 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001089],
1090[
1091FLAG_MAIX64="-maix64"
1092AC_MSG_RESULT([yes])
1093], [
1094FLAG_MAIX64=""
1095AC_MSG_RESULT([no])
1096])
1097CFLAGS=$safe_CFLAGS
1098
1099AC_SUBST(FLAG_MAIX64)
1100
1101
sewardj67f1fcc2005-07-03 10:41:02 +00001102# does this compiler support -mmmx ?
1103AC_MSG_CHECKING([if gcc accepts -mmmx])
1104
1105safe_CFLAGS=$CFLAGS
1106CFLAGS="-mmmx"
1107
1108AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001109 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001110],
1111[
1112FLAG_MMMX="-mmmx"
1113AC_MSG_RESULT([yes])
1114], [
1115FLAG_MMMX=""
1116AC_MSG_RESULT([no])
1117])
1118CFLAGS=$safe_CFLAGS
1119
1120AC_SUBST(FLAG_MMMX)
1121
1122
1123# does this compiler support -msse ?
1124AC_MSG_CHECKING([if gcc accepts -msse])
1125
1126safe_CFLAGS=$CFLAGS
1127CFLAGS="-msse"
1128
1129AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001130 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001131],
1132[
1133FLAG_MSSE="-msse"
1134AC_MSG_RESULT([yes])
1135], [
1136FLAG_MSSE=""
1137AC_MSG_RESULT([no])
1138])
1139CFLAGS=$safe_CFLAGS
1140
1141AC_SUBST(FLAG_MSSE)
1142
1143
sewardj5b754b42002-06-03 22:53:35 +00001144# does this compiler support -mpreferred-stack-boundary=2 ?
1145AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1146
daywalker3664f562003-10-17 13:43:46 +00001147safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001148CFLAGS="-mpreferred-stack-boundary=2"
1149
1150AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001151 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001152],
1153[
1154PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001155AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001156], [
1157PREFERRED_STACK_BOUNDARY=""
1158AC_MSG_RESULT([no])
1159])
daywalker3664f562003-10-17 13:43:46 +00001160CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001161
1162AC_SUBST(PREFERRED_STACK_BOUNDARY)
1163
sewardj535c50f2005-06-04 23:14:53 +00001164
sewardjb5f6f512005-03-10 23:59:00 +00001165# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001166AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001167
1168safe_CFLAGS=$CFLAGS
1169CFLAGS="-Wno-pointer-sign"
1170
1171AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001172 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001173],
1174[
1175no_pointer_sign=yes
1176AC_MSG_RESULT([yes])
1177], [
1178no_pointer_sign=no
1179AC_MSG_RESULT([no])
1180])
1181CFLAGS=$safe_CFLAGS
1182
1183if test x$no_pointer_sign = xyes; then
1184 CFLAGS="$CFLAGS -Wno-pointer-sign"
1185fi
1186
sewardj535c50f2005-06-04 23:14:53 +00001187
tom1e946682005-10-12 11:27:33 +00001188# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001189AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001190
1191safe_CFLAGS=$CFLAGS
1192CFLAGS="-Wdeclaration-after-statement"
1193
1194AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001195 return 0;
tom1e946682005-10-12 11:27:33 +00001196],
1197[
tome9814c32005-10-12 11:30:43 +00001198declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001199FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001200AC_MSG_RESULT([yes])
1201], [
tome9814c32005-10-12 11:30:43 +00001202declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001203FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001204AC_MSG_RESULT([no])
1205])
1206CFLAGS=$safe_CFLAGS
1207
sewardj72a547e2006-01-25 02:58:28 +00001208AC_SUBST(FLAG_WDECL_AFTER_STMT)
1209
tome9814c32005-10-12 11:30:43 +00001210if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001211 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1212fi
1213
sewardj00f1e622006-03-12 16:47:10 +00001214
bart82410952009-05-31 11:22:58 +00001215# does this compiler support -Wno-empty-body ?
1216
1217AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1218
1219safe_CFLAGS=$CFLAGS
1220CFLAGS="-Wno-empty-body"
1221
1222AC_TRY_COMPILE(
1223[ ],
1224[
1225 return 0;
1226],
1227[
1228AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1229AC_MSG_RESULT([yes])
1230],
1231[
1232AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1233AC_MSG_RESULT([no])
1234])
1235CFLAGS=$safe_CFLAGS
1236
1237
bart9d865fa2008-06-23 12:11:49 +00001238# does this compiler support -Wno-format-zero-length ?
1239
1240AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1241
1242safe_CFLAGS=$CFLAGS
1243CFLAGS="-Wno-format-zero-length"
1244
1245AC_TRY_COMPILE(
1246[ ],
1247[
1248 return 0;
1249],
1250[
1251AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1252AC_MSG_RESULT([yes])
1253],
1254[
1255AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1256AC_MSG_RESULT([no])
1257])
1258CFLAGS=$safe_CFLAGS
1259
1260
bart56730cd2008-05-11 06:41:46 +00001261# does this compiler support -Wextra or the older -W ?
1262
1263AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1264
1265safe_CFLAGS=$CFLAGS
1266CFLAGS="-Wextra"
1267
1268AC_TRY_COMPILE(
1269[ ],
1270[
1271 return 0;
1272],
1273[
1274AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1275AC_MSG_RESULT([-Wextra])
1276], [
1277 CFLAGS="-W"
1278 AC_TRY_COMPILE(
1279 [ ],
1280 [
1281 return 0;
1282 ],
1283 [
1284 AC_SUBST([FLAG_W_EXTRA], [-W])
1285 AC_MSG_RESULT([-W])
1286 ], [
1287 AC_SUBST([FLAG_W_EXTRA], [])
1288 AC_MSG_RESULT([not supported])
1289 ])
1290])
1291CFLAGS=$safe_CFLAGS
1292
1293
sewardja72c26d2007-05-01 13:44:08 +00001294# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001295AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001296
1297safe_CFLAGS=$CFLAGS
1298CFLAGS="-fno-stack-protector"
1299
1300AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001301 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001302],
1303[
1304no_stack_protector=yes
1305FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1306AC_MSG_RESULT([yes])
1307], [
1308no_stack_protector=no
1309FLAG_FNO_STACK_PROTECTOR=""
1310AC_MSG_RESULT([no])
1311])
1312CFLAGS=$safe_CFLAGS
1313
1314AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1315
1316if test x$no_stack_protector = xyes; then
1317 CFLAGS="$CFLAGS -fno-stack-protector"
1318fi
1319
1320
bart56730cd2008-05-11 06:41:46 +00001321# does this compiler support --param inline-unit-growth=... ?
1322
1323AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1324
1325safe_CFLAGS=$CFLAGS
1326CFLAGS="--param inline-unit-growth=900"
1327
1328AC_TRY_COMPILE(
1329[ ],
1330[
1331 return 0;
1332],
1333[
1334AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1335 ["--param inline-unit-growth=900"])
1336AC_MSG_RESULT([yes])
1337], [
1338AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1339AC_MSG_RESULT([no])
1340])
1341CFLAGS=$safe_CFLAGS
1342
1343
tomd55121e2005-12-19 12:40:13 +00001344# does this compiler support __builtin_expect?
1345AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001346
tomd55121e2005-12-19 12:40:13 +00001347AC_TRY_LINK(, [
1348return __builtin_expect(1, 1) ? 1 : 0
1349],
1350[
1351ac_have_builtin_expect=yes
1352AC_MSG_RESULT([yes])
1353], [
1354ac_have_builtin_expect=no
1355AC_MSG_RESULT([no])
1356])
1357if test x$ac_have_builtin_expect = xyes ; then
1358 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1359fi
1360
tom1e946682005-10-12 11:27:33 +00001361
sewardj00f1e622006-03-12 16:47:10 +00001362# does the ppc assembler support "mtocrf" et al?
1363AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1364
1365AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001366__asm__ __volatile__("mtocrf 4,0");
1367__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001368],
1369[
1370ac_have_as_ppc_mftocrf=yes
1371AC_MSG_RESULT([yes])
1372], [
1373ac_have_as_ppc_mftocrf=no
1374AC_MSG_RESULT([no])
1375])
1376if test x$ac_have_as_ppc_mftocrf = xyes ; then
1377 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1378fi
1379
1380
sewardjf0aabf82007-03-22 00:24:21 +00001381# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001382# Note, this doesn't generate a C-level symbol. It generates a
1383# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001384AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1385
1386AC_TRY_COMPILE(, [
1387 do { long long int x;
1388 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1389 while (0)
1390],
1391[
1392ac_have_as_sse3=yes
1393AC_MSG_RESULT([yes])
1394], [
1395ac_have_as_sse3=no
1396AC_MSG_RESULT([no])
1397])
sewardjfa18a262007-03-22 12:13:13 +00001398
1399AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001400
1401
sewardj6d6da5b2008-02-09 12:07:40 +00001402# Ditto for SSSE3 instructions (note extra S)
1403# Note, this doesn't generate a C-level symbol. It generates a
1404# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1405AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1406
1407AC_TRY_COMPILE(, [
1408 do { long long int x;
1409 __asm__ __volatile__(
1410 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1411 while (0)
1412],
1413[
1414ac_have_as_ssse3=yes
1415AC_MSG_RESULT([yes])
1416], [
1417ac_have_as_ssse3=no
1418AC_MSG_RESULT([no])
1419])
1420
1421AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1422
1423
sewardjb5f6f512005-03-10 23:59:00 +00001424# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001425if test "x${cross_compiling}" = "xno"; then
1426# Native compilation: check whether running a program using TLS succeeds.
1427# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1428# succeeds but running programs using TLS fails.
1429AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1430 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1431 [vg_cv_tls=$enableval],
1432 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1433 [[return foo;]])],
1434 [vg_cv_tls=yes],
1435 [vg_cv_tls=no])])])
1436else
1437# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001438AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1439 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1440 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001441 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001442 [[return foo;]])],
1443 [vg_cv_tls=yes],
1444 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001445fi
sewardjb5f6f512005-03-10 23:59:00 +00001446
1447if test "$vg_cv_tls" = yes; then
1448AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1449fi
sewardj5b754b42002-06-03 22:53:35 +00001450
sewardj535c50f2005-06-04 23:14:53 +00001451
njn7fd6d382009-01-22 21:56:32 +00001452#----------------------------------------------------------------------------
njnf76d27a2009-05-28 01:53:07 +00001453# Check for /proc filesystem
1454#----------------------------------------------------------------------------
1455AC_CHECK_FILES(/proc/self/fd /proc/self/exe /proc/self/maps,
1456 [ AC_DEFINE([HAVE_PROC], 1, [can use /proc filesystem]) ],
1457 [])
1458
1459
1460#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001461# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001462#----------------------------------------------------------------------------
1463
sewardjde4a1d02002-03-22 01:27:54 +00001464AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001465AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001466 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001467 endian.h \
1468 mqueue.h \
1469 sys/endian.h \
1470 sys/epoll.h \
1471 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001472 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001473 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001474 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001475 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001476 sys/syscall.h \
1477 sys/time.h \
1478 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001479 ])
sewardjde4a1d02002-03-22 01:27:54 +00001480
njn7fd6d382009-01-22 21:56:32 +00001481#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001482# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001483#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001484AC_TYPE_UID_T
1485AC_TYPE_OFF_T
1486AC_TYPE_SIZE_T
1487AC_HEADER_TIME
1488
sewardj535c50f2005-06-04 23:14:53 +00001489
njn7fd6d382009-01-22 21:56:32 +00001490#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001491# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001492#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001493AC_FUNC_MEMCMP
1494AC_FUNC_MMAP
1495AC_TYPE_SIGNAL
1496
bart71bad292008-04-27 11:43:23 +00001497AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001498
bartf5ceec82008-04-26 07:45:10 +00001499AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001500 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001501 epoll_create \
1502 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001503 floor \
bartce48fa92008-04-26 10:59:46 +00001504 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001505 mallinfo \
1506 memchr \
1507 memset \
1508 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001509 mremap \
bartf5ceec82008-04-26 07:45:10 +00001510 ppoll \
bart6d45e922009-01-20 13:45:38 +00001511 pthread_barrier_init \
1512 pthread_condattr_setclock \
1513 pthread_mutex_timedlock \
1514 pthread_rwlock_timedrdlock \
1515 pthread_rwlock_timedwrlock \
1516 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001517 semtimedop \
1518 signalfd \
njn6cc22472009-03-16 03:46:48 +00001519 sigwaitinfo \
bart71bad292008-04-27 11:43:23 +00001520 syscall \
bartf5ceec82008-04-26 07:45:10 +00001521 strchr \
1522 strdup \
1523 strpbrk \
1524 strrchr \
1525 strstr \
1526 timerfd \
1527 utimensat \
1528 ])
sewardjde4a1d02002-03-22 01:27:54 +00001529
bart623eec32008-07-29 17:54:49 +00001530# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1531# libraries with any shared object and/or executable. This is NOT what we
1532# want for e.g. vgpreload_core-x86-linux.so
1533LIBS=""
sewardj80637752006-03-02 13:48:21 +00001534
bart6d45e922009-01-20 13:45:38 +00001535AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1536 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001537AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1538 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001539AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1540 [test x$ac_cv_func_pthread_spin_lock = xyes])
1541
njn7fd6d382009-01-22 21:56:32 +00001542
1543#----------------------------------------------------------------------------
1544# MPI checks
1545#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001546# Do we have a useable MPI setup on the primary and/or secondary targets?
1547# On Linux, by default, assumes mpicc and -m32/-m64
1548# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001549# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001550# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1551# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001552MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001553if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1554 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001555 MPI_CC="mpxlc"
1556fi
1557
sewardje9fa5062006-03-12 18:29:18 +00001558mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001559if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1560 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001561 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001562elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1563 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001564 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001565elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001566 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001567elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001568 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001569fi
1570
sewardj03d86f22006-10-17 00:57:24 +00001571mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001572if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1573 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001574 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001575elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001576 mflag_secondary=-q32
1577fi
1578
1579
sewardj0ad46092006-03-02 17:09:16 +00001580AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001581 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001582 MPI_CC=$withval
1583)
sewardj03d86f22006-10-17 00:57:24 +00001584AC_SUBST(MPI_CC)
1585
1586## See if MPI_CC works for the primary target
1587##
1588AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001589saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001590saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001591CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001592CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001593AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001594#include <mpi.h>
1595#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001596],[
1597 int r = MPI_Init(NULL,NULL);
1598 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1599 return r;
1600], [
sewardj03d86f22006-10-17 00:57:24 +00001601ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001602AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001603], [
sewardj03d86f22006-10-17 00:57:24 +00001604ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001605AC_MSG_RESULT([no])
1606])
sewardj0ad46092006-03-02 17:09:16 +00001607CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001608CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001609AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001610
sewardj03d86f22006-10-17 00:57:24 +00001611## See if MPI_CC works for the secondary target. Complication: what if
1612## there is no secondary target? We need this to then fail.
1613## Kludge this by making MPI_CC something which will surely fail in
1614## such a case.
1615##
1616AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1617saved_CC=$CC
1618saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001619if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001620 CC="$MPI_CC this will surely fail"
1621else
1622 CC=$MPI_CC
1623fi
1624CFLAGS=$mflag_secondary
1625AC_TRY_LINK([
1626#include <mpi.h>
1627#include <stdio.h>
1628],[
1629 int r = MPI_Init(NULL,NULL);
1630 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1631 return r;
1632], [
1633ac_have_mpi2_sec=yes
1634AC_MSG_RESULT([yes, $MPI_CC])
1635], [
1636ac_have_mpi2_sec=no
1637AC_MSG_RESULT([no])
1638])
1639CC=$saved_CC
1640CFLAGS=$saved_CFLAGS
1641AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001642
1643
njn7fd6d382009-01-22 21:56:32 +00001644#----------------------------------------------------------------------------
1645# Other library checks
1646#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001647# There now follow some tests for QtCore, Boost, and OpenMP. These
1648# tests are present because Drd has some regression tests that use
1649# these packages. All regression test programs all compiled only
1650# for the primary target. And so it is important that the configure
1651# checks that follow, use the correct -m32 or -m64 flag for the
1652# primary target (called $mflag_primary). Otherwise, we can end up
1653# in a situation (eg) where, on amd64-linux, the test for Boost checks
1654# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1655# only build (meaning, the primary target is x86-linux), the build
1656# of the regtest programs that use Boost fails, because they are
1657# build as 32-bit (IN THIS EXAMPLE).
1658#
1659# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1660# NEEDED BY THE REGRESSION TEST PROGRAMS.
1661
1662
bart21d3cfc2008-08-02 09:08:17 +00001663# The test below verifies whether the QtCore package been installed.
1664# This test works as follows:
1665# - If pkg-config was not installed at the time autogen.sh was run,
1666# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1667# autogen.sh. Augogen.sh will generate a configure script that prints
1668# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1669# - If pkg-config was installed at the time autogen.sh was run,
1670# the generated configure script will try to detect the presence of the
1671# Qt4 QtCore library by looking up compile and linker flags in the file
1672# called QtCore.pc.
1673# - pkg-config settings can be overridden via the configure variables
1674# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1675# configure script -- see also ./configure --help).
1676# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1677# the pkg-config executable is not present on the system on which the
1678# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001679
bart21d3cfc2008-08-02 09:08:17 +00001680ifdef(
1681 [PKG_CHECK_EXISTS],
1682 [PKG_CHECK_EXISTS(
1683 [QtCore],
1684 [
1685 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001686 # Paranoia: don't trust the result reported by pkg-config, but when
1687 # pkg-config reports that QtCore has been found, verify whether linking
1688 # programs with QtCore succeeds.
1689 AC_LANG(C++)
1690 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001691 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001692 AC_TRY_LINK(
1693 [#include <QMutex>],
1694 [QMutex Mutex;],
1695 [ac_have_qtcore=yes],
1696 [
1697 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1698 ac_have_qtcore=no
1699 ]
1700 )
1701 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001702 ],
1703 [
1704 ac_have_qtcore=no
1705 ]
1706 )
1707 ],
1708 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1709 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1710 [ac_have_qtcore=no]
1711)
bart41ac62a2008-07-07 16:58:03 +00001712
1713AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1714
1715
bart62f54e42008-07-28 11:35:10 +00001716# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1717# See also http://doc.trolltech.com/4.3/qmutex.html.
1718if test x$ac_have_qtcore = xyes; then
1719 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1720 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001721 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001722 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001723 AC_TRY_COMPILE([
1724 #include <QtCore/QMutex>
1725 ],
1726 [
1727 QMutex M;
1728 M.tryLock(1);
1729 M.unlock();
1730 return 0;
1731 ],
1732 [
1733 AC_MSG_RESULT([yes])
1734 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1735 ],
1736 [
1737 AC_MSG_RESULT([no])
1738 ])
bart21d3cfc2008-08-02 09:08:17 +00001739 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001740 AC_LANG(C)
1741fi
1742
1743
sewardj493c4ef2008-12-13 16:45:19 +00001744# Check whether the boost library 1.35 or later has been installed.
1745# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1746
1747AC_MSG_CHECKING([for boost])
1748
1749AC_LANG(C++)
1750safe_CXXFLAGS=$CXXFLAGS
1751CXXFLAGS="-lboost_thread-mt $mflag_primary"
1752
1753AC_LINK_IFELSE(
1754[
1755#include <boost/thread.hpp>
1756static void thread_func(void)
1757{ }
1758int main(int argc, char** argv)
1759{
1760 boost::thread t(thread_func);
1761 return 0;
1762}
1763],
1764[
1765ac_have_boost_1_35=yes
1766AC_SUBST([BOOST_CFLAGS], [])
1767AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1768AC_MSG_RESULT([yes])
1769], [
1770ac_have_boost_1_35=no
1771AC_MSG_RESULT([no])
1772])
1773
1774CXXFLAGS=$safe_CXXFLAGS
1775AC_LANG(C)
1776
1777AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1778
1779
1780# does this compiler support -fopenmp, does it have the include file
1781# <omp.h> and does it have libgomp ?
1782
1783AC_MSG_CHECKING([for OpenMP])
1784
1785safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001786CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001787
1788AC_LINK_IFELSE(
1789[
1790#include <omp.h>
1791int main(int argc, char** argv)
1792{
1793 omp_set_dynamic(0);
1794 return 0;
1795}
1796],
1797[
1798ac_have_openmp=yes
1799AC_MSG_RESULT([yes])
1800], [
1801ac_have_openmp=no
1802AC_MSG_RESULT([no])
1803])
1804CFLAGS=$safe_CFLAGS
1805
1806AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1807
1808
sewardjc876a2f2009-01-22 22:44:30 +00001809# does this compiler have built-in functions for atomic memory access ?
1810AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1811
1812safe_CFLAGS=$CFLAGS
1813CFLAGS="$mflag_primary"
1814
1815AC_TRY_LINK(,
1816[
1817 int variable = 1;
1818 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1819 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1820],
1821[
bartc82d1372009-05-31 16:21:23 +00001822 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001823 AC_MSG_RESULT([yes])
1824 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1825],
1826[
bartc82d1372009-05-31 16:21:23 +00001827 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001828 AC_MSG_RESULT([no])
1829])
1830
1831CFLAGS=$safe_CFLAGS
1832
bartc82d1372009-05-31 16:21:23 +00001833AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1834
sewardjc876a2f2009-01-22 22:44:30 +00001835
njn7fd6d382009-01-22 21:56:32 +00001836#----------------------------------------------------------------------------
1837# Ok. We're done checking.
1838#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001839
gobrye721a522002-03-22 13:38:30 +00001840AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001841 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001842 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001843 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001844 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001845 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001846 docs/lib/Makefile
1847 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001848 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001849 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001850 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001851 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001852 perf/Makefile
1853 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001854 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001855 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001856 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001857 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001858 memcheck/Makefile
1859 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001860 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001861 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001862 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001863 memcheck/tests/darwin/Makefile
njna454ec02009-01-19 03:16:59 +00001864 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001865 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001866 memcheck/docs/Makefile
1867 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001868 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001869 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001870 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001871 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001872 callgrind/Makefile
1873 callgrind/callgrind_annotate
1874 callgrind/callgrind_control
1875 callgrind/tests/Makefile
1876 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001877 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001878 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001879 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001880 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001881 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001882 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001883 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001884 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001885 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001886 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001887 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001888 none/Makefile
1889 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001890 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001891 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001892 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001893 none/tests/x86/Makefile
njn0458a122009-02-13 06:23:46 +00001894 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001895 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001896 none/tests/x86-linux/Makefile
njn9bc8c002002-10-02 13:49:13 +00001897 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001898 exp-omega/Makefile
1899 exp-omega/tests/Makefile
1900 exp-omega/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001901 exp-ptrcheck/Makefile
1902 exp-ptrcheck/tests/Makefile
1903 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001904 drd/Makefile
1905 drd/docs/Makefile
1906 drd/scripts/download-and-build-splash2
1907 drd/tests/Makefile
bart0b2b4622008-06-17 19:19:16 +00001908)
gobry3b777892002-04-04 09:18:39 +00001909
1910cat<<EOF
1911
njn311303f2009-02-06 03:46:50 +00001912 Maximum build arch: ${ARCH_MAX}
1913 Primary build arch: ${VGCONF_ARCH_PRI}
1914 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001915 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1916 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001917 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001918
gobry3b777892002-04-04 09:18:39 +00001919EOF